Compare commits

..

No commits in common. "c277ed0eca54880ff070205f23ce4b7df61ac95e" and "9e046b2c32a546b165b822e69d086809b0e77adc" have entirely different histories.

2 changed files with 6 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@tp/tp-table",
"version": "1.3.1",
"version": "1.3.0",
"description": "",
"main": "tp-table.js",
"scripts": {

View File

@ -186,7 +186,7 @@ export class TpTable extends DomQuery(LitElement) {
${this.renderTableHeader(columns)}
<div class="list" @row-selection-changed=${(e) => this._selectionChanged(e)}>
${this._emptyMessage}
<lit-virtualizer id="virtualList" part="list" scroller .items=${items} .renderItem=${(item, idx) => this.renderItem(item, idx, columns, this._selItems.has(this.getItemId(item)))}></lit-virtualizer>
<lit-virtualizer id="virtualList" part="list" @scroll=${this._onScroll} scroller .items=${items} .renderItem=${(item, idx) => this.renderItem(item, idx, columns, this._selItems.has(this.getItemId(item)))}></lit-virtualizer>
</div>
<tp-scroll-threshold id="threshold" lowerThreshold="40"></tp-scroll-threshold>
@ -200,12 +200,12 @@ export class TpTable extends DomQuery(LitElement) {
${this.selectable ? html`
<div class="select-col" part="chkAll"><tp-checkbox @toggled=${e => this._checkedChanged(e)}></tp-checkbox></div>
` : null}
${columns.map((column, idx) => this.renderColumnHeader(column, idx))}
${columns.map(column => this.renderColumnHeader(column))}
</div>
`;
}
renderColumnHeader(column, idx) {
renderColumnHeader(column) {
if (column.visible !== true && column.required !== true) return null;
const { name, width, label, sortable } = column;
@ -254,11 +254,9 @@ export class TpTable extends DomQuery(LitElement) {
static get properties() {
return {
/** @type {{label: string, name: string, width: number, [required]: boolean, [visible]: boolean, [sortable]: boolean}[]} */
columns: { type: Array },
sorting: { type: Object },
selectable: { type: Boolean },
columns: { type: Array },
items: { type: Array },
columnMoveHandle: { type: String },
_selItems: { type: Map },
@ -321,9 +319,7 @@ export class TpTable extends DomQuery(LitElement) {
}
firstUpdated() {
this.$.virtualList.addEventListener('scroll', e => this._onScroll(e), true);
this.shadowRoot.querySelector('tp-scroll-threshold').target = this.$.virtualList;
this.shadowRoot.querySelector('tp-scroll-threshold').target = this.shadowRoot.querySelector('lit-virtualizer');
new ColumnResizer(this.$.tableHeader, '.width-handle');
if (this.columnMoveHandle) {