@tanstack/react-table 8.0.0-beta.3 → 8.0.0-beta.6
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 +1 -0
- package/build/cjs/react-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +76 -31
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +77 -31
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +19 -19
- package/build/umd/index.development.js +77 -31
- 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 +1 -0
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":"c1f5-127"},{"name":"react-table/src/index.tsx","uid":"c1f5-129"}]}]}],"isRoot":true},"nodeParts":{"c1f5-127":{"renderedLength":138812,"gzipLength":23634,"brotliLength":0,"mainUid":"c1f5-126"},"c1f5-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"c1f5-128"}},"nodeMetas":{"c1f5-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"c1f5-127"},"imported":[],"importedBy":[{"uid":"c1f5-128"}]},"c1f5-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"c1f5-129"},"imported":[{"uid":"c1f5-130"},{"uid":"c1f5-126"}],"importedBy":[],"isEntry":true},"c1f5-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"c1f5-128"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"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": "c1f5-132"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "react-table/src/index.tsx",
|
|
18
|
-
"uid": "
|
|
18
|
+
"uid": "c1f5-134"
|
|
19
19
|
}
|
|
20
20
|
]
|
|
21
21
|
}
|
|
@@ -25,55 +25,55 @@
|
|
|
25
25
|
"isRoot": true
|
|
26
26
|
},
|
|
27
27
|
"nodeParts": {
|
|
28
|
-
"
|
|
29
|
-
"renderedLength":
|
|
30
|
-
"gzipLength":
|
|
28
|
+
"c1f5-132": {
|
|
29
|
+
"renderedLength": 138812,
|
|
30
|
+
"gzipLength": 23634,
|
|
31
31
|
"brotliLength": 0,
|
|
32
|
-
"mainUid": "
|
|
32
|
+
"mainUid": "c1f5-131"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
35
|
-
"renderedLength":
|
|
36
|
-
"gzipLength":
|
|
34
|
+
"c1f5-134": {
|
|
35
|
+
"renderedLength": 2135,
|
|
36
|
+
"gzipLength": 854,
|
|
37
37
|
"brotliLength": 0,
|
|
38
|
-
"mainUid": "
|
|
38
|
+
"mainUid": "c1f5-133"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"nodeMetas": {
|
|
42
|
-
"
|
|
42
|
+
"c1f5-131": {
|
|
43
43
|
"id": "/packages/table-core/build/esm/index.js",
|
|
44
44
|
"moduleParts": {
|
|
45
|
-
"index.production.js": "
|
|
45
|
+
"index.production.js": "c1f5-132"
|
|
46
46
|
},
|
|
47
47
|
"imported": [],
|
|
48
48
|
"importedBy": [
|
|
49
49
|
{
|
|
50
|
-
"uid": "
|
|
50
|
+
"uid": "c1f5-133"
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"
|
|
54
|
+
"c1f5-133": {
|
|
55
55
|
"id": "/packages/react-table/src/index.tsx",
|
|
56
56
|
"moduleParts": {
|
|
57
|
-
"index.production.js": "
|
|
57
|
+
"index.production.js": "c1f5-134"
|
|
58
58
|
},
|
|
59
59
|
"imported": [
|
|
60
60
|
{
|
|
61
|
-
"uid": "
|
|
61
|
+
"uid": "c1f5-135"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
"uid": "
|
|
64
|
+
"uid": "c1f5-131"
|
|
65
65
|
}
|
|
66
66
|
],
|
|
67
67
|
"importedBy": [],
|
|
68
68
|
"isEntry": true
|
|
69
69
|
},
|
|
70
|
-
"
|
|
70
|
+
"c1f5-135": {
|
|
71
71
|
"id": "react",
|
|
72
72
|
"moduleParts": {},
|
|
73
73
|
"imported": [],
|
|
74
74
|
"importedBy": [
|
|
75
75
|
{
|
|
76
|
-
"uid": "
|
|
76
|
+
"uid": "c1f5-133"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
"isExternal": true
|
|
@@ -848,7 +848,6 @@
|
|
|
848
848
|
getDefaultOptions: instance => {
|
|
849
849
|
return {
|
|
850
850
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
851
|
-
autoResetExpanded: true,
|
|
852
851
|
paginateExpandedRows: true
|
|
853
852
|
};
|
|
854
853
|
},
|
|
@@ -857,6 +856,8 @@
|
|
|
857
856
|
let queued = false;
|
|
858
857
|
return {
|
|
859
858
|
_autoResetExpanded: () => {
|
|
859
|
+
var _ref, _instance$options$aut;
|
|
860
|
+
|
|
860
861
|
if (!registered) {
|
|
861
862
|
instance._queue(() => {
|
|
862
863
|
registered = true;
|
|
@@ -865,11 +866,7 @@
|
|
|
865
866
|
return;
|
|
866
867
|
}
|
|
867
868
|
|
|
868
|
-
if (instance.options.autoResetAll
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
|
|
869
|
+
if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
|
|
873
870
|
if (queued) return;
|
|
874
871
|
queued = true;
|
|
875
872
|
|
|
@@ -933,7 +930,7 @@
|
|
|
933
930
|
});
|
|
934
931
|
return maxDepth;
|
|
935
932
|
},
|
|
936
|
-
getPreExpandedRowModel: () => instance.
|
|
933
|
+
getPreExpandedRowModel: () => instance.getSortedRowModel(),
|
|
937
934
|
getExpandedRowModel: () => {
|
|
938
935
|
if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
|
|
939
936
|
instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
|
|
@@ -1534,7 +1531,7 @@
|
|
|
1534
1531
|
|
|
1535
1532
|
instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
|
|
1536
1533
|
},
|
|
1537
|
-
getPreGroupedRowModel: () => instance.
|
|
1534
|
+
getPreGroupedRowModel: () => instance.getFilteredRowModel(),
|
|
1538
1535
|
getGroupedRowModel: () => {
|
|
1539
1536
|
if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
|
|
1540
1537
|
instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
|
|
@@ -1555,6 +1552,12 @@
|
|
|
1555
1552
|
};
|
|
1556
1553
|
},
|
|
1557
1554
|
createCell: (cell, column, row, instance) => {
|
|
1555
|
+
const getRenderValue = () => {
|
|
1556
|
+
var _cell$getValue;
|
|
1557
|
+
|
|
1558
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1558
1561
|
return {
|
|
1559
1562
|
getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
|
|
1560
1563
|
getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
|
|
@@ -1564,15 +1567,19 @@
|
|
|
1564
1567
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1565
1568
|
},
|
|
1566
1569
|
renderAggregatedCell: () => {
|
|
1567
|
-
|
|
1570
|
+
{
|
|
1571
|
+
if (!column.columnDef.aggregatedCell) {
|
|
1572
|
+
console.warn('A columnDef.aggregatedCell template is recommended for displaying aggregated values.');
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1568
1575
|
|
|
1569
|
-
const template =
|
|
1576
|
+
const template = column.columnDef.aggregatedCell || column.columnDef.cell;
|
|
1570
1577
|
return template ? instance._render(template, {
|
|
1571
1578
|
instance,
|
|
1572
1579
|
column,
|
|
1573
1580
|
row,
|
|
1574
1581
|
cell,
|
|
1575
|
-
getValue:
|
|
1582
|
+
getValue: getRenderValue
|
|
1576
1583
|
}) : null;
|
|
1577
1584
|
}
|
|
1578
1585
|
};
|
|
@@ -2042,11 +2049,11 @@
|
|
|
2042
2049
|
});
|
|
2043
2050
|
},
|
|
2044
2051
|
toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
|
|
2045
|
-
typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
|
|
2052
|
+
const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
|
|
2046
2053
|
const rowSelection = { ...old
|
|
2047
2054
|
};
|
|
2048
2055
|
instance.getRowModel().rows.forEach(row => {
|
|
2049
|
-
mutateRowIsSelected(rowSelection, row.id,
|
|
2056
|
+
mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
|
|
2050
2057
|
});
|
|
2051
2058
|
return rowSelection;
|
|
2052
2059
|
}),
|
|
@@ -2137,7 +2144,7 @@
|
|
|
2137
2144
|
return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
|
|
2138
2145
|
}
|
|
2139
2146
|
}),
|
|
2140
|
-
getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.
|
|
2147
|
+
getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
|
|
2141
2148
|
if (!Object.keys(rowSelection).length) {
|
|
2142
2149
|
return {
|
|
2143
2150
|
rows: [],
|
|
@@ -2201,7 +2208,7 @@
|
|
|
2201
2208
|
},
|
|
2202
2209
|
getIsSomePageRowsSelected: () => {
|
|
2203
2210
|
const paginationFlatRows = instance.getPaginationRowModel().flatRows;
|
|
2204
|
-
return instance.getIsAllPageRowsSelected() ? false :
|
|
2211
|
+
return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
|
|
2205
2212
|
},
|
|
2206
2213
|
getToggleAllRowsSelectedHandler: () => {
|
|
2207
2214
|
return e => {
|
|
@@ -2555,8 +2562,10 @@
|
|
|
2555
2562
|
// })
|
|
2556
2563
|
// return
|
|
2557
2564
|
// }
|
|
2565
|
+
// this needs to be outside of instance.setSorting to be in sync with rerender
|
|
2566
|
+
const nextSortingOrder = column.getNextSortingOrder();
|
|
2558
2567
|
instance.setSorting(old => {
|
|
2559
|
-
var
|
|
2568
|
+
var _instance$options$ena, _instance$options$ena2;
|
|
2560
2569
|
|
|
2561
2570
|
// Find any existing sorting for this column
|
|
2562
2571
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2581,30 +2590,29 @@
|
|
|
2581
2590
|
} else {
|
|
2582
2591
|
sortAction = 'replace';
|
|
2583
2592
|
}
|
|
2584
|
-
}
|
|
2593
|
+
} // Handle toggle states that will remove the sorting
|
|
2585
2594
|
|
|
2586
|
-
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc'; // Handle toggle states that will remove the sorting
|
|
2587
2595
|
|
|
2588
2596
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2589
2597
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
2590
2598
|
!hasDescDefined && ( // Must not be setting desc
|
|
2591
|
-
multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) &&
|
|
2592
|
-
|
|
2593
|
-
|
|
2599
|
+
multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) && // If multi, don't allow if enableMultiRemove
|
|
2600
|
+
!nextSortingOrder // Finally, detect if it should indeed be removed
|
|
2601
|
+
) {
|
|
2594
2602
|
sortAction = 'remove';
|
|
2595
2603
|
}
|
|
2596
2604
|
|
|
2597
2605
|
if (sortAction === 'replace') {
|
|
2598
2606
|
newSorting = [{
|
|
2599
2607
|
id: column.id,
|
|
2600
|
-
desc: hasDescDefined ? desc :
|
|
2608
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2601
2609
|
}];
|
|
2602
2610
|
} else if (sortAction === 'add' && old != null && old.length) {
|
|
2603
2611
|
var _instance$options$max;
|
|
2604
2612
|
|
|
2605
2613
|
newSorting = [...old, {
|
|
2606
2614
|
id: column.id,
|
|
2607
|
-
desc: hasDescDefined ? desc :
|
|
2615
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2608
2616
|
}]; // Take latest n columns
|
|
2609
2617
|
|
|
2610
2618
|
newSorting.splice(0, newSorting.length - ((_instance$options$max = instance.options.maxMultiSortColCount) != null ? _instance$options$max : Number.MAX_SAFE_INTEGER));
|
|
@@ -2613,7 +2621,7 @@
|
|
|
2613
2621
|
newSorting = old.map(d => {
|
|
2614
2622
|
if (d.id === column.id) {
|
|
2615
2623
|
return { ...d,
|
|
2616
|
-
desc: hasDescDefined ? desc :
|
|
2624
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2617
2625
|
};
|
|
2618
2626
|
}
|
|
2619
2627
|
|
|
@@ -2626,6 +2634,23 @@
|
|
|
2626
2634
|
return newSorting;
|
|
2627
2635
|
});
|
|
2628
2636
|
},
|
|
2637
|
+
getNextSortingOrder: () => {
|
|
2638
|
+
var _ref2, _column$columnDef$sor;
|
|
2639
|
+
|
|
2640
|
+
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc';
|
|
2641
|
+
const firstSortDirection = sortDescFirst ? 'desc' : 'asc';
|
|
2642
|
+
const isSorted = column.getIsSorted();
|
|
2643
|
+
|
|
2644
|
+
if (!isSorted) {
|
|
2645
|
+
return firstSortDirection;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
if (isSorted === firstSortDirection) {
|
|
2649
|
+
return isSorted === 'desc' ? 'asc' : 'desc';
|
|
2650
|
+
} else {
|
|
2651
|
+
return false;
|
|
2652
|
+
}
|
|
2653
|
+
},
|
|
2629
2654
|
getCanSort: () => {
|
|
2630
2655
|
var _column$columnDef$ena, _instance$options$ena3;
|
|
2631
2656
|
|
|
@@ -2669,7 +2694,7 @@
|
|
|
2669
2694
|
|
|
2670
2695
|
instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
|
|
2671
2696
|
},
|
|
2672
|
-
getPreSortedRowModel: () => instance.
|
|
2697
|
+
getPreSortedRowModel: () => instance.getGroupedRowModel(),
|
|
2673
2698
|
getSortedRowModel: () => {
|
|
2674
2699
|
if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
|
|
2675
2700
|
instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
|
|
@@ -3073,6 +3098,12 @@
|
|
|
3073
3098
|
}
|
|
3074
3099
|
|
|
3075
3100
|
function createCell(instance, row, column, columnId) {
|
|
3101
|
+
const getRenderValue = () => {
|
|
3102
|
+
var _cell$getValue;
|
|
3103
|
+
|
|
3104
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
|
|
3105
|
+
};
|
|
3106
|
+
|
|
3076
3107
|
const cell = {
|
|
3077
3108
|
id: row.id + "_" + column.id,
|
|
3078
3109
|
row,
|
|
@@ -3084,7 +3115,7 @@
|
|
|
3084
3115
|
column,
|
|
3085
3116
|
row,
|
|
3086
3117
|
cell: cell,
|
|
3087
|
-
getValue:
|
|
3118
|
+
getValue: getRenderValue
|
|
3088
3119
|
}) : null;
|
|
3089
3120
|
}
|
|
3090
3121
|
};
|
|
@@ -3813,20 +3844,34 @@
|
|
|
3813
3844
|
const pageStart = pageSize * pageIndex;
|
|
3814
3845
|
const pageEnd = pageStart + pageSize;
|
|
3815
3846
|
rows = rows.slice(pageStart, pageEnd);
|
|
3847
|
+
let paginatedRowModel;
|
|
3816
3848
|
|
|
3817
3849
|
if (!instance.options.paginateExpandedRows) {
|
|
3818
|
-
|
|
3850
|
+
paginatedRowModel = expandRows({
|
|
3819
3851
|
rows,
|
|
3820
3852
|
flatRows,
|
|
3821
3853
|
rowsById
|
|
3822
3854
|
});
|
|
3855
|
+
} else {
|
|
3856
|
+
paginatedRowModel = {
|
|
3857
|
+
rows,
|
|
3858
|
+
flatRows,
|
|
3859
|
+
rowsById
|
|
3860
|
+
};
|
|
3823
3861
|
}
|
|
3824
3862
|
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3863
|
+
paginatedRowModel.flatRows = [];
|
|
3864
|
+
|
|
3865
|
+
const handleRow = row => {
|
|
3866
|
+
paginatedRowModel.flatRows.push(row);
|
|
3867
|
+
|
|
3868
|
+
if (row.subRows.length) {
|
|
3869
|
+
row.subRows.forEach(handleRow);
|
|
3870
|
+
}
|
|
3829
3871
|
};
|
|
3872
|
+
|
|
3873
|
+
paginatedRowModel.rows.forEach(handleRow);
|
|
3874
|
+
return paginatedRowModel;
|
|
3830
3875
|
}, {
|
|
3831
3876
|
key: 'getPaginationRowModel',
|
|
3832
3877
|
debug: () => {
|
|
@@ -3868,6 +3913,7 @@
|
|
|
3868
3913
|
onStateChange: () => {},
|
|
3869
3914
|
// noop
|
|
3870
3915
|
render,
|
|
3916
|
+
renderFallbackValue: null,
|
|
3871
3917
|
...options
|
|
3872
3918
|
}; // Create a new table instance and store it in state
|
|
3873
3919
|
|