@tanstack/svelte-table 8.0.0-beta.6 → 8.0.0-beta.9

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":"c1f5-163"},{"name":"svelte-table/src","children":[{"uid":"c1f5-165","name":"placeholder.svelte"},{"uid":"c1f5-167","name":"placeholder.ts"},{"uid":"c1f5-169","name":"render-component.ts"},{"uid":"c1f5-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"c1f5-163":{"renderedLength":138814,"gzipLength":23636,"brotliLength":0,"mainUid":"c1f5-162"},"c1f5-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"c1f5-164"},"c1f5-167":{"renderedLength":246,"gzipLength":184,"brotliLength":0,"mainUid":"c1f5-166"},"c1f5-169":{"renderedLength":1458,"gzipLength":539,"brotliLength":0,"mainUid":"c1f5-168"},"c1f5-171":{"renderedLength":3046,"gzipLength":993,"brotliLength":0,"mainUid":"c1f5-170"}},"nodeMetas":{"c1f5-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"c1f5-163"},"imported":[],"importedBy":[{"uid":"c1f5-170"}]},"c1f5-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"c1f5-165"},"imported":[{"uid":"c1f5-172"}],"importedBy":[{"uid":"c1f5-166"}]},"c1f5-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"c1f5-167"},"imported":[{"uid":"c1f5-172"},{"uid":"c1f5-164"}],"importedBy":[{"uid":"c1f5-170"}]},"c1f5-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"c1f5-169"},"imported":[{"uid":"c1f5-172"}],"importedBy":[{"uid":"c1f5-170"}]},"c1f5-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"c1f5-171"},"imported":[{"uid":"c1f5-162"},{"uid":"c1f5-166"},{"uid":"c1f5-172"},{"uid":"c1f5-173"},{"uid":"c1f5-168"}],"importedBy":[],"isEntry":true},"c1f5-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"c1f5-170"},{"uid":"c1f5-166"},{"uid":"c1f5-168"},{"uid":"c1f5-164"}],"isExternal":true},"c1f5-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"c1f5-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":"612e-163"},{"name":"svelte-table/src","children":[{"uid":"612e-165","name":"placeholder.svelte"},{"uid":"612e-167","name":"placeholder.ts"},{"uid":"612e-169","name":"render-component.ts"},{"uid":"612e-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"612e-163":{"renderedLength":139242,"gzipLength":23687,"brotliLength":0,"mainUid":"612e-162"},"612e-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"612e-164"},"612e-167":{"renderedLength":246,"gzipLength":184,"brotliLength":0,"mainUid":"612e-166"},"612e-169":{"renderedLength":1458,"gzipLength":539,"brotliLength":0,"mainUid":"612e-168"},"612e-171":{"renderedLength":3046,"gzipLength":993,"brotliLength":0,"mainUid":"612e-170"}},"nodeMetas":{"612e-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"612e-163"},"imported":[],"importedBy":[{"uid":"612e-170"}]},"612e-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"612e-165"},"imported":[{"uid":"612e-172"}],"importedBy":[{"uid":"612e-166"}]},"612e-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"612e-167"},"imported":[{"uid":"612e-172"},{"uid":"612e-164"}],"importedBy":[{"uid":"612e-170"}]},"612e-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"612e-169"},"imported":[{"uid":"612e-172"}],"importedBy":[{"uid":"612e-170"}]},"612e-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"612e-171"},"imported":[{"uid":"612e-162"},{"uid":"612e-166"},{"uid":"612e-172"},{"uid":"612e-173"},{"uid":"612e-168"}],"importedBy":[],"isEntry":true},"612e-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"612e-170"},{"uid":"612e-166"},{"uid":"612e-168"},{"uid":"612e-164"}],"isExternal":true},"612e-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"612e-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": "c1f5-175"
14
+ "uid": "612e-175"
15
15
  },
16
16
  {
17
17
  "name": "svelte-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "c1f5-177",
20
+ "uid": "612e-177",
21
21
  "name": "placeholder.svelte"
22
22
  },
23
23
  {
24
- "uid": "c1f5-179",
24
+ "uid": "612e-179",
25
25
  "name": "placeholder.ts"
26
26
  },
27
27
  {
28
- "uid": "c1f5-181",
28
+ "uid": "612e-181",
29
29
  "name": "render-component.ts"
30
30
  },
31
31
  {
32
- "uid": "c1f5-183",
32
+ "uid": "612e-183",
33
33
  "name": "index.ts"
34
34
  }
35
35
  ]
@@ -42,153 +42,153 @@
42
42
  "isRoot": true
