@tanstack/table-core 8.9.2 → 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.
- package/build/lib/features/Sorting.js +2 -1
- package/build/lib/features/Sorting.js.map +1 -1
- package/build/lib/index.esm.js +12 -10
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.mjs +12 -10
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/utils/getSortedRowModel.js +10 -9
- package/build/lib/utils/getSortedRowModel.js.map +1 -1
- package/build/umd/index.development.js +12 -10
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/features/Sorting.ts +1 -0
- package/src/utils/getSortedRowModel.ts +10 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/table-core",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "8.9.
|
|
4
|
+
"version": "8.9.3",
|
|
5
5
|
"description": "Headless UI for building powerful tables & datagrids for TS/JS.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/tanstack/table#readme",
|
package/src/features/Sorting.ts
CHANGED
|
@@ -53,32 +53,31 @@ export function getSortedRowModel<TData extends RowData>(): (
|
|
|
53
53
|
const columnInfo = columnInfoById[sortEntry.id]!
|
|
54
54
|
const isDesc = sortEntry?.desc ?? false
|
|
55
55
|
|
|
56
|
+
let sortInt = 0
|
|
57
|
+
|
|
58
|
+
// All sorting ints should always return in ascending order
|
|
56
59
|
if (columnInfo.sortUndefined) {
|
|
57
60
|
const aValue = rowA.getValue(sortEntry.id)
|
|
58
61
|
const bValue = rowB.getValue(sortEntry.id)
|
|
59
62
|
|
|
60
|
-
const aUndefined =
|
|
61
|
-
const bUndefined =
|
|
63
|
+
const aUndefined = aValue === undefined
|
|
64
|
+
const bUndefined = bValue === undefined
|
|
62
65
|
|
|
63
66
|
if (aUndefined || bUndefined) {
|
|
64
|
-
|
|
67
|
+
sortInt =
|
|
65
68
|
aUndefined && bUndefined
|
|
66
69
|
? 0
|
|
67
70
|
: aUndefined
|
|
68
71
|
? columnInfo.sortUndefined
|
|
69
72
|
: -columnInfo.sortUndefined
|
|
70
|
-
|
|
71
|
-
if (isDesc && undefinedSort !== 0) {
|
|
72
|
-
undefinedSort *= -1
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return undefinedSort
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
if (sortInt === 0) {
|
|
77
|
+
sortInt = columnInfo.sortingFn(rowA, rowB, sortEntry.id)
|
|
78
|
+
}
|
|
81
79
|
|
|
80
|
+
// If sorting is non-zero, take care of desc and inversion
|
|
82
81
|
if (sortInt !== 0) {
|
|
83
82
|
if (isDesc) {
|
|
84
83
|
sortInt *= -1
|