@tanstack/react-table 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/table-core/build/esm/index.js +13 -4
- package/build/cjs/table-core/build/esm/index.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 +17 -17
- package/build/types/index.d.ts +1 -1
- 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 +2 -2
package/build/esm/index.js
CHANGED
|
@@ -966,6 +966,7 @@ const Filters = {
|
|
|
966
966
|
onColumnFiltersChange: makeStateUpdater('columnFilters', table),
|
|
967
967
|
onGlobalFilterChange: makeStateUpdater('globalFilter', table),
|
|
968
968
|
filterFromLeafRows: false,
|
|
969
|
+
maxLeafRowFilterDepth: 100,
|
|
969
970
|
globalFilterFn: 'auto',
|
|
970
971
|
getColumnCanGlobalFilter: column => {
|
|
971
972
|
var _table$getCoreRowMode, _table$getCoreRowMode2;
|
|
@@ -2847,7 +2848,11 @@ function filterRows(rows, filterRowImpl, table) {
|
|
|
2847
2848
|
function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
|
|
2848
2849
|
const newFilteredFlatRows = [];
|
|
2849
2850
|
const newFilteredRowsById = {};
|
|
2851
|
+
const maxDepth = table.options.maxLeafRowFilterDepth ?? 100;
|
|
2850
2852
|
const recurseFilterRows = function (rowsToFilter, depth) {
|
|
2853
|
+
if (depth === void 0) {
|
|
2854
|
+
depth = 0;
|
|
2855
|
+
}
|
|
2851
2856
|
const rows = [];
|
|
2852
2857
|
|
|
2853
2858
|
// Filter from children up first
|
|
@@ -2856,8 +2861,8 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
|
|
|
2856
2861
|
let row = rowsToFilter[i];
|
|
2857
2862
|
const newRow = createRow(table, row.id, row.original, row.index, row.depth);
|
|
2858
2863
|
newRow.columnFilters = row.columnFilters;
|
|
2859
|
-
if ((_row$subRows = row.subRows) != null && _row$subRows.length) {
|
|
2860
|
-
newRow.subRows = recurseFilterRows(row.subRows);
|
|
2864
|
+
if ((_row$subRows = row.subRows) != null && _row$subRows.length && depth < maxDepth) {
|
|
2865
|
+
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
2861
2866
|
row = newRow;
|
|
2862
2867
|
if (filterRow(row) && !newRow.subRows.length) {
|
|
2863
2868
|
rows.push(row);
|
|
@@ -2891,9 +2896,13 @@ function filterRowModelFromLeafs(rowsToFilter, filterRow, table) {
|
|
|
2891
2896
|
function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
2892
2897
|
const newFilteredFlatRows = [];
|
|
2893
2898
|
const newFilteredRowsById = {};
|
|
2899
|
+
const maxDepth = table.options.maxLeafRowFilterDepth ?? 100;
|
|
2894
2900
|
|
|
2895
2901
|
// Filters top level and nested rows
|
|
2896
2902
|
const recurseFilterRows = function (rowsToFilter, depth) {
|
|
2903
|
+
if (depth === void 0) {
|
|
2904
|
+
depth = 0;
|
|
2905
|
+
}
|
|
2897
2906
|
// Filter from parents downward first
|
|
2898
2907
|
|
|
2899
2908
|
const rows = [];
|
|
@@ -2904,9 +2913,9 @@ function filterRowModelFromRoot(rowsToFilter, filterRow, table) {
|
|
|
2904
2913
|
const pass = filterRow(row);
|
|
2905
2914
|
if (pass) {
|
|
2906
2915
|
var _row$subRows2;
|
|
2907
|
-
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length) {
|
|
2916
|
+
if ((_row$subRows2 = row.subRows) != null && _row$subRows2.length && depth < maxDepth) {
|
|
2908
2917
|
const newRow = createRow(table, row.id, row.original, row.index, row.depth);
|
|
2909
|
-
newRow.subRows = recurseFilterRows(row.subRows);
|
|
2918
|
+
newRow.subRows = recurseFilterRows(row.subRows, depth + 1);
|
|
2910
2919
|
row = newRow;
|
|
2911
2920
|
}
|
|
2912
2921
|
rows.push(row);
|