@tanstack/react-table 8.0.0-alpha.69 → 8.0.0-alpha.71

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":"8f31-127"},{"name":"react-table/src/index.tsx","uid":"8f31-129"}]}]}],"isRoot":true},"nodeParts":{"8f31-127":{"renderedLength":142276,"gzipLength":24319,"brotliLength":0,"mainUid":"8f31-126"},"8f31-129":{"renderedLength":2102,"gzipLength":836,"brotliLength":0,"mainUid":"8f31-128"}},"nodeMetas":{"8f31-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"8f31-127"},"imported":[],"importedBy":[{"uid":"8f31-128"}]},"8f31-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"8f31-129"},"imported":[{"uid":"8f31-130"},{"uid":"8f31-126"}],"importedBy":[],"isEntry":true},"8f31-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"8f31-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":"9906-127"},{"name":"react-table/src/index.tsx","uid":"9906-129"}]}]}],"isRoot":true},"nodeParts":{"9906-127":{"renderedLength":142387,"gzipLength":24367,"brotliLength":0,"mainUid":"9906-126"},"9906-129":{"renderedLength":2102,"gzipLength":836,"brotliLength":0,"mainUid":"9906-128"}},"nodeMetas":{"9906-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"9906-127"},"imported":[],"importedBy":[{"uid":"9906-128"}]},"9906-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"9906-129"},"imported":[{"uid":"9906-130"},{"uid":"9906-126"}],"importedBy":[],"isEntry":true},"9906-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"9906-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": "8f31-132"
14
+ "uid": "9906-132"
15
15
  },
16
16
  {
17
17
  "name": "react-table/src/index.tsx",
18
- "uid": "8f31-134"
18
+ "uid": "9906-134"
19
19
  }
20
20
  ]
21
21
  }
@@ -25,55 +25,55 @@
25
25
  "isRoot": true
26
26
  },
27
27
  "nodeParts": {
28
- "8f31-132": {
29
- "renderedLength": 142276,
30
- "gzipLength": 24319,
28
+ "9906-132": {
29
+ "renderedLength": 142387,
30
+ "gzipLength": 24367,
31
31
  "brotliLength": 0,
32
- "mainUid": "8f31-131"
32
+ "mainUid": "9906-131"
33
33
  },
34
- "8f31-134": {
34
+ "9906-134": {
35
35
  "renderedLength": 2102,
36
36
  "gzipLength": 836,
37
37
  "brotliLength": 0,
38
- "mainUid": "8f31-133"
38
+ "mainUid": "9906-133"
39
39
  }
40
40
  },
41
41
  "nodeMetas": {
42
- "8f31-131": {
42
+ "9906-131": {
43
43
  "id": "/packages/table-core/build/esm/index.js",
44
44
  "moduleParts": {
45
- "index.production.js": "8f31-132"
45
+ "index.production.js": "9906-132"
46
46
  },
47
47
  "imported": [],
48
48
  "importedBy": [
49
49
  {
50
- "uid": "8f31-133"
50
+ "uid": "9906-133"
51
51
  }
52
52
  ]
53
53
  },
54
- "8f31-133": {
54
+ "9906-133": {
55
55
  "id": "/packages/react-table/src/index.tsx",
56
56
  "moduleParts": {
57
- "index.production.js": "8f31-134"
57
+ "index.production.js": "9906-134"
58
58
  },
59
59
  "imported": [
60
60
  {
61
- "uid": "8f31-135"
61
+ "uid": "9906-135"
62
62
  },
63
63
  {
64
- "uid": "8f31-131"
64
+ "uid": "9906-131"
65
65
  }
66
66
  ],
67
67
  "importedBy": [],
68
68
  "isEntry": true
69
69
  },
70
- "8f31-135": {
70
+ "9906-135": {
71
71
  "id": "react",
72
72
  "moduleParts": {},
73
73
  "imported": [],
74
74
  "importedBy": [
75
75
  {
76
- "uid": "8f31-133"
76
+ "uid": "9906-133"
77
77
  }
78
78
  ],
79
79
  "isExternal": true
@@ -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,13 @@
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
+ });
732
735
  return;
733
736
  }
734
737
 
@@ -737,7 +740,12 @@
737
740
  }
738
741
 
739
742
  if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
740
- instance.resetExpanded();
743
+ if (queued) return;
744
+ queued = true;
745
+ instance.queue(() => {
746
+ instance.resetExpanded();
747
+ queued = false;
748
+ });
741
749
  }
742
750
  },
743
751
  setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
@@ -1090,7 +1098,7 @@
1090
1098
  _getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
1091
1099
  getFacetedMinMaxValues: () => {
1092
1100
  if (!column._getFacetedMinMaxValues) {
1093
- return [NaN, NaN];
1101
+ return undefined;
1094
1102
  }
1095
1103
 
1096
1104
  return column._getFacetedMinMaxValues();
@@ -1181,7 +1189,7 @@
1181
1189
  _getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
1182
1190
  getGlobalFacetedMinMaxValues: () => {
1183
1191
  if (!instance._getGlobalFacetedMinMaxValues) {
1184
- return [NaN, NaN];
1192
+ return;
1185
1193
  }
1186
1194
 
1187
1195
  return instance._getGlobalFacetedMinMaxValues();
@@ -1501,12 +1509,10 @@
1501
1509
  };
1502
1510
 
1503
1511
  //
1504
- const defaultPageCount = -1;
1505
1512
  const defaultPageIndex = 0;
1506
1513
  const defaultPageSize = 10;
1507
1514
 
1508
1515
  const getDefaultPaginationState = () => ({
1509
- pageCount: defaultPageCount,
1510
1516
  pageIndex: defaultPageIndex,
1511
1517
  pageSize: defaultPageSize
1512
1518
  });
@@ -1527,10 +1533,13 @@
1527
1533
  },
1528
1534
  createInstance: instance => {
1529
1535
  let registered = false;
1536
+ let queued = false;
1530
1537
  return {
1531
1538
  _autoResetPageIndex: () => {
1532
1539
  if (!registered) {
1533
- registered = true;
1540
+ instance.queue(() => {
1541
+ registered = true;
1542
+ });
1534
1543
  return;
1535
1544
  }
1536
1545
 
@@ -1539,7 +1548,12 @@
1539
1548
  }
1540
1549
 
1541
1550
  if (instance.options.autoResetAll === true || instance.options.autoResetPageIndex) {
1542
- instance.resetPageIndex();
1551
+ if (queued) return;
1552
+ queued = true;
1553
+ instance.queue(() => {
1554
+ instance.resetPageIndex();
1555
+ queued = false;
1556
+ });
1543
1557
  }
1544
1558
  },
1545
1559
  setPagination: updater => {
@@ -1587,7 +1601,9 @@
1587
1601
  });
1588
1602
  },
