@tanstack/table-core 8.5.30 → 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 +1 -0
- 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/utils/filterRowsUtils.ts +4 -2
package/build/types/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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);
|