@tanstack/react-table 8.1.4 → 8.2.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/cjs/react-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +43 -33
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +43 -33
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +18 -18
- package/build/umd/index.development.js +43 -33
- 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 +2 -2
- package/src/index.tsx +10 -6
package/build/stats-html.html
CHANGED
|
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
|
|
|
2669
2669
|
</script>
|
|
2670
2670
|
<script>
|
|
2671
2671
|
/*<!--*/
|
|
2672
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"
|
|
2672
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"a9b1-123"},{"name":"react-table/src/index.tsx","uid":"a9b1-125"}]}]}],"isRoot":true},"nodeParts":{"a9b1-123":{"renderedLength":134594,"gzipLength":23188,"brotliLength":0,"mainUid":"a9b1-122"},"a9b1-125":{"renderedLength":1900,"gzipLength":752,"brotliLength":0,"mainUid":"a9b1-124"}},"nodeMetas":{"a9b1-122":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"a9b1-123"},"imported":[],"importedBy":[{"uid":"a9b1-124"}]},"a9b1-124":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"a9b1-125"},"imported":[{"uid":"a9b1-126"},{"uid":"a9b1-122"}],"importedBy":[],"isEntry":true},"a9b1-126":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"a9b1-124"}],"isExternal":true}},"env":{"rollup":"2.76.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
2673
2673
|
|
|
2674
2674
|
const run = () => {
|
|
2675
2675
|
const width = window.innerWidth;
|
package/build/stats-react.json
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"children": [
|
|
12
12
|
{
|
|
13
13
|
"name": "table-core/build/esm/index.js",
|
|
14
|
-
"uid": "
|
|
14
|
+
"uid": "a9b1-128"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "react-table/src/index.tsx",
|
|
18
|
-
"uid": "
|
|
18
|
+
"uid": "a9b1-130"
|
|
19
19
|
}
|
|
20
20
|
]
|
|
21
21
|
}
|
|
@@ -25,62 +25,62 @@
|
|
|
25
25
|
"isRoot": true
|
|
26
26
|
},
|
|
27
27
|
"nodeParts": {
|
|
28
|
-
"
|
|
29
|
-
"renderedLength":
|
|
30
|
-
"gzipLength":
|
|
28
|
+
"a9b1-128": {
|
|
29
|
+
"renderedLength": 134594,
|
|
30
|
+
"gzipLength": 23188,
|
|
31
31
|
"brotliLength": 0,
|
|
32
|
-
"mainUid": "
|
|
32
|
+
"mainUid": "a9b1-127"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
34
|
+
"a9b1-130": {
|
|
35
35
|
"renderedLength": 1900,
|
|
36
36
|
"gzipLength": 752,
|
|
37
37
|
"brotliLength": 0,
|
|
38
|
-
"mainUid": "
|
|
38
|
+
"mainUid": "a9b1-129"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"nodeMetas": {
|
|
42
|
-
"
|
|
42
|
+
"a9b1-127": {
|
|
43
43
|
"id": "/packages/table-core/build/esm/index.js",
|
|
44
44
|
"moduleParts": {
|
|
45
|
-
"index.production.js": "
|
|
45
|
+
"index.production.js": "a9b1-128"
|
|
46
46
|
},
|
|
47
47
|
"imported": [],
|
|
48
48
|
"importedBy": [
|
|
49
49
|
{
|
|
50
|
-
"uid": "
|
|
50
|
+
"uid": "a9b1-129"
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"
|
|
54
|
+
"a9b1-129": {
|
|
55
55
|
"id": "/packages/react-table/src/index.tsx",
|
|
56
56
|
"moduleParts": {
|
|
57
|
-
"index.production.js": "
|
|
57
|
+
"index.production.js": "a9b1-130"
|
|
58
58
|
},
|
|
59
59
|
"imported": [
|
|
60
60
|
{
|
|
61
|
-
"uid": "
|
|
61
|
+
"uid": "a9b1-131"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
"uid": "
|
|
64
|
+
"uid": "a9b1-127"
|
|
65
65
|
}
|
|
66
66
|
],
|
|
67
67
|
"importedBy": [],
|
|
68
68
|
"isEntry": true
|
|
69
69
|
},
|
|
70
|
-
"
|
|
70
|
+
"a9b1-131": {
|
|
71
71
|
"id": "react",
|
|
72
72
|
"moduleParts": {},
|
|
73
73
|
"imported": [],
|
|
74
74
|
"importedBy": [
|
|
75
75
|
{
|
|
76
|
-
"uid": "
|
|
76
|
+
"uid": "a9b1-129"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
"isExternal": true
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"env": {
|
|
83
|
-
"rollup": "2.
|
|
83
|
+
"rollup": "2.76.0"
|
|
84
84
|
},
|
|
85
85
|
"options": {
|
|
86
86
|
"gzip": true,
|
|
@@ -2383,7 +2383,12 @@
|
|
|
2383
2383
|
};
|
|
2384
2384
|
|
|
2385
2385
|
const datetime = (rowA, rowB, columnId) => {
|
|
2386
|
-
|
|
2386
|
+
const a = rowA.getValue(columnId);
|
|
2387
|
+
const b = rowB.getValue(columnId); // Can handle nullish values
|
|
2388
|
+
// Use > and < because == (and ===) doesn't work with
|
|
2389
|
+
// Date objects (would require calling getTime()).
|
|
2390
|
+
|
|
2391
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
2387
2392
|
};
|
|
2388
2393
|
|
|
2389
2394
|
const basic = (rowA, rowB, columnId) => {
|
|
@@ -2544,18 +2549,17 @@
|
|
|
2544
2549
|
// }
|
|
2545
2550
|
// this needs to be outside of table.setSorting to be in sync with rerender
|
|
2546
2551
|
const nextSortingOrder = column.getNextSortingOrder();
|
|
2552
|
+
const hasManualValue = typeof desc !== 'undefined' && desc !== null;
|
|
2547
2553
|
table.setSorting(old => {
|
|
2548
|
-
var _table$options$enable, _table$options$enable2;
|
|
2549
|
-
|
|
2550
2554
|
// Find any existing sorting for this column
|
|
2551
2555
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
2552
2556
|
const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
|
|
2553
|
-
const hasDescDefined = typeof desc !== 'undefined' && desc !== null;
|
|
2554
2557
|
let newSorting = []; // What should we do with this sort action?
|
|
2555
2558
|
|
|
2556
2559
|
let sortAction;
|
|
2560
|
+
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; // Multi-mode
|
|
2557
2561
|
|
|
2558
|
-
if (column.getCanMultiSort() && multi) {
|
|
2562
|
+
if (old != null && old.length && column.getCanMultiSort() && multi) {
|
|
2559
2563
|
if (existingSorting) {
|
|
2560
2564
|
sortAction = 'toggle';
|
|
2561
2565
|
} else {
|
|
@@ -2573,63 +2577,71 @@
|
|
|
2573
2577
|
} // Handle toggle states that will remove the sorting
|
|
2574
2578
|
|
|
2575
2579
|
|
|
2576
|
-
if (sortAction === 'toggle'
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2580
|
+
if (sortAction === 'toggle') {
|
|
2581
|
+
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
|
|
2582
|
+
if (!hasManualValue) {
|
|
2583
|
+
// Is our intention to remove?
|
|
2584
|
+
if (!nextSortingOrder) {
|
|
2585
|
+
sortAction = 'remove';
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2583
2588
|
}
|
|
2584
2589
|
|
|
2585
|
-
if (sortAction === '
|
|
2586
|
-
newSorting = [{
|
|
2587
|
-
id: column.id,
|
|
2588
|
-
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2589
|
-
}];
|
|
2590
|
-
} else if (sortAction === 'add' && old != null && old.length) {
|
|
2590
|
+
if (sortAction === 'add') {
|
|
2591
2591
|
var _table$options$maxMul;
|
|
2592
2592
|
|
|
2593
2593
|
newSorting = [...old, {
|
|
2594
2594
|
id: column.id,
|
|
2595
|
-
desc:
|
|
2595
|
+
desc: nextDesc
|
|
2596
2596
|
}]; // Take latest n columns
|
|
2597
2597
|
|
|
2598
2598
|
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
|
|
2599
|
-
} else if (sortAction === 'toggle'
|
|
2599
|
+
} else if (sortAction === 'toggle') {
|
|
2600
2600
|
// This flips (or sets) the
|
|
2601
2601
|
newSorting = old.map(d => {
|
|
2602
2602
|
if (d.id === column.id) {
|
|
2603
2603
|
return { ...d,
|
|
2604
|
-
desc:
|
|
2604
|
+
desc: nextDesc
|
|
2605
2605
|
};
|
|
2606
2606
|
}
|
|
2607
2607
|
|
|
2608
2608
|
return d;
|
|
2609
2609
|
});
|
|
2610
|
-
} else if (sortAction === 'remove'
|
|
2610
|
+
} else if (sortAction === 'remove') {
|
|
2611
2611
|
newSorting = old.filter(d => d.id !== column.id);
|
|
2612
|
+
} else {
|
|
2613
|
+
newSorting = [{
|
|
2614
|
+
id: column.id,
|
|
2615
|
+
desc: nextDesc
|
|
2616
|
+
}];
|
|
2612
2617
|
}
|
|
2613
2618
|
|
|
2614
2619
|
return newSorting;
|
|
2615
2620
|
});
|
|
2616
2621
|
},
|
|
2617
|
-
|
|
2622
|
+
getFirstSortDir: () => {
|
|
2618
2623
|
var _ref, _column$columnDef$sor;
|
|
2619
2624
|
|
|
2620
2625
|
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
|
|
2621
|
-
|
|
2626
|
+
return sortDescFirst ? 'desc' : 'asc';
|
|
2627
|
+
},
|
|
2628
|
+
getNextSortingOrder: multi => {
|
|
2629
|
+
var _table$options$enable, _table$options$enable2;
|
|
2630
|
+
|
|
2631
|
+
const firstSortDirection = column.getFirstSortDir();
|
|
2622
2632
|
const isSorted = column.getIsSorted();
|
|
2623
2633
|
|
|
2624
2634
|
if (!isSorted) {
|
|
2625
2635
|
return firstSortDirection;
|
|
2626
2636
|
}
|
|
2627
2637
|
|
|
2628
|
-
if (isSorted
|
|
2629
|
-
|
|
2630
|
-
|
|
2638
|
+
if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( // If enableSortRemove, enable in general
|
|
2639
|
+
multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))
|
|
2640
|
+
) {
|
|
2631
2641
|
return false;
|
|
2632
2642
|
}
|
|
2643
|
+
|
|
2644
|
+
return isSorted === 'desc' ? 'asc' : 'desc';
|
|
2633
2645
|
},
|
|
2634
2646
|
getCanSort: () => {
|
|
2635
2647
|
var _column$columnDef$ena, _table$options$enable3;
|
|
@@ -2911,9 +2923,9 @@
|
|
|
2911
2923
|
header: props => props.header.column.id,
|
|
2912
2924
|
footer: props => props.header.column.id,
|
|
2913
2925
|
cell: props => {
|
|
2914
|
-
var
|
|
2926
|
+
var _props$renderValue$to, _props$renderValue;
|
|
2915
2927
|
|
|
2916
|
-
return (
|
|
2928
|
+
return (_props$renderValue$to = (_props$renderValue = props.renderValue()) == null ? void 0 : _props$renderValue.toString == null ? void 0 : _props$renderValue.toString()) != null ? _props$renderValue$to : null;
|
|
2917
2929
|
},
|
|
2918
2930
|
...table._features.reduce((obj, feature) => {
|
|
2919
2931
|
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
@@ -3443,9 +3455,7 @@
|
|
|
3443
3455
|
let facetedMinMaxValues = [firstValue, firstValue];
|
|
3444
3456
|
|
|
3445
3457
|
for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
const value = (_facetedRowModel$flat2 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat2.getValue(columnId);
|
|
3458
|
+
const value = facetedRowModel.flatRows[i].getValue(columnId);
|
|
3449
3459
|
|
|
3450
3460
|
if (value < facetedMinMaxValues[0]) {
|
|
3451
3461
|
facetedMinMaxValues[0] = value;
|
|
@@ -3595,7 +3605,7 @@
|
|
|
3595
3605
|
const subRows = groupUpRecursively(groupedRows, depth + 1, id); // Flatten the leaf rows of the rows in this group
|
|
3596
3606
|
|
|
3597
3607
|
const leafRows = depth ? flattenBy(groupedRows, row => row.subRows) : groupedRows;
|
|
3598
|
-
const row = createRow(table, id,
|
|
3608
|
+
const row = createRow(table, id, leafRows[0].original, index, depth);
|
|
3599
3609
|
Object.assign(row, {
|
|
3600
3610
|
groupingColumnId: columnId,
|
|
3601
3611
|
groupingValue,
|