@tanstack/table-core 9.0.0-beta.1 → 9.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/cells/constructCell.d.cts +1 -1
- package/dist/core/cells/constructCell.d.ts +1 -1
- package/dist/core/cells/coreCellsFeature.cjs +11 -20
- package/dist/core/cells/coreCellsFeature.cjs.map +1 -1
- package/dist/core/cells/coreCellsFeature.d.cts +4 -12
- package/dist/core/cells/coreCellsFeature.d.ts +4 -12
- package/dist/core/cells/coreCellsFeature.js +12 -20
- package/dist/core/cells/coreCellsFeature.js.map +1 -1
- package/dist/core/cells/coreCellsFeature.types.d.cts +4 -4
- package/dist/core/cells/coreCellsFeature.types.d.ts +4 -4
- package/dist/core/cells/coreCellsFeature.utils.d.cts +1 -1
- package/dist/core/cells/coreCellsFeature.utils.d.ts +1 -1
- package/dist/core/columns/constructColumn.d.cts +1 -1
- package/dist/core/columns/constructColumn.d.ts +1 -1
- package/dist/core/columns/coreColumnsFeature.cjs +59 -68
- package/dist/core/columns/coreColumnsFeature.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.d.cts +4 -12
- package/dist/core/columns/coreColumnsFeature.d.ts +4 -12
- package/dist/core/columns/coreColumnsFeature.js +60 -68
- package/dist/core/columns/coreColumnsFeature.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.types.d.cts +5 -5
- package/dist/core/columns/coreColumnsFeature.types.d.ts +5 -5
- package/dist/core/columns/coreColumnsFeature.utils.d.cts +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.d.ts +1 -1
- package/dist/core/coreFeatures.cjs.map +1 -1
- package/dist/core/coreFeatures.d.cts +1 -1
- package/dist/core/coreFeatures.d.ts +1 -1
- package/dist/core/coreFeatures.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.d.cts +1 -1
- package/dist/core/headers/buildHeaderGroups.d.ts +1 -1
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/constructHeader.d.cts +1 -1
- package/dist/core/headers/constructHeader.d.ts +1 -1
- package/dist/core/headers/coreHeadersFeature.cjs +44 -53
- package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.d.cts +4 -12
- package/dist/core/headers/coreHeadersFeature.d.ts +4 -12
- package/dist/core/headers/coreHeadersFeature.js +45 -53
- package/dist/core/headers/coreHeadersFeature.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.types.d.cts +6 -6
- package/dist/core/headers/coreHeadersFeature.types.d.ts +6 -6
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.cjs +17 -26
- package/dist/core/row-models/coreRowModelsFeature.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.d.cts +4 -12
- package/dist/core/row-models/coreRowModelsFeature.d.ts +4 -12
- package/dist/core/row-models/coreRowModelsFeature.js +18 -26
- package/dist/core/row-models/coreRowModelsFeature.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.types.d.cts +5 -15
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +5 -15
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +13 -13
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +2 -2
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +2 -2
- package/dist/core/row-models/coreRowModelsFeature.utils.js +13 -13
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/core/row-models/createCoreRowModel.cjs +1 -2
- package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
- package/dist/core/row-models/createCoreRowModel.d.cts +2 -2
- package/dist/core/row-models/createCoreRowModel.d.ts +2 -2
- package/dist/core/row-models/createCoreRowModel.js +1 -2
- package/dist/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/core/rows/constructRow.d.cts +1 -1
- package/dist/core/rows/constructRow.d.ts +1 -1
- package/dist/core/rows/coreRowsFeature.cjs +27 -36
- package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.d.cts +4 -12
- package/dist/core/rows/coreRowsFeature.d.ts +4 -12
- package/dist/core/rows/coreRowsFeature.js +28 -36
- package/dist/core/rows/coreRowsFeature.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +5 -5
- package/dist/core/rows/coreRowsFeature.types.d.ts +5 -5
- package/dist/core/rows/coreRowsFeature.utils.d.cts +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.ts +1 -1
- package/dist/core/table/constructTable.cjs +21 -6
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.d.cts +1 -1
- package/dist/core/table/constructTable.d.ts +1 -1
- package/dist/core/table/constructTable.js +21 -6
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.cjs +7 -16
- package/dist/core/table/coreTablesFeature.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.d.cts +4 -12
- package/dist/core/table/coreTablesFeature.d.ts +4 -12
- package/dist/core/table/coreTablesFeature.js +8 -16
- package/dist/core/table/coreTablesFeature.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +27 -15
- package/dist/core/table/coreTablesFeature.types.d.ts +27 -15
- package/dist/core/table/coreTablesFeature.utils.cjs +1 -2
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.d.cts +1 -1
- package/dist/core/table/coreTablesFeature.utils.d.ts +1 -1
- package/dist/core/table/coreTablesFeature.utils.js +1 -2
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.cjs +49 -61
- package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.d.cts +4 -15
- package/dist/features/column-faceting/columnFacetingFeature.d.ts +4 -15
- package/dist/features/column-faceting/columnFacetingFeature.js +50 -61
- package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +8 -29
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +8 -29
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +12 -12
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.js +12 -12
- package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.d.cts +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.d.ts +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.d.cts +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.d.ts +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.d.cts +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.d.ts +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.cjs +40 -53
- package/dist/features/column-filtering/columnFilteringFeature.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.d.cts +4 -16
- package/dist/features/column-filtering/columnFilteringFeature.d.ts +4 -16
- package/dist/features/column-filtering/columnFilteringFeature.js +41 -53
- package/dist/features/column-filtering/columnFilteringFeature.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +40 -26
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +40 -26
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +2 -2
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +2 -2
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.cjs +4 -2
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.d.cts +5 -3
- package/dist/features/column-filtering/createFilteredRowModel.d.ts +5 -3
- package/dist/features/column-filtering/createFilteredRowModel.js +4 -2
- package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.cjs +57 -69
- package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.d.cts +4 -15
- package/dist/features/column-grouping/columnGroupingFeature.d.ts +4 -15
- package/dist/features/column-grouping/columnGroupingFeature.js +58 -69
- package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +23 -19
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +23 -19
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs +5 -2
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.d.cts +6 -3
- package/dist/features/column-grouping/createGroupedRowModel.d.ts +6 -3
- package/dist/features/column-grouping/createGroupedRowModel.js +5 -2
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.cjs +47 -59
- package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.d.cts +4 -15
- package/dist/features/column-ordering/columnOrderingFeature.d.ts +4 -15
- package/dist/features/column-ordering/columnOrderingFeature.js +48 -59
- package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.cjs +209 -221
- package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.d.cts +4 -15
- package/dist/features/column-pinning/columnPinningFeature.d.ts +4 -15
- package/dist/features/column-pinning/columnPinningFeature.js +210 -221
- package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +13 -13
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +13 -13
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.cjs +31 -43
- package/dist/features/column-resizing/columnResizingFeature.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.d.cts +4 -15
- package/dist/features/column-resizing/columnResizingFeature.d.ts +4 -15
- package/dist/features/column-resizing/columnResizingFeature.js +32 -43
- package/dist/features/column-resizing/columnResizingFeature.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +1 -1
- package/dist/features/column-sizing/columnSizingFeature.cjs +112 -125
- package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.d.cts +4 -16
- package/dist/features/column-sizing/columnSizingFeature.d.ts +4 -16
- package/dist/features/column-sizing/columnSizingFeature.js +113 -125
- package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +4 -4
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +4 -4
- package/dist/features/column-visibility/columnVisibilityFeature.cjs +83 -95
- package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.d.cts +4 -15
- package/dist/features/column-visibility/columnVisibilityFeature.d.ts +4 -15
- package/dist/features/column-visibility/columnVisibilityFeature.js +84 -95
- package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +2 -2
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +2 -2
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.cjs +31 -43
- package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.d.cts +4 -15
- package/dist/features/global-filtering/globalFilteringFeature.d.ts +4 -15
- package/dist/features/global-filtering/globalFilteringFeature.js +32 -43
- package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +3 -3
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +3 -3
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +7 -5
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +7 -5
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.d.cts +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.d.ts +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.cjs +37 -49
- package/dist/features/row-expanding/rowExpandingFeature.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.d.cts +4 -15
- package/dist/features/row-expanding/rowExpandingFeature.d.ts +4 -15
- package/dist/features/row-expanding/rowExpandingFeature.js +38 -49
- package/dist/features/row-expanding/rowExpandingFeature.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +5 -14
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +5 -14
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.cjs.map +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.d.cts +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.d.ts +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.cjs +35 -47
- package/dist/features/row-pagination/rowPaginationFeature.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.d.cts +4 -15
- package/dist/features/row-pagination/rowPaginationFeature.d.ts +4 -15
- package/dist/features/row-pagination/rowPaginationFeature.js +36 -47
- package/dist/features/row-pagination/rowPaginationFeature.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +4 -13
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +4 -13
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +1 -1
- package/dist/features/row-pinning/rowPinningFeature.cjs +55 -67
- package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.d.cts +4 -15
- package/dist/features/row-pinning/rowPinningFeature.d.ts +4 -15
- package/dist/features/row-pinning/rowPinningFeature.js +56 -67
- package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +2 -2
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +2 -2
- package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.cjs +65 -77
- package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.d.cts +4 -15
- package/dist/features/row-selection/rowSelectionFeature.d.ts +4 -15
- package/dist/features/row-selection/rowSelectionFeature.js +66 -77
- package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +2 -2
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +10 -6
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.js +10 -6
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +4 -2
- package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.d.cts +5 -3
- package/dist/features/row-sorting/createSortedRowModel.d.ts +5 -3
- package/dist/features/row-sorting/createSortedRowModel.js +4 -2
- package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.cjs +45 -57
- package/dist/features/row-sorting/rowSortingFeature.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.d.cts +4 -15
- package/dist/features/row-sorting/rowSortingFeature.d.ts +4 -15
- package/dist/features/row-sorting/rowSortingFeature.js +46 -57
- package/dist/features/row-sorting/rowSortingFeature.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +23 -20
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +23 -20
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +8 -5
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js +8 -5
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/fns/aggregationFns.cjs +18 -18
- package/dist/fns/aggregationFns.cjs.map +1 -1
- package/dist/fns/aggregationFns.d.cts +21 -19
- package/dist/fns/aggregationFns.d.ts +21 -19
- package/dist/fns/aggregationFns.js +18 -18
- package/dist/fns/aggregationFns.js.map +1 -1
- package/dist/fns/filterFns.cjs +51 -65
- package/dist/fns/filterFns.cjs.map +1 -1
- package/dist/fns/filterFns.d.cts +82 -28
- package/dist/fns/filterFns.d.ts +82 -28
- package/dist/fns/filterFns.js +51 -65
- package/dist/fns/filterFns.js.map +1 -1
- package/dist/fns/sortFns.cjs +18 -6
- package/dist/fns/sortFns.cjs.map +1 -1
- package/dist/fns/sortFns.d.cts +15 -13
- package/dist/fns/sortFns.d.ts +15 -13
- package/dist/fns/sortFns.js +18 -6
- package/dist/fns/sortFns.js.map +1 -1
- package/dist/helpers/metaHelper.cjs +30 -0
- package/dist/helpers/metaHelper.cjs.map +1 -0
- package/dist/helpers/metaHelper.d.cts +26 -0
- package/dist/helpers/metaHelper.d.ts +26 -0
- package/dist/helpers/metaHelper.js +29 -0
- package/dist/helpers/metaHelper.js.map +1 -0
- package/dist/helpers/tableFeatures.cjs +31 -3
- package/dist/helpers/tableFeatures.cjs.map +1 -1
- package/dist/helpers/tableFeatures.d.cts +33 -5
- package/dist/helpers/tableFeatures.d.ts +33 -5
- package/dist/helpers/tableFeatures.js +31 -3
- package/dist/helpers/tableFeatures.js.map +1 -1
- package/dist/index.cjs +2 -20
- package/dist/index.d.cts +44 -43
- package/dist/index.d.ts +44 -43
- package/dist/index.js +22 -21
- package/dist/store-reactivity-bindings.cjs +1 -1
- package/dist/store-reactivity-bindings.cjs.map +1 -1
- package/dist/store-reactivity-bindings.d.cts +1 -1
- package/dist/store-reactivity-bindings.d.ts +1 -1
- package/dist/store-reactivity-bindings.js +1 -1
- package/dist/store-reactivity-bindings.js.map +1 -1
- package/dist/types/Cell.d.cts +8 -10
- package/dist/types/Cell.d.ts +8 -10
- package/dist/types/Column.d.cts +19 -12
- package/dist/types/Column.d.ts +19 -12
- package/dist/types/ColumnDef.d.cts +30 -11
- package/dist/types/ColumnDef.d.ts +30 -11
- package/dist/types/Header.d.cts +10 -11
- package/dist/types/Header.d.ts +10 -11
- package/dist/types/HeaderGroup.d.cts +4 -9
- package/dist/types/HeaderGroup.d.ts +4 -9
- package/dist/types/Row.d.cts +15 -11
- package/dist/types/Row.d.ts +15 -11
- package/dist/types/RowModel.d.cts +19 -19
- package/dist/types/RowModel.d.ts +19 -19
- package/dist/types/RowModelFns.d.cts +9 -9
- package/dist/types/RowModelFns.d.ts +9 -9
- package/dist/types/Table.d.cts +52 -24
- package/dist/types/Table.d.ts +52 -24
- package/dist/types/TableFeatures.d.cts +178 -41
- package/dist/types/TableFeatures.d.ts +178 -41
- package/dist/types/TableOptions.d.cts +31 -10
- package/dist/types/TableOptions.d.ts +31 -10
- package/dist/types/TableState.d.cts +22 -13
- package/dist/types/TableState.d.ts +22 -13
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +8 -3
- package/dist/utils.d.ts +8 -3
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/skills/column-definitions/SKILL.md +3 -6
- package/skills/column-layout/SKILL.md +0 -2
- package/skills/customizing-feature-behavior/SKILL.md +63 -56
- package/skills/filtering/SKILL.md +60 -42
- package/skills/filtering/references/faceting-and-fuzzy.md +59 -32
- package/skills/grouping/SKILL.md +49 -54
- package/skills/migrate-v8-to-v9/SKILL.md +30 -33
- package/skills/pagination/SKILL.md +22 -20
- package/skills/row-expanding/SKILL.md +33 -25
- package/skills/row-pinning/SKILL.md +11 -7
- package/skills/row-selection/SKILL.md +0 -3
- package/skills/setup/SKILL.md +55 -65
- package/skills/sorting/SKILL.md +21 -21
- package/skills/state-management/SKILL.md +40 -25
- package/src/core/cells/coreCellsFeature.ts +17 -39
- package/src/core/cells/coreCellsFeature.types.ts +6 -6
- package/src/core/columns/coreColumnsFeature.ts +56 -83
- package/src/core/columns/coreColumnsFeature.types.ts +8 -8
- package/src/core/coreFeatures.ts +1 -1
- package/src/core/headers/buildHeaderGroups.ts +1 -1
- package/src/core/headers/coreHeadersFeature.ts +42 -64
- package/src/core/headers/coreHeadersFeature.types.ts +10 -10
- package/src/core/headers/coreHeadersFeature.utils.ts +1 -1
- package/src/core/row-models/coreRowModelsFeature.ts +43 -64
- package/src/core/row-models/coreRowModelsFeature.types.ts +7 -24
- package/src/core/row-models/coreRowModelsFeature.utils.ts +7 -7
- package/src/core/row-models/createCoreRowModel.ts +5 -4
- package/src/core/rows/coreRowsFeature.ts +45 -72
- package/src/core/rows/coreRowsFeature.types.ts +8 -8
- package/src/core/table/constructTable.ts +50 -13
- package/src/core/table/coreTablesFeature.ts +13 -35
- package/src/core/table/coreTablesFeature.types.ts +40 -17
- package/src/core/table/coreTablesFeature.utils.ts +10 -5
- package/src/features/column-faceting/columnFacetingFeature.ts +71 -102
- package/src/features/column-faceting/columnFacetingFeature.types.ts +11 -44
- package/src/features/column-faceting/columnFacetingFeature.utils.ts +6 -6
- package/src/features/column-faceting/createFacetedMinMaxValues.ts +1 -1
- package/src/features/column-faceting/createFacetedRowModel.ts +1 -1
- package/src/features/column-faceting/createFacetedUniqueValues.ts +1 -1
- package/src/features/column-filtering/columnFilteringFeature.ts +60 -103
- package/src/features/column-filtering/columnFilteringFeature.types.ts +55 -39
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +2 -2
- package/src/features/column-filtering/createFilteredRowModel.ts +5 -7
- package/src/features/column-grouping/columnGroupingFeature.ts +82 -126
- package/src/features/column-grouping/columnGroupingFeature.types.ts +32 -31
- package/src/features/column-grouping/createGroupedRowModel.ts +7 -11
- package/src/features/column-ordering/columnOrderingFeature.ts +52 -84
- package/src/features/column-ordering/columnOrderingFeature.types.ts +2 -2
- package/src/features/column-pinning/columnPinningFeature.ts +268 -304
- package/src/features/column-pinning/columnPinningFeature.types.ts +4 -4
- package/src/features/column-pinning/columnPinningFeature.utils.ts +5 -5
- package/src/features/column-resizing/columnResizingFeature.ts +44 -78
- package/src/features/column-sizing/columnSizingFeature.ts +115 -152
- package/src/features/column-visibility/columnVisibilityFeature.ts +92 -129
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.ts +45 -79
- package/src/features/global-filtering/globalFilteringFeature.types.ts +4 -4
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +4 -2
- package/src/features/row-expanding/createExpandedRowModel.ts +1 -1
- package/src/features/row-expanding/rowExpandingFeature.ts +65 -101
- package/src/features/row-expanding/rowExpandingFeature.types.ts +8 -22
- package/src/features/row-pagination/createPaginatedRowModel.ts +1 -1
- package/src/features/row-pagination/rowPaginationFeature.ts +69 -103
- package/src/features/row-pagination/rowPaginationFeature.types.ts +6 -20
- package/src/features/row-pinning/rowPinningFeature.ts +72 -104
- package/src/features/row-pinning/rowPinningFeature.types.ts +4 -4
- package/src/features/row-selection/rowSelectionFeature.ts +103 -135
- package/src/features/row-selection/rowSelectionFeature.types.ts +4 -4
- package/src/features/row-selection/rowSelectionFeature.utils.ts +12 -7
- package/src/features/row-sorting/createSortedRowModel.ts +6 -6
- package/src/features/row-sorting/rowSortingFeature.ts +73 -114
- package/src/features/row-sorting/rowSortingFeature.types.ts +33 -32
- package/src/features/row-sorting/rowSortingFeature.utils.ts +8 -6
- package/src/fns/aggregationFns.ts +26 -42
- package/src/fns/filterFns.ts +231 -264
- package/src/fns/sortFns.ts +51 -29
- package/src/helpers/metaHelper.ts +24 -0
- package/src/helpers/tableFeatures.ts +36 -5
- package/src/index.ts +1 -0
- package/src/store-reactivity-bindings.ts +1 -1
- package/src/types/Cell.ts +10 -30
- package/src/types/Column.ts +21 -56
- package/src/types/ColumnDef.ts +48 -49
- package/src/types/Header.ts +10 -32
- package/src/types/HeaderGroup.ts +4 -15
- package/src/types/Row.ts +18 -39
- package/src/types/RowModel.ts +24 -114
- package/src/types/RowModelFns.ts +12 -31
- package/src/types/Table.ts +85 -80
- package/src/types/TableFeatures.ts +253 -108
- package/src/types/TableOptions.ts +70 -60
- package/src/types/TableState.ts +20 -73
- package/src/utils.ts +16 -6
|
@@ -3,76 +3,65 @@ import { cell_getIsAggregated, cell_getIsGrouped, cell_getIsPlaceholder, column_
|
|
|
3
3
|
|
|
4
4
|
//#region src/features/column-grouping/columnGroupingFeature.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
|
|
6
|
+
* Feature that adds column grouping state, aggregation defaults, and grouped row APIs.
|
|
9
7
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* The stock column grouping feature.
|
|
70
|
-
*
|
|
71
|
-
* Register this feature to add grouping state, aggregation defaults, grouped
|
|
72
|
-
* row-model support, and table/row/column/cell grouping APIs.
|
|
73
|
-
*/
|
|
74
|
-
const columnGroupingFeature = constructColumnGroupingFeature();
|
|
8
|
+
const columnGroupingFeature = {
|
|
9
|
+
getInitialState: (initialState) => {
|
|
10
|
+
return {
|
|
11
|
+
grouping: getDefaultGroupingState(),
|
|
12
|
+
...initialState
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
getDefaultColumnDef: () => {
|
|
16
|
+
return {
|
|
17
|
+
aggregatedCell: ({ getValue }) => {
|
|
18
|
+
var _getValue, _getValue$toString;
|
|
19
|
+
return ((_getValue = getValue()) === null || _getValue === void 0 || (_getValue$toString = _getValue.toString) === null || _getValue$toString === void 0 ? void 0 : _getValue$toString.call(_getValue)) ?? null;
|
|
20
|
+
},
|
|
21
|
+
aggregationFn: "auto"
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
getDefaultTableOptions: (table) => {
|
|
25
|
+
return {
|
|
26
|
+
onGroupingChange: makeStateUpdater("grouping", table),
|
|
27
|
+
groupedColumnMode: "reorder"
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
assignCellPrototype: (prototype, table) => {
|
|
31
|
+
assignPrototypeAPIs("columnGroupingFeature", prototype, table, {
|
|
32
|
+
cell_getIsGrouped: { fn: (cell) => cell_getIsGrouped(cell) },
|
|
33
|
+
cell_getIsPlaceholder: { fn: (cell) => cell_getIsPlaceholder(cell) },
|
|
34
|
+
cell_getIsAggregated: { fn: (cell) => cell_getIsAggregated(cell) }
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
assignColumnPrototype: (prototype, table) => {
|
|
38
|
+
assignPrototypeAPIs("columnGroupingFeature", prototype, table, {
|
|
39
|
+
column_toggleGrouping: { fn: (column) => column_toggleGrouping(column) },
|
|
40
|
+
column_getCanGroup: { fn: (column) => column_getCanGroup(column) },
|
|
41
|
+
column_getIsGrouped: { fn: (column) => column_getIsGrouped(column) },
|
|
42
|
+
column_getGroupedIndex: { fn: (column) => column_getGroupedIndex(column) },
|
|
43
|
+
column_getToggleGroupingHandler: { fn: (column) => column_getToggleGroupingHandler(column) },
|
|
44
|
+
column_getAutoAggregationFn: { fn: (column) => column_getAutoAggregationFn(column) },
|
|
45
|
+
column_getAggregationFn: { fn: (column) => column_getAggregationFn(column) }
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
assignRowPrototype: (prototype, table) => {
|
|
49
|
+
assignPrototypeAPIs("columnGroupingFeature", prototype, table, {
|
|
50
|
+
row_getIsGrouped: { fn: (row) => row_getIsGrouped(row) },
|
|
51
|
+
row_getGroupingValue: { fn: (row, columnId) => row_getGroupingValue(row, columnId) }
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
initRowInstanceData: (row) => {
|
|
55
|
+
row._groupingValuesCache = {};
|
|
56
|
+
},
|
|
57
|
+
constructTableAPIs: (table) => {
|
|
58
|
+
assignTableAPIs("columnGroupingFeature", table, {
|
|
59
|
+
table_setGrouping: { fn: (updater) => table_setGrouping(table, updater) },
|
|
60
|
+
table_resetGrouping: { fn: (defaultState) => table_resetGrouping(table, defaultState) }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
75
64
|
|
|
76
65
|
//#endregion
|
|
77
|
-
export { columnGroupingFeature
|
|
66
|
+
export { columnGroupingFeature };
|
|
78
67
|
//# sourceMappingURL=columnGroupingFeature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnGroupingFeature.js","names":[],"sources":["../../../src/features/column-grouping/columnGroupingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n makeStateUpdater,\n} from '../../utils'\nimport {\n cell_getIsAggregated,\n cell_getIsGrouped,\n cell_getIsPlaceholder,\n column_getAggregationFn,\n column_getAutoAggregationFn,\n column_getCanGroup,\n column_getGroupedIndex,\n column_getIsGrouped,\n column_getToggleGroupingHandler,\n column_toggleGrouping,\n getDefaultGroupingState,\n row_getGroupingValue,\n row_getIsGrouped,\n table_resetGrouping,\n table_setGrouping,\n} from './columnGroupingFeature.utils'\nimport type {
|
|
1
|
+
{"version":3,"file":"columnGroupingFeature.js","names":[],"sources":["../../../src/features/column-grouping/columnGroupingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n makeStateUpdater,\n} from '../../utils'\nimport {\n cell_getIsAggregated,\n cell_getIsGrouped,\n cell_getIsPlaceholder,\n column_getAggregationFn,\n column_getAutoAggregationFn,\n column_getCanGroup,\n column_getGroupedIndex,\n column_getIsGrouped,\n column_getToggleGroupingHandler,\n column_toggleGrouping,\n getDefaultGroupingState,\n row_getGroupingValue,\n row_getIsGrouped,\n table_resetGrouping,\n table_setGrouping,\n} from './columnGroupingFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Feature that adds column grouping state, aggregation defaults, and grouped row APIs.\n */\nexport const columnGroupingFeature: TableFeature = {\n getInitialState: (initialState) => {\n return {\n grouping: getDefaultGroupingState(),\n ...initialState,\n }\n },\n\n getDefaultColumnDef: () => {\n return {\n aggregatedCell: ({ getValue }: any) => getValue()?.toString?.() ?? null,\n aggregationFn: 'auto',\n }\n },\n\n getDefaultTableOptions: (table) => {\n return {\n onGroupingChange: makeStateUpdater('grouping', table),\n groupedColumnMode: 'reorder',\n }\n },\n\n assignCellPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnGroupingFeature', prototype, table, {\n cell_getIsGrouped: {\n fn: (cell) => cell_getIsGrouped(cell),\n },\n cell_getIsPlaceholder: {\n fn: (cell) => cell_getIsPlaceholder(cell),\n },\n cell_getIsAggregated: {\n fn: (cell) => cell_getIsAggregated(cell),\n },\n })\n },\n\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnGroupingFeature', prototype, table, {\n column_toggleGrouping: {\n fn: (column) => column_toggleGrouping(column),\n },\n column_getCanGroup: {\n fn: (column) => column_getCanGroup(column),\n },\n column_getIsGrouped: {\n fn: (column) => column_getIsGrouped(column),\n },\n column_getGroupedIndex: {\n fn: (column) => column_getGroupedIndex(column),\n },\n column_getToggleGroupingHandler: {\n fn: (column) => column_getToggleGroupingHandler(column),\n },\n column_getAutoAggregationFn: {\n fn: (column) => column_getAutoAggregationFn(column),\n },\n column_getAggregationFn: {\n fn: (column) => column_getAggregationFn(column),\n },\n })\n },\n\n assignRowPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnGroupingFeature', prototype, table, {\n row_getIsGrouped: {\n fn: (row) => row_getIsGrouped(row),\n },\n row_getGroupingValue: {\n fn: (row, columnId) => row_getGroupingValue(row, columnId),\n },\n })\n },\n\n initRowInstanceData: (row) => {\n ;(row as any)._groupingValuesCache = {}\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnGroupingFeature', table, {\n table_setGrouping: {\n fn: (updater) => table_setGrouping(table, updater),\n },\n table_resetGrouping: {\n fn: (defaultState) => table_resetGrouping(table, defaultState),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AA2BA,MAAa,wB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EA,qBAAqB,UAAU;EAC7B,gBAAgB,yBAAyB,OAAO;GAC9C,mBAAmB,EACjB,KAAK,YAAY,kBAAkB,OAAO,OAAO,EACnD;GACA,qBAAqB,EACnB,KAAK,iBAAiB,oBAAoB,OAAO,YAAY,EAC/D;EACF,CAAC;CACH;AACF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CellData, OnChangeFn, RowData, Updater } from "../../types/type-utils.cjs";
|
|
2
2
|
import { Row } from "../../types/Row.cjs";
|
|
3
3
|
import { ColumnDefTemplate } from "../../types/ColumnDef.cjs";
|
|
4
|
-
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
5
|
-
import { Table } from "../../types/Table.cjs";
|
|
4
|
+
import { IsAny, TableFeatures } from "../../types/TableFeatures.cjs";
|
|
6
5
|
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.cjs";
|
|
7
6
|
import { BuiltInAggregationFn } from "../../fns/aggregationFns.cjs";
|
|
8
7
|
import { Cell } from "../../types/Cell.cjs";
|
|
@@ -12,14 +11,27 @@ type GroupingState = Array<string>;
|
|
|
12
11
|
interface TableState_ColumnGrouping {
|
|
13
12
|
grouping: GroupingState;
|
|
14
13
|
}
|
|
15
|
-
interface RowModelFns_ColumnGrouping<TFeatures extends TableFeatures, TData extends RowData> {
|
|
16
|
-
aggregationFns: Record<
|
|
14
|
+
interface RowModelFns_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
15
|
+
aggregationFns: Record<string, AggregationFn<TFeatures, TData>>;
|
|
17
16
|
}
|
|
18
17
|
interface AggregationFns {}
|
|
19
18
|
type AggregationFn<TFeatures extends TableFeatures, TData extends RowData> = (columnId: string, leafRows: Array<Row<TFeatures, TData>>, childRows: Array<Row<TFeatures, TData>>) => any;
|
|
20
19
|
type CustomAggregationFns<TFeatures extends TableFeatures, TData extends RowData> = Record<string, AggregationFn<TFeatures, TData>>;
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the valid string names for `columnDef.aggregationFn` for a feature
|
|
22
|
+
* set.
|
|
23
|
+
*
|
|
24
|
+
* When the features object declares an `aggregationFns` registry
|
|
25
|
+
* (`tableFeatures({ ..., aggregationFns })`), its keys are the only valid
|
|
26
|
+
* names; a name is only assignable if an aggregation function is actually
|
|
27
|
+
* registered for it. Otherwise this falls back to the global
|
|
28
|
+
* declaration-merged `AggregationFns` interface.
|
|
29
|
+
*/
|
|
30
|
+
type ExtractAggregationFnKeys<TFeatures extends TableFeatures> = IsAny<TFeatures> extends true ? keyof AggregationFns | BuiltInAggregationFn : TFeatures extends {
|
|
31
|
+
aggregationFns: infer TAggregationFns extends object;
|
|
32
|
+
} ? Extract<keyof TAggregationFns, string> : keyof AggregationFns;
|
|
33
|
+
type AggregationFnOption<TFeatures extends TableFeatures, TData extends RowData> = 'auto' | ExtractAggregationFnKeys<TFeatures> | AggregationFn<TFeatures, TData>;
|
|
34
|
+
interface ColumnDef_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
23
35
|
/**
|
|
24
36
|
* The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).
|
|
25
37
|
*/
|
|
@@ -39,7 +51,7 @@ interface ColumnDef_ColumnGrouping<TFeatures extends TableFeatures, TData extend
|
|
|
39
51
|
*/
|
|
40
52
|
getGroupingValue?: (row: TData) => any;
|
|
41
53
|
}
|
|
42
|
-
interface Column_ColumnGrouping<TFeatures extends TableFeatures, TData extends RowData> {
|
|
54
|
+
interface Column_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
43
55
|
/**
|
|
44
56
|
* Returns the aggregation function for the column.
|
|
45
57
|
*/
|
|
@@ -127,7 +139,7 @@ interface TableOptions_ColumnGrouping {
|
|
|
127
139
|
onGroupingChange?: OnChangeFn<GroupingState>;
|
|
128
140
|
}
|
|
129
141
|
type GroupingColumnMode = false | 'reorder' | 'remove';
|
|
130
|
-
interface Table_ColumnGrouping<TFeatures extends TableFeatures, TData extends RowData> {
|
|
142
|
+
interface Table_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
131
143
|
/**
|
|
132
144
|
* Resets `grouping` to `initialState.grouping`.
|
|
133
145
|
*
|
|
@@ -139,7 +151,7 @@ interface Table_ColumnGrouping<TFeatures extends TableFeatures, TData extends Ro
|
|
|
139
151
|
*/
|
|
140
152
|
setGrouping: (updater: Updater<GroupingState>) => void;
|
|
141
153
|
}
|
|
142
|
-
interface Table_RowModels_Grouped<TFeatures extends TableFeatures, TData extends RowData> {
|
|
154
|
+
interface Table_RowModels_Grouped<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
143
155
|
/**
|
|
144
156
|
* Resolves the row model after grouping and aggregation have been applied.
|
|
145
157
|
*/
|
|
@@ -149,17 +161,9 @@ interface Table_RowModels_Grouped<TFeatures extends TableFeatures, TData extends
|
|
|
149
161
|
*/
|
|
150
162
|
getPreGroupedRowModel: () => RowModel<TFeatures, TData>;
|
|
151
163
|
}
|
|
152
|
-
interface
|
|
153
|
-
/**
|
|
154
|
-
* Factory used to retrieve the grouped row model. If using server-side
|
|
155
|
-
* grouping, this is not required. To use client-side grouping, pass
|
|
156
|
-
* `createGroupedRowModel()` or implement your own factory.
|
|
157
|
-
*/
|
|
158
|
-
groupedRowModel?: (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
|
|
159
|
-
}
|
|
160
|
-
interface CachedRowModel_Grouped<TFeatures extends TableFeatures, TData extends RowData> {
|
|
164
|
+
interface CachedRowModel_Grouped<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
161
165
|
groupedRowModel: () => RowModel<TFeatures, TData>;
|
|
162
166
|
}
|
|
163
167
|
//#endregion
|
|
164
|
-
export { AggregationFn, AggregationFnOption, AggregationFns, CachedRowModel_Grouped, Cell_ColumnGrouping, ColumnDef_ColumnGrouping, ColumnDefaultOptions, Column_ColumnGrouping,
|
|
168
|
+
export { AggregationFn, AggregationFnOption, AggregationFns, CachedRowModel_Grouped, Cell_ColumnGrouping, ColumnDef_ColumnGrouping, ColumnDefaultOptions, Column_ColumnGrouping, CustomAggregationFns, ExtractAggregationFnKeys, GroupingColumnMode, GroupingState, RowModelFns_ColumnGrouping, Row_ColumnGrouping, TableOptions_ColumnGrouping, TableState_ColumnGrouping, Table_ColumnGrouping, Table_RowModels_Grouped };
|
|
165
169
|
//# sourceMappingURL=columnGroupingFeature.types.d.cts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CellData, OnChangeFn, RowData, Updater } from "../../types/type-utils.js";
|
|
2
2
|
import { Row } from "../../types/Row.js";
|
|
3
3
|
import { ColumnDefTemplate } from "../../types/ColumnDef.js";
|
|
4
|
-
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
|
-
import { Table } from "../../types/Table.js";
|
|
4
|
+
import { IsAny, TableFeatures } from "../../types/TableFeatures.js";
|
|
6
5
|
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
7
6
|
import { BuiltInAggregationFn } from "../../fns/aggregationFns.js";
|
|
8
7
|
import { Cell } from "../../types/Cell.js";
|
|
@@ -12,14 +11,27 @@ type GroupingState = Array<string>;
|
|
|
12
11
|
interface TableState_ColumnGrouping {
|
|
13
12
|
grouping: GroupingState;
|
|
14
13
|
}
|
|
15
|
-
interface RowModelFns_ColumnGrouping<TFeatures extends TableFeatures, TData extends RowData> {
|
|
16
|
-
aggregationFns: Record<
|
|
14
|
+
interface RowModelFns_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
15
|
+
aggregationFns: Record<string, AggregationFn<TFeatures, TData>>;
|
|
17
16
|
}
|
|
18
17
|
interface AggregationFns {}
|
|
19
18
|
type AggregationFn<TFeatures extends TableFeatures, TData extends RowData> = (columnId: string, leafRows: Array<Row<TFeatures, TData>>, childRows: Array<Row<TFeatures, TData>>) => any;
|
|
20
19
|
type CustomAggregationFns<TFeatures extends TableFeatures, TData extends RowData> = Record<string, AggregationFn<TFeatures, TData>>;
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the valid string names for `columnDef.aggregationFn` for a feature
|
|
22
|
+
* set.
|
|
23
|
+
*
|
|
24
|
+
* When the features object declares an `aggregationFns` registry
|
|
25
|
+
* (`tableFeatures({ ..., aggregationFns })`), its keys are the only valid
|
|
26
|
+
* names; a name is only assignable if an aggregation function is actually
|
|
27
|
+
* registered for it. Otherwise this falls back to the global
|
|
28
|
+
* declaration-merged `AggregationFns` interface.
|
|
29
|
+
*/
|
|
30
|
+
type ExtractAggregationFnKeys<TFeatures extends TableFeatures> = IsAny<TFeatures> extends true ? keyof AggregationFns | BuiltInAggregationFn : TFeatures extends {
|
|
31
|
+
aggregationFns: infer TAggregationFns extends object;
|
|
32
|
+
} ? Extract<keyof TAggregationFns, string> : keyof AggregationFns;
|
|
33
|
+
type AggregationFnOption<TFeatures extends TableFeatures, TData extends RowData> = 'auto' | ExtractAggregationFnKeys<TFeatures> | AggregationFn<TFeatures, TData>;
|
|
34
|
+
interface ColumnDef_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
23
35
|
/**
|
|
24
36
|
* The cell to display each row for the column if the cell is an aggregate. If a function is passed, it will be passed a props object with the context of the cell and should return the property type for your adapter (the exact type depends on the adapter being used).
|
|
25
37
|
*/
|
|
@@ -39,7 +51,7 @@ interface ColumnDef_ColumnGrouping<TFeatures extends TableFeatures, TData extend
|
|
|
39
51
|
*/
|
|
40
52
|
getGroupingValue?: (row: TData) => any;
|
|
41
53
|
}
|
|
42
|
-
interface Column_ColumnGrouping<TFeatures extends TableFeatures, TData extends RowData> {
|
|
54
|
+
interface Column_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
43
55
|
/**
|
|
44
56
|
* Returns the aggregation function for the column.
|
|
45
57
|
*/
|
|
@@ -127,7 +139,7 @@ interface TableOptions_ColumnGrouping {
|
|
|
127
139
|
onGroupingChange?: OnChangeFn<GroupingState>;
|
|
128
140
|
}
|
|
129
141
|
type GroupingColumnMode = false | 'reorder' | 'remove';
|
|
130
|
-
interface Table_ColumnGrouping<TFeatures extends TableFeatures, TData extends RowData> {
|
|
142
|
+
interface Table_ColumnGrouping<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
131
143
|
/**
|
|
132
144
|
* Resets `grouping` to `initialState.grouping`.
|
|
133
145
|
*
|
|
@@ -139,7 +151,7 @@ interface Table_ColumnGrouping<TFeatures extends TableFeatures, TData extends Ro
|
|
|
139
151
|
*/
|
|
140
152
|
setGrouping: (updater: Updater<GroupingState>) => void;
|
|
141
153
|
}
|
|
142
|
-
interface Table_RowModels_Grouped<TFeatures extends TableFeatures, TData extends RowData> {
|
|
154
|
+
interface Table_RowModels_Grouped<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
143
155
|
/**
|
|
144
156
|
* Resolves the row model after grouping and aggregation have been applied.
|
|
145
157
|
*/
|
|
@@ -149,17 +161,9 @@ interface Table_RowModels_Grouped<TFeatures extends TableFeatures, TData extends
|
|
|
149
161
|
*/
|
|
150
162
|
getPreGroupedRowModel: () => RowModel<TFeatures, TData>;
|
|
151
163
|
}
|
|
152
|
-
interface
|
|
153
|
-
/**
|
|
154
|
-
* Factory used to retrieve the grouped row model. If using server-side
|
|
155
|
-
* grouping, this is not required. To use client-side grouping, pass
|
|
156
|
-
* `createGroupedRowModel()` or implement your own factory.
|
|
157
|
-
*/
|
|
158
|
-
groupedRowModel?: (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
|
|
159
|
-
}
|
|
160
|
-
interface CachedRowModel_Grouped<TFeatures extends TableFeatures, TData extends RowData> {
|
|
164
|
+
interface CachedRowModel_Grouped<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
161
165
|
groupedRowModel: () => RowModel<TFeatures, TData>;
|
|
162
166
|
}
|
|
163
167
|
//#endregion
|
|
164
|
-
export { AggregationFn, AggregationFnOption, AggregationFns, CachedRowModel_Grouped, Cell_ColumnGrouping, ColumnDef_ColumnGrouping, ColumnDefaultOptions, Column_ColumnGrouping,
|
|
168
|
+
export { AggregationFn, AggregationFnOption, AggregationFns, CachedRowModel_Grouped, Cell_ColumnGrouping, ColumnDef_ColumnGrouping, ColumnDefaultOptions, Column_ColumnGrouping, CustomAggregationFns, ExtractAggregationFnKeys, GroupingColumnMode, GroupingState, RowModelFns_ColumnGrouping, Row_ColumnGrouping, TableOptions_ColumnGrouping, TableState_ColumnGrouping, Table_ColumnGrouping, Table_RowModels_Grouped };
|
|
165
169
|
//# sourceMappingURL=columnGroupingFeature.types.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, RowData, Updater } from "../../types/type-utils.cjs";
|
|
2
2
|
import { Column_Internal } from "../../types/Column.cjs";
|
|
3
3
|
import { Row } from "../../types/Row.cjs";
|
|
4
|
-
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
5
4
|
import { Table_Internal } from "../../types/Table.cjs";
|
|
5
|
+
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
6
6
|
import { AggregationFn, GroupingState, Row_ColumnGrouping } from "./columnGroupingFeature.types.cjs";
|
|
7
7
|
import { Cell } from "../../types/Cell.cjs";
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, RowData, Updater } from "../../types/type-utils.js";
|
|
2
2
|
import { Column_Internal } from "../../types/Column.js";
|
|
3
3
|
import { Row } from "../../types/Row.js";
|
|
4
|
-
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
4
|
import { Table_Internal } from "../../types/Table.js";
|
|
5
|
+
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
6
|
import { AggregationFn, GroupingState, Row_ColumnGrouping } from "./columnGroupingFeature.types.js";
|
|
7
7
|
import { Cell } from "../../types/Cell.js";
|
|
8
8
|
|
|
@@ -10,11 +10,14 @@ const require_rowExpandingFeature_utils = require('../row-expanding/rowExpanding
|
|
|
10
10
|
* Creates a memoized grouped row model factory.
|
|
11
11
|
*
|
|
12
12
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
13
|
+
*
|
|
14
|
+
* Register aggregation functions with the `aggregationFns` slot on the
|
|
15
|
+
* `features` option:
|
|
16
|
+
* `tableFeatures({ columnGroupingFeature, groupedRowModel: createGroupedRowModel(), aggregationFns })`.
|
|
13
17
|
*/
|
|
14
|
-
function createGroupedRowModel(
|
|
18
|
+
function createGroupedRowModel() {
|
|
15
19
|
return (_table) => {
|
|
16
20
|
const table = _table;
|
|
17
|
-
if (!table._rowModelFns.aggregationFns) table._rowModelFns.aggregationFns = aggregationFns;
|
|
18
21
|
return require_utils.tableMemo({
|
|
19
22
|
feature: "columnGroupingFeature",
|
|
20
23
|
table,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGroupedRowModel.cjs","names":["tableMemo","table_getColumn","flattenBy","constructRow","column_getAggregationFn","row_getGroupingValue"],"sources":["../../../src/features/column-grouping/createGroupedRowModel.ts"],"sourcesContent":["import { flattenBy, tableMemo } from '../../utils'\nimport { constructRow } from '../../core/rows/constructRow'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport { table_autoResetExpanded } from '../row-expanding/rowExpandingFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport {\n column_getAggregationFn,\n row_getGroupingValue,\n} from './columnGroupingFeature.utils'\nimport type { Column } from '../../types/Column'\nimport type {
|
|
1
|
+
{"version":3,"file":"createGroupedRowModel.cjs","names":["tableMemo","table_getColumn","flattenBy","constructRow","column_getAggregationFn","row_getGroupingValue"],"sources":["../../../src/features/column-grouping/createGroupedRowModel.ts"],"sourcesContent":["import { flattenBy, tableMemo } from '../../utils'\nimport { constructRow } from '../../core/rows/constructRow'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport { table_autoResetExpanded } from '../row-expanding/rowExpandingFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport {\n column_getAggregationFn,\n row_getGroupingValue,\n} from './columnGroupingFeature.utils'\nimport type { Column } from '../../types/Column'\nimport type { Row_ColumnGrouping } from './columnGroupingFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized grouped row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n *\n * Register aggregation functions with the `aggregationFns` slot on the\n * `features` option:\n * `tableFeatures({ columnGroupingFeature, groupedRowModel: createGroupedRowModel(), aggregationFns })`.\n */\nexport function createGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table = _table as unknown as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnGroupingFeature',\n table,\n fnName: 'table.getGroupedRowModel',\n memoDeps: () => [\n table.atoms.grouping?.get(),\n table.getPreGroupedRowModel(),\n ],\n fn: () => _createGroupedRowModel(table),\n onAfterUpdate: () => {\n table_autoResetExpanded(table)\n table_autoResetPageIndex(table)\n },\n })\n }\n}\n\nfunction _createGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const rowModel = table.getPreGroupedRowModel()\n const grouping = table.atoms.grouping?.get()\n\n if (!rowModel.rows.length || !grouping?.length) {\n rowModel.rows.forEach((row) => {\n row.depth = 0\n row.parentId = undefined\n })\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter((columnId) =>\n table_getColumn(table, columnId),\n )\n\n const groupedFlatRows: Array<Row<TFeatures, TData>> &\n Partial<Row_ColumnGrouping> = []\n const groupedRowsById: Record<string, Row<TFeatures, TData>> = {}\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n parentId?: string,\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map((row) => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows.length) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId = existingGrouping[depth] as string\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n subRows.forEach((subRow) => {\n subRow.parentId = id\n })\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, (row) => row.subRows)\n : groupedRows\n\n const row = constructRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId,\n ) as Row<TFeatures, TData> & Partial<Row_ColumnGrouping>\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (colId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(colId)) {\n if (row._valuesCache.hasOwnProperty(colId)) {\n return row._valuesCache[colId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[colId] =\n groupedRows[0].getValue(colId) ?? undefined\n }\n\n return row._valuesCache[colId]\n }\n\n if (row._groupingValuesCache?.hasOwnProperty(colId)) {\n return row._groupingValuesCache[colId]\n }\n\n // Aggregate the values\n const column = table.getColumn(colId)\n const aggregateFn = column_getAggregationFn(\n column as Column<TFeatures, TData, unknown>,\n )\n\n if (!row._groupingValuesCache) row._groupingValuesCache = {}\n\n if (aggregateFn) {\n row._groupingValuesCache[colId] = aggregateFn(\n colId,\n leafRows,\n groupedRows,\n )\n\n return row._groupingValuesCache[colId]\n }\n },\n })\n\n subRows.forEach((subRow) => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n })\n\n return row\n },\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach((subRow) => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n}\n\nfunction groupBy<TFeatures extends TableFeatures, TData extends RowData = any>(\n rows: Array<Row<TFeatures, TData>>,\n columnId: string,\n) {\n const groupMap = new Map<any, Array<Row<TFeatures, TData>>>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row_getGroupingValue(row, columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,SAAgB,wBAG0D;CACxE,QAAQ,WAAW;EACjB,MAAM,QAAQ;EACd,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;qCACd,MAAM,MAAM,wFAAU,IAAI,GAC1B,MAAM,sBAAsB,CAC9B;;GACA,UAAU,uBAAuB,KAAK;GACtC,qBAAqB;IACnB,0DAAwB,KAAK;IAC7B,4DAAyB,KAAK;GAChC;EACF,CAAC;CACH;AACF;AAEA,SAAS,uBAGP,OAAqE;;CACrE,MAAM,WAAW,MAAM,sBAAsB;CAC7C,MAAM,qCAAW,MAAM,MAAM,0FAAU,IAAI;CAE3C,IAAI,CAAC,SAAS,KAAK,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SACf,YAAY,EAAE,CAAC,SAAS,KAAK,KAAK;MAGtC,OAAO,IAAI,aAAa;KAC1B;KAEA,6BAAI,IAAI,oGAAsB,eAAe,KAAK,GAChD,OAAO,IAAI,qBAAqB;KAKlC,MAAM,cAAcC,4DADL,MAAM,UAAU,KAExB,CACP;KAEA,IAAI,CAAC,IAAI,sBAAsB,IAAI,uBAAuB,CAAC;KAE3D,IAAI,aAAa;MACf,IAAI,qBAAqB,SAAS,YAChC,OACA,UACA,WACF;MAEA,OAAO,IAAI,qBAAqB;KAClC;IACF;GACF,CAAC;GAED,QAAQ,SAAS,WAAW;IAC1B,gBAAgB,KAAK,MAAM;IAC3B,gBAAgB,OAAO,MAAM;GAC/B,CAAC;GAED,OAAO;EACT,CAGyB;CAC7B;CAEA,MAAM,cAAc,mBAAmB,SAAS,MAAM,CAAC;CAEvD,YAAY,SAAS,WAAW;EAC9B,gBAAgB,KAAK,MAAM;EAC3B,gBAAgB,OAAO,MAAM;CAC/B,CAAC;CAED,OAAO;EACL,MAAM;EACN,UAAU;EACV,UAAU;CACZ;AACF;AAEA,SAAS,QACP,MACA,UACA;CACA,MAAM,2BAAW,IAAI,IAAuC;CAE5D,OAAO,KAAK,QAAQ,KAAK,QAAQ;EAC/B,MAAM,SAAS,GAAGC,yDAAqB,KAAK,QAAQ;EACpD,MAAM,WAAW,IAAI,IAAI,MAAM;EAC/B,IAAI,CAAC,UACH,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC;OAErB,SAAS,KAAK,GAAG;EAEnB,OAAO;CACT,GAAG,QAAQ;AACb"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.cjs";
|
|
2
|
-
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
3
2
|
import { Table } from "../../types/Table.cjs";
|
|
3
|
+
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
4
4
|
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.cjs";
|
|
5
|
-
import { AggregationFn, AggregationFns } from "./columnGroupingFeature.types.cjs";
|
|
6
5
|
|
|
7
6
|
//#region src/features/column-grouping/createGroupedRowModel.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Creates a memoized grouped row model factory.
|
|
10
9
|
*
|
|
11
10
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
11
|
+
*
|
|
12
|
+
* Register aggregation functions with the `aggregationFns` slot on the
|
|
13
|
+
* `features` option:
|
|
14
|
+
* `tableFeatures({ columnGroupingFeature, groupedRowModel: createGroupedRowModel(), aggregationFns })`.
|
|
12
15
|
*/
|
|
13
|
-
declare function createGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData = any>(
|
|
16
|
+
declare function createGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData = any>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
|
|
14
17
|
//#endregion
|
|
15
18
|
export { createGroupedRowModel };
|
|
16
19
|
//# sourceMappingURL=createGroupedRowModel.d.cts.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
3
2
|
import { Table } from "../../types/Table.js";
|
|
3
|
+
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
4
4
|
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
5
|
-
import { AggregationFn, AggregationFns } from "./columnGroupingFeature.types.js";
|
|
6
5
|
|
|
7
6
|
//#region src/features/column-grouping/createGroupedRowModel.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Creates a memoized grouped row model factory.
|
|
10
9
|
*
|
|
11
10
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
11
|
+
*
|
|
12
|
+
* Register aggregation functions with the `aggregationFns` slot on the
|
|
13
|
+
* `features` option:
|
|
14
|
+
* `tableFeatures({ columnGroupingFeature, groupedRowModel: createGroupedRowModel(), aggregationFns })`.
|
|
12
15
|
*/
|
|
13
|
-
declare function createGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData = any>(
|
|
16
|
+
declare function createGroupedRowModel<TFeatures extends TableFeatures, TData extends RowData = any>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData>;
|
|
14
17
|
//#endregion
|
|
15
18
|
export { createGroupedRowModel };
|
|
16
19
|
//# sourceMappingURL=createGroupedRowModel.d.ts.map
|
|
@@ -10,11 +10,14 @@ import { table_autoResetExpanded } from "../row-expanding/rowExpandingFeature.ut
|
|
|
10
10
|
* Creates a memoized grouped row model factory.
|
|
11
11
|
*
|
|
12
12
|
* The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.
|
|
13
|
+
*
|
|
14
|
+
* Register aggregation functions with the `aggregationFns` slot on the
|
|
15
|
+
* `features` option:
|
|
16
|
+
* `tableFeatures({ columnGroupingFeature, groupedRowModel: createGroupedRowModel(), aggregationFns })`.
|
|
13
17
|
*/
|
|
14
|
-
function createGroupedRowModel(
|
|
18
|
+
function createGroupedRowModel() {
|
|
15
19
|
return (_table) => {
|
|
16
20
|
const table = _table;
|
|
17
|
-
if (!table._rowModelFns.aggregationFns) table._rowModelFns.aggregationFns = aggregationFns;
|
|
18
21
|
return tableMemo({
|
|
19
22
|
feature: "columnGroupingFeature",
|
|
20
23
|
table,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGroupedRowModel.js","names":[],"sources":["../../../src/features/column-grouping/createGroupedRowModel.ts"],"sourcesContent":["import { flattenBy, tableMemo } from '../../utils'\nimport { constructRow } from '../../core/rows/constructRow'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport { table_autoResetExpanded } from '../row-expanding/rowExpandingFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport {\n column_getAggregationFn,\n row_getGroupingValue,\n} from './columnGroupingFeature.utils'\nimport type { Column } from '../../types/Column'\nimport type {
|
|
1
|
+
{"version":3,"file":"createGroupedRowModel.js","names":[],"sources":["../../../src/features/column-grouping/createGroupedRowModel.ts"],"sourcesContent":["import { flattenBy, tableMemo } from '../../utils'\nimport { constructRow } from '../../core/rows/constructRow'\nimport { table_getColumn } from '../../core/columns/coreColumnsFeature.utils'\nimport { table_autoResetExpanded } from '../row-expanding/rowExpandingFeature.utils'\nimport { table_autoResetPageIndex } from '../row-pagination/rowPaginationFeature.utils'\nimport {\n column_getAggregationFn,\n row_getGroupingValue,\n} from './columnGroupingFeature.utils'\nimport type { Column } from '../../types/Column'\nimport type { Row_ColumnGrouping } from './columnGroupingFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized grouped row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n *\n * Register aggregation functions with the `aggregationFns` slot on the\n * `features` option:\n * `tableFeatures({ columnGroupingFeature, groupedRowModel: createGroupedRowModel(), aggregationFns })`.\n */\nexport function createGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (table: Table<TFeatures, TData>) => () => RowModel<TFeatures, TData> {\n return (_table) => {\n const table = _table as unknown as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnGroupingFeature',\n table,\n fnName: 'table.getGroupedRowModel',\n memoDeps: () => [\n table.atoms.grouping?.get(),\n table.getPreGroupedRowModel(),\n ],\n fn: () => _createGroupedRowModel(table),\n onAfterUpdate: () => {\n table_autoResetExpanded(table)\n table_autoResetPageIndex(table)\n },\n })\n }\n}\n\nfunction _createGroupedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n const rowModel = table.getPreGroupedRowModel()\n const grouping = table.atoms.grouping?.get()\n\n if (!rowModel.rows.length || !grouping?.length) {\n rowModel.rows.forEach((row) => {\n row.depth = 0\n row.parentId = undefined\n })\n return rowModel\n }\n\n // Filter the grouping list down to columns that exist\n const existingGrouping = grouping.filter((columnId) =>\n table_getColumn(table, columnId),\n )\n\n const groupedFlatRows: Array<Row<TFeatures, TData>> &\n Partial<Row_ColumnGrouping> = []\n const groupedRowsById: Record<string, Row<TFeatures, TData>> = {}\n\n // Recursively group the data\n const groupUpRecursively = (\n rows: Array<Row<TFeatures, TData>>,\n depth = 0,\n parentId?: string,\n ) => {\n // Grouping depth has been been met\n // Stop grouping and simply rewrite thd depth and row relationships\n if (depth >= existingGrouping.length) {\n return rows.map((row) => {\n row.depth = depth\n\n groupedFlatRows.push(row)\n groupedRowsById[row.id] = row\n\n if (row.subRows.length) {\n row.subRows = groupUpRecursively(row.subRows, depth + 1, row.id)\n }\n\n return row\n })\n }\n\n const columnId = existingGrouping[depth] as string\n\n // Group the rows together for this level\n const rowGroupsMap = groupBy(rows, columnId)\n\n // Perform aggregations for each group\n const aggregatedGroupedRows = Array.from(rowGroupsMap.entries()).map(\n ([groupingValue, groupedRows], index) => {\n let id = `${columnId}:${groupingValue}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n subRows.forEach((subRow) => {\n subRow.parentId = id\n })\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, (row) => row.subRows)\n : groupedRows\n\n const row = constructRow(\n table,\n id,\n leafRows[0]!.original,\n index,\n depth,\n undefined,\n parentId,\n ) as Row<TFeatures, TData> & Partial<Row_ColumnGrouping>\n\n Object.assign(row, {\n groupingColumnId: columnId,\n groupingValue,\n subRows,\n leafRows,\n getValue: (colId: string) => {\n // Don't aggregate columns that are in the grouping\n if (existingGrouping.includes(colId)) {\n if (row._valuesCache.hasOwnProperty(colId)) {\n return row._valuesCache[colId]\n }\n\n if (groupedRows[0]) {\n row._valuesCache[colId] =\n groupedRows[0].getValue(colId) ?? undefined\n }\n\n return row._valuesCache[colId]\n }\n\n if (row._groupingValuesCache?.hasOwnProperty(colId)) {\n return row._groupingValuesCache[colId]\n }\n\n // Aggregate the values\n const column = table.getColumn(colId)\n const aggregateFn = column_getAggregationFn(\n column as Column<TFeatures, TData, unknown>,\n )\n\n if (!row._groupingValuesCache) row._groupingValuesCache = {}\n\n if (aggregateFn) {\n row._groupingValuesCache[colId] = aggregateFn(\n colId,\n leafRows,\n groupedRows,\n )\n\n return row._groupingValuesCache[colId]\n }\n },\n })\n\n subRows.forEach((subRow) => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n })\n\n return row\n },\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rowModel.rows, 0)\n\n groupedRows.forEach((subRow) => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n })\n\n return {\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n }\n}\n\nfunction groupBy<TFeatures extends TableFeatures, TData extends RowData = any>(\n rows: Array<Row<TFeatures, TData>>,\n columnId: string,\n) {\n const groupMap = new Map<any, Array<Row<TFeatures, TData>>>()\n\n return rows.reduce((map, row) => {\n const resKey = `${row_getGroupingValue(row, columnId)}`\n const previous = map.get(resKey)\n if (!previous) {\n map.set(resKey, [row])\n } else {\n previous.push(row)\n }\n return map\n }, groupMap)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,SAAgB,wBAG0D;CACxE,QAAQ,WAAW;EACjB,MAAM,QAAQ;EACd,OAAO,UAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;;qCACd,MAAM,MAAM,wFAAU,IAAI,GAC1B,MAAM,sBAAsB,CAC9B;;GACA,UAAU,uBAAuB,KAAK;GACtC,qBAAqB;IACnB,wBAAwB,KAAK;IAC7B,yBAAyB,KAAK;GAChC;EACF,CAAC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