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