@tanstack/svelte-table 8.0.0-alpha.69 → 8.0.0-alpha.72

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-163"},{"name":"svelte-table/src","children":[{"uid":"8f31-165","name":"placeholder.svelte"},{"uid":"8f31-167","name":"render-component.ts"},{"uid":"8f31-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"8f31-163":{"renderedLength":142278,"gzipLength":24321,"brotliLength":0,"mainUid":"8f31-162"},"8f31-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"8f31-164"},"8f31-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"8f31-166"},"8f31-169":{"renderedLength":1958,"gzipLength":709,"brotliLength":0,"mainUid":"8f31-168"}},"nodeMetas":{"8f31-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"8f31-163"},"imported":[],"importedBy":[{"uid":"8f31-168"}]},"8f31-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"8f31-165"},"imported":[{"uid":"8f31-171"}],"importedBy":[{"uid":"8f31-168"}]},"8f31-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"8f31-167"},"imported":[{"uid":"8f31-171"}],"importedBy":[{"uid":"8f31-168"}]},"8f31-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"8f31-169"},"imported":[{"uid":"8f31-162"},{"uid":"8f31-164"},{"uid":"8f31-170"},{"uid":"8f31-166"}],"importedBy":[],"isEntry":true},"8f31-170":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"8f31-168"}],"isExternal":true},"8f31-171":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"8f31-164"},{"uid":"8f31-166"}],"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":"540e-163"},{"name":"svelte-table/src","children":[{"uid":"540e-165","name":"placeholder.svelte"},{"uid":"540e-167","name":"render-component.ts"},{"uid":"540e-169","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"540e-163":{"renderedLength":142389,"gzipLength":24368,"brotliLength":0,"mainUid":"540e-162"},"540e-165":{"renderedLength":925,"gzipLength":444,"brotliLength":0,"mainUid":"540e-164"},"540e-167":{"renderedLength":1365,"gzipLength":519,"brotliLength":0,"mainUid":"540e-166"},"540e-169":{"renderedLength":1958,"gzipLength":709,"brotliLength":0,"mainUid":"540e-168"}},"nodeMetas":{"540e-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"540e-163"},"imported":[],"importedBy":[{"uid":"540e-168"}]},"540e-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"540e-165"},"imported":[{"uid":"540e-171"}],"importedBy":[{"uid":"540e-168"}]},"540e-166":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"540e-167"},"imported":[{"uid":"540e-171"}],"importedBy":[{"uid":"540e-168"}]},"540e-168":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"540e-169"},"imported":[{"uid":"540e-162"},{"uid":"540e-164"},{"uid":"540e-170"},{"uid":"540e-166"}],"importedBy":[],"isEntry":true},"540e-170":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"540e-168"}],"isExternal":true},"540e-171":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"540e-164"},{"uid":"540e-166"}],"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": "8f31-173"
14
+ "uid": "540e-173"
15
15
  },
16
16
  {
17
17
  "name": "svelte-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "8f31-175",
20
+ "uid": "540e-175",
21
21
  "name": "placeholder.svelte"
22
22
  },
23
23
  {
24
- "uid": "8f31-177",
24
+ "uid": "540e-177",
25
25
  "name": "render-component.ts"
26
26
  },
27
27
  {
28
- "uid": "8f31-179",
28
+ "uid": "540e-179",
29
29
  "name": "index.ts"
30
30
  }
31
31
  ]
@@ -38,119 +38,119 @@
38
38
  "isRoot": true
39
39
  },
