@fluid-topics/ft-filterable-table 1.1.81 → 1.1.83
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.
|
@@ -23,6 +23,7 @@ export declare class FtFilterableTable<T extends Record<string, any>> extends Ft
|
|
|
23
23
|
private renderHeader;
|
|
24
24
|
private getOppositeSortOrder;
|
|
25
25
|
private renderColumnSort;
|
|
26
|
+
private getSortOrderText;
|
|
26
27
|
private dispatchChangeEvent;
|
|
27
28
|
private renderColumnFilter;
|
|
28
29
|
private columnPart;
|
|
@@ -144,18 +144,29 @@ class FtFilterableTable extends FtLitElement {
|
|
|
144
144
|
};
|
|
145
145
|
this.dispatchChangeEvent();
|
|
146
146
|
};
|
|
147
|
-
|
|
147
|
+
const titleText = (_a = column.titleText) !== null && _a !== void 0 ? _a : column.title;
|
|
148
|
+
const sortOrderText = this.getSortOrderText(isSorted, column);
|
|
149
|
+
const label = `Sort ${titleText} in ${sortOrderText} order`;
|
|
150
|
+
return ((_b = column.sortable) !== null && _b !== void 0 ? _b : true) ? html `
|
|
148
151
|
<ft-button
|
|
149
152
|
round
|
|
150
153
|
dense
|
|
151
154
|
iconVariant="material"
|
|
152
155
|
icon="${sortIcon}"
|
|
153
|
-
label="
|
|
156
|
+
label="${label}"
|
|
154
157
|
@click=${sort}
|
|
155
158
|
part="${this.columnPart("sort-button", index)}"
|
|
156
159
|
></ft-button>
|
|
157
160
|
` : nothing;
|
|
158
161
|
}
|
|
162
|
+
getSortOrderText(isSorted, column) {
|
|
163
|
+
if (isSorted) {
|
|
164
|
+
return this.currentSort.order === "asc" ? "descending" : "ascending";
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return column.defaultSortOrder === "desc" ? "descending" : "ascending";
|
|
168
|
+
}
|
|
169
|
+
}
|
|
159
170
|
dispatchChangeEvent() {
|
|
160
171
|
this.dispatchEvent(new FtFilterableTableChangeEvent({
|
|
161
172
|
filters: this.filters
|