@tanstack/table-core 8.2.3 → 8.2.6

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.2.3",
4
+ "version": "8.2.6",
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",
@@ -218,9 +218,11 @@ export const Expanding: TableFeature = {
218
218
  },
219
219
  getCanExpand: () => {
220
220
  return (
221
- (table.options.getRowCanExpand?.(row) ?? true) &&
222
- (table.options.enableExpanding ?? true) &&
223
- !!row.subRows?.length
221
+ table.options.getRowCanExpand?.(row) ??
222
+ (
223
+ (table.options.enableExpanding ?? true) &&
224
+ !!row.subRows?.length
225
+ )
224
226
  )
225
227
  },
226
228
  getToggleExpandedHandler: () => {
@@ -178,7 +178,7 @@ export const Filters: TableFeature = {
178
178
  .flatRows[0]?._getAllCellsByColumnId()
179
179
  [column.id]?.getValue()
180
180
 
181
- return typeof value === 'string'
181
+ return typeof value === 'string' || typeof value === 'number'
182
182
  },
183
183
  }
184
184
  },
@@ -423,7 +423,7 @@ const mutateRowIsSelected = <TData extends RowData>(
423
423
  ) => {
424
424
  const row = table.getRow(id)
425
425
 
426
- const isGrouped = row.getIsGrouped()
426
+ // const isGrouped = row.getIsGrouped()
427
427
 
428
428
  // if ( // TODO: enforce grouping row selection rules
429
429
  // !isGrouped ||
@@ -29,11 +29,23 @@ export function getGroupedRowModel<TData extends RowData>(): (
29
29
  const groupUpRecursively = (
30
30
  rows: Row<TData>[],
31
31
  depth = 0,
32
- parentId: string
32
+ parentId?: string
33
33
  ) => {
34
- // This is the last level, just return the rows
35
- if (depth === existingGrouping.length) {
36
- return rows
34
+ // Grouping depth has been been met
35
+ // Stop grouping and simply rewrite thd depth and row relationships
36
+ if (depth >= existingGrouping.length) {
37
+ return rows.map(row => {
38
+ row.depth = depth
39
+
40
+ groupedFlatRows.push(row)
41
+ groupedRowsById[row.id] = row
42
+
43
+ if (row.subRows) {
44
+ row.subRows = groupUpRecursively(row.subRows, depth + 1)
45
+ }
46
+
47
+ return row
48
+ })
37
49
  }
38
50
 
39
51
  const columnId = existingGrouping[depth]!