@tanstack/react-table 8.0.0-alpha.70 → 8.0.0-alpha.73

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.
@@ -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":"fca1-127"},{"name":"react-table/src/index.tsx","uid":"fca1-129"}]}]}],"isRoot":true},"nodeParts":{"fca1-127":{"renderedLength":142311,"gzipLength":24347,"brotliLength":0,"mainUid":"fca1-126"},"fca1-129":{"renderedLength":2102,"gzipLength":836,"brotliLength":0,"mainUid":"fca1-128"}},"nodeMetas":{"fca1-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"fca1-127"},"imported":[],"importedBy":[{"uid":"fca1-128"}]},"fca1-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"fca1-129"},"imported":[{"uid":"fca1-130"},{"uid":"fca1-126"}],"importedBy":[],"isEntry":true},"fca1-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"fca1-128"}],"isExternal":true}},"env":{"rollup":"2.70.2"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
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":"1ed1-127"},{"name":"react-table/src/index.tsx","uid":"1ed1-129"}]}]}],"isRoot":true},"nodeParts":{"1ed1-127":{"renderedLength":142433,"gzipLength":24399,"brotliLength":0,"mainUid":"1ed1-126"},"1ed1-129":{"renderedLength":2102,"gzipLength":836,"brotliLength":0,"mainUid":"1ed1-128"}},"nodeMetas":{"1ed1-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"1ed1-127"},"imported":[],"importedBy":[{"uid":"1ed1-128"}]},"1ed1-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"1ed1-129"},"imported":[{"uid":"1ed1-130"},{"uid":"1ed1-126"}],"importedBy":[],"isEntry":true},"1ed1-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"1ed1-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;
@@ -11,11 +11,11 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "fca1-132"
14
+ "uid": "1ed1-132"
15
15
  },
16
16
  {
17
17
  "name": "react-table/src/index.tsx",
18
- "uid": "fca1-134"
18
+ "uid": "1ed1-134"
19
19
  }
20
20
  ]
21
21
  }
@@ -25,55 +25,55 @@
25
25
  "isRoot": true
26
26
  },
