diff --git a/package.json b/package.json index 584350c..a7f74af 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,11 @@ "author": "trading_peter", "license": "Apache-2.0", "dependencies": { - "@lit-labs/virtualizer": "^1.0.1", - "@tp/helpers": "^1.1.3", - "@tp/tp-checkbox": "^1.0.4", + "@lit-labs/virtualizer": "^2.0.7", + "@tp/helpers": "^2.1.0", + "@tp/tp-checkbox": "^1.0.7", "@tp/tp-icon": "^1.0.1", "@tp/tp-scroll-threshold": "^1.0.0", - "lit": "^2.2.6" + "lit": "^2.8.0" } } diff --git a/tp-table-item.js b/tp-table-item.js index 8174a10..ef38440 100644 --- a/tp-table-item.js +++ b/tp-table-item.js @@ -80,8 +80,8 @@ class TpTableItem extends BaseElement { ` : null} ${Array.isArray(columns) ? columns.map((column, idx) => { if (column.visible !== true && column.required !== true) return; - return this.renderColumn(column, item, idx) || null; - }) : null + return this.renderColumn(column, item, idx) || null; + }) : null } `; diff --git a/tp-table.js b/tp-table.js index 28a404a..5eb1c78 100644 --- a/tp-table.js +++ b/tp-table.js @@ -182,12 +182,7 @@ export class TpTable extends DomQuery(LitElement) { return html`
-
- ${this.selectable ? html` -
this._checkedChanged(e)}>
- ` : null} - ${columns.map(column => this.renderColumnHeader(column))} -
+ ${this.renderTableHeader(columns)}
this._selectionChanged(e)}> ${this._emptyMessage} this.renderItem(item, idx, columns, this._selItems.has(this.getItemId(item)))}> @@ -198,6 +193,17 @@ export class TpTable extends DomQuery(LitElement) { `; } + renderTableHeader(columns) { + return html` +
+ ${this.selectable ? html` +
this._checkedChanged(e)}>
+ ` : null} + ${columns.map(column => this.renderColumnHeader(column))} +
+ `; + } + renderColumnHeader(column) { if (column.visible !== true && column.required !== true) return null;