@fluid-topics/ftds-table 2.1.6 → 2.1.8
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.js
CHANGED
|
@@ -206,11 +206,12 @@ export class FtdsTable extends FtLitElement {
|
|
|
206
206
|
return typeof column.getter === "string" ? row[column.getter] : column.getter(row);
|
|
207
207
|
}
|
|
208
208
|
sortData(data) {
|
|
209
|
-
var _a;
|
|
209
|
+
var _a, _b;
|
|
210
210
|
if (this.currentSort && !this.disableDataManipulation) {
|
|
211
211
|
const column = this.columns[this.currentSort.column];
|
|
212
212
|
const ascComparator = (_a = column.comparator) !== null && _a !== void 0 ? _a : FtdsTable.DEFAULT_COMPARATOR;
|
|
213
|
-
const
|
|
213
|
+
const descComparator = (_b = column.descComparator) !== null && _b !== void 0 ? _b : ((a, b) => -ascComparator(a, b));
|
|
214
|
+
const comparator = this.currentSort.order === "asc" ? ascComparator : descComparator;
|
|
214
215
|
return [...data].sort((a, b) => comparator(this.getValue(column, a), this.getValue(column, b)));
|
|
215
216
|
}
|
|
216
217
|
return data;
|