@tanstack/table-core 9.0.0-alpha.47 → 9.0.0-alpha.48
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/README.md +10 -0
- package/dist/core/cells/coreCellsFeature.utils.cjs +11 -8
- package/dist/core/cells/coreCellsFeature.utils.cjs.map +1 -1
- package/dist/core/cells/coreCellsFeature.utils.d.cts +11 -8
- package/dist/core/cells/coreCellsFeature.utils.d.ts +11 -8
- package/dist/core/cells/coreCellsFeature.utils.js +11 -8
- package/dist/core/cells/coreCellsFeature.utils.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.types.d.cts +7 -6
- package/dist/core/columns/coreColumnsFeature.types.d.ts +7 -6
- package/dist/core/columns/coreColumnsFeature.utils.cjs +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.d.cts +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.d.ts +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.js +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.types.d.cts +6 -4
- package/dist/core/headers/coreHeadersFeature.types.d.ts +6 -4
- package/dist/core/headers/coreHeadersFeature.utils.cjs +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.js +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.js +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +4 -4
- package/dist/core/rows/coreRowsFeature.types.d.ts +4 -4
- package/dist/core/rows/coreRowsFeature.utils.cjs +34 -28
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.cts +34 -28
- package/dist/core/rows/coreRowsFeature.utils.d.ts +34 -28
- package/dist/core/rows/coreRowsFeature.utils.js +34 -28
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +6 -2
- package/dist/core/table/coreTablesFeature.types.d.ts +6 -2
- package/dist/core/table/coreTablesFeature.utils.cjs +2 -2
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.d.cts +2 -2
- package/dist/core/table/coreTablesFeature.utils.d.ts +2 -2
- package/dist/core/table/coreTablesFeature.utils.js +2 -2
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +16 -10
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +16 -10
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.js +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +21 -11
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +21 -11
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +18 -14
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +18 -14
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +14 -5
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +14 -5
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +43 -31
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +43 -31
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.js +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.types.d.cts +9 -9
- package/dist/features/column-resizing/columnResizingFeature.types.d.ts +9 -9
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.js +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.types.d.cts +19 -12
- package/dist/features/column-sizing/columnSizingFeature.types.d.ts +19 -12
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.js +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +16 -13
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +16 -13
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +10 -5
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +10 -5
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.js +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +16 -15
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +16 -15
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +19 -12
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +19 -12
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.js +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +12 -8
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +12 -8
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.js +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +30 -24
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +30 -24
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.js +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +10 -8
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +10 -8
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.js +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/fns/aggregationFns.cjs +33 -9
- package/dist/fns/aggregationFns.cjs.map +1 -1
- package/dist/fns/aggregationFns.d.cts +33 -9
- package/dist/fns/aggregationFns.d.ts +33 -9
- package/dist/fns/aggregationFns.js +33 -9
- package/dist/fns/aggregationFns.js.map +1 -1
- package/dist/fns/filterFns.cjs +48 -17
- package/dist/fns/filterFns.cjs.map +1 -1
- package/dist/fns/filterFns.d.cts +42 -15
- package/dist/fns/filterFns.d.ts +42 -15
- package/dist/fns/filterFns.js +48 -17
- package/dist/fns/filterFns.js.map +1 -1
- package/dist/helpers/columnHelper.cjs +9 -4
- package/dist/helpers/columnHelper.cjs.map +1 -1
- package/dist/helpers/columnHelper.d.cts +9 -4
- package/dist/helpers/columnHelper.d.ts +9 -4
- package/dist/helpers/columnHelper.js +9 -4
- package/dist/helpers/columnHelper.js.map +1 -1
- package/dist/helpers/tableOptions.cjs.map +1 -1
- package/dist/helpers/tableOptions.d.cts +12 -9
- package/dist/helpers/tableOptions.d.ts +12 -9
- package/dist/helpers/tableOptions.js.map +1 -1
- package/dist/types/ColumnDef.d.cts +38 -0
- package/dist/types/ColumnDef.d.ts +38 -0
- package/dist/types/TableOptions.d.cts +15 -0
- package/dist/types/TableOptions.d.ts +15 -0
- package/dist/types/TableState.d.cts +12 -0
- package/dist/types/TableState.d.ts +12 -0
- package/package.json +5 -3
- package/skills/column-definitions/SKILL.md +333 -0
- package/skills/column-layout/SKILL.md +328 -0
- package/skills/column-layout/references/subsystems.md +220 -0
- package/skills/customizing-feature-behavior/SKILL.md +416 -0
- package/skills/filtering/SKILL.md +357 -0
- package/skills/filtering/references/faceting-and-fuzzy.md +191 -0
- package/skills/grouping/SKILL.md +448 -0
- package/skills/migrate-v8-to-v9/SKILL.md +495 -0
- package/skills/pagination/SKILL.md +385 -0
- package/skills/row-expanding/SKILL.md +348 -0
- package/skills/row-pinning/SKILL.md +269 -0
- package/skills/row-selection/SKILL.md +391 -0
- package/skills/setup/SKILL.md +400 -0
- package/skills/sorting/SKILL.md +344 -0
- package/skills/state-management/SKILL.md +388 -0
- package/src/core/cells/coreCellsFeature.utils.ts +11 -8
- package/src/core/columns/coreColumnsFeature.types.ts +7 -6
- package/src/core/columns/coreColumnsFeature.utils.ts +37 -27
- package/src/core/headers/coreHeadersFeature.types.ts +6 -4
- package/src/core/headers/coreHeadersFeature.utils.ts +23 -18
- package/src/core/row-models/coreRowModelsFeature.utils.ts +48 -36
- package/src/core/rows/coreRowsFeature.types.ts +4 -4
- package/src/core/rows/coreRowsFeature.utils.ts +34 -28
- package/src/core/table/coreTablesFeature.types.ts +6 -2
- package/src/core/table/coreTablesFeature.utils.ts +2 -2
- package/src/features/column-faceting/columnFacetingFeature.types.ts +16 -10
- package/src/features/column-faceting/columnFacetingFeature.utils.ts +26 -18
- package/src/features/column-filtering/columnFilteringFeature.types.ts +21 -11
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +39 -28
- package/src/features/column-grouping/columnGroupingFeature.types.ts +18 -14
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +55 -43
- package/src/features/column-ordering/columnOrderingFeature.types.ts +14 -5
- package/src/features/column-ordering/columnOrderingFeature.utils.ts +30 -23
- package/src/features/column-pinning/columnPinningFeature.types.ts +43 -31
- package/src/features/column-pinning/columnPinningFeature.utils.ts +111 -91
- package/src/features/column-resizing/columnResizingFeature.types.ts +9 -9
- package/src/features/column-resizing/columnResizingFeature.utils.ts +28 -19
- package/src/features/column-sizing/columnSizingFeature.types.ts +19 -12
- package/src/features/column-sizing/columnSizingFeature.utils.ts +52 -41
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +16 -13
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +54 -42
- package/src/features/global-filtering/globalFilteringFeature.types.ts +10 -5
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +20 -14
- package/src/features/row-expanding/rowExpandingFeature.types.ts +16 -15
- package/src/features/row-expanding/rowExpandingFeature.utils.ts +56 -41
- package/src/features/row-pagination/rowPaginationFeature.types.ts +19 -12
- package/src/features/row-pagination/rowPaginationFeature.utils.ts +49 -32
- package/src/features/row-pinning/rowPinningFeature.types.ts +12 -8
- package/src/features/row-pinning/rowPinningFeature.utils.ts +39 -29
- package/src/features/row-selection/rowSelectionFeature.types.ts +30 -24
- package/src/features/row-selection/rowSelectionFeature.utils.ts +89 -69
- package/src/features/row-sorting/rowSortingFeature.types.ts +10 -8
- package/src/features/row-sorting/rowSortingFeature.utils.ts +61 -44
- package/src/fns/aggregationFns.ts +33 -9
- package/src/fns/filterFns.ts +48 -17
- package/src/helpers/columnHelper.ts +9 -4
- package/src/helpers/tableOptions.ts +12 -9
- package/src/types/ColumnDef.ts +38 -0
- package/src/types/TableOptions.ts +15 -0
- package/src/types/TableState.ts +12 -0
|
@@ -5,13 +5,14 @@ const require_columnPinningFeature_utils = require('../../features/column-pinnin
|
|
|
5
5
|
|
|
6
6
|
//#region src/core/headers/coreHeadersFeature.utils.ts
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Walks a header tree and collects all descendant leaf headers.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* The header itself is included after its descendants, matching the recursive
|
|
11
|
+
* shape used by nested header groups.
|
|
11
12
|
*
|
|
12
13
|
* @example
|
|
13
14
|
* ```ts
|
|
14
|
-
* const
|
|
15
|
+
* const leafHeaders = header_getLeafHeaders(header)
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
18
|
function header_getLeafHeaders(header) {
|
|
@@ -24,13 +25,13 @@ function header_getLeafHeaders(header) {
|
|
|
24
25
|
return leafHeaders;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* Builds the render context passed to a column's `header` or `footer` template.
|
|
28
29
|
*
|
|
29
|
-
*
|
|
30
|
+
* The context contains the header, its column, and the owning table instance.
|
|
30
31
|
*
|
|
31
32
|
* @example
|
|
32
33
|
* ```ts
|
|
33
|
-
* const
|
|
34
|
+
* const context = header_getContext(header)
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
36
37
|
function header_getContext(header) {
|
|
@@ -41,13 +42,14 @@ function header_getContext(header) {
|
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* Builds visible header groups for the current column tree.
|
|
45
46
|
*
|
|
46
|
-
*
|
|
47
|
+
* Column visibility and pinning are applied before groups are built. When no
|
|
48
|
+
* columns are pinned, the fast path skips pin partitioning.
|
|
47
49
|
*
|
|
48
50
|
* @example
|
|
49
51
|
* ```ts
|
|
50
|
-
* const
|
|
52
|
+
* const headerGroups = table_getHeaderGroups(table)
|
|
51
53
|
* ```
|
|
52
54
|
*/
|
|
53
55
|
function table_getHeaderGroups(table) {
|
|
@@ -75,26 +77,28 @@ function table_getHeaderGroups(table) {
|
|
|
75
77
|
], table);
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
|
-
*
|
|
80
|
+
* Builds footer groups by reversing the current header groups.
|
|
79
81
|
*
|
|
80
|
-
*
|
|
82
|
+
* Footer rendering uses the same header objects and grouping structure, but
|
|
83
|
+
* renders them from leaf level back toward the root.
|
|
81
84
|
*
|
|
82
85
|
* @example
|
|
83
86
|
* ```ts
|
|
84
|
-
* const
|
|
87
|
+
* const footerGroups = table_getFooterGroups(table)
|
|
85
88
|
* ```
|
|
86
89
|
*/
|
|
87
90
|
function table_getFooterGroups(table) {
|
|
88
91
|
return [...table.getHeaderGroups()].reverse();
|
|
89
92
|
}
|
|
90
93
|
/**
|
|
91
|
-
*
|
|
94
|
+
* Flattens every header from every header group into one array.
|
|
92
95
|
*
|
|
93
|
-
*
|
|
96
|
+
* The result includes parent headers and placeholder headers, in header-group
|
|
97
|
+
* order from top to bottom.
|
|
94
98
|
*
|
|
95
99
|
* @example
|
|
96
100
|
* ```ts
|
|
97
|
-
* const
|
|
101
|
+
* const flatHeaders = table_getFlatHeaders(table)
|
|
98
102
|
* ```
|
|
99
103
|
*/
|
|
100
104
|
function table_getFlatHeaders(table) {
|
|
@@ -107,13 +111,14 @@ function table_getFlatHeaders(table) {
|
|
|
107
111
|
return result;
|
|
108
112
|
}
|
|
109
113
|
/**
|
|
110
|
-
*
|
|
114
|
+
* Collects only the leaf headers from the current header tree.
|
|
111
115
|
*
|
|
112
|
-
*
|
|
116
|
+
* Parent/group headers are skipped, making the result suitable for rendering
|
|
117
|
+
* one header per visible leaf column.
|
|
113
118
|
*
|
|
114
119
|
* @example
|
|
115
120
|
* ```ts
|
|
116
|
-
* const
|
|
121
|
+
* const leafHeaders = table_getLeafHeaders(table)
|
|
117
122
|
* ```
|
|
118
123
|
*/
|
|
119
124
|
function table_getLeafHeaders(table) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreHeadersFeature.utils.cjs","names":["getDefaultColumnPinningState","callMemoOrStaticFn","table_getVisibleLeafColumns","buildHeaderGroups","column_getIsVisible"],"sources":["../../../src/core/headers/coreHeadersFeature.utils.ts"],"sourcesContent":["import { getDefaultColumnPinningState } from '../../features/column-pinning/columnPinningFeature.utils'\nimport {\n column_getIsVisible,\n table_getVisibleLeafColumns,\n} from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { callMemoOrStaticFn } from '../../utils'\nimport { buildHeaderGroups } from './buildHeaderGroups'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Header } from '../../types/Header'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header_Header } from './coreHeadersFeature.types'\nimport type { Column } from '../../types/Column'\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"coreHeadersFeature.utils.cjs","names":["getDefaultColumnPinningState","callMemoOrStaticFn","table_getVisibleLeafColumns","buildHeaderGroups","column_getIsVisible"],"sources":["../../../src/core/headers/coreHeadersFeature.utils.ts"],"sourcesContent":["import { getDefaultColumnPinningState } from '../../features/column-pinning/columnPinningFeature.utils'\nimport {\n column_getIsVisible,\n table_getVisibleLeafColumns,\n} from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { callMemoOrStaticFn } from '../../utils'\nimport { buildHeaderGroups } from './buildHeaderGroups'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Header } from '../../types/Header'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header_Header } from './coreHeadersFeature.types'\nimport type { Column } from '../../types/Column'\n\n/**\n * Walks a header tree and collects all descendant leaf headers.\n *\n * The header itself is included after its descendants, matching the recursive\n * shape used by nested header groups.\n *\n * @example\n * ```ts\n * const leafHeaders = header_getLeafHeaders(header)\n * ```\n */\nexport function header_getLeafHeaders<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue,\n>(header: Header<TFeatures, TData, TValue>) {\n const leafHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n const recurseHeader = (h: Header_Header<TFeatures, TData, TValue>) => {\n if (h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header<TFeatures, TData, TValue>)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n}\n\n/**\n * Builds the render context passed to a column's `header` or `footer` template.\n *\n * The context contains the header, its column, and the owning table instance.\n *\n * @example\n * ```ts\n * const context = header_getContext(header)\n * ```\n */\nexport function header_getContext<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue,\n>(header: Header<TFeatures, TData, TValue>) {\n return {\n column: header.column,\n header,\n table: header.column.table,\n }\n}\n\n/**\n * Builds visible header groups for the current column tree.\n *\n * Column visibility and pinning are applied before groups are built. When no\n * columns are pinned, the fast path skips pin partitioning.\n *\n * @example\n * ```ts\n * const headerGroups = table_getHeaderGroups(table)\n * ```\n */\nexport function table_getHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const { left, right } =\n table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()\n const allColumns = table.getAllColumns()\n const leafColumns = callMemoOrStaticFn(\n table,\n 'getVisibleLeafColumns',\n table_getVisibleLeafColumns,\n ) as Array<Column<TFeatures, TData, unknown>>\n\n // Fast path: no columns are pinned — skip per-side lookups, partition, and spread.\n if (!left.length && !right.length) {\n return buildHeaderGroups(allColumns, leafColumns, table)\n }\n\n const leafColumnsById = table.getAllLeafColumnsById()\n\n const leftColumns: typeof leafColumns = []\n for (let i = 0; i < left.length; i++) {\n const column = leafColumnsById[left[i]!]\n if (\n column &&\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)\n ) {\n leftColumns.push(column)\n }\n }\n\n const rightColumns: typeof leafColumns = []\n for (let i = 0; i < right.length; i++) {\n const column = leafColumnsById[right[i]!]\n if (\n column &&\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)\n ) {\n rightColumns.push(column)\n }\n }\n\n const centerColumns = leafColumns.filter(\n (column) => !left.includes(column.id) && !right.includes(column.id),\n )\n\n return buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table,\n )\n}\n\n/**\n * Builds footer groups by reversing the current header groups.\n *\n * Footer rendering uses the same header objects and grouping structure, but\n * renders them from leaf level back toward the root.\n *\n * @example\n * ```ts\n * const footerGroups = table_getFooterGroups(table)\n * ```\n */\nexport function table_getFooterGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const headerGroups = table.getHeaderGroups()\n return [...headerGroups].reverse()\n}\n\n/**\n * Flattens every header from every header group into one array.\n *\n * The result includes parent headers and placeholder headers, in header-group\n * order from top to bottom.\n *\n * @example\n * ```ts\n * const flatHeaders = table_getFlatHeaders(table)\n * ```\n */\nexport function table_getFlatHeaders<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const headerGroups = table.getHeaderGroups()\n const result: Array<Header<TFeatures, TData, unknown>> = []\n for (let i = 0; i < headerGroups.length; i++) {\n const headers = headerGroups[i]!.headers\n for (let j = 0; j < headers.length; j++) {\n result.push(headers[j]!)\n }\n }\n return result\n}\n\n/**\n * Collects only the leaf headers from the current header tree.\n *\n * Parent/group headers are skipped, making the result suitable for rendering\n * one header per visible leaf column.\n *\n * @example\n * ```ts\n * const leafHeaders = table_getLeafHeaders(table)\n * ```\n */\nexport function table_getLeafHeaders<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const topHeaders = table.getHeaderGroups()[0]?.headers ?? []\n const result: Array<Header<TFeatures, TData, unknown>> = []\n for (let i = 0; i < topHeaders.length; i++) {\n const leafHeaders = topHeaders[i]!.getLeafHeaders()\n for (let j = 0; j < leafHeaders.length; j++) {\n result.push(leafHeaders[j]!)\n }\n }\n return result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,SAAgB,sBAId,QAA0C;CAC1C,MAAM,cAAuD,EAAE;CAE/D,MAAM,iBAAiB,MAA+C;EACpE,IAAI,EAAE,WAAW,QACf,EAAE,WAAW,IAAI,cAAc;EAEjC,YAAY,KAAK,EAAsC;;CAGzD,cAAc,OAAO;CAErB,OAAO;;;;;;;;;;;;AAaT,SAAgB,kBAId,QAA0C;CAC1C,OAAO;EACL,QAAQ,OAAO;EACf;EACA,OAAO,OAAO,OAAO;EACtB;;;;;;;;;;;;;AAcH,SAAgB,sBAGd,OAAyC;;CACzC,MAAM,EAAE,MAAM,oCACZ,MAAM,MAAM,6FAAe,KAAK,KAAIA,iEAA8B;CACpE,MAAM,aAAa,MAAM,eAAe;CACxC,MAAM,cAAcC,iCAClB,OACA,yBACAC,kEACD;CAGD,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM,QACzB,OAAOC,4CAAkB,YAAY,aAAa,MAAM;CAG1D,MAAM,kBAAkB,MAAM,uBAAuB;CAErD,MAAM,cAAkC,EAAE;CAC1C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,SAAS,gBAAgB,KAAK;EACpC,IACE,UACAF,iCAAmB,QAAQ,gBAAgBG,0DAAoB,EAE/D,YAAY,KAAK,OAAO;;CAI5B,MAAM,eAAmC,EAAE;CAC3C,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,SAAS,gBAAgB,MAAM;EACrC,IACE,UACAH,iCAAmB,QAAQ,gBAAgBG,0DAAoB,EAE/D,aAAa,KAAK,OAAO;;CAI7B,MAAM,gBAAgB,YAAY,QAC/B,WAAW,CAAC,KAAK,SAAS,OAAO,GAAG,IAAI,CAAC,MAAM,SAAS,OAAO,GAAG,CACpE;CAED,OAAOD,4CACL,YACA;EAAC,GAAG;EAAa,GAAG;EAAe,GAAG;EAAa,EACnD,MACD;;;;;;;;;;;;;AAcH,SAAgB,sBAGd,OAAyC;CAEzC,OAAO,CAAC,GADa,MAAM,iBACJ,CAAC,CAAC,SAAS;;;;;;;;;;;;;AAcpC,SAAgB,qBAGd,OAAyC;CACzC,MAAM,eAAe,MAAM,iBAAiB;CAC5C,MAAM,SAAmD,EAAE;CAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;EAC5C,MAAM,UAAU,aAAa,GAAI;EACjC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAClC,OAAO,KAAK,QAAQ,GAAI;;CAG5B,OAAO;;;;;;;;;;;;;AAcT,SAAgB,qBAGd,OAAyC;;CACzC,MAAM,uCAAa,MAAM,iBAAiB,CAAC,kFAAI,YAAW,EAAE;CAC5D,MAAM,SAAmD,EAAE;CAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EAC1C,MAAM,cAAc,WAAW,GAAI,gBAAgB;EACnD,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KACtC,OAAO,KAAK,YAAY,GAAI;;CAGhC,OAAO"}
|
|
@@ -6,24 +6,25 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
6
6
|
import { Table_Internal } from "../../types/Table.cjs";
|
|
7
7
|
//#region src/core/headers/coreHeadersFeature.utils.d.ts
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Walks a header tree and collects all descendant leaf headers.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* The header itself is included after its descendants, matching the recursive
|
|
12
|
+
* shape used by nested header groups.
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
14
15
|
* ```ts
|
|
15
|
-
* const
|
|
16
|
+
* const leafHeaders = header_getLeafHeaders(header)
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
19
|
declare function header_getLeafHeaders<TFeatures extends TableFeatures, TData extends RowData, TValue>(header: Header<TFeatures, TData, TValue>): Header<TFeatures, TData, TValue>[];
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Builds the render context passed to a column's `header` or `footer` template.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
+
* The context contains the header, its column, and the owning table instance.
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* ```ts
|
|
26
|
-
* const
|
|
27
|
+
* const context = header_getContext(header)
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
29
30
|
declare function header_getContext<TFeatures extends TableFeatures, TData extends RowData, TValue>(header: Header<TFeatures, TData, TValue>): {
|
|
@@ -32,46 +33,50 @@ declare function header_getContext<TFeatures extends TableFeatures, TData extend
|
|
|
32
33
|
table: Table_Internal<TFeatures, TData>;
|
|
33
34
|
};
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
+
* Builds visible header groups for the current column tree.
|
|
36
37
|
*
|
|
37
|
-
*
|
|
38
|
+
* Column visibility and pinning are applied before groups are built. When no
|
|
39
|
+
* columns are pinned, the fast path skips pin partitioning.
|
|
38
40
|
*
|
|
39
41
|
* @example
|
|
40
42
|
* ```ts
|
|
41
|
-
* const
|
|
43
|
+
* const headerGroups = table_getHeaderGroups(table)
|
|
42
44
|
* ```
|
|
43
45
|
*/
|
|
44
46
|
declare function table_getHeaderGroups<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): HeaderGroup<TFeatures, TData>[];
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
48
|
+
* Builds footer groups by reversing the current header groups.
|
|
47
49
|
*
|
|
48
|
-
*
|
|
50
|
+
* Footer rendering uses the same header objects and grouping structure, but
|
|
51
|
+
* renders them from leaf level back toward the root.
|
|
49
52
|
*
|
|
50
53
|
* @example
|
|
51
54
|
* ```ts
|
|
52
|
-
* const
|
|
55
|
+
* const footerGroups = table_getFooterGroups(table)
|
|
53
56
|
* ```
|
|
54
57
|
*/
|
|
55
58
|
declare function table_getFooterGroups<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): HeaderGroup<TFeatures, TData>[];
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
60
|
+
* Flattens every header from every header group into one array.
|
|
58
61
|
*
|
|
59
|
-
*
|
|
62
|
+
* The result includes parent headers and placeholder headers, in header-group
|
|
63
|
+
* order from top to bottom.
|
|
60
64
|
*
|
|
61
65
|
* @example
|
|
62
66
|
* ```ts
|
|
63
|
-
* const
|
|
67
|
+
* const flatHeaders = table_getFlatHeaders(table)
|
|
64
68
|
* ```
|
|
65
69
|
*/
|
|
66
70
|
declare function table_getFlatHeaders<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Header<TFeatures, TData, unknown>[];
|
|
67
71
|
/**
|
|
68
|
-
*
|
|
72
|
+
* Collects only the leaf headers from the current header tree.
|
|
69
73
|
*
|
|
70
|
-
*
|
|
74
|
+
* Parent/group headers are skipped, making the result suitable for rendering
|
|
75
|
+
* one header per visible leaf column.
|
|
71
76
|
*
|
|
72
77
|
* @example
|
|
73
78
|
* ```ts
|
|
74
|
-
* const
|
|
79
|
+
* const leafHeaders = table_getLeafHeaders(table)
|
|
75
80
|
* ```
|
|
76
81
|
*/
|
|
77
82
|
declare function table_getLeafHeaders<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Header<TFeatures, TData, unknown>[];
|
|
@@ -6,24 +6,25 @@ import { TableFeatures } from "../../types/TableFeatures.js";
|
|
|
6
6
|
import { Table_Internal } from "../../types/Table.js";
|
|
7
7
|
//#region src/core/headers/coreHeadersFeature.utils.d.ts
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Walks a header tree and collects all descendant leaf headers.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* The header itself is included after its descendants, matching the recursive
|
|
12
|
+
* shape used by nested header groups.
|
|
12
13
|
*
|
|
13
14
|
* @example
|
|
14
15
|
* ```ts
|
|
15
|
-
* const
|
|
16
|
+
* const leafHeaders = header_getLeafHeaders(header)
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
19
|
declare function header_getLeafHeaders<TFeatures extends TableFeatures, TData extends RowData, TValue>(header: Header<TFeatures, TData, TValue>): Header<TFeatures, TData, TValue>[];
|
|
19
20
|
/**
|
|
20
|
-
*
|
|
21
|
+
* Builds the render context passed to a column's `header` or `footer` template.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
+
* The context contains the header, its column, and the owning table instance.
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* ```ts
|
|
26
|
-
* const
|
|
27
|
+
* const context = header_getContext(header)
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
29
30
|
declare function header_getContext<TFeatures extends TableFeatures, TData extends RowData, TValue>(header: Header<TFeatures, TData, TValue>): {
|
|
@@ -32,46 +33,50 @@ declare function header_getContext<TFeatures extends TableFeatures, TData extend
|
|
|
32
33
|
table: Table_Internal<TFeatures, TData>;
|
|
33
34
|
};
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
+
* Builds visible header groups for the current column tree.
|
|
36
37
|
*
|
|
37
|
-
*
|
|
38
|
+
* Column visibility and pinning are applied before groups are built. When no
|
|
39
|
+
* columns are pinned, the fast path skips pin partitioning.
|
|
38
40
|
*
|
|
39
41
|
* @example
|
|
40
42
|
* ```ts
|
|
41
|
-
* const
|
|
43
|
+
* const headerGroups = table_getHeaderGroups(table)
|
|
42
44
|
* ```
|
|
43
45
|
*/
|
|
44
46
|
declare function table_getHeaderGroups<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): HeaderGroup<TFeatures, TData>[];
|
|
45
47
|
/**
|
|
46
|
-
*
|
|
48
|
+
* Builds footer groups by reversing the current header groups.
|
|
47
49
|
*
|
|
48
|
-
*
|
|
50
|
+
* Footer rendering uses the same header objects and grouping structure, but
|
|
51
|
+
* renders them from leaf level back toward the root.
|
|
49
52
|
*
|
|
50
53
|
* @example
|
|
51
54
|
* ```ts
|
|
52
|
-
* const
|
|
55
|
+
* const footerGroups = table_getFooterGroups(table)
|
|
53
56
|
* ```
|
|
54
57
|
*/
|
|
55
58
|
declare function table_getFooterGroups<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): HeaderGroup<TFeatures, TData>[];
|
|
56
59
|
/**
|
|
57
|
-
*
|
|
60
|
+
* Flattens every header from every header group into one array.
|
|
58
61
|
*
|
|
59
|
-
*
|
|
62
|
+
* The result includes parent headers and placeholder headers, in header-group
|
|
63
|
+
* order from top to bottom.
|
|
60
64
|
*
|
|
61
65
|
* @example
|
|
62
66
|
* ```ts
|
|
63
|
-
* const
|
|
67
|
+
* const flatHeaders = table_getFlatHeaders(table)
|
|
64
68
|
* ```
|
|
65
69
|
*/
|
|
66
70
|
declare function table_getFlatHeaders<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Header<TFeatures, TData, unknown>[];
|
|
67
71
|
/**
|
|
68
|
-
*
|
|
72
|
+
* Collects only the leaf headers from the current header tree.
|
|
69
73
|
*
|
|
70
|
-
*
|
|
74
|
+
* Parent/group headers are skipped, making the result suitable for rendering
|
|
75
|
+
* one header per visible leaf column.
|
|
71
76
|
*
|
|
72
77
|
* @example
|
|
73
78
|
* ```ts
|
|
74
|
-
* const
|
|
79
|
+
* const leafHeaders = table_getLeafHeaders(table)
|
|
75
80
|
* ```
|
|
76
81
|
*/
|
|
77
82
|
declare function table_getLeafHeaders<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): Header<TFeatures, TData, unknown>[];
|
|
@@ -5,13 +5,14 @@ import { getDefaultColumnPinningState } from "../../features/column-pinning/colu
|
|
|
5
5
|
|
|
6
6
|
//#region src/core/headers/coreHeadersFeature.utils.ts
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Walks a header tree and collects all descendant leaf headers.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* The header itself is included after its descendants, matching the recursive
|
|
11
|
+
* shape used by nested header groups.
|
|
11
12
|
*
|
|
12
13
|
* @example
|
|
13
14
|
* ```ts
|
|
14
|
-
* const
|
|
15
|
+
* const leafHeaders = header_getLeafHeaders(header)
|
|
15
16
|
* ```
|
|
16
17
|
*/
|
|
17
18
|
function header_getLeafHeaders(header) {
|
|
@@ -24,13 +25,13 @@ function header_getLeafHeaders(header) {
|
|
|
24
25
|
return leafHeaders;
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
+
* Builds the render context passed to a column's `header` or `footer` template.
|
|
28
29
|
*
|
|
29
|
-
*
|
|
30
|
+
* The context contains the header, its column, and the owning table instance.
|
|
30
31
|
*
|
|
31
32
|
* @example
|
|
32
33
|
* ```ts
|
|
33
|
-
* const
|
|
34
|
+
* const context = header_getContext(header)
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
36
37
|
function header_getContext(header) {
|
|
@@ -41,13 +42,14 @@ function header_getContext(header) {
|
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* Builds visible header groups for the current column tree.
|
|
45
46
|
*
|
|
46
|
-
*
|
|
47
|
+
* Column visibility and pinning are applied before groups are built. When no
|
|
48
|
+
* columns are pinned, the fast path skips pin partitioning.
|
|
47
49
|
*
|
|
48
50
|
* @example
|
|
49
51
|
* ```ts
|
|
50
|
-
* const
|
|
52
|
+
* const headerGroups = table_getHeaderGroups(table)
|
|
51
53
|
* ```
|
|
52
54
|
*/
|
|
53
55
|
function table_getHeaderGroups(table) {
|
|
@@ -75,26 +77,28 @@ function table_getHeaderGroups(table) {
|
|
|
75
77
|
], table);
|
|
76
78
|
}
|
|
77
79
|
/**
|
|
78
|
-
*
|
|
80
|
+
* Builds footer groups by reversing the current header groups.
|
|
79
81
|
*
|
|
80
|
-
*
|
|
82
|
+
* Footer rendering uses the same header objects and grouping structure, but
|
|
83
|
+
* renders them from leaf level back toward the root.
|
|
81
84
|
*
|
|
82
85
|
* @example
|
|
83
86
|
* ```ts
|
|
84
|
-
* const
|
|
87
|
+
* const footerGroups = table_getFooterGroups(table)
|
|
85
88
|
* ```
|
|
86
89
|
*/
|
|
87
90
|
function table_getFooterGroups(table) {
|
|
88
91
|
return [...table.getHeaderGroups()].reverse();
|
|
89
92
|
}
|
|
90
93
|
/**
|
|
91
|
-
*
|
|
94
|
+
* Flattens every header from every header group into one array.
|
|
92
95
|
*
|
|
93
|
-
*
|
|
96
|
+
* The result includes parent headers and placeholder headers, in header-group
|
|
97
|
+
* order from top to bottom.
|
|
94
98
|
*
|
|
95
99
|
* @example
|
|
96
100
|
* ```ts
|
|
97
|
-
* const
|
|
101
|
+
* const flatHeaders = table_getFlatHeaders(table)
|
|
98
102
|
* ```
|
|
99
103
|
*/
|
|
100
104
|
function table_getFlatHeaders(table) {
|
|
@@ -107,13 +111,14 @@ function table_getFlatHeaders(table) {
|
|
|
107
111
|
return result;
|
|
108
112
|
}
|
|
109
113
|
/**
|
|
110
|
-
*
|
|
114
|
+
* Collects only the leaf headers from the current header tree.
|
|
111
115
|
*
|
|
112
|
-
*
|
|
116
|
+
* Parent/group headers are skipped, making the result suitable for rendering
|
|
117
|
+
* one header per visible leaf column.
|
|
113
118
|
*
|
|
114
119
|
* @example
|
|
115
120
|
* ```ts
|
|
116
|
-
* const
|
|
121
|
+
* const leafHeaders = table_getLeafHeaders(table)
|
|
117
122
|
* ```
|
|
118
123
|
*/
|
|
119
124
|
function table_getLeafHeaders(table) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreHeadersFeature.utils.js","names":[],"sources":["../../../src/core/headers/coreHeadersFeature.utils.ts"],"sourcesContent":["import { getDefaultColumnPinningState } from '../../features/column-pinning/columnPinningFeature.utils'\nimport {\n column_getIsVisible,\n table_getVisibleLeafColumns,\n} from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { callMemoOrStaticFn } from '../../utils'\nimport { buildHeaderGroups } from './buildHeaderGroups'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Header } from '../../types/Header'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header_Header } from './coreHeadersFeature.types'\nimport type { Column } from '../../types/Column'\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"coreHeadersFeature.utils.js","names":[],"sources":["../../../src/core/headers/coreHeadersFeature.utils.ts"],"sourcesContent":["import { getDefaultColumnPinningState } from '../../features/column-pinning/columnPinningFeature.utils'\nimport {\n column_getIsVisible,\n table_getVisibleLeafColumns,\n} from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { callMemoOrStaticFn } from '../../utils'\nimport { buildHeaderGroups } from './buildHeaderGroups'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Header } from '../../types/Header'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header_Header } from './coreHeadersFeature.types'\nimport type { Column } from '../../types/Column'\n\n/**\n * Walks a header tree and collects all descendant leaf headers.\n *\n * The header itself is included after its descendants, matching the recursive\n * shape used by nested header groups.\n *\n * @example\n * ```ts\n * const leafHeaders = header_getLeafHeaders(header)\n * ```\n */\nexport function header_getLeafHeaders<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue,\n>(header: Header<TFeatures, TData, TValue>) {\n const leafHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n const recurseHeader = (h: Header_Header<TFeatures, TData, TValue>) => {\n if (h.subHeaders.length) {\n h.subHeaders.map(recurseHeader)\n }\n leafHeaders.push(h as Header<TFeatures, TData, TValue>)\n }\n\n recurseHeader(header)\n\n return leafHeaders\n}\n\n/**\n * Builds the render context passed to a column's `header` or `footer` template.\n *\n * The context contains the header, its column, and the owning table instance.\n *\n * @example\n * ```ts\n * const context = header_getContext(header)\n * ```\n */\nexport function header_getContext<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue,\n>(header: Header<TFeatures, TData, TValue>) {\n return {\n column: header.column,\n header,\n table: header.column.table,\n }\n}\n\n/**\n * Builds visible header groups for the current column tree.\n *\n * Column visibility and pinning are applied before groups are built. When no\n * columns are pinned, the fast path skips pin partitioning.\n *\n * @example\n * ```ts\n * const headerGroups = table_getHeaderGroups(table)\n * ```\n */\nexport function table_getHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const { left, right } =\n table.atoms.columnPinning?.get() ?? getDefaultColumnPinningState()\n const allColumns = table.getAllColumns()\n const leafColumns = callMemoOrStaticFn(\n table,\n 'getVisibleLeafColumns',\n table_getVisibleLeafColumns,\n ) as Array<Column<TFeatures, TData, unknown>>\n\n // Fast path: no columns are pinned — skip per-side lookups, partition, and spread.\n if (!left.length && !right.length) {\n return buildHeaderGroups(allColumns, leafColumns, table)\n }\n\n const leafColumnsById = table.getAllLeafColumnsById()\n\n const leftColumns: typeof leafColumns = []\n for (let i = 0; i < left.length; i++) {\n const column = leafColumnsById[left[i]!]\n if (\n column &&\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)\n ) {\n leftColumns.push(column)\n }\n }\n\n const rightColumns: typeof leafColumns = []\n for (let i = 0; i < right.length; i++) {\n const column = leafColumnsById[right[i]!]\n if (\n column &&\n callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)\n ) {\n rightColumns.push(column)\n }\n }\n\n const centerColumns = leafColumns.filter(\n (column) => !left.includes(column.id) && !right.includes(column.id),\n )\n\n return buildHeaderGroups(\n allColumns,\n [...leftColumns, ...centerColumns, ...rightColumns],\n table,\n )\n}\n\n/**\n * Builds footer groups by reversing the current header groups.\n *\n * Footer rendering uses the same header objects and grouping structure, but\n * renders them from leaf level back toward the root.\n *\n * @example\n * ```ts\n * const footerGroups = table_getFooterGroups(table)\n * ```\n */\nexport function table_getFooterGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const headerGroups = table.getHeaderGroups()\n return [...headerGroups].reverse()\n}\n\n/**\n * Flattens every header from every header group into one array.\n *\n * The result includes parent headers and placeholder headers, in header-group\n * order from top to bottom.\n *\n * @example\n * ```ts\n * const flatHeaders = table_getFlatHeaders(table)\n * ```\n */\nexport function table_getFlatHeaders<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const headerGroups = table.getHeaderGroups()\n const result: Array<Header<TFeatures, TData, unknown>> = []\n for (let i = 0; i < headerGroups.length; i++) {\n const headers = headerGroups[i]!.headers\n for (let j = 0; j < headers.length; j++) {\n result.push(headers[j]!)\n }\n }\n return result\n}\n\n/**\n * Collects only the leaf headers from the current header tree.\n *\n * Parent/group headers are skipped, making the result suitable for rendering\n * one header per visible leaf column.\n *\n * @example\n * ```ts\n * const leafHeaders = table_getLeafHeaders(table)\n * ```\n */\nexport function table_getLeafHeaders<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>) {\n const topHeaders = table.getHeaderGroups()[0]?.headers ?? []\n const result: Array<Header<TFeatures, TData, unknown>> = []\n for (let i = 0; i < topHeaders.length; i++) {\n const leafHeaders = topHeaders[i]!.getLeafHeaders()\n for (let j = 0; j < leafHeaders.length; j++) {\n result.push(leafHeaders[j]!)\n }\n }\n return result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,SAAgB,sBAId,QAA0C;CAC1C,MAAM,cAAuD,EAAE;CAE/D,MAAM,iBAAiB,MAA+C;EACpE,IAAI,EAAE,WAAW,QACf,EAAE,WAAW,IAAI,cAAc;EAEjC,YAAY,KAAK,EAAsC;;CAGzD,cAAc,OAAO;CAErB,OAAO;;;;;;;;;;;;AAaT,SAAgB,kBAId,QAA0C;CAC1C,OAAO;EACL,QAAQ,OAAO;EACf;EACA,OAAO,OAAO,OAAO;EACtB;;;;;;;;;;;;;AAcH,SAAgB,sBAGd,OAAyC;;CACzC,MAAM,EAAE,MAAM,oCACZ,MAAM,MAAM,6FAAe,KAAK,KAAI,8BAA8B;CACpE,MAAM,aAAa,MAAM,eAAe;CACxC,MAAM,cAAc,mBAClB,OACA,yBACA,4BACD;CAGD,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM,QACzB,OAAO,kBAAkB,YAAY,aAAa,MAAM;CAG1D,MAAM,kBAAkB,MAAM,uBAAuB;CAErD,MAAM,cAAkC,EAAE;CAC1C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACpC,MAAM,SAAS,gBAAgB,KAAK;EACpC,IACE,UACA,mBAAmB,QAAQ,gBAAgB,oBAAoB,EAE/D,YAAY,KAAK,OAAO;;CAI5B,MAAM,eAAmC,EAAE;CAC3C,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,SAAS,gBAAgB,MAAM;EACrC,IACE,UACA,mBAAmB,QAAQ,gBAAgB,oBAAoB,EAE/D,aAAa,KAAK,OAAO;;CAI7B,MAAM,gBAAgB,YAAY,QAC/B,WAAW,CAAC,KAAK,SAAS,OAAO,GAAG,IAAI,CAAC,MAAM,SAAS,OAAO,GAAG,CACpE;CAED,OAAO,kBACL,YACA;EAAC,GAAG;EAAa,GAAG;EAAe,GAAG;EAAa,EACnD,MACD;;;;;;;;;;;;;AAcH,SAAgB,sBAGd,OAAyC;CAEzC,OAAO,CAAC,GADa,MAAM,iBACJ,CAAC,CAAC,SAAS;;;;;;;;;;;;;AAcpC,SAAgB,qBAGd,OAAyC;CACzC,MAAM,eAAe,MAAM,iBAAiB;CAC5C,MAAM,SAAmD,EAAE;CAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;EAC5C,MAAM,UAAU,aAAa,GAAI;EACjC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAClC,OAAO,KAAK,QAAQ,GAAI;;CAG5B,OAAO;;;;;;;;;;;;;AAcT,SAAgB,qBAGd,OAAyC;;CACzC,MAAM,uCAAa,MAAM,iBAAiB,CAAC,kFAAI,YAAW,EAAE;CAC5D,MAAM,SAAmD,EAAE;CAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;EAC1C,MAAM,cAAc,WAAW,GAAI,gBAAgB;EACnD,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KACtC,OAAO,KAAK,YAAY,GAAI;;CAGhC,OAAO"}
|