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: 'e152c6c5ff2075368de61ceb808d955f4fb59117', class: "table-wrapper" }, h("table", { key: '15c290deee49da7a1d55c78c6c270909a94774a8', class: "table" }, h("thead", { key: '945ce3665c279dc219800207d005c3c1f303e48f' }, h("tr", { key: '66a4707a369dd0299c9141b19857f5cb6cf23dc5', 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: '4fd199454878ff499a5148ad864b9e40ebaa2e70' }, 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
