@tanstack/react-table 8.9.1 → 8.9.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.
|
@@ -2340,7 +2340,8 @@
|
|
|
2340
2340
|
},
|
|
2341
2341
|
getDefaultColumnDef: () => {
|
|
2342
2342
|
return {
|
|
2343
|
-
sortingFn: 'auto'
|
|
2343
|
+
sortingFn: 'auto',
|
|
2344
|
+
sortUndefined: 1
|
|
2344
2345
|
};
|
|
2345
2346
|
},
|
|
2346
2347
|
getDefaultOptions: table => {
|
|
@@ -3387,18 +3388,23 @@
|
|
|
3387
3388
|
const sortEntry = availableSorting[i];
|
|
3388
3389
|
const columnInfo = columnInfoById[sortEntry.id];
|
|
3389
3390
|
const isDesc = (_sortEntry$desc = sortEntry == null ? void 0 : sortEntry.desc) != null ? _sortEntry$desc : false;
|
|
3391
|
+
let sortInt = 0;
|
|
3392
|
+
|
|
3393
|
+
// All sorting ints should always return in ascending order
|
|
3390
3394
|
if (columnInfo.sortUndefined) {
|
|
3391
3395
|
const aValue = rowA.getValue(sortEntry.id);
|
|
3392
3396
|
const bValue = rowB.getValue(sortEntry.id);
|
|
3393
|
-
const aUndefined =
|
|
3394
|
-
const bUndefined =
|
|
3397
|
+
const aUndefined = aValue === undefined;
|
|
3398
|
+
const bUndefined = bValue === undefined;
|
|
3395
3399
|
if (aUndefined || bUndefined) {
|
|
3396
|
-
|
|
3400
|
+
sortInt = aUndefined && bUndefined ? 0 : aUndefined ? columnInfo.sortUndefined : -columnInfo.sortUndefined;
|
|
3397
3401
|
}
|
|
3398
3402
|
}
|
|
3403
|
+
if (sortInt === 0) {
|
|
3404
|
+
sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);
|
|
3405
|
+
}
|
|
3399
3406
|
|
|
3400
|
-
//
|
|
3401
|
-
let sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id);
|
|
3407
|
+
// If sorting is non-zero, take care of desc and inversion
|
|
3402
3408
|
if (sortInt !== 0) {
|
|
3403
3409
|
if (isDesc) {
|
|
3404
3410
|
sortInt *= -1;
|