@tanstack/table-core 9.0.0-beta.68 → 9.0.0-beta.69

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.
@@ -69,21 +69,25 @@ function updateHeaderSpans(headers) {
69
69
  const header = headers[i];
70
70
  if (!callMemoOrStaticFn(header.column, "getIsVisible", column_getIsVisible)) continue;
71
71
  let colSpan = 0;
72
- let minChildRowSpan = Infinity;
73
72
  if (header.subHeaders.length) {
74
73
  updateHeaderSpans(header.subHeaders);
75
74
  for (let j = 0; j < header.subHeaders.length; j++) {
76
75
  const child = header.subHeaders[j];
77
76
  if (!callMemoOrStaticFn(child.column, "getIsVisible", column_getIsVisible)) continue;
78
77
  colSpan += child.colSpan;
79
- if (child.rowSpan < minChildRowSpan) minChildRowSpan = child.rowSpan;
80
78
  }
81
- } else {
82
- colSpan = 1;
83
- minChildRowSpan = 0;
84
- }
79
+ } else colSpan = 1;
85
80
  header.colSpan = colSpan;
86
- header.rowSpan = minChildRowSpan;
81
+ if (header.isPlaceholder && header.subHeaders.length === 1 && header.subHeaders[0].column === header.column) {
82
+ let rowSpan = 1;
83
+ let chainChild = header.subHeaders[0];
84
+ while (chainChild) {
85
+ chainChild.rowSpan = 0;
86
+ rowSpan++;
87
+ chainChild = chainChild.subHeaders.length === 1 && chainChild.subHeaders[0].column === header.column ? chainChild.subHeaders[0] : void 0;
88
+ }
89
+ header.rowSpan = rowSpan;
90
+ } else header.rowSpan = 1;
87
91
  }
88
92
  }
89
93
  /**
@@ -65,7 +65,11 @@ interface Header_CoreProperties<in out TFeatures extends TableFeatures, in out T
65
65
  */
66
66
  index: number;
67
67
  /**
68
- * A boolean denoting if the header is a placeholder header.
68
+ * A boolean denoting if the header is a placeholder header. Placeholder
69
+ * headers fill the rows above a shallow leaf column's real header so that
70
+ * every header group row accounts for every visible column. Render them as
71
+ * empty cells, or use `header.rowSpan` to merge each chain of placeholders
72
+ * into one vertically spanning header cell.
69
73
  */
70
74
  isPlaceholder: boolean;
71
75
  /**
@@ -73,7 +77,15 @@ interface Header_CoreProperties<in out TFeatures extends TableFeatures, in out T
73
77
  */
74
78
  placeholderId?: string;
75
79
  /**
76
- * The row-span for the header.
80
+ * The number of header group rows the header should span when merging header
81
+ * cells vertically. A leaf column that is shallower than the deepest leaf
82
+ * column produces a chain of placeholder headers above its real header; the
83
+ * placeholder at the top of the chain reports the chain's full span, and
84
+ * every header it covers (including the real leaf header in the bottom row)
85
+ * reports 0. To merge vertically, skip headers with a rowSpan of 0 and
86
+ * render every other header with the `rowSpan` attribute and its column's
87
+ * header content, even when it is a placeholder. Headers in even column
88
+ * trees always report 1.
77
89
  */
78
90
  rowSpan: number;
79
91
  /**
@@ -15,7 +15,15 @@ function flexRender(comp, props) {
15
15
  * Framework adapters use this helper to support column definitions that contain either plain values or template functions.
16
16
  */