40
40
  "nodeParts": {
41
- "8f31-173": {
42
- "renderedLength": 142278,
43
- "gzipLength": 24321,
41
+ "540e-173": {
42
+ "renderedLength": 142389,
43
+ "gzipLength": 24368,
44
44
  "brotliLength": 0,
45
- "mainUid": "8f31-172"
45
+ "mainUid": "540e-172"
46
46
  },
47
- "8f31-175": {
47
+ "540e-175": {
48
48
  "renderedLength": 925,
49
49
  "gzipLength": 444,
50
50
  "brotliLength": 0,
51
- "mainUid": "8f31-174"
51
+ "mainUid": "540e-174"
52
52
  },
53
- "8f31-177": {
53
+ "540e-177": {
54
54
  "renderedLength": 1365,
55
55
  "gzipLength": 519,
56
56
  "brotliLength": 0,
57
- "mainUid": "8f31-176"
57
+ "mainUid": "540e-176"
58
58
  },
59
- "8f31-179": {
59
+ "540e-179": {
60
60
  "renderedLength": 1958,
61
61
  "gzipLength": 709,
62
62
  "brotliLength": 0,
63
- "mainUid": "8f31-178"
63
+ "mainUid": "540e-178"
64
64
  }
65
65
  },
66
66
  "nodeMetas": {
67
- "8f31-172": {
67
+ "540e-172": {
68
68
  "id": "/packages/table-core/build/esm/index.js",
69
69
  "moduleParts": {
70
- "index.production.js": "8f31-173"
70
+ "index.production.js": "540e-173"
71
71
  },
72
72
  "imported": [],
73
73
  "importedBy": [
74
74
  {
75
- "uid": "8f31-178"
75
+ "uid": "540e-178"
76
76
  }
77
77
  ]
78
78
  },
79
- "8f31-174": {
79
+ "540e-174": {
80
80
  "id": "/packages/svelte-table/src/placeholder.svelte",
81
81
  "moduleParts": {
82
- "index.production.js": "8f31-175"
82
+ "index.production.js": "540e-175"
83
83
  },
84
84
  "imported": [
85
85
  {
86
- "uid": "8f31-181"
86
+ "uid": "540e-181"
87
87
  }
88
88
  ],
89
89
  "importedBy": [
90
90
  {
91
- "uid": "8f31-178"
91
+ "uid": "540e-178"
92
92
  }
93
93
  ]
94
94
  },
95
- "8f31-176": {
95
+ "540e-176": {
96
96
  "id": "/packages/svelte-table/src/render-component.ts",
97
97
  "moduleParts": {
98
- "index.production.js": "8f31-177"
98
+ "index.production.js": "540e-177"
99
99
  },
100
100
  "imported": [
101
101
  {
102
- "uid": "8f31-181"
102
+ "uid": "540e-181"
103
103
  }
104
104
  ],
105
105
  "importedBy": [
106
106
  {
107
- "uid": "8f31-178"
107
+ "uid": "540e-178"
108
108
  }
109
109
  ]
110
110
  },
111
- "8f31-178": {
111
+ "540e-178": {
112
112
  "id": "/packages/svelte-table/src/index.ts",
113
113
  "moduleParts": {
114
- "index.production.js": "8f31-179"
114
+ "index.production.js": "540e-179"
115
115
  },
116
116
  "imported": [
117
117
  {
118
- "uid": "8f31-172"
118
+ "uid": "540e-172"
119
119
  },
120
120
  {
121
- "uid": "8f31-174"
121
+ "uid": "540e-174"
122
122
  },
123
123
  {
124
- "uid": "8f31-180"
124
+ "uid": "540e-180"
125
125
  },
126
126
  {
127
- "uid": "8f31-176"
127
+ "uid": "540e-176"
128
128
  }
129
129
  ],
130
130
  "importedBy": [],
131
131
  "isEntry": true
132
132
  },
133
- "8f31-180": {
133
+ "540e-180": {
134
134
  "id": "svelte/store",
135
135
  "moduleParts": {},
136
136
  "imported": [],
137
137
  "importedBy": [
138
138
  {
139
- "uid": "8f31-178"
139
+ "uid": "540e-178"
140
140
  }
141
141
  ],
142
142
  "isExternal": true
143
143
  },
144
- "8f31-181": {
144
+ "540e-181": {
145
145
  "id": "svelte/internal",
146
146
  "moduleParts": {},
147
147
  "imported": [],
148
148
  "importedBy": [
149
149
  {
150
- "uid": "8f31-174"
150
+ "uid": "540e-174"
151
151
  },
152
152
  {
153
- "uid": "8f31-176"
153
+ "uid": "540e-176"
154
154
  }
155
155
  ],
156
156
  "isExternal": true
@@ -630,28 +630,28 @@
630
630
  var _instance$getHeaderGr, _instance$getHeaderGr2;
631
631
 
632
632
  return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce((sum, header) => {
633
- return sum + header.column.getSize();
633
+ return sum + header.getSize();
634
634
  }, 0)) != null ? _instance$getHeaderGr : 0;
635
635
  },
636
636
  getLeftTotalSize: () => {
637
637
  var _instance$getLeftHead, _instance$getLeftHead2;
638
638
 
639
639
  return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce((sum, header) => {
640
- return sum + header.column.getSize();
640
+ return sum + header.getSize();
641
641
  }, 0)) != null ? _instance$getLeftHead : 0;
642
642
  },
643
643
  getCenterTotalSize: () => {
644
644
  var _instance$getCenterHe, _instance$getCenterHe2;
645
645
 
646
646
  return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce((sum, header) => {
647
- return sum + header.column.getSize();
647
+ return sum + header.getSize();
648
648
  }, 0)) != null ? _instance$getCenterHe : 0;
649
649
  },
650
650
  getRightTotalSize: () => {
651
651
  var _instance$getRightHea, _instance$getRightHea2;
652
652
 
653
653
  return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce((sum, header) => {
654
- return sum + header.column.getSize();
654
+ return sum + header.getSize();
655
655
  }, 0)) != null ? _instance$getRightHea : 0;
656
656
  }
657
657
  };
@@ -705,10 +705,13 @@
705
705
  },
706
706
  createInstance: instance => {
707
707
  let registered = false;
708
+ let queued = false;
708
709
  return {
709
710
  _autoResetExpanded: () => {
710
711
  if (!registered) {
711
- registered = true;
712
+ instance.queue(() => {
713
+ registered = true;
714
+ });
712
715
  return;
713
716
  }
714
717
 
@@ -717,7 +720,12 @@
717
720
  }
718
721
 
719
722
  if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
720
- instance.resetExpanded();
723
+ if (queued) return;
724
+ queued = true;
725
+ instance.queue(() => {
726
+ instance.resetExpanded();
727
+ queued = false;
728
+ });
721
729
  }
722
730
  },
723
731
  setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
@@ -1070,7 +1078,7 @@
1070
1078
  _getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
1071
1079
  getFacetedMinMaxValues: () => {
1072
1080
  if (!column._getFacetedMinMaxValues) {
1073
- return [NaN, NaN];
1081
+ return undefined;
1074
1082
  }
1075
1083
 
1076
1084
  return column._getFacetedMinMaxValues();
@@ -1161,7 +1169,7 @@
1161
1169
  _getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
1162
1170
  getGlobalFacetedMinMaxValues: () => {
1163
1171
  if (!instance._getGlobalFacetedMinMaxValues) {
1164
- return [NaN, NaN];
1172
+ return;
1165
1173
  }
1166
1174
 
1167
1175
  return instance._getGlobalFacetedMinMaxValues();
@@ -1481,12 +1489,10 @@
1481
1489
  };
1482
1490
 
1483
1491
  //
1484
- const defaultPageCount = -1;
1485
1492
  const defaultPageIndex = 0;
1486
1493
  const defaultPageSize = 10;
1487
1494
 
1488
1495
  const getDefaultPaginationState = () => ({
1489
- pageCount: defaultPageCount,
1490
1496
  pageIndex: defaultPageIndex,
1491
1497
  pageSize: defaultPageSize
1492
1498
  });
@@ -1507,10 +1513,13 @@
1507
1513
  },
1508
1514
  createInstance: instance => {
1509
1515
  let registered = false;
1516
+ let queued = false;
1510
1517
  return {
1511
1518
  _autoResetPageIndex: () => {
1512
1519
  if (!registered) {
1513
- registered = true;
1520
+ instance.queue(() => {
1521
+ registered = true;
1522
+ });
1514
1523
  return;
1515
1524
  }
1516
1525
 
@@ -1519,7 +1528,12 @@
1519
1528
  }
1520
1529
 
1521
1530
  if (instance.options.autoResetAll === true || instance.options.autoResetPageIndex) {
1522
- instance.resetPageIndex();
1531
+ if (queued) return;
1532
+ queued = true;
1533
+ instance.queue(() => {
1534
+ instance.resetPageIndex();
1535
+ queued = false;
1536
+ });
1523
1537
  }
1524
1538
  },
1525
1539
  setPagination: updater => {
@@ -1567,7 +1581,9 @@
1567
1581
  });
1568
1582
  },
1569
1583
  setPageCount: updater => instance.setPagination(old => {
1570
- let newPageCount = functionalUpdate(updater, old.pageCount);
1584
+ var _old$pageCount;
1585
+
1586
+ let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1571
1587
 
1572
1588
  if (typeof newPageCount === 'number') {
1573
1589
  newPageCount = Math.max(-1, newPageCount);
@@ -1635,7 +1651,7 @@
1635
1651
  pageCount
1636
1652
  } = instance.getState().pagination;
1637
1653
 
1638
- if (pageCount > 0) {
1654
+ if (typeof pageCount !== 'undefined') {
1639
1655
  return pageCount;
1640
1656
  }
1641
1657
 
@@ -3358,9 +3374,7 @@
3358
3374
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3359
3375
  },
3360
3376
  onChange: () => {
3361
- instance.queue(() => {
3362
- instance._autoResetPageIndex();
3363
- });
3377
+ instance._autoResetPageIndex();
3364
3378
  }
3365
3379
  });
3366
3380
  }
@@ -3566,9 +3580,7 @@
3566
3580
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3567
3581
  },
3568
3582
  onChange: () => {
3569
- instance.queue(() => {
3570
- instance._autoResetPageIndex();
3571
- });
3583
+ instance._autoResetPageIndex();
3572
3584
  }
3573
3585
  });
