@tanstack/table-core 8.5.22 → 8.5.25

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
3
  "author": "Tanner Linsley",
4
- "version": "8.5.22",
4
+ "version": "8.5.25",
5
5
  "description": "Headless UI for building powerful tables & datagrids for TS/JS.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/tanstack/table#readme",
@@ -130,7 +130,7 @@ export const Pagination: TableFeature = {
130
130
  ? Number.MAX_SAFE_INTEGER
131
131
  : table.options.pageCount - 1
132
132
 
133
- pageIndex = Math.min(Math.max(0, pageIndex), maxPageIndex)
133
+ pageIndex = Math.max(0, Math.min(pageIndex, maxPageIndex))
134
134
 
135
135
  return {
136
136
  ...old,
@@ -28,26 +28,39 @@ export function filterRowModelFromLeafs<TData extends RowData>(
28
28
  for (let i = 0; i < rowsToFilter.length; i++) {
29
29
  let row = rowsToFilter[i]!
30
30
 
31
+ const newRow = createRow(
32
+ table,
33
+ row.id,
34
+ row.original,
35
+ row.index,
36
+ row.depth
37
+ )
38
+ newRow.columnFilters = row.columnFilters
39
+
31
40
  if (row.subRows?.length) {
32
- const newRow = createRow(
33
- table,
34
- row.id,
35
- row.original,
36
- row.index,
37
- row.depth
38
- )
39
- newRow.columnFilters = row.columnFilters
40
41
  newRow.subRows = recurseFilterRows(row.subRows, depth + 1)
41
- if (!newRow.subRows.length) {
42
+ row = newRow
43
+
44
+ if (filterRow(row) && !newRow.subRows.length) {
45
+ rows.push(row)
46
+ newFilteredRowsById[row.id] = row
47
+ newFilteredRowsById[i] = row
42
48
  continue
43
49
  }
44
- row = newRow
45
- }
46
50
 
47
- if (filterRow(row)) {
48
- rows.push(row)
49
- newFilteredRowsById[row.id] = row
50
- newFilteredRowsById[i] = row
51
+ if (filterRow(row) || newRow.subRows.length) {
52
+ rows.push(row)
53
+ newFilteredRowsById[row.id] = row
54
+ newFilteredRowsById[i] = row
55
+ continue
56
+ }
57
+ } else {
58
+ row = newRow
59
+ if (filterRow(row)) {
60
+ rows.push(row)
61
+ newFilteredRowsById[row.id] = row
62
+ newFilteredRowsById[i] = row
63
+ }
51
64
  }
52
65
  }
53
66