17
17
  function FlexRender(props) {
18
- if ("cell" in props && props.cell) return flexRender(props.cell.column.columnDef.cell, props.cell.getContext());
18
+ if ("cell" in props && props.cell) {
19
+ const cell = props.cell;
20
+ const def = cell.column.columnDef;
21
+ const groupingCell = cell;
22
+ const groupingDef = def;
23
+ if (groupingCell.getIsAggregated?.()) return flexRender(groupingDef.aggregatedCell ?? def.cell, cell.getContext());
24
+ if (groupingCell.getIsPlaceholder?.()) return null;
25
+ return flexRender(def.cell, cell.getContext());
26
+ }
19
27
  if ("header" in props && props.header) return flexRender(props.header.column.columnDef.header, props.header.getContext());
20
28
  if ("footer" in props && props.footer) return flexRender(props.footer.column.columnDef.footer, props.footer.getContext());
21
29
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/table-core",
3
- "version": "9.0.0-beta.68",
3
+ "version": "9.0.0-beta.69",
4
4
  "description": "Headless UI for building powerful tables & datagrids for TS/JS.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features']
12
12
  sources:
@@ -5,7 +5,7 @@ description: >
5
5
  metadata:
6
6
  type: sub-skill
7
7
  library: '@tanstack/table-core'
8
- library_version: '9.0.0-beta.68'
8
+ library_version: '9.0.0-beta.69'
9
9
  requires: ['core', 'table-features']
10
10
  sources:
11
11
  - 'TanStack/table:packages/table-core/src/index.ts'
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features']
12
12
  sources:
@@ -5,7 +5,7 @@ description: >
5
5
  metadata:
6
6
  type: sub-skill
7
7
  library: '@tanstack/table-core'
8
- library_version: '9.0.0-beta.68'
8
+ library_version: '9.0.0-beta.69'
9
9
  requires: ['core', 'table-features']
10
10
  sources:
11
11
  - 'TanStack/table:docs/guide/row-models.md'
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'column-filtering']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'client-vs-server']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'column-sizing']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'column-sizing']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features']
12
12
  sources:
@@ -5,7 +5,7 @@ description: >
5
5
  metadata:
6
6
  type: core
7
7
  library: '@tanstack/table-core'
8
- library_version: '9.0.0-beta.68'
8
+ library_version: '9.0.0-beta.69'
9
9
  sources:
10
10
  - 'TanStack/table:docs/overview.md'
11
11
  - 'TanStack/table:docs/guide/tables.md'
@@ -5,7 +5,7 @@ description: >
5
5
  metadata:
6
6
  type: sub-skill
7
7
  library: '@tanstack/table-core'
8
- library_version: '9.0.0-beta.68'
8
+ library_version: '9.0.0-beta.69'
9
9
  requires: ['core', 'table-features', 'typescript']
10
10
  sources:
11
11
  - 'TanStack/table:docs/framework/react/guide/custom-features.md'
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'client-vs-server']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'client-vs-server', 'column-filtering']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'client-vs-server']
12
12
  sources:
@@ -5,7 +5,7 @@ description: >
5
5
  metadata:
6
6
  type: lifecycle
7
7
  library: '@tanstack/table-core'
8
- library_version: '9.0.0-beta.68'
8
+ library_version: '9.0.0-beta.69'
9
9
  requires: ['core', 'table-features', 'typescript']
10
10
  sources:
11
11
  - 'TanStack/table:docs/framework/react/guide/migrating.md'
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'client-vs-server']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features']
12
12
  sources:
@@ -6,7 +6,7 @@ metadata:
6
6
  {
7
7
  type: sub-skill,
8
8
  library: '@tanstack/table-core',
9
- library_version: '9.0.0-beta.68',
9
+ library_version: '9.0.0-beta.69',
10
10
  }
11
11
  requires: ['core', 'table-features', 'client-vs-server']
12
12
  sources:
@@ -5,7 +5,7 @@ description: >
5
5
  metadata:
6
6
  type: sub-skill
7
7
  library: '@tanstack/table-core'
8
- library_version: '9.0.0-beta.68'
8
+ library_version: '9.0.0-beta.69'
9
9
  requires: ['core']
10
10
  sources:
11
11
  - 'TanStack/table:docs/guide/row-models.md'
@@ -5,7 +5,7 @@ description: >
5
5
  metadata:
6
6
  type: sub-skill
7
7
  library: '@tanstack/table-core'
8
- library_version: '9.0.0-beta.68'
8
+ library_version: '9.0.0-beta.69'
9
9
  requires: ['core', 'table-features']
10
10
  sources:
11
11
  - 'TanStack/table:docs/guide/helpers.md'