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

class List {
    constructor() {
        /**
         * Defines the component header text.
      
      **Note:** If `header` is set this property is ignored.
         */
        this.headerText = input(...(ngDevMode ? [undefined, { debugName: "headerText" }] : []));
        /**
         * Defines the footer text.
         */
        this.footerText = input(...(ngDevMode ? [undefined, { debugName: "footerText" }] : []));
        /**
         * Determines whether the component is indented.
         */
        this.indent = input(false, ...(ngDevMode ? [{ debugName: "indent", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the selection mode of the component.
         */
        this.selectionMode = input("None", ...(ngDevMode ? [{ debugName: "selectionMode" }] : []));
        /**
         * Defines the text that is displayed when the component contains no items.
         */
        this.noDataText = input(...(ngDevMode ? [undefined, { debugName: "noDataText" }] : []));
        /**
         * Defines the item separator style that is used.
         */
        this.separators = input("All", ...(ngDevMode ? [{ debugName: "separators" }] : []));
        /**
         * Defines whether the component will have growing capability either by pressing a `More` button,
      or via user scroll. In both cases `load-more` event is fired.
      
      **Restrictions:** `growing="Scroll"` is not supported for Internet Explorer,
      on IE the component will fallback to `growing="Button"`.
         */
        this.growing = input("None", ...(ngDevMode ? [{ debugName: "growing" }] : []));
        /**
         * Defines the text that will be displayed inside the growing button.
      
      **Note:** If not specified a built-in text will be displayed.
      
      **Note:** This property takes effect if the `growing` property is set to the `Button`.
         */
        this.growingButtonText = input(...(ngDevMode ? [undefined, { debugName: "growingButtonText" }] : []));
        /**
         * Defines if the component would display a loading indicator over the list.
         */
        this.loading = input(false, ...(ngDevMode ? [{ debugName: "loading", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the delay in milliseconds, after which the loading indicator will show up for this component.
         */
        this.loadingDelay = input(1000, ...(ngDevMode ? [{ debugName: "loadingDelay" }] : []));
        /**
         * Defines the accessible name of the component.
         */
        this.accessibleName = input(...(ngDevMode ? [undefined, { debugName: "accessibleName" }] : []));
        /**
         * Defines additional accessibility attributes on different areas of the component.
      
      The accessibilityAttributes object has the following field:
      
       - **growingButton**: `growingButton.name`, `growingButton.description`.
      
       The accessibility attributes support the following values:
      
      - **name**: Defines the accessible ARIA name of the growing button.
      Accepts any string.
      
      - **description**: Defines the accessible ARIA description of the growing button.
      Accepts any string.
      
       **Note:** The `accessibilityAttributes` property is in an experimental state and is a subject to change.
         */
        this.accessibilityAttributes = input({}, ...(ngDevMode ? [{ debugName: "accessibilityAttributes" }] : []));
        /**
         * Defines the IDs of the elements that label the component.
         */
        this.accessibleNameRef = input(...(ngDevMode ? [undefined, { debugName: "accessibleNameRef" }] : []));
        /**
         * Defines the accessible description of the component.
         */
        this.accessibleDescription = input(...(ngDevMode ? [undefined, { debugName: "accessibleDescription" }] : []));
        /**
         * Defines the IDs of the elements that describe the component.
         */
        this.accessibleDescriptionRef = input(...(ngDevMode ? [undefined, { debugName: "accessibleDescriptionRef" }] : []));
        /**
         * Defines the accessible role of the component.
         */
        this.accessibleRole = input("List", ...(ngDevMode ? [{ debugName: "accessibleRole" }] : [])); // className is now passed
        /**
         * Fired when an item is activated, unless the item's `type` property
      is set to `Inactive`.
      
      **Note**: This event is not triggered by interactions with selection components such as the checkboxes and radio buttons,
      associated with non-default `selectionMode` values, or if any other **interactive** component
      (such as a button or input) within the list item is directly clicked.
         */
        this.ui5ItemClick = output();
        /**
         * Fired when the `Close` button of any item is clicked
      
      **Note:** This event is only applicable to list items that can be closed (such as notification list items),
      not to be confused with `item-delete`.
         */
        this.ui5ItemClose = output();
        /**
         * Fired when the `Toggle` button of any item is clicked.
      
      **Note:** This event is only applicable to list items that can be toggled (such as notification group list items).
         */
        this.ui5ItemToggle = output();
        /**
         * Fired when the Delete button of any item is pressed.
      
      **Note:** A Delete button is displayed on each item,
      when the component `selectionMode` property is set to `Delete`.
         */
        this.ui5ItemDelete = output();
        /**
         * Fired when selection is changed by user interaction
      in `Single`, `SingleStart`, `SingleEnd` and `Multiple` selection modes.
         */
        this.ui5SelectionChange = output();
        /**
         * Fired when the user scrolls to the bottom of the list.
      
      **Note:** The event is fired when the `growing='Scroll'` property is enabled.
         */
        this.ui5LoadMore = output();
        /**
         * Fired when a movable list item is moved over a potential drop target during a dragging operation.
      
      If the new position is valid, prevent the default action of the event using `preventDefault()`.
         */
        this.ui5MoveOver = output();
        /**
         * Fired when a movable list item is dropped onto a drop target.
      
      **Note:** `move` event is fired only if there was a preceding `move-over` with prevented default action.
         */
        this.ui5Move = 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.
         *
         * - **(default)**: Defines the items of the component.
      
      **Note:** Use `ui5-li`, `ui5-li-custom`, and `ui5-li-group` for the intended design.
         * - **header**: Defines the component header.
      
      **Note:** When `header` is set, the
      `headerText` property is ignored.
         *
         * @example
         * ```html
         * <ui5-list>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-list>
         * ```
         *
         * @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": "default",
                "description": "Defines the items of the component.\n\n**Note:** Use `ui5-li`, `ui5-li-custom`, and `ui5-li-group` for the intended design."
            },
            {
                "name": "header",
                "description": "Defines the component header.\n\n**Note:** When `header` is set, the\n`headerText` property is ignored."
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    /**
     * Returns an array containing the list item instances without the groups in a flat structure.
     * @readonly This property is managed by the web component.
     */
    get listItems() {
        return this.element?.listItems ?? [];
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'headerText',
            'footerText',
            'indent',
            'selectionMode',
            'noDataText',
            'separators',
            'growing',
            'growingButtonText',
            'loading',
            'loadingDelay',
            'accessibleName',
            'accessibilityAttributes',
            'accessibleNameRef',
            'accessibleDescription',
            'accessibleDescriptionRef',
            'accessibleRole',
        ];
        // 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 = [
            'ui5ItemClick',
            'ui5ItemClose',
            'ui5ItemToggle',
            'ui5ItemDelete',
            'ui5SelectionChange',
            'ui5LoadMore',
            'ui5MoveOver',
            'ui5Move',
        ];
        // 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: List, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: List, isStandalone: true, selector: "ui5-list, [ui5-list]", inputs: { headerText: { classPropertyName: "headerText", publicName: "headerText", isSignal: true, isRequired: false, transformFunction: null }, footerText: { classPropertyName: "footerText", publicName: "footerText", isSignal: true, isRequired: false, transformFunction: null }, indent: { classPropertyName: "indent", publicName: "indent", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, noDataText: { classPropertyName: "noDataText", publicName: "noDataText", isSignal: true, isRequired: false, transformFunction: null }, separators: { classPropertyName: "separators", publicName: "separators", isSignal: true, isRequired: false, transformFunction: null }, growing: { classPropertyName: "growing", publicName: "growing", isSignal: true, isRequired: false, transformFunction: null }, growingButtonText: { classPropertyName: "growingButtonText", publicName: "growingButtonText", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, loadingDelay: { classPropertyName: "loadingDelay", publicName: "loadingDelay", isSignal: true, isRequired: false, transformFunction: null }, accessibleName: { classPropertyName: "accessibleName", publicName: "accessibleName", isSignal: true, isRequired: false, transformFunction: null }, accessibilityAttributes: { classPropertyName: "accessibilityAttributes", publicName: "accessibilityAttributes", isSignal: true, isRequired: false, transformFunction: null }, accessibleNameRef: { classPropertyName: "accessibleNameRef", publicName: "accessibleNameRef", isSignal: true, isRequired: false, transformFunction: null }, accessibleDescription: { classPropertyName: "accessibleDescription", publicName: "accessibleDescription", isSignal: true, isRequired: false, transformFunction: null }, accessibleDescriptionRef: { classPropertyName: "accessibleDescriptionRef", publicName: "accessibleDescriptionRef", isSignal: true, isRequired: false, transformFunction: null }, accessibleRole: { classPropertyName: "accessibleRole", publicName: "accessibleRole", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5ItemClick: "ui5ItemClick", ui5ItemClose: "ui5ItemClose", ui5ItemToggle: "ui5ItemToggle", ui5ItemDelete: "ui5ItemDelete", ui5SelectionChange: "ui5SelectionChange", ui5LoadMore: "ui5LoadMore", ui5MoveOver: "ui5MoveOver", ui5Move: "ui5Move" }, exportAs: ["ui5List"], 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: List, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-list, [ui5-list]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5List',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

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