@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.
- package/dist/core/headers/buildHeaderGroups.js +11 -7
- package/dist/core/headers/coreHeadersFeature.types.d.ts +14 -2
- package/dist/flex-render.js +9 -1
- package/package.json +1 -1
- package/skills/aggregation/SKILL.md +1 -1
- package/skills/api-not-found/SKILL.md +1 -1
- package/skills/cell-selection/SKILL.md +1 -1
- package/skills/client-vs-server/SKILL.md +1 -1
- package/skills/column-faceting/SKILL.md +1 -1
- package/skills/column-filtering/SKILL.md +1 -1
- package/skills/column-ordering/SKILL.md +1 -1
- package/skills/column-pinning/SKILL.md +1 -1
- package/skills/column-resizing/SKILL.md +1 -1
- package/skills/column-sizing/SKILL.md +1 -1
- package/skills/column-visibility/SKILL.md +1 -1
- package/skills/core/SKILL.md +1 -1
- package/skills/custom-features/SKILL.md +1 -1
- package/skills/expanding/SKILL.md +1 -1
- package/skills/global-filtering/SKILL.md +1 -1
- package/skills/grouping/SKILL.md +1 -1
- package/skills/migrate-v8-to-v9/SKILL.md +1 -1
- package/skills/pagination/SKILL.md +1 -1
- package/skills/row-pinning/SKILL.md +1 -1
- package/skills/row-selection/SKILL.md +1 -1
- package/skills/sorting/SKILL.md +1 -1
- package/skills/table-features/SKILL.md +1 -1
- package/skills/typescript/SKILL.md +1 -1
|
@@ -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.
|
|
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
|
|
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
|
/**
|
package/dist/flex-render.js
CHANGED
|
@@ -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)
|
|
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
package/skills/core/SKILL.md
CHANGED
|
@@ -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.
|
|
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'
|
package/skills/grouping/SKILL.md
CHANGED
|
@@ -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.
|
|
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'
|
package/skills/sorting/SKILL.md
CHANGED