@tanstack/react-table 8.0.0-beta.5 → 8.0.0-beta.8

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.
@@ -826,7 +826,6 @@ const Expanding = {
826
826
  getDefaultOptions: instance => {
827
827
  return {
828
828
  onExpandedChange: makeStateUpdater('expanded', instance),
829
- autoResetExpanded: true,
830
829
  paginateExpandedRows: true
831
830
  };
832
831
  },
@@ -835,6 +834,8 @@ const Expanding = {
835
834
  let queued = false;
836
835
  return {
837
836
  _autoResetExpanded: () => {
837
+ var _ref, _instance$options$aut;
838
+
838
839
  if (!registered) {
839
840
  instance._queue(() => {
840
841
  registered = true;
@@ -843,11 +844,7 @@ const Expanding = {
843
844
  return;
844
845
  }
845
846
 
846
- if (instance.options.autoResetAll === false) {
847
- return;
848
- }
849
-
850
- if (instance.options.autoResetAll === true || instance.options.autoResetExpanded) {
847
+ if ((_ref = (_instance$options$aut = instance.options.autoResetAll) != null ? _instance$options$aut : instance.options.autoResetExpanded) != null ? _ref : !instance.options.manualExpanding) {
851
848
  if (queued) return;
852
849
  queued = true;
853
850
 
@@ -911,7 +908,7 @@ const Expanding = {
911
908
  });
912
909
  return maxDepth;
913
910
  },
914
- getPreExpandedRowModel: () => instance.getGroupedRowModel(),
911
+ getPreExpandedRowModel: () => instance.getSortedRowModel(),
915
912
  getExpandedRowModel: () => {
916
913
  if (!instance._getExpandedRowModel && instance.options.getExpandedRowModel) {
917
914
  instance._getExpandedRowModel = instance.options.getExpandedRowModel(instance);
@@ -1512,7 +1509,7 @@ const Grouping = {
1512
1509
 
1513
1510
  instance.setGrouping(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.grouping) != null ? _instance$initialStat : []);
1514
1511
  },
1515
- getPreGroupedRowModel: () => instance.getSortedRowModel(),
1512
+ getPreGroupedRowModel: () => instance.getFilteredRowModel(),
1516
1513
  getGroupedRowModel: () => {
1517
1514
  if (!instance._getGroupedRowModel && instance.options.getGroupedRowModel) {
1518
1515
  instance._getGroupedRowModel = instance.options.getGroupedRowModel(instance);
@@ -1545,7 +1542,7 @@ const Grouping = {
1545
1542
  getIsAggregated: () => {
1546
1543
  var _row$subRows;
1547
1544
 
1548
- return !cell.getIsGrouped() && !cell.getIsPlaceholder() && ((_row$subRows = row.subRows) == null ? void 0 : _row$subRows.length) > 1;
1545
+ return !cell.getIsGrouped() && !cell.getIsPlaceholder() && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
1549
1546
  },
1550
1547
  renderAggregatedCell: () => {
1551
1548
  if (process.env.NODE_ENV === 'development') {
@@ -1700,7 +1697,7 @@ const Pagination = {
1700
1697
  setPageIndex: updater => {
1701
1698
  instance.setPagination(old => {
1702
1699
  let pageIndex = functionalUpdate(updater, old.pageIndex);
1703
- const maxPageIndex = typeof old.pageCount !== 'undefined' ? old.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1700
+ const maxPageIndex = typeof instance.options.pageCount !== 'undefined' ? instance.options.pageCount - 1 : Number.MAX_SAFE_INTEGER;
1704
1701
  pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex);
1705
1702
  return { ...old,
1706
1703
  pageIndex
@@ -1729,9 +1726,9 @@ const Pagination = {
1729
1726
  });
1730
1727
  },
1731
1728
  setPageCount: updater => instance.setPagination(old => {
1732
- var _old$pageCount;
1729
+ var _instance$options$pag;
1733
1730
 
1734
- let newPageCount = functionalUpdate(updater, (_old$pageCount = old.pageCount) != null ? _old$pageCount : -1);
1731
+ let newPageCount = functionalUpdate(updater, (_instance$options$pag = instance.options.pageCount) != null ? _instance$options$pag : -1);
1735
1732
 
1736
1733
  if (typeof newPageCount === 'number') {
1737
1734
  newPageCount = Math.max(-1, newPageCount);
@@ -1741,7 +1738,7 @@ const Pagination = {
1741
1738
  pageCount: newPageCount
1742
1739
  };
1743
1740
  }),
1744
- getPageOptions: memo(() => [instance.getState().pagination.pageSize, instance.getState().pagination.pageCount], (pageSize, pageCount) => {
1741
+ getPageOptions: memo(() => [instance.getPageCount()], pageCount => {
1745
1742
  let pageOptions = [];
1746
1743
 
1747
1744
  if (pageCount && pageCount > 0) {
@@ -1795,15 +1792,9 @@ const Pagination = {
1795
1792
  return instance._getPaginationRowModel();
1796
1793
  },
1797
1794
  getPageCount: () => {
1798
- const {
1799
- pageCount
1800
- } = instance.getState().pagination;
1801
-
1802
- if (typeof pageCount !== 'undefined') {
1803
- return pageCount;
1804
- }
1795
+ var _instance$options$pag2;
1805
1796
 
1806
- return Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1797
+ return (_instance$options$pag2 = instance.options.pageCount) != null ? _instance$options$pag2 : Math.ceil(instance.getPrePaginationRowModel().rows.length / instance.getState().pagination.pageSize);
1807
1798
  }
1808
1799
  };
1809
1800
  }
@@ -2125,7 +2116,7 @@ const RowSelection = {
2125
2116
  return (_instance$options$deb2 = instance.options.debugAll) != null ? _instance$options$deb2 : instance.options.debugTable;
2126
2117
  }
2127
2118
  }),
2128
- getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getGroupedRowModel()], (rowSelection, rowModel) => {
2119
+ getGroupedSelectedRowModel: memo(() => [instance.getState().rowSelection, instance.getSortedRowModel()], (rowSelection, rowModel) => {
2129
2120
  if (!Object.keys(rowSelection).length) {
2130
2121
  return {
2131
2122
  rows: [],
@@ -2675,7 +2666,7 @@ const Sorting = {
2675
2666
 
2676
2667
  instance.setSorting(defaultState ? [] : (_instance$initialStat = (_instance$initialStat2 = instance.initialState) == null ? void 0 : _instance$initialStat2.sorting) != null ? _instance$initialStat : []);
2677
2668
  },
2678
- getPreSortedRowModel: () => instance.getFilteredRowModel(),
2669
+ getPreSortedRowModel: () => instance.getGroupedRowModel(),
2679
2670
  getSortedRowModel: () => {
2680
2671
  if (!instance._getSortedRowModel && instance.options.getSortedRowModel) {
2681
2672
  instance._getSortedRowModel = instance.options.getSortedRowModel(instance);