@tanstack/svelte-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-163"},{"name":"svelte-table/src","children":[{"uid":"50f7-165","name":"placeholder.svelte"},{"uid":"50f7-167","name":"placeholder.ts"},{"uid":"50f7-169","name":"render-component.ts"},{"uid":"50f7-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"50f7-163":{"renderedLength":138366,"gzipLength":23598,"brotliLength":0,"mainUid":"50f7-162"},"50f7-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"50f7-164"},"50f7-167":{"renderedLength":246,"gzipLength":184,"brotliLength":0,"mainUid":"50f7-166"},"50f7-169":{"renderedLength":1458,"gzipLength":539,"brotliLength":0,"mainUid":"50f7-168"},"50f7-171":{"renderedLength":3046,"gzipLength":993,"brotliLength":0,"mainUid":"50f7-170"}},"nodeMetas":{"50f7-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"50f7-163"},"imported":[],"importedBy":[{"uid":"50f7-170"}]},"50f7-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"50f7-165"},"imported":[{"uid":"50f7-172"}],"importedBy":[{"uid":"50f7-166"}]},"50f7-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"50f7-167"},"imported":[{"uid":"50f7-172"},{"uid":"50f7-164"}],"importedBy":[{"uid":"50f7-170"}]},"50f7-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"50f7-169"},"imported":[{"uid":"50f7-172"}],"importedBy":[{"uid":"50f7-170"}]},"50f7-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"50f7-171"},"imported":[{"uid":"50f7-162"},{"uid":"50f7-166"},{"uid":"50f7-172"},{"uid":"50f7-173"},{"uid":"50f7-168"}],"importedBy":[],"isEntry":true},"50f7-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"50f7-170"},{"uid":"50f7-166"},{"uid":"50f7-168"},{"uid":"50f7-164"}],"isExternal":true},"50f7-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"50f7-170"}],"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-163"},{"name":"svelte-table/src","children":[{"uid":"779a-165","name":"placeholder.svelte"},{"uid":"779a-167","name":"placeholder.ts"},{"uid":"779a-169","name":"render-component.ts"},{"uid":"779a-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"779a-163":{"renderedLength":138804,"gzipLength":23617,"brotliLength":0,"mainUid":"779a-162"},"779a-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"779a-164"},"779a-167":{"renderedLength":246,"gzipLength":184,"brotliLength":0,"mainUid":"779a-166"},"779a-169":{"renderedLength":1458,"gzipLength":539,"brotliLength":0,"mainUid":"779a-168"},"779a-171":{"renderedLength":3046,"gzipLength":993,"brotliLength":0,"mainUid":"779a-170"}},"nodeMetas":{"779a-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"779a-163"},"imported":[],"importedBy":[{"uid":"779a-170"}]},"779a-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"779a-165"},"imported":[{"uid":"779a-172"}],"importedBy":[{"uid":"779a-166"}]},"779a-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"779a-167"},"imported":[{"uid":"779a-172"},{"uid":"779a-164"}],"importedBy":[{"uid":"779a-170"}]},"779a-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"779a-169"},"imported":[{"uid":"779a-172"}],"importedBy":[{"uid":"779a-170"}]},"779a-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"779a-171"},"imported":[{"uid":"779a-162"},{"uid":"779a-166"},{"uid":"779a-172"},{"uid":"779a-173"},{"uid":"779a-168"}],"importedBy":[],"isEntry":true},"779a-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"779a-170"},{"uid":"779a-166"},{"uid":"779a-168"},{"uid":"779a-164"}],"isExternal":true},"779a-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"779a-170"}],"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,25 +11,25 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "50f7-175"
14
+ "uid": "779a-175"
15
15
  },
16
16
  {
17
17
  "name": "svelte-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "50f7-177",
20
+ "uid": "779a-177",
21
21
  "name": "placeholder.svelte"
22
22
  },
