@tanstack/table-core 8.9.0 → 8.9.2
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/aggregationFns.js +12 -10
- package/build/lib/aggregationFns.js.map +1 -1
- package/build/lib/index.esm.js +19 -12
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +1 -0
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +19 -12
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/utils/getSortedRowModel.js +5 -1
- package/build/lib/utils/getSortedRowModel.js.map +1 -1
- package/build/lib/utils.d.ts +1 -0
- package/build/lib/utils.js +4 -0
- package/build/lib/utils.js.map +1 -1
- package/build/umd/index.development.js +19 -11
- 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/aggregationFns.ts +11 -11
- package/src/utils/getSortedRowModel.ts +12 -5
- package/src/utils.ts +4 -0
package/build/lib/index.js
CHANGED
|
@@ -75,6 +75,7 @@ exports.createColumnHelper = columnHelper.createColumnHelper;
|
|
|
75
75
|
exports.flattenBy = utils.flattenBy;
|
|
76
76
|
exports.functionalUpdate = utils.functionalUpdate;
|
|
77
77
|
exports.isFunction = utils.isFunction;
|
|
78
|
+
exports.isNumberArray = utils.isNumberArray;
|
|
78
79
|
exports.makeStateUpdater = utils.makeStateUpdater;
|
|
79
80
|
exports.memo = utils.memo;
|
|
80
81
|
exports.noop = utils.noop;
|
package/build/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/lib/index.mjs
CHANGED
|
@@ -33,6 +33,9 @@ function makeStateUpdater(key, instance) {
|
|
|
33
33
|
function isFunction(d) {
|
|
34
34
|
return d instanceof Function;
|
|
35
35
|
}
|
|
36
|
+
function isNumberArray(d) {
|
|
37
|
+
return Array.isArray(d) && d.every(val => typeof val === 'number');
|
|
38
|
+
}
|
|
36
39
|
function flattenBy(arr, getChildren) {
|
|
37
40
|
const flat = [];
|
|
38
41
|
const recurse = subArr => {
|
|
@@ -1280,16 +1283,16 @@ const median = (columnId, leafRows) => {
|
|
|
1280
1283
|
if (!leafRows.length) {
|
|
1281
1284
|
return;
|
|
1282
1285
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
return (
|
|
1286
|
+
const values = leafRows.map(row => row.getValue(columnId));
|
|
1287
|
+
if (!isNumberArray(values)) {
|
|
1288
|
+
return;
|
|
1289
|
+
}
|
|
1290
|
+
if (values.length === 1) {
|
|
1291
|
+
return values[0];
|
|
1292
|
+
}
|
|
1293
|
+
const mid = Math.floor(values.length / 2);
|
|
1294
|
+
const nums = values.sort((a, b) => a - b);
|
|
1295
|
+
return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
|
|
1293
1296
|
};
|
|
1294
1297
|
const unique = (columnId, leafRows) => {
|
|
1295
1298
|
return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
|
|
@@ -3356,7 +3359,11 @@ function getSortedRowModel() {
|
|
|
3356
3359
|
const aUndefined = typeof aValue === 'undefined';
|
|
3357
3360
|
const bUndefined = typeof bValue === 'undefined';
|
|
3358
3361
|
if (aUndefined || bUndefined) {
|
|
3359
|
-
|
|
3362
|
+
let undefinedSort = aUndefined && bUndefined ? 0 : aUndefined ? columnInfo.sortUndefined : -columnInfo.sortUndefined;
|
|
3363
|
+
if (isDesc && undefinedSort !== 0) {
|
|
3364
|
+
undefinedSort *= -1;
|
|
3365
|
+
}
|
|
3366
|
+
return undefinedSort;
|
|
3360
3367
|
}
|
|
3361
3368
|
}
|
|
3362
3369
|
|
|
@@ -3628,5 +3635,5 @@ function getPaginationRowModel(opts) {
|
|
|
3628
3635
|
});
|
|
3629
3636
|
}
|
|
3630
3637
|
|
|
3631
|
-
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
3638
|
+
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isNumberArray, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
3632
3639
|
//# sourceMappingURL=index.mjs.map
|