@tanstack/table-core 9.0.0-alpha.46 → 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/constructCell.cjs +4 -3
- package/dist/core/cells/constructCell.cjs.map +1 -1
- package/dist/core/cells/constructCell.js +4 -3
- package/dist/core/cells/constructCell.js.map +1 -1
- 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/constructColumn.cjs +6 -4
- package/dist/core/columns/constructColumn.cjs.map +1 -1
- package/dist/core/columns/constructColumn.js +6 -4
- package/dist/core/columns/constructColumn.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 +47 -29
- 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 +47 -29
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs +27 -19
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.js +27 -19
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/constructHeader.cjs +4 -3
- package/dist/core/headers/constructHeader.cjs.map +1 -1
- package/dist/core/headers/constructHeader.js +4 -3
- package/dist/core/headers/constructHeader.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.cjs +1 -6
- package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.js +2 -7
- package/dist/core/headers/coreHeadersFeature.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 +43 -36
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +24 -19
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +24 -19
- package/dist/core/headers/coreHeadersFeature.utils.js +44 -37
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/reactivity/coreReactivityFeature.types.d.cts +4 -0
- package/dist/core/reactivity/coreReactivityFeature.types.d.ts +4 -0
- 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/constructRow.cjs +8 -6
- package/dist/core/rows/constructRow.cjs.map +1 -1
- package/dist/core/rows/constructRow.js +8 -6
- package/dist/core/rows/constructRow.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 +43 -32
- 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 +43 -32
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/constructTable.cjs +9 -5
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.js +9 -5
- package/dist/core/table/constructTable.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 +7 -3
- 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 +7 -3
- 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-faceting/createFacetedMinMaxValues.cjs +8 -5
- package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.js +8 -5
- package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs +8 -3
- package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.js +8 -3
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs +7 -4
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.js +7 -4
- package/dist/features/column-faceting/createFacetedUniqueValues.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-filtering/createFilteredRowModel.cjs +11 -5
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.js +11 -5
- package/dist/features/column-filtering/createFilteredRowModel.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 +46 -29
- 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 +46 -29
- 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 +152 -115
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +116 -95
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +116 -95
- package/dist/features/column-pinning/columnPinningFeature.utils.js +153 -116
- 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.cjs +28 -4
- package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.js +28 -4
- package/dist/features/column-sizing/columnSizingFeature.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.cjs +23 -14
- package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.js +24 -15
- package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +19 -12
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +19 -12
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +91 -52
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +63 -40
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +63 -40
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +91 -53
- 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 +58 -43
- 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 +58 -43
- 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 +52 -36
- 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 +52 -36
- 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 +95 -72
- 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 +95 -72
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +13 -8
- package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.js +13 -8
- package/dist/features/row-sorting/createSortedRowModel.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 +63 -46
- 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 +63 -46
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/fns/aggregationFns.cjs +47 -16
- 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 +47 -17
- 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/index.cjs +0 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/static-functions.cjs +1 -0
- package/dist/static-functions.d.cts +2 -2
- package/dist/static-functions.d.ts +2 -2
- package/dist/static-functions.js +2 -2
- package/dist/store-reactivity-bindings.cjs +1 -0
- package/dist/store-reactivity-bindings.cjs.map +1 -1
- package/dist/store-reactivity-bindings.js +1 -0
- package/dist/store-reactivity-bindings.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/dist/utils.cjs +18 -39
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -23
- package/dist/utils.d.ts +1 -23
- package/dist/utils.js +19 -36
- package/dist/utils.js.map +1 -1
- 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/constructCell.ts +3 -2
- package/src/core/cells/coreCellsFeature.utils.ts +11 -8
- package/src/core/columns/constructColumn.ts +5 -3
- package/src/core/columns/coreColumnsFeature.types.ts +7 -6
- package/src/core/columns/coreColumnsFeature.utils.ts +43 -29
- package/src/core/headers/buildHeaderGroups.ts +29 -30
- package/src/core/headers/constructHeader.ts +3 -2
- package/src/core/headers/coreHeadersFeature.ts +2 -27
- package/src/core/headers/coreHeadersFeature.types.ts +6 -4
- package/src/core/headers/coreHeadersFeature.utils.ts +52 -61
- package/src/core/reactivity/coreReactivityFeature.types.ts +4 -0
- package/src/core/row-models/coreRowModelsFeature.utils.ts +48 -36
- package/src/core/rows/constructRow.ts +6 -4
- package/src/core/rows/coreRowsFeature.types.ts +4 -4
- package/src/core/rows/coreRowsFeature.utils.ts +45 -32
- package/src/core/table/constructTable.ts +6 -4
- package/src/core/table/coreTablesFeature.types.ts +6 -2
- package/src/core/table/coreTablesFeature.utils.ts +5 -3
- package/src/features/column-faceting/columnFacetingFeature.types.ts +16 -10
- package/src/features/column-faceting/columnFacetingFeature.utils.ts +26 -18
- package/src/features/column-faceting/createFacetedMinMaxValues.ts +8 -10
- package/src/features/column-faceting/createFacetedRowModel.ts +10 -6
- package/src/features/column-faceting/createFacetedUniqueValues.ts +4 -3
- package/src/features/column-filtering/columnFilteringFeature.types.ts +21 -11
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +39 -28
- package/src/features/column-filtering/createFilteredRowModel.ts +14 -8
- 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 +44 -29
- package/src/features/column-pinning/columnPinningFeature.types.ts +43 -31
- package/src/features/column-pinning/columnPinningFeature.utils.ts +164 -128
- 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.ts +16 -0
- 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.ts +8 -0
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +22 -12
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +101 -56
- 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 +58 -43
- 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 +59 -47
- package/src/features/row-selection/rowSelectionFeature.types.ts +30 -24
- package/src/features/row-selection/rowSelectionFeature.utils.ts +109 -88
- package/src/features/row-sorting/createSortedRowModel.ts +16 -13
- package/src/features/row-sorting/rowSortingFeature.types.ts +10 -8
- package/src/features/row-sorting/rowSortingFeature.utils.ts +63 -46
- package/src/fns/aggregationFns.ts +53 -17
- package/src/fns/filterFns.ts +48 -17
- package/src/helpers/columnHelper.ts +9 -4
- package/src/helpers/tableOptions.ts +12 -9
- package/src/store-reactivity-bindings.ts +1 -0
- package/src/types/ColumnDef.ts +38 -0
- package/src/types/TableOptions.ts +15 -0
- package/src/types/TableState.ts +12 -0
- package/src/utils.ts +19 -46
|
@@ -12,13 +12,14 @@ import type {
|
|
|
12
12
|
import type { Column } from '../../types/Column'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Flattens this column and every descendant column into a single array.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* Group columns appear before their child columns, which matches the normalized
|
|
18
|
+
* column hierarchy produced during table construction.
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
21
|
* ```ts
|
|
21
|
-
* const
|
|
22
|
+
* const flatColumns = column_getFlatColumns(column)
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
25
|
export function column_getFlatColumns<
|
|
@@ -32,13 +33,14 @@ export function column_getFlatColumns<
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
+
* Collects the terminal leaf columns below this column.
|
|
36
37
|
*
|
|
37
|
-
*
|
|
38
|
+
* Group columns return their ordered descendants. Non-group columns return an
|
|
39
|
+
* array containing only the column itself.
|
|
38
40
|
*
|
|
39
41
|
* @example
|
|
40
42
|
* ```ts
|
|
41
|
-
* const
|
|
43
|
+
* const leafColumns = column_getLeafColumns(column)
|
|
42
44
|
* ```
|
|
43
45
|
*/
|
|
44
46
|
export function column_getLeafColumns<
|
|
@@ -64,13 +66,15 @@ export function column_getLeafColumns<
|
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
/**
|
|
67
|
-
*
|
|
69
|
+
* Merges built-in, feature, and user default column definitions.
|
|
68
70
|
*
|
|
69
|
-
*
|
|
71
|
+
* Built-in defaults provide a header and fallback cell renderer, feature
|
|
72
|
+
* defaults can add feature-specific column options, and
|
|
73
|
+
* `options.defaultColumn` wins last.
|
|
70
74
|
*
|
|
71
75
|
* @example
|
|
72
76
|
* ```ts
|
|
73
|
-
* const
|
|
77
|
+
* const defaultColumn = table_getDefaultColumnDef(table)
|
|
74
78
|
* ```
|
|
75
79
|
*/
|
|
76
80
|
export function table_getDefaultColumnDef<
|
|
@@ -103,13 +107,14 @@ export function table_getDefaultColumnDef<
|
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
/**
|
|
106
|
-
*
|
|
110
|
+
* Normalizes `options.columns` into the table's nested column tree.
|
|
107
111
|
*
|
|
108
|
-
*
|
|
112
|
+
* Each column definition is constructed with its parent and depth, and group
|
|
113
|
+
* column children are recursively constructed.
|
|
109
114
|
*
|
|
110
115
|
* @example
|
|
111
116
|
* ```ts
|
|
112
|
-
* const
|
|
117
|
+
* const columns = table_getAllColumns(table)
|
|
113
118
|
* ```
|
|
114
119
|
*/
|
|
115
120
|
export function table_getAllColumns<
|
|
@@ -144,13 +149,14 @@ export function table_getAllColumns<
|
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
/**
|
|
147
|
-
*
|
|
152
|
+
* Flattens every table column, including group columns and leaf columns.
|
|
148
153
|
*
|
|
149
|
-
*
|
|
154
|
+
* Use this when parent/group columns must be included in addition to data leaf
|
|
155
|
+
* columns.
|
|
150
156
|
*
|
|
151
157
|
* @example
|
|
152
158
|
* ```ts
|
|
153
|
-
* const
|
|
159
|
+
* const flatColumns = table_getAllFlatColumns(table)
|
|
154
160
|
* ```
|
|
155
161
|
*/
|
|
156
162
|
export function table_getAllFlatColumns<
|
|
@@ -163,13 +169,14 @@ export function table_getAllFlatColumns<
|
|
|
163
169
|
}
|
|
164
170
|
|
|
165
171
|
/**
|
|
166
|
-
*
|
|
172
|
+
* Builds an id lookup for every flat column in the table.
|
|
167
173
|
*
|
|
168
|
-
*
|
|
174
|
+
* Group columns and leaf columns are included. Later columns with the same id
|
|
175
|
+
* replace earlier entries.
|
|
169
176
|
*
|
|
170
177
|
* @example
|
|
171
178
|
* ```ts
|
|
172
|
-
* const
|
|
179
|
+
* const columnsById = table_getAllFlatColumnsById(table)
|
|
173
180
|
* ```
|
|
174
181
|
*/
|
|
175
182
|
export function table_getAllFlatColumnsById<
|
|
@@ -179,20 +186,23 @@ export function table_getAllFlatColumnsById<
|
|
|
179
186
|
table: Table_Internal<TFeatures, TData>,
|
|
180
187
|
): Record<string, Column<TFeatures, TData, unknown>> {
|
|
181
188
|
const result: Record<string, Column<TFeatures, TData, unknown>> = {}
|
|
182
|
-
|
|
189
|
+
const flatColumns = table.getAllFlatColumns()
|
|
190
|
+
for (let i = 0; i < flatColumns.length; i++) {
|
|
191
|
+
const column = flatColumns[i]!
|
|
183
192
|
result[column.id] = column
|
|
184
193
|
}
|
|
185
194
|
return result
|
|
186
195
|
}
|
|
187
196
|
|
|
188
197
|
/**
|
|
189
|
-
*
|
|
198
|
+
* Collects all terminal leaf columns in their current table order.
|
|
190
199
|
*
|
|
191
|
-
*
|
|
200
|
+
* Column ordering features can reorder the collected leaves before the result
|
|
201
|
+
* is returned.
|
|
192
202
|
*
|
|
193
203
|
* @example
|
|
194
204
|
* ```ts
|
|
195
|
-
* const
|
|
205
|
+
* const leafColumns = table_getAllLeafColumns(table)
|
|
196
206
|
* ```
|
|
197
207
|
*/
|
|
198
208
|
export function table_getAllLeafColumns<
|
|
@@ -212,13 +222,14 @@ export function table_getAllLeafColumns<
|
|
|
212
222
|
}
|
|
213
223
|
|
|
214
224
|
/**
|
|
215
|
-
*
|
|
225
|
+
* Builds an id lookup for terminal leaf columns only.
|
|
216
226
|
*
|
|
217
|
-
*
|
|
227
|
+
* Parent/group columns are excluded, making this lookup appropriate for row
|
|
228
|
+
* cells and feature state keyed by data columns.
|
|
218
229
|
*
|
|
219
230
|
* @example
|
|
220
231
|
* ```ts
|
|
221
|
-
* const
|
|
232
|
+
* const leavesById = table_getAllLeafColumnsById(table)
|
|
222
233
|
* ```
|
|
223
234
|
*/
|
|
224
235
|
export function table_getAllLeafColumnsById<
|
|
@@ -228,20 +239,23 @@ export function table_getAllLeafColumnsById<
|
|
|
228
239
|
table: Table_Internal<TFeatures, TData>,
|
|
229
240
|
): Record<string, Column<TFeatures, TData, unknown>> {
|
|
230
241
|
const result: Record<string, Column<TFeatures, TData, unknown>> = {}
|
|
231
|
-
|
|
242
|
+
const leafColumns = table.getAllLeafColumns()
|
|
243
|
+
for (let i = 0; i < leafColumns.length; i++) {
|
|
244
|
+
const column = leafColumns[i]!
|
|
232
245
|
result[column.id] = column
|
|
233
246
|
}
|
|
234
247
|
return result
|
|
235
248
|
}
|
|
236
249
|
|
|
237
250
|
/**
|
|
238
|
-
*
|
|
251
|
+
* Looks up a column by id from the flat column map.
|
|
239
252
|
*
|
|
240
|
-
*
|
|
253
|
+
* The lookup can return group columns or leaf columns. In development, a
|
|
254
|
+
* missing id logs a warning to help catch stale column references.
|
|
241
255
|
*
|
|
242
256
|
* @example
|
|
243
257
|
* ```ts
|
|
244
|
-
* const
|
|
258
|
+
* const column = table_getColumn(table, 'firstName')
|
|
245
259
|
* ```
|
|
246
260
|
*/
|
|
247
261
|
export function table_getColumn<
|
|
@@ -37,15 +37,14 @@ export function buildHeaderGroups<
|
|
|
37
37
|
) => {
|
|
38
38
|
maxDepth = Math.max(maxDepth, depth)
|
|
39
39
|
|
|
40
|
-
columns
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
)
|
|
44
|
-
.forEach((column) => {
|
|
40
|
+
for (let i = 0; i < columns.length; i++) {
|
|
41
|
+
const column = columns[i]!
|
|
42
|
+
if (callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)) {
|
|
45
43
|
if (column.columns.length) {
|
|
46
44
|
findMaxDepth(column.columns, depth + 1)
|
|
47
45
|
}
|
|
48
|
-
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
findMaxDepth(allColumns)
|
|
@@ -136,43 +135,43 @@ export function buildHeaderGroups<
|
|
|
136
135
|
|
|
137
136
|
headerGroups.reverse()
|
|
138
137
|
|
|
139
|
-
// headerGroups = headerGroups.filter(headerGroup => {
|
|
140
|
-
// return !headerGroup.headers.every(header => header.isPlaceholder)
|
|
141
|
-
// })
|
|
142
|
-
|
|
143
138
|
const recurseHeadersForSpans = (
|
|
144
139
|
headers: Array<Header<TFeatures, TData, TValue>>,
|
|
145
140
|
): Array<{ colSpan: number; rowSpan: number }> => {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
)
|
|
141
|
+
const results: Array<{ colSpan: number; rowSpan: number }> = []
|
|
142
|
+
|
|
143
|
+
for (let i = 0; i < headers.length; i++) {
|
|
144
|
+
const header = headers[i]!
|
|
145
|
+
if (
|
|
146
|
+
!callMemoOrStaticFn(header.column, 'getIsVisible', column_getIsVisible)
|
|
147
|
+
) {
|
|
148
|
+
continue
|
|
149
|
+
}
|
|
149
150
|
|
|
150
|
-
return filteredHeaders.map((header) => {
|
|
151
151
|
let colSpan = 0
|
|
152
|
-
let
|
|
153
|
-
let childRowSpans = [0]
|
|
152
|
+
let minChildRowSpan = Infinity
|
|
154
153
|
|
|
155
154
|
if (header.subHeaders.length) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
155
|
+
const childSpans = recurseHeadersForSpans(header.subHeaders)
|
|
156
|
+
for (let j = 0; j < childSpans.length; j++) {
|
|
157
|
+
const child = childSpans[j]!
|
|
158
|
+
colSpan += child.colSpan
|
|
159
|
+
if (child.rowSpan < minChildRowSpan) {
|
|
160
|
+
minChildRowSpan = child.rowSpan
|
|
161
|
+
}
|
|
162
|
+
}
|
|
164
163
|
} else {
|
|
165
164
|
colSpan = 1
|
|
165
|
+
minChildRowSpan = 0
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
const minChildRowSpan = Math.min(...childRowSpans)
|
|
169
|
-
rowSpan = rowSpan + minChildRowSpan
|
|
170
|
-
|
|
171
168
|
header.colSpan = colSpan
|
|
172
|
-
header.rowSpan =
|
|
169
|
+
header.rowSpan = minChildRowSpan
|
|
173
170
|
|
|
174
|
-
|
|
175
|
-
}
|
|
171
|
+
results.push({ colSpan, rowSpan: header.rowSpan })
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return results
|
|
176
175
|
}
|
|
177
176
|
|
|
178
177
|
recurseHeadersForSpans(
|
|
@@ -15,8 +15,9 @@ function getHeaderPrototype<
|
|
|
15
15
|
>(table: Table_Internal<TFeatures, TData>): object {
|
|
16
16
|
if (!table._headerPrototype) {
|
|
17
17
|
table._headerPrototype = { table }
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const features = Object.values(table._features)
|
|
19
|
+
for (let i = 0; i < features.length; i++) {
|
|
20
|
+
features[i]!.assignHeaderPrototype?.(table._headerPrototype, table)
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
return table._headerPrototype
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assignPrototypeAPIs,
|
|
3
|
-
assignTableAPIs,
|
|
4
|
-
callMemoOrStaticFn,
|
|
5
|
-
} from '../../utils'
|
|
6
|
-
import {
|
|
7
|
-
table_getCenterHeaderGroups,
|
|
8
|
-
table_getLeftHeaderGroups,
|
|
9
|
-
table_getRightHeaderGroups,
|
|
10
|
-
} from '../../features/column-pinning/columnPinningFeature.utils'
|
|
1
|
+
import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'
|
|
11
2
|
import {
|
|
12
3
|
header_getContext,
|
|
13
4
|
header_getLeafHeaders,
|
|
@@ -74,23 +65,7 @@ export function constructCoreHeadersFeature<
|
|
|
74
65
|
},
|
|
75
66
|
table_getLeafHeaders: {
|
|
76
67
|
fn: () => table_getLeafHeaders(table),
|
|
77
|
-
memoDeps: () => [
|
|
78
|
-
callMemoOrStaticFn(
|
|
79
|
-
table,
|
|
80
|
-
'getLeftHeaderGroups',
|
|
81
|
-
table_getLeftHeaderGroups,
|
|
82
|
-
),
|
|
83
|
-
callMemoOrStaticFn(
|
|
84
|
-
table,
|
|
85
|
-
'getCenterHeaderGroups',
|
|
86
|
-
table_getCenterHeaderGroups,
|
|
87
|
-
),
|
|
88
|
-
callMemoOrStaticFn(
|
|
89
|
-
table,
|
|
90
|
-
'getRightHeaderGroups',
|
|
91
|
-
table_getRightHeaderGroups,
|
|
92
|
-
),
|
|
93
|
-
],
|
|
68
|
+
memoDeps: () => [table.getHeaderGroups()],
|
|
94
69
|
},
|
|
95
70
|
})
|
|
96
71
|
},
|
|
@@ -10,19 +10,21 @@ export interface Table_Headers<
|
|
|
10
10
|
TData extends RowData,
|
|
11
11
|
> {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Builds the visible header groups for the current column tree, visibility,
|
|
14
|
+
* and pinning state.
|
|
14
15
|
*/
|
|
15
16
|
getHeaderGroups: () => Array<HeaderGroup<TFeatures, TData>>
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Builds footer groups by reversing the current header group order.
|
|
18
19
|
*/
|
|
19
20
|
getFooterGroups: () => Array<HeaderGroup<TFeatures, TData>>
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* Flattens every header from every header group, including parent and
|
|
23
|
+
* placeholder headers.
|
|
22
24
|
*/
|
|
23
25
|
getFlatHeaders: () => Array<Header<TFeatures, TData, unknown>>
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
27
|
+
* Collects only leaf headers, excluding parent/group headers.
|
|
26
28
|
*/
|
|
27
29
|
getLeafHeaders: () => Array<Header<TFeatures, TData, unknown>>
|
|
28
30
|
}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDefaultColumnPinningState,
|
|
3
|
-
table_getCenterHeaderGroups,
|
|
4
|
-
table_getLeftHeaderGroups,
|
|
5
|
-
table_getRightHeaderGroups,
|
|
6
|
-
} from '../../features/column-pinning/columnPinningFeature.utils'
|
|
1
|
+
import { getDefaultColumnPinningState } from '../../features/column-pinning/columnPinningFeature.utils'
|
|
7
2
|
import {
|
|
8
3
|
column_getIsVisible,
|
|
9
4
|
table_getVisibleLeafColumns,
|
|
@@ -18,13 +13,14 @@ import type { Header_Header } from './coreHeadersFeature.types'
|
|
|
18
13
|
import type { Column } from '../../types/Column'
|
|
19
14
|
|
|
20
15
|
/**
|
|
21
|
-
*
|
|
16
|
+
* Walks a header tree and collects all descendant leaf headers.
|
|
22
17
|
*
|
|
23
|
-
*
|
|
18
|
+
* The header itself is included after its descendants, matching the recursive
|
|
19
|
+
* shape used by nested header groups.
|
|
24
20
|
*
|
|
25
21
|
* @example
|
|
26
22
|
* ```ts
|
|
27
|
-
* const
|
|
23
|
+
* const leafHeaders = header_getLeafHeaders(header)
|
|
28
24
|
* ```
|
|
29
25
|
*/
|
|
30
26
|
export function header_getLeafHeaders<
|
|
@@ -47,13 +43,13 @@ export function header_getLeafHeaders<
|
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
/**
|
|
50
|
-
*
|
|
46
|
+
* Builds the render context passed to a column's `header` or `footer` template.
|
|
51
47
|
*
|
|
52
|
-
*
|
|
48
|
+
* The context contains the header, its column, and the owning table instance.
|
|
53
49
|
*
|
|
54
50
|
* @example
|
|
55
51
|
* ```ts
|
|
56
|
-
* const
|
|
52
|
+
* const context = header_getContext(header)
|
|
57
53
|
* ```
|
|
58
54
|
*/
|
|
59
55
|
export function header_getContext<
|
|
@@ -69,13 +65,14 @@ export function header_getContext<
|
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
/**
|
|
72
|
-
*
|
|
68
|
+
* Builds visible header groups for the current column tree.
|
|
73
69
|
*
|
|
74
|
-
*
|
|
70
|
+
* Column visibility and pinning are applied before groups are built. When no
|
|
71
|
+
* columns are pinned, the fast path skips pin partitioning.
|
|
75
72
|
*
|
|
76
73
|
* @example
|
|
77
74
|
* ```ts
|
|
78
|
-
* const
|
|
75
|
+
* const headerGroups = table_getHeaderGroups(table)
|
|
79
76
|
* ```
|
|
80
77
|
*/
|
|
81
78
|
export function table_getHeaderGroups<
|
|
@@ -90,11 +87,17 @@ export function table_getHeaderGroups<
|
|
|
90
87
|
'getVisibleLeafColumns',
|
|
91
88
|
table_getVisibleLeafColumns,
|
|
92
89
|
) as Array<Column<TFeatures, TData, unknown>>
|
|
90
|
+
|
|
91
|
+
// Fast path: no columns are pinned — skip per-side lookups, partition, and spread.
|
|
92
|
+
if (!left.length && !right.length) {
|
|
93
|
+
return buildHeaderGroups(allColumns, leafColumns, table)
|
|
94
|
+
}
|
|
95
|
+
|
|
93
96
|
const leafColumnsById = table.getAllLeafColumnsById()
|
|
94
97
|
|
|
95
98
|
const leftColumns: typeof leafColumns = []
|
|
96
|
-
for (
|
|
97
|
-
const column = leafColumnsById[
|
|
99
|
+
for (let i = 0; i < left.length; i++) {
|
|
100
|
+
const column = leafColumnsById[left[i]!]
|
|
98
101
|
if (
|
|
99
102
|
column &&
|
|
100
103
|
callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)
|
|
@@ -104,8 +107,8 @@ export function table_getHeaderGroups<
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
const rightColumns: typeof leafColumns = []
|
|
107
|
-
for (
|
|
108
|
-
const column = leafColumnsById[
|
|
110
|
+
for (let i = 0; i < right.length; i++) {
|
|
111
|
+
const column = leafColumnsById[right[i]!]
|
|
109
112
|
if (
|
|
110
113
|
column &&
|
|
111
114
|
callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)
|
|
@@ -118,23 +121,22 @@ export function table_getHeaderGroups<
|
|
|
118
121
|
(column) => !left.includes(column.id) && !right.includes(column.id),
|
|
119
122
|
)
|
|
120
123
|
|
|
121
|
-
|
|
124
|
+
return buildHeaderGroups(
|
|
122
125
|
allColumns,
|
|
123
126
|
[...leftColumns, ...centerColumns, ...rightColumns],
|
|
124
127
|
table,
|
|
125
128
|
)
|
|
126
|
-
|
|
127
|
-
return headerGroups
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
/**
|
|
131
|
-
*
|
|
132
|
+
* Builds footer groups by reversing the current header groups.
|
|
132
133
|
*
|
|
133
|
-
*
|
|
134
|
+
* Footer rendering uses the same header objects and grouping structure, but
|
|
135
|
+
* renders them from leaf level back toward the root.
|
|
134
136
|
*
|
|
135
137
|
* @example
|
|
136
138
|
* ```ts
|
|
137
|
-
* const
|
|
139
|
+
* const footerGroups = table_getFooterGroups(table)
|
|
138
140
|
* ```
|
|
139
141
|
*/
|
|
140
142
|
export function table_getFooterGroups<
|
|
@@ -146,13 +148,14 @@ export function table_getFooterGroups<
|
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
|
-
*
|
|
151
|
+
* Flattens every header from every header group into one array.
|
|
150
152
|
*
|
|
151
|
-
*
|
|
153
|
+
* The result includes parent headers and placeholder headers, in header-group
|
|
154
|
+
* order from top to bottom.
|
|
152
155
|
*
|
|
153
156
|
* @example
|
|
154
157
|
* ```ts
|
|
155
|
-
* const
|
|
158
|
+
* const flatHeaders = table_getFlatHeaders(table)
|
|
156
159
|
* ```
|
|
157
160
|
*/
|
|
158
161
|
export function table_getFlatHeaders<
|
|
@@ -160,50 +163,38 @@ export function table_getFlatHeaders<
|
|
|
160
163
|
TData extends RowData,
|
|
161
164
|
>(table: Table_Internal<TFeatures, TData>) {
|
|
162
165
|
const headerGroups = table.getHeaderGroups()
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
const result: Array<Header<TFeatures, TData, unknown>> = []
|
|
167
|
+
for (let i = 0; i < headerGroups.length; i++) {
|
|
168
|
+
const headers = headerGroups[i]!.headers
|
|
169
|
+
for (let j = 0; j < headers.length; j++) {
|
|
170
|
+
result.push(headers[j]!)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return result
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
/**
|
|
171
|
-
*
|
|
177
|
+
* Collects only the leaf headers from the current header tree.
|
|
172
178
|
*
|
|
173
|
-
*
|
|
179
|
+
* Parent/group headers are skipped, making the result suitable for rendering
|
|
180
|
+
* one header per visible leaf column.
|
|
174
181
|
*
|
|
175
182
|
* @example
|
|
176
183
|
* ```ts
|
|
177
|
-
* const
|
|
184
|
+
* const leafHeaders = table_getLeafHeaders(table)
|
|
178
185
|
* ```
|
|
179
186
|
*/
|
|
180
187
|
export function table_getLeafHeaders<
|
|
181
188
|
TFeatures extends TableFeatures,
|
|
182
189
|
TData extends RowData,
|
|
183
190
|
>(table: Table_Internal<TFeatures, TData>) {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
const right = callMemoOrStaticFn(
|
|
195
|
-
table,
|
|
196
|
-
'getRightHeaderGroups',
|
|
197
|
-
table_getRightHeaderGroups,
|
|
198
|
-
)
|
|
199
|
-
|
|
200
|
-
return [
|
|
201
|
-
...(left[0]?.headers ?? []),
|
|
202
|
-
...(center[0]?.headers ?? []),
|
|
203
|
-
...(right[0]?.headers ?? []),
|
|
204
|
-
]
|
|
205
|
-
.map((header) => {
|
|
206
|
-
return header.getLeafHeaders()
|
|
207
|
-
})
|
|
208
|
-
.flat()
|
|
191
|
+
const topHeaders = table.getHeaderGroups()[0]?.headers ?? []
|
|
192
|
+
const result: Array<Header<TFeatures, TData, unknown>> = []
|
|
193
|
+
for (let i = 0; i < topHeaders.length; i++) {
|
|
194
|
+
const leafHeaders = topHeaders[i]!.getLeafHeaders()
|
|
195
|
+
for (let j = 0; j < leafHeaders.length; j++) {
|
|
196
|
+
result.push(leafHeaders[j]!)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return result
|
|
209
200
|
}
|
|
@@ -38,4 +38,8 @@ export interface TableReactivityBindings {
|
|
|
38
38
|
* Batches reactive updates to avoid intermediate recomputation.
|
|
39
39
|
*/
|
|
40
40
|
batch: (fn: () => void) => void
|
|
41
|
+
/**
|
|
42
|
+
* Schedules a function to run. This is used to defer updates after the current call stack (render, etc.) has finished
|
|
43
|
+
*/
|
|
44
|
+
schedule: (fn: () => void) => void
|
|
41
45
|
}
|