43
43
  },
44
44
  "nodeParts": {
45
- "c1f5-175": {
46
- "renderedLength": 138814,
47
- "gzipLength": 23636,
45
+ "612e-175": {
46
+ "renderedLength": 139242,
47
+ "gzipLength": 23687,
48
48
  "brotliLength": 0,
49
- "mainUid": "c1f5-174"
49
+ "mainUid": "612e-174"
50
50
  },
51
- "c1f5-177": {
51
+ "612e-177": {
52
52
  "renderedLength": 927,
53
53
  "gzipLength": 445,
54
54
  "brotliLength": 0,
55
- "mainUid": "c1f5-176"
55
+ "mainUid": "612e-176"
56
56
  },
57
- "c1f5-179": {
57
+ "612e-179": {
58
58
  "renderedLength": 246,
59
59
  "gzipLength": 184,
60
60
  "brotliLength": 0,
61
- "mainUid": "c1f5-178"
61
+ "mainUid": "612e-178"
62
62
  },
63
- "c1f5-181": {
63
+ "612e-181": {
64
64
  "renderedLength": 1458,
65
65
  "gzipLength": 539,
66
66
  "brotliLength": 0,
67
- "mainUid": "c1f5-180"
67
+ "mainUid": "612e-180"
68
68
  },
69
- "c1f5-183": {
69
+ "612e-183": {
70
70
  "renderedLength": 3046,
71
71
  "gzipLength": 993,
72
72
  "brotliLength": 0,
73
- "mainUid": "c1f5-182"
73
+ "mainUid": "612e-182"
74
74
  }
75
75
  },
76
76
  "nodeMetas": {
77
- "c1f5-174": {
77
+ "612e-174": {
78
78
  "id": "/packages/table-core/build/esm/index.js",
79
79
  "moduleParts": {
80
- "index.production.js": "c1f5-175"
80
+ "index.production.js": "612e-175"
81
81
  },
82
82
  "imported": [],
83
83
  "importedBy": [
84
84
  {
85
- "uid": "c1f5-182"
85
+ "uid": "612e-182"
86
86
  }
87
87
  ]
88
88
  },
89
- "c1f5-176": {
89
+ "612e-176": {
90
90
  "id": "/packages/svelte-table/src/placeholder.svelte",
91
91
  "moduleParts": {
92
- "index.production.js": "c1f5-177"
92
+ "index.production.js": "612e-177"
93
93
  },
94
94
  "imported": [
95
95
  {
96
- "uid": "c1f5-184"
96
+ "uid": "612e-184"
97
97
  }
98
98
  ],
99
99
  "importedBy": [
100
100
  {
101
- "uid": "c1f5-178"
101
+ "uid": "612e-178"
102
102
  }
103
103
  ]
104
104
  },
105
- "c1f5-178": {
105
+ "612e-178": {
106
106
  "id": "/packages/svelte-table/src/placeholder.ts",
107
107
  "moduleParts": {
108
- "index.production.js": "c1f5-179"
108
+ "index.production.js": "612e-179"
109
109
  },
110
110
  "imported": [
111
111
  {
112
- "uid": "c1f5-184"
112
+ "uid": "612e-184"
113
113
  },
114
114
  {
115
- "uid": "c1f5-176"
115
+ "uid": "612e-176"
116
116
  }
117
117
  ],
118
118
  "importedBy": [
119
119
  {
120
- "uid": "c1f5-182"
120
+ "uid": "612e-182"
121
121
  }
122
122
  ]
123
123
  },
124
- "c1f5-180": {
124
+ "612e-180": {
125
125
  "id": "/packages/svelte-table/src/render-component.ts",
126
126
  "moduleParts": {
127
- "index.production.js": "c1f5-181"
127
+ "index.production.js": "612e-181"
128
128
  },
129
129
  "imported": [
130
130
  {
131
- "uid": "c1f5-184"
131
+ "uid": "612e-184"
132
132
  }
133
133
  ],
134
134
  "importedBy": [
135
135
  {
136
- "uid": "c1f5-182"
136
+ "uid": "612e-182"
137
137
  }
138
138
  ]
139
139
  },
140
- "c1f5-182": {
140
+ "612e-182": {
141
141
  "id": "/packages/svelte-table/src/index.ts",
142
142
  "moduleParts": {
143
- "index.production.js": "c1f5-183"
143
+ "index.production.js": "612e-183"
144
144
  },
145
145
  "imported": [
146
146
  {
147
- "uid": "c1f5-174"
147
+ "uid": "612e-174"
148
148
  },
149
149
  {
150
- "uid": "c1f5-178"
150
+ "uid": "612e-178"
151
151
  },
152
152
  {
153
- "uid": "c1f5-184"
153
+ "uid": "612e-184"
154
154
  },
155
155
  {
156
- "uid": "c1f5-185"
156
+ "uid": "612e-185"
157
157
  },
158
158
  {
159
- "uid": "c1f5-180"
159
+ "uid": "612e-180"
160
160
  }
161
161
  ],
162
162
  "importedBy": [],
163
163
  "isEntry": true
164
164
  },
165
- "c1f5-184": {
165
+ "612e-184": {
166
166
  "id": "svelte/internal",
167
167
  "moduleParts": {},
168
168
  "imported": [],
169
169
  "importedBy": [
170
170
  {
171
- "uid": "c1f5-182"
171
+ "uid": "612e-182"
172
172
  },
173
173
  {
174
- "uid": "c1f5-178"
174
+ "uid": "612e-178"
175
175
  },
176
176
  {
177
- "uid": "c1f5-180"
177
+ "uid": "612e-180"
178
178
  },
179
179
  {
180
- "uid": "c1f5-176"
180
+ "uid": "612e-176"
181
181
  }
182
182
  ],
183
183
  "isExternal": true
184
184
  },
185
- "c1f5-185": {
185
+ "612e-185": {
186
186
  "id": "svelte/store",
187
187
  "moduleParts": {},
188
188
  "imported": [],
189
189
  "importedBy": [
190
190
  {
191
- "uid": "c1f5-182"
191
+ "uid": "612e-182"
192
192
  }
193
193
  ],
194
194
  "isExternal": true
@@ -983,38 +983,54 @@
983
983
  };
984
984
 
985
985
  const includesString = (row, columnId, filterValue) => {
986
+ var _row$getValue;
987
+
986
988
  const search = filterValue.toLowerCase();
987
- return row.getValue(columnId).toLowerCase().includes(search);
989
+ return (_row$getValue = row.getValue(columnId)) == null ? void 0 : _row$getValue.toLowerCase().includes(search);
988
990
  };
989
991
 
990
992
  includesString.autoRemove = val => testFalsey(val);
991
993
 
992
994
  const includesStringSensitive = (row, columnId, filterValue) => {
993
- return row.getValue(columnId).includes(filterValue);
995
+ var _row$getValue2;
996
+
997
+ return (_row$getValue2 = row.getValue(columnId)) == null ? void 0 : _row$getValue2.includes(filterValue);
994
998
  };
995
999
 
996
1000
  includesStringSensitive.autoRemove = val => testFalsey(val);
997
1001
 
998
1002
  const equalsString = (row, columnId, filterValue) => {
999
- return row.getValue(columnId).toLowerCase() === filterValue.toLowerCase();
1003
+ var _row$getValue3;
1004
+
1005
+ return ((_row$getValue3 = row.getValue(columnId)) == null ? void 0 : _row$getValue3.toLowerCase()) === filterValue.toLowerCase();
1000
1006
  };
1001
1007
 
1002
1008
  equalsString.autoRemove = val => testFalsey(val);
1003
1009
 
1004
1010
  const arrIncludes = (row, columnId, filterValue) => {
1005
- return row.getValue(columnId).includes(filterValue);
1011
+ var _row$getValue4;
1012
+
1013
+ return (_row$getValue4 = row.getValue(columnId)) == null ? void 0 : _row$getValue4.includes(filterValue);
1006
1014
  };
1007
1015
 
1008
1016
  arrIncludes.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1009
1017
 
1010
1018
  const arrIncludesAll = (row, columnId, filterValue) => {
1011
- return !filterValue.some(val => !row.getValue(columnId).includes(val));
1019
+ return !filterValue.some(val => {
1020
+ var _row$getValue5;
1021
+
1022
+ return !((_row$getValue5 = row.getValue(columnId)) != null && _row$getValue5.includes(val));
1023
+ });
1012
1024
  };
1013
1025
 
1014
1026
  arrIncludesAll.autoRemove = val => testFalsey(val) || !(val != null && val.length);
1015
1027
 
1016
1028
  const arrIncludesSome = (row, columnId, filterValue) => {
1017
- return filterValue.some(val => row.getValue(columnId).includes(val));
1029
+ return filterValue.some(val => {
1030
+ var _row$getValue6;
1031
+
1032
+ return (_row$getValue6 = row.getValue(columnId)) == null ? void 0 : _row$getValue6.includes(val);
1033
+ });
1018
1034
  };
1019
1035
 
1020
1036
  arrIncludesSome.autoRemove = val => testFalsey(val) || !(val != null && val.length);
@@ -1544,7 +1560,7 @@
1544
1560
  getIsAggregated: () => {
1545
1561
  var _row$subRows;
1546
1562
 
1547
- return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1563
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1548
1564
  },
1549
1565
  renderAggregatedCell: () => {
1550
1566
  {
@@ -1699,7 +1715,7 @@
1699
1715
  setPageIndex: updater => {
1700
1716
  instance.setPagination(old => {
1701
1717
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1702
- const maxPageIndex = typeof old.pageCount !== 'undefined' ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1718
+ const maxPageIndex = typeof instance.options.pageCount === 'undefined' || instance.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : instance.options.pageCount - 1;
1703
1719
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1704
1720
  return { ...old,
1705
1721
  pageIndex
@@ -1728,9 +1744,9 @@
1728
1744
  });
1729
1745
  },
1730
1746
  setPageCount: updater => instance.setPagination(old => {
1731
- var _old$pageCount;
1747
+ var _instance$options$pag;
1732
1748
 
1733
- let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1749
+ let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1734
1750
 
1735
1751
  if (typeof newPageCount === 'number') {
1736
1752
  newPageCount = Math.max(-1, newPageCount);
@@ -1740,7 +1756,7 @@
1740
1756
  pageCount: newPageCount
1741
1757
  };
1742
1758
  }),
1743
- getPageOptions: memo(() => [instance.getState().pagination.pageSize, instance.getState().pagination.pageCount], (pageSize, pageCount) => {
1759
+ getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1744
1760
  let pageOptions = [];
1745
1761
 
1746
1762
  if (pageCount && pageCount > 0) {
@@ -1794,15 +1810,9 @@
1794
1810
  return instance._getPaginationRowModel();
1795
1811
  },
1796
1812
  getPageCount: () => {
1797
- const {
1798
- pageCount
1799
- } = instance.getState().pagination;
1813
+ var _instance$options$pag2;
1800
1814
 
1801
- if (typeof pageCount !== 'undefined') {
1802
- return pageCount;
1803
- }
1804
-
1805
- return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1815
+ return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1806
1816
  }
1807
1817
  };
1808
1818
  }
@@ -3235,8 +3245,6 @@
3235
3245
  function filterRowModelFromLeafs(rowsToFilter, filterRow, instance) {
3236
3246
  const newFilteredFlatRows = [];
3237
3247
  const newFilteredRowsById = {};
3238
- let row;
3239
- let newRow;
3240
3248
 
3241
3249
  const recurseFilterRows = function (rowsToFilter, depth) {
3242
3250
  if (depth === void 0) {
@@ -3248,10 +3256,10 @@
3248
3256
  for (let i = 0; i < rowsToFilter.length; i++) {
3249
3257
  var _row$subRows;
3250
3258
 
3251
- row = rowsToFilter[i];
3259
+ let row = rowsToFilter[i];
3252
3260
 
3253
3261
  if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
3254
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3262
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3255
3263
  newRow.columnFilters = row.columnFilters;
3256
3264
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3257
3265
 
@@ -3280,10 +3288,7 @@
3280
3288
  }
3281
3289
  function filterRowModelFromRoot(rowsToFilter, filterRow, instance) {
3282
3290
  const newFilteredFlatRows = [];
3283
- const newFilteredRowsById = {};
3284
- let rows;
3285
- let row;
3286
- let newRow; // Filters top level and nested rows
3291
+ const newFilteredRowsById = {}; // Filters top level and nested rows
3287
3292
 
3288
3293
  const recurseFilterRows = function (rowsToFilter, depth) {
3289
3294
  if (depth === void 0) {
@@ -3291,17 +3296,17 @@
3291
3296
  }
3292
3297
 
3293
3298
  // Filter from parents downward first
3294
- rows = []; // Apply the filter to any subRows
3299
+ const rows = []; // Apply the filter to any subRows
3295
3300
 
3296
3301
  for (let i = 0; i < rowsToFilter.length; i++) {
3297
- row = rowsToFilter[i];
3302
+ let row = rowsToFilter[i];
3298
3303
  const pass = filterRow(row);
3299
3304
 
3300
3305
  if (pass) {
3301
3306
  var _row$subRows2;
3302
3307
 
3303
3308
  if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
3304
- newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3309
+ const newRow = createRow(instance, row.id, row.original, row.index, row.depth);
3305
3310
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
3306
3311
  row = newRow;
3307
3312
  }