27
27
  "nodeParts": {
28
- "fca1-132": {
29
- "renderedLength": 142311,
30
- "gzipLength": 24347,
28
+ "1ed1-132": {
29
+ "renderedLength": 142433,
30
+ "gzipLength": 24399,
31
31
  "brotliLength": 0,
32
- "mainUid": "fca1-131"
32
+ "mainUid": "1ed1-131"
33
33
  },
34
- "fca1-134": {
34
+ "1ed1-134": {
35
35
  "renderedLength": 2102,
36
36
  "gzipLength": 836,
37
37
  "brotliLength": 0,
38
- "mainUid": "fca1-133"
38
+ "mainUid": "1ed1-133"
39
39
  }
40
40
  },
41
41
  "nodeMetas": {
42
- "fca1-131": {
42
+ "1ed1-131": {
43
43
  "id": "/packages/table-core/build/esm/index.js",
44
44
  "moduleParts": {
45
- "index.production.js": "fca1-132"
45
+ "index.production.js": "1ed1-132"
46
46
  },
47
47
  "imported": [],
48
48
  "importedBy": [
49
49
  {
50
- "uid": "fca1-133"
50
+ "uid": "1ed1-133"
51
51
  }
52
52
  ]
53
53
  },
54
- "fca1-133": {
54
+ "1ed1-133": {
55
55
  "id": "/packages/react-table/src/index.tsx",
56
56
  "moduleParts": {
57
- "index.production.js": "fca1-134"
57
+ "index.production.js": "1ed1-134"
58
58
  },
59
59
  "imported": [
60
60
  {
61
- "uid": "fca1-135"
61
+ "uid": "1ed1-135"
62
62
  },
63
63
  {
64
- "uid": "fca1-131"
64
+ "uid": "1ed1-131"
65
65
  }
66
66
  ],
67
67
  "importedBy": [],
68
68
  "isEntry": true
69
69
  },
70
- "fca1-135": {
70
+ "1ed1-135": {
71
71
  "id": "react",
72
72
  "moduleParts": {},
73
73
  "imported": [],
74
74
  "importedBy": [
75
75
  {
76
- "uid": "fca1-133"
76
+ "uid": "1ed1-133"
77
77
  }
78
78
  ],
79
79
  "isExternal": true
@@ -405,7 +405,7 @@
405
405
  row,
406
406
  column,
407
407
  getValue: () => row.getValue(columnId),
408
- renderCell: () => column.cell ? instance.render(column.cell, {
408
+ renderCell: () => column.cell ? instance._render(column.cell, {
409
409
  instance,
410
410
  column,
411
411
  row,
@@ -650,28 +650,28 @@
650
650
  var _instance$getHeaderGr, _instance$getHeaderGr2;
651
651
 
652
652
  return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce((sum, header) => {
653
- return sum + header.column.getSize();
653
+ return sum + header.getSize();
654
654
  }, 0)) != null ? _instance$getHeaderGr : 0;
655
655
  },
656
656
  getLeftTotalSize: () => {
657
657
  var _instance$getLeftHead, _instance$getLeftHead2;
658
658
 
659
659
  return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce((sum, header) => {
660
- return sum + header.column.getSize();
660
+ return sum + header.getSize();
661
661
  }, 0)) != null ? _instance$getLeftHead : 0;
662
662
  },
663
663
  getCenterTotalSize: () => {
664
664
  var _instance$getCenterHe, _instance$getCenterHe2;
665
665
 
666
666
  return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce((sum, header) => {
667
- return sum + header.column.getSize();
667
+ return sum + header.getSize();
668
668
  }, 0)) != null ? _instance$getCenterHe : 0;
669
669
  },
670
670
  getRightTotalSize: () => {
671
671
  var _instance$getRightHea, _instance$getRightHea2;
672
672
 
673
673
  return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce((sum, header) => {
674
- return sum + header.column.getSize();
674
+ return sum + header.getSize();
675
675
  }, 0)) != null ? _instance$getRightHea : 0;
676
676
  }
677
677
  };
@@ -725,10 +725,14 @@
725
725
  },
726
726
  createInstance: instance => {
727
727
  let registered = false;
728
+ let queued = false;
728
729
  return {
729
730
  _autoResetExpanded: () => {
730
731
  if (!registered) {
731
- registered = true;
732
+ instance._queue(() => {
733
+ registered = true;
734
+ });
735
+
732
736
  return;
733
737
  }
734
738
 
@@ -737,7 +741,13 @@
737
741
  }
738
742
 
739
743
  if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
740
- instance.resetExpanded();
744
+ if (queued) return;
745
+ queued = true;
746
+
747
+ instance._queue(() => {
748
+ instance.resetExpanded();
749
+ queued = false;
750
+ });
741
751
  }
742
752
  },
743
753
  setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
@@ -1090,7 +1100,7 @@
1090
1100
  _getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
1091
1101
  getFacetedMinMaxValues: () => {
1092
1102
  if (!column._getFacetedMinMaxValues) {
1093
- return [NaN, NaN];
1103
+ return undefined;
1094
1104
  }
1095
1105
 
1096
1106
  return column._getFacetedMinMaxValues();
@@ -1181,7 +1191,7 @@
1181
1191
  _getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
1182
1192
  getGlobalFacetedMinMaxValues: () => {
1183
1193
  if (!instance._getGlobalFacetedMinMaxValues) {
1184
- return [NaN, NaN];
1194
+ return;
1185
1195
  }
1186
1196
 
1187
1197
  return instance._getGlobalFacetedMinMaxValues();
@@ -1418,7 +1428,7 @@
1418
1428
  var _column$aggregatedCel;
1419
1429
 
1420
1430
  const template = (_column$aggregatedCel = column.aggregatedCell) != null ? _column$aggregatedCel : column.cell;
1421
- return template ? instance.render(template, {
1431
+ return template ? instance._render(template, {
1422
1432
  instance,
1423
1433
  column,
1424
1434
  row,
@@ -1519,25 +1529,32 @@
1519
1529
  },
1520
1530
  getDefaultOptions: instance => {
1521
1531
  return {
1522
- onPaginationChange: makeStateUpdater('pagination', instance),
1523
- autoResetPageIndex: true
1532
+ onPaginationChange: makeStateUpdater('pagination', instance)
1524
1533
  };
1525
1534
  },
1526
1535
  createInstance: instance => {
1527
1536
  let registered = false;
1537
+ let queued = false;
1528
1538
  return {
1529
1539
  _autoResetPageIndex: () => {
1540
+ var _ref, _instance$options$aut;
1541
+
1530
1542
  if (!registered) {
1531
- registered = true;
1532
- return;
1533
- }
1543
+ instance._queue(() => {
1544
+ registered = true;
1545
+ });
1534
1546
 
1535
- if (instance.options.autoResetAll === false) {
1536
1547
  return;
1537
1548
  }
1538
1549
 
1539
- if (instance.options.autoResetAll === true || instance.options.autoResetPageIndex) {
1540
- instance.resetPageIndex();
1550
+ if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetPageIndex) != null ? _ref : !instance.options.manualPagination) {
1551
+ if (queued) return;
1552
+ queued = true;
1553
+
1554
+ instance._queue(() => {
1555
+ instance.resetPageIndex();
1556
+ queued = false;
1557
+ });
1541
1558
  }
1542
1559
  },
1543
1560
  setPagination: updater => {
@@ -1556,7 +1573,7 @@
1556
1573
  setPageIndex: updater => {
1557
1574
  instance.setPagination(old => {
1558
1575
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1559
- const maxPageIndex = old.pageCount && old.pageCount > 0 ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1576
+ const maxPageIndex = typeof old.pageCount !== 'undefined' ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1560
1577
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1561
1578
  return { ...old,
1562
1579
  pageIndex
@@ -2667,12 +2684,12 @@
2667
2684
  recurseHeader(header);
2668
2685
  return leafHeaders;
2669
2686
  },
2670
- renderHeader: () => column.header ? instance.render(column.header, {
2687
+ renderHeader: () => column.header ? instance._render(column.header, {
2671
2688
  instance,
2672
2689
  header: header,
2673
2690
  column
2674
2691
  }) : null,
2675
- renderFooter: () => column.footer ? instance.render(column.footer, {
2692
+ renderFooter: () => column.footer ? instance._render(column.footer, {
2676
2693
  instance,
2677
2694
  header: header,
2678
2695
  column
@@ -3146,7 +3163,7 @@
3146
3163
  ...options
3147
3164
  },
3148
3165
  initialState,
3149
- queue: cb => {
3166
+ _queue: cb => {
3150
3167
  queued.push(cb);
3151
3168
 
3152
3169
  if (!queuedTimeout) {
@@ -3204,7 +3221,7 @@
3204
3221
  const newOptions = functionalUpdate(updater, instance.options);
3205
3222
  instance.options = mergeOptions(newOptions);
3206
3223
  },
3207
- render: (template, props) => {
3224
+ _render: (template, props) => {
3208
3225
  if (typeof instance.options.render === 'function') {
3209
3226
  return instance.options.render(template, props);
3210
3227
  }
@@ -3378,9 +3395,7 @@
3378
3395
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3379
3396
  },
3380
3397
  onChange: () => {
3381
- instance.queue(() => {
3382
- instance._autoResetPageIndex();
3383
- });
3398
+ instance._autoResetPageIndex();
3384
3399
  }
3385
3400
  });
3386
3401
  }
@@ -3586,9 +3601,7 @@
3586
3601
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3587
3602
  },
3588
3603
  onChange: () => {
3589
- instance.queue(() => {
3590
- instance._autoResetPageIndex();
3591
- });
3604
+ instance._autoResetPageIndex();
3592
3605
  }
3593
3606
  });
3594
3607
  }
@@ -3656,14 +3669,20 @@
3656
3669
 
3657
3670
  function getFacetedMinMaxValues() {
3658
3671
  return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3659
- var _facetedRowModel$flat, _facetedRowModel$flat2, _facetedRowModel$flat3, _facetedRowModel$flat4;
3672
+ var _facetedRowModel$flat;
3660
3673
 
3661
- let facetedMinMaxValues = [(_facetedRowModel$flat = (_facetedRowModel$flat2 = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat2.getValue(columnId)) != null ? _facetedRowModel$flat : null, (_facetedRowModel$flat3 = (_facetedRowModel$flat4 = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat4.getValue(columnId)) != null ? _facetedRowModel$flat3 : null];
3674
+ const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3675
+
3676
+ if (typeof firstValue === 'undefined') {
3677
+ return undefined;
3678
+ }
3679
+
3680
+ let facetedMinMaxValues = [firstValue, firstValue];
3662
3681
 
3663
3682
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3664
- var _facetedRowModel$flat5;
3683
+ var _facetedRowModel$flat2;
3665
3684
 
3666
- const value = (_facetedRowModel$flat5 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat5.getValue(columnId);
3685
+ const value = (_facetedRowModel$flat2 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat2.getValue(columnId);
3667
3686
 
3668
3687
  if (value < facetedMinMaxValues[0]) {
3669
3688
  facetedMinMaxValues[0] = value;
@@ -3771,9 +3790,7 @@
3771
3790
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3772
3791
  },
3773
3792
  onChange: () => {
3774
- instance.queue(() => {
3775
- instance._autoResetPageIndex();
3776
- });
3793
+ instance._autoResetPageIndex();
3777
3794
  }
3778
3795
  });
3779
3796
  }
@@ -3903,7 +3920,7 @@
3903
3920
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3904
3921
  },
3905
3922
  onChange: () => {
3906
- instance.queue(() => {
3923
+ instance._queue(() => {
3907
3924
  instance._autoResetExpanded();
3908
3925
 
3909
3926
  instance._autoResetPageIndex();