@fluid-topics/ftds-table 2.2.1 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ftds-table.d.ts +4 -0
- package/build/ftds-table.js +34 -0
- package/build/ftds-table.light.js +48 -35
- package/build/ftds-table.min.js +179 -166
- package/build/ftds-table.styles.js +20 -7
- package/package.json +9 -9
package/build/ftds-table.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ export declare class FtdsTable<T extends Record<string, any>> extends FtLitEleme
|
|
|
33
33
|
protected renderColumnSort(column: ColumnConfiguration<T>, index: number): typeof nothing | TemplateResult<1>;
|
|
34
34
|
protected getSortIcon(isSorted: boolean | undefined): FtdsIcons;
|
|
35
35
|
protected update(props: PropertyValues): void;
|
|
36
|
+
protected updated(props: PropertyValues): void;
|
|
37
|
+
private scrollHighlightedRowIntoDisplayedRows;
|
|
38
|
+
private getStickyHeaderBottom;
|
|
39
|
+
private isScrollable;
|
|
36
40
|
protected columnPart(prefix: string, index: number): string;
|
|
37
41
|
protected getValue(column: ColumnConfiguration<T>, row: T): any;
|
|
38
42
|
private renderEmptyStateTable;
|
package/build/ftds-table.js
CHANGED
|
@@ -190,6 +190,40 @@ export class FtdsTable extends FtLitElement {
|
|
|
190
190
|
this.currentSort = this.sort;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
+
updated(props) {
|
|
194
|
+
super.updated(props);
|
|
195
|
+
if (props.has("highlightedRowIndex") && this.highlightedRowIndex >= 0) {
|
|
196
|
+
this.scrollHighlightedRowIntoDisplayedRows();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
scrollHighlightedRowIntoDisplayedRows() {
|
|
200
|
+
var _a;
|
|
201
|
+
const row = (_a = this.rows) === null || _a === void 0 ? void 0 : _a[this.highlightedRowIndex];
|
|
202
|
+
if (!row || !this.isScrollable()) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const rowRect = row.getBoundingClientRect();
|
|
206
|
+
const containerRect = this.getBoundingClientRect();
|
|
207
|
+
const visibleTop = Math.max(containerRect.top, this.getStickyHeaderBottom());
|
|
208
|
+
if (rowRect.top < visibleTop) {
|
|
209
|
+
this.scrollTop -= visibleTop - rowRect.top;
|
|
210
|
+
}
|
|
211
|
+
else if (rowRect.bottom > containerRect.bottom) {
|
|
212
|
+
this.scrollTop += rowRect.bottom - containerRect.bottom;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
getStickyHeaderBottom() {
|
|
216
|
+
var _a, _b;
|
|
217
|
+
if (!this.stickyHeaders) {
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
const stickyCell = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".header-cell--sticky");
|
|
221
|
+
return (_b = stickyCell === null || stickyCell === void 0 ? void 0 : stickyCell.getBoundingClientRect().bottom) !== null && _b !== void 0 ? _b : 0;
|
|
222
|
+
}
|
|
223
|
+
isScrollable() {
|
|
224
|
+
const overflowY = getComputedStyle(this).overflowY;
|
|
225
|
+
return (overflowY === "auto" || overflowY === "scroll") && this.scrollHeight > this.clientHeight;
|
|
226
|
+
}
|
|
193
227
|
columnPart(prefix, index) {
|
|
194
228
|
return `${prefix} ${prefix}-column-${index}`;
|
|
195
229
|
}
|