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

class MenuItem {
    constructor() {
        /**
         * Defines the text of the tree item.
         */
        this.text = input(...(ngDevMode ? [undefined, { debugName: "text" }] : []));
        /**
         * Defines the `additionalText`, displayed in the end of the menu item.
      
      **Note:** The additional text will not be displayed if there are items added in `items` slot or there are
      components added to `endContent` slot.
      
      The priority of what will be displayed at the end of the menu item is as follows:
      sub-menu arrow (if there are items added in `items` slot) -> components added in `endContent` -> text set to `additionalText`.
         */
        this.additionalText = input(...(ngDevMode ? [undefined, { debugName: "additionalText" }] : []));
        /**
         * Defines the icon to be displayed as graphical element within the component.
      The SAP-icons font provides numerous options.
      
      **Example:**
      
      See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
         */
        this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
        /**
         * Defines whether menu item is in disabled state.
      
      **Note:** A disabled menu item is noninteractive.
         */
        this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the delay in milliseconds, after which the loading indicator will be displayed inside the corresponding menu popover.
      
      **Note:** If set to `true` a busy indicator component will be displayed into the related one to the current menu item sub-menu popover.
         */
        this.loading = input(false, ...(ngDevMode ? [{ debugName: "loading", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the delay in milliseconds, after which the loading indicator will be displayed inside the corresponding menu popover.
         */
        this.loadingDelay = input(1000, ...(ngDevMode ? [{ debugName: "loadingDelay" }] : []));
        /**
         * Defines the accessible ARIA name of the component.
         */
        this.accessibleName = input(...(ngDevMode ? [undefined, { debugName: "accessibleName" }] : []));
        /**
         * Defines the text of the tooltip for the menu item.
         */
        this.tooltip = input(...(ngDevMode ? [undefined, { debugName: "tooltip" }] : []));
        /**
         * Defines whether menu item is in checked state.
      
      **Note:** checked state is only taken into account when menu item is added to menu item group
      with `checkMode` other than `None`.
      
      **Note:** A checked menu item has a checkmark displayed at its end.
         */
        this.checked = input(false, ...(ngDevMode ? [{ debugName: "checked", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the additional accessibility attributes that will be applied to the component.
      The following fields are supported:
      
      - **ariaKeyShortcuts**: Indicated the availability of a keyboard shortcuts defined for the menu item.
      
      - **role**: Defines the role of the menu item. If not set, menu item will have default role="menuitem".
         */
        this.accessibilityAttributes = input({}, ...(ngDevMode ? [{ debugName: "accessibilityAttributes" }] : []));
        /**
         * Defines the visual indication and behavior of the list items.
      Available options are `Active` (by default), `Inactive`, `Detail` and `Navigation`.
      
      **Note:** When set to `Active` or `Navigation`, the item will provide visual response upon press and hover,
      while with type `Inactive` and `Detail` - will not.
         */
        this.type = input("Active", ...(ngDevMode ? [{ debugName: "type" }] : []));
        /**
         * The navigated state of the list item.
      If set to `true`, a navigation indicator is displayed at the end of the list item.
         */
        this.navigated = input(false, ...(ngDevMode ? [{ debugName: "navigated", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the highlight state of the list items.
      Available options are: `"None"` (by default), `"Positive"`, `"Critical"`, `"Information"` and `"Negative"`.
         */
        this.highlight = input("None", ...(ngDevMode ? [{ debugName: "highlight" }] : []));
        /**
         * Defines the selected state of the component.
         */
        this.selected = input(false, ...(ngDevMode ? [{ debugName: "selected", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
        /**
         * Fired before the menu is opened. This event can be cancelled, which will prevent the menu from opening.
      
      **Note:** Since 1.14.0 the event is also fired before a sub-menu opens.
         */
        this.ui5BeforeOpen = output();
        /**
         * Fired after the menu is opened.
         */
        this.ui5Open = output();
        /**
         * Fired before the menu is closed. This event can be cancelled, which will prevent the menu from closing.
         */
        this.ui5BeforeClose = output();
        /**
         * Fired after the menu is closed.
         */
        this.ui5Close = output();
        /**
         * Fired when an item is checked or unchecked.
         */
        this.ui5Check = output();
        /**
         * Fired when the user clicks on the detail button when type is `Detail`.
         */
        this.ui5DetailClick = 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 this component.
      
      **Note:** The slot can hold menu item and menu separator items.
      
      If there are items added to this slot, an arrow will be displayed at the end
      of the item in order to indicate that there are items added. In that case components added
      to `endContent` slot or `additionalText` content will not be displayed.
      
      The priority of what will be displayed at the end of the menu item is as follows:
      sub-menu arrow (if there are items added in `items` slot) -> components added in `endContent` -> text set to `additionalText`.
         * - **endContent**: Defines the components that should be displayed at the end of the menu item.
      
      **Note:** It is highly recommended to slot only components of type `ui5-button`,`ui5-link`
      or `ui5-icon` in order to preserve the intended design. If there are components added to this slot,
      and there is text set in `additionalText`, it will not be displayed. If there are items added to `items` slot,
      nether `additionalText` nor components added to this slot would be displayed.
      
      The priority of what will be displayed at the end of the menu item is as follows:
      sub-menu arrow (if there are items added in `items` slot) -> components added in `endContent` -> text set to `additionalText`.
      
      Application developers are responsible for ensuring that interactive elements placed in the `endContent` slot
      have the correct accessibility behaviour, including their enabled or disabled states.
      The menu does not manage these aspects when the menu item state changes.
         * - **deleteButton**: Defines the delete button, displayed in "Delete" mode.
      **Note:** While the slot allows custom buttons, to match
      design guidelines, please use the `ui5-button` component.
      **Note:** When the slot is not present, a built-in delete button will be displayed.
         *
         * @example
         * ```html
         * <ui5-menu-item>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-menu-item>
         * ```
         *
         * @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 this component.\n\n**Note:** The slot can hold menu item and menu separator items.\n\nIf there are items added to this slot, an arrow will be displayed at the end\nof the item in order to indicate that there are items added. In that case components added\nto `endContent` slot or `additionalText` content will not be displayed.\n\nThe priority of what will be displayed at the end of the menu item is as follows:\nsub-menu arrow (if there are items added in `items` slot) -> components added in `endContent` -> text set to `additionalText`."
            },
            {
                "name": "endContent",
                "description": "Defines the components that should be displayed at the end of the menu item.\n\n**Note:** It is highly recommended to slot only components of type `ui5-button`,`ui5-link`\nor `ui5-icon` in order to preserve the intended design. If there are components added to this slot,\nand there is text set in `additionalText`, it will not be displayed. If there are items added to `items` slot,\nnether `additionalText` nor components added to this slot would be displayed.\n\nThe priority of what will be displayed at the end of the menu item is as follows:\nsub-menu arrow (if there are items added in `items` slot) -> components added in `endContent` -> text set to `additionalText`.\n\nApplication developers are responsible for ensuring that interactive elements placed in the `endContent` slot\nhave the correct accessibility behaviour, including their enabled or disabled states.\nThe menu does not manage these aspects when the menu item state changes.",
                "since": "2.0.0"
            },
            {
                "name": "deleteButton",
                "description": "Defines the delete button, displayed in \"Delete\" mode.\n**Note:** While the slot allows custom buttons, to match\ndesign guidelines, please use the `ui5-button` component.\n**Note:** When the slot is not present, a built-in delete button will be displayed.",
                "since": "1.9.0"
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'text',
            'additionalText',
            'icon',
            'disabled',
            'loading',
            'loadingDelay',
            'accessibleName',
            'tooltip',
            'checked',
            'accessibilityAttributes',
            'type',
            'navigated',
            'highlight',
            'selected',
        ];
        // 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 = [
            'ui5BeforeOpen',
            'ui5Open',
            'ui5BeforeClose',
            'ui5Close',
            'ui5Check',
            'ui5DetailClick',
        ];
        // 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: MenuItem, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: MenuItem, isStandalone: true, selector: "ui5-menu-item, [ui5-menu-item]", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, additionalText: { classPropertyName: "additionalText", publicName: "additionalText", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", 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 }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, accessibilityAttributes: { classPropertyName: "accessibilityAttributes", publicName: "accessibilityAttributes", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, navigated: { classPropertyName: "navigated", publicName: "navigated", isSignal: true, isRequired: false, transformFunction: null }, highlight: { classPropertyName: "highlight", publicName: "highlight", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5BeforeOpen: "ui5BeforeOpen", ui5Open: "ui5Open", ui5BeforeClose: "ui5BeforeClose", ui5Close: "ui5Close", ui5Check: "ui5Check", ui5DetailClick: "ui5DetailClick" }, exportAs: ["ui5MenuItem"], 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: MenuItem, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-menu-item, [ui5-menu-item]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5MenuItem',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

export { MenuItem };
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-menu-item.mjs.map
