@tanstack/table-core 9.0.0-beta.31 → 9.0.0-beta.34
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.cjs +1 -4
- package/dist/core/cells/constructCell.cjs.map +1 -1
- package/dist/core/cells/constructCell.d.cts +1 -1
- package/dist/core/cells/constructCell.d.ts +1 -1
- package/dist/core/cells/constructCell.js +1 -4
- package/dist/core/cells/constructCell.js.map +1 -1
- package/dist/core/cells/coreCellsFeature.types.d.cts +1 -1
- package/dist/core/cells/coreCellsFeature.types.d.ts +1 -1
- 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.cjs +3 -9
- package/dist/core/columns/constructColumn.cjs.map +1 -1
- package/dist/core/columns/constructColumn.js +3 -9
- package/dist/core/columns/constructColumn.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.cjs +12 -18
- package/dist/core/columns/coreColumnsFeature.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.js +12 -18
- package/dist/core/columns/coreColumnsFeature.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.cjs +2 -6
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.js +2 -6
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs +1 -2
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.js +1 -2
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/constructHeader.cjs +1 -4
- package/dist/core/headers/constructHeader.cjs.map +1 -1
- package/dist/core/headers/constructHeader.js +1 -4
- package/dist/core/headers/constructHeader.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.cjs +8 -11
- package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.js +8 -11
- package/dist/core/headers/coreHeadersFeature.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.cjs +2 -4
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.js +2 -4
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.types.d.cts +3 -3
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +3 -3
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +6 -24
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.js +6 -24
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/core/row-models/createCoreRowModel.cjs +2 -3
- package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
- package/dist/core/row-models/createCoreRowModel.d.cts +1 -1
- package/dist/core/row-models/createCoreRowModel.d.ts +1 -1
- package/dist/core/row-models/createCoreRowModel.js +2 -3
- package/dist/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/core/rows/constructRow.cjs +2 -8
- package/dist/core/rows/constructRow.cjs.map +1 -1
- package/dist/core/rows/constructRow.js +2 -8
- package/dist/core/rows/constructRow.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.cjs +4 -1
- package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.js +4 -1
- package/dist/core/rows/coreRowsFeature.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.ts +1 -1
- package/dist/core/rows/coreRowsFeature.utils.cjs +3 -4
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.cts +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.ts +1 -1
- package/dist/core/rows/coreRowsFeature.utils.js +3 -4
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/constructTable.cjs +4 -10
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.js +4 -10
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/experimental-worker-plugin.cjs +14 -0
- package/dist/experimental-worker-plugin.d.cts +5 -0
- package/dist/experimental-worker-plugin.d.ts +5 -0
- package/dist/experimental-worker-plugin.js +6 -0
- package/dist/features/column-faceting/columnFacetingFeature.cjs +12 -18
- package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.js +12 -18
- package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +7 -25
- 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 +7 -25
- package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs +8 -14
- 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 +8 -14
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +10 -13
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +10 -13
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.cjs +12 -18
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.d.cts +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.d.ts +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.js +12 -18
- package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.cjs +1 -4
- package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.js +1 -4
- package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +4 -4
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +4 -4
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +8 -13
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +2 -2
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +2 -2
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +8 -13
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs +3 -7
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.d.cts +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.d.ts +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.js +3 -7
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.cjs +13 -19
- package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.js +13 -19
- package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +6 -11
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +6 -11
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.cjs +78 -114
- package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.js +78 -114
- package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +15 -28
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +2 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.js +15 -28
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs +12 -16
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.js +12 -16
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.cjs +24 -48
- package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.js +24 -48
- package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +11 -18
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.js +11 -18
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.cjs +25 -40
- package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.js +25 -40
- package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +3 -6
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- 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/column-visibility/columnVisibilityFeature.utils.js +3 -6
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.cjs +1 -2
- package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.js +1 -2
- package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +3 -5
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.js +3 -5
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.cjs +6 -10
- 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 +6 -10
- package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +8 -15
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +8 -15
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.cjs +6 -10
- 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 +6 -10
- package/dist/features/row-pagination/createPaginatedRowModel.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +8 -14
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.js +8 -14
- package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.cjs +4 -16
- package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.js +4 -16
- package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs +7 -12
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.js +7 -12
- package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.cjs +30 -60
- package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.js +30 -60
- package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +11 -18
- 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 +12 -19
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +20 -14
- package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.d.cts +1 -1
- package/dist/features/row-sorting/createSortedRowModel.d.ts +1 -1
- package/dist/features/row-sorting/createSortedRowModel.js +21 -15
- package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +2 -2
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +2 -2
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +10 -14
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.js +10 -14
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/flex-render.d.cts +1 -1
- package/dist/flex-render.d.ts +1 -1
- package/dist/fns/filterFns.cjs +8 -12
- package/dist/fns/filterFns.cjs.map +1 -1
- package/dist/fns/filterFns.js +8 -12
- package/dist/fns/filterFns.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +2 -2
- package/dist/store-reactivity-bindings.cjs +2 -2
- package/dist/store-reactivity-bindings.cjs.map +1 -1
- package/dist/store-reactivity-bindings.js +2 -2
- package/dist/store-reactivity-bindings.js.map +1 -1
- package/dist/types/Cell.d.cts +1 -1
- package/dist/types/Cell.d.ts +1 -1
- package/dist/types/Column.d.cts +7 -7
- package/dist/types/Column.d.ts +7 -7
- package/dist/types/ColumnDef.d.cts +6 -6
- package/dist/types/ColumnDef.d.ts +6 -6
- package/dist/types/Header.d.cts +1 -1
- package/dist/types/Header.d.ts +1 -1
- package/dist/types/Row.d.cts +2 -2
- package/dist/types/Row.d.ts +2 -2
- package/dist/types/RowModel.d.cts +4 -4
- package/dist/types/RowModel.d.ts +4 -4
- package/dist/types/RowModelFns.d.cts +2 -2
- package/dist/types/RowModelFns.d.ts +2 -2
- package/dist/types/Table.d.cts +9 -9
- package/dist/types/Table.d.ts +9 -9
- package/dist/types/TableFeatures.d.cts +4 -4
- package/dist/types/TableFeatures.d.ts +4 -4
- package/dist/types/TableOptions.d.cts +7 -7
- package/dist/types/TableOptions.d.ts +7 -7
- package/dist/types/TableState.d.cts +6 -6
- package/dist/types/TableState.d.ts +6 -6
- package/dist/utils.cjs +23 -12
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +6 -1
- package/dist/utils.d.ts +6 -1
- package/dist/utils.js +23 -13
- package/dist/utils.js.map +1 -1
- package/dist/worker/createTableWorker.cjs +189 -0
- package/dist/worker/createTableWorker.cjs.map +1 -0
- package/dist/worker/createTableWorker.d.cts +102 -0
- package/dist/worker/createTableWorker.d.ts +102 -0
- package/dist/worker/createTableWorker.js +186 -0
- package/dist/worker/createTableWorker.js.map +1 -0
- package/dist/worker/createWorkerRowModel.cjs +78 -0
- package/dist/worker/createWorkerRowModel.cjs.map +1 -0
- package/dist/worker/createWorkerRowModel.d.cts +42 -0
- package/dist/worker/createWorkerRowModel.d.ts +42 -0
- package/dist/worker/createWorkerRowModel.js +78 -0
- package/dist/worker/createWorkerRowModel.js.map +1 -0
- package/dist/worker/initTableWorker.cjs +100 -0
- package/dist/worker/initTableWorker.cjs.map +1 -0
- package/dist/worker/initTableWorker.d.cts +33 -0
- package/dist/worker/initTableWorker.d.ts +33 -0
- package/dist/worker/initTableWorker.js +100 -0
- package/dist/worker/initTableWorker.js.map +1 -0
- package/dist/worker/rebuildRowModel.cjs +72 -0
- package/dist/worker/rebuildRowModel.cjs.map +1 -0
- package/dist/worker/rebuildRowModel.d.cts +9 -0
- package/dist/worker/rebuildRowModel.d.ts +9 -0
- package/dist/worker/rebuildRowModel.js +72 -0
- package/dist/worker/rebuildRowModel.js.map +1 -0
- package/dist/worker/serializeRowModel.cjs +53 -0
- package/dist/worker/serializeRowModel.cjs.map +1 -0
- package/dist/worker/serializeRowModel.js +52 -0
- package/dist/worker/serializeRowModel.js.map +1 -0
- package/dist/worker/tableWorkerProtocol.cjs +29 -0
- package/dist/worker/tableWorkerProtocol.cjs.map +1 -0
- package/dist/worker/tableWorkerProtocol.d.cts +88 -0
- package/dist/worker/tableWorkerProtocol.d.ts +88 -0
- package/dist/worker/tableWorkerProtocol.js +27 -0
- package/dist/worker/tableWorkerProtocol.js.map +1 -0
- package/package.json +6 -2
- package/src/core/rows/coreRowsFeature.ts +1 -0
- package/src/experimental-worker-plugin.ts +22 -0
- package/src/features/row-selection/rowSelectionFeature.utils.ts +2 -1
- package/src/features/row-sorting/createSortedRowModel.ts +31 -10
- package/src/features/row-sorting/rowSortingFeature.utils.ts +2 -10
- package/src/utils.ts +21 -0
- package/src/worker/createTableWorker.ts +357 -0
- package/src/worker/createWorkerRowModel.ts +121 -0
- package/src/worker/initTableWorker.ts +164 -0
- package/src/worker/rebuildRowModel.ts +117 -0
- package/src/worker/serializeRowModel.ts +80 -0
- package/src/worker/tableWorkerProtocol.ts +105 -0
|
@@ -8,10 +8,7 @@ function getCellPrototype(table) {
|
|
|
8
8
|
if (!table._cellPrototype) {
|
|
9
9
|
table._cellPrototype = { table };
|
|
10
10
|
const features = Object.values(table._features);
|
|
11
|
-
for (let i = 0; i < features.length; i++)
|
|
12
|
-
var _assignCellPrototype, _ref;
|
|
13
|
-
(_assignCellPrototype = (_ref = features[i]).assignCellPrototype) === null || _assignCellPrototype === void 0 || _assignCellPrototype.call(_ref, table._cellPrototype, table);
|
|
14
|
-
}
|
|
11
|
+
for (let i = 0; i < features.length; i++) features[i].assignCellPrototype?.(table._cellPrototype, table);
|
|
15
12
|
}
|
|
16
13
|
return table._cellPrototype;
|
|
17
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructCell.cjs","names":[],"sources":["../../../src/core/cells/constructCell.ts"],"sourcesContent":["import type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type { Column } from '../../types/Column'\nimport type { Cell_CoreProperties } from './coreCellsFeature.types'\n\n/**\n * Creates or retrieves the cell prototype for a table.\n * The prototype is cached on the table and shared by all cell instances.\n */\nfunction getCellPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._cellPrototype) {\n table._cellPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignCellPrototype?.(table._cellPrototype, table)\n }\n }\n return table._cellPrototype\n}\n\n/**\n * Constructs a cell instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructCell<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n row: Row<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): Cell<TFeatures, TData, TValue> {\n // Create cell with shared prototype for memory efficiency\n const cellPrototype = getCellPrototype(table)\n const cell = Object.create(cellPrototype) as Cell_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n cell.column = column\n cell.id = `${row.id}_${column.id}`\n cell.row = row\n\n return cell as Cell<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;;AAYA,SAAS,iBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,gBAAgB;EACzB,MAAM,iBAAiB,EAAE,MAAM;EAC/B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"constructCell.cjs","names":[],"sources":["../../../src/core/cells/constructCell.ts"],"sourcesContent":["import type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type { Column } from '../../types/Column'\nimport type { Cell_CoreProperties } from './coreCellsFeature.types'\n\n/**\n * Creates or retrieves the cell prototype for a table.\n * The prototype is cached on the table and shared by all cell instances.\n */\nfunction getCellPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._cellPrototype) {\n table._cellPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignCellPrototype?.(table._cellPrototype, table)\n }\n }\n return table._cellPrototype\n}\n\n/**\n * Constructs a cell instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructCell<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n row: Row<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): Cell<TFeatures, TData, TValue> {\n // Create cell with shared prototype for memory efficiency\n const cellPrototype = getCellPrototype(table)\n const cell = Object.create(cellPrototype) as Cell_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n cell.column = column\n cell.id = `${row.id}_${column.id}`\n cell.row = row\n\n return cell as Cell<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;;AAYA,SAAS,iBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,gBAAgB;EACzB,MAAM,iBAAiB,EAAE,MAAM;EAC/B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,sBAAsB,MAAM,gBAAgB,KAAK;CAElE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,SAAgB,cAKd,QACA,KACA,OACgC;CAEhC,MAAM,gBAAgB,iBAAiB,KAAK;CAC5C,MAAM,OAAO,OAAO,OAAO,aAAa;CAOxC,KAAK,SAAS;CACd,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,OAAO;CAC9B,KAAK,MAAM;CAEX,OAAO;AACT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.cjs";
|
|
2
|
+
import { Cell } from "../../types/Cell.cjs";
|
|
2
3
|
import { Row } from "../../types/Row.cjs";
|
|
3
4
|
import { Table } from "../../types/Table.cjs";
|
|
4
5
|
import { Column } from "../../types/Column.cjs";
|
|
5
6
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
6
|
-
import { Cell } from "../../types/Cell.cjs";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/constructCell.d.ts
|
|
9
9
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.js";
|
|
2
|
+
import { Cell } from "../../types/Cell.js";
|
|
2
3
|
import { Row } from "../../types/Row.js";
|
|
3
4
|
import { Table } from "../../types/Table.js";
|
|
4
5
|
import { Column } from "../../types/Column.js";
|
|
5
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
|
-
import { Cell } from "../../types/Cell.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/constructCell.d.ts
|
|
9
9
|
/**
|
|
@@ -7,10 +7,7 @@ function getCellPrototype(table) {
|
|
|
7
7
|
if (!table._cellPrototype) {
|
|
8
8
|
table._cellPrototype = { table };
|
|
9
9
|
const features = Object.values(table._features);
|
|
10
|
-
for (let i = 0; i < features.length; i++)
|
|
11
|
-
var _assignCellPrototype, _ref;
|
|
12
|
-
(_assignCellPrototype = (_ref = features[i]).assignCellPrototype) === null || _assignCellPrototype === void 0 || _assignCellPrototype.call(_ref, table._cellPrototype, table);
|
|
13
|
-
}
|
|
10
|
+
for (let i = 0; i < features.length; i++) features[i].assignCellPrototype?.(table._cellPrototype, table);
|
|
14
11
|
}
|
|
15
12
|
return table._cellPrototype;
|
|
16
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructCell.js","names":[],"sources":["../../../src/core/cells/constructCell.ts"],"sourcesContent":["import type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type { Column } from '../../types/Column'\nimport type { Cell_CoreProperties } from './coreCellsFeature.types'\n\n/**\n * Creates or retrieves the cell prototype for a table.\n * The prototype is cached on the table and shared by all cell instances.\n */\nfunction getCellPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._cellPrototype) {\n table._cellPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignCellPrototype?.(table._cellPrototype, table)\n }\n }\n return table._cellPrototype\n}\n\n/**\n * Constructs a cell instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructCell<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n row: Row<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): Cell<TFeatures, TData, TValue> {\n // Create cell with shared prototype for memory efficiency\n const cellPrototype = getCellPrototype(table)\n const cell = Object.create(cellPrototype) as Cell_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n cell.column = column\n cell.id = `${row.id}_${column.id}`\n cell.row = row\n\n return cell as Cell<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;AAYA,SAAS,iBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,gBAAgB;EACzB,MAAM,iBAAiB,EAAE,MAAM;EAC/B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"constructCell.js","names":[],"sources":["../../../src/core/cells/constructCell.ts"],"sourcesContent":["import type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Row } from '../../types/Row'\nimport type { Cell } from '../../types/Cell'\nimport type { Column } from '../../types/Column'\nimport type { Cell_CoreProperties } from './coreCellsFeature.types'\n\n/**\n * Creates or retrieves the cell prototype for a table.\n * The prototype is cached on the table and shared by all cell instances.\n */\nfunction getCellPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._cellPrototype) {\n table._cellPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignCellPrototype?.(table._cellPrototype, table)\n }\n }\n return table._cellPrototype\n}\n\n/**\n * Constructs a cell instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructCell<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n row: Row<TFeatures, TData>,\n table: Table_Internal<TFeatures, TData>,\n): Cell<TFeatures, TData, TValue> {\n // Create cell with shared prototype for memory efficiency\n const cellPrototype = getCellPrototype(table)\n const cell = Object.create(cellPrototype) as Cell_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n cell.column = column\n cell.id = `${row.id}_${column.id}`\n cell.row = row\n\n return cell as Cell<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;AAYA,SAAS,iBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,gBAAgB;EACzB,MAAM,iBAAiB,EAAE,MAAM;EAC/B,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,sBAAsB,MAAM,gBAAgB,KAAK;CAElE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,SAAgB,cAKd,QACA,KACA,OACgC;CAEhC,MAAM,gBAAgB,iBAAiB,KAAK;CAC5C,MAAM,OAAO,OAAO,OAAO,aAAa;CAOxC,KAAK,SAAS;CACd,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,OAAO;CAC9B,KAAK,MAAM;CAEX,OAAO;AACT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, Getter, RowData } from "../../types/type-utils.cjs";
|
|
2
|
+
import { Cell } from "../../types/Cell.cjs";
|
|
2
3
|
import { Row } from "../../types/Row.cjs";
|
|
3
4
|
import { Table } from "../../types/Table.cjs";
|
|
4
5
|
import { Column } from "../../types/Column.cjs";
|
|
5
6
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
6
|
-
import { Cell } from "../../types/Cell.cjs";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/coreCellsFeature.types.d.ts
|
|
9
9
|
interface CellContext<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, Getter, RowData } from "../../types/type-utils.js";
|
|
2
|
+
import { Cell } from "../../types/Cell.js";
|
|
2
3
|
import { Row } from "../../types/Row.js";
|
|
3
4
|
import { Table } from "../../types/Table.js";
|
|
4
5
|
import { Column } from "../../types/Column.js";
|
|
5
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
|
-
import { Cell } from "../../types/Cell.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/cells/coreCellsFeature.types.d.ts
|
|
9
9
|
interface CellContext<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, NoInfer, RowData } from "../../types/type-utils.cjs";
|
|
2
|
+
import { Cell } from "../../types/Cell.cjs";
|
|
2
3
|
import { Row } from "../../types/Row.cjs";
|
|
3
4
|
import { Table } from "../../types/Table.cjs";
|
|
4
5
|
import { Column } from "../../types/Column.cjs";
|
|
5
6
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
6
|
-
import { Cell } from "../../types/Cell.cjs";
|
|
7
7
|
//#region src/core/cells/coreCellsFeature.utils.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Reads this cell's accessor value from its owning row and column.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CellData, NoInfer, RowData } from "../../types/type-utils.js";
|
|
2
|
+
import { Cell } from "../../types/Cell.js";
|
|
2
3
|
import { Row } from "../../types/Row.js";
|
|
3
4
|
import { Table } from "../../types/Table.js";
|
|
4
5
|
import { Column } from "../../types/Column.js";
|
|
5
6
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
6
|
-
import { Cell } from "../../types/Cell.js";
|
|
7
7
|
//#region src/core/cells/coreCellsFeature.utils.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Reads this cell's accessor value from its owning row and column.
|
|
@@ -8,10 +8,7 @@ function getColumnPrototype(table) {
|
|
|
8
8
|
if (!table._columnPrototype) {
|
|
9
9
|
table._columnPrototype = { table };
|
|
10
10
|
const features = Object.values(table._features);
|
|
11
|
-
for (let i = 0; i < features.length; i++)
|
|
12
|
-
var _assignColumnPrototyp, _ref;
|
|
13
|
-
(_assignColumnPrototyp = (_ref = features[i]).assignColumnPrototype) === null || _assignColumnPrototyp === void 0 || _assignColumnPrototyp.call(_ref, table._columnPrototype, table);
|
|
14
|
-
}
|
|
11
|
+
for (let i = 0; i < features.length; i++) features[i].assignColumnPrototype?.(table._columnPrototype, table);
|
|
15
12
|
}
|
|
16
13
|
return table._columnPrototype;
|
|
17
14
|
}
|
|
@@ -35,7 +32,7 @@ function constructColumn(table, columnDef, depth, parent) {
|
|
|
35
32
|
let result = originalRow;
|
|
36
33
|
for (let i = 0; i < keys.length; i++) {
|
|
37
34
|
const key = keys[i];
|
|
38
|
-
result = result
|
|
35
|
+
result = result?.[key];
|
|
39
36
|
if (process.env.NODE_ENV === "development" && result === void 0) console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
|
|
40
37
|
}
|
|
41
38
|
return result;
|
|
@@ -54,10 +51,7 @@ function constructColumn(table, columnDef, depth, parent) {
|
|
|
54
51
|
column.id = `${String(id)}`;
|
|
55
52
|
column.parent = parent;
|
|
56
53
|
const features = Object.values(table._features);
|
|
57
|
-
for (let i = 0; i < features.length; i++)
|
|
58
|
-
var _initColumnInstanceDa, _ref2;
|
|
59
|
-
(_initColumnInstanceDa = (_ref2 = features[i]).initColumnInstanceData) === null || _initColumnInstanceDa === void 0 || _initColumnInstanceDa.call(_ref2, column);
|
|
60
|
-
}
|
|
54
|
+
for (let i = 0; i < features.length; i++) features[i].initColumnInstanceData?.(column);
|
|
61
55
|
return column;
|
|
62
56
|
}
|
|
63
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructColumn.cjs","names":[],"sources":["../../../src/core/columns/constructColumn.ts"],"sourcesContent":["import {} from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n AccessorFn,\n ColumnDef,\n ColumnDefResolved,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\nimport type { Column_CoreProperties } from './coreColumnsFeature.types'\n\n/**\n * Creates or retrieves the column prototype for a table.\n * The prototype is cached on the table and shared by all column instances.\n */\nfunction getColumnPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._columnPrototype) {\n table._columnPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignColumnPrototype?.(table._columnPrototype, table)\n }\n }\n return table._columnPrototype\n}\n\n/**\n * Constructs a column instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnDef: ColumnDef<TFeatures, TData, TValue>,\n depth: number,\n parent?: Column<TFeatures, TData, TValue>,\n): Column<TFeatures, TData, TValue> {\n const defaultColumn = table.getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved<{}, TData, TValue>\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n const id =\n resolvedColumnDef.id ??\n (accessorKey ? accessorKey.replaceAll('.', '_') : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn<TData, TValue> | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n const keys = accessorKey.split('.')\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record<string, any> | undefined\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n result = result?.[key]\n if (process.env.NODE_ENV === 'development' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`,\n )\n }\n }\n\n return result as TValue\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `coreColumnsFeature require an id when using an accessorFn`\n : `coreColumnsFeature require an id when using a non-string header`,\n )\n }\n throw new Error()\n }\n\n // Create column with shared prototype for memory efficiency\n const columnPrototype = getColumnPrototype(table)\n const column = Object.create(columnPrototype) as Column_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n column.accessorFn = accessorFn\n column.columnDef = resolvedColumnDef as ColumnDef<TFeatures, TData, TValue>\n column.columns = []\n column.depth = depth\n column.id = `${String(id)}`\n column.parent = parent\n\n // Initialize instance-specific data for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initColumnInstanceData?.(column)\n }\n\n return column as Column<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;;AAgBA,SAAS,mBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,kBAAkB;EAC3B,MAAM,mBAAmB,EAAE,MAAM;EACjC,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"constructColumn.cjs","names":[],"sources":["../../../src/core/columns/constructColumn.ts"],"sourcesContent":["import {} from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n AccessorFn,\n ColumnDef,\n ColumnDefResolved,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\nimport type { Column_CoreProperties } from './coreColumnsFeature.types'\n\n/**\n * Creates or retrieves the column prototype for a table.\n * The prototype is cached on the table and shared by all column instances.\n */\nfunction getColumnPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._columnPrototype) {\n table._columnPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignColumnPrototype?.(table._columnPrototype, table)\n }\n }\n return table._columnPrototype\n}\n\n/**\n * Constructs a column instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnDef: ColumnDef<TFeatures, TData, TValue>,\n depth: number,\n parent?: Column<TFeatures, TData, TValue>,\n): Column<TFeatures, TData, TValue> {\n const defaultColumn = table.getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved<{}, TData, TValue>\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n const id =\n resolvedColumnDef.id ??\n (accessorKey ? accessorKey.replaceAll('.', '_') : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn<TData, TValue> | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n const keys = accessorKey.split('.')\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record<string, any> | undefined\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n result = result?.[key]\n if (process.env.NODE_ENV === 'development' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`,\n )\n }\n }\n\n return result as TValue\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `coreColumnsFeature require an id when using an accessorFn`\n : `coreColumnsFeature require an id when using a non-string header`,\n )\n }\n throw new Error()\n }\n\n // Create column with shared prototype for memory efficiency\n const columnPrototype = getColumnPrototype(table)\n const column = Object.create(columnPrototype) as Column_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n column.accessorFn = accessorFn\n column.columnDef = resolvedColumnDef as ColumnDef<TFeatures, TData, TValue>\n column.columns = []\n column.depth = depth\n column.id = `${String(id)}`\n column.parent = parent\n\n // Initialize instance-specific data for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initColumnInstanceData?.(column)\n }\n\n return column as Column<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;;AAgBA,SAAS,mBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,kBAAkB;EAC3B,MAAM,mBAAmB,EAAE,MAAM;EACjC,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,wBAAwB,MAAM,kBAAkB,KAAK;CAEtE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,SAAgB,gBAKd,OACA,WACA,OACA,QACkC;CAGlC,MAAM,oBAAoB;EACxB,GAHoB,MAAM,oBAGX;EACf,GAAG;CACL;CAEA,MAAM,cAAc,kBAAkB;CAEtC,MAAM,KACJ,kBAAkB,OACjB,cAAc,YAAY,WAAW,KAAK,GAAG,IAAI,YACjD,OAAO,kBAAkB,WAAW,WACjC,kBAAkB,SAClB;CAEN,IAAI;CAEJ,IAAI,kBAAkB,YACpB,aAAa,kBAAkB;MAC1B,IAAI,aAET,IAAI,YAAY,SAAS,GAAG,GAAG;EAC7B,MAAM,OAAO,YAAY,MAAM,GAAG;EAClC,cAAc,gBAAuB;GACnC,IAAI,SAAS;GAEb,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;IACpC,MAAM,MAAM,KAAK;IACjB,SAAS,SAAS;IAClB,IAAI,QAAQ,IAAI,aAAa,iBAAiB,WAAW,QACvD,QAAQ,KACN,IAAI,IAAI,0BAA0B,YAAY,sBAChD;GAEJ;GAEA,OAAO;EACT;CACF,OACE,cAAc,gBACX,YAAoB,kBAAkB;CAI7C,IAAI,CAAC,IAAI;EACP,IAAI,QAAQ,IAAI,aAAa,eAC3B,MAAM,IAAI,MACR,kBAAkB,aACd,8DACA,iEACN;EAEF,MAAM,IAAI,MAAM;CAClB;CAGA,MAAM,kBAAkB,mBAAmB,KAAK;CAChD,MAAM,SAAS,OAAO,OAAO,eAAe;CAO5C,OAAO,aAAa;CACpB,OAAO,YAAY;CACnB,OAAO,UAAU,CAAC;CAClB,OAAO,QAAQ;CACf,OAAO,KAAK,GAAG,OAAO,EAAE;CACxB,OAAO,SAAS;CAGhB,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,yBAAyB,MAAM;CAG9C,OAAO;AACT"}
|
|
@@ -7,10 +7,7 @@ function getColumnPrototype(table) {
|
|
|
7
7
|
if (!table._columnPrototype) {
|
|
8
8
|
table._columnPrototype = { table };
|
|
9
9
|
const features = Object.values(table._features);
|
|
10
|
-
for (let i = 0; i < features.length; i++)
|
|
11
|
-
var _assignColumnPrototyp, _ref;
|
|
12
|
-
(_assignColumnPrototyp = (_ref = features[i]).assignColumnPrototype) === null || _assignColumnPrototyp === void 0 || _assignColumnPrototyp.call(_ref, table._columnPrototype, table);
|
|
13
|
-
}
|
|
10
|
+
for (let i = 0; i < features.length; i++) features[i].assignColumnPrototype?.(table._columnPrototype, table);
|
|
14
11
|
}
|
|
15
12
|
return table._columnPrototype;
|
|
16
13
|
}
|
|
@@ -34,7 +31,7 @@ function constructColumn(table, columnDef, depth, parent) {
|
|
|
34
31
|
let result = originalRow;
|
|
35
32
|
for (let i = 0; i < keys.length; i++) {
|
|
36
33
|
const key = keys[i];
|
|
37
|
-
result = result
|
|
34
|
+
result = result?.[key];
|
|
38
35
|
if (process.env.NODE_ENV === "development" && result === void 0) console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
|
|
39
36
|
}
|
|
40
37
|
return result;
|
|
@@ -53,10 +50,7 @@ function constructColumn(table, columnDef, depth, parent) {
|
|
|
53
50
|
column.id = `${String(id)}`;
|
|
54
51
|
column.parent = parent;
|
|
55
52
|
const features = Object.values(table._features);
|
|
56
|
-
for (let i = 0; i < features.length; i++)
|
|
57
|
-
var _initColumnInstanceDa, _ref2;
|
|
58
|
-
(_initColumnInstanceDa = (_ref2 = features[i]).initColumnInstanceData) === null || _initColumnInstanceDa === void 0 || _initColumnInstanceDa.call(_ref2, column);
|
|
59
|
-
}
|
|
53
|
+
for (let i = 0; i < features.length; i++) features[i].initColumnInstanceData?.(column);
|
|
60
54
|
return column;
|
|
61
55
|
}
|
|
62
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructColumn.js","names":[],"sources":["../../../src/core/columns/constructColumn.ts"],"sourcesContent":["import {} from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n AccessorFn,\n ColumnDef,\n ColumnDefResolved,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\nimport type { Column_CoreProperties } from './coreColumnsFeature.types'\n\n/**\n * Creates or retrieves the column prototype for a table.\n * The prototype is cached on the table and shared by all column instances.\n */\nfunction getColumnPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._columnPrototype) {\n table._columnPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignColumnPrototype?.(table._columnPrototype, table)\n }\n }\n return table._columnPrototype\n}\n\n/**\n * Constructs a column instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnDef: ColumnDef<TFeatures, TData, TValue>,\n depth: number,\n parent?: Column<TFeatures, TData, TValue>,\n): Column<TFeatures, TData, TValue> {\n const defaultColumn = table.getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved<{}, TData, TValue>\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n const id =\n resolvedColumnDef.id ??\n (accessorKey ? accessorKey.replaceAll('.', '_') : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn<TData, TValue> | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n const keys = accessorKey.split('.')\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record<string, any> | undefined\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n result = result?.[key]\n if (process.env.NODE_ENV === 'development' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`,\n )\n }\n }\n\n return result as TValue\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `coreColumnsFeature require an id when using an accessorFn`\n : `coreColumnsFeature require an id when using a non-string header`,\n )\n }\n throw new Error()\n }\n\n // Create column with shared prototype for memory efficiency\n const columnPrototype = getColumnPrototype(table)\n const column = Object.create(columnPrototype) as Column_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n column.accessorFn = accessorFn\n column.columnDef = resolvedColumnDef as ColumnDef<TFeatures, TData, TValue>\n column.columns = []\n column.depth = depth\n column.id = `${String(id)}`\n column.parent = parent\n\n // Initialize instance-specific data for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initColumnInstanceData?.(column)\n }\n\n return column as Column<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;AAgBA,SAAS,mBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,kBAAkB;EAC3B,MAAM,mBAAmB,EAAE,MAAM;EACjC,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,
|
|
1
|
+
{"version":3,"file":"constructColumn.js","names":[],"sources":["../../../src/core/columns/constructColumn.ts"],"sourcesContent":["import {} from '../../utils'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n AccessorFn,\n ColumnDef,\n ColumnDefResolved,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\nimport type { Column_CoreProperties } from './coreColumnsFeature.types'\n\n/**\n * Creates or retrieves the column prototype for a table.\n * The prototype is cached on the table and shared by all column instances.\n */\nfunction getColumnPrototype<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): object {\n if (!table._columnPrototype) {\n table._columnPrototype = { table }\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.assignColumnPrototype?.(table._columnPrototype, table)\n }\n }\n return table._columnPrototype\n}\n\n/**\n * Constructs a column instance from normalized table internals.\n *\n * This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.\n */\nexport function constructColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnDef: ColumnDef<TFeatures, TData, TValue>,\n depth: number,\n parent?: Column<TFeatures, TData, TValue>,\n): Column<TFeatures, TData, TValue> {\n const defaultColumn = table.getDefaultColumnDef()\n\n const resolvedColumnDef = {\n ...defaultColumn,\n ...columnDef,\n } as ColumnDefResolved<{}, TData, TValue>\n\n const accessorKey = resolvedColumnDef.accessorKey\n\n const id =\n resolvedColumnDef.id ??\n (accessorKey ? accessorKey.replaceAll('.', '_') : undefined) ??\n (typeof resolvedColumnDef.header === 'string'\n ? resolvedColumnDef.header\n : undefined)\n\n let accessorFn: AccessorFn<TData, TValue> | undefined\n\n if (resolvedColumnDef.accessorFn) {\n accessorFn = resolvedColumnDef.accessorFn\n } else if (accessorKey) {\n // Support deep accessor keys\n if (accessorKey.includes('.')) {\n const keys = accessorKey.split('.')\n accessorFn = (originalRow: TData) => {\n let result = originalRow as Record<string, any> | undefined\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n result = result?.[key]\n if (process.env.NODE_ENV === 'development' && result === undefined) {\n console.warn(\n `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`,\n )\n }\n }\n\n return result as TValue\n }\n } else {\n accessorFn = (originalRow: TData) =>\n (originalRow as any)[resolvedColumnDef.accessorKey]\n }\n }\n\n if (!id) {\n if (process.env.NODE_ENV === 'development') {\n throw new Error(\n resolvedColumnDef.accessorFn\n ? `coreColumnsFeature require an id when using an accessorFn`\n : `coreColumnsFeature require an id when using a non-string header`,\n )\n }\n throw new Error()\n }\n\n // Create column with shared prototype for memory efficiency\n const columnPrototype = getColumnPrototype(table)\n const column = Object.create(columnPrototype) as Column_CoreProperties<\n TFeatures,\n TData,\n TValue\n >\n\n // Only assign instance-specific properties\n column.accessorFn = accessorFn\n column.columnDef = resolvedColumnDef as ColumnDef<TFeatures, TData, TValue>\n column.columns = []\n column.depth = depth\n column.id = `${String(id)}`\n column.parent = parent\n\n // Initialize instance-specific data for features that need it\n const features = Object.values(table._features)\n for (let i = 0; i < features.length; i++) {\n features[i]!.initColumnInstanceData?.(column)\n }\n\n return column as Column<TFeatures, TData, TValue>\n}\n"],"mappings":";;;;;AAgBA,SAAS,mBAGP,OAAiD;CACjD,IAAI,CAAC,MAAM,kBAAkB;EAC3B,MAAM,mBAAmB,EAAE,MAAM;EACjC,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;EAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,wBAAwB,MAAM,kBAAkB,KAAK;CAEtE;CACA,OAAO,MAAM;AACf;;;;;;AAOA,SAAgB,gBAKd,OACA,WACA,OACA,QACkC;CAGlC,MAAM,oBAAoB;EACxB,GAHoB,MAAM,oBAGX;EACf,GAAG;CACL;CAEA,MAAM,cAAc,kBAAkB;CAEtC,MAAM,KACJ,kBAAkB,OACjB,cAAc,YAAY,WAAW,KAAK,GAAG,IAAI,YACjD,OAAO,kBAAkB,WAAW,WACjC,kBAAkB,SAClB;CAEN,IAAI;CAEJ,IAAI,kBAAkB,YACpB,aAAa,kBAAkB;MAC1B,IAAI,aAET,IAAI,YAAY,SAAS,GAAG,GAAG;EAC7B,MAAM,OAAO,YAAY,MAAM,GAAG;EAClC,cAAc,gBAAuB;GACnC,IAAI,SAAS;GAEb,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;IACpC,MAAM,MAAM,KAAK;IACjB,SAAS,SAAS;IAClB,IAAI,QAAQ,IAAI,aAAa,iBAAiB,WAAW,QACvD,QAAQ,KACN,IAAI,IAAI,0BAA0B,YAAY,sBAChD;GAEJ;GAEA,OAAO;EACT;CACF,OACE,cAAc,gBACX,YAAoB,kBAAkB;CAI7C,IAAI,CAAC,IAAI;EACP,IAAI,QAAQ,IAAI,aAAa,eAC3B,MAAM,IAAI,MACR,kBAAkB,aACd,8DACA,iEACN;EAEF,MAAM,IAAI,MAAM;CAClB;CAGA,MAAM,kBAAkB,mBAAmB,KAAK;CAChD,MAAM,SAAS,OAAO,OAAO,eAAe;CAO5C,OAAO,aAAa;CACpB,OAAO,YAAY;CACnB,OAAO,UAAU,CAAC;CAClB,OAAO,QAAQ;CACf,OAAO,KAAK,GAAG,OAAO,EAAE;CACxB,OAAO,SAAS;CAGhB,MAAM,WAAW,OAAO,OAAO,MAAM,SAAS;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,SAAS,EAAE,CAAE,yBAAyB,MAAM;CAG9C,OAAO;AACT"}
|
|
@@ -14,15 +14,12 @@ const coreColumnsFeature = {
|
|
|
14
14
|
},
|
|
15
15
|
column_getLeafColumns: {
|
|
16
16
|
fn: (column) => require_coreColumnsFeature_utils.column_getLeafColumns(column),
|
|
17
|
-
memoDeps: (column) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
column.table.options.groupedColumnMode
|
|
24
|
-
];
|
|
25
|
-
}
|
|
17
|
+
memoDeps: (column) => [
|
|
18
|
+
column.table.atoms.columnOrder?.get(),
|
|
19
|
+
column.table.atoms.grouping?.get(),
|
|
20
|
+
column.table.options.columns,
|
|
21
|
+
column.table.options.groupedColumnMode
|
|
22
|
+
]
|
|
26
23
|
}
|
|
27
24
|
});
|
|
28
25
|
},
|
|
@@ -46,15 +43,12 @@ const coreColumnsFeature = {
|
|
|
46
43
|
},
|
|
47
44
|
table_getAllLeafColumns: {
|
|
48
45
|
fn: () => require_coreColumnsFeature_utils.table_getAllLeafColumns(table),
|
|
49
|
-
memoDeps: () =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
table.options.groupedColumnMode
|
|
56
|
-
];
|
|
57
|
-
}
|
|
46
|
+
memoDeps: () => [
|
|
47
|
+
table.atoms.columnOrder?.get(),
|
|
48
|
+
table.atoms.grouping?.get(),
|
|
49
|
+
table.options.columns,
|
|
50
|
+
table.options.groupedColumnMode
|
|
51
|
+
]
|
|
58
52
|
},
|
|
59
53
|
table_getAllLeafColumnsById: {
|
|
60
54
|
fn: () => require_coreColumnsFeature_utils.table_getAllLeafColumnsById(table),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreColumnsFeature.cjs","names":["column_getFlatColumns","column_getLeafColumns","table_getDefaultColumnDef","table_getAllColumns","table_getAllFlatColumns","table_getAllFlatColumnsById","table_getAllLeafColumns","table_getAllLeafColumnsById","table_getColumn"],"sources":["../../../src/core/columns/coreColumnsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n column_getFlatColumns,\n column_getLeafColumns,\n table_getAllColumns,\n table_getAllFlatColumns,\n table_getAllFlatColumnsById,\n table_getAllLeafColumns,\n table_getAllLeafColumnsById,\n table_getColumn,\n table_getDefaultColumnDef,\n} from './coreColumnsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that builds the column tree and exposes table/column column APIs.\n */\nexport const coreColumnsFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreColumnsFeature', prototype, table, {\n column_getFlatColumns: {\n fn: (column) => column_getFlatColumns(column),\n memoDeps: (column) => [column.table.options.columns],\n },\n column_getLeafColumns: {\n fn: (column) => column_getLeafColumns(column),\n memoDeps: (column) => [\n column.table.atoms.columnOrder?.get(),\n column.table.atoms.grouping?.get(),\n column.table.options.columns,\n column.table.options.groupedColumnMode,\n ],\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('coreColumnsFeature', table, {\n table_getDefaultColumnDef: {\n fn: () => table_getDefaultColumnDef(table),\n memoDeps: () => [table.options.defaultColumn],\n },\n table_getAllColumns: {\n fn: () => table_getAllColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumns: {\n fn: () => table_getAllFlatColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumnsById: {\n fn: () => table_getAllFlatColumnsById(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllLeafColumns: {\n fn: () => table_getAllLeafColumns(table),\n memoDeps: () => [\n table.atoms.columnOrder?.get(),\n table.atoms.grouping?.get(),\n table.options.columns,\n table.options.groupedColumnMode,\n ],\n },\n table_getAllLeafColumnsById: {\n fn: () => table_getAllLeafColumnsById(table),\n memoDeps: () => [table.getAllLeafColumns()],\n },\n table_getColumn: {\n fn: (columnId) => table_getColumn(table, columnId),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAiBA,MAAa,qBAAmC;CAC9C,wBAAwB,WAAW,UAAU;EAC3C,kCAAoB,sBAAsB,WAAW,OAAO;GAC1D,uBAAuB;IACrB,KAAK,WAAWA,uDAAsB,MAAM;IAC5C,WAAW,WAAW,CAAC,OAAO,MAAM,QAAQ,OAAO;GACrD;GACA,uBAAuB;IACrB,KAAK,WAAWC,uDAAsB,MAAM;IAC5C,WAAW,WAAW
|
|
1
|
+
{"version":3,"file":"coreColumnsFeature.cjs","names":["column_getFlatColumns","column_getLeafColumns","table_getDefaultColumnDef","table_getAllColumns","table_getAllFlatColumns","table_getAllFlatColumnsById","table_getAllLeafColumns","table_getAllLeafColumnsById","table_getColumn"],"sources":["../../../src/core/columns/coreColumnsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n column_getFlatColumns,\n column_getLeafColumns,\n table_getAllColumns,\n table_getAllFlatColumns,\n table_getAllFlatColumnsById,\n table_getAllLeafColumns,\n table_getAllLeafColumnsById,\n table_getColumn,\n table_getDefaultColumnDef,\n} from './coreColumnsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that builds the column tree and exposes table/column column APIs.\n */\nexport const coreColumnsFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreColumnsFeature', prototype, table, {\n column_getFlatColumns: {\n fn: (column) => column_getFlatColumns(column),\n memoDeps: (column) => [column.table.options.columns],\n },\n column_getLeafColumns: {\n fn: (column) => column_getLeafColumns(column),\n memoDeps: (column) => [\n column.table.atoms.columnOrder?.get(),\n column.table.atoms.grouping?.get(),\n column.table.options.columns,\n column.table.options.groupedColumnMode,\n ],\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('coreColumnsFeature', table, {\n table_getDefaultColumnDef: {\n fn: () => table_getDefaultColumnDef(table),\n memoDeps: () => [table.options.defaultColumn],\n },\n table_getAllColumns: {\n fn: () => table_getAllColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumns: {\n fn: () => table_getAllFlatColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumnsById: {\n fn: () => table_getAllFlatColumnsById(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllLeafColumns: {\n fn: () => table_getAllLeafColumns(table),\n memoDeps: () => [\n table.atoms.columnOrder?.get(),\n table.atoms.grouping?.get(),\n table.options.columns,\n table.options.groupedColumnMode,\n ],\n },\n table_getAllLeafColumnsById: {\n fn: () => table_getAllLeafColumnsById(table),\n memoDeps: () => [table.getAllLeafColumns()],\n },\n table_getColumn: {\n fn: (columnId) => table_getColumn(table, columnId),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAiBA,MAAa,qBAAmC;CAC9C,wBAAwB,WAAW,UAAU;EAC3C,kCAAoB,sBAAsB,WAAW,OAAO;GAC1D,uBAAuB;IACrB,KAAK,WAAWA,uDAAsB,MAAM;IAC5C,WAAW,WAAW,CAAC,OAAO,MAAM,QAAQ,OAAO;GACrD;GACA,uBAAuB;IACrB,KAAK,WAAWC,uDAAsB,MAAM;IAC5C,WAAW,WAAW;KACpB,OAAO,MAAM,MAAM,aAAa,IAAI;KACpC,OAAO,MAAM,MAAM,UAAU,IAAI;KACjC,OAAO,MAAM,QAAQ;KACrB,OAAO,MAAM,QAAQ;IACvB;GACF;EACF,CAAC;CACH;CAEA,qBAAqB,UAAU;EAC7B,8BAAgB,sBAAsB,OAAO;GAC3C,2BAA2B;IACzB,UAAUC,2DAA0B,KAAK;IACzC,gBAAgB,CAAC,MAAM,QAAQ,aAAa;GAC9C;GACA,qBAAqB;IACnB,UAAUC,qDAAoB,KAAK;IACnC,gBAAgB,CAAC,MAAM,QAAQ,OAAO;GACxC;GACA,yBAAyB;IACvB,UAAUC,yDAAwB,KAAK;IACvC,gBAAgB,CAAC,MAAM,QAAQ,OAAO;GACxC;GACA,6BAA6B;IAC3B,UAAUC,6DAA4B,KAAK;IAC3C,gBAAgB,CAAC,MAAM,QAAQ,OAAO;GACxC;GACA,yBAAyB;IACvB,UAAUC,yDAAwB,KAAK;IACvC,gBAAgB;KACd,MAAM,MAAM,aAAa,IAAI;KAC7B,MAAM,MAAM,UAAU,IAAI;KAC1B,MAAM,QAAQ;KACd,MAAM,QAAQ;IAChB;GACF;GACA,6BAA6B;IAC3B,UAAUC,6DAA4B,KAAK;IAC3C,gBAAgB,CAAC,MAAM,kBAAkB,CAAC;GAC5C;GACA,iBAAiB,EACf,KAAK,aAAaC,iDAAgB,OAAO,QAAQ,EACnD;EACF,CAAC;CACH;AACF"}
|
|
@@ -14,15 +14,12 @@ const coreColumnsFeature = {
|
|
|
14
14
|
},
|
|
15
15
|
column_getLeafColumns: {
|
|
16
16
|
fn: (column) => column_getLeafColumns(column),
|
|
17
|
-
memoDeps: (column) =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
column.table.options.groupedColumnMode
|
|
24
|
-
];
|
|
25
|
-
}
|
|
17
|
+
memoDeps: (column) => [
|
|
18
|
+
column.table.atoms.columnOrder?.get(),
|
|
19
|
+
column.table.atoms.grouping?.get(),
|
|
20
|
+
column.table.options.columns,
|
|
21
|
+
column.table.options.groupedColumnMode
|
|
22
|
+
]
|
|
26
23
|
}
|
|
27
24
|
});
|
|
28
25
|
},
|
|
@@ -46,15 +43,12 @@ const coreColumnsFeature = {
|
|
|
46
43
|
},
|
|
47
44
|
table_getAllLeafColumns: {
|
|
48
45
|
fn: () => table_getAllLeafColumns(table),
|
|
49
|
-
memoDeps: () =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
table.options.groupedColumnMode
|
|
56
|
-
];
|
|
57
|
-
}
|
|
46
|
+
memoDeps: () => [
|
|
47
|
+
table.atoms.columnOrder?.get(),
|
|
48
|
+
table.atoms.grouping?.get(),
|
|
49
|
+
table.options.columns,
|
|
50
|
+
table.options.groupedColumnMode
|
|
51
|
+
]
|
|
58
52
|
},
|
|
59
53
|
table_getAllLeafColumnsById: {
|
|
60
54
|
fn: () => table_getAllLeafColumnsById(table),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreColumnsFeature.js","names":[],"sources":["../../../src/core/columns/coreColumnsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n column_getFlatColumns,\n column_getLeafColumns,\n table_getAllColumns,\n table_getAllFlatColumns,\n table_getAllFlatColumnsById,\n table_getAllLeafColumns,\n table_getAllLeafColumnsById,\n table_getColumn,\n table_getDefaultColumnDef,\n} from './coreColumnsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that builds the column tree and exposes table/column column APIs.\n */\nexport const coreColumnsFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreColumnsFeature', prototype, table, {\n column_getFlatColumns: {\n fn: (column) => column_getFlatColumns(column),\n memoDeps: (column) => [column.table.options.columns],\n },\n column_getLeafColumns: {\n fn: (column) => column_getLeafColumns(column),\n memoDeps: (column) => [\n column.table.atoms.columnOrder?.get(),\n column.table.atoms.grouping?.get(),\n column.table.options.columns,\n column.table.options.groupedColumnMode,\n ],\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('coreColumnsFeature', table, {\n table_getDefaultColumnDef: {\n fn: () => table_getDefaultColumnDef(table),\n memoDeps: () => [table.options.defaultColumn],\n },\n table_getAllColumns: {\n fn: () => table_getAllColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumns: {\n fn: () => table_getAllFlatColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumnsById: {\n fn: () => table_getAllFlatColumnsById(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllLeafColumns: {\n fn: () => table_getAllLeafColumns(table),\n memoDeps: () => [\n table.atoms.columnOrder?.get(),\n table.atoms.grouping?.get(),\n table.options.columns,\n table.options.groupedColumnMode,\n ],\n },\n table_getAllLeafColumnsById: {\n fn: () => table_getAllLeafColumnsById(table),\n memoDeps: () => [table.getAllLeafColumns()],\n },\n table_getColumn: {\n fn: (columnId) => table_getColumn(table, columnId),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAiBA,MAAa,qBAAmC;CAC9C,wBAAwB,WAAW,UAAU;EAC3C,oBAAoB,sBAAsB,WAAW,OAAO;GAC1D,uBAAuB;IACrB,KAAK,WAAW,sBAAsB,MAAM;IAC5C,WAAW,WAAW,CAAC,OAAO,MAAM,QAAQ,OAAO;GACrD;GACA,uBAAuB;IACrB,KAAK,WAAW,sBAAsB,MAAM;IAC5C,WAAW,WAAW
|
|
1
|
+
{"version":3,"file":"coreColumnsFeature.js","names":[],"sources":["../../../src/core/columns/coreColumnsFeature.ts"],"sourcesContent":["import { assignPrototypeAPIs, assignTableAPIs } from '../../utils'\nimport {\n column_getFlatColumns,\n column_getLeafColumns,\n table_getAllColumns,\n table_getAllFlatColumns,\n table_getAllFlatColumnsById,\n table_getAllLeafColumns,\n table_getAllLeafColumnsById,\n table_getColumn,\n table_getDefaultColumnDef,\n} from './coreColumnsFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Core feature that builds the column tree and exposes table/column column APIs.\n */\nexport const coreColumnsFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('coreColumnsFeature', prototype, table, {\n column_getFlatColumns: {\n fn: (column) => column_getFlatColumns(column),\n memoDeps: (column) => [column.table.options.columns],\n },\n column_getLeafColumns: {\n fn: (column) => column_getLeafColumns(column),\n memoDeps: (column) => [\n column.table.atoms.columnOrder?.get(),\n column.table.atoms.grouping?.get(),\n column.table.options.columns,\n column.table.options.groupedColumnMode,\n ],\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('coreColumnsFeature', table, {\n table_getDefaultColumnDef: {\n fn: () => table_getDefaultColumnDef(table),\n memoDeps: () => [table.options.defaultColumn],\n },\n table_getAllColumns: {\n fn: () => table_getAllColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumns: {\n fn: () => table_getAllFlatColumns(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllFlatColumnsById: {\n fn: () => table_getAllFlatColumnsById(table),\n memoDeps: () => [table.options.columns],\n },\n table_getAllLeafColumns: {\n fn: () => table_getAllLeafColumns(table),\n memoDeps: () => [\n table.atoms.columnOrder?.get(),\n table.atoms.grouping?.get(),\n table.options.columns,\n table.options.groupedColumnMode,\n ],\n },\n table_getAllLeafColumnsById: {\n fn: () => table_getAllLeafColumnsById(table),\n memoDeps: () => [table.getAllLeafColumns()],\n },\n table_getColumn: {\n fn: (columnId) => table_getColumn(table, columnId),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAiBA,MAAa,qBAAmC;CAC9C,wBAAwB,WAAW,UAAU;EAC3C,oBAAoB,sBAAsB,WAAW,OAAO;GAC1D,uBAAuB;IACrB,KAAK,WAAW,sBAAsB,MAAM;IAC5C,WAAW,WAAW,CAAC,OAAO,MAAM,QAAQ,OAAO;GACrD;GACA,uBAAuB;IACrB,KAAK,WAAW,sBAAsB,MAAM;IAC5C,WAAW,WAAW;KACpB,OAAO,MAAM,MAAM,aAAa,IAAI;KACpC,OAAO,MAAM,MAAM,UAAU,IAAI;KACjC,OAAO,MAAM,QAAQ;KACrB,OAAO,MAAM,QAAQ;IACvB;GACF;EACF,CAAC;CACH;CAEA,qBAAqB,UAAU;EAC7B,gBAAgB,sBAAsB,OAAO;GAC3C,2BAA2B;IACzB,UAAU,0BAA0B,KAAK;IACzC,gBAAgB,CAAC,MAAM,QAAQ,aAAa;GAC9C;GACA,qBAAqB;IACnB,UAAU,oBAAoB,KAAK;IACnC,gBAAgB,CAAC,MAAM,QAAQ,OAAO;GACxC;GACA,yBAAyB;IACvB,UAAU,wBAAwB,KAAK;IACvC,gBAAgB,CAAC,MAAM,QAAQ,OAAO;GACxC;GACA,6BAA6B;IAC3B,UAAU,4BAA4B,KAAK;IAC3C,gBAAgB,CAAC,MAAM,QAAQ,OAAO;GACxC;GACA,yBAAyB;IACvB,UAAU,wBAAwB,KAAK;IACvC,gBAAgB;KACd,MAAM,MAAM,aAAa,IAAI;KAC7B,MAAM,MAAM,UAAU,IAAI;KAC1B,MAAM,QAAQ;KACd,MAAM,QAAQ;IAChB;GACF;GACA,6BAA6B;IAC3B,UAAU,4BAA4B,KAAK;IAC3C,gBAAgB,CAAC,MAAM,kBAAkB,CAAC;GAC5C;GACA,iBAAiB,EACf,KAAK,aAAa,gBAAgB,OAAO,QAAQ,EACnD;EACF,CAAC;CACH;AACF"}
|
|
@@ -55,13 +55,9 @@ function table_getDefaultColumnDef(table) {
|
|
|
55
55
|
if (resolvedColumnDef.accessorFn) return resolvedColumnDef.id;
|
|
56
56
|
return null;
|
|
57
57
|
},
|
|
58
|
-
cell: (props) =>
|
|
59
|
-
var _props$renderValue, _props$renderValue$to;
|
|
60
|
-
return ((_props$renderValue = props.renderValue()) === null || _props$renderValue === void 0 || (_props$renderValue$to = _props$renderValue.toString) === null || _props$renderValue$to === void 0 ? void 0 : _props$renderValue$to.call(_props$renderValue)) ?? null;
|
|
61
|
-
},
|
|
58
|
+
cell: (props) => props.renderValue()?.toString?.() ?? null,
|
|
62
59
|
...Object.values(table._features).reduce((obj, feature) => {
|
|
63
|
-
|
|
64
|
-
return Object.assign(obj, (_feature$getDefaultCo = feature.getDefaultColumnDef) === null || _feature$getDefaultCo === void 0 ? void 0 : _feature$getDefaultCo.call(feature));
|
|
60
|
+
return Object.assign(obj, feature.getDefaultColumnDef?.());
|
|
65
61
|
}, {}),
|
|
66
62
|
...table.options.defaultColumn
|
|
67
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreColumnsFeature.utils.cjs","names":["callMemoOrStaticFn","table_getOrderColumnsFn","constructColumn","makeObjectMap"],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, makeObjectMap } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns) as Array<Column<TFeatures, TData, unknown>>\n}\n\n/**\n * Builds an id lookup for terminal leaf columns only.\n *\n * Parent/group columns are excluded, making this lookup appropriate for row\n * cells and feature state keyed by data columns.\n *\n * @example\n * ```ts\n * const leavesById = table_getAllLeafColumnsById(table)\n * ```\n */\nexport function table_getAllLeafColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Looks up a column by id from the flat column map.\n *\n * The lookup can return group columns or leaf columns. In development, a\n * missing id logs a warning to help catch stale column references.\n *\n * @example\n * ```ts\n * const column = table_getColumn(table, 'firstName')\n * ```\n */\nexport function table_getColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n): Column<TFeatures, TData, unknown> | undefined {\n const column = table.getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV === 'development' && !column) {\n console.warn(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,sBAKd,QACyC;CACzC,OAAO,CAAC,QAAQ,GAAG,OAAO,QAAQ,SAAS,QAAQ,IAAI,eAAe,CAAC,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,sBAKd,QACyC;CACzC,IAAI,OAAO,QAAQ,QAAQ;EACzB,MAAM,cAAc,OAAO,QAAQ,SAChC,QAAQ,IAAI,eAAe,CAC9B;EAEA,OAAOA,iCACL,OAAO,OACP,mBACAC,2DACF,CAAC,CAAC,WAAkB;CACtB;CAEA,OAAO,CAAC,MAAM;AAChB;;;;;;;;;;;;;AAcA,SAAgB,0BAId,OAC+C;CAC/C,OAAO;EACL,SAAS,UAAU;GACjB,MAAM,oBAAoB,MAAM,OAAO,OACpC;GAEH,IAAI,kBAAkB,aACpB,OAAO,kBAAkB;GAG3B,IAAI,kBAAkB,YACpB,OAAO,kBAAkB;GAG3B,OAAO;EACT;EACA,OAAO,UAAU;;uCAAM,YAAiB,4FAAG,+GAAW,MAAK;EAAG;EAC9D,GAAG,OAAO,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,KAAK,YAAY;;GACzD,OAAO,OAAO,OAAO,8BAAK,QAAQ,+GAAsB,CAAC;EAC3D,GAAG,CAAC,CAAC;EACL,GAAG,MAAM,QAAQ;CACnB;AACF;;;;;;;;;;;;AAaA,SAAgB,oBAId,OAC0C;CAC1C,MAAM,kBACJ,SACA,QACA,QAAQ,MACqC;EAC7C,OAAO,QAAQ,KAAK,cAAc;GAChC,MAAM,SAASC,wCAAgB,OAAO,WAAW,OAAO,MAAM;GAE9D,MAAM,oBAAoB;GAM1B,OAAO,UAAU,kBAAkB,UAC/B,eAAe,kBAAkB,SAAS,QAAQ,QAAQ,CAAC,IAC3D,CAAC;GAEL,OAAO;EACT,CAAC;CACH;CAEA,OAAO,eAAe,MAAM,QAAQ,OAAO;AAC7C;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,OAAO,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,OAAO,eAAe,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAASC,4BAAiD;CAChE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,MAAM,cAAc,MAAM,cAAc,CAAC,CAAC,SACvC,MAAM,EAAE,eAAe,CAC1B;CACA,OAAOH,iCACL,OACA,mBACAC,2DACF,CAAC,CAAC,WAAW;AACf;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAASE,4BAAiD;CAChE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,gBAId,OACA,UAC+C;CAC/C,MAAM,SAAS,MAAM,sBAAsB,CAAC,CAAC;CAE7C,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAC7C,QAAQ,KAAK,2BAA2B,SAAS,kBAAkB;CAGrE,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"coreColumnsFeature.utils.cjs","names":["callMemoOrStaticFn","table_getOrderColumnsFn","constructColumn","makeObjectMap"],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, makeObjectMap } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns) as Array<Column<TFeatures, TData, unknown>>\n}\n\n/**\n * Builds an id lookup for terminal leaf columns only.\n *\n * Parent/group columns are excluded, making this lookup appropriate for row\n * cells and feature state keyed by data columns.\n *\n * @example\n * ```ts\n * const leavesById = table_getAllLeafColumnsById(table)\n * ```\n */\nexport function table_getAllLeafColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Looks up a column by id from the flat column map.\n *\n * The lookup can return group columns or leaf columns. In development, a\n * missing id logs a warning to help catch stale column references.\n *\n * @example\n * ```ts\n * const column = table_getColumn(table, 'firstName')\n * ```\n */\nexport function table_getColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n): Column<TFeatures, TData, unknown> | undefined {\n const column = table.getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV === 'development' && !column) {\n console.warn(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,sBAKd,QACyC;CACzC,OAAO,CAAC,QAAQ,GAAG,OAAO,QAAQ,SAAS,QAAQ,IAAI,eAAe,CAAC,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,sBAKd,QACyC;CACzC,IAAI,OAAO,QAAQ,QAAQ;EACzB,MAAM,cAAc,OAAO,QAAQ,SAChC,QAAQ,IAAI,eAAe,CAC9B;EAEA,OAAOA,iCACL,OAAO,OACP,mBACAC,2DACF,CAAC,CAAC,WAAkB;CACtB;CAEA,OAAO,CAAC,MAAM;AAChB;;;;;;;;;;;;;AAcA,SAAgB,0BAId,OAC+C;CAC/C,OAAO;EACL,SAAS,UAAU;GACjB,MAAM,oBAAoB,MAAM,OAAO,OACpC;GAEH,IAAI,kBAAkB,aACpB,OAAO,kBAAkB;GAG3B,IAAI,kBAAkB,YACpB,OAAO,kBAAkB;GAG3B,OAAO;EACT;EACA,OAAO,UAAU,MAAM,YAAiB,CAAC,EAAE,WAAW,KAAK;EAC3D,GAAG,OAAO,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,KAAK,YAAY;GACzD,OAAO,OAAO,OAAO,KAAK,QAAQ,sBAAsB,CAAC;EAC3D,GAAG,CAAC,CAAC;EACL,GAAG,MAAM,QAAQ;CACnB;AACF;;;;;;;;;;;;AAaA,SAAgB,oBAId,OAC0C;CAC1C,MAAM,kBACJ,SACA,QACA,QAAQ,MACqC;EAC7C,OAAO,QAAQ,KAAK,cAAc;GAChC,MAAM,SAASC,wCAAgB,OAAO,WAAW,OAAO,MAAM;GAE9D,MAAM,oBAAoB;GAM1B,OAAO,UAAU,kBAAkB,UAC/B,eAAe,kBAAkB,SAAS,QAAQ,QAAQ,CAAC,IAC3D,CAAC;GAEL,OAAO;EACT,CAAC;CACH;CAEA,OAAO,eAAe,MAAM,QAAQ,OAAO;AAC7C;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,OAAO,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,OAAO,eAAe,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAASC,4BAAiD;CAChE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,MAAM,cAAc,MAAM,cAAc,CAAC,CAAC,SACvC,MAAM,EAAE,eAAe,CAC1B;CACA,OAAOH,iCACL,OACA,mBACAC,2DACF,CAAC,CAAC,WAAW;AACf;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAASE,4BAAiD;CAChE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,gBAId,OACA,UAC+C;CAC/C,MAAM,SAAS,MAAM,sBAAsB,CAAC,CAAC;CAE7C,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAC7C,QAAQ,KAAK,2BAA2B,SAAS,kBAAkB;CAGrE,OAAO;AACT"}
|
|
@@ -55,13 +55,9 @@ function table_getDefaultColumnDef(table) {
|
|
|
55
55
|
if (resolvedColumnDef.accessorFn) return resolvedColumnDef.id;
|
|
56
56
|
return null;
|
|
57
57
|
},
|
|
58
|
-
cell: (props) =>
|
|
59
|
-
var _props$renderValue, _props$renderValue$to;
|
|
60
|
-
return ((_props$renderValue = props.renderValue()) === null || _props$renderValue === void 0 || (_props$renderValue$to = _props$renderValue.toString) === null || _props$renderValue$to === void 0 ? void 0 : _props$renderValue$to.call(_props$renderValue)) ?? null;
|
|
61
|
-
},
|
|
58
|
+
cell: (props) => props.renderValue()?.toString?.() ?? null,
|
|
62
59
|
...Object.values(table._features).reduce((obj, feature) => {
|
|
63
|
-
|
|
64
|
-
return Object.assign(obj, (_feature$getDefaultCo = feature.getDefaultColumnDef) === null || _feature$getDefaultCo === void 0 ? void 0 : _feature$getDefaultCo.call(feature));
|
|
60
|
+
return Object.assign(obj, feature.getDefaultColumnDef?.());
|
|
65
61
|
}, {}),
|
|
66
62
|
...table.options.defaultColumn
|
|
67
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreColumnsFeature.utils.js","names":[],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, makeObjectMap } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns) as Array<Column<TFeatures, TData, unknown>>\n}\n\n/**\n * Builds an id lookup for terminal leaf columns only.\n *\n * Parent/group columns are excluded, making this lookup appropriate for row\n * cells and feature state keyed by data columns.\n *\n * @example\n * ```ts\n * const leavesById = table_getAllLeafColumnsById(table)\n * ```\n */\nexport function table_getAllLeafColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Looks up a column by id from the flat column map.\n *\n * The lookup can return group columns or leaf columns. In development, a\n * missing id logs a warning to help catch stale column references.\n *\n * @example\n * ```ts\n * const column = table_getColumn(table, 'firstName')\n * ```\n */\nexport function table_getColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n): Column<TFeatures, TData, unknown> | undefined {\n const column = table.getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV === 'development' && !column) {\n console.warn(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,sBAKd,QACyC;CACzC,OAAO,CAAC,QAAQ,GAAG,OAAO,QAAQ,SAAS,QAAQ,IAAI,eAAe,CAAC,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,sBAKd,QACyC;CACzC,IAAI,OAAO,QAAQ,QAAQ;EACzB,MAAM,cAAc,OAAO,QAAQ,SAChC,QAAQ,IAAI,eAAe,CAC9B;EAEA,OAAO,mBACL,OAAO,OACP,mBACA,uBACF,CAAC,CAAC,WAAkB;CACtB;CAEA,OAAO,CAAC,MAAM;AAChB;;;;;;;;;;;;;AAcA,SAAgB,0BAId,OAC+C;CAC/C,OAAO;EACL,SAAS,UAAU;GACjB,MAAM,oBAAoB,MAAM,OAAO,OACpC;GAEH,IAAI,kBAAkB,aACpB,OAAO,kBAAkB;GAG3B,IAAI,kBAAkB,YACpB,OAAO,kBAAkB;GAG3B,OAAO;EACT;EACA,OAAO,UAAU
|
|
1
|
+
{"version":3,"file":"coreColumnsFeature.utils.js","names":[],"sources":["../../../src/core/columns/coreColumnsFeature.utils.ts"],"sourcesContent":["import { callMemoOrStaticFn, makeObjectMap } from '../../utils'\nimport { table_getOrderColumnsFn } from '../../features/column-ordering/columnOrderingFeature.utils'\nimport { constructColumn } from './constructColumn'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type {\n ColumnDef,\n ColumnDefResolved,\n GroupColumnDef,\n} from '../../types/ColumnDef'\nimport type { Column } from '../../types/Column'\n\n/**\n * Flattens this column and every descendant column into a single array.\n *\n * Group columns appear before their child columns, which matches the normalized\n * column hierarchy produced during table construction.\n *\n * @example\n * ```ts\n * const flatColumns = column_getFlatColumns(column)\n * ```\n */\nexport function column_getFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n return [column, ...column.columns.flatMap((col) => col.getFlatColumns())]\n}\n\n/**\n * Collects the terminal leaf columns below this column.\n *\n * Group columns return their ordered descendants. Non-group columns return an\n * array containing only the column itself.\n *\n * @example\n * ```ts\n * const leafColumns = column_getLeafColumns(column)\n * ```\n */\nexport function column_getLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column<TFeatures, TData, TValue>,\n): Array<Column<TFeatures, TData, TValue>> {\n if (column.columns.length) {\n const leafColumns = column.columns.flatMap(\n (col) => col.getLeafColumns(), // recursive\n )\n\n return callMemoOrStaticFn(\n column.table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns as any) as any\n }\n\n return [column]\n}\n\n/**\n * Merges built-in, feature, and user default column definitions.\n *\n * Built-in defaults provide a header and fallback cell renderer, feature\n * defaults can add feature-specific column options, and\n * `options.defaultColumn` wins last.\n *\n * @example\n * ```ts\n * const defaultColumn = table_getDefaultColumnDef(table)\n * ```\n */\nexport function table_getDefaultColumnDef<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Partial<ColumnDef<TFeatures, TData, unknown>> {\n return {\n header: (props) => {\n const resolvedColumnDef = props.header.column\n .columnDef as ColumnDefResolved<{}, TData>\n\n if (resolvedColumnDef.accessorKey) {\n return resolvedColumnDef.accessorKey\n }\n\n if (resolvedColumnDef.accessorFn) {\n return resolvedColumnDef.id\n }\n\n return null\n },\n cell: (props) => props.renderValue<any>()?.toString?.() ?? null,\n ...Object.values(table._features).reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultColumnDef?.())\n }, {}),\n ...table.options.defaultColumn,\n } as Partial<ColumnDef<TFeatures, TData, unknown>>\n}\n\n/**\n * Normalizes `options.columns` into the table's nested column tree.\n *\n * Each column definition is constructed with its parent and depth, and group\n * column children are recursively constructed.\n *\n * @example\n * ```ts\n * const columns = table_getAllColumns(table)\n * ```\n */\nexport function table_getAllColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const recurseColumns = (\n colDefs: ReadonlyArray<ColumnDef<TFeatures, TData, unknown>>,\n parent?: Column<TFeatures, TData, unknown>,\n depth = 0,\n ): Array<Column<TFeatures, TData, unknown>> => {\n return colDefs.map((columnDef) => {\n const column = constructColumn(table, columnDef, depth, parent)\n\n const groupingColumnDef = columnDef as GroupColumnDef<\n TFeatures,\n TData,\n unknown\n >\n\n column.columns = groupingColumnDef.columns\n ? recurseColumns(groupingColumnDef.columns, column, depth + 1)\n : []\n\n return column\n })\n }\n\n return recurseColumns(table.options.columns)\n}\n\n/**\n * Flattens every table column, including group columns and leaf columns.\n *\n * Use this when parent/group columns must be included in addition to data leaf\n * columns.\n *\n * @example\n * ```ts\n * const flatColumns = table_getAllFlatColumns(table)\n * ```\n */\nexport function table_getAllFlatColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n return table.getAllColumns().flatMap((column) => column.getFlatColumns())\n}\n\n/**\n * Builds an id lookup for every flat column in the table.\n *\n * Group columns and leaf columns are included. Later columns with the same id\n * replace earlier entries.\n *\n * @example\n * ```ts\n * const columnsById = table_getAllFlatColumnsById(table)\n * ```\n */\nexport function table_getAllFlatColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const flatColumns = table.getAllFlatColumns()\n for (let i = 0; i < flatColumns.length; i++) {\n const column = flatColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Collects all terminal leaf columns in their current table order.\n *\n * Column ordering features can reorder the collected leaves before the result\n * is returned.\n *\n * @example\n * ```ts\n * const leafColumns = table_getAllLeafColumns(table)\n * ```\n */\nexport function table_getAllLeafColumns<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Array<Column<TFeatures, TData, unknown>> {\n const leafColumns = table.getAllColumns().flatMap(\n (c) => c.getLeafColumns(), // recursive\n )\n return callMemoOrStaticFn(\n table,\n 'getOrderColumns',\n table_getOrderColumnsFn,\n )(leafColumns) as Array<Column<TFeatures, TData, unknown>>\n}\n\n/**\n * Builds an id lookup for terminal leaf columns only.\n *\n * Parent/group columns are excluded, making this lookup appropriate for row\n * cells and feature state keyed by data columns.\n *\n * @example\n * ```ts\n * const leavesById = table_getAllLeafColumnsById(table)\n * ```\n */\nexport function table_getAllLeafColumnsById<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n): Record<string, Column<TFeatures, TData, unknown>> {\n const result = makeObjectMap<Column<TFeatures, TData, unknown>>()\n const leafColumns = table.getAllLeafColumns()\n for (let i = 0; i < leafColumns.length; i++) {\n const column = leafColumns[i]!\n result[column.id] = column\n }\n return result\n}\n\n/**\n * Looks up a column by id from the flat column map.\n *\n * The lookup can return group columns or leaf columns. In development, a\n * missing id logs a warning to help catch stale column references.\n *\n * @example\n * ```ts\n * const column = table_getColumn(table, 'firstName')\n * ```\n */\nexport function table_getColumn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n): Column<TFeatures, TData, unknown> | undefined {\n const column = table.getAllFlatColumnsById()[columnId]\n\n if (process.env.NODE_ENV === 'development' && !column) {\n console.warn(`[Table] Column with id '${columnId}' does not exist.`)\n }\n\n return column\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,sBAKd,QACyC;CACzC,OAAO,CAAC,QAAQ,GAAG,OAAO,QAAQ,SAAS,QAAQ,IAAI,eAAe,CAAC,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,sBAKd,QACyC;CACzC,IAAI,OAAO,QAAQ,QAAQ;EACzB,MAAM,cAAc,OAAO,QAAQ,SAChC,QAAQ,IAAI,eAAe,CAC9B;EAEA,OAAO,mBACL,OAAO,OACP,mBACA,uBACF,CAAC,CAAC,WAAkB;CACtB;CAEA,OAAO,CAAC,MAAM;AAChB;;;;;;;;;;;;;AAcA,SAAgB,0BAId,OAC+C;CAC/C,OAAO;EACL,SAAS,UAAU;GACjB,MAAM,oBAAoB,MAAM,OAAO,OACpC;GAEH,IAAI,kBAAkB,aACpB,OAAO,kBAAkB;GAG3B,IAAI,kBAAkB,YACpB,OAAO,kBAAkB;GAG3B,OAAO;EACT;EACA,OAAO,UAAU,MAAM,YAAiB,CAAC,EAAE,WAAW,KAAK;EAC3D,GAAG,OAAO,OAAO,MAAM,SAAS,CAAC,CAAC,QAAQ,KAAK,YAAY;GACzD,OAAO,OAAO,OAAO,KAAK,QAAQ,sBAAsB,CAAC;EAC3D,GAAG,CAAC,CAAC;EACL,GAAG,MAAM,QAAQ;CACnB;AACF;;;;;;;;;;;;AAaA,SAAgB,oBAId,OAC0C;CAC1C,MAAM,kBACJ,SACA,QACA,QAAQ,MACqC;EAC7C,OAAO,QAAQ,KAAK,cAAc;GAChC,MAAM,SAAS,gBAAgB,OAAO,WAAW,OAAO,MAAM;GAE9D,MAAM,oBAAoB;GAM1B,OAAO,UAAU,kBAAkB,UAC/B,eAAe,kBAAkB,SAAS,QAAQ,QAAQ,CAAC,IAC3D,CAAC;GAEL,OAAO;EACT,CAAC;CACH;CAEA,OAAO,eAAe,MAAM,QAAQ,OAAO;AAC7C;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,OAAO,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,OAAO,eAAe,CAAC;AAC1E;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAAS,cAAiD;CAChE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,wBAId,OAC0C;CAC1C,MAAM,cAAc,MAAM,cAAc,CAAC,CAAC,SACvC,MAAM,EAAE,eAAe,CAC1B;CACA,OAAO,mBACL,OACA,mBACA,uBACF,CAAC,CAAC,WAAW;AACf;;;;;;;;;;;;AAaA,SAAgB,4BAId,OACmD;CACnD,MAAM,SAAS,cAAiD;CAChE,MAAM,cAAc,MAAM,kBAAkB;CAC5C,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;EAC3C,MAAM,SAAS,YAAY;EAC3B,OAAO,OAAO,MAAM;CACtB;CACA,OAAO;AACT;;;;;;;;;;;;AAaA,SAAgB,gBAId,OACA,UAC+C;CAC/C,MAAM,SAAS,MAAM,sBAAsB,CAAC,CAAC;CAE7C,IAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,QAC7C,QAAQ,KAAK,2BAA2B,SAAS,kBAAkB;CAGrE,OAAO;AACT"}
|
|
@@ -9,7 +9,6 @@ const require_constructHeader = require('./constructHeader.cjs');
|
|
|
9
9
|
* The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.
|
|
10
10
|
*/
|
|
11
11
|
function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
12
|
-
var _headerGroups$;
|
|
13
12
|
let maxDepth = 0;
|
|
14
13
|
const findMaxDepth = (columns, depth = 1) => {
|
|
15
14
|
maxDepth = Math.max(maxDepth, depth);
|
|
@@ -94,7 +93,7 @@ function buildHeaderGroups(allColumns, columnsToGroup, table, headerFamily) {
|
|
|
94
93
|
}
|
|
95
94
|
return results;
|
|
96
95
|
};
|
|
97
|
-
recurseHeadersForSpans(
|
|
96
|
+
recurseHeadersForSpans(headerGroups[0]?.headers ?? []);
|
|
98
97
|
return headerGroups;
|
|
99
98
|
}
|
|
100
99
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildHeaderGroups.cjs","names":["callMemoOrStaticFn","column_getIsVisible","constructHeader"],"sources":["../../../src/core/headers/buildHeaderGroups.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { column_getIsVisible } from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { constructHeader } from './constructHeader'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header } from '../../types/Header'\nimport type { HeaderGroup } from '../../types/HeaderGroup'\nimport type { Column } from '../../types/Column'\n\n/**\n * Builds the nested header group structure for a table.\n *\n * The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.\n */\nexport function buildHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n allColumns: Array<Column<TFeatures, TData, TValue>>,\n columnsToGroup: Array<Column<TFeatures, TData, TValue>>,\n table: Table_Internal<TFeatures, TData>,\n headerFamily?: 'center' | 'left' | 'right',\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (\n columns: Array<Column<TFeatures, TData, TValue>>,\n depth = 1,\n ) => {\n maxDepth = Math.max(maxDepth, depth)\n\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n if (callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)) {\n if (column.columns.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }\n }\n }\n\n findMaxDepth(allColumns)\n\n const headerGroups: Array<HeaderGroup<TFeatures, TData>> = []\n\n const constructHeaderGroup = (\n headersToGroup: Array<Header<TFeatures, TData, TValue>>,\n depth: number,\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<TFeatures, TData> = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n // Scan each column for parents\n headersToGroup.forEach((headerToGroup) => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader =\n pendingParentHeaders[pendingParentHeaders.length - 1]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TFeatures, TData, TValue>\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = constructHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter((d) => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(\n headerToGroup as Header<TFeatures, TData, unknown>,\n )\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n constructHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n constructHeader(table, column, {\n depth: maxDepth,\n index,\n }),\n )\n\n constructHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n const recurseHeadersForSpans = (\n headers: Array<Header<TFeatures, TData, TValue>>,\n ): Array<{ colSpan: number; rowSpan: number }> => {\n const results: Array<{ colSpan: number; rowSpan: number }> = []\n\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]!\n if (\n !callMemoOrStaticFn(header.column, 'getIsVisible', column_getIsVisible)\n ) {\n continue\n }\n\n let colSpan = 0\n let minChildRowSpan = Infinity\n\n if (header.subHeaders.length) {\n const childSpans = recurseHeadersForSpans(header.subHeaders)\n for (let j = 0; j < childSpans.length; j++) {\n const child = childSpans[j]!\n colSpan += child.colSpan\n if (child.rowSpan < minChildRowSpan) {\n minChildRowSpan = child.rowSpan\n }\n }\n } else {\n colSpan = 1\n minChildRowSpan = 0\n }\n\n header.colSpan = colSpan\n header.rowSpan = minChildRowSpan\n\n results.push({ colSpan, rowSpan: header.rowSpan })\n }\n\n return results\n }\n\n recurseHeadersForSpans(\n (headerGroups[0]?.headers ?? []) as Array<Header<TFeatures, TData, TValue>>,\n )\n\n return headerGroups\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,kBAKd,YACA,gBACA,OACA,cACA
|
|
1
|
+
{"version":3,"file":"buildHeaderGroups.cjs","names":["callMemoOrStaticFn","column_getIsVisible","constructHeader"],"sources":["../../../src/core/headers/buildHeaderGroups.ts"],"sourcesContent":["import { callMemoOrStaticFn } from '../../utils'\nimport { column_getIsVisible } from '../../features/column-visibility/columnVisibilityFeature.utils'\nimport { constructHeader } from './constructHeader'\nimport type { Table_Internal } from '../../types/Table'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Header } from '../../types/Header'\nimport type { HeaderGroup } from '../../types/HeaderGroup'\nimport type { Column } from '../../types/Column'\n\n/**\n * Builds the nested header group structure for a table.\n *\n * The result accounts for visible leaf columns, pinned column groups, and placeholder headers needed to render multi-level headers.\n */\nexport function buildHeaderGroups<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n allColumns: Array<Column<TFeatures, TData, TValue>>,\n columnsToGroup: Array<Column<TFeatures, TData, TValue>>,\n table: Table_Internal<TFeatures, TData>,\n headerFamily?: 'center' | 'left' | 'right',\n) {\n // Find the max depth of the columns:\n // build the leaf column row\n // build each buffer row going up\n // placeholder for non-existent level\n // real column for existing level\n\n let maxDepth = 0\n\n const findMaxDepth = (\n columns: Array<Column<TFeatures, TData, TValue>>,\n depth = 1,\n ) => {\n maxDepth = Math.max(maxDepth, depth)\n\n for (let i = 0; i < columns.length; i++) {\n const column = columns[i]!\n if (callMemoOrStaticFn(column, 'getIsVisible', column_getIsVisible)) {\n if (column.columns.length) {\n findMaxDepth(column.columns, depth + 1)\n }\n }\n }\n }\n\n findMaxDepth(allColumns)\n\n const headerGroups: Array<HeaderGroup<TFeatures, TData>> = []\n\n const constructHeaderGroup = (\n headersToGroup: Array<Header<TFeatures, TData, TValue>>,\n depth: number,\n ) => {\n // The header group we are creating\n const headerGroup: HeaderGroup<TFeatures, TData> = {\n depth,\n id: [headerFamily, `${depth}`].filter(Boolean).join('_'),\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const pendingParentHeaders: Array<Header<TFeatures, TData, TValue>> = []\n\n // Scan each column for parents\n headersToGroup.forEach((headerToGroup) => {\n // What is the latest (last) parent column?\n\n const latestPendingParentHeader =\n pendingParentHeaders[pendingParentHeaders.length - 1]\n\n const isLeafHeader = headerToGroup.column.depth === headerGroup.depth\n\n let column: Column<TFeatures, TData, TValue>\n let isPlaceholder = false\n\n if (isLeafHeader && headerToGroup.column.parent) {\n // The parent header is new\n column = headerToGroup.column.parent\n } else {\n // The parent header is repeated\n column = headerToGroup.column\n isPlaceholder = true\n }\n\n if (\n latestPendingParentHeader &&\n latestPendingParentHeader.column === column\n ) {\n // This column is repeated. Add it as a sub header to the next batch\n latestPendingParentHeader.subHeaders.push(headerToGroup)\n } else {\n // This is a new header. Let's create it\n const header = constructHeader(table, column, {\n id: [headerFamily, depth, column.id, headerToGroup.id]\n .filter(Boolean)\n .join('_'),\n isPlaceholder,\n placeholderId: isPlaceholder\n ? `${pendingParentHeaders.filter((d) => d.column === column).length}`\n : undefined,\n depth,\n index: pendingParentHeaders.length,\n })\n\n // Add the headerToGroup as a subHeader of the new header\n header.subHeaders.push(headerToGroup)\n // Add the new header to the pendingParentHeaders to get grouped\n // in the next batch\n pendingParentHeaders.push(header)\n }\n\n headerGroup.headers.push(\n headerToGroup as Header<TFeatures, TData, unknown>,\n )\n headerToGroup.headerGroup = headerGroup\n })\n\n headerGroups.push(headerGroup)\n\n if (depth > 0) {\n constructHeaderGroup(pendingParentHeaders, depth - 1)\n }\n }\n\n const bottomHeaders = columnsToGroup.map((column, index) =>\n constructHeader(table, column, {\n depth: maxDepth,\n index,\n }),\n )\n\n constructHeaderGroup(bottomHeaders, maxDepth - 1)\n\n headerGroups.reverse()\n\n const recurseHeadersForSpans = (\n headers: Array<Header<TFeatures, TData, TValue>>,\n ): Array<{ colSpan: number; rowSpan: number }> => {\n const results: Array<{ colSpan: number; rowSpan: number }> = []\n\n for (let i = 0; i < headers.length; i++) {\n const header = headers[i]!\n if (\n !callMemoOrStaticFn(header.column, 'getIsVisible', column_getIsVisible)\n ) {\n continue\n }\n\n let colSpan = 0\n let minChildRowSpan = Infinity\n\n if (header.subHeaders.length) {\n const childSpans = recurseHeadersForSpans(header.subHeaders)\n for (let j = 0; j < childSpans.length; j++) {\n const child = childSpans[j]!\n colSpan += child.colSpan\n if (child.rowSpan < minChildRowSpan) {\n minChildRowSpan = child.rowSpan\n }\n }\n } else {\n colSpan = 1\n minChildRowSpan = 0\n }\n\n header.colSpan = colSpan\n header.rowSpan = minChildRowSpan\n\n results.push({ colSpan, rowSpan: header.rowSpan })\n }\n\n return results\n }\n\n recurseHeadersForSpans(\n (headerGroups[0]?.headers ?? []) as Array<Header<TFeatures, TData, TValue>>,\n )\n\n return headerGroups\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAgB,kBAKd,YACA,gBACA,OACA,cACA;CAOA,IAAI,WAAW;CAEf,MAAM,gBACJ,SACA,QAAQ,MACL;EACH,WAAW,KAAK,IAAI,UAAU,KAAK;EAEnC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IAAIA,iCAAmB,QAAQ,gBAAgBC,yDAAmB,GAChE;QAAI,OAAO,QAAQ,QACjB,aAAa,OAAO,SAAS,QAAQ,CAAC;GACxC;EAEJ;CACF;CAEA,aAAa,UAAU;CAEvB,MAAM,eAAqD,CAAC;CAE5D,MAAM,wBACJ,gBACA,UACG;EAEH,MAAM,cAA6C;GACjD;GACA,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GACvD,SAAS,CAAC;EACZ;EAGA,MAAM,uBAAgE,CAAC;EAGvE,eAAe,SAAS,kBAAkB;GAGxC,MAAM,4BACJ,qBAAqB,qBAAqB,SAAS;GAErD,MAAM,eAAe,cAAc,OAAO,UAAU,YAAY;GAEhE,IAAI;GACJ,IAAI,gBAAgB;GAEpB,IAAI,gBAAgB,cAAc,OAAO,QAEvC,SAAS,cAAc,OAAO;QACzB;IAEL,SAAS,cAAc;IACvB,gBAAgB;GAClB;GAEA,IACE,6BACA,0BAA0B,WAAW,QAGrC,0BAA0B,WAAW,KAAK,aAAa;QAClD;IAEL,MAAM,SAASC,wCAAgB,OAAO,QAAQ;KAC5C,IAAI;MAAC;MAAc;MAAO,OAAO;MAAI,cAAc;KAAE,CAAC,CACnD,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;KACX;KACA,eAAe,gBACX,GAAG,qBAAqB,QAAQ,MAAM,EAAE,WAAW,MAAM,CAAC,CAAC,WAC3D;KACJ;KACA,OAAO,qBAAqB;IAC9B,CAAC;IAGD,OAAO,WAAW,KAAK,aAAa;IAGpC,qBAAqB,KAAK,MAAM;GAClC;GAEA,YAAY,QAAQ,KAClB,aACF;GACA,cAAc,cAAc;EAC9B,CAAC;EAED,aAAa,KAAK,WAAW;EAE7B,IAAI,QAAQ,GACV,qBAAqB,sBAAsB,QAAQ,CAAC;CAExD;CASA,qBAPsB,eAAe,KAAK,QAAQ,UAChDA,wCAAgB,OAAO,QAAQ;EAC7B,OAAO;EACP;CACF,CAAC,CAG8B,GAAG,WAAW,CAAC;CAEhD,aAAa,QAAQ;CAErB,MAAM,0BACJ,YACgD;EAChD,MAAM,UAAuD,CAAC;EAE9D,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;GACvC,MAAM,SAAS,QAAQ;GACvB,IACE,CAACF,iCAAmB,OAAO,QAAQ,gBAAgBC,yDAAmB,GAEtE;GAGF,IAAI,UAAU;GACd,IAAI,kBAAkB;GAEtB,IAAI,OAAO,WAAW,QAAQ;IAC5B,MAAM,aAAa,uBAAuB,OAAO,UAAU;IAC3D,KAAK,IAAI,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;KAC1C,MAAM,QAAQ,WAAW;KACzB,WAAW,MAAM;KACjB,IAAI,MAAM,UAAU,iBAClB,kBAAkB,MAAM;IAE5B;GACF,OAAO;IACL,UAAU;IACV,kBAAkB;GACpB;GAEA,OAAO,UAAU;GACjB,OAAO,UAAU;GAEjB,QAAQ,KAAK;IAAE;IAAS,SAAS,OAAO;GAAQ,CAAC;EACnD;EAEA,OAAO;CACT;CAEA,uBACG,aAAa,EAAE,EAAE,WAAW,CAAC,CAChC;CAEA,OAAO;AACT"}
|