@tanstack/react-table 8.0.0-alpha.85 → 8.0.0-alpha.88
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/table-core/build/esm/index.js +78 -80
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +78 -80
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +17 -17
- package/build/umd/index.development.js +78 -80
- 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 +5 -5
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":"8ad0-127"},{"name":"react-table/src/index.tsx","uid":"8ad0-129"}]}]}],"isRoot":true},"nodeParts":{"8ad0-127":{"renderedLength":137430,"gzipLength":23365,"brotliLength":0,"mainUid":"8ad0-126"},"8ad0-129":{"renderedLength":2102,"gzipLength":836,"brotliLength":0,"mainUid":"8ad0-128"}},"nodeMetas":{"8ad0-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"8ad0-127"},"imported":[],"importedBy":[{"uid":"8ad0-128"}]},"8ad0-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"8ad0-129"},"imported":[{"uid":"8ad0-130"},{"uid":"8ad0-126"}],"importedBy":[],"isEntry":true},"8ad0-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"8ad0-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": "8ad0-132"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "react-table/src/index.tsx",
|
|
18
|
-
"uid": "
|
|
18
|
+
"uid": "8ad0-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
|
+
"8ad0-132": {
|
|
29
|
+
"renderedLength": 137430,
|
|
30
|
+
"gzipLength": 23365,
|
|
31
31
|
"brotliLength": 0,
|
|
32
|
-
"mainUid": "
|
|
32
|
+
"mainUid": "8ad0-131"
|
|
33
33
|
},
|
|
34
|
-
"
|
|
34
|
+
"8ad0-134": {
|
|
35
35
|
"renderedLength": 2102,
|
|
36
36
|
"gzipLength": 836,
|
|
37
37
|
"brotliLength": 0,
|
|
38
|
-
"mainUid": "
|
|
38
|
+
"mainUid": "8ad0-133"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"nodeMetas": {
|
|
42
|
-
"
|
|
42
|
+
"8ad0-131": {
|
|
43
43
|
"id": "/packages/table-core/build/esm/index.js",
|
|
44
44
|
"moduleParts": {
|
|
45
|
-
"index.production.js": "
|
|
45
|
+
"index.production.js": "8ad0-132"
|
|
46
46
|
},
|
|
47
47
|
"imported": [],
|
|
48
48
|
"importedBy": [
|
|
49
49
|
{
|
|
50
|
-
"uid": "
|
|
50
|
+
"uid": "8ad0-133"
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
|
-
"
|
|
54
|
+
"8ad0-133": {
|
|
55
55
|
"id": "/packages/react-table/src/index.tsx",
|
|
56
56
|
"moduleParts": {
|
|
57
|
-
"index.production.js": "
|
|
57
|
+
"index.production.js": "8ad0-134"
|
|
58
58
|
},
|
|
59
59
|
"imported": [
|
|
60
60
|
{
|
|
61
|
-
"uid": "
|
|
61
|
+
"uid": "8ad0-135"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
"uid": "
|
|
64
|
+
"uid": "8ad0-131"
|
|
65
65
|
}
|
|
66
66
|
],
|
|
67
67
|
"importedBy": [],
|
|
68
68
|
"isEntry": true
|
|
69
69
|
},
|
|
70
|
-
"
|
|
70
|
+
"8ad0-135": {
|
|
71
71
|
"id": "react",
|
|
72
72
|
"moduleParts": {},
|
|
73
73
|
"imported": [],
|
|
74
74
|
"importedBy": [
|
|
75
75
|
{
|
|
76
|
-
"uid": "
|
|
76
|
+
"uid": "8ad0-133"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
79
|
"isExternal": true
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
let column = {
|
|
147
|
+
let column = {
|
|
148
148
|
id: "" + id,
|
|
149
149
|
accessorFn,
|
|
150
150
|
parent: parent,
|
|
@@ -849,7 +849,6 @@
|
|
|
849
849
|
return {
|
|
850
850
|
onExpandedChange: makeStateUpdater('expanded', instance),
|
|
851
851
|
autoResetExpanded: true,
|
|
852
|
-
expandSubRows: true,
|
|
853
852
|
paginateExpandedRows: true
|
|
854
853
|
};
|
|
855
854
|
},
|
|
@@ -909,8 +908,12 @@
|
|
|
909
908
|
getIsAllRowsExpanded: () => {
|
|
910
909
|
const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
|
|
911
910
|
|
|
912
|
-
if (expanded ===
|
|
913
|
-
return true;
|
|
911
|
+
if (typeof expanded === 'boolean') {
|
|
912
|
+
return expanded === true;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
if (!Object.keys(expanded).length) {
|
|
916
|
+
return false;
|
|
914
917
|
} // If any row is not expanded, return false
|
|
915
918
|
|
|
916
919
|
|
|
@@ -2365,21 +2368,54 @@
|
|
|
2365
2368
|
}
|
|
2366
2369
|
|
|
2367
2370
|
const reSplitAlphaNumeric = /([0-9]+)/gm;
|
|
2368
|
-
const sortingFns = {
|
|
2369
|
-
alphanumeric,
|
|
2370
|
-
alphanumericCaseSensitive,
|
|
2371
|
-
text,
|
|
2372
|
-
textCaseSensitive,
|
|
2373
|
-
datetime,
|
|
2374
|
-
basic
|
|
2375
|
-
};
|
|
2376
2371
|
|
|
2377
|
-
|
|
2372
|
+
const alphanumeric = (rowA, rowB, columnId) => {
|
|
2378
2373
|
return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
|
|
2379
|
-
}
|
|
2374
|
+
};
|
|
2380
2375
|
|
|
2381
|
-
|
|
2376
|
+
const alphanumericCaseSensitive = (rowA, rowB, columnId) => {
|
|
2382
2377
|
return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
|
|
2378
|
+
}; // The text filter is more basic (less numeric support)
|
|
2379
|
+
// but is much faster
|
|
2380
|
+
|
|
2381
|
+
|
|
2382
|
+
const text = (rowA, rowB, columnId) => {
|
|
2383
|
+
return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
|
|
2384
|
+
}; // The text filter is more basic (less numeric support)
|
|
2385
|
+
// but is much faster
|
|
2386
|
+
|
|
2387
|
+
|
|
2388
|
+
const textCaseSensitive = (rowA, rowB, columnId) => {
|
|
2389
|
+
return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
|
|
2390
|
+
};
|
|
2391
|
+
|
|
2392
|
+
const datetime = (rowA, rowB, columnId) => {
|
|
2393
|
+
return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
|
|
2394
|
+
};
|
|
2395
|
+
|
|
2396
|
+
const basic = (rowA, rowB, columnId) => {
|
|
2397
|
+
return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
|
|
2398
|
+
}; // Utils
|
|
2399
|
+
|
|
2400
|
+
|
|
2401
|
+
function compareBasic(a, b) {
|
|
2402
|
+
return a === b ? 0 : a > b ? 1 : -1;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
function toString(a) {
|
|
2406
|
+
if (typeof a === 'number') {
|
|
2407
|
+
if (isNaN(a) || a === Infinity || a === -Infinity) {
|
|
2408
|
+
return '';
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
return String(a);
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
if (typeof a === 'string') {
|
|
2415
|
+
return a;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
return '';
|
|
2383
2419
|
} // Mixed sorting is slow, but very inclusive of many edge cases.
|
|
2384
2420
|
// It handles numbers, mixed alphanumeric combinations, and even
|
|
2385
2421
|
// null, undefined, and Infinity
|
|
@@ -2426,48 +2462,17 @@
|
|
|
2426
2462
|
}
|
|
2427
2463
|
|
|
2428
2464
|
return a.length - b.length;
|
|
2429
|
-
} //
|
|
2430
|
-
// but is much faster
|
|
2465
|
+
} // Exports
|
|
2431
2466
|
|
|
2432
2467
|
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
function datetime(rowA, rowB, columnId) {
|
|
2444
|
-
return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
function basic(rowA, rowB, columnId) {
|
|
2448
|
-
return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
|
|
2449
|
-
} // Utils
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
function compareBasic(a, b) {
|
|
2453
|
-
return a === b ? 0 : a > b ? 1 : -1;
|
|
2454
|
-
}
|
|
2455
|
-
|
|
2456
|
-
function toString(a) {
|
|
2457
|
-
if (typeof a === 'number') {
|
|
2458
|
-
if (isNaN(a) || a === Infinity || a === -Infinity) {
|
|
2459
|
-
return '';
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
return String(a);
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
if (typeof a === 'string') {
|
|
2466
|
-
return a;
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
return '';
|
|
2470
|
-
}
|
|
2468
|
+
const sortingFns = {
|
|
2469
|
+
alphanumeric,
|
|
2470
|
+
alphanumericCaseSensitive,
|
|
2471
|
+
text,
|
|
2472
|
+
textCaseSensitive,
|
|
2473
|
+
datetime,
|
|
2474
|
+
basic
|
|
2475
|
+
};
|
|
2471
2476
|
|
|
2472
2477
|
//
|
|
2473
2478
|
const Sorting = {
|
|
@@ -2691,11 +2696,6 @@
|
|
|
2691
2696
|
onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
|
|
2692
2697
|
};
|
|
2693
2698
|
},
|
|
2694
|
-
getDefaultColumnDef: () => {
|
|
2695
|
-
return {
|
|
2696
|
-
defaultIsVisible: true
|
|
2697
|
-
};
|
|
2698
|
-
},
|
|
2699
2699
|
createColumn: (column, instance) => {
|
|
2700
2700
|
return {
|
|
2701
2701
|
toggleVisibility: value => {
|
|
@@ -2724,8 +2724,8 @@
|
|
|
2724
2724
|
},
|
|
2725
2725
|
createRow: (row, instance) => {
|
|
2726
2726
|
return {
|
|
2727
|
-
_getAllVisibleCells: memo(() => [row.getAllCells()
|
|
2728
|
-
return
|
|
2727
|
+
_getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
|
|
2728
|
+
return cells.filter(cell => cell.column.getIsVisible());
|
|
2729
2729
|
}, {
|
|
2730
2730
|
key: "development" === 'production' ,
|
|
2731
2731
|
debug: () => {
|
|
@@ -3076,13 +3076,15 @@
|
|
|
3076
3076
|
row,
|
|
3077
3077
|
column,
|
|
3078
3078
|
getValue: () => row.getValue(columnId),
|
|
3079
|
-
renderCell: () =>
|
|
3080
|
-
instance,
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3079
|
+
renderCell: () => {
|
|
3080
|
+
return column.columnDef.cell ? instance._render(column.columnDef.cell, {
|
|
3081
|
+
instance,
|
|
3082
|
+
column,
|
|
3083
|
+
row,
|
|
3084
|
+
cell: cell,
|
|
3085
|
+
getValue: cell.getValue
|
|
3086
|
+
}) : null;
|
|
3087
|
+
}
|
|
3086
3088
|
};
|
|
3087
3089
|
|
|
3088
3090
|
instance._features.forEach(feature => {
|
|
@@ -3157,27 +3159,23 @@
|
|
|
3157
3159
|
flatRows: [],
|
|
3158
3160
|
rowsById: {}
|
|
3159
3161
|
};
|
|
3160
|
-
let rows;
|
|
3161
|
-
let row;
|
|
3162
|
-
let originalRow;
|
|
3163
3162
|
|
|
3164
3163
|
const accessRows = function (originalRows, depth, parent) {
|
|
3165
3164
|
if (depth === void 0) {
|
|
3166
3165
|
depth = 0;
|
|
3167
3166
|
}
|
|
3168
3167
|
|
|
3169
|
-
rows = [];
|
|
3168
|
+
const rows = [];
|
|
3170
3169
|
|
|
3171
3170
|
for (let i = 0; i < originalRows.length; i++) {
|
|
3172
|
-
|
|
3171
|
+
// This could be an expensive check at scale, so we should move it somewhere else, but where?
|
|
3173
3172
|
// if (!id) {
|
|
3174
3173
|
// if ("development" !== 'production') {
|
|
3175
3174
|
// throw new Error(`getRowId expected an ID, but got ${id}`)
|
|
3176
3175
|
// }
|
|
3177
3176
|
// }
|
|
3178
3177
|
// Make the row
|
|
3179
|
-
|
|
3180
|
-
row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
|
|
3178
|
+
const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
|
|
3181
3179
|
|
|
3182
3180
|
rowModel.flatRows.push(row); // Also keep track of every row by its ID
|
|
3183
3181
|
|
|
@@ -3188,7 +3186,7 @@
|
|
|
3188
3186
|
if (instance.options.getSubRows) {
|
|
3189
3187
|
var _row$originalSubRows;
|
|
3190
3188
|
|
|
3191
|
-
row.originalSubRows = instance.options.getSubRows(
|
|
3189
|
+
row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
|
|
3192
3190
|
|
|
3193
3191
|
if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
|
|
3194
3192
|
row.subRows = accessRows(row.originalSubRows, depth + 1, row);
|
|
@@ -3769,7 +3767,7 @@
|
|
|
3769
3767
|
return rowModel;
|
|
3770
3768
|
}
|
|
3771
3769
|
|
|
3772
|
-
return expandRows(rowModel
|
|
3770
|
+
return expandRows(rowModel);
|
|
3773
3771
|
}, {
|
|
3774
3772
|
key: 'getExpandedRowModel',
|
|
3775
3773
|
debug: () => {
|
|
@@ -3787,7 +3785,7 @@
|
|
|
3787
3785
|
|
|
3788
3786
|
expandedRows.push(row);
|
|
3789
3787
|
|
|
3790
|
-
if (
|
|
3788
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
|
|
3791
3789
|
row.subRows.forEach(handleRow);
|
|
3792
3790
|
}
|
|
3793
3791
|
};
|
|
@@ -3824,7 +3822,7 @@
|
|
|
3824
3822
|
rows,
|
|
3825
3823
|
flatRows,
|
|
3826
3824
|
rowsById
|
|
3827
|
-
}
|
|
3825
|
+
});
|
|
3828
3826
|
}
|
|
3829
3827
|
|
|
3830
3828
|
return {
|