@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
|
@@ -3,13 +3,14 @@ import { row_getIsAllParentsExpanded } from "../row-expanding/rowExpandingFeatur
|
|
|
3
3
|
|
|
4
4
|
//#region src/features/row-pinning/rowPinningFeature.utils.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Creates the default row pinning state.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Both pinning regions start empty. Reset APIs use this value when
|
|
9
|
+
* `defaultState` is `true`.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```ts
|
|
12
|
-
* const
|
|
13
|
+
* const pinning = getDefaultRowPinningState()
|
|
13
14
|
* ```
|
|
14
15
|
*/
|
|
15
16
|
function getDefaultRowPinningState() {
|
|
@@ -19,13 +20,14 @@ function getDefaultRowPinningState() {
|
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* Routes a row pinning updater through the table's row-pinning change handler.
|
|
23
24
|
*
|
|
24
|
-
* The updater
|
|
25
|
+
* The updater may be a next `{ top, bottom }` state or a function of the
|
|
26
|
+
* previous state, matching the instance `table.setRowPinning` behavior.
|
|
25
27
|
*
|
|
26
28
|
* @example
|
|
27
29
|
* ```ts
|
|
28
|
-
* table_setRowPinning(table, (old) => old)
|
|
30
|
+
* table_setRowPinning(table, (old) => ({ ...old, top: [rowId] }))
|
|
29
31
|
* ```
|
|
30
32
|
*/
|
|
31
33
|
function table_setRowPinning(table, updater) {
|
|
@@ -33,9 +35,11 @@ function table_setRowPinning(table, updater) {
|
|
|
33
35
|
(_table$options$onRowP = (_table$options = table.options).onRowPinningChange) === null || _table$options$onRowP === void 0 || _table$options$onRowP.call(_table$options, updater);
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
|
-
* Resets the
|
|
38
|
+
* Resets `rowPinning` to the configured initial state or feature default.
|
|
37
39
|
*
|
|
38
|
-
*
|
|
40
|
+
* With no argument, the reset clones `table.initialState.rowPinning` when it
|
|
41
|
+
* exists. Passing `true` ignores initial state and resets to empty top/bottom
|
|
42
|
+
* arrays.
|
|
39
43
|
*
|
|
40
44
|
* @example
|
|
41
45
|
* ```ts
|
|
@@ -47,13 +51,14 @@ function table_resetRowPinning(table, defaultState) {
|
|
|
47
51
|
table_setRowPinning(table, defaultState ? getDefaultRowPinningState() : cloneState(table.initialState.rowPinning ?? getDefaultRowPinningState()));
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
|
-
*
|
|
54
|
+
* Checks whether any rows are pinned.
|
|
51
55
|
*
|
|
52
|
-
*
|
|
56
|
+
* Omit `position` to check both regions, or pass `'top'`/`'bottom'` to inspect
|
|
57
|
+
* one region.
|
|
53
58
|
*
|
|
54
59
|
* @example
|
|
55
60
|
* ```ts
|
|
56
|
-
* const
|
|
61
|
+
* const hasPinnedRows = table_getIsSomeRowsPinned(table)
|
|
57
62
|
* ```
|
|
58
63
|
*/
|
|
59
64
|
function table_getIsSomeRowsPinned(table, position) {
|
|
@@ -66,49 +71,58 @@ function table_getPinnedRows(table, position) {
|
|
|
66
71
|
var _table$atoms$rowPinni2;
|
|
67
72
|
const visibleRows = table.getRowModel().rows;
|
|
68
73
|
const pinnedRowIds = ((_table$atoms$rowPinni2 = table.atoms.rowPinning) === null || _table$atoms$rowPinni2 === void 0 || (_table$atoms$rowPinni2 = _table$atoms$rowPinni2.get()) === null || _table$atoms$rowPinni2 === void 0 ? void 0 : _table$atoms$rowPinni2[position]) ?? [];
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
const keepPinnedRows = table.options.keepPinnedRows ?? true;
|
|
75
|
+
const result = [];
|
|
76
|
+
for (let i = 0; i < pinnedRowIds.length; i++) {
|
|
77
|
+
const rowId = pinnedRowIds[i];
|
|
78
|
+
let row;
|
|
79
|
+
if (keepPinnedRows) {
|
|
80
|
+
const fullRow = table.getRow(rowId, true);
|
|
81
|
+
if (row_getIsAllParentsExpanded(fullRow)) row = fullRow;
|
|
82
|
+
} else row = visibleRows.find((r) => r.id === rowId);
|
|
83
|
+
if (!row) continue;
|
|
74
84
|
row.position = position;
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
result.push(row);
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
77
88
|
}
|
|
78
89
|
/**
|
|
79
|
-
*
|
|
90
|
+
* Resolves the visible rows pinned to the top region.
|
|
80
91
|
*
|
|
81
|
-
*
|
|
92
|
+
* The result follows `state.rowPinning.top` order and marks each row with
|
|
93
|
+
* `position = 'top'`.
|
|
82
94
|
*
|
|
83
95
|
* @example
|
|
84
96
|
* ```ts
|
|
85
|
-
* const
|
|
97
|
+
* const rows = table_getTopRows(table)
|
|
86
98
|
* ```
|
|
87
99
|
*/
|
|
88
100
|
function table_getTopRows(table) {
|
|
89
101
|
return table_getPinnedRows(table, "top");
|
|
90
102
|
}
|
|
91
103
|
/**
|
|
92
|
-
*
|
|
104
|
+
* Resolves the visible rows pinned to the bottom region.
|
|
93
105
|
*
|
|
94
|
-
*
|
|
106
|
+
* The result follows `state.rowPinning.bottom` order and marks each row with
|
|
107
|
+
* `position = 'bottom'`.
|
|
95
108
|
*
|
|
96
109
|
* @example
|
|
97
110
|
* ```ts
|
|
98
|
-
* const
|
|
111
|
+
* const rows = table_getBottomRows(table)
|
|
99
112
|
* ```
|
|
100
113
|
*/
|
|
101
114
|
function table_getBottomRows(table) {
|
|
102
115
|
return table_getPinnedRows(table, "bottom");
|
|
103
116
|
}
|
|
104
117
|
/**
|
|
105
|
-
*
|
|
118
|
+
* Resolves rows that are not pinned to top or bottom.
|
|
106
119
|
*
|
|
107
|
-
*
|
|
120
|
+
* The current row model is filtered by `state.rowPinning.top` and
|
|
121
|
+
* `state.rowPinning.bottom`.
|
|
108
122
|
*
|
|
109
123
|
* @example
|
|
110
124
|
* ```ts
|
|
111
|
-
* const
|
|
125
|
+
* const rows = table_getCenterRows(table)
|
|
112
126
|
* ```
|
|
113
127
|
*/
|
|
114
128
|
function table_getCenterRows(table) {
|
|
@@ -119,13 +133,14 @@ function table_getCenterRows(table) {
|
|
|
119
133
|
return allRows.filter((d) => !topAndBottom.has(d.id));
|
|
120
134
|
}
|
|
121
135
|
/**
|
|
122
|
-
*
|
|
136
|
+
* Checks whether this row can be pinned.
|
|
123
137
|
*
|
|
124
|
-
*
|
|
138
|
+
* `options.enableRowPinning` may be a boolean or a row predicate; it defaults
|
|
139
|
+
* to `true`.
|
|
125
140
|
*
|
|
126
141
|
* @example
|
|
127
142
|
* ```ts
|
|
128
|
-
* const
|
|
143
|
+
* const canPin = row_getCanPin(row)
|
|
129
144
|
* ```
|
|
130
145
|
*/
|
|
131
146
|
function row_getCanPin(row) {
|
|
@@ -134,13 +149,14 @@ function row_getCanPin(row) {
|
|
|
134
149
|
return enableRowPinning ?? true;
|
|
135
150
|
}
|
|
136
151
|
/**
|
|
137
|
-
*
|
|
152
|
+
* Reads this row's current pinning region.
|
|
138
153
|
*
|
|
139
|
-
*
|
|
154
|
+
* Rows listed in `state.rowPinning.top` return `'top'`, rows listed in
|
|
155
|
+
* `bottom` return `'bottom'`, and unpinned rows return `false`.
|
|
140
156
|
*
|
|
141
157
|
* @example
|
|
142
158
|
* ```ts
|
|
143
|
-
* const
|
|
159
|
+
* const position = row_getIsPinned(row)
|
|
144
160
|
* ```
|
|
145
161
|
*/
|
|
146
162
|
function row_getIsPinned(row) {
|
|
@@ -149,13 +165,13 @@ function row_getIsPinned(row) {
|
|
|
149
165
|
return top.includes(row.id) ? "top" : bottom.includes(row.id) ? "bottom" : false;
|
|
150
166
|
}
|
|
151
167
|
/**
|
|
152
|
-
*
|
|
168
|
+
* Finds this row's visible index within its pinned region.
|
|
153
169
|
*
|
|
154
|
-
*
|
|
170
|
+
* Unpinned rows return `-1`.
|
|
155
171
|
*
|
|
156
172
|
* @example
|
|
157
173
|
* ```ts
|
|
158
|
-
* const
|
|
174
|
+
* const index = row_getPinnedIndex(row)
|
|
159
175
|
* ```
|
|
160
176
|
*/
|
|
161
177
|
function row_getPinnedIndex(row) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowPinningFeature.utils.js","names":[],"sources":["../../../src/features/row-pinning/rowPinningFeature.utils.ts"],"sourcesContent":["import { row_getIsAllParentsExpanded } from '../row-expanding/rowExpandingFeature.utils'\nimport { callMemoOrStaticFn, cloneState } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n RowPinningPosition,\n RowPinningState,\n} from './rowPinningFeature.types'\n\n// State Utils\n\n/**\n * Returns the default row pinning state.\n *\n * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.\n *\n * @example\n * ```ts\n * const initialValue = getDefaultRowPinningState()\n * ```\n */\nexport function getDefaultRowPinningState(): RowPinningState {\n return {\n top: [],\n bottom: [],\n }\n}\n\n/**\n * Updates the table's row pinning state slice.\n *\n * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.\n *\n * @example\n * ```ts\n * table_setRowPinning(table, (old) => old)\n * ```\n */\nexport function table_setRowPinning<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowPinningState>,\n): void {\n table.options.onRowPinningChange?.(updater)\n}\n\n/**\n * Resets the table's row pinning state slice.\n *\n * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.\n *\n * @example\n * ```ts\n * table_resetRowPinning(table)\n * table_resetRowPinning(table, true)\n * ```\n */\nexport function table_resetRowPinning<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void {\n table_setRowPinning(\n table,\n defaultState\n ? getDefaultRowPinningState()\n : cloneState(\n table.initialState.rowPinning ?? getDefaultRowPinningState(),\n ),\n )\n}\n\n// Table Utils\n\n/**\n * Returns is some rows pinned for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getIsSomeRowsPinned(table)\n * ```\n */\nexport function table_getIsSomeRowsPinned<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n position?: RowPinningPosition,\n): boolean {\n const rowPinning = table.atoms.rowPinning?.get()\n\n if (!position) {\n return Boolean(rowPinning?.top.length || rowPinning?.bottom.length)\n }\n return Boolean(rowPinning?.[position].length)\n}\n\nfunction table_getPinnedRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n position: 'top' | 'bottom',\n): Array<Row<TFeatures, TData>> {\n const visibleRows = table.getRowModel().rows\n const pinnedRowIds = table.atoms.rowPinning?.get()?.[position] ?? []\n\n const rows =\n (table.options.keepPinnedRows ?? true)\n ? // get all rows that are pinned even if they would not be otherwise visible\n // account for expanded parent rows, but not pagination or filtering\n pinnedRowIds.map((rowId) => {\n const row = table.getRow(rowId, true)\n return row_getIsAllParentsExpanded(row) ? row : null\n })\n : // else get only visible rows that are pinned\n pinnedRowIds.map(\n (rowId) => visibleRows.find((row) => row.id === rowId)!,\n )\n\n const filteredRows = rows.filter((r) => !!r)\n // Assign position property directly to preserve prototype chain\n filteredRows.forEach((row) => {\n ;(row as any).position = position\n })\n return filteredRows\n}\n\n/**\n * Returns top rows for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getTopRows(table)\n * ```\n */\nexport function table_getTopRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return table_getPinnedRows(table, 'top')\n}\n\n/**\n * Returns bottom rows for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getBottomRows(table)\n * ```\n */\nexport function table_getBottomRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return table_getPinnedRows(table, 'bottom')\n}\n\n/**\n * Returns center rows for the table.\n *\n * This reads the relevant table atoms, options, and row-model cache to derive the current table-level value.\n *\n * @example\n * ```ts\n * const value = table_getCenterRows(table)\n * ```\n */\nexport function table_getCenterRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n const { top, bottom } =\n table.atoms.rowPinning?.get() ?? getDefaultRowPinningState()\n const allRows = table.getRowModel().rows\n\n const topAndBottom = new Set([...top, ...bottom])\n return allRows.filter((d) => !topAndBottom.has(d.id))\n}\n\n// Row Utils\n\n/**\n * Returns whether a row can use pin.\n *\n * This evaluates row data, table options, and feature-specific enablement rules.\n *\n * @example\n * ```ts\n * const value = row_getCanPin(row)\n * ```\n */\nexport function row_getCanPin<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean {\n const { enableRowPinning } = row.table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? true\n}\n\n/**\n * Returns is pinned for a row.\n *\n * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.\n *\n * @example\n * ```ts\n * const value = row_getIsPinned(row)\n * ```\n */\nexport function row_getIsPinned<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): RowPinningPosition {\n const { top, bottom } =\n row.table.atoms.rowPinning?.get() ?? getDefaultRowPinningState()\n\n return top.includes(row.id)\n ? 'top'\n : bottom.includes(row.id)\n ? 'bottom'\n : false\n}\n\n/**\n * Returns pinned index for a row.\n *\n * This is the static implementation behind the matching row instance API and may read row caches or table state atoms.\n *\n * @example\n * ```ts\n * const value = row_getPinnedIndex(row)\n * ```\n */\nexport function row_getPinnedIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): number {\n const position = row_getIsPinned(row)\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top'\n ? callMemoOrStaticFn(row.table, 'getTopRows', table_getTopRows)\n : callMemoOrStaticFn(row.table, 'getBottomRows', table_getBottomRows)\n ).map(({ id }) => id)\n\n return visiblePinnedRowIds.indexOf(row.id)\n}\n\n/**\n * Pins or unpins a row.\n *\n * Optional flags let callers include parent rows or leaf rows when updating\n * the row pinning state.\n *\n * @example\n * ```ts\n * row_pin(row, 'top')\n * ```\n */\nexport function row_pin<TFeatures extends TableFeatures, TData extends RowData>(\n row: Row<TFeatures, TData>,\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean,\n): void {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds: Set<string> = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table_setRowPinning(row.table, (old) => {\n if (position === 'bottom') {\n return {\n top: old.top.filter((d) => !rowIds.has(d)),\n bottom: [\n ...old.bottom.filter((d) => !rowIds.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [...old.top.filter((d) => !rowIds.has(d)), ...Array.from(rowIds)],\n bottom: old.bottom.filter((d) => !rowIds.has(d)),\n }\n }\n\n return {\n top: old.top.filter((d) => !rowIds.has(d)),\n bottom: old.bottom.filter((d) => !rowIds.has(d)),\n }\n })\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"rowPinningFeature.utils.js","names":[],"sources":["../../../src/features/row-pinning/rowPinningFeature.utils.ts"],"sourcesContent":["import { row_getIsAllParentsExpanded } from '../row-expanding/rowExpandingFeature.utils'\nimport { callMemoOrStaticFn, cloneState } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type {\n RowPinningPosition,\n RowPinningState,\n} from './rowPinningFeature.types'\n\n// State Utils\n\n/**\n * Creates the default row pinning state.\n *\n * Both pinning regions start empty. Reset APIs use this value when\n * `defaultState` is `true`.\n *\n * @example\n * ```ts\n * const pinning = getDefaultRowPinningState()\n * ```\n */\nexport function getDefaultRowPinningState(): RowPinningState {\n return {\n top: [],\n bottom: [],\n }\n}\n\n/**\n * Routes a row pinning updater through the table's row-pinning change handler.\n *\n * The updater may be a next `{ top, bottom }` state or a function of the\n * previous state, matching the instance `table.setRowPinning` behavior.\n *\n * @example\n * ```ts\n * table_setRowPinning(table, (old) => ({ ...old, top: [rowId] }))\n * ```\n */\nexport function table_setRowPinning<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<RowPinningState>,\n): void {\n table.options.onRowPinningChange?.(updater)\n}\n\n/**\n * Resets `rowPinning` to the configured initial state or feature default.\n *\n * With no argument, the reset clones `table.initialState.rowPinning` when it\n * exists. Passing `true` ignores initial state and resets to empty top/bottom\n * arrays.\n *\n * @example\n * ```ts\n * table_resetRowPinning(table)\n * table_resetRowPinning(table, true)\n * ```\n */\nexport function table_resetRowPinning<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void {\n table_setRowPinning(\n table,\n defaultState\n ? getDefaultRowPinningState()\n : cloneState(\n table.initialState.rowPinning ?? getDefaultRowPinningState(),\n ),\n )\n}\n\n// Table Utils\n\n/**\n * Checks whether any rows are pinned.\n *\n * Omit `position` to check both regions, or pass `'top'`/`'bottom'` to inspect\n * one region.\n *\n * @example\n * ```ts\n * const hasPinnedRows = table_getIsSomeRowsPinned(table)\n * ```\n */\nexport function table_getIsSomeRowsPinned<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n position?: RowPinningPosition,\n): boolean {\n const rowPinning = table.atoms.rowPinning?.get()\n\n if (!position) {\n return Boolean(rowPinning?.top.length || rowPinning?.bottom.length)\n }\n return Boolean(rowPinning?.[position].length)\n}\n\nfunction table_getPinnedRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n position: 'top' | 'bottom',\n): Array<Row<TFeatures, TData>> {\n const visibleRows = table.getRowModel().rows\n const pinnedRowIds = table.atoms.rowPinning?.get()?.[position] ?? []\n const keepPinnedRows = table.options.keepPinnedRows ?? true\n\n const result: Array<Row<TFeatures, TData>> = []\n for (let i = 0; i < pinnedRowIds.length; i++) {\n const rowId = pinnedRowIds[i]!\n let row: Row<TFeatures, TData> | undefined\n if (keepPinnedRows) {\n // get all rows that are pinned even if they would not be otherwise\n // visible; account for expanded parent rows, but not pagination/filtering\n const fullRow = table.getRow(rowId, true)\n if (row_getIsAllParentsExpanded(fullRow)) row = fullRow\n } else {\n // else get only visible rows that are pinned\n row = visibleRows.find((r) => r.id === rowId)\n }\n if (!row)\n continue\n // Assign position property directly to preserve prototype chain\n ;(row as any).position = position\n result.push(row)\n }\n return result\n}\n\n/**\n * Resolves the visible rows pinned to the top region.\n *\n * The result follows `state.rowPinning.top` order and marks each row with\n * `position = 'top'`.\n *\n * @example\n * ```ts\n * const rows = table_getTopRows(table)\n * ```\n */\nexport function table_getTopRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return table_getPinnedRows(table, 'top')\n}\n\n/**\n * Resolves the visible rows pinned to the bottom region.\n *\n * The result follows `state.rowPinning.bottom` order and marks each row with\n * `position = 'bottom'`.\n *\n * @example\n * ```ts\n * const rows = table_getBottomRows(table)\n * ```\n */\nexport function table_getBottomRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n return table_getPinnedRows(table, 'bottom')\n}\n\n/**\n * Resolves rows that are not pinned to top or bottom.\n *\n * The current row model is filtered by `state.rowPinning.top` and\n * `state.rowPinning.bottom`.\n *\n * @example\n * ```ts\n * const rows = table_getCenterRows(table)\n * ```\n */\nexport function table_getCenterRows<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Array<Row<TFeatures, TData>> {\n const { top, bottom } =\n table.atoms.rowPinning?.get() ?? getDefaultRowPinningState()\n const allRows = table.getRowModel().rows\n\n const topAndBottom = new Set([...top, ...bottom])\n return allRows.filter((d) => !topAndBottom.has(d.id))\n}\n\n// Row Utils\n\n/**\n * Checks whether this row can be pinned.\n *\n * `options.enableRowPinning` may be a boolean or a row predicate; it defaults\n * to `true`.\n *\n * @example\n * ```ts\n * const canPin = row_getCanPin(row)\n * ```\n */\nexport function row_getCanPin<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): boolean {\n const { enableRowPinning } = row.table.options\n if (typeof enableRowPinning === 'function') {\n return enableRowPinning(row)\n }\n return enableRowPinning ?? true\n}\n\n/**\n * Reads this row's current pinning region.\n *\n * Rows listed in `state.rowPinning.top` return `'top'`, rows listed in\n * `bottom` return `'bottom'`, and unpinned rows return `false`.\n *\n * @example\n * ```ts\n * const position = row_getIsPinned(row)\n * ```\n */\nexport function row_getIsPinned<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): RowPinningPosition {\n const { top, bottom } =\n row.table.atoms.rowPinning?.get() ?? getDefaultRowPinningState()\n\n return top.includes(row.id)\n ? 'top'\n : bottom.includes(row.id)\n ? 'bottom'\n : false\n}\n\n/**\n * Finds this row's visible index within its pinned region.\n *\n * Unpinned rows return `-1`.\n *\n * @example\n * ```ts\n * const index = row_getPinnedIndex(row)\n * ```\n */\nexport function row_getPinnedIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(row: Row<TFeatures, TData>): number {\n const position = row_getIsPinned(row)\n if (!position) return -1\n\n const visiblePinnedRowIds = (\n position === 'top'\n ? callMemoOrStaticFn(row.table, 'getTopRows', table_getTopRows)\n : callMemoOrStaticFn(row.table, 'getBottomRows', table_getBottomRows)\n ).map(({ id }) => id)\n\n return visiblePinnedRowIds.indexOf(row.id)\n}\n\n/**\n * Pins or unpins a row.\n *\n * Optional flags let callers include parent rows or leaf rows when updating\n * the row pinning state.\n *\n * @example\n * ```ts\n * row_pin(row, 'top')\n * ```\n */\nexport function row_pin<TFeatures extends TableFeatures, TData extends RowData>(\n row: Row<TFeatures, TData>,\n position: RowPinningPosition,\n includeLeafRows?: boolean,\n includeParentRows?: boolean,\n): void {\n const leafRowIds = includeLeafRows\n ? row.getLeafRows().map(({ id }) => id)\n : []\n const parentRowIds = includeParentRows\n ? row.getParentRows().map(({ id }) => id)\n : []\n const rowIds: Set<string> = new Set([...parentRowIds, row.id, ...leafRowIds])\n\n table_setRowPinning(row.table, (old) => {\n if (position === 'bottom') {\n return {\n top: old.top.filter((d) => !rowIds.has(d)),\n bottom: [\n ...old.bottom.filter((d) => !rowIds.has(d)),\n ...Array.from(rowIds),\n ],\n }\n }\n\n if (position === 'top') {\n return {\n top: [...old.top.filter((d) => !rowIds.has(d)), ...Array.from(rowIds)],\n bottom: old.bottom.filter((d) => !rowIds.has(d)),\n }\n }\n\n return {\n top: old.top.filter((d) => !rowIds.has(d)),\n bottom: old.bottom.filter((d) => !rowIds.has(d)),\n }\n })\n}\n"],"mappings":"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"}
|
|
@@ -10,18 +10,22 @@ interface TableState_RowSelection {
|
|
|
10
10
|
}
|
|
11
11
|
interface TableOptions_RowSelection<TFeatures extends TableFeatures, TData extends RowData> {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Allows rows to be selected alongside other rows.
|
|
14
|
+
*
|
|
15
|
+
* Provide a predicate to decide per row. Defaults to `true`.
|
|
15
16
|
*/
|
|
16
17
|
enableMultiRowSelection?: boolean | ((row: Row<TFeatures, TData>) => boolean);
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* Allows rows to be selected.
|
|
20
|
+
*
|
|
21
|
+
* Provide a predicate to decide per row. Defaults to `true`.
|
|
20
22
|
*/
|
|
21
23
|
enableRowSelection?: boolean | ((row: Row<TFeatures, TData>) => boolean);
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
+
* Controls whether selecting a parent row also selects its subRows.
|
|
26
|
+
*
|
|
27
|
+
* Provide a predicate to decide per row. This is most useful with expanding or
|
|
28
|
+
* grouping features and defaults to `true`.
|
|
25
29
|
*/
|
|
26
30
|
enableSubRowSelection?: boolean | ((row: Row<TFeatures, TData>) => boolean);
|
|
27
31
|
/**
|
|
@@ -33,31 +37,31 @@ interface TableOptions_RowSelection<TFeatures extends TableFeatures, TData exten
|
|
|
33
37
|
}
|
|
34
38
|
interface Row_RowSelection {
|
|
35
39
|
/**
|
|
36
|
-
*
|
|
40
|
+
* Checks whether this row can be selected alongside other rows.
|
|
37
41
|
*/
|
|
38
42
|
getCanMultiSelect: () => boolean;
|
|
39
43
|
/**
|
|
40
|
-
*
|
|
44
|
+
* Checks whether this row can currently be selected.
|
|
41
45
|
*/
|
|
42
46
|
getCanSelect: () => boolean;
|
|
43
47
|
/**
|
|
44
|
-
*
|
|
48
|
+
* Checks whether selecting this row should also select its subRows.
|
|
45
49
|
*/
|
|
46
50
|
getCanSelectSubRows: () => boolean;
|
|
47
51
|
/**
|
|
48
|
-
*
|
|
52
|
+
* Checks whether all selectable descendants are selected.
|
|
49
53
|
*/
|
|
50
54
|
getIsAllSubRowsSelected: () => boolean;
|
|
51
55
|
/**
|
|
52
|
-
*
|
|
56
|
+
* Checks whether this row id is selected.
|
|
53
57
|
*/
|
|
54
58
|
getIsSelected: () => boolean;
|
|
55
59
|
/**
|
|
56
|
-
*
|
|
60
|
+
* Checks whether some selectable descendants are selected.
|
|
57
61
|
*/
|
|
58
62
|
getIsSomeSelected: () => boolean;
|
|
59
63
|
/**
|
|
60
|
-
*
|
|
64
|
+
* Creates a checkbox-style handler that toggles this row's selected state.
|
|
61
65
|
*/
|
|
62
66
|
getToggleSelectedHandler: () => (event: unknown) => void;
|
|
63
67
|
/**
|
|
@@ -69,27 +73,27 @@ interface Row_RowSelection {
|
|
|
69
73
|
}
|
|
70
74
|
interface Table_RowSelection<TFeatures extends TableFeatures, TData extends RowData> {
|
|
71
75
|
/**
|
|
72
|
-
*
|
|
76
|
+
* Builds a selected-row model from rows after filtering.
|
|
73
77
|
*/
|
|
74
78
|
getFilteredSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
75
79
|
/**
|
|
76
|
-
*
|
|
80
|
+
* Builds a selected-row model from rows after grouping.
|
|
77
81
|
*/
|
|
78
82
|
getGroupedSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
79
83
|
/**
|
|
80
|
-
*
|
|
84
|
+
* Checks whether every selectable row on the current page is selected.
|
|
81
85
|
*/
|
|
82
86
|
getIsAllPageRowsSelected: () => boolean;
|
|
83
87
|
/**
|
|
84
|
-
*
|
|
88
|
+
* Checks whether every selectable filtered row is selected.
|
|
85
89
|
*/
|
|
86
90
|
getIsAllRowsSelected: () => boolean;
|
|
87
91
|
/**
|
|
88
|
-
*
|
|
92
|
+
* Checks whether the current page has a partial row selection.
|
|
89
93
|
*/
|
|
90
94
|
getIsSomePageRowsSelected: () => boolean;
|
|
91
95
|
/**
|
|
92
|
-
*
|
|
96
|
+
* Checks whether filtered rows have a partial row selection.
|
|
93
97
|
*/
|
|
94
98
|
getIsSomeRowsSelected: () => boolean;
|
|
95
99
|
/**
|
|
@@ -97,23 +101,25 @@ interface Table_RowSelection<TFeatures extends TableFeatures, TData extends RowD
|
|
|
97
101
|
*/
|
|
98
102
|
getPreSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
99
103
|
/**
|
|
100
|
-
*
|
|
104
|
+
* Builds a selected-row model from the core row model.
|
|
101
105
|
*/
|
|
102
106
|
getSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
103
107
|
/**
|
|
104
|
-
*
|
|
108
|
+
* Creates a checkbox-style handler that toggles all current-page rows.
|
|
105
109
|
*/
|
|
106
110
|
getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void;
|
|
107
111
|
/**
|
|
108
|
-
*
|
|
112
|
+
* Creates a checkbox-style handler that toggles all selectable rows.
|
|
109
113
|
*/
|
|
110
114
|
getToggleAllRowsSelectedHandler: () => (event: unknown) => void;
|
|
111
115
|
/**
|
|
112
|
-
* Resets
|
|
116
|
+
* Resets `rowSelection` to `initialState.rowSelection`.
|
|
117
|
+
*
|
|
118
|
+
* Pass `true` to ignore initial state and reset to `{}`.
|
|
113
119
|
*/
|
|
114
120
|
resetRowSelection: (defaultState?: boolean) => void;
|
|
115
121
|
/**
|
|
116
|
-
*
|
|
122
|
+
* Updates row selection state with a next map or updater function.
|
|
117
123
|
*/
|
|
118
124
|
setRowSelection: (updater: Updater<RowSelectionState>) => void;
|
|
119
125
|
/**
|
|
@@ -10,18 +10,22 @@ interface TableState_RowSelection {
|
|
|
10
10
|
}
|
|
11
11
|
interface TableOptions_RowSelection<TFeatures extends TableFeatures, TData extends RowData> {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Allows rows to be selected alongside other rows.
|
|
14
|
+
*
|
|
15
|
+
* Provide a predicate to decide per row. Defaults to `true`.
|
|
15
16
|
*/
|
|
16
17
|
enableMultiRowSelection?: boolean | ((row: Row<TFeatures, TData>) => boolean);
|
|
17
18
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* Allows rows to be selected.
|
|
20
|
+
*
|
|
21
|
+
* Provide a predicate to decide per row. Defaults to `true`.
|
|
20
22
|
*/
|
|
21
23
|
enableRowSelection?: boolean | ((row: Row<TFeatures, TData>) => boolean);
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
+
* Controls whether selecting a parent row also selects its subRows.
|
|
26
|
+
*
|
|
27
|
+
* Provide a predicate to decide per row. This is most useful with expanding or
|
|
28
|
+
* grouping features and defaults to `true`.
|
|
25
29
|
*/
|
|
26
30
|
enableSubRowSelection?: boolean | ((row: Row<TFeatures, TData>) => boolean);
|
|
27
31
|
/**
|
|
@@ -33,31 +37,31 @@ interface TableOptions_RowSelection<TFeatures extends TableFeatures, TData exten
|
|
|
33
37
|
}
|
|
34
38
|
interface Row_RowSelection {
|
|
35
39
|
/**
|
|
36
|
-
*
|
|
40
|
+
* Checks whether this row can be selected alongside other rows.
|
|
37
41
|
*/
|
|
38
42
|
getCanMultiSelect: () => boolean;
|
|
39
43
|
/**
|
|
40
|
-
*
|
|
44
|
+
* Checks whether this row can currently be selected.
|
|
41
45
|
*/
|
|
42
46
|
getCanSelect: () => boolean;
|
|
43
47
|
/**
|
|
44
|
-
*
|
|
48
|
+
* Checks whether selecting this row should also select its subRows.
|
|
45
49
|
*/
|
|
46
50
|
getCanSelectSubRows: () => boolean;
|
|
47
51
|
/**
|
|
48
|
-
*
|
|
52
|
+
* Checks whether all selectable descendants are selected.
|
|
49
53
|
*/
|
|
50
54
|
getIsAllSubRowsSelected: () => boolean;
|
|
51
55
|
/**
|
|
52
|
-
*
|
|
56
|
+
* Checks whether this row id is selected.
|
|
53
57
|
*/
|
|
54
58
|
getIsSelected: () => boolean;
|
|
55
59
|
/**
|
|
56
|
-
*
|
|
60
|
+
* Checks whether some selectable descendants are selected.
|
|
57
61
|
*/
|
|
58
62
|
getIsSomeSelected: () => boolean;
|
|
59
63
|
/**
|
|
60
|
-
*
|
|
64
|
+
* Creates a checkbox-style handler that toggles this row's selected state.
|
|
61
65
|
*/
|
|
62
66
|
getToggleSelectedHandler: () => (event: unknown) => void;
|
|
63
67
|
/**
|
|
@@ -69,27 +73,27 @@ interface Row_RowSelection {
|
|
|
69
73
|
}
|
|
70
74
|
interface Table_RowSelection<TFeatures extends TableFeatures, TData extends RowData> {
|
|
71
75
|
/**
|
|
72
|
-
*
|
|
76
|
+
* Builds a selected-row model from rows after filtering.
|
|
73
77
|
*/
|
|
74
78
|
getFilteredSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
75
79
|
/**
|
|
76
|
-
*
|
|
80
|
+
* Builds a selected-row model from rows after grouping.
|
|
77
81
|
*/
|
|
78
82
|
getGroupedSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
79
83
|
/**
|
|
80
|
-
*
|
|
84
|
+
* Checks whether every selectable row on the current page is selected.
|
|
81
85
|
*/
|
|
82
86
|
getIsAllPageRowsSelected: () => boolean;
|
|
83
87
|
/**
|
|
84
|
-
*
|
|
88
|
+
* Checks whether every selectable filtered row is selected.
|
|
85
89
|
*/
|
|
86
90
|
getIsAllRowsSelected: () => boolean;
|
|
87
91
|
/**
|
|
88
|
-
*
|
|
92
|
+
* Checks whether the current page has a partial row selection.
|
|
89
93
|
*/
|
|
90
94
|
getIsSomePageRowsSelected: () => boolean;
|
|
91
95
|
/**
|
|
92
|
-
*
|
|
96
|
+
* Checks whether filtered rows have a partial row selection.
|
|
93
97
|
*/
|
|
94
98
|
getIsSomeRowsSelected: () => boolean;
|
|
95
99
|
/**
|
|
@@ -97,23 +101,25 @@ interface Table_RowSelection<TFeatures extends TableFeatures, TData extends RowD
|
|
|
97
101
|
*/
|
|
98
102
|
getPreSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
99
103
|
/**
|
|
100
|
-
*
|
|
104
|
+
* Builds a selected-row model from the core row model.
|
|
101
105
|
*/
|
|
102
106
|
getSelectedRowModel: () => RowModel<TFeatures, TData>;
|
|
103
107
|
/**
|
|
104
|
-
*
|
|
108
|
+
* Creates a checkbox-style handler that toggles all current-page rows.
|
|
105
109
|
*/
|
|
106
110
|
getToggleAllPageRowsSelectedHandler: () => (event: unknown) => void;
|
|
107
111
|
/**
|
|
108
|
-
*
|
|
112
|
+
* Creates a checkbox-style handler that toggles all selectable rows.
|
|
109
113
|
*/
|
|
110
114
|
getToggleAllRowsSelectedHandler: () => (event: unknown) => void;
|
|
111
115
|
/**
|
|
112
|
-
* Resets
|
|
116
|
+
* Resets `rowSelection` to `initialState.rowSelection`.
|
|
117
|
+
*
|
|
118
|
+
* Pass `true` to ignore initial state and reset to `{}`.
|
|
113
119
|
*/
|
|
114
120
|
resetRowSelection: (defaultState?: boolean) => void;
|
|
115
121
|
/**
|
|
116
|
-
*
|
|
122
|
+
* Updates row selection state with a next map or updater function.
|
|
117
123
|
*/
|
|
118
124
|
setRowSelection: (updater: Updater<RowSelectionState>) => void;
|
|
119
125
|
/**
|