@tanstack/svelte-table 8.0.0-alpha.85 → 8.0.0-alpha.88

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":"ddcf-163"},{"name":"svelte-table/src","children":[{"uid":"ddcf-165","name":"placeholder.svelte"},{"uid":"ddcf-167","name":"render-component.ts"},{"uid":"ddcf-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"ddcf-163":{"renderedLength":137538,"gzipLength":23388,"brotliLength":0,"mainUid":"ddcf-162"},"ddcf-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"ddcf-164"},"ddcf-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"ddcf-166"},"ddcf-169":{"renderedLength":2729,"gzipLength":868,"brotliLength":0,"mainUid":"ddcf-168"}},"nodeMetas":{"ddcf-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"ddcf-163"},"imported":[],"importedBy":[{"uid":"ddcf-168"}]},"ddcf-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"ddcf-165"},"imported":[{"uid":"ddcf-170"}],"importedBy":[{"uid":"ddcf-168"}]},"ddcf-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"ddcf-167"},"imported":[{"uid":"ddcf-170"}],"importedBy":[{"uid":"ddcf-168"}]},"ddcf-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"ddcf-169"},"imported":[{"uid":"ddcf-162"},{"uid":"ddcf-164"},{"uid":"ddcf-170"},{"uid":"ddcf-171"},{"uid":"ddcf-166"}],"importedBy":[],"isEntry":true},"ddcf-170":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"ddcf-168"},{"uid":"ddcf-164"},{"uid":"ddcf-166"}],"isExternal":true},"ddcf-171":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"ddcf-168"}],"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":"8ad0-163"},{"name":"svelte-table/src","children":[{"uid":"8ad0-165","name":"placeholder.svelte"},{"uid":"8ad0-167","name":"render-component.ts"},{"uid":"8ad0-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"8ad0-163":{"renderedLength":137432,"gzipLength":23367,"brotliLength":0,"mainUid":"8ad0-162"},"8ad0-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"8ad0-164"},"8ad0-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"8ad0-166"},"8ad0-169":{"renderedLength":2729,"gzipLength":868,"brotliLength":0,"mainUid":"8ad0-168"}},"nodeMetas":{"8ad0-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"8ad0-163"},"imported":[],"importedBy":[{"uid":"8ad0-168"}]},"8ad0-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"8ad0-165"},"imported":[{"uid":"8ad0-170"}],"importedBy":[{"uid":"8ad0-168"}]},"8ad0-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"8ad0-167"},"imported":[{"uid":"8ad0-170"}],"importedBy":[{"uid":"8ad0-168"}]},"8ad0-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"8ad0-169"},"imported":[{"uid":"8ad0-162"},{"uid":"8ad0-164"},{"uid":"8ad0-170"},{"uid":"8ad0-171"},{"uid":"8ad0-166"}],"importedBy":[],"isEntry":true},"8ad0-170":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"8ad0-168"},{"uid":"8ad0-164"},{"uid":"8ad0-166"}],"isExternal":true},"8ad0-171":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"8ad0-168"}],"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,21 +11,21 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "ddcf-173"
14
+ "uid": "8ad0-173"
15
15
  },
16
16
  {
17
17
  "name": "svelte-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "ddcf-175",
20
+ "uid": "8ad0-175",
21
21
  "name": "placeholder.svelte"
22
22
  },
23
23
  {
24
- "uid": "ddcf-177",
24
+ "uid": "8ad0-177",
25
25
  "name": "render-component.ts"
26
26
  },
27
27
  {
28
- "uid": "ddcf-179",
28
+ "uid": "8ad0-179",
29
29
  "name": "index.ts"
30
30
  }
31
31
  ]
@@ -38,125 +38,125 @@
38
38
  "isRoot": true
39
39
  },