1589
1603
  setPageCount: updater => instance.setPagination(old => {
1590
- let newPageCount = functionalUpdate(updater, old.pageCount);
1604
+ var _old$pageCount;
1605
+
1606
+ let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1591
1607
 
1592
1608
  if (typeof newPageCount === 'number') {
1593
1609
  newPageCount = Math.max(-1, newPageCount);
@@ -1655,7 +1671,7 @@
1655
1671
  pageCount
1656
1672
  } = instance.getState().pagination;
1657
1673
 
1658
- if (pageCount > 0) {
1674
+ if (typeof pageCount !== 'undefined') {
1659
1675
  return pageCount;
1660
1676
  }
1661
1677
 
@@ -3378,9 +3394,7 @@
3378
3394
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3379
3395
  },
3380
3396
  onChange: () => {
3381
- instance.queue(() => {
3382
- instance._autoResetPageIndex();
3383
- });
3397
+ instance._autoResetPageIndex();
3384
3398
  }
3385
3399
  });
3386
3400
  }
@@ -3586,9 +3600,7 @@
3586
3600
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3587
3601
  },
3588
3602
  onChange: () => {
3589
- instance.queue(() => {
3590
- instance._autoResetPageIndex();
3591
- });
3603
+ instance._autoResetPageIndex();
3592
3604
  }
3593
3605
  });
3594
3606
  }
@@ -3656,14 +3668,20 @@
3656
3668
 
3657
3669
  function getFacetedMinMaxValues() {
3658
3670
  return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3659
- var _facetedRowModel$flat, _facetedRowModel$flat2, _facetedRowModel$flat3, _facetedRowModel$flat4;
3671
+ var _facetedRowModel$flat;
3660
3672
 
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];
3673
+ const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3674
+
3675
+ if (typeof firstValue === 'undefined') {
3676
+ return undefined;
3677
+ }
3678
+
3679
+ let facetedMinMaxValues = [firstValue, firstValue];
3662
3680
 
3663
3681
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3664
- var _facetedRowModel$flat5;
3682
+ var _facetedRowModel$flat2;
3665
3683
 
3666
- const value = (_facetedRowModel$flat5 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat5.getValue(columnId);
3684
+ const value = (_facetedRowModel$flat2 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat2.getValue(columnId);
3667
3685
 
3668
3686
  if (value < facetedMinMaxValues[0]) {
3669
3687
  facetedMinMaxValues[0] = value;
@@ -3771,9 +3789,7 @@
3771
3789
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3772
3790
  },
3773
3791
  onChange: () => {
3774
- instance.queue(() => {
3775
- instance._autoResetPageIndex();
3776
- });
3792
+ instance._autoResetPageIndex();
3777
3793
  }
3778
3794
  });
3779
3795
  }