import { Host, h } from "@stencil/core";
/**
 * Display a simple table of data. Columns and data cells may have custom renderers defined to
 * support creating interactive table layouts.
 *
 * ```ts
 * <verdocs-table columns={[...columns]} data={[...data]} />
 * ```
 */
export class VerdocsTable {
    constructor() {
        /**
         * The columns to display
         */
        this.columns = [];
        /**
         * The rows to display
         */
        this.data = [];
    }
    render() {
        return (h(Host, { key: '027b0578ef1ddfcc704178f803bf086bbe1c15d4', class: "table-wrapper" }, h("table", { key: '10ddbad54ffc0f292a1a351d7aad7134ade3a7dc', class: "table" }, h("thead", { key: '9ca47afa590f59634f8c781f7a653ca6352428fa' }, h("tr", { key: 'a3f020abcf70a5f7547ee970c8f298e44b31ca30', class: "row header-row" }, this.columns.map((col, i) => {
            return (h("th", { class: `col header-col col-${i} col-${col.id}`, onClick: () => { var _a; return (_a = this.colHeaderClick) === null || _a === void 0 ? void 0 : _a.emit({ col }); }, innerHTML: col.renderHeader ? col.renderHeader(col) : col.header || col.id }));
        }))), h("tbody", { key: 'ed8bba8eb08a27a632483da969c00c6dab46f849' }, this.data.map(row => (h("tr", { class: "row data-row", onClick: () => { var _a; return (_a = this.rowClick) === null || _a === void 0 ? void 0 : _a.emit({ row }); } }, this.columns.map((col, i) => {
            return col.renderCell ? (h("td", { class: `col data-col col-${i} col-${col.id}`, innerHTML: col.renderCell(col, row) })) : (h("td", { class: `col data-col col-${i} col-${col.id}` }, row[col.id]));
        }))))))));
    }
    static get is() { return "verdocs-table"; }
    static get originalStyleUrls() {
        return {
            "$": ["verdocs-table.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["verdocs-table.css"]
        };
    }
    static get properties() {
        return {
            "columns": {
                "type": "unknown",
                "attribute": "columns",
                "mutable": false,
                "complexType": {
                    "original": "IColumn[]",
                    "resolved": "IColumn[]",
                    "references": {
                        "IColumn": {
                            "location": "local",
                            "path": "/Users/chad/projects/verdocs/web-sdk/verdocs-web-sdk/src/components/controls/verdocs-table/verdocs-table.tsx",
                            "id": "src/components/controls/verdocs-table/verdocs-table.tsx::IColumn"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The columns to display"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "[]"
            },
            "data": {
                "type": "unknown",
                "attribute": "data",
                "mutable": false,
                "complexType": {
                    "original": "any[]",
                    "resolved": "any[]",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The rows to display"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "[]"
            }
        };
    }
    static get events() {
        return [{
                "method": "colHeaderClick",
                "name": "colHeaderClick",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event fired when the user clicks a column header. This may be used to manage sorting options."
                },
                "complexType": {
                    "original": "{col: IColumn}",
                    "resolved": "{ col: IColumn; }",
                    "references": {
                        "IColumn": {
                            "location": "local",
                            "path": "/Users/chad/projects/verdocs/web-sdk/verdocs-web-sdk/src/components/controls/verdocs-table/verdocs-table.tsx",
                            "id": "src/components/controls/verdocs-table/verdocs-table.tsx::IColumn"
                        }
                    }
                }
            }, {
                "method": "rowClick",
                "name": "rowClick",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event fired when the user clicks a row."
                },
                "complexType": {
                    "original": "{row: any}",
                    "resolved": "{ row: any; }",
                    "references": {}
                }
            }];
    }
}
//# sourceMappingURL=verdocs-table.js.map