23
23
  {
24
- "uid": "50f7-179",
24
+ "uid": "779a-179",
25
25
  "name": "placeholder.ts"
26
26
  },
27
27
  {
28
- "uid": "50f7-181",
28
+ "uid": "779a-181",
29
29
  "name": "render-component.ts"
30
30
  },
31
31
  {
32
- "uid": "50f7-183",
32
+ "uid": "779a-183",
33
33
  "name": "index.ts"
34
34
  }
35
35
  ]
@@ -42,153 +42,153 @@
42
42
  "isRoot": true
43
43
  },
44
44
  "nodeParts": {
45
- "50f7-175": {
46
- "renderedLength": 138366,
47
- "gzipLength": 23598,
45
+ "779a-175": {
46
+ "renderedLength": 138804,
47
+ "gzipLength": 23617,
48
48
  "brotliLength": 0,
49
- "mainUid": "50f7-174"
49
+ "mainUid": "779a-174"
50
50
  },
51
- "50f7-177": {
51
+ "779a-177": {
52
52
  "renderedLength": 927,
53
53
  "gzipLength": 445,
54
54
  "brotliLength": 0,
55
- "mainUid": "50f7-176"
55
+ "mainUid": "779a-176"
56
56
  },
57
- "50f7-179": {
57
+ "779a-179": {
58
58
  "renderedLength": 246,
59
59
  "gzipLength": 184,
60
60
  "brotliLength": 0,
61
- "mainUid": "50f7-178"
61
+ "mainUid": "779a-178"
62
62
  },
63
- "50f7-181": {
63
+ "779a-181": {
64
64
  "renderedLength": 1458,
65
65
  "gzipLength": 539,
66
66
  "brotliLength": 0,
67
- "mainUid": "50f7-180"
67
+ "mainUid": "779a-180"
68
68
  },
69
- "50f7-183": {
69
+ "779a-183": {
70
70
  "renderedLength": 3046,
71
71
  "gzipLength": 993,
72
72
  "brotliLength": 0,
73
- "mainUid": "50f7-182"
73
+ "mainUid": "779a-182"
74
74
  }
75
75
  },
76
76
  "nodeMetas": {
77
- "50f7-174": {
77
+ "779a-174": {
78
78
  "id": "/packages/table-core/build/esm/index.js",
79
79
  "moduleParts": {
80
- "index.production.js": "50f7-175"
80
+ "index.production.js": "779a-175"
81
81
  },
82
82
  "imported": [],
83
83
  "importedBy": [
84
84
  {
85
- "uid": "50f7-182"
85
+ "uid": "779a-182"
86
86
  }
87
87
  ]
88
88
  },
89
- "50f7-176": {
89
+ "779a-176": {
90
90
  "id": "/packages/svelte-table/src/placeholder.svelte",
91
91
  "moduleParts": {
92
- "index.production.js": "50f7-177"
92
+ "index.production.js": "779a-177"
93
93
  },
94
94
  "imported": [
95
95
  {
96
- "uid": "50f7-184"
96
+ "uid": "779a-184"
97
97
  }
98
98
  ],
99
99
  "importedBy": [
100
100
  {
101
- "uid": "50f7-178"
101
+ "uid": "779a-178"
102
102
  }
103
103
  ]
104
104
  },
105
- "50f7-178": {
105
+ "779a-178": {
106
106
  "id": "/packages/svelte-table/src/placeholder.ts",
107
107
  "moduleParts": {
108
- "index.production.js": "50f7-179"
108
+ "index.production.js": "779a-179"
109
109
  },
110
110
  "imported": [
111
111
  {
112
- "uid": "50f7-184"
112
+ "uid": "779a-184"
113
113
  },
114
114
  {
115
- "uid": "50f7-176"
115
+ "uid": "779a-176"
116
116
  }
117
117
  ],
118
118
  "importedBy": [
119
119
  {
120
- "uid": "50f7-182"
120
+ "uid": "779a-182"
121
121
  }
122
122
  ]
123
123
  },
124
- "50f7-180": {
124
+ "779a-180": {
125
125
  "id": "/packages/svelte-table/src/render-component.ts",
126
126
  "moduleParts": {
127
- "index.production.js": "50f7-181"
127
+ "index.production.js": "779a-181"
128
128
  },
129
129
  "imported": [
130
130
  {
131
- "uid": "50f7-184"
131
+ "uid": "779a-184"
132
132
  }
133
133
  ],
134
134
  "importedBy": [
135
135
  {
136
- "uid": "50f7-182"
136
+ "uid": "779a-182"
137
137
  }
138
138
  ]
139
139
  },
140
- "50f7-182": {
140
+ "779a-182": {
141
141
  "id": "/packages/svelte-table/src/index.ts",
142
142
  "moduleParts": {
143
- "index.production.js": "50f7-183"
143
+ "index.production.js": "779a-183"
144
144
  },
145
145
  "imported": [
146
146
  {
147
- "uid": "50f7-174"
147
+ "uid": "779a-174"
148
148
  },
149
149
  {
150
- "uid": "50f7-178"
150
+ "uid": "779a-178"
151
151
  },
152
152
  {
153
- "uid": "50f7-184"
153
+ "uid": "779a-184"
154
154
  },
155
155
  {
156
- "uid": "50f7-185"
156
+ "uid": "779a-185"
157
157
  },
158
158
  {
159
- "uid": "50f7-180"
159
+ "uid": "779a-180"
160
160
  }
161
161
  ],
162
162
  "importedBy": [],
163
163
  "isEntry": true
164
164
  },
165
- "50f7-184": {
165
+ "779a-184": {
166
166
  "id": "svelte/internal",
167
167
  "moduleParts": {},
168
168
  "imported": [],
169
169
  "importedBy": [
170
170
  {
171
- "uid": "50f7-182"
171
+ "uid": "779a-182"
172
172
  },
173
173
  {
174
- "uid": "50f7-178"
174
+ "uid": "779a-178"
175
175
  },
176
176
  {
177
- "uid": "50f7-180"
177
+ "uid": "779a-180"
178
178
  },
179
179
  {
180
- "uid": "50f7-176"
180
+ "uid": "779a-176"
181
181
  }
182
182
  ],
183
183
  "isExternal": true
184
184
  },
185
- "50f7-185": {
185
+ "779a-185": {
186
186
  "id": "svelte/store",
187
187
  "moduleParts": {},
188
188
  "imported": [],
189
189
  "importedBy": [
190
190
  {
191
- "uid": "50f7-182"
191
+ "uid": "779a-182"
192
192
  }
193
193
  ],
194
194
  "isExternal": true
@@ -828,7 +828,6 @@
828
828
  getDefaultOptions: instance => {
829
829
  return {
830
830
  onExpandedChange: makeStateUpdater('expanded', instance),
831
- autoResetExpanded: true,
832
831
  paginateExpandedRows: true
833
832
  };
834
833
  },
@@ -837,6 +836,8 @@
837
836
  let queued = false;
838
837
  return {
839
838
  _autoResetExpanded: () => {
839
+ var _ref, _instance$options$aut;
840
+
840
841
  if (!registered) {
841
842
  instance._queue(() => {
842
843
  registered = true;
@@ -845,11 +846,7 @@
845
846
  return;
846
847
  }
847
848
 
848
- if (instance.options.autoResetAll === false) {
849
- return;
850
- }
851
-
852
- if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
849
+ if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
853
850
  if (queued) return;
854
851
  queued = true;
855
852
 
@@ -913,7 +910,7 @@
913
910
  });
914
911
  return maxDepth;
915
912
  },
916
- getPreExpandedRowModel: () => instance.getGroupedRowModel(),
913
+ getPreExpandedRowModel: () => instance.getSortedRowModel(),
917
914
  getExpandedRowModel: () => {
918
915
  if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
919
916
  instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
@@ -1514,7 +1511,7 @@
1514
1511
 
1515
1512
  instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
1516
1513
  },
1517
- getPreGroupedRowModel: () => instance.getSortedRowModel(),
1514
+ getPreGroupedRowModel: () => instance.getFilteredRowModel(),
1518
1515
  getGroupedRowModel: () => {
1519
1516
  if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
1520
1517
  instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
@@ -1547,7 +1544,7 @@
1547
1544
  getIsAggregated: () => {
1548
1545
  var _row$subRows;
1549
1546
 
1550
- return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1547
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1551
1548
  },
1552
1549
  renderAggregatedCell: () => {
1553
1550
  {
@@ -2032,11 +2029,11 @@
2032
2029
  });
2033
2030
  },
2034
2031
  toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
2035
- typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2032
+ const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2036
2033
  const rowSelection = { ...old
2037
2034
  };
2038
2035
  instance.getRowModel().rows.forEach(row => {
2039
- mutateRowIsSelected(rowSelection, row.id, value, instance);
2036
+ mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
2040
2037
  });
2041
2038
  return rowSelection;
2042
2039
  }),
@@ -2127,7 +2124,7 @@
2127
2124
  return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
2128
2125
  }
2129
2126
  }),
2130
- getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getGroupedRowModel()], (rowSelection, rowModel) => {
2127
+ getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
2131
2128
  if (!Object.keys(rowSelection).length) {
2132
2129
  return {
2133
2130
  rows: [],
@@ -2191,7 +2188,7 @@
2191
2188
  },
2192
2189
  getIsSomePageRowsSelected: () => {
2193
2190
  const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2194
- return instance.getIsAllPageRowsSelected() ? false : !!(paginationFlatRows != null && paginationFlatRows.length);
2191
+ return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2195
2192
  },
2196
2193
  getToggleAllRowsSelectedHandler: () => {
2197
2194
  return e => {
@@ -2677,7 +2674,7 @@
2677
2674
 
2678
2675
  instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
2679
2676
  },
2680
- getPreSortedRowModel: () => instance.getFilteredRowModel(),
2677
+ getPreSortedRowModel: () => instance.getGroupedRowModel(),
2681
2678
  getSortedRowModel: () => {
2682
2679
  if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
2683
2680
  instance._getSortedRowModel = instance.options.getSortedRowModel(instance);
@@ -3827,20 +3824,34 @@
3827
3824
  const pageStart = pageSize * pageIndex;
3828
3825
  const pageEnd = pageStart + pageSize;
3829
3826
  rows = rows.slice(pageStart, pageEnd);
3827
+ let paginatedRowModel;
3830
3828
 
3831
3829
  if (!instance.options.paginateExpandedRows) {
3832
- return expandRows({
3830
+ paginatedRowModel = expandRows({
3833
3831
  rows,
3834
3832
  flatRows,
3835
3833
  rowsById
3836
3834
  });
3835
+ } else {
3836
+ paginatedRowModel = {
3837
+ rows,
3838
+ flatRows,
3839
+ rowsById
3840
+ };
3837
3841
  }
3838
3842
 
3839
- return {
3840
- rows,
3841
- flatRows,
3842
- rowsById
3843
+ paginatedRowModel.flatRows = [];
3844
+
3845
+ const handleRow = row => {
3846
+ paginatedRowModel.flatRows.push(row);
3847
+
3848
+ if (row.subRows.length) {
3849
+ row.subRows.forEach(handleRow);
3850
+ }
3843
3851
  };
3852
+
3853
+ paginatedRowModel.rows.forEach(handleRow);
3854
+ return paginatedRowModel;
3844
3855
  }, {
3845
3856
  key: 'getPaginationRowModel',
3846
3857
  debug: () => {