@tanstack/table-core 8.5.28 → 8.6.0
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/features/Filters.js +1 -0
- package/build/cjs/features/Filters.js.map +1 -1
- package/build/cjs/utils/filterRowsUtils.js +12 -4
- package/build/cjs/utils/filterRowsUtils.js.map +1 -1
- package/build/esm/index.js +13 -4
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +314 -314
- package/build/types/index.d.ts +63 -62
- package/build/umd/index.development.js +13 -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/features/Filters.ts +2 -0
- package/src/types.ts +1 -1
- package/src/utils/filterRowsUtils.ts +4 -2
package/build/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
type VisibilityState = Record<string, boolean>;
|
|
12
12
|
interface VisibilityTableState {
|
|
13
13
|
columnVisibility: VisibilityState;
|
|
14
14
|
}
|
|
@@ -50,7 +50,7 @@ declare const Visibility: TableFeature;
|
|
|
50
50
|
interface ColumnOrderTableState {
|
|
51
51
|
columnOrder: ColumnOrderState;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
type ColumnOrderState = string[];
|
|
54
54
|
interface ColumnOrderOptions {
|
|
55
55
|
onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
|
|
56
56
|
}
|
|
@@ -64,7 +64,7 @@ interface ColumnOrderInstance<TData extends RowData> {
|
|
|
64
64
|
}
|
|
65
65
|
declare const Ordering: TableFeature;
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
type ColumnPinningPosition = false | 'left' | 'right';
|
|
68
68
|
interface ColumnPinningState {
|
|
69
69
|
left?: string[];
|
|
70
70
|
right?: string[];
|
|
@@ -159,13 +159,13 @@ declare const filterFns: {
|
|
|
159
159
|
weakEquals: FilterFn<any>;
|
|
160
160
|
inNumberRange: FilterFn<any>;
|
|
161
161
|
};
|
|
162
|
-
|
|
162
|
+
type BuiltInFilterFn = keyof typeof filterFns;
|
|
163
163
|
|
|
164
164
|
interface FiltersTableState {
|
|
165
165
|
columnFilters: ColumnFiltersState;
|
|
166
166
|
globalFilter: any;
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
type ColumnFiltersState = ColumnFilter[];
|
|
169
169
|
interface ColumnFilter {
|
|
170
170
|
id: string;
|
|
171
171
|
value: unknown;
|
|
@@ -180,10 +180,10 @@ interface FilterFn<TData extends RowData> {
|
|
|
180
180
|
resolveFilterValue?: TransformFilterValueFn<TData>;
|
|
181
181
|
autoRemove?: ColumnFilterAutoRemoveTestFn<TData>;
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
type TransformFilterValueFn<TData extends RowData> = (value: any, column?: Column<TData, unknown>) => unknown;
|
|
184
|
+
type ColumnFilterAutoRemoveTestFn<TData extends RowData> = (value: any, column?: Column<TData, unknown>) => boolean;
|
|
185
|
+
type CustomFilterFns<TData extends RowData> = Record<string, FilterFn<TData>>;
|
|
186
|
+
type FilterFnOption<TData extends RowData> = 'auto' | BuiltInFilterFn | keyof FilterFns | FilterFn<TData>;
|
|
187
187
|
interface FiltersColumnDef<TData extends RowData> {
|
|
188
188
|
filterFn?: FilterFnOption<TData>;
|
|
189
189
|
enableColumnFilter?: boolean;
|
|
@@ -213,6 +213,7 @@ interface FiltersOptionsBase<TData extends RowData> {
|
|
|
213
213
|
enableFilters?: boolean;
|
|
214
214
|
manualFiltering?: boolean;
|
|
215
215
|
filterFromLeafRows?: boolean;
|
|
216
|
+
maxLeafRowFilterDepth?: number;
|
|
216
217
|
getFilteredRowModel?: (table: Table<any>) => () => RowModel<any>;
|
|
217
218
|
onColumnFiltersChange?: OnChangeFn<ColumnFiltersState>;
|
|
218
219
|
enableColumnFilters?: boolean;
|
|
@@ -224,7 +225,7 @@ interface FiltersOptionsBase<TData extends RowData> {
|
|
|
224
225
|
getFacetedUniqueValues?: (table: Table<TData>, columnId: string) => () => Map<any, number>;
|
|
225
226
|
getFacetedMinMaxValues?: (table: Table<TData>, columnId: string) => () => undefined | [number, number];
|
|
226
227
|
}
|
|
227
|
-
|
|
228
|
+
type ResolvedFilterFns = keyof FilterFns extends never ? {
|
|
228
229
|
filterFns?: Record<string, FilterFn<any>>;
|
|
229
230
|
} : {
|
|
230
231
|
filterFns: Record<keyof FilterFns, FilterFn<any>>;
|
|
@@ -260,22 +261,22 @@ declare const sortingFns: {
|
|
|
260
261
|
datetime: SortingFn<any>;
|
|
261
262
|
basic: SortingFn<any>;
|
|
262
263
|
};
|
|
263
|
-
|
|
264
|
+
type BuiltInSortingFn = keyof typeof sortingFns;
|
|
264
265
|
|
|
265
|
-
|
|
266
|
+
type SortDirection = 'asc' | 'desc';
|
|
266
267
|
interface ColumnSort {
|
|
267
268
|
id: string;
|
|
268
269
|
desc: boolean;
|
|
269
270
|
}
|
|
270
|
-
|
|
271
|
+
type SortingState = ColumnSort[];
|
|
271
272
|
interface SortingTableState {
|
|
272
273
|
sorting: SortingState;
|
|
273
274
|
}
|
|
274
275
|
interface SortingFn<TData extends RowData> {
|
|
275
276
|
(rowA: Row<TData>, rowB: Row<TData>, columnId: string): number;
|
|
276
277
|
}
|
|
277
|
-
|
|
278
|
-
|
|
278
|
+
type CustomSortingFns<TData extends RowData> = Record<string, SortingFn<TData>>;
|
|
279
|
+
type SortingFnOption<TData extends RowData> = 'auto' | keyof SortingFns | BuiltInSortingFn | SortingFn<TData>;
|
|
279
280
|
interface SortingColumnDef<TData extends RowData> {
|
|
280
281
|
sortingFn?: SortingFnOption<TData>;
|
|
281
282
|
sortDescFirst?: boolean;
|
|
@@ -310,7 +311,7 @@ interface SortingOptionsBase {
|
|
|
310
311
|
maxMultiSortColCount?: number;
|
|
311
312
|
isMultiSortEvent?: (e: unknown) => boolean;
|
|
312
313
|
}
|
|
313
|
-
|
|
314
|
+
type ResolvedSortingFns = keyof SortingFns extends never ? {
|
|
314
315
|
sortingFns?: Record<string, SortingFn<any>>;
|
|
315
316
|
} : {
|
|
316
317
|
sortingFns: Record<keyof SortingFns, SortingFn<any>>;
|
|
@@ -337,15 +338,15 @@ declare const aggregationFns: {
|
|
|
337
338
|
uniqueCount: AggregationFn<any>;
|
|
338
339
|
count: AggregationFn<any>;
|
|
339
340
|
};
|
|
340
|
-
|
|
341
|
+
type BuiltInAggregationFn = keyof typeof aggregationFns;
|
|
341
342
|
|
|
342
|
-
|
|
343
|
+
type GroupingState = string[];
|
|
343
344
|
interface GroupingTableState {
|
|
344
345
|
grouping: GroupingState;
|
|
345
346
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
347
|
+
type AggregationFn<TData extends RowData> = (columnId: string, leafRows: Row<TData>[], childRows: Row<TData>[]) => any;
|
|
348
|
+
type CustomAggregationFns = Record<string, AggregationFn<any>>;
|
|
349
|
+
type AggregationFnOption<TData extends RowData> = 'auto' | keyof AggregationFns | BuiltInAggregationFn | AggregationFn<TData>;
|
|
349
350
|
interface GroupingColumnDef<TData extends RowData, TValue> {
|
|
350
351
|
aggregationFn?: AggregationFnOption<TData>;
|
|
351
352
|
aggregatedCell?: ColumnDefTemplate<ReturnType<Cell<TData, TValue>['getContext']>>;
|
|
@@ -382,14 +383,14 @@ interface GroupingOptionsBase {
|
|
|
382
383
|
getGroupedRowModel?: (table: Table<any>) => () => RowModel<any>;
|
|
383
384
|
groupedColumnMode?: false | 'reorder' | 'remove';
|
|
384
385
|
}
|
|
385
|
-
|
|
386
|
+
type ResolvedAggregationFns = keyof AggregationFns extends never ? {
|
|
386
387
|
aggregationFns?: Record<string, AggregationFn<any>>;
|
|
387
388
|
} : {
|
|
388
389
|
aggregationFns: Record<keyof AggregationFns, AggregationFn<any>>;
|
|
389
390
|
};
|
|
390
391
|
interface GroupingOptions extends GroupingOptionsBase, ResolvedAggregationFns {
|
|
391
392
|
}
|
|
392
|
-
|
|
393
|
+
type GroupingColumnMode = false | 'reorder' | 'remove';
|
|
393
394
|
interface GroupingInstance<TData extends RowData> {
|
|
394
395
|
setGrouping: (updater: Updater<GroupingState>) => void;
|
|
395
396
|
resetGrouping: (defaultState?: boolean) => void;
|
|
@@ -400,8 +401,8 @@ interface GroupingInstance<TData extends RowData> {
|
|
|
400
401
|
declare const Grouping: TableFeature;
|
|
401
402
|
declare function orderColumns<TData extends RowData>(leafColumns: Column<TData, unknown>[], grouping: string[], groupedColumnMode?: GroupingColumnMode): Column<TData, unknown>[];
|
|
402
403
|
|
|
403
|
-
|
|
404
|
-
|
|
404
|
+
type ExpandedStateList = Record<string, boolean>;
|
|
405
|
+
type ExpandedState = true | Record<string, boolean>;
|
|
405
406
|
interface ExpandedTableState {
|
|
406
407
|
expanded: ExpandedState;
|
|
407
408
|
}
|
|
@@ -441,7 +442,7 @@ interface ColumnSizingTableState {
|
|
|
441
442
|
columnSizing: ColumnSizingState;
|
|
442
443
|
columnSizingInfo: ColumnSizingInfoState;
|
|
443
444
|
}
|
|
444
|
-
|
|
445
|
+
type ColumnSizingState = Record<string, number>;
|
|
445
446
|
interface ColumnSizingInfoState {
|
|
446
447
|
startOffset: null | number;
|
|
447
448
|
startSize: null | number;
|
|
@@ -450,7 +451,7 @@ interface ColumnSizingInfoState {
|
|
|
450
451
|
isResizingColumn: false | string;
|
|
451
452
|
columnSizingStart: [string, number][];
|
|
452
453
|
}
|
|
453
|
-
|
|
454
|
+
type ColumnResizeMode = 'onChange' | 'onEnd';
|
|
454
455
|
interface ColumnSizingOptions {
|
|
455
456
|
enableColumnResizing?: boolean;
|
|
456
457
|
columnResizeMode?: ColumnResizeMode;
|
|
@@ -539,7 +540,7 @@ interface PaginationInstance<TData extends RowData> {
|
|
|
539
540
|
}
|
|
540
541
|
declare const Pagination: TableFeature;
|
|
541
542
|
|
|
542
|
-
|
|
543
|
+
type RowSelectionState = Record<string, boolean>;
|
|
543
544
|
interface RowSelectionTableState {
|
|
544
545
|
rowSelection: RowSelectionState;
|
|
545
546
|
}
|
|
@@ -640,15 +641,15 @@ interface SortingFns {
|
|
|
640
641
|
}
|
|
641
642
|
interface AggregationFns {
|
|
642
643
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
644
|
+
type Updater<T> = T | ((old: T) => T);
|
|
645
|
+
type OnChangeFn<T> = (updaterOrValue: Updater<T>) => void;
|
|
646
|
+
type RowData = unknown | object | any[];
|
|
647
|
+
type AnyRender = (Comp: any, props: any) => any;
|
|
647
648
|
interface Table<TData extends RowData> extends CoreInstance<TData>, HeadersInstance<TData>, VisibilityInstance<TData>, ColumnOrderInstance<TData>, ColumnPinningInstance<TData>, FiltersInstance<TData>, SortingInstance<TData>, GroupingInstance<TData>, ColumnSizingInstance, ExpandedInstance<TData>, PaginationInstance<TData>, RowSelectionInstance<TData> {
|
|
648
649
|
}
|
|
649
650
|
interface FeatureOptions<TData extends RowData> extends VisibilityOptions, ColumnOrderOptions, ColumnPinningOptions, FiltersOptions<TData>, SortingOptions<TData>, GroupingOptions, ExpandedOptions<TData>, ColumnSizingOptions, PaginationOptions, RowSelectionOptions<TData> {
|
|
650
651
|
}
|
|
651
|
-
|
|
652
|
+
type TableOptionsResolved<TData extends RowData> = CoreOptions<TData> & FeatureOptions<TData>;
|
|
652
653
|
interface TableOptions<TData extends RowData> extends PartialKeys<TableOptionsResolved<TData>, 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
653
654
|
}
|
|
654
655
|
interface TableState extends CoreTableState, VisibilityTableState, ColumnOrderTableState, ColumnPinningTableState, FiltersTableState, SortingTableState, ExpandedTableState, GroupingTableState, ColumnSizingTableState, PaginationTableState, RowSelectionTableState {
|
|
@@ -664,9 +665,9 @@ interface RowModel<TData extends RowData> {
|
|
|
664
665
|
flatRows: Row<TData>[];
|
|
665
666
|
rowsById: Record<string, Row<TData>>;
|
|
666
667
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
668
|
+
type AccessorFn<TData extends RowData, TValue = unknown> = (originalRow: TData, index: number) => TValue;
|
|
669
|
+
type ColumnDefTemplate<TProps extends object> = string | ((props: TProps) => any);
|
|
670
|
+
type StringOrTemplateHeader<TData, TValue> = string | ColumnDefTemplate<HeaderContext<TData, TValue>>;
|
|
670
671
|
interface StringHeaderIdentifier {
|
|
671
672
|
header: string;
|
|
672
673
|
id?: string;
|
|
@@ -675,7 +676,7 @@ interface IdIdentifier<TData extends RowData, TValue> {
|
|
|
675
676
|
id: string;
|
|
676
677
|
header?: StringOrTemplateHeader<TData, TValue>;
|
|
677
678
|
}
|
|
678
|
-
|
|
679
|
+
type ColumnIdentifiers<TData extends RowData, TValue> = IdIdentifier<TData, TValue> | StringHeaderIdentifier;
|
|
679
680
|
interface ColumnDefExtensions<TData extends RowData, TValue = unknown> extends VisibilityColumnDef, ColumnPinningColumnDef, FiltersColumnDef<TData>, SortingColumnDef<TData>, GroupingColumnDef<TData, TValue>, ColumnSizingColumnDef {
|
|
680
681
|
}
|
|
681
682
|
interface ColumnDefBase<TData extends RowData, TValue = unknown> extends ColumnDefExtensions<TData, TValue> {
|
|
@@ -688,23 +689,23 @@ interface IdentifiedColumnDef<TData extends RowData, TValue = unknown> extends C
|
|
|
688
689
|
id?: string;
|
|
689
690
|
header?: StringOrTemplateHeader<TData, TValue>;
|
|
690
691
|
}
|
|
691
|
-
|
|
692
|
+
type DisplayColumnDef<TData extends RowData, TValue = unknown> = ColumnDefBase<TData, TValue> & ColumnIdentifiers<TData, TValue>;
|
|
692
693
|
interface GroupColumnDefBase<TData extends RowData, TValue = unknown> extends ColumnDefBase<TData, TValue> {
|
|
693
694
|
columns?: ColumnDef<TData, any>[];
|
|
694
695
|
}
|
|
695
|
-
|
|
696
|
+
type GroupColumnDef<TData extends RowData, TValue = unknown> = GroupColumnDefBase<TData, TValue> & ColumnIdentifiers<TData, TValue>;
|
|
696
697
|
interface AccessorFnColumnDefBase<TData extends RowData, TValue = unknown> extends ColumnDefBase<TData, TValue> {
|
|
697
698
|
accessorFn: AccessorFn<TData, TValue>;
|
|
698
699
|
}
|
|
699
|
-
|
|
700
|
+
type AccessorFnColumnDef<TData extends RowData, TValue = unknown> = AccessorFnColumnDefBase<TData, TValue> & ColumnIdentifiers<TData, TValue>;
|
|
700
701
|
interface AccessorKeyColumnDefBase<TData extends RowData, TValue = unknown> extends ColumnDefBase<TData, TValue> {
|
|
701
702
|
id?: string;
|
|
702
|
-
accessorKey: string | keyof TData;
|
|
703
|
+
accessorKey: (string & {}) | keyof TData;
|
|
703
704
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
705
|
+
type AccessorKeyColumnDef<TData extends RowData, TValue = unknown> = AccessorKeyColumnDefBase<TData, TValue> & Partial<ColumnIdentifiers<TData, TValue>>;
|
|
706
|
+
type AccessorColumnDef<TData extends RowData, TValue = unknown> = AccessorKeyColumnDef<TData, TValue> | AccessorFnColumnDef<TData, TValue>;
|
|
707
|
+
type ColumnDef<TData extends RowData, TValue = unknown> = DisplayColumnDef<TData, TValue> | GroupColumnDef<TData, TValue> | AccessorColumnDef<TData, TValue>;
|
|
708
|
+
type ColumnDefResolved<TData extends RowData, TValue = unknown> = Partial<UnionToIntersection<ColumnDef<TData, TValue>>> & {
|
|
708
709
|
accessorKey?: string;
|
|
709
710
|
};
|
|
710
711
|
interface Column<TData extends RowData, TValue = unknown> extends CoreColumn<TData, TValue>, VisibilityColumn, ColumnPinningColumn, FiltersColumn<TData>, SortingColumn<TData>, GroupingColumn<TData>, ColumnSizingColumn {
|
|
@@ -716,29 +717,29 @@ interface Header<TData extends RowData, TValue> extends CoreHeader<TData, TValue
|
|
|
716
717
|
interface HeaderGroup<TData extends RowData> extends CoreHeaderGroup<TData> {
|
|
717
718
|
}
|
|
718
719
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
720
|
+
type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
721
|
+
type RequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
722
|
+
type Overwrite<T, U extends {
|
|
722
723
|
[TKey in keyof T]?: any;
|
|
723
724
|
}> = Omit<T, keyof U> & U;
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
725
|
+
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
|
726
|
+
type IsAny<T, Y, N> = 1 extends 0 & T ? Y : N;
|
|
727
|
+
type IsKnown<T, Y, N> = unknown extends T ? N : Y;
|
|
728
|
+
type ComputeRange<N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : ComputeRange<N, [...Result, Result['length']]>;
|
|
729
|
+
type Index40 = ComputeRange<40>[number];
|
|
730
|
+
type IsTuple<T> = T extends readonly any[] & {
|
|
730
731
|
length: infer Length;
|
|
731
732
|
} ? Length extends Index40 ? T : never : never;
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
733
|
+
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;
|
|
734
|
+
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;
|
|
735
|
+
type DeepKeysPrefix<T, TPrefix> = TPrefix extends keyof T & (number | string) ? `${TPrefix}.${DeepKeys<T[TPrefix]> & string}` : never;
|
|
736
|
+
type DeepValue<T, TProp> = T extends Record<string | number, any> ? TProp extends `${infer TBranch}.${infer TDeepProp}` ? DeepValue<T[TBranch], TDeepProp> : T[TProp & string] : never;
|
|
737
|
+
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
738
|
+
type Getter<TValue> = <TTValue = TValue>() => NoInfer<TTValue>;
|
|
738
739
|
declare function functionalUpdate<T>(updater: Updater<T>, input: T): T;
|
|
739
740
|
declare function noop(): void;
|
|
740
741
|
declare function makeStateUpdater<K extends keyof TableState>(key: K, instance: unknown): (updater: Updater<TableState[K]>) => void;
|
|
741
|
-
|
|
742
|
+
type AnyFunction = (...args: any) => any;
|
|
742
743
|
declare function isFunction<T extends AnyFunction>(d: any): d is T;
|
|
743
744
|
declare function flattenBy<TNode>(arr: TNode[], getChildren: (item: TNode) => TNode[]): TNode[];
|
|
744
745
|
declare function memo<TDeps extends readonly any[], TResult>(getDeps: () => [...TDeps], fn: (...args: NoInfer<[...TDeps]>) => TResult, opts: {
|
|
@@ -803,7 +804,7 @@ interface CoreInstance<TData extends RowData> {
|
|
|
803
804
|
}
|
|
804
805
|
declare function createTable<TData extends RowData>(options: TableOptionsResolved<TData>): Table<TData>;
|
|
805
806
|
|
|
806
|
-
|
|
807
|
+
type ColumnHelper<TData extends RowData> = {
|
|
807
808
|
accessor: <TAccessor extends AccessorFn<TData> | DeepKeys<TData>, TValue extends TAccessor extends AccessorFn<TData, infer TReturn> ? TReturn : TAccessor extends DeepKeys<TData> ? DeepValue<TData, TAccessor> : never>(accessor: TAccessor, column: TAccessor extends AccessorFn<TData> ? DisplayColumnDef<TData, TValue> : IdentifiedColumnDef<TData, TValue>) => ColumnDef<TData, TValue>;
|
|
808
809
|
display: (column: DisplayColumnDef<TData>) => ColumnDef<TData, unknown>;
|
|
809
810
|
group: (column: GroupColumnDef<TData>) => ColumnDef<TData, unknown>;
|
|
@@ -959,6 +959,7 @@
|
|
|
959
959
|
onColumnFiltersChange: makeStateUpdater('columnFilters', table),
|
|
960
960
|
onGlobalFilterChange: makeStateUpdater('globalFilter', table),
|
|
961
961
|
filterFromLeafRows: false,
|
|
962
|
+
maxLeafRowFilterDepth: 100,
|
|
962
963
|
globalFilterFn: 'auto',
|
|
963
964
|
getColumnCanGlobalFilter: column => {
|
|
964
965
|
var _table$getCoreRowMode, _table$getCoreRowMode2;
|
|
@@ -2839,7 +2840,11 @@
|
|
|
2839
2840
|
function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
|
|
2840
2841
|
const newFilteredFlatRows = [];
|
|
2841
2842
|
const newFilteredRowsById = {};
|
|
2843
|
+
const maxDepth = table.options.maxLeafRowFilterDepth ?? 100;
|
|
2842
2844
|
const recurseFilterRows = function (rowsToFilter, depth) {
|
|
2845
|
+
if (depth === void 0) {
|
|
2846
|
+
depth = 0;
|
|
2847
|
+
}
|
|
2843
2848
|
const rows = [];
|
|
2844
2849
|
|
|
2845
2850
|
// Filter from children up first
|
|
@@ -2848,8 +2853,8 @@
|
|
|
2848
2853
|
let row = rowsToFilter[i];
|
|
2849
2854
|
const newRow = createRow(table, row.id, row.original, row.index, row.depth);
|
|
2850
2855
|
newRow.columnFilters = row.columnFilters;
|
|
2851
|
-
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
2852
|
-
newRow.subRows = recurseFilterRows(row.subRows);
|
|
2856
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
|
|
2857
|
+
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
2853
2858
|
row = newRow;
|
|
2854
2859
|
if (filterRow(row) && !newRow.subRows.length) {
|
|
2855
2860
|
rows.push(row);
|
|
@@ -2883,9 +2888,13 @@
|
|
|
2883
2888
|
function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
2884
2889
|
const newFilteredFlatRows = [];
|
|
2885
2890
|
const newFilteredRowsById = {};
|
|
2891
|
+
const maxDepth = table.options.maxLeafRowFilterDepth ?? 100;
|
|
2886
2892
|
|
|
2887
2893
|
// Filters top level and nested rows
|
|
2888
2894
|
const recurseFilterRows = function (rowsToFilter, depth) {
|
|
2895
|
+
if (depth === void 0) {
|
|
2896
|
+
depth = 0;
|
|
2897
|
+
}
|
|
2889
2898
|
// Filter from parents downward first
|
|
2890
2899
|
|
|
2891
2900
|
const rows = [];
|
|
@@ -2896,9 +2905,9 @@
|
|
|
2896
2905
|
const pass = filterRow(row);
|
|
2897
2906
|
if (pass) {
|
|
2898
2907
|
var _row$subRows2;
|
|
2899
|
-
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
2908
|
+
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
|
|
2900
2909
|
const newRow = createRow(table, row.id, row.original, row.index, row.depth);
|
|
2901
|
-
newRow.subRows = recurseFilterRows(row.subRows);
|
|
2910
|
+
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
2902
2911
|
row = newRow;
|
|
2903
2912
|
}
|
|
2904
2913
|
rows.push(row);
|