@tanstack/svelte-table 8.0.0-alpha.70 → 8.0.0-alpha.71

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.
@@ -635,28 +635,28 @@ const ColumnSizing = {
635
635
  var _instance$getHeaderGr, _instance$getHeaderGr2;
636
636
 
637
637
  return (_instance$getHeaderGr = (_instance$getHeaderGr2 = instance.getHeaderGroups()[0]) == null ? void 0 : _instance$getHeaderGr2.headers.reduce((sum, header) => {
638
- return sum + header.column.getSize();
638
+ return sum + header.getSize();
639
639
  }, 0)) != null ? _instance$getHeaderGr : 0;
640
640
  },
641
641
  getLeftTotalSize: () => {
642
642
  var _instance$getLeftHead, _instance$getLeftHead2;
643
643
 
644
644
  return (_instance$getLeftHead = (_instance$getLeftHead2 = instance.getLeftHeaderGroups()[0]) == null ? void 0 : _instance$getLeftHead2.headers.reduce((sum, header) => {
645
- return sum + header.column.getSize();
645
+ return sum + header.getSize();
646
646
  }, 0)) != null ? _instance$getLeftHead : 0;
647
647
  },
648
648
  getCenterTotalSize: () => {
649
649
  var _instance$getCenterHe, _instance$getCenterHe2;
650
650
 
651
651
  return (_instance$getCenterHe = (_instance$getCenterHe2 = instance.getCenterHeaderGroups()[0]) == null ? void 0 : _instance$getCenterHe2.headers.reduce((sum, header) => {
652
- return sum + header.column.getSize();
652
+ return sum + header.getSize();
653
653
  }, 0)) != null ? _instance$getCenterHe : 0;
654
654
  },
655
655
  getRightTotalSize: () => {
656
656
  var _instance$getRightHea, _instance$getRightHea2;
657
657
 
658
658
  return (_instance$getRightHea = (_instance$getRightHea2 = instance.getRightHeaderGroups()[0]) == null ? void 0 : _instance$getRightHea2.headers.reduce((sum, header) => {
659
- return sum + header.column.getSize();
659
+ return sum + header.getSize();
660
660
  }, 0)) != null ? _instance$getRightHea : 0;
661
661
  }
662
662
  };
@@ -710,10 +710,13 @@ const Expanding = {
710
710
  },
711
711
  createInstance: instance => {
712
712
  let registered = false;
713
+ let queued = false;
713
714
  return {
714
715
  _autoResetExpanded: () => {
715
716
  if (!registered) {
716
- registered = true;
717
+ instance.queue(() => {
718
+ registered = true;
719
+ });
717
720
  return;
718
721
  }
719
722
 
@@ -722,7 +725,12 @@ const Expanding = {
722
725
  }
723
726
 
724
727
  if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
725
- instance.resetExpanded();
728
+ if (queued) return;
729
+ queued = true;
730
+ instance.queue(() => {
731
+ instance.resetExpanded();
732
+ queued = false;
733
+ });
726
734
  }
727
735
  },
728
736
  setExpanded: updater => instance.options.onExpandedChange == null ? void 0 : instance.options.onExpandedChange(updater),
@@ -1075,7 +1083,7 @@ const Filters = {
1075
1083
  _getFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, column.id),
1076
1084
  getFacetedMinMaxValues: () => {
1077
1085
  if (!column._getFacetedMinMaxValues) {
1078
- return [NaN, NaN];
1086
+ return undefined;
1079
1087
  }
1080
1088
 
1081
1089
  return column._getFacetedMinMaxValues();
@@ -1166,7 +1174,7 @@ const Filters = {
1166
1174
  _getGlobalFacetedMinMaxValues: instance.options.getFacetedMinMaxValues && instance.options.getFacetedMinMaxValues(instance, '__global__'),
1167
1175
  getGlobalFacetedMinMaxValues: () => {
1168
1176
  if (!instance._getGlobalFacetedMinMaxValues) {
1169
- return [NaN, NaN];
1177
+ return;
1170
1178
  }
1171
1179
 
1172
1180
  return instance._getGlobalFacetedMinMaxValues();
@@ -1510,10 +1518,13 @@ const Pagination = {
1510
1518
  },
1511
1519
  createInstance: instance => {
1512
1520
  let registered = false;
1521
+ let queued = false;
1513
1522
  return {
1514
1523
  _autoResetPageIndex: () => {
1515
1524
  if (!registered) {
1516
- registered = true;
1525
+ instance.queue(() => {
1526
+ registered = true;
1527
+ });
1517
1528
  return;
1518
1529
  }
1519
1530
 
@@ -1522,7 +1533,12 @@ const Pagination = {
1522
1533
  }
1523
1534
 
1524
1535
  if (instance.options.autoResetAll === true || instance.options.autoResetPageIndex) {
1525
- instance.resetPageIndex();
1536
+ if (queued) return;
1537
+ queued = true;
1538
+ instance.queue(() => {
1539
+ instance.resetPageIndex();
1540
+ queued = false;
1541
+ });
1526
1542
  }
1527
1543
  },
1528
1544
  setPagination: updater => {
@@ -3363,9 +3379,7 @@ function getCoreRowModel() {
3363
3379
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3364
3380
  },
3365
3381
  onChange: () => {
3366
- instance.queue(() => {
3367
- instance._autoResetPageIndex();
3368
- });
3382
+ instance._autoResetPageIndex();
3369
3383
  }
3370
3384
  });
3371
3385
  }
@@ -3571,9 +3585,7 @@ function getFilteredRowModel() {
3571
3585
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3572
3586
  },
3573
3587
  onChange: () => {
3574
- instance.queue(() => {
3575
- instance._autoResetPageIndex();
3576
- });
3588
+ instance._autoResetPageIndex();
3577
3589
  }
3578
3590
  });
3579
3591
  }
@@ -3641,14 +3653,20 @@ function getFacetedUniqueValues() {
3641
3653
 
3642
3654
  function getFacetedMinMaxValues() {
3643
3655
  return (instance, columnId) => memo(() => [instance.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3644
- var _facetedRowModel$flat, _facetedRowModel$flat2, _facetedRowModel$flat3, _facetedRowModel$flat4;
3656
+ var _facetedRowModel$flat;
3657
+
3658
+ const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3659
+
3660
+ if (typeof firstValue === 'undefined') {
3661
+ return undefined;
3662
+ }
3645
3663
 
3646
- 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];
3664
+ let facetedMinMaxValues = [firstValue, firstValue];
3647
3665
 
3648
3666
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3649
- var _facetedRowModel$flat5;
3667
+ var _facetedRowModel$flat2;
3650
3668
 
3651
- const value = (_facetedRowModel$flat5 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat5.getValue(columnId);
3669
+ const value = (_facetedRowModel$flat2 = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat2.getValue(columnId);
3652
3670
 
3653
3671
  if (value < facetedMinMaxValues[0]) {
3654
3672
  facetedMinMaxValues[0] = value;
@@ -3756,9 +3774,7 @@ function getSortedRowModel() {
3756
3774
  return (_instance$options$deb = instance.options.debugAll) != null ? _instance$options$deb : instance.options.debugTable;
3757
3775
  },
3758
3776
  onChange: () => {
3759
- instance.queue(() => {
3760
- instance._autoResetPageIndex();
3761
- });
3777
+ instance._autoResetPageIndex();
3762
3778
  }
3763
3779
  });
3764
3780
  }