@tanstack/react-table 8.0.0-beta.4 → 8.0.0-beta.7

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":"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}};
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":"779a-127"},{"name":"react-table/src/index.tsx","uid":"779a-129"}]}]}],"isRoot":true},"nodeParts":{"779a-127":{"renderedLength":138802,"gzipLength":23615,"brotliLength":0,"mainUid":"779a-126"},"779a-129":{"renderedLength":2135,"gzipLength":854,"brotliLength":0,"mainUid":"779a-128"}},"nodeMetas":{"779a-126":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"779a-127"},"imported":[],"importedBy":[{"uid":"779a-128"}]},"779a-128":{"id":"/packages/react-table/src/index.tsx","moduleParts":{"index.production.js":"779a-129"},"imported":[{"uid":"779a-130"},{"uid":"779a-126"}],"importedBy":[],"isEntry":true},"779a-130":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"779a-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": "50f7-132"
14
+ "uid": "779a-132"
15
15
  },
16
16
  {
17
17
  "name": "react-table/src/index.tsx",
18
- "uid": "50f7-134"
18
+ "uid": "779a-134"
19
19
  }
20
20
  ]
21
21
  }
@@ -25,55 +25,55 @@
25
25
  "isRoot": true
26
26
  },
27
27
  "nodeParts": {
28
- "50f7-132": {
29
- "renderedLength": 138364,
30
- "gzipLength": 23596,
28
+ "779a-132": {
29
+ "renderedLength": 138802,
30
+ "gzipLength": 23615,
31
31
  "brotliLength": 0,
32
- "mainUid": "50f7-131"
32
+ "mainUid": "779a-131"
33
33
  },
34
- "50f7-134": {
34
+ "779a-134": {
35
35
  "renderedLength": 2135,
36
36
  "gzipLength": 854,
37
37
  "brotliLength": 0,
38
- "mainUid": "50f7-133"
38
+ "mainUid": "779a-133"
39
39
  }
40
40
  },
41
41
  "nodeMetas": {
42
- "50f7-131": {
42
+ "779a-131": {
43
43
  "id": "/packages/table-core/build/esm/index.js",
44
44
  "moduleParts": {
45
- "index.production.js": "50f7-132"
45
+ "index.production.js": "779a-132"
46
46
  },
47
47
  "imported": [],
48
48
  "importedBy": [
49
49
  {
50
- "uid": "50f7-133"
50
+ "uid": "779a-133"
51
51
  }
52
52
  ]
53
53
  },
54
- "50f7-133": {
54
+ "779a-133": {
55
55
  "id": "/packages/react-table/src/index.tsx",
56
56
  "moduleParts": {
57
- "index.production.js": "50f7-134"
57
+ "index.production.js": "779a-134"
58
58
  },
59
59
  "imported": [
60
60
  {
61
- "uid": "50f7-135"
61
+ "uid": "779a-135"
62
62
  },
63
63
  {
64
- "uid": "50f7-131"
64
+ "uid": "779a-131"
65
65
  }
66
66
  ],
67
67
  "importedBy": [],
68
68
  "isEntry": true
69
69
  },
70
- "50f7-135": {
70
+ "779a-135": {
71
71
  "id": "react",
72
72
  "moduleParts": {},
73
73
  "imported": [],
74
74
  "importedBy": [
75
75
  {
76
- "uid": "50f7-133"
76
+ "uid": "779a-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 === false) {
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.getGroupedRowModel(),
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.getSortedRowModel(),
1534
+ getPreGroupedRowModel: () => instance.getFilteredRowModel(),
1538
1535
  getGroupedRowModel: () => {
1539
1536
  if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
1540
1537
  instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
@@ -1567,7 +1564,7 @@
1567
1564
  getIsAggregated: () => {
1568
1565
  var _row$subRows;
1569
1566
 
1570
- return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1567
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1571
1568
  },
1572
1569
  renderAggregatedCell: () => {
1573
1570
  {
@@ -2052,11 +2049,11 @@
2052
2049
  });
2053
2050
  },
2054
2051
  toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
2055
- typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2052
+ const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2056
2053
  const rowSelection = { ...old
2057
2054
  };
2058
2055
  instance.getRowModel().rows.forEach(row => {
2059
- mutateRowIsSelected(rowSelection, row.id, value, instance);
2056
+ mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
2060
2057
  });
2061
2058
  return rowSelection;
2062
2059
  }),
@@ -2147,7 +2144,7 @@
2147
2144
  return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
2148
2145
  }
2149
2146
  }),
2150
- getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getGroupedRowModel()], (rowSelection, rowModel) => {
2147
+ getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
2151
2148
  if (!Object.keys(rowSelection).length) {
2152
2149
  return {
2153
2150
  rows: [],
@@ -2211,7 +2208,7 @@
2211
2208
  },
2212
2209
  getIsSomePageRowsSelected: () => {
2213
2210
  const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2214
- return instance.getIsAllPageRowsSelected() ? false : !!(paginationFlatRows != null && paginationFlatRows.length);
2211
+ return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2215
2212
  },
2216
2213
  getToggleAllRowsSelectedHandler: () => {
2217
2214
  return e => {
@@ -2697,7 +2694,7 @@
2697
2694
 
2698
2695
  instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
2699
2696
  },
2700
- getPreSortedRowModel: () => instance.getFilteredRowModel(),
2697
+ getPreSortedRowModel: () => instance.getGroupedRowModel(),
2701
2698
  getSortedRowModel: () => {
2702
2699
  if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
2703
2700
  instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
@@ -3847,20 +3844,34 @@
3847
3844
  const pageStart = pageSize * pageIndex;
3848
3845
  const pageEnd = pageStart + pageSize;
3849
3846
  rows = rows.slice(pageStart, pageEnd);
3847
+ let paginatedRowModel;
3850
3848
 
3851
3849
  if (!instance.options.paginateExpandedRows) {
3852
- return expandRows({
3850
+ paginatedRowModel = expandRows({
3853
3851
  rows,
3854
3852
  flatRows,
3855
3853
  rowsById
3856
3854
  });
3855
+ } else {
3856
+ paginatedRowModel = {
3857
+ rows,
3858
+ flatRows,
3859
+ rowsById
3860
+ };
3857
3861
  }
3858
3862
 
3859
- return {
3860
- rows,
3861
- flatRows,
3862
- rowsById
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
+ }
3863
3871
  };
3872
+
3873
+ paginatedRowModel.rows.forEach(handleRow);
3874
+ return paginatedRowModel;
3864
3875
  }, {
3865
3876
  key: 'getPaginationRowModel',
3866
3877
  debug: () => {