3574
3586
  }
@@ -3636,14 +3648,20 @@
3636
3648
 
3637
3649
  function getFacetedMinMaxValues() {
3638
3650
  return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3639
- var _facetedRowModel$flat, _facetedRowModel$flat2, _facetedRowModel$flat3, _facetedRowModel$flat4;
3651
+ var _facetedRowModel$flat;
3640
3652
 
3641
- 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];
3653
+ const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3654
+
3655
+ if (typeof firstValue === 'undefined') {
3656
+ return undefined;
3657
+ }
3658
+
3659
+ let facetedMinMaxValues = [firstValue, firstValue];
3642
3660
 
3643
3661
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3644
- var _facetedRowModel$flat5;
3662
+ var _facetedRowModel$flat2;
3645
3663
 
3646
- const value = (_facetedRowModel$flat5 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat5.getValue(columnId);
3664
+ const value = (_facetedRowModel$flat2 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat2.getValue(columnId);
3647
3665
 
3648
3666
  if (value < facetedMinMaxValues[0]) {
3649
3667
  facetedMinMaxValues[0] = value;
@@ -3751,9 +3769,7 @@
3751
3769
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3752
3770
  },
3753
3771
  onChange: () => {
3754
- instance.queue(() => {
3755
- instance._autoResetPageIndex();
3756
- });
3772
+ instance._autoResetPageIndex();
3757
3773
  }
3758
3774
  });
3759
3775
  }