@tanstack/table-core 8.5.8 → 8.5.11

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.
@@ -675,7 +675,7 @@ declare type AccessorFnColumnDef<TData extends RowData, TValue = unknown> = Colu
675
675
  declare type AccessorKeyColumnDef<TData extends RowData, TValue = unknown> = {
676
676
  id?: string;
677
677
  } & Partial<ColumnIdentifiers<TData, TValue>> & ColumnDefBase<TData, TValue> & {
678
- accessorKey: DeepKeys<TData>;
678
+ accessorKey: string | keyof TData;
679
679
  };
680
680
  declare type AccessorColumnDef<TData extends RowData, TValue = unknown> = AccessorKeyColumnDef<TData, TValue> | AccessorFnColumnDef<TData, TValue>;
681
681
  declare type ColumnDef<TData extends RowData, TValue = unknown> = DisplayColumnDef<TData, TValue> | GroupColumnDef<TData, TValue> | AccessorColumnDef<TData, TValue>;
@@ -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,12 @@
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
3790
3794
  return rowModel;
3791
3795
  }
3792
3796
 
@@ -3800,7 +3804,7 @@
3800
3804
  }
3801
3805
  });
3802
3806
  }
3803
- function expandRows(rowModel, table) {
3807
+ function expandRows(rowModel) {
3804
3808
  const expandedRows = [];
3805
3809
 
3806
3810
  const handleRow = row => {
@@ -3822,7 +3826,7 @@
3822
3826
  }
3823
3827
 
3824
3828
  function getPaginationRowModel(opts) {
3825
- return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel()], (pagination, rowModel) => {
3829
+ return table => memo(() => [table.getState().pagination, table.getPrePaginationRowModel(), table.options.paginateExpandedRows ? undefined : table.getState().expanded], (pagination, rowModel) => {
3826
3830
  if (!rowModel.rows.length) {
3827
3831
  return rowModel;
3828
3832
  }