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