@tanstack/table-core 8.5.6 → 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.
- package/build/cjs/utils/getExpandedRowModel.js +8 -3
- package/build/cjs/utils/getExpandedRowModel.js.map +1 -1
- package/build/cjs/utils/getPaginationRowModel.js +2 -1
- package/build/cjs/utils/getPaginationRowModel.js.map +1 -1
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +10 -4
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +312 -312
- package/build/types/index.d.ts +6 -11
- package/build/umd/index.development.js +10 -4
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +1 -1
- package/src/utils/getExpandedRowModel.ts +8 -7
- package/src/utils/getPaginationRowModel.ts +14 -9
- package/src/utils.ts +7 -37
package/build/types/index.d.ts
CHANGED
|
@@ -674,7 +674,7 @@ declare type AccessorFnColumnDef<TData extends RowData, TValue = unknown> = Colu
|
|
|
674
674
|
};
|
|
675
675
|
declare type AccessorKeyColumnDef<TData extends RowData, TValue = unknown> = {
|
|
676
676
|
id?: string;
|
|
677
|
-
} & ColumnIdentifiers<TData, TValue
|
|
677
|
+
} & Partial<ColumnIdentifiers<TData, TValue>> & ColumnDefBase<TData, TValue> & {
|
|
678
678
|
accessorKey: DeepKeys<TData>;
|
|
679
679
|
};
|
|
680
680
|
declare type AccessorColumnDef<TData extends RowData, TValue = unknown> = AccessorKeyColumnDef<TData, TValue> | AccessorFnColumnDef<TData, TValue>;
|
|
@@ -696,18 +696,13 @@ declare type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) ex
|
|
|
696
696
|
declare type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N;
|
|
697
697
|
declare type IsKnown<T, Y, N> = unknown extends T ? N : Y;
|
|
698
698
|
declare type ComputeRange<N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : ComputeRange<N, [...Result, Result['length']]>;
|
|
699
|
-
declare type
|
|
699
|
+
declare type Index40 = ComputeRange<40>[number];
|
|
700
700
|
declare type IsTuple<T> = T extends readonly any[] & {
|
|
701
701
|
length: infer Length;
|
|
702
|
-
} ? Length extends
|
|
702
|
+
} ? Length extends Index40 ? T : never : never;
|
|
703
703
|
declare type AllowedIndexes<Tuple extends ReadonlyArray<any>, Keys extends number = never> = Tuple extends readonly [] ? Keys : Tuple extends readonly [infer _, ...infer Tail] ? AllowedIndexes<Tail, Keys | Tail['length']> : Keys;
|
|
704
|
-
declare type DeepKeys<T> = unknown extends T ? keyof T : object extends T ? string : T extends readonly any[] & IsTuple<T> ? AllowedIndexes<T> | DeepKeysPrefix<T
|
|
705
|
-
declare type
|
|
706
|
-
declare type Join<L extends Key | undefined, R extends Key | undefined> = L extends string | number ? R extends string | number ? `${L}.${R}` : L : R extends string | number ? R : undefined;
|
|
707
|
-
declare type Union<L extends unknown | undefined, R extends unknown | undefined> = L extends undefined ? R extends undefined ? undefined : R : R extends undefined ? L : L | R;
|
|
708
|
-
declare type DeepKeysPrefix<T extends object, Prev extends Key | undefined = undefined, Path extends Key | undefined = undefined, PrevTypes extends object = T> = string & {
|
|
709
|
-
[K in keyof T]: T[K] extends PrevTypes | T ? Union<Union<Prev, Path>, Join<Path, K>> : T[K] extends object ? DeepKeysPrefix<T[K], Union<Prev, Path>, Join<Path, K>, PrevTypes | T> : Union<Union<Prev, Path>, Join<Path, K>>;
|
|
710
|
-
}[keyof T];
|
|
704
|
+
declare type DeepKeys<T> = unknown extends T ? keyof T : object extends T ? string : T extends readonly any[] & IsTuple<T> ? AllowedIndexes<T> | DeepKeysPrefix<T, AllowedIndexes<T>> : T extends any[] ? never & 'Dynamic length array indexing is not supported' : T extends Date ? never : T extends object ? (keyof T & string) | DeepKeysPrefix<T, keyof T> : never;
|
|
705
|
+
declare type DeepKeysPrefix<T, TPrefix> = TPrefix extends keyof T & (number | string) ? `${TPrefix}.${DeepKeys<T[TPrefix]> & string}` : never;
|
|
711
706
|
declare type DeepValue<T, TProp> = T extends Record<string | number, any> ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue<T[TBranch], TDeepProp> : T[TProp & string] : never;
|
|
712
707
|
declare type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
713
708
|
declare type Getter<TValue> = <TTValue = TValue>() => NoInfer<TTValue>;
|
|
@@ -800,7 +795,7 @@ declare function getSortedRowModel<TData extends RowData>(): (table: Table<TData
|
|
|
800
795
|
declare function getGroupedRowModel<TData extends RowData>(): (table: Table<TData>) => () => RowModel<TData>;
|
|
801
796
|
|
|
802
797
|
declare function getExpandedRowModel<TData extends RowData>(): (table: Table<TData>) => () => RowModel<TData>;
|
|
803
|
-
declare function expandRows<TData extends RowData>(rowModel: RowModel<TData
|
|
798
|
+
declare function expandRows<TData extends RowData>(rowModel: RowModel<TData>): {
|
|
804
799
|
rows: Row<TData>[];
|
|
805
800
|
flatRows: Row<TData>[];
|
|
806
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 ||
|
|
3789
|
-
|
|
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
|
|
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 => {
|