@fluid-topics/ftds-table 2.1.24 → 2.2.1
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 +2 -1
- package/build/ftds-table.js +19 -15
- package/build/ftds-table.light.js +361 -361
- package/build/ftds-table.min.js +336 -336
- package/build/ftds-table.styles.js +2 -2
- package/package.json +9 -9
package/build/ftds-table.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare class FtdsTable<T extends Record<string, any>> extends FtLitEleme
|
|
|
19
19
|
highlightedRowIndex: number;
|
|
20
20
|
private activeRowIndex;
|
|
21
21
|
private rows?;
|
|
22
|
+
get isEmptyState(): boolean;
|
|
22
23
|
static DEFAULT_RENDER: (v: any) => TemplateResult<1>;
|
|
23
24
|
static DEFAULT_COMPARATOR: (a: any, b: any) => number;
|
|
24
25
|
focusRow(rowIndex: number): void;
|
|
@@ -30,11 +31,11 @@ export declare class FtdsTable<T extends Record<string, any>> extends FtLitEleme
|
|
|
30
31
|
protected renderSortButton(sortIcon: FtdsIcons, label: string, sort: () => void, index: number): TemplateResult<1>;
|
|
31
32
|
protected renderCell(column: ColumnConfiguration<T>, columnIndex: number, row: T, rowIndex: number): TemplateResult<1>;
|
|
32
33
|
protected renderColumnSort(column: ColumnConfiguration<T>, index: number): typeof nothing | TemplateResult<1>;
|
|
33
|
-
private renderEmptyStateTable;
|
|
34
34
|
protected getSortIcon(isSorted: boolean | undefined): FtdsIcons;
|
|
35
35
|
protected update(props: PropertyValues): void;
|
|
36
36
|
protected columnPart(prefix: string, index: number): string;
|
|
37
37
|
protected getValue(column: ColumnConfiguration<T>, row: T): any;
|
|
38
|
+
private renderEmptyStateTable;
|
|
38
39
|
private sortData;
|
|
39
40
|
private getOppositeSortOrder;
|
|
40
41
|
private getSortOrderText;
|
package/build/ftds-table.js
CHANGED
|
@@ -31,6 +31,9 @@ export class FtdsTable extends FtLitElement {
|
|
|
31
31
|
this.highlightedRowIndex = -1;
|
|
32
32
|
this.activeRowIndex = -1;
|
|
33
33
|
}
|
|
34
|
+
get isEmptyState() {
|
|
35
|
+
return this.data.length === 0;
|
|
36
|
+
}
|
|
34
37
|
focusRow(rowIndex) {
|
|
35
38
|
if (this.rows) {
|
|
36
39
|
this.rows[rowIndex].focus();
|
|
@@ -46,8 +49,8 @@ export class FtdsTable extends FtLitElement {
|
|
|
46
49
|
>
|
|
47
50
|
${this.renderHeaderRow()}
|
|
48
51
|
<tbody>
|
|
49
|
-
${
|
|
50
|
-
${repeat(data, (_, rowIndex) => "row-" + rowIndex, (row, rowIndex) => this.renderRow(row, rowIndex))}`
|
|
52
|
+
${this.isEmptyState ? this.renderEmptyStateTable() : html `
|
|
53
|
+
${repeat(data, (_, rowIndex) => "row-" + rowIndex, (row, rowIndex) => this.renderRow(row, rowIndex))}`}
|
|
51
54
|
</tbody>
|
|
52
55
|
</table>
|
|
53
56
|
`;
|
|
@@ -115,6 +118,7 @@ export class FtdsTable extends FtLitElement {
|
|
|
115
118
|
"row--clickable": this.clickableRows,
|
|
116
119
|
"row--active": rowIndex === this.activeRowIndex,
|
|
117
120
|
"row--highlighted": rowIndex === this.highlightedRowIndex,
|
|
121
|
+
"row--has-content": !this.isEmptyState,
|
|
118
122
|
};
|
|
119
123
|
return html `
|
|
120
124
|
<tr class="${classMap(classes)}" role="row" tabindex="${this.clickableRows ? "0" : nothing}"
|
|
@@ -177,19 +181,6 @@ export class FtdsTable extends FtLitElement {
|
|
|
177
181
|
const label = `Sort ${titleText} in ${sortOrderText} order`;
|
|
178
182
|
return ((_c = column.sortable) !== null && _c !== void 0 ? _c : true) ? this.renderSortButton(sortIcon, label, sort, index) : nothing;
|
|
179
183
|
}
|
|
180
|
-
renderEmptyStateTable() {
|
|
181
|
-
var _a, _b;
|
|
182
|
-
return html `
|
|
183
|
-
<tr class="row" role="row">
|
|
184
|
-
<td colspan="${this.columns.length}" class="cell no-content" role="cell">
|
|
185
|
-
${((_a = this.emptyState) === null || _a === void 0 ? void 0 : _a.noImage) ? nothing : cactusSvg}
|
|
186
|
-
<ftds-typography variant="${FtdsTypographyVariants.body2medium}">
|
|
187
|
-
${(_b = this.emptyState) === null || _b === void 0 ? void 0 : _b.content}
|
|
188
|
-
</ftds-typography>
|
|
189
|
-
</td>
|
|
190
|
-
</tr>
|
|
191
|
-
`;
|
|
192
|
-
}
|
|
193
184
|
getSortIcon(isSorted) {
|
|
194
185
|
return isSorted ? (this.currentSort.order === "asc" ? FtdsIcons.SORT_UP : FtdsIcons.SORT_DOWN) : FtdsIcons.SORT;
|
|
195
186
|
}
|
|
@@ -205,6 +196,19 @@ export class FtdsTable extends FtLitElement {
|
|
|
205
196
|
getValue(column, row) {
|
|
206
197
|
return typeof column.getter === "string" ? row[column.getter] : column.getter(row);
|
|
207
198
|
}
|
|
199
|
+
renderEmptyStateTable() {
|
|
200
|
+
var _a, _b;
|
|
201
|
+
return html `
|
|
202
|
+
<tr class="row" role="row">
|
|
203
|
+
<td colspan="${this.columns.length}" class="cell no-content" role="cell">
|
|
204
|
+
${((_a = this.emptyState) === null || _a === void 0 ? void 0 : _a.noImage) ? nothing : cactusSvg}
|
|
205
|
+
<ftds-typography variant="${FtdsTypographyVariants.body2medium}">
|
|
206
|
+
${(_b = this.emptyState) === null || _b === void 0 ? void 0 : _b.content}
|
|
207
|
+
</ftds-typography>
|
|
208
|
+
</td>
|
|
209
|
+
</tr>
|
|
210
|
+
`;
|
|
211
|
+
}
|
|
208
212
|
sortData(data) {
|
|
209
213
|
var _a, _b;
|
|
210
214
|
if (this.currentSort && !this.disableDataManipulation) {
|