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

class Table {
    constructor() {
        /**
         * Defines the accessible ARIA name of the component.
         */
        this.accessibleName = input(...(ngDevMode ? [undefined, { debugName: "accessibleName" }] : []));
        /**
         * Identifies the element (or elements) that labels the component.
         */
        this.accessibleNameRef = input(...(ngDevMode ? [undefined, { debugName: "accessibleNameRef" }] : []));
        /**
         * Defines the text to be displayed when there are no rows in the component.
         */
        this.noDataText = input(...(ngDevMode ? [undefined, { debugName: "noDataText" }] : []));
        /**
         * Defines the mode of the <code>ui5-table</code> overflow behavior.
      
      Available options are:
      
      <code>Scroll</code> - Columns are shown as regular columns and horizontal scrolling is enabled.
      <code>Popin</code> - Columns are shown as pop-ins instead of regular columns.
         */
        this.overflowMode = input("Scroll", ...(ngDevMode ? [{ debugName: "overflowMode" }] : []));
        /**
         * Defines if the loading indicator should be shown.
      
      **Note:** When the component is loading, it is not interactive.
         */
        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 maximum number of row actions that is displayed, which determines the width of the row action column.
      
      **Note:** It is recommended to use a maximum of 3 row actions, as exceeding this limit may take up too much space on smaller screens.
         */
        this.rowActionCount = input(0, ...(ngDevMode ? [{ debugName: "rowActionCount" }] : []));
        /**
         * Determines whether the table rows are displayed with alternating background colors.
         */
        this.alternateRowColors = input(false, ...(ngDevMode ? [{ debugName: "alternateRowColors", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
        /**
         * Fired when an interactive row is clicked.
      
      **Note:** This event is not fired if the `behavior` property of the selection component is set to `RowOnly`.
      In that case, use the `change` event of the selection component instead.
         */
        this.ui5RowClick = output();
        /**
         * Fired when a movable 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()`.
      
      **Note:** If the dragging operation is a cross-browser operation or files are moved to a potential drop target,
      the `source` parameter will be `null`.
         */
        this.ui5MoveOver = output();
        /**
         * Fired when a movable list item is dropped onto a drop target.
      
      **Notes:**
      
      The `move` event is fired only if there was a preceding `move-over` with prevented default action.
      
      If the dragging operation is a cross-browser operation or files are moved to a potential drop target,
      the `source` parameter will be `null`.
         */
        this.ui5Move = output();
        /**
         * Fired when a row action is clicked.
         */
        this.ui5RowActionClick = 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 rows of the component.
      
      **Note:** Use `ui5-table-row` for the intended design.
         * - **headerRow**: Defines the header row of the component.
      
      **Note:** Use `ui5-table-header-row` for the intended design.
         * - **noData**: Defines the custom visualization if there is no data available.
         * - **features**: Defines the features of the component.
         *
         * @example
         * ```html
         * <ui5-table>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-table>
         * ```
         *
         * @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 rows of the component.\n\n**Note:** Use `ui5-table-row` for the intended design."
            },
            {
                "name": "headerRow",
                "description": "Defines the header row of the component.\n\n**Note:** Use `ui5-table-header-row` for the intended design."
            },
            {
                "name": "noData",
                "description": "Defines the custom visualization if there is no data available."
            },
            {
                "name": "features",
                "description": "Defines the features of the component."
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'accessibleName',
            'accessibleNameRef',
            'noDataText',
            'overflowMode',
            'loading',
            'loadingDelay',
            'rowActionCount',
            'alternateRowColors',
        ];
        // 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 = [
            'ui5RowClick',
            'ui5MoveOver',
            'ui5Move',
            'ui5RowActionClick',
        ];
        // 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: Table, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Table, isStandalone: true, selector: "ui5-table, [ui5-table]", inputs: { accessibleName: { classPropertyName: "accessibleName", publicName: "accessibleName", isSignal: true, isRequired: false, transformFunction: null }, accessibleNameRef: { classPropertyName: "accessibleNameRef", publicName: "accessibleNameRef", isSignal: true, isRequired: false, transformFunction: null }, noDataText: { classPropertyName: "noDataText", publicName: "noDataText", isSignal: true, isRequired: false, transformFunction: null }, overflowMode: { classPropertyName: "overflowMode", publicName: "overflowMode", 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 }, rowActionCount: { classPropertyName: "rowActionCount", publicName: "rowActionCount", isSignal: true, isRequired: false, transformFunction: null }, alternateRowColors: { classPropertyName: "alternateRowColors", publicName: "alternateRowColors", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5RowClick: "ui5RowClick", ui5MoveOver: "ui5MoveOver", ui5Move: "ui5Move", ui5RowActionClick: "ui5RowActionClick" }, exportAs: ["ui5Table"], 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: Table, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-table, [ui5-table]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5Table',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

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