/*
 * Copyright (c) 2016-2025 Broadcom. All Rights Reserved.
 * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
 * This software is released under MIT license.
 * The full license information can be found in LICENSE in the root directory of this project.
 */
import { Component } from '@angular/core';
import { DatepickerFocusService } from './providers/datepicker-focus.service';
import * as i0 from "@angular/core";
import * as i1 from "../../utils/i18n/common-strings.service";
import * as i2 from "./providers/view-manager.service";
import * as i3 from "./providers/date-navigation.service";
import * as i4 from "./providers/date-io.service";
import * as i5 from "@angular/common";
import * as i6 from "../../layout/vertical-nav/vertical-nav";
import * as i7 from "../../layout/vertical-nav/vertical-nav-link";
import * as i8 from "./monthpicker";
import * as i9 from "./yearpicker";
import * as i10 from "./daypicker";
import * as i11 from "./datepicker-action-buttons";
export class ClrDatepickerViewManager {
    constructor(commonStrings, viewManagerService, dateNavigationService, dateIOService) {
        this.commonStrings = commonStrings;
        this.viewManagerService = viewManagerService;
        this.dateNavigationService = dateNavigationService;
        this.dateIOService = dateIOService;
    }
    /**
     * Returns if the current view is the monthpicker.
     */
    get isMonthView() {
        return this.viewManagerService.isMonthView;
    }
    /**
     * Returns if the current view is the yearpicker.
     */
    get isYearView() {
        return this.viewManagerService.isYearView;
    }
    /**
     * Returns if the current view is the daypicker.
     */
    get isDayView() {
        return this.viewManagerService.isDayView;
    }
    get hasRangeOptions() {
        return !!this.dateNavigationService?.isRangePicker && !!this.dateRangeOptions?.length;
    }
    get hasActionButtons() {
        return this.dateNavigationService.hasActionButtons;
    }
    get dateRangeOptions() {
        return this.dateIOService.getRangeOptions();
    }
    onRangeOptionSelect(selectedRange) {
        const startDate = this.dateNavigationService.convertDateToDayModel(selectedRange?.value[0]), endDate = this.dateNavigationService.convertDateToDayModel(selectedRange?.value[1]);
        this.dateNavigationService.notifySelectedDayChanged({ startDate, endDate }, { emitEvent: !this.hasActionButtons });
        this.dateNavigationService.moveToSpecificMonth(startDate);
    }
}
ClrDatepickerViewManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrDatepickerViewManager, deps: [{ token: i1.ClrCommonStringsService }, { token: i2.ViewManagerService }, { token: i3.DateNavigationService }, { token: i4.DateIOService }], target: i0.ɵɵFactoryTarget.Component });
ClrDatepickerViewManager.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.2", type: ClrDatepickerViewManager, selector: "clr-datepicker-view-manager", host: { attributes: { "role": "dialog" }, properties: { "class.datepicker": "true", "class.has-range-option": "hasRangeOptions", "class.has-action-buttons": "hasActionButtons", "attr.aria-modal": "true", "attr.aria-label": "commonStrings.keys.datepickerDialogLabel" } }, providers: [DatepickerFocusService], ngImport: i0, template: "<!--\n  ~ Copyright (c) 2016-2025 Broadcom. All Rights Reserved.\n  ~ The term \"Broadcom\" refers to Broadcom Inc. and/or its subsidiaries.\n  ~ This software is released under MIT license.\n  ~ The full license information can be found in LICENSE in the root directory of this project.\n-->\n\n<ng-container *ngIf=\"hasRangeOptions; else calendarView\">\n  <clr-vertical-nav class=\"clr-date-range-picker-nav\">\n    <ng-container *ngFor=\"let option of dateRangeOptions\">\n      <a\n        clrVerticalNavLink\n        href=\"javascript:void(0)\"\n        [attr.aria-label]=\"option?.label\"\n        tabindex=\"0\"\n        (keyup.enter)=\"onRangeOptionSelect(option)\"\n        (click)=\"onRangeOptionSelect(option)\"\n      >\n        {{option.label}}\n      </a>\n    </ng-container>\n  </clr-vertical-nav>\n\n  <ng-container *ngTemplateOutlet=\"calendarView\"></ng-container>\n</ng-container>\n\n<ng-template #calendarView>\n  <div class=\"datepicker-view-manager\">\n    <clr-monthpicker *ngIf=\"isMonthView\"></clr-monthpicker>\n    <clr-yearpicker *ngIf=\"isYearView\"></clr-yearpicker>\n    <clr-daypicker *ngIf=\"isDayView\"></clr-daypicker>\n    <clr-datepicker-actions *ngIf=\"hasActionButtons\"></clr-datepicker-actions>\n  </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i6.ClrVerticalNav, selector: "clr-vertical-nav", inputs: ["clrVerticalNavToggleLabel", "clrVerticalNavCollapsible", "clrVerticalNavCollapsed"], outputs: ["clrVerticalNavCollapsedChange"] }, { kind: "component", type: i7.ClrVerticalNavLink, selector: "[clrVerticalNavLink]" }, { kind: "component", type: i8.ClrMonthpicker, selector: "clr-monthpicker" }, { kind: "component", type: i9.ClrYearpicker, selector: "clr-yearpicker" }, { kind: "component", type: i10.ClrDaypicker, selector: "clr-daypicker" }, { kind: "component", type: i11.ClrDatepickerActions, selector: "clr-datepicker-actions" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.2", ngImport: i0, type: ClrDatepickerViewManager, decorators: [{
            type: Component,
            args: [{ selector: 'clr-datepicker-view-manager', providers: [DatepickerFocusService], host: {
                        '[class.datepicker]': 'true',
                        '[class.has-range-option]': 'hasRangeOptions',
                        '[class.has-action-buttons]': 'hasActionButtons',
                        '[attr.aria-modal]': 'true',
                        '[attr.aria-label]': 'commonStrings.keys.datepickerDialogLabel',
                        role: 'dialog',
                    }, template: "<!--\n  ~ Copyright (c) 2016-2025 Broadcom. All Rights Reserved.\n  ~ The term \"Broadcom\" refers to Broadcom Inc. and/or its subsidiaries.\n  ~ This software is released under MIT license.\n  ~ The full license information can be found in LICENSE in the root directory of this project.\n-->\n\n<ng-container *ngIf=\"hasRangeOptions; else calendarView\">\n  <clr-vertical-nav class=\"clr-date-range-picker-nav\">\n    <ng-container *ngFor=\"let option of dateRangeOptions\">\n      <a\n        clrVerticalNavLink\n        href=\"javascript:void(0)\"\n        [attr.aria-label]=\"option?.label\"\n        tabindex=\"0\"\n        (keyup.enter)=\"onRangeOptionSelect(option)\"\n        (click)=\"onRangeOptionSelect(option)\"\n      >\n        {{option.label}}\n      </a>\n    </ng-container>\n  </clr-vertical-nav>\n\n  <ng-container *ngTemplateOutlet=\"calendarView\"></ng-container>\n</ng-container>\n\n<ng-template #calendarView>\n  <div class=\"datepicker-view-manager\">\n    <clr-monthpicker *ngIf=\"isMonthView\"></clr-monthpicker>\n    <clr-yearpicker *ngIf=\"isYearView\"></clr-yearpicker>\n    <clr-daypicker *ngIf=\"isDayView\"></clr-daypicker>\n    <clr-datepicker-actions *ngIf=\"hasActionButtons\"></clr-datepicker-actions>\n  </div>\n</ng-template>\n" }]
        }], ctorParameters: function () { return [{ type: i1.ClrCommonStringsService }, { type: i2.ViewManagerService }, { type: i3.DateNavigationService }, { type: i4.DateIOService }]; } });
//# sourceMappingURL=data:application/json;base64, 