@tanstack/vue-table 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/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export declare const FlexRender: import("vue").DefineComponent<Readonly<{
|
|
|
9
9
|
}>>>, {
|
|
10
10
|
readonly props?: any;
|
|
11
11
|
readonly render?: any;
|
|
12
|
-
}>;
|
|
12
|
+
}, {}>;
|
|
13
13
|
export declare function useVueTable<TData extends RowData>(options: TableOptions<TData>): import("@tanstack/table-core").Table<TData>;
|
|
@@ -49,6 +49,9 @@
|
|
|
49
49
|
function isFunction(d) {
|
|
50
50
|
return d instanceof Function;
|
|
51
51
|
}
|
|
52
|
+
function isNumberArray(d) {
|
|
53
|
+
return Array.isArray(d) && d.every(val => typeof val === 'number');
|
|
54
|
+
}
|
|
52
55
|
function flattenBy(arr, getChildren) {
|
|
53
56
|
const flat = [];
|
|
54
57
|
const recurse = subArr => {
|
|
@@ -1295,16 +1298,16 @@
|
|
|
1295
1298
|
if (!leafRows.length) {
|
|
1296
1299
|
return;
|
|
1297
1300
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
return (
|
|
1301
|
+
const values = leafRows.map(row => row.getValue(columnId));
|
|
1302
|
+
if (!isNumberArray(values)) {
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
if (values.length === 1) {
|
|
1306
|
+
return values[0];
|
|
1307
|
+
}
|
|
1308
|
+
const mid = Math.floor(values.length / 2);
|
|
1309
|
+
const nums = values.sort((a, b) => a - b);
|
|
1310
|
+
return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
|
|
1308
1311
|
};
|
|
1309
1312
|
const unique = (columnId, leafRows) => {
|
|
1310
1313
|
return Array.from(new Set(leafRows.map(d => d.getValue(columnId))).values());
|
|
@@ -3370,7 +3373,11 @@
|
|
|
3370
3373
|
const aUndefined = typeof aValue === 'undefined';
|
|
3371
3374
|
const bUndefined = typeof bValue === 'undefined';
|
|
3372
3375
|
if (aUndefined || bUndefined) {
|
|
3373
|
-
|
|
3376
|
+
let undefinedSort = aUndefined && bUndefined ? 0 : aUndefined ? columnInfo.sortUndefined : -columnInfo.sortUndefined;
|
|
3377
|
+
if (isDesc && undefinedSort !== 0) {
|
|
3378
|
+
undefinedSort *= -1;
|
|
3379
|
+
}
|
|
3380
|
+
return undefinedSort;
|
|
3374
3381
|
}
|
|
3375
3382
|
}
|
|
3376
3383
|
|
|
@@ -3787,6 +3794,7 @@
|
|
|
3787
3794
|
exports.getPaginationRowModel = getPaginationRowModel;
|
|
3788
3795
|
exports.getSortedRowModel = getSortedRowModel;
|
|
3789
3796
|
exports.isFunction = isFunction;
|
|
3797
|
+
exports.isNumberArray = isNumberArray;
|
|
3790
3798
|
exports.isRowSelected = isRowSelected;
|
|
3791
3799
|
exports.isSubRowSelected = isSubRowSelected;
|
|
3792
3800
|
exports.makeStateUpdater = makeStateUpdater;
|