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

class Tree {
    constructor() {
        /**
         * Defines the selection mode of the component. Since the tree uses a `ui5-list` to display its structure,
      the tree modes are exactly the same as the list modes, and are all applicable.
         */
        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 component header text.
      
      **Note:** If the `header` slot is set, this property is ignored.
         */
        this.headerText = input(...(ngDevMode ? [undefined, { debugName: "headerText" }] : []));
        /**
         * Defines the component footer text.
         */
        this.footerText = input(...(ngDevMode ? [undefined, { debugName: "footerText" }] : []));
        /**
         * Defines the accessible name of the component.
         */
        this.accessibleName = input(...(ngDevMode ? [undefined, { debugName: "accessibleName" }] : []));
        /**
         * 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" }] : [])); // className is now passed
        /**
         * Fired when a tree item is expanded or collapsed.
      
      **Note:** You can call `preventDefault()` on the event object to suppress the event, if needed.
      This may be handy for example if you want to dynamically load tree items upon the user expanding a node.
      Even if you prevented the event's default behavior, you can always manually call `toggle()` on a tree item.
         */
        this.ui5ItemToggle = output();
        /**
         * Fired when the mouse cursor enters the tree item borders.
         */
        this.ui5ItemMouseover = output();
        /**
         * Fired when the mouse cursor leaves the tree item borders.
         */
        this.ui5ItemMouseout = output();
        /**
         * Fired when a tree item is activated.
         */
        this.ui5ItemClick = output();
        /**
         * Fired when the Delete button of any tree 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` modes.
         */
        this.ui5SelectionChange = output();
        /**
         * Fired when a movable tree item is moved over a potential drop target during a drag-and-drop operation.
      
      If the new position is valid, prevent the default action of the event using `preventDefault()`.
         */
        this.ui5Move = output();
        /**
         * Fired when a movable tree item is dropped onto a drop target.
      
      **Note:** The `move` event is fired only if there was a preceding `move-over` event with prevented default action.
         */
        this.ui5MoveOver = 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. Tree items may have other tree items as children.
      
      **Note:** Use `ui5-tree-item` for the intended design.
         * - **header**: Defines the component header.
      
      **Note:** When the `header` slot is set, the
      `headerText` property is ignored.
         *
         * @example
         * ```html
         * <ui5-tree>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-tree>
         * ```
         *
         * @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. Tree items may have other tree items as children.\n\n**Note:** Use `ui5-tree-item` for the intended design."
            },
            {
                "name": "header",
                "description": "Defines the component header.\n\n**Note:** When the `header` slot is set, the\n`headerText` property is ignored."
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'selectionMode',
            'noDataText',
            'headerText',
            'footerText',
            'accessibleName',
            'accessibleNameRef',
            'accessibleDescription',
            'accessibleDescriptionRef',
        ];
        // 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 = [
            'ui5ItemToggle',
            'ui5ItemMouseover',
            'ui5ItemMouseout',
            'ui5ItemClick',
            'ui5ItemDelete',
            'ui5SelectionChange',
            'ui5Move',
            'ui5MoveOver',
        ];
        // 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: Tree, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Tree, isStandalone: true, selector: "ui5-tree, [ui5-tree]", inputs: { selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, noDataText: { classPropertyName: "noDataText", publicName: "noDataText", isSignal: true, isRequired: false, transformFunction: null }, headerText: { classPropertyName: "headerText", publicName: "headerText", isSignal: true, isRequired: false, transformFunction: null }, footerText: { classPropertyName: "footerText", publicName: "footerText", isSignal: true, isRequired: false, transformFunction: null }, accessibleName: { classPropertyName: "accessibleName", publicName: "accessibleName", 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 } }, outputs: { ui5ItemToggle: "ui5ItemToggle", ui5ItemMouseover: "ui5ItemMouseover", ui5ItemMouseout: "ui5ItemMouseout", ui5ItemClick: "ui5ItemClick", ui5ItemDelete: "ui5ItemDelete", ui5SelectionChange: "ui5SelectionChange", ui5Move: "ui5Move", ui5MoveOver: "ui5MoveOver" }, exportAs: ["ui5Tree"], 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: Tree, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-tree, [ui5-tree]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5Tree',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

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