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