import * as i0 from '@angular/core';
import { input, booleanAttribute, output, inject, ElementRef, Injector, runInInjectionContext, effect, ChangeDetectionStrategy, Component } from '@angular/core';
import '@ui5/webcomponents/dist/Calendar.js';

class Calendar {
    constructor() {
        /**
         * Defines the type of selection used in the calendar component.
      Accepted property values are:
      
      - `CalendarSelectionMode.Single` - enables a single date selection.(default value)
      - `CalendarSelectionMode.Range` - enables selection of a date range.
      - `CalendarSelectionMode.Multiple` - enables selection of multiple dates.
         */
        this.selectionMode = input("Single", ...(ngDevMode ? [{ debugName: "selectionMode" }] : []));
        /**
         * Defines the visibility of the week numbers column.
      
      **Note:** For calendars other than Gregorian,
      the week numbers are not displayed regardless of what is set.
         */
        this.hideWeekNumbers = input(false, ...(ngDevMode ? [{ debugName: "hideWeekNumbers", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Sets a calendar type used for display.
      If not set, the calendar type of the global configuration is used.
         */
        this.primaryCalendarType = input(...(ngDevMode ? [undefined, { debugName: "primaryCalendarType" }] : []));
        /**
         * Defines the secondary calendar type.
      If not set, the calendar will only show the primary calendar type.
         */
        this.secondaryCalendarType = input(...(ngDevMode ? [undefined, { debugName: "secondaryCalendarType" }] : []));
        /**
         * Determines the format, displayed in the input field.
         */
        this.formatPattern = input(...(ngDevMode ? [undefined, { debugName: "formatPattern" }] : []));
        /**
         * Determines the format, displayed in the input field.
         */
        this.displayFormat = input(...(ngDevMode ? [undefined, { debugName: "displayFormat" }] : []));
        /**
         * Determines the format, used for the value attribute.
         */
        this.valueFormat = input(...(ngDevMode ? [undefined, { debugName: "valueFormat" }] : []));
        /**
         * Determines the minimum date available for selection.
      
      **Note:** If the formatPattern property is not set, the minDate value must be provided in the ISO date format (yyyy-MM-dd).
         */
        this.minDate = input("", ...(ngDevMode ? [{ debugName: "minDate" }] : []));
        /**
         * Determines the maximum date available for selection.
      
      **Note:** If the formatPattern property is not set, the maxDate value must be provided in the ISO date format (yyyy-MM-dd).
         */
        this.maxDate = input("", ...(ngDevMode ? [{ debugName: "maxDate" }] : []));
        /**
         * Defines how to calculate calendar weeks and first day of the week.
      If not set, the calendar will be displayed according to the currently set global configuration.
         */
        this.calendarWeekNumbering = input("Default", ...(ngDevMode ? [{ debugName: "calendarWeekNumbering" }] : [])); // className is now passed
        /**
         * Fired when the selected dates change.
      
      **Note:** If you call `preventDefault()` for this event, the component will not
      create instances of `ui5-date` for the newly selected dates. In that case you should do this manually.
         */
        this.ui5SelectionChange = output();
        /**
         * Available slots for content projection in this component.
         *
         * Slots allow you to insert custom content into predefined areas of the web component.
         * Use the `slot` attribute on child elements to target specific slots.
         *
         * - **calendarLegend**: Defines the calendar legend of the component.
         * - **(default)**: Defines the selected date or dates (depending on the `selectionMode` property)
      for this calendar as instances of `ui5-date` or `ui5-date-range`.
      Use `ui5-date` for single or multiple selection, and `ui5-date-range` for range selection.
         * - **specialDates**: Defines the special dates, visually emphasized in the calendar.
         * - **disabledDates**: Defines the disabled date ranges that cannot be selected in the calendar.
      Use `ui5-date-range` elements to specify ranges of disabled dates.
      Each range can define a start date, an end date, or both.
         *
         * @example
         * ```html
         * <ui5-calendar>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-calendar>
         * ```
         *
         * @readonly
         * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}
         */
        this.slots = [
            {
                "name": "calendarLegend",
                "description": "Defines the calendar legend of the component.",
                "since": "1.23.0"
            },
            {
                "name": "default",
                "description": "Defines the selected date or dates (depending on the `selectionMode` property)\nfor this calendar as instances of `ui5-date` or `ui5-date-range`.\nUse `ui5-date` for single or multiple selection, and `ui5-date-range` for range selection."
            },
            {
                "name": "specialDates",
                "description": "Defines the special dates, visually emphasized in the calendar.",
                "since": "1.23.0"
            },
            {
                "name": "disabledDates",
                "description": "Defines the disabled date ranges that cannot be selected in the calendar.\nUse `ui5-date-range` elements to specify ranges of disabled dates.\nEach range can define a start date, an end date, or both.",
                "since": "2.16.0"
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'selectionMode',
            'hideWeekNumbers',
            'primaryCalendarType',
            'secondaryCalendarType',
            'formatPattern',
            'displayFormat',
            'valueFormat',
            'minDate',
            'maxDate',
            'calendarWeekNumbering',
        ];
        // Synchronize inputs (properties)
        for (const inputName of inputsToSync) {
            // Find the corresponding camelCase signal property on the Angular component
            const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
            // Use the Injector to run the effect in the correct context
            if (this[signalName] && typeof this[signalName] === 'function') {
                runInInjectionContext(this.injector, () => {
                    effect(() => {
                        // Read the signal value
                        const value = this[signalName]();
                        if (wcElement) {
                            // Write the value to the Web Component's property
                            wcElement[inputName] = value;
                        }
                    });
                });
            }
        }
        const outputsToSync = [
            'ui5SelectionChange',
        ];
        // Synchronize outputs (events)
        for (const outputName of outputsToSync) {
            // Map Angular output name to UI5 web component event name
            const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);
            // Ensure the output property exists and has an emit function before adding listener
            if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {
                // Cast the listener to the correct type to satisfy TypeScript
                wcElement.addEventListener(eventName, (e) => {
                    this[outputName].emit(e);
                });
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Calendar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Calendar, isStandalone: true, selector: "ui5-calendar, [ui5-calendar]", inputs: { selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, hideWeekNumbers: { classPropertyName: "hideWeekNumbers", publicName: "hideWeekNumbers", isSignal: true, isRequired: false, transformFunction: null }, primaryCalendarType: { classPropertyName: "primaryCalendarType", publicName: "primaryCalendarType", isSignal: true, isRequired: false, transformFunction: null }, secondaryCalendarType: { classPropertyName: "secondaryCalendarType", publicName: "secondaryCalendarType", isSignal: true, isRequired: false, transformFunction: null }, formatPattern: { classPropertyName: "formatPattern", publicName: "formatPattern", isSignal: true, isRequired: false, transformFunction: null }, displayFormat: { classPropertyName: "displayFormat", publicName: "displayFormat", isSignal: true, isRequired: false, transformFunction: null }, valueFormat: { classPropertyName: "valueFormat", publicName: "valueFormat", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, calendarWeekNumbering: { classPropertyName: "calendarWeekNumbering", publicName: "calendarWeekNumbering", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5SelectionChange: "ui5SelectionChange" }, exportAs: ["ui5Calendar"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Calendar, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-calendar, [ui5-calendar]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5Calendar',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { Calendar };
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-calendar.mjs.map
