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