40
40
  "nodeParts": {
41
- "ddcf-173": {
42
- "renderedLength": 137538,
43
- "gzipLength": 23388,
41
+ "8ad0-173": {
42
+ "renderedLength": 137432,
43
+ "gzipLength": 23367,
44
44
  "brotliLength": 0,
45
- "mainUid": "ddcf-172"
45
+ "mainUid": "8ad0-172"
46
46
  },
47
- "ddcf-175": {
47
+ "8ad0-175": {
48
48
  "renderedLength": 925,
49
49
  "gzipLength": 444,
50
50
  "brotliLength": 0,
51
- "mainUid": "ddcf-174"
51
+ "mainUid": "8ad0-174"
52
52
  },
53
- "ddcf-177": {
53
+ "8ad0-177": {
54
54
  "renderedLength": 1365,
55
55
  "gzipLength": 519,
56
56
  "brotliLength": 0,
57
- "mainUid": "ddcf-176"
57
+ "mainUid": "8ad0-176"
58
58
  },
59
- "ddcf-179": {
59
+ "8ad0-179": {
60
60
  "renderedLength": 2729,
61
61
  "gzipLength": 868,
62
62
  "brotliLength": 0,
63
- "mainUid": "ddcf-178"
63
+ "mainUid": "8ad0-178"
64
64
  }
65
65
  },
66
66
  "nodeMetas": {
67
- "ddcf-172": {
67
+ "8ad0-172": {
68
68
  "id": "/packages/table-core/build/esm/index.js",
69
69
  "moduleParts": {
70
- "index.production.js": "ddcf-173"
70
+ "index.production.js": "8ad0-173"
71
71
  },
72
72
  "imported": [],
73
73
  "importedBy": [
74
74
  {
75
- "uid": "ddcf-178"
75
+ "uid": "8ad0-178"
76
76
  }
77
77
  ]
78
78
  },
79
- "ddcf-174": {
79
+ "8ad0-174": {
80
80
  "id": "/packages/svelte-table/src/placeholder.svelte",
81
81
  "moduleParts": {
82
- "index.production.js": "ddcf-175"
82
+ "index.production.js": "8ad0-175"
83
83
  },
84
84
  "imported": [
85
85
  {
86
- "uid": "ddcf-180"
86
+ "uid": "8ad0-180"
87
87
  }
88
88
  ],
89
89
  "importedBy": [
90
90
  {
91
- "uid": "ddcf-178"
91
+ "uid": "8ad0-178"
92
92
  }
93
93
  ]
94
94
  },
95
- "ddcf-176": {
95
+ "8ad0-176": {
96
96
  "id": "/packages/svelte-table/src/render-component.ts",
97
97
  "moduleParts": {
98
- "index.production.js": "ddcf-177"
98
+ "index.production.js": "8ad0-177"
99
99
  },
100
100
  "imported": [
101
101
  {
102
- "uid": "ddcf-180"
102
+ "uid": "8ad0-180"
103
103
  }
104
104
  ],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "ddcf-178"
107
+ "uid": "8ad0-178"
108
108
  }
109
109
  ]
110
110
  },
111
- "ddcf-178": {
111
+ "8ad0-178": {
112
112
  "id": "/packages/svelte-table/src/index.ts",
113
113
  "moduleParts": {
114
- "index.production.js": "ddcf-179"
114
+ "index.production.js": "8ad0-179"
115
115
  },
116
116
  "imported": [
117
117
  {
118
- "uid": "ddcf-172"
118
+ "uid": "8ad0-172"
119
119
  },
120
120
  {
121
- "uid": "ddcf-174"
121
+ "uid": "8ad0-174"
122
122
  },
123
123
  {
124
- "uid": "ddcf-180"
124
+ "uid": "8ad0-180"
125
125
  },
126
126
  {
127
- "uid": "ddcf-181"
127
+ "uid": "8ad0-181"
128
128
  },
129
129
  {
130
- "uid": "ddcf-176"
130
+ "uid": "8ad0-176"
131
131
  }
132
132
  ],
133
133
  "importedBy": [],
134
134
  "isEntry": true
135
135
  },
136
- "ddcf-180": {
136
+ "8ad0-180": {
137
137
  "id": "svelte/internal",
138
138
  "moduleParts": {},
139
139
  "imported": [],
140
140
  "importedBy": [
141
141
  {
142
- "uid": "ddcf-178"
142
+ "uid": "8ad0-178"
143
143
  },
144
144
  {
145
- "uid": "ddcf-174"
145
+ "uid": "8ad0-174"
146
146
  },
147
147
  {
148
- "uid": "ddcf-176"
148
+ "uid": "8ad0-176"
149
149
  }
150
150
  ],
151
151
  "isExternal": true
152
152
  },
153
- "ddcf-181": {
153
+ "8ad0-181": {
154
154
  "id": "svelte/store",
155
155
  "moduleParts": {},
156
156
  "imported": [],
157
157
  "importedBy": [
158
158
  {
159
- "uid": "ddcf-178"
159
+ "uid": "8ad0-178"
160
160
  }
161
161
  ],
162
162
  "isExternal": true
@@ -124,7 +124,7 @@
124
124
  }
125
125
  }
126
126
 
127
- let column = { ...columnDef,
127
+ let column = {
128
128
  id: "" + id,
129
129
  accessorFn,
130
130
  parent: parent,
@@ -829,7 +829,6 @@
829
829
  return {
830
830
  onExpandedChange: makeStateUpdater('expanded', instance),
831
831
  autoResetExpanded: true,
832
- expandSubRows: true,
833
832
  paginateExpandedRows: true
834
833
  };
835
834
  },
@@ -889,8 +888,12 @@
889
888
  getIsAllRowsExpanded: () => {
890
889
  const expanded = instance.getState().expanded; // If expanded is true, save some cycles and return true
891
890
 
892
- if (expanded === true) {
893
- return true;
891
+ if (typeof expanded === 'boolean') {
892
+ return expanded === true;
893
+ }
894
+
895
+ if (!Object.keys(expanded).length) {
896
+ return false;
894
897
  } // If any row is not expanded, return false
895
898
 
896
899
 
@@ -2345,21 +2348,54 @@
2345
2348
  }
2346
2349
 
2347
2350
  const reSplitAlphaNumeric = /([0-9]+)/gm;
2348
- const sortingFns = {
2349
- alphanumeric,
2350
- alphanumericCaseSensitive,
2351
- text,
2352
- textCaseSensitive,
2353
- datetime,
2354
- basic
2355
- };
2356
2351
 
2357
- function alphanumeric(rowA, rowB, columnId) {
2352
+ const alphanumeric = (rowA, rowB, columnId) => {
2358
2353
  return compareAlphanumeric(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2359
- }
2354
+ };
2360
2355
 
2361
- function alphanumericCaseSensitive(rowA, rowB, columnId) {
2356
+ const alphanumericCaseSensitive = (rowA, rowB, columnId) => {
2362
2357
  return compareAlphanumeric(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2358
+ }; // The text filter is more basic (less numeric support)
2359
+ // but is much faster
2360
+
2361
+
2362
+ const text = (rowA, rowB, columnId) => {
2363
+ return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2364
+ }; // The text filter is more basic (less numeric support)
2365
+ // but is much faster
2366
+
2367
+
2368
+ const textCaseSensitive = (rowA, rowB, columnId) => {
2369
+ return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2370
+ };
2371
+
2372
+ const datetime = (rowA, rowB, columnId) => {
2373
+ return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
2374
+ };
2375
+
2376
+ const basic = (rowA, rowB, columnId) => {
2377
+ return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
2378
+ }; // Utils
2379
+
2380
+
2381
+ function compareBasic(a, b) {
2382
+ return a === b ? 0 : a > b ? 1 : -1;
2383
+ }
2384
+
2385
+ function toString(a) {
2386
+ if (typeof a === 'number') {
2387
+ if (isNaN(a) || a === Infinity || a === -Infinity) {
2388
+ return '';
2389
+ }
2390
+
2391
+ return String(a);
2392
+ }
2393
+
2394
+ if (typeof a === 'string') {
2395
+ return a;
2396
+ }
2397
+
2398
+ return '';
2363
2399
  } // Mixed sorting is slow, but very inclusive of many edge cases.
2364
2400
  // It handles numbers, mixed alphanumeric combinations, and even
2365
2401
  // null, undefined, and Infinity
@@ -2406,48 +2442,17 @@
2406
2442
  }
2407
2443
 
2408
2444
  return a.length - b.length;
2409
- } // The text filter is more basic (less numeric support)
2410
- // but is much faster
2445
+ } // Exports
2411
2446
 
2412
2447
 
2413
- function text(rowA, rowB, columnId) {
2414
- return compareBasic(toString(rowA.getValue(columnId)).toLowerCase(), toString(rowB.getValue(columnId)).toLowerCase());
2415
- } // The text filter is more basic (less numeric support)
2416
- // but is much faster
2417
-
2418
-
2419
- function textCaseSensitive(rowA, rowB, columnId) {
2420
- return compareBasic(toString(rowA.getValue(columnId)), toString(rowB.getValue(columnId)));
2421
- }
2422
-
2423
- function datetime(rowA, rowB, columnId) {
2424
- return compareBasic(rowA.getValue(columnId).getTime(), rowB.getValue(columnId).getTime());
2425
- }
2426
-
2427
- function basic(rowA, rowB, columnId) {
2428
- return compareBasic(rowA.getValue(columnId), rowB.getValue(columnId));
2429
- } // Utils
2430
-
2431
-
2432
- function compareBasic(a, b) {
2433
- return a === b ? 0 : a > b ? 1 : -1;
2434
- }
2435
-
2436
- function toString(a) {
2437
- if (typeof a === 'number') {
2438
- if (isNaN(a) || a === Infinity || a === -Infinity) {
2439
- return '';
2440
- }
2441
-
2442
- return String(a);
2443
- }
2444
-
2445
- if (typeof a === 'string') {
2446
- return a;
2447
- }
2448
-
2449
- return '';
2450
- }
2448
+ const sortingFns = {
2449
+ alphanumeric,
2450
+ alphanumericCaseSensitive,
2451
+ text,
2452
+ textCaseSensitive,
2453
+ datetime,
2454
+ basic
2455
+ };
2451
2456
 
2452
2457
  //
2453
2458
  const Sorting = {
@@ -2671,11 +2676,6 @@
2671
2676
  onColumnVisibilityChange: makeStateUpdater('columnVisibility', instance)
2672
2677
  };
2673
2678
  },
2674
- getDefaultColumnDef: () => {
2675
- return {
2676
- defaultIsVisible: true
2677
- };
2678
- },
2679
2679
  createColumn: (column, instance) => {
2680
2680
  return {
2681
2681
  toggleVisibility: value => {
@@ -2704,8 +2704,8 @@
2704
2704
  },
2705
2705
  createRow: (row, instance) => {
2706
2706
  return {
2707
- _getAllVisibleCells: memo(() => [row.getAllCells().filter(cell => cell.column.getIsVisible()).map(d => d.id).join('_')], _ => {
2708
- return row.getAllCells().filter(cell => cell.column.getIsVisible());
2707
+ _getAllVisibleCells: memo(() => [row.getAllCells(), instance.getState().columnVisibility], cells => {
2708
+ return cells.filter(cell => cell.column.getIsVisible());
2709
2709
  }, {
2710
2710
  key: "development" === 'production' ,
2711
2711
  debug: () => {
@@ -3056,13 +3056,15 @@
3056
3056
  row,
3057
3057
  column,
3058
3058
  getValue: () => row.getValue(columnId),
3059
- renderCell: () => column.columnDef.cell ? instance._render(column.columnDef.cell, {
3060
- instance,
3061
- column,
3062
- row,
3063
- cell: cell,
3064
- getValue: cell.getValue
3065
- }) : null
3059
+ renderCell: () => {
3060
+ return column.columnDef.cell ? instance._render(column.columnDef.cell, {
3061
+ instance,
3062
+ column,
3063
+ row,
3064
+ cell: cell,
3065
+ getValue: cell.getValue
3066
+ }) : null;
3067
+ }
3066
3068
  };
3067
3069
 
3068
3070
  instance._features.forEach(feature => {
@@ -3137,27 +3139,23 @@
3137
3139
  flatRows: [],
3138
3140
  rowsById: {}
3139
3141
  };
3140
- let rows;
3141
- let row;
3142
- let originalRow;
3143
3142
 
3144
3143
  const accessRows = function (originalRows, depth, parent) {
3145
3144
  if (depth === void 0) {
3146
3145
  depth = 0;
3147
3146
  }
3148
3147
 
3149
- rows = [];
3148
+ const rows = [];
3150
3149
 
3151
3150
  for (let i = 0; i < originalRows.length; i++) {
3152
- originalRow = originalRows[i]; // This could be an expensive check at scale, so we should move it somewhere else, but where?
3151
+ // This could be an expensive check at scale, so we should move it somewhere else, but where?
3153
3152
  // if (!id) {
3154
3153
  // if ("development" !== 'production') {
3155
3154
  // throw new Error(`getRowId expected an ID, but got ${id}`)
3156
3155
  // }
3157
3156
  // }
3158
3157
  // Make the row
3159
-
3160
- row = createRow(instance, instance._getRowId(originalRow, i, parent), originalRow, i, depth); // Keep track of every row in a flat array
3158
+ const row = createRow(instance, instance._getRowId(originalRows[i], i, parent), originalRows[i], i, depth); // Keep track of every row in a flat array
3161
3159
 
3162
3160
  rowModel.flatRows.push(row); // Also keep track of every row by its ID
3163
3161
 
@@ -3168,7 +3166,7 @@
3168
3166
  if (instance.options.getSubRows) {
3169
3167
  var _row$originalSubRows;
3170
3168
 
3171
- row.originalSubRows = instance.options.getSubRows(originalRow, i); // Then recursively access them
3169
+ row.originalSubRows = instance.options.getSubRows(originalRows[i], i); // Then recursively access them
3172
3170
 
3173
3171
  if ((_row$originalSubRows = row.originalSubRows) != null && _row$originalSubRows.length) {
3174
3172
  row.subRows = accessRows(row.originalSubRows, depth + 1, row);
@@ -3749,7 +3747,7 @@
3749
3747
  return rowModel;
3750
3748
  }
3751
3749
 
3752
- return expandRows(rowModel, instance);
3750
+ return expandRows(rowModel);
3753
3751
  }, {
3754
3752
  key: 'getExpandedRowModel',
3755
3753
  debug: () => {
@@ -3767,7 +3765,7 @@
3767
3765
 
3768
3766
  expandedRows.push(row);
3769
3767
 
3770
- if (instance.options.expandSubRows && (_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
3768
+ if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
3771
3769
  row.subRows.forEach(handleRow);
3772
3770
  }
3773
3771
  };
@@ -3804,7 +3802,7 @@
3804
3802
  rows,
3805
3803
  flatRows,
3806
3804
  rowsById
3807
- }, instance);
3805
+ });
3808
3806
  }
3809
3807
 
3810
3808
  return {