import { h, Host } from "@stencil/core";
import classNames from "classnames";
import { trackComponent } from "../../global/utils/tracking";
import { isNestedInIfxComponent } from "../../global/utils/dom-utils";
import { detectFramework } from "../../global/utils/framework-detection";
import { createGrid } from "ag-grid-community";
import { ButtonCellRenderer } from "./buttonCellRenderer";
import { LinkCellRenderer } from "./linkCellRenderer";
import { StatusCellRenderer } from "./statusCellRenderer";
import { CustomNoRowsOverlay } from "./customNoRowsOverlay";
import { CustomLoadingOverlay } from "./customLoadingOverlay";
export class Table {
    constructor() {
        this.currentPage = 1;
        this.rowData = [];
        this.colData = [];
        this.filterOptions = {};
        this.currentFilters = {};
        this.allRowData = [];
        this.rowHeight = 'default';
        this.tableHeight = 'auto';
        this.pagination = true;
        this.paginationPageSize = 10;
        this.filterOrientation = 'sidebar';
        this.headline = "";
        this.showSidebarFilters = true;
        this.matchingResultsCount = 0;
        this.variant = 'default';
        this.serverSidePagination = false;
        this.showLoading = false;
        this.originalRowData = [];
        this.internalItemsPerPage = JSON.stringify([
            { value: 10, label: '10', selected: true },
            { value: 20, label: '20', selected: false },
            { value: 30, label: '30', selected: false }
        ]);
    }
    rowsChanged(_newVal) {
        const parsed = this.parseArrayInput(this.rows);
        this.currentFilters = {};
        this.currentPage = 1;
        this.originalRowData = [...parsed];
        this.allRowData = [...parsed];
        this.matchingResultsCount = this.allRowData.length;
        this.updateTableView();
        this.updateFilterOptions();
    }
    colsChanged(_newVal) {
        this.colData = this.getColData();
        if (this.gridApi) {
            this.gridApi.setGridOption('columnDefs', this.colData);
            this.gridApi.sizeColumnsToFit({
                defaultMinWidth: 100,
            });
        }
        this.updateFilterOptions();
    }
    handleResultsPerPageChange(e) {
        this.paginationPageSize = Number(e.detail);
        this.currentPage = 1;
        this.updateTableView();
    }
    handleChipChange(event) {
        const { name, currentSelection, previousSelection } = event.detail;
        if (currentSelection && previousSelection) {
            // Clone the current filters state
            const updatedFilters = Object.assign({}, this.currentFilters);
            if (currentSelection.length === 0) {
                // If there are no selections for this filter, delete the filter
                delete updatedFilters[name];
                // Emit event with specific filter name
                const customEvent = new CustomEvent('ifxUpdateSidebarFilter', { detail: { filterName: name }, bubbles: true, composed: true });
                this.host.dispatchEvent(customEvent);
            }
            else {
                // Otherwise, update the filter values with the current selection
                updatedFilters[name].filterValues = currentSelection.map(selection => selection.value);
            }
            // Update the component's filters
            this.currentFilters = updatedFilters;
            // Ensure table data is updated
            this.allRowData = this.applyAllFilters(this.originalRowData, this.currentFilters);
            this.updateTableView();
        }
    }
    onButtonRendererOptionsChanged() {
        this.colData = this.getColData(); // Re-fetch column data to apply new renderer options
        if (this.gridApi) {
            this.gridApi.setColumnDefs(this.colData); // Update column definitions in the grid API
        }
    }
    parseArrayInput(input) {
        if (typeof input === 'string') {
            try {
                const parsed = JSON.parse(input);
                return Array.isArray(parsed) ? parsed : [];
            }
            catch (_a) {
                console.error('Failed to parse input:', input);
                return [];
            }
        }
        if (Array.isArray(input))
            return input;
        if (typeof input === 'object' && input !== null)
            return [input];
        return [];
    }
    toggleSidebarFilters() {
        this.showSidebarFilters = !this.showSidebarFilters;
    }
    updateFilterOptions() {
        const options = {};
        for (let col of this.colData) {
            options[col.field] = [...new Set(this.rowData.map(row => row[col.field]))];
        }
        this.filterOptions = options;
    }
    handleSidebarFilterChange(event) {
        const filterGroups = event.detail;
        const updatedFilters = {};
        filterGroups.forEach(filterGroup => {
            const filterName = filterGroup.filterGroupName;
            let filterValues;
            let type;
            if (filterGroup.selectedItems && filterGroup.selectedItems.length > 0) {
                filterValues = filterGroup.selectedItems.map(item => item.label);
                type = 'multi-select';
            }
            else if (filterGroup.value) {
                filterValues = [filterGroup.value];
                type = 'text';
            }
            else {
                filterValues = [];
            }
            if (!(filterValues.length === 0 || (filterValues.length === 1 && type === 'text' && filterValues[0] === ''))) {
                updatedFilters[filterName] = { filterValues, type };
            }
        });
        this.allRowData = this.applyAllFilters(this.originalRowData, updatedFilters);
        this.updateTableView();
        this.currentFilters = updatedFilters;
    }
    handleTopbarFilterChange(event) {
        const filters = event.detail;
        // Start by resetting the filter conditions to a blank object
        this.currentFilters = {};
        // Loop through each filter group provided in the event detail
        filters.forEach(filter => {
            const filterName = filter.filterName;
            let filterValues;
            let type = filter.type;
            if (type === 'text') {
                // Search/Text filter
                filterValues = filter.filterValues;
            }
            else {
                // Multi-select/Single-Select
                filterValues = filter.filterValues.map(item => item.label);
            }
            // If there are no filter values, or the filter is a text filter with an empty value, remove the filter
            if (!(filterValues.length === 0 || (filterValues.length === 1 && type === 'text' && filterValues[0] === ''))) {
                // Add or update the filter in the currentFilters object
                this.currentFilters[filterName] = { filterValues, type };
            }
        });
        // Now that the currentFilters object has been updated, apply all filters to the data
        this.allRowData = this.applyAllFilters(this.originalRowData, this.currentFilters);
        // After filtering, update the table view with the new filtered data
        this.updateTableView();
    }
    applyAllFilters(data, filters) {
        return data.filter(row => {
            for (const filterName in filters) {
                const filterInfo = filters[filterName];
                let selectedValues = (filterInfo.filterValues || []).map(value => {
                    if (typeof value === 'string') {
                        return value.toLowerCase();
                    }
                    else if (typeof value === 'number' || typeof value === 'boolean') {
                        return value.toString();
                    }
                    return '';
                });
                // For text filters, check if row values start with any of the selectedValues
                if (filterInfo.type === 'text') {
                    let textFilterMatched = false;
                    for (let property in row) {
                        if (row.hasOwnProperty(property)) {
                            let rowValue = row[property] != null ? String(row[property]).toLowerCase() : '';
                            if (selectedValues.some(filterValue => rowValue.startsWith(filterValue))) {
                                textFilterMatched = true;
                                break;
                            }
                        }
                    }
                    if (!textFilterMatched)
                        return false;
                }
                // For multi-select filters, this remains unchanged
                else if (filterInfo.type === 'multi-select') {
                    let rowValue = row[filterName] != null ? String(row[filterName]).toLowerCase() : '';
                    // Check if 'undefined' is a selected value and include rows with empty values in that case
                    let includesUndefined = selectedValues.includes('undefined');
                    if (!selectedValues.includes(rowValue) && !(includesUndefined && rowValue === '')) {
                        return false;
                    }
                }
            }
            return true;
        });
    }
    async updateTableView() {
        if (this.serverSidePagination && this.serverPageChangeHandler) {
            const { rows, total } = await this.serverPageChangeHandler({
                page: this.currentPage,
                pageSize: this.paginationPageSize
            });
            this.rowData = rows;
            this.matchingResultsCount = total;
            if (this.gridApi) {
                this.gridApi.setGridOption('rowData', rows);
            }
            // 👇 FIX: update pagination total
            const paginationElement = this.host.shadowRoot.querySelector('ifx-pagination');
            if (paginationElement) {
                paginationElement.setAttribute('total', total.toString());
            }
        }
        else {
            const startIndex = (this.currentPage - 1) * this.paginationPageSize;
            const endIndex = startIndex + this.paginationPageSize;
            const visibleRowData = this.allRowData.slice(startIndex, endIndex);
            this.rowData = visibleRowData;
            this.matchingResultsCount = this.allRowData.length;
            if (this.gridApi) {
                this.gridApi.setGridOption('rowData', this.rowData);
            }
        }
    }
    clearAllFilters() {
        this.currentFilters = {};
        this.allRowData = [...this.originalRowData];
    }
    async onBtShowLoading() {
        this.gridApi.showLoadingOverlay();
    }
    setPaginationItemsPerPage() {
        const newItemsPerPage = this.paginationItemsPerPage;
        if (newItemsPerPage) {
            this.internalItemsPerPage = this.paginationItemsPerPage;
            const itemsPerPageArray = JSON.parse(this.internalItemsPerPage);
            const selectedOption = itemsPerPageArray.find(option => option.selected);
            if (selectedOption) {
                this.paginationPageSize = Number(selectedOption.value);
            }
            else if (itemsPerPageArray.length > 0) {
                this.paginationPageSize = Number(itemsPerPageArray[0].value);
            }
        }
    }
    componentWillLoad() {
        this.setPaginationItemsPerPage();
        this.uniqueKey = `unique-${Math.floor(Math.random() * 1000000)}`;
        this.rowData = this.getRowData();
        this.colData = this.getColData();
        this.updateFilterOptions();
        this.gridOptions = {
            rowHeight: this.rowHeight === 'default' ? 40 : 32,
            headerHeight: 40,
            defaultColDef: {
                resizable: true,
                autoHeight: true,
            },
            suppressDragLeaveHidesColumns: true,
            enableCellTextSelection: true,
            onFirstDataRendered: this.onFirstDataRendered.bind(this),
            columnDefs: this.colData,
            rowData: this.rowData,
            loadingOverlayComponent: CustomLoadingOverlay,
            noRowsOverlayComponent: CustomNoRowsOverlay,
            noRowsOverlayComponentParams: {
                noRowsMessageFunc: () => 'No rows found' //at: ' + new Date().toLocaleTimeString(),
            },
            icons: {
                sortAscending: '<ifx-icon icon="arrow-triangle-up-16"></ifx-icon>',
                sortDescending: '<ifx-icon icon="arrow-triangle-down-16"></ifx-icon>',
                sortUnSort: '<a class="unsort-icon-custom-color"><ifx-icon icon="arrow-triangle-vertikal-16"></ifx-icon></a>'
            },
            rowDragManaged: this.colData.some(col => col.dndSource === true) ? true : false,
            animateRows: this.colData.some(col => col.dndSource === true) ? true : false,
        };
    }
    componentDidRender() {
        if (this.gridApi) {
            this.gridApi.setGridOption('columnDefs', this.colData);
        }
    }
    async componentDidLoad() {
        if (this.container) {
            if (!isNestedInIfxComponent(this.host)) {
                const framework = detectFramework();
                trackComponent('ifx-table', await framework);
            }
            this.gridApi = createGrid(this.container, this.gridOptions);
            if (this.gridApi) {
                this.gridApi.sizeColumnsToFit({
                    defaultMinWidth: 100,
                });
                this.gridApi.setGridOption('columnDefs', this.colData);
                this.gridApi.setGridOption('rowData', this.rowData);
                if (this.pagination) {
                    const paginationElement = this.host.shadowRoot.querySelector('ifx-pagination');
                    if (paginationElement) {
                        paginationElement.addEventListener('ifxPageChange', this.handlePageChange.bind(this));
                    }
                }
                const sidebarFilterElements = this.host.querySelectorAll('ifx-filter-type-group');
                // Add an event listener to each SetFilter component
                sidebarFilterElements.forEach(sidebarFilterElement => {
                    sidebarFilterElement.addEventListener('ifxSidebarFilterChange', this.handleSidebarFilterChange.bind(this));
                });
                const topbarFilterElements = this.host.querySelectorAll('ifx-filter-bar');
                // Add an event listener to each SetFilter component
                topbarFilterElements.forEach(topbarFilterElement => {
                    topbarFilterElement.addEventListener('ifxTopbarFilterChange', this.handleTopbarFilterChange.bind(this));
                });
            }
        }
        this.updateTableView();
    }
    componentWillUnmount() {
        if (this.pagination) {
            const paginationElement = this.host.shadowRoot.querySelector('ifx-pagination');
            if (paginationElement) {
                paginationElement.removeEventListener('ifxPageChange', this.handlePageChange.bind(this));
            }
        }
        const sidebarFilters = this.host.shadowRoot.querySelectorAll('ifx-filter-type-group');
        // Remove the event listener from each SetFilter component
        sidebarFilters.forEach(sidebarFilter => {
            sidebarFilter.removeEventListener('ifxSidebarFilterChange', this.handleSidebarFilterChange.bind(this));
        });
        const topbarFilters = this.host.shadowRoot.querySelectorAll('ifx-filter-type-group');
        // Remove the event listener from each SetFilter component
        topbarFilters.forEach(topbarFilter => {
            topbarFilter.removeEventListener('ifxTopbarFilterChange', this.handleTopbarFilterChange.bind(this));
        });
    }
    async handlePageChange(event) {
        this.currentPage = event.detail.currentPage;
        if (this.serverSidePagination && this.serverPageChangeHandler) {
            const { rows, total } = await this.serverPageChangeHandler({
                page: this.currentPage,
                pageSize: this.paginationPageSize
            });
            this.rowData = rows;
            this.matchingResultsCount = total;
            if (this.gridApi) {
                this.gridApi.setGridOption('rowData', this.rowData);
            }
            const paginationElement = this.host.shadowRoot.querySelector('ifx-pagination');
            if (paginationElement) {
                paginationElement.setAttribute('total', total.toString());
            }
        }
        else {
            const startIndex = (this.currentPage - 1) * this.paginationPageSize;
            const endIndex = startIndex + this.paginationPageSize;
            const visibleRowData = this.allRowData.slice(startIndex, endIndex);
            if (this.gridApi) {
                this.gridApi.setGridOption('rowData', visibleRowData);
            }
        }
    }
    isJSONParseable(str) {
        try {
            JSON.parse(str);
            return true;
        }
        catch (e) {
            return false;
        }
    }
    getRowData() {
        let rows = [];
        if (this.rows === undefined || this.rows === null) {
            return rows;
        }
        if (this.isJSONParseable(this.rows)) {
            rows = [...JSON.parse(this.rows)];
        }
        else if (Array.isArray(this.rows) || typeof this.rows === 'object') {
            rows = [...this.rows];
        }
        else {
            console.error('Unexpected value for rows: ', this.rows);
        }
        this.allRowData = rows;
        this.originalRowData = [...rows]; // Deep copy the original data
        this.matchingResultsCount = this.allRowData.length;
        return rows.slice(0, this.paginationPageSize);
    }
    getColData() {
        let cols = [];
        if (this.cols === undefined || this.cols === null)
            return cols;
        if (this.isJSONParseable(this.cols)) {
            cols = [...JSON.parse(this.cols)];
        }
        else if (Array.isArray(this.cols) || typeof this.cols === 'object') {
            cols = [...this.cols];
        }
        else {
            console.error('Unexpected value for cols: ', this.cols);
        }
        cols.forEach(column => {
            var _a, _b;
            const field = ((_a = column.field) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
            // --- Button columns ---
            if (field.startsWith('button')) {
                column.cellRenderer = ButtonCellRenderer;
                column.valueFormatter = undefined;
                column.cellDataType = false;
                if ((_b = this.buttonRendererOptions) === null || _b === void 0 ? void 0 : _b.onButtonClick) {
                    column.cellRendererParams = {
                        onButtonClick: this.buttonRendererOptions.onButtonClick
                    };
                }
            }
            // --- Status columns ---
            else if (field.startsWith('status')) {
                column.cellRenderer = StatusCellRenderer;
                column.valueFormatter = undefined;
                column.cellDataType = false;
            }
            // --- Link columns ---
            else if (field.startsWith('link')) {
                column.cellRenderer = LinkCellRenderer;
                column.valueFormatter = undefined;
                column.cellDataType = false;
            }
        });
        return cols;
    }
    onFirstDataRendered(params) {
        params.api.sizeColumnsToFit();
    }
    handleResetButtonClick() {
        const resetEvent = new CustomEvent('ifxResetFiltersEvent', { bubbles: true, composed: true });
        window.dispatchEvent(resetEvent); // Dispatch from the window object
        this.clearAllFilters();
        this.updateTableView(); // Update table view with the original data
    }
    disconnectedCallback() {
        if (this.pagination) {
            const paginationElement = this.host.shadowRoot.querySelector('ifx-pagination');
            if (paginationElement) {
                paginationElement.removeEventListener('ifxPageChange', this.handlePageChange);
            }
        }
        const resetButton = this.host.shadowRoot.querySelector('#reset-filters-button');
        if (resetButton) {
            resetButton.removeEventListener('click', this.handleResetButtonClick.bind(this));
        }
    }
    getTableClassNames() {
        return classNames(this.tableHeight === 'auto' && 'table-wrapper ag-root-wrapper-body', 'table-wrapper');
    }
    render() {
        let style = {};
        if (this.tableHeight !== 'auto') {
            style = {
                'height': this.tableHeight
            };
        }
        const filterClass = this.filterOrientation === 'topbar' ? 'topbar-layout'
            : this.filterOrientation === 'none' ? ''
                : 'sidebar-layout';
        return (h(Host, { key: 'accd6f7139d19cf703dc44fe35ce1f6c70efcaa1' }, h("div", { key: 'd3b61765c436cbfc5fee655e8674731206028fe1', class: "table-container" }, this.filterOrientation === 'sidebar' && (h("div", { key: 'aaee2de1b55a4aacf17ae77ee54f4485401f55ce', class: "sidebar-btn" }, h("ifx-button", { key: '7674fd753f54085f6db869a2364cfc61a08d5134', type: "button", disabled: false, variant: "secondary", size: "m", target: "_blank", theme: "default", "full-width": "false", onClick: () => this.toggleSidebarFilters() }, h("ifx-icon", { key: 'be5181e879aea39f48079349c17c29b80395c5f7', icon: "cross-16" }), this.showSidebarFilters ? 'Hide Filters' : 'Show Filters'))), h("div", { key: 'b878dd1b2b5ccd8bd35353ac5e256937f1c5da98', class: filterClass }, this.filterOrientation === 'sidebar' && this.showSidebarFilters && (h("div", { key: '4da50424e5f37d0a9ab1038a4843065ff9de4bce', class: "sidebar-container" }, h("div", { key: '123977a44d7ae9e75eda77b8903e7109dd233f6e', class: "filters-title-container" }, h("span", { key: 'f1fe735dc5d3bbf517228326653508e405fb5701', class: "filters-title" }, "Filters")), h("div", { key: '6210d1e5fbcb418564b2992922af1532a46c1093', class: "set-filter-wrapper-sidebar" }, (this.filterOrientation !== 'sidebar' || this.showSidebarFilters) && (h("slot", { key: '85ec286774983176e9180e28deb4992a0c7478af', name: "sidebar-filter" }))))), this.filterOrientation !== 'none' && this.filterOrientation !== 'sidebar' && (h("div", { key: 'aba9c39c9be1dc070fb0ced52971e31eef839f43', class: "set-filter-wrapper-topbar" }, (this.filterOrientation !== 'sidebar' || this.showSidebarFilters) && (h("slot", { key: 'fb941a744965519cac0485840b60ff8b4c7c0c5e', name: "topbar-filter" })))), h("div", { key: 'f7b5aedd4052934be840b340f9794125d34cc3d6', class: "table-pagination-wrapper" }, this.filterOrientation !== 'none' && this.filterOrientation !== 'topbar' && this.showSidebarFilters && (h("div", { key: 'dc65c124b35bbae11de3af30c7820edfd625496f', class: "filter-chips" }, Object.keys(this.currentFilters).map(name => {
            const filter = this.currentFilters[name];
            const filterValues = filter.filterValues;
            const isMultiSelect = filter.type !== 'text';
            return filterValues.length > 0 ? (h("ifx-chip", { placeholder: name, size: "large", variant: isMultiSelect ? "multi" : "single", readOnly: true, value: filterValues, key: name }, filterValues.map(filterValue => (h("ifx-chip-item", { value: filterValue, selected: true, key: filterValue }, filterValue))))) : null;
        }))), h("div", { key: '6782072d9ccd90babfbed31c36ecfca12dfe2515', class: "headline-wrapper" }, this.filterOrientation !== 'none' && this.headline && (h("div", { key: 'd3a178e1e515279805ef4a5f799c612602571309', class: "matching-results-container" }, h("span", { key: 'add78a0ec4e42384e6d2fe35ac95ba722cf1e414', class: "matching-results-count" }, "(", this.matchingResultsCount, ")"), h("span", { key: '87393f46a061b60feb4f1097f21f547e9e32436f', class: "matching-results-text" }, this.headline))), h("div", { key: 'f0b25a977efa0d5fb7ae69d999552e6e066a4f9f', class: "inner-buttons-wrapper" }, h("slot", { key: '08b16998f3801896dc81233c9222e3f34a4ecc1c', name: 'inner-button' }))), h("div", { key: '6dc177c3c2bbfaa36d730724e59daf0916432693', id: "table-wrapper", class: this.getTableClassNames() }, h("div", { key: '305360f7e7cd5a2ba86dc08cdaa8ad6a5a27d784', id: `ifxTable-${this.uniqueKey}`, class: `ifx-ag-grid ${this.variant === 'zebra' ? 'zebra' : ""}`, style: style, ref: (el) => this.container = el })), h("div", { key: '154f0654ed7ecfe8280be35903081f630198afd0', class: "pagination-wrapper" }, this.pagination ? h("ifx-pagination", { total: this.serverSidePagination ? this.matchingResultsCount : this.allRowData.length, "current-page": this.currentPage, "items-per-page": this.internalItemsPerPage }) : null))))));
    }
    hasButtonCol() {
        return this.getColData().some(column => column.field === 'button');
    }
    onDragOver(event) {
        var dragSupported = event.dataTransfer.length;
        if (dragSupported) {
            event.dataTransfer.dropEffect = 'move';
        }
        event.preventDefault();
    }
    onDrop(event) {
        var jsonData = event.dataTransfer.getData('application/json');
        var eJsonRow = document.createElement('div');
        eJsonRow.classList.add('json-row');
        eJsonRow.innerText = jsonData;
        var eJsonDisplay = document.querySelector('#eJsonDisplay');
        eJsonDisplay.appendChild(eJsonRow);
        event.preventDefault();
    }
    static get is() { return "ifx-table"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["table.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["table.css"]
        };
    }
    static get properties() {
        return {
            "cols": {
                "type": "any",
                "attribute": "cols",
                "mutable": false,
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "rows": {
                "type": "any",
                "attribute": "rows",
                "mutable": false,
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "buttonRendererOptions": {
                "type": "unknown",
                "attribute": "button-renderer-options",
                "mutable": false,
                "complexType": {
                    "original": "{ onButtonClick?: (params: any, event: Event) => void;}",
                    "resolved": "{ onButtonClick?: (params: any, event: Event) => void; }",
                    "references": {
                        "Event": {
                            "location": "global",
                            "id": "global::Event"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            },
            "rowHeight": {
                "type": "string",
                "attribute": "row-height",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'default'"
            },
            "tableHeight": {
                "type": "string",
                "attribute": "table-height",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'auto'"
            },
            "pagination": {
                "type": "boolean",
                "attribute": "pagination",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "true"
            },
            "paginationItemsPerPage": {
                "type": "string",
                "attribute": "pagination-items-per-page",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false
            },
            "filterOrientation": {
                "type": "string",
                "attribute": "filter-orientation",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'sidebar'"
            },
            "headline": {
                "type": "string",
                "attribute": "headline",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "\"\""
            },
            "variant": {
                "type": "string",
                "attribute": "variant",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "'default'"
            },
            "serverSidePagination": {
                "type": "boolean",
                "attribute": "server-side-pagination",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "false"
            },
            "serverPageChangeHandler": {
                "type": "unknown",
                "attribute": "server-page-change-handler",
                "mutable": false,
                "complexType": {
                    "original": "(params: { page: number, pageSize: number }) => Promise<{ rows: any[], total: number }>",
                    "resolved": "(params: { page: number; pageSize: number; }) => Promise<{ rows: any[]; total: number; }>",
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            },
            "showLoading": {
                "type": "boolean",
                "attribute": "show-loading",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get states() {
        return {
            "currentPage": {},
            "rowData": {},
            "colData": {},
            "filterOptions": {},
            "currentFilters": {},
            "uniqueKey": {},
            "paginationPageSize": {},
            "showSidebarFilters": {},
            "matchingResultsCount": {}
        };
    }
    static get methods() {
        return {
            "onBtShowLoading": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            }
        };
    }
    static get elementRef() { return "host"; }
    static get watchers() {
        return [{
                "propName": "rows",
                "methodName": "rowsChanged"
            }, {
                "propName": "cols",
                "methodName": "colsChanged"
            }, {
                "propName": "buttonRendererOptions",
                "methodName": "onButtonRendererOptionsChanged"
            }];
    }
    static get listeners() {
        return [{
                "name": "ifxItemsPerPageChange",
                "method": "handleResultsPerPageChange",
                "target": undefined,
                "capture": false,
                "passive": false
            }, {
                "name": "ifxChange",
                "method": "handleChipChange",
                "target": undefined,
                "capture": false,
                "passive": false
            }];
    }
}
//# sourceMappingURL=table.js.map
