@tanstack/react-table 8.0.0-beta.1 → 8.0.0-beta.4
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 +56 -25
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +57 -25
- 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 +57 -25
- 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":"50f7-127"},{"name":"react-table/src/index.tsx","uid":"50f7-129"}]}]}],"isRoot":true},"nodeParts":{"50f7-127":{"renderedLength":138364,"gzipLength":23596,"brotliLength":0,"mainUid":"50f7-126"},"50f7-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"50f7-128"}},"nodeMetas":{"50f7-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"50f7-127"},"imported":[],"importedBy":[{"uid":"50f7-128"}]},"50f7-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"50f7-129"},"imported":[{"uid":"50f7-130"},{"uid":"50f7-126"}],"importedBy":[],"isEntry":true},"50f7-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"50f7-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": "50f7-132"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "react-table/src/index.tsx",
|
|
18
|
-
"uid": "
|
|
18
|
+
"uid": "50f7-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
|
+
"50f7-132": {
|
|
29
|
+
"renderedLength": 138364,
|
|
30
|
+
"gzipLength": 23596,
|
|
31
31
|
"brotliLength": 0,
|
|
32
|
-
"mainUid": "
|
|
32
|
+
"mainUid": "50f7-131"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
35
|
-
"renderedLength":
|
|
36
|
-
"gzipLength":
|
|
34
|
+
"50f7-134": {
|
|
35
|
+
"renderedLength": 2135,
|
|
36
|
+
"gzipLength": 854,
|
|
37
37
|
"brotliLength": 0,
|
|
38
|
-
"mainUid": "
|
|
38
|
+
"mainUid": "50f7-133"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"nodeMetas": {
|
|
42
|
-
"
|
|
42
|
+
"50f7-131": {
|
|
43
43
|
"id": "/packages/table-core/build/esm/index.js",
|
|
44
44
|
"moduleParts": {
|
|
45
|
-
"index.production.js": "
|
|
45
|
+
"index.production.js": "50f7-132"
|
|
46
46
|
},
|
|
47
47
|
"imported": [],
|
|
48
48
|
"importedBy": [
|
|
49
49
|
{
|
|
50
|
-
"uid": "
|
|
50
|
+
"uid": "50f7-133"
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"
|
|
54
|
+
"50f7-133": {
|
|
55
55
|
"id": "/packages/react-table/src/index.tsx",
|
|
56
56
|
"moduleParts": {
|
|
57
|
-
"index.production.js": "
|
|
57
|
+
"index.production.js": "50f7-134"
|
|
58
58
|
},
|
|
59
59
|
"imported": [
|
|
60
60
|
{
|
|
61
|
-
"uid": "
|
|
61
|
+
"uid": "50f7-135"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
"uid": "
|
|
64
|
+
"uid": "50f7-131"
|
|
65
65
|
}
|
|
66
66
|
],
|
|
67
67
|
"importedBy": [],
|
|
68
68
|
"isEntry": true
|
|
69
69
|
},
|
|
70
|
-
"
|
|
70
|
+
"50f7-135": {
|
|
71
71
|
"id": "react",
|
|
72
72
|
"moduleParts": {},
|
|
73
73
|
"imported": [],
|
|
74
74
|
"importedBy": [
|
|
75
75
|
{
|
|
76
|
-
"uid": "
|
|
76
|
+
"uid": "50f7-133"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
"isExternal": true
|
|
@@ -1128,7 +1128,6 @@
|
|
|
1128
1128
|
},
|
|
1129
1129
|
createColumn: (column, instance) => {
|
|
1130
1130
|
return {
|
|
1131
|
-
filterFn: column.filterFn,
|
|
1132
1131
|
getAutoFilterFn: () => {
|
|
1133
1132
|
const firstRow = instance.getCoreRowModel().flatRows[0];
|
|
1134
1133
|
const value = firstRow == null ? void 0 : firstRow.getValue(column.id);
|
|
@@ -1159,7 +1158,7 @@
|
|
|
1159
1158
|
var _ref;
|
|
1160
1159
|
|
|
1161
1160
|
const userFilterFns = instance.options.filterFns;
|
|
1162
|
-
return isFunction(column.filterFn) ? column.filterFn : column.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.filterFn]) != null ? _ref : filterFns[column.filterFn];
|
|
1161
|
+
return isFunction(column.columnDef.filterFn) ? column.columnDef.filterFn : column.columnDef.filterFn === 'auto' ? column.getAutoFilterFn() : (_ref = userFilterFns == null ? void 0 : userFilterFns[column.columnDef.filterFn]) != null ? _ref : filterFns[column.columnDef.filterFn];
|
|
1163
1162
|
},
|
|
1164
1163
|
getCanFilter: () => {
|
|
1165
1164
|
var _column$columnDef$ena, _instance$options$ena, _instance$options$ena2;
|
|
@@ -1448,6 +1447,11 @@
|
|
|
1448
1447
|
const Grouping = {
|
|
1449
1448
|
getDefaultColumnDef: () => {
|
|
1450
1449
|
return {
|
|
1450
|
+
aggregatedCell: props => {
|
|
1451
|
+
var _props$getValue$toStr, _props$getValue;
|
|
1452
|
+
|
|
1453
|
+
return (_props$getValue$toStr = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _props$getValue$toStr : null;
|
|
1454
|
+
},
|
|
1451
1455
|
aggregationFn: 'auto'
|
|
1452
1456
|
};
|
|
1453
1457
|
},
|
|
@@ -1508,8 +1512,6 @@
|
|
|
1508
1512
|
if (Object.prototype.toString.call(value) === '[object Date]') {
|
|
1509
1513
|
return aggregationFns.extent;
|
|
1510
1514
|
}
|
|
1511
|
-
|
|
1512
|
-
return aggregationFns.count;
|
|
1513
1515
|
},
|
|
1514
1516
|
getAggregationFn: () => {
|
|
1515
1517
|
var _ref4;
|
|
@@ -1520,7 +1522,7 @@
|
|
|
1520
1522
|
throw new Error();
|
|
1521
1523
|
}
|
|
1522
1524
|
|
|
1523
|
-
return isFunction(column.aggregationFn) ? column.aggregationFn : column.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.aggregationFn]) != null ? _ref4 : aggregationFns[column.aggregationFn];
|
|
1525
|
+
return isFunction(column.columnDef.aggregationFn) ? column.columnDef.aggregationFn : column.columnDef.aggregationFn === 'auto' ? column.getAutoAggregationFn() : (_ref4 = userAggregationFns == null ? void 0 : userAggregationFns[column.columnDef.aggregationFn]) != null ? _ref4 : aggregationFns[column.columnDef.aggregationFn];
|
|
1524
1526
|
}
|
|
1525
1527
|
};
|
|
1526
1528
|
},
|
|
@@ -1553,6 +1555,12 @@
|
|
|
1553
1555
|
};
|
|
1554
1556
|
},
|
|
1555
1557
|
createCell: (cell, column, row, instance) => {
|
|
1558
|
+
const getRenderValue = () => {
|
|
1559
|
+
var _cell$getValue;
|
|
1560
|
+
|
|
1561
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1556
1564
|
return {
|
|
1557
1565
|
getIsGrouped: () => column.getIsGrouped() && column.id === row.groupingColumnId,
|
|
1558
1566
|
getIsPlaceholder: () => !cell.getIsGrouped() && column.getIsGrouped(),
|
|
@@ -1562,15 +1570,19 @@
|
|
|
1562
1570
|
return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
|
|
1563
1571
|
},
|
|
1564
1572
|
renderAggregatedCell: () => {
|
|
1565
|
-
|
|
1573
|
+
{
|
|
1574
|
+
if (!column.columnDef.aggregatedCell) {
|
|
1575
|
+
console.warn('A columnDef.aggregatedCell template is recommended for displaying aggregated values.');
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1566
1578
|
|
|
1567
|
-
const template =
|
|
1579
|
+
const template = column.columnDef.aggregatedCell || column.columnDef.cell;
|
|
1568
1580
|
return template ? instance._render(template, {
|
|
1569
1581
|
instance,
|
|
1570
1582
|
column,
|
|
1571
1583
|
row,
|
|
1572
1584
|
cell,
|
|
1573
|
-
getValue:
|
|
1585
|
+
getValue: getRenderValue
|
|
1574
1586
|
}) : null;
|
|
1575
1587
|
}
|
|
1576
1588
|
};
|
|
@@ -2553,8 +2565,10 @@
|
|
|
2553
2565
|
// })
|
|
2554
2566
|
// return
|
|
2555
2567
|
// }
|
|
2568
|
+
// this needs to be outside of instance.setSorting to be in sync with rerender
|
|
2569
|
+
const nextSortingOrder = column.getNextSortingOrder();
|
|
2556
2570
|
instance.setSorting(old => {
|
|
2557
|
-
var
|
|
2571
|
+
var _instance$options$ena, _instance$options$ena2;
|
|
2558
2572
|
|
|
2559
2573
|
// Find any existing sorting for this column
|
|
2560
2574
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
@@ -2579,30 +2593,29 @@
|
|
|
2579
2593
|
} else {
|
|
2580
2594
|
sortAction = 'replace';
|
|
2581
2595
|
}
|
|
2582
|
-
}
|
|
2596
|
+
} // Handle toggle states that will remove the sorting
|
|
2583
2597
|
|
|
2584
|
-
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
|
|
2585
2598
|
|
|
2586
2599
|
if (sortAction === 'toggle' && ( // Must be toggling
|
|
2587
2600
|
(_instance$options$ena = instance.options.enableSortingRemoval) != null ? _instance$options$ena : true) && // If enableSortRemove, enable in general
|
|
2588
2601
|
!hasDescDefined && ( // Must not be setting desc
|
|
2589
|
-
multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) &&
|
|
2590
|
-
|
|
2591
|
-
|
|
2602
|
+
multi ? (_instance$options$ena2 = instance.options.enableMultiRemove) != null ? _instance$options$ena2 : true : true) && // If multi, don't allow if enableMultiRemove
|
|
2603
|
+
!nextSortingOrder // Finally, detect if it should indeed be removed
|
|
2604
|
+
) {
|
|
2592
2605
|
sortAction = 'remove';
|
|
2593
2606
|
}
|
|
2594
2607
|
|
|
2595
2608
|
if (sortAction === 'replace') {
|
|
2596
2609
|
newSorting = [{
|
|
2597
2610
|
id: column.id,
|
|
2598
|
-
desc: hasDescDefined ? desc :
|
|
2611
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2599
2612
|
}];
|
|
2600
2613
|
} else if (sortAction === 'add' && old != null && old.length) {
|
|
2601
2614
|
var _instance$options$max;
|
|
2602
2615
|
|
|
2603
2616
|
newSorting = [...old, {
|
|
2604
2617
|
id: column.id,
|
|
2605
|
-
desc: hasDescDefined ? desc :
|
|
2618
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2606
2619
|
}]; // Take latest n columns
|
|
2607
2620
|
|
|
2608
2621
|
newSorting.splice(0, newSorting.length - ((_instance$options$max = instance.options.maxMultiSortColCount) != null ? _instance$options$max : Number.MAX_SAFE_INTEGER));
|
|
@@ -2611,7 +2624,7 @@
|
|
|
2611
2624
|
newSorting = old.map(d => {
|
|
2612
2625
|
if (d.id === column.id) {
|
|
2613
2626
|
return { ...d,
|
|
2614
|
-
desc: hasDescDefined ? desc :
|
|
2627
|
+
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2615
2628
|
};
|
|
2616
2629
|
}
|
|
2617
2630
|
|
|
@@ -2624,6 +2637,23 @@
|
|
|
2624
2637
|
return newSorting;
|
|
2625
2638
|
});
|
|
2626
2639
|
},
|
|
2640
|
+
getNextSortingOrder: () => {
|
|
2641
|
+
var _ref2, _column$columnDef$sor;
|
|
2642
|
+
|
|
2643
|
+
const sortDescFirst = (_ref2 = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : instance.options.sortDescFirst) != null ? _ref2 : column.getAutoSortDir() === 'desc';
|
|
2644
|
+
const firstSortDirection = sortDescFirst ? 'desc' : 'asc';
|
|
2645
|
+
const isSorted = column.getIsSorted();
|
|
2646
|
+
|
|
2647
|
+
if (!isSorted) {
|
|
2648
|
+
return firstSortDirection;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
if (isSorted === firstSortDirection) {
|
|
2652
|
+
return isSorted === 'desc' ? 'asc' : 'desc';
|
|
2653
|
+
} else {
|
|
2654
|
+
return false;
|
|
2655
|
+
}
|
|
2656
|
+
},
|
|
2627
2657
|
getCanSort: () => {
|
|
2628
2658
|
var _column$columnDef$ena, _instance$options$ena3;
|
|
2629
2659
|
|
|
@@ -2915,9 +2945,9 @@
|
|
|
2915
2945
|
header: props => props.header.column.id,
|
|
2916
2946
|
footer: props => props.header.column.id,
|
|
2917
2947
|
cell: props => {
|
|
2918
|
-
var _props$getValue$toStr, _props$getValue
|
|
2948
|
+
var _props$getValue$toStr, _props$getValue;
|
|
2919
2949
|
|
|
2920
|
-
return (_props$getValue$toStr = (_props$getValue
|
|
2950
|
+
return (_props$getValue$toStr = (_props$getValue = props.getValue()) == null ? void 0 : _props$getValue.toString == null ? void 0 : _props$getValue.toString()) != null ? _props$getValue$toStr : null;
|
|
2921
2951
|
},
|
|
2922
2952
|
...instance._features.reduce((obj, feature) => {
|
|
2923
2953
|
return Object.assign(obj, feature.getDefaultColumnDef == null ? void 0 : feature.getDefaultColumnDef());
|
|
@@ -3071,6 +3101,12 @@
|
|
|
3071
3101
|
}
|
|
3072
3102
|
|
|
3073
3103
|
function createCell(instance, row, column, columnId) {
|
|
3104
|
+
const getRenderValue = () => {
|
|
3105
|
+
var _cell$getValue;
|
|
3106
|
+
|
|
3107
|
+
return (_cell$getValue = cell.getValue()) != null ? _cell$getValue : instance.options.renderFallbackValue;
|
|
3108
|
+
};
|
|
3109
|
+
|
|
3074
3110
|
const cell = {
|
|
3075
3111
|
id: row.id + "_" + column.id,
|
|
3076
3112
|
row,
|
|
@@ -3082,7 +3118,7 @@
|
|
|
3082
3118
|
column,
|
|
3083
3119
|
row,
|
|
3084
3120
|
cell: cell,
|
|
3085
|
-
getValue:
|
|
3121
|
+
getValue: getRenderValue
|
|
3086
3122
|
}) : null;
|
|
3087
3123
|
}
|
|
3088
3124
|
};
|
|
@@ -3688,11 +3724,6 @@
|
|
|
3688
3724
|
if (aggregateFn) {
|
|
3689
3725
|
row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
|
|
3690
3726
|
return row._groupingValuesCache[columnId];
|
|
3691
|
-
} else if (column.aggregationFn) {
|
|
3692
|
-
console.info({
|
|
3693
|
-
column
|
|
3694
|
-
});
|
|
3695
|
-
throw new Error("Table: Invalid column.aggregateType option for column listed above" );
|
|
3696
3727
|
}
|
|
3697
3728
|
}
|
|
3698
3729
|
});
|
|
@@ -3871,6 +3902,7 @@
|
|
|
3871
3902
|
onStateChange: () => {},
|
|
3872
3903
|
// noop
|
|
3873
3904
|
render,
|
|
3905
|
+
renderFallbackValue: null,
|
|
3874
3906
|
...options
|
|
3875
3907
|
}; // Create a new table instance and store it in state
|
|
3876
3908
|
|