@tanstack/table-core 8.5.8 → 8.5.9

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.
@@ -795,7 +795,7 @@ declare function getSortedRowModel<TData extends RowData>(): (table: Table<TData
795
795
  declare function getGroupedRowModel<TData extends RowData>(): (table: Table<TData>) => () => RowModel<TData>;
796
796
 
797
797
  declare function getExpandedRowModel<TData extends RowData>(): (table: Table<TData>) => () => RowModel<TData>;
798
- declare function expandRows<TData extends RowData>(rowModel: RowModel<TData>, table: Table<TData>): {
798
+ declare function expandRows<TData extends RowData>(rowModel: RowModel<TData>): {
799
799
  rows: Row<TData>[];
800
800
  flatRows: Row<TData>[];
801
801
  rowsById: Record<string, Row<TData>>;
@@ -3785,8 +3785,13 @@
3785
3785
 
3786
3786
  function getExpandedRowModel() {
3787
3787
  return table => memo(() => [table.getState().expanded, table.getPreExpandedRowModel(), table.options.paginateExpandedRows], (expanded, rowModel, paginateExpandedRows) => {
3788
- if (!rowModel.rows.length || // Do not expand if rows are not included in pagination
3789
- !paginateExpandedRows || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
3788
+ if (!rowModel.rows.length || expanded !== true && !Object.keys(expanded != null ? expanded : {}).length) {
3789
+ return rowModel;
3790
+ }
3791
+
3792
+ if (!paginateExpandedRows) {
3793
+ // Only expand rows at this point if they are being paginated
3794
+ console.log(rowModel.rows);
3790
3795
  return rowModel;
3791
3796
  }
3792
3797
 
@@ -3800,7 +3805,7 @@
3800
3805
  }
3801
3806
  });
3802
3807
  }
3803
- function expandRows(rowModel, table) {
3808
+ function expandRows(rowModel) {
3804
3809
  const expandedRows = [];
3805
3810
 
3806
3811
  const handleRow = row => {
@@ -3822,7 +3827,7 @@
3822
3827
  }
3823
3828
 
3824
3829
  function getPaginationRowModel(opts) {
3825
- return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel()], (pagination, rowModel) => {
3830
+ return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => {
3826
3831
  if (!rowModel.rows.length) {
3827
3832
  return rowModel;
3828
3833
  }
@@ -3855,6 +3860,7 @@
3855
3860
  };
3856
3861
  }
3857
3862
 
3863
+ console.log(paginatedRowModel.rows);
3858
3864
  paginatedRowModel.flatRows = [];
3859
3865
 
3860
3866
  const handleRow = row => {