@tanstack/svelte-table 8.0.0-beta.4 → 8.0.0-beta.5

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.
@@ -2031,11 +2031,11 @@ const RowSelection = {
2031
2031
  });
2032
2032
  },
2033
2033
  toggleAllPageRowsSelected: value => instance.setRowSelection(old => {
2034
- typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2034
+ const resolvedValue = typeof value !== 'undefined' ? value : !instance.getIsAllPageRowsSelected();
2035
2035
  const rowSelection = { ...old
2036
2036
  };
2037
2037
  instance.getRowModel().rows.forEach(row => {
2038
- mutateRowIsSelected(rowSelection, row.id, value, instance);
2038
+ mutateRowIsSelected(rowSelection, row.id, resolvedValue, instance);
2039
2039
  });
2040
2040
  return rowSelection;
2041
2041
  }),
@@ -2190,7 +2190,7 @@ const RowSelection = {
2190
2190
  },
2191
2191
  getIsSomePageRowsSelected: () => {
2192
2192
  const paginationFlatRows = instance.getPaginationRowModel().flatRows;
2193
- return instance.getIsAllPageRowsSelected() ? false : !!(paginationFlatRows != null && paginationFlatRows.length);
2193
+ return instance.getIsAllPageRowsSelected() ? false : paginationFlatRows.some(d => d.getIsSelected() || d.getIsSomeSelected());
2194
2194
  },
2195
2195
  getToggleAllRowsSelectedHandler: () => {
2196
2196
  return e => {
@@ -3828,20 +3828,34 @@ function getPaginationRowModel(opts) {
3828
3828
  const pageStart = pageSize * pageIndex;
3829
3829
  const pageEnd = pageStart + pageSize;
3830
3830
  rows = rows.slice(pageStart, pageEnd);
3831
+ let paginatedRowModel;
3831
3832
 
3832
3833
  if (!instance.options.paginateExpandedRows) {
3833
- return expandRows({
3834
+ paginatedRowModel = expandRows({
3834
3835
  rows,
3835
3836
  flatRows,
3836
3837
  rowsById
3837
3838
  });
3839
+ } else {
3840
+ paginatedRowModel = {
3841
+ rows,
3842
+ flatRows,
3843
+ rowsById
3844
+ };
3838
3845
  }
3839
3846
 
3840
- return {
3841
- rows,
3842
- flatRows,
3843
- rowsById
3847
+ paginatedRowModel.flatRows = [];
3848
+
3849
+ const handleRow = row => {
3850
+ paginatedRowModel.flatRows.push(row);
3851
+
3852
+ if (row.subRows.length) {
3853
+ row.subRows.forEach(handleRow);
3854
+ }
3844
3855
  };
3856
+
3857
+ paginatedRowModel.rows.forEach(handleRow);
3858
+ return paginatedRowModel;
3845
3859
  }, {
3846
3860
  key: process.env.NODE_ENV === 'development' && 'getPaginationRowModel',
3847
3861
  debug: () => {