@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
|
@@ -11,8 +11,7 @@ import { atomToStore } from "../reactivity/coreReactivityFeature.utils.js";
|
|
|
11
11
|
*/
|
|
12
12
|
function getInitialTableState(features, initialState = {}) {
|
|
13
13
|
Object.values(features).forEach((feature) => {
|
|
14
|
-
|
|
15
|
-
initialState = ((_feature$getInitialSt = feature.getInitialState) === null || _feature$getInitialSt === void 0 ? void 0 : _feature$getInitialSt.call(feature, initialState)) ?? initialState;
|
|
14
|
+
initialState = feature.getInitialState?.(initialState) ?? initialState;
|
|
16
15
|
});
|
|
17
16
|
return cloneState(initialState);
|
|
18
17
|
}
|
|
@@ -42,8 +41,7 @@ function constructTable(tableOptions) {
|
|
|
42
41
|
const featuresList = Object.values(table._features);
|
|
43
42
|
const mergedOptions = {
|
|
44
43
|
...featuresList.reduce((obj, feature) => {
|
|
45
|
-
|
|
46
|
-
return Object.assign(obj, (_feature$getDefaultTa = feature.getDefaultTableOptions) === null || _feature$getDefaultTa === void 0 ? void 0 : _feature$getDefaultTa.call(feature, table));
|
|
44
|
+
return Object.assign(obj, feature.getDefaultTableOptions?.(table));
|
|
47
45
|
}, {}),
|
|
48
46
|
...tableOptions
|
|
49
47
|
};
|
|
@@ -83,8 +81,7 @@ function constructTable(tableOptions) {
|
|
|
83
81
|
const key = stateKeys[i];
|
|
84
82
|
table.baseAtoms[key] = _reactivity.createWritableAtom(table.initialState[key], { debugName: `table/baseAtoms/${key}` });
|
|
85
83
|
table.atoms[key] = _reactivity.createReadonlyAtom(() => {
|
|
86
|
-
const
|
|
87
|
-
const externalAtom = externalAtoms === null || externalAtoms === void 0 ? void 0 : externalAtoms[key];
|
|
84
|
+
const externalAtom = table.options.atoms?.[key];
|
|
88
85
|
if (externalAtom) return externalAtom.get();
|
|
89
86
|
return table.baseAtoms[key].get();
|
|
90
87
|
}, { debugName: `table/atoms/${key}` });
|
|
@@ -120,10 +117,7 @@ function constructTable(tableOptions) {
|
|
|
120
117
|
|
|
121
118
|
States: ${states.join("\n ")}\n`, { table });
|
|
122
119
|
}
|
|
123
|
-
for (let i = 0; i < featuresList.length; i++)
|
|
124
|
-
var _constructTableAPIs, _ref;
|
|
125
|
-
(_constructTableAPIs = (_ref = featuresList[i]).constructTableAPIs) === null || _constructTableAPIs === void 0 || _constructTableAPIs.call(_ref, table);
|
|
126
|
-
}
|
|
120
|
+
for (let i = 0; i < featuresList.length; i++) featuresList[i].constructTableAPIs?.(table);
|
|
127
121
|
return table;
|
|
128
122
|
}
|
|
129
123
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table 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 constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReactivityFeature!\n\n // Strip the non-feature slots: type-only meta slots, row model factories,\n // and row model fn registries all live on the `features` option but are not\n // table features themselves.\n const {\n aggregationFns,\n columnMeta: _columnMeta,\n coreRowModel,\n expandedRowModel,\n facetedMinMaxValues,\n facetedRowModel,\n facetedUniqueValues,\n filterFns,\n filterMeta: _filterMeta,\n filteredRowModel,\n groupedRowModel,\n paginatedRowModel,\n sortFns,\n sortedRowModel,\n tableMeta: _tableMeta,\n ...features\n } = tableOptions.features\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...features },\n _rowModels: {},\n _rowModelFns: { aggregationFns, filterFns, sortFns },\n baseAtoms: {},\n atoms: {},\n } as unknown as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState_All\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtoms = table.options.atoms as\n | Partial<Record<keyof TableState_All, Atom<unknown>>>\n | undefined\n const externalAtom = externalAtoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key]!.get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures> & TableState_All\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key]!.get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.entries({\n coreRowModel,\n filteredRowModel,\n groupedRowModel,\n sortedRowModel,\n expandedRowModel,\n paginatedRowModel,\n facetedRowModel,\n facetedMinMaxValues,\n facetedUniqueValues,\n })\n .filter(([, factory]) => factory)\n .map(([key]) => key)\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table as unknown as Table<TFeatures, TData>\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,qBACd,UACA,eAA2D,CAAC,GACrC;CACvB,OAAO,OAAO,QAAQ,CAAC,CAAC,SAAS,YAAY
|
|
1
|
+
{"version":3,"file":"constructTable.js","names":[],"sources":["../../../src/core/table/constructTable.ts"],"sourcesContent":["import { coreFeatures } from '../coreFeatures'\nimport { cloneState } from '../../utils'\nimport { atomToStore } from '../reactivity/coreReactivityFeature.utils'\nimport { table_syncExternalStateToBaseAtoms } from './coreTablesFeature.utils'\nimport type { Atom } from '@tanstack/store'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\nimport type { TableState, TableState_All } from '../../types/TableState'\n\n/**\n * Builds the initial table state from registered features and user initial state.\n *\n * Each feature contributes its default state before user-provided `initialState` values are merged in.\n */\nexport function getInitialTableState<TFeatures extends TableFeatures>(\n features: TFeatures,\n initialState: Partial<TableState<TFeatures>> | undefined = {},\n): TableState<TFeatures> {\n Object.values(features).forEach((feature) => {\n initialState = feature.getInitialState?.(initialState) ?? initialState\n })\n return cloneState(initialState) as TableState<TFeatures>\n}\n\n/**\n * Constructs a table 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 constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions.features.coreReactivityFeature!\n\n // Strip the non-feature slots: type-only meta slots, row model factories,\n // and row model fn registries all live on the `features` option but are not\n // table features themselves.\n const {\n aggregationFns,\n columnMeta: _columnMeta,\n coreRowModel,\n expandedRowModel,\n facetedMinMaxValues,\n facetedRowModel,\n facetedUniqueValues,\n filterFns,\n filterMeta: _filterMeta,\n filteredRowModel,\n groupedRowModel,\n paginatedRowModel,\n sortFns,\n sortedRowModel,\n tableMeta: _tableMeta,\n ...features\n } = tableOptions.features\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...features },\n _rowModels: {},\n _rowModelFns: { aggregationFns, filterFns, sortFns },\n baseAtoms: {},\n atoms: {},\n } as unknown as Table_Internal<TFeatures, TData>\n\n const featuresList: Array<TableFeature> = Object.values(table._features)\n\n const defaultOptions = featuresList.reduce((obj, feature) => {\n return Object.assign(obj, feature.getDefaultTableOptions?.(table))\n }, {}) as TableOptions<TFeatures, TData>\n\n const mergedOptions = { ...defaultOptions, ...tableOptions }\n\n if (_reactivity.wrapExternalAtoms && mergedOptions.atoms) {\n for (const [atomKey, _atom] of Object.entries(mergedOptions.atoms)) {\n const atom = _atom as Atom<any>\n const wrappedAtom = _reactivity.createWritableAtom(atom.get(), {\n debugName: `externalAtom/${atomKey}`,\n })\n ;(mergedOptions.atoms as any)[atomKey] = wrappedAtom\n // Two-way syncing between the original atom and the wrapped one.\n let syncExternal = false\n const syncAtomToWrappedSub = atom.subscribe((value) => {\n if (syncExternal) return\n wrappedAtom.set(value)\n })\n const syncWrappedToAtomSub = wrappedAtom.subscribe((value) => {\n syncExternal = true\n atom.set(value)\n syncExternal = false\n })\n _reactivity.addSubscription(syncAtomToWrappedSub)\n _reactivity.addSubscription(syncWrappedToAtomSub)\n }\n }\n\n if (_reactivity.createOptionsStore) {\n // @ts-ignore - direct set\n table.optionsStore = _reactivity.createWritableAtom<\n TableOptions<TFeatures, TData>\n >(mergedOptions, { debugName: 'table/optionsStore' })\n Object.defineProperty(table, 'options', {\n configurable: true,\n enumerable: true,\n get() {\n return table.optionsStore!.get()\n },\n set(value) {\n table.optionsStore!.set(() => value) // or your real update shape\n },\n })\n } else {\n table.options = mergedOptions\n }\n\n table.initialState = getInitialTableState(\n table._features,\n table.options.initialState,\n )\n\n const stateKeys = Object.keys(table.initialState) as Array<\n string & keyof TableState_All\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n table.baseAtoms[key] = _reactivity.createWritableAtom(\n table.initialState[key],\n {\n debugName: `table/baseAtoms/${key}`,\n },\n ) as any\n\n // create readonly derived atom: on each get(), read either external atom or base atom\n ;(table.atoms as any)[key] = _reactivity.createReadonlyAtom(\n () => {\n const externalAtoms = table.options.atoms as\n | Partial<Record<keyof TableState_All, Atom<unknown>>>\n | undefined\n const externalAtom = externalAtoms?.[key]\n if (externalAtom) {\n return externalAtom.get()\n }\n return table.baseAtoms[key]!.get()\n },\n { debugName: `table/atoms/${key}` },\n )\n }\n\n table_syncExternalStateToBaseAtoms(table)\n\n table.store = atomToStore(\n _reactivity.createReadonlyAtom(\n () => {\n const snapshot = {} as TableState<TFeatures> & TableState_All\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n ;(snapshot as Record<string, unknown>)[key] = table.atoms[key]!.get()\n }\n return snapshot\n },\n { debugName: 'table/store' },\n ),\n )\n\n if (\n process.env.NODE_ENV === 'development' &&\n (tableOptions.debugAll || tableOptions.debugTable)\n ) {\n const features = Object.keys(table._features)\n const rowModels = Object.entries({\n coreRowModel,\n filteredRowModel,\n groupedRowModel,\n sortedRowModel,\n expandedRowModel,\n paginatedRowModel,\n facetedRowModel,\n facetedMinMaxValues,\n facetedUniqueValues,\n })\n .filter(([, factory]) => factory)\n .map(([key]) => key)\n const states = Object.keys(table.initialState)\n\n console.log(\n `Constructing Table Instance\n\n Features: ${features.join('\\n ')}\n\n Row Models: ${rowModels.length ? rowModels.join('\\n ') : '(none)'}\n\n States: ${states.join('\\n ')}\\n`,\n { table },\n )\n }\n\n for (let i = 0; i < featuresList.length; i++) {\n featuresList[i]!.constructTableAPIs?.(table)\n }\n\n return table as unknown as Table<TFeatures, TData>\n}\n"],"mappings":";;;;;;;;;;;AAgBA,SAAgB,qBACd,UACA,eAA2D,CAAC,GACrC;CACvB,OAAO,OAAO,QAAQ,CAAC,CAAC,SAAS,YAAY;EAC3C,eAAe,QAAQ,kBAAkB,YAAY,KAAK;CAC5D,CAAC;CACD,OAAO,WAAW,YAAY;AAChC;;;;;;AAOA,SAAgB,eAGd,cAAuE;CACvE,MAAM,cAAc,aAAa,SAAS;CAK1C,MAAM,EACJ,gBACA,YAAY,aACZ,cACA,kBACA,qBACA,iBACA,qBACA,WACA,YAAY,aACZ,kBACA,iBACA,mBACA,SACA,gBACA,WAAW,YACX,GAAG,aACD,aAAa;CAEjB,MAAM,QAAQ;EACZ;EACA,WAAW;GAAE,GAAG;GAAc,GAAG;EAAS;EAC1C,YAAY,CAAC;EACb,cAAc;GAAE;GAAgB;GAAW;EAAQ;EACnD,WAAW,CAAC;EACZ,OAAO,CAAC;CACV;CAEA,MAAM,eAAoC,OAAO,OAAO,MAAM,SAAS;CAMvE,MAAM,gBAAgB;EAAE,GAJD,aAAa,QAAQ,KAAK,YAAY;GAC3D,OAAO,OAAO,OAAO,KAAK,QAAQ,yBAAyB,KAAK,CAAC;EACnE,GAAG,CAAC,CAEoC;EAAG,GAAG;CAAa;CAE3D,IAAI,YAAY,qBAAqB,cAAc,OACjD,KAAK,MAAM,CAAC,SAAS,UAAU,OAAO,QAAQ,cAAc,KAAK,GAAG;EAClE,MAAM,OAAO;EACb,MAAM,cAAc,YAAY,mBAAmB,KAAK,IAAI,GAAG,EAC7D,WAAW,gBAAgB,UAC7B,CAAC;EACA,AAAC,cAAc,MAAc,WAAW;EAEzC,IAAI,eAAe;EACnB,MAAM,uBAAuB,KAAK,WAAW,UAAU;GACrD,IAAI,cAAc;GAClB,YAAY,IAAI,KAAK;EACvB,CAAC;EACD,MAAM,uBAAuB,YAAY,WAAW,UAAU;GAC5D,eAAe;GACf,KAAK,IAAI,KAAK;GACd,eAAe;EACjB,CAAC;EACD,YAAY,gBAAgB,oBAAoB;EAChD,YAAY,gBAAgB,oBAAoB;CAClD;CAGF,IAAI,YAAY,oBAAoB;EAElC,MAAM,eAAe,YAAY,mBAE/B,eAAe,EAAE,WAAW,qBAAqB,CAAC;EACpD,OAAO,eAAe,OAAO,WAAW;GACtC,cAAc;GACd,YAAY;GACZ,MAAM;IACJ,OAAO,MAAM,aAAc,IAAI;GACjC;GACA,IAAI,OAAO;IACT,MAAM,aAAc,UAAU,KAAK;GACrC;EACF,CAAC;CACH,OACE,MAAM,UAAU;CAGlB,MAAM,eAAe,qBACnB,MAAM,WACN,MAAM,QAAQ,YAChB;CAEA,MAAM,YAAY,OAAO,KAAK,MAAM,YAAY;CAIhD,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;EACzC,MAAM,MAAM,UAAU;EACtB,MAAM,UAAU,OAAO,YAAY,mBACjC,MAAM,aAAa,MACnB,EACE,WAAW,mBAAmB,MAChC,CACF;EAGC,AAAC,MAAM,MAAc,OAAO,YAAY,yBACjC;GAIJ,MAAM,eAHgB,MAAM,QAAQ,QAGC;GACrC,IAAI,cACF,OAAO,aAAa,IAAI;GAE1B,OAAO,MAAM,UAAU,IAAI,CAAE,IAAI;EACnC,GACA,EAAE,WAAW,eAAe,MAAM,CACpC;CACF;CAEA,mCAAmC,KAAK;CAExC,MAAM,QAAQ,YACZ,YAAY,yBACJ;EACJ,MAAM,WAAW,CAAC;EAClB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;GACzC,MAAM,MAAM,UAAU;GACrB,AAAC,SAAqC,OAAO,MAAM,MAAM,IAAI,CAAE,IAAI;EACtE;EACA,OAAO;CACT,GACA,EAAE,WAAW,cAAc,CAC7B,CACF;CAEA,IACE,QAAQ,IAAI,aAAa,kBACxB,aAAa,YAAY,aAAa,aACvC;EACA,MAAM,WAAW,OAAO,KAAK,MAAM,SAAS;EAC5C,MAAM,YAAY,OAAO,QAAQ;GAC/B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC,CAAC,CACC,QAAQ,GAAG,aAAa,OAAO,CAAC,CAChC,KAAK,CAAC,SAAS,GAAG;EACrB,MAAM,SAAS,OAAO,KAAK,MAAM,YAAY;EAE7C,QAAQ,IACN;;gBAEU,SAAS,KAAK,kBAAkB,EAAE;;gBAElC,UAAU,SAAS,UAAU,KAAK,kBAAkB,IAAI,SAAS;;gBAEjE,OAAO,KAAK,kBAAkB,EAAE,KAC1C,EAAE,MAAM,CACV;CACF;CAEA,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KACvC,aAAa,EAAE,CAAE,qBAAqB,KAAK;CAG7C,OAAO;AACT"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_tableWorkerProtocol = require('./worker/tableWorkerProtocol.cjs');
|
|
3
|
+
const require_initTableWorker = require('./worker/initTableWorker.cjs');
|
|
4
|
+
const require_createTableWorker = require('./worker/createTableWorker.cjs');
|
|
5
|
+
const require_createWorkerRowModel = require('./worker/createWorkerRowModel.cjs');
|
|
6
|
+
|
|
7
|
+
exports.createTableWorker = require_createTableWorker.createTableWorker;
|
|
8
|
+
exports.createWorkerRowModel = require_createWorkerRowModel.createWorkerRowModel;
|
|
9
|
+
exports.getTableWorkerBridge = require_createTableWorker.getTableWorkerBridge;
|
|
10
|
+
exports.initTableWorker = require_initTableWorker.initTableWorker;
|
|
11
|
+
exports.syncTableWorker = require_createTableWorker.syncTableWorker;
|
|
12
|
+
exports.tableWorkerPipeline = require_tableWorkerProtocol.tableWorkerPipeline;
|
|
13
|
+
exports.tableWorkerStageStateDeps = require_tableWorkerProtocol.tableWorkerStageStateDeps;
|
|
14
|
+
exports.workerRowModelsFeature = require_createTableWorker.workerRowModelsFeature;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TableState_WorkerRowModels, TableWorkerGroupNode, TableWorkerRequest, TableWorkerResponse, TableWorkerResult, TableWorkerRowNode, TableWorkerStage, TableWorkerStagePayload, tableWorkerPipeline, tableWorkerStageStateDeps } from "./worker/tableWorkerProtocol.cjs";
|
|
2
|
+
import { TableWorkerConfig, initTableWorker } from "./worker/initTableWorker.cjs";
|
|
3
|
+
import { TableWorker, TableWorkerBridge, TableWorkerOptions, createTableWorker, getTableWorkerBridge, syncTableWorker, workerRowModelsFeature } from "./worker/createTableWorker.cjs";
|
|
4
|
+
import { createWorkerRowModel } from "./worker/createWorkerRowModel.cjs";
|
|
5
|
+
export { TableState_WorkerRowModels, TableWorker, TableWorkerBridge, TableWorkerConfig, TableWorkerGroupNode, TableWorkerOptions, TableWorkerRequest, TableWorkerResponse, TableWorkerResult, TableWorkerRowNode, TableWorkerStage, TableWorkerStagePayload, createTableWorker, createWorkerRowModel, getTableWorkerBridge, initTableWorker, syncTableWorker, tableWorkerPipeline, tableWorkerStageStateDeps, workerRowModelsFeature };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TableState_WorkerRowModels, TableWorkerGroupNode, TableWorkerRequest, TableWorkerResponse, TableWorkerResult, TableWorkerRowNode, TableWorkerStage, TableWorkerStagePayload, tableWorkerPipeline, tableWorkerStageStateDeps } from "./worker/tableWorkerProtocol.js";
|
|
2
|
+
import { TableWorkerConfig, initTableWorker } from "./worker/initTableWorker.js";
|
|
3
|
+
import { TableWorker, TableWorkerBridge, TableWorkerOptions, createTableWorker, getTableWorkerBridge, syncTableWorker, workerRowModelsFeature } from "./worker/createTableWorker.js";
|
|
4
|
+
import { createWorkerRowModel } from "./worker/createWorkerRowModel.js";
|
|
5
|
+
export { TableState_WorkerRowModels, TableWorker, TableWorkerBridge, TableWorkerConfig, TableWorkerGroupNode, TableWorkerOptions, TableWorkerRequest, TableWorkerResponse, TableWorkerResult, TableWorkerRowNode, TableWorkerStage, TableWorkerStagePayload, createTableWorker, createWorkerRowModel, getTableWorkerBridge, initTableWorker, syncTableWorker, tableWorkerPipeline, tableWorkerStageStateDeps, workerRowModelsFeature };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { tableWorkerPipeline, tableWorkerStageStateDeps } from "./worker/tableWorkerProtocol.js";
|
|
2
|
+
import { initTableWorker } from "./worker/initTableWorker.js";
|
|
3
|
+
import { createTableWorker, getTableWorkerBridge, syncTableWorker, workerRowModelsFeature } from "./worker/createTableWorker.js";
|
|
4
|
+
import { createWorkerRowModel } from "./worker/createWorkerRowModel.js";
|
|
5
|
+
|
|
6
|
+
export { createTableWorker, createWorkerRowModel, getTableWorkerBridge, initTableWorker, syncTableWorker, tableWorkerPipeline, tableWorkerStageStateDeps, workerRowModelsFeature };
|
|
@@ -9,15 +9,12 @@ const columnFacetingFeature = {
|
|
|
9
9
|
assignColumnPrototype: (prototype, table) => {
|
|
10
10
|
require_utils.assignPrototypeAPIs("columnFacetingFeature", prototype, table, {
|
|
11
11
|
column_getFacetedRowModel: {
|
|
12
|
-
memoDeps: () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
table.getFilteredRowModel().rows
|
|
19
|
-
];
|
|
20
|
-
},
|
|
12
|
+
memoDeps: () => [
|
|
13
|
+
table.getPreFilteredRowModel().rows,
|
|
14
|
+
table.atoms.columnFilters?.get(),
|
|
15
|
+
table.atoms.globalFilter?.get(),
|
|
16
|
+
table.getFilteredRowModel().rows
|
|
17
|
+
],
|
|
21
18
|
fn: (column) => require_columnFacetingFeature_utils.column_getFacetedRowModel(column, column.table)
|
|
22
19
|
},
|
|
23
20
|
column_getFacetedMinMaxValues: {
|
|
@@ -33,15 +30,12 @@ const columnFacetingFeature = {
|
|
|
33
30
|
constructTableAPIs: (table) => {
|
|
34
31
|
require_utils.assignTableAPIs("columnFacetingFeature", table, {
|
|
35
32
|
table_getGlobalFacetedRowModel: {
|
|
36
|
-
memoDeps: () =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
table.getFilteredRowModel().rows
|
|
43
|
-
];
|
|
44
|
-
},
|
|
33
|
+
memoDeps: () => [
|
|
34
|
+
table.getPreFilteredRowModel().rows,
|
|
35
|
+
table.atoms.columnFilters?.get(),
|
|
36
|
+
table.atoms.globalFilter?.get(),
|
|
37
|
+
table.getFilteredRowModel().rows
|
|
38
|
+
],
|
|
45
39
|
fn: () => require_columnFacetingFeature_utils.table_getGlobalFacetedRowModel(table)
|
|
46
40
|
},
|
|
47
41
|
table_getGlobalFacetedMinMaxValues: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFacetingFeature.cjs","names":["column_getFacetedRowModel","callMemoOrStaticFn","column_getFacetedMinMaxValues","column_getFacetedUniqueValues","table_getGlobalFacetedRowModel","table_getGlobalFacetedMinMaxValues","table_getGlobalFacetedUniqueValues"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Feature that derives faceted row models, unique values, and min/max values for filters.\n */\nexport const columnFacetingFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAkBA,MAAa,wBAAsC;CACjD,wBAAwB,WAAW,UAAU;EAC3C,kCAAoB,yBAAyB,WAAW,OAAO;GAC7D,2BAA2B;IACzB,gBAAgB
|
|
1
|
+
{"version":3,"file":"columnFacetingFeature.cjs","names":["column_getFacetedRowModel","callMemoOrStaticFn","column_getFacetedMinMaxValues","column_getFacetedUniqueValues","table_getGlobalFacetedRowModel","table_getGlobalFacetedMinMaxValues","table_getGlobalFacetedUniqueValues"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Feature that derives faceted row models, unique values, and min/max values for filters.\n */\nexport const columnFacetingFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAkBA,MAAa,wBAAsC;CACjD,wBAAwB,WAAW,UAAU;EAC3C,kCAAoB,yBAAyB,WAAW,OAAO;GAC7D,2BAA2B;IACzB,gBAAgB;KACd,MAAM,uBAAuB,CAAC,CAAC;KAC/B,MAAM,MAAM,eAAe,IAAI;KAC/B,MAAM,MAAM,cAAc,IAAI;KAC9B,MAAM,oBAAoB,CAAC,CAAC;IAC9B;IACA,KAAK,WAAWA,8DAA0B,QAAQ,OAAO,KAAK;GAChE;GACA,+BAA+B;IAC7B,WAAW,WAAW,CACpBC,iCACE,QACA,sBACAD,+DACA,OAAO,KACT,CAAC,CAAC,QACJ;IACA,KAAK,WAAWE,kEAA8B,QAAQ,OAAO,KAAK;GACpE;GACA,+BAA+B;IAC7B,WAAW,WAAW,CACpBD,iCACE,QACA,sBACAD,+DACA,OAAO,KACT,CAAC,CAAC,QACJ;IACA,KAAK,WAAWG,kEAA8B,QAAQ,OAAO,KAAK;GACpE;EACF,CAAC;CACH;CAEA,qBAAqB,UAAU;EAC7B,8BAAgB,yBAAyB,OAAO;GAC9C,gCAAgC;IAC9B,gBAAgB;KACd,MAAM,uBAAuB,CAAC,CAAC;KAC/B,MAAM,MAAM,eAAe,IAAI;KAC/B,MAAM,MAAM,cAAc,IAAI;KAC9B,MAAM,oBAAoB,CAAC,CAAC;IAC9B;IACA,UAAUC,mEAA+B,KAAK;GAChD;GACA,oCAAoC;IAClC,gBAAgB,CACdH,iCACE,OACA,4BACAG,kEACF,CAAC,CAAC,QACJ;IACA,UAAUC,uEAAmC,KAAK;GACpD;GACA,oCAAoC;IAClC,gBAAgB,CACdJ,iCACE,OACA,4BACAG,kEACF,CAAC,CAAC,QACJ;IACA,UAAUE,uEAAmC,KAAK;GACpD;EACF,CAAC;CACH;AACF"}
|
|
@@ -9,15 +9,12 @@ const columnFacetingFeature = {
|
|
|
9
9
|
assignColumnPrototype: (prototype, table) => {
|
|
10
10
|
assignPrototypeAPIs("columnFacetingFeature", prototype, table, {
|
|
11
11
|
column_getFacetedRowModel: {
|
|
12
|
-
memoDeps: () =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
table.getFilteredRowModel().rows
|
|
19
|
-
];
|
|
20
|
-
},
|
|
12
|
+
memoDeps: () => [
|
|
13
|
+
table.getPreFilteredRowModel().rows,
|
|
14
|
+
table.atoms.columnFilters?.get(),
|
|
15
|
+
table.atoms.globalFilter?.get(),
|
|
16
|
+
table.getFilteredRowModel().rows
|
|
17
|
+
],
|
|
21
18
|
fn: (column) => column_getFacetedRowModel(column, column.table)
|
|
22
19
|
},
|
|
23
20
|
column_getFacetedMinMaxValues: {
|
|
@@ -33,15 +30,12 @@ const columnFacetingFeature = {
|
|
|
33
30
|
constructTableAPIs: (table) => {
|
|
34
31
|
assignTableAPIs("columnFacetingFeature", table, {
|
|
35
32
|
table_getGlobalFacetedRowModel: {
|
|
36
|
-
memoDeps: () =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
table.getFilteredRowModel().rows
|
|
43
|
-
];
|
|
44
|
-
},
|
|
33
|
+
memoDeps: () => [
|
|
34
|
+
table.getPreFilteredRowModel().rows,
|
|
35
|
+
table.atoms.columnFilters?.get(),
|
|
36
|
+
table.atoms.globalFilter?.get(),
|
|
37
|
+
table.getFilteredRowModel().rows
|
|
38
|
+
],
|
|
45
39
|
fn: () => table_getGlobalFacetedRowModel(table)
|
|
46
40
|
},
|
|
47
41
|
table_getGlobalFacetedMinMaxValues: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFacetingFeature.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Feature that derives faceted row models, unique values, and min/max values for filters.\n */\nexport const columnFacetingFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAkBA,MAAa,wBAAsC;CACjD,wBAAwB,WAAW,UAAU;EAC3C,oBAAoB,yBAAyB,WAAW,OAAO;GAC7D,2BAA2B;IACzB,gBAAgB
|
|
1
|
+
{"version":3,"file":"columnFacetingFeature.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.ts"],"sourcesContent":["import {\n assignPrototypeAPIs,\n assignTableAPIs,\n callMemoOrStaticFn,\n} from '../../utils'\nimport {\n column_getFacetedMinMaxValues,\n column_getFacetedRowModel,\n column_getFacetedUniqueValues,\n table_getGlobalFacetedMinMaxValues,\n table_getGlobalFacetedRowModel,\n table_getGlobalFacetedUniqueValues,\n} from './columnFacetingFeature.utils'\nimport type { TableFeature } from '../../types/TableFeatures'\n\n/**\n * Feature that derives faceted row models, unique values, and min/max values for filters.\n */\nexport const columnFacetingFeature: TableFeature = {\n assignColumnPrototype: (prototype, table) => {\n assignPrototypeAPIs('columnFacetingFeature', prototype, table, {\n column_getFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: (column) => column_getFacetedRowModel(column, column.table),\n },\n column_getFacetedMinMaxValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedMinMaxValues(column, column.table),\n },\n column_getFacetedUniqueValues: {\n memoDeps: (column) => [\n callMemoOrStaticFn(\n column,\n 'getFacetedRowModel',\n column_getFacetedRowModel,\n column.table,\n ).flatRows,\n ],\n fn: (column) => column_getFacetedUniqueValues(column, column.table),\n },\n })\n },\n\n constructTableAPIs: (table) => {\n assignTableAPIs('columnFacetingFeature', table, {\n table_getGlobalFacetedRowModel: {\n memoDeps: () => [\n table.getPreFilteredRowModel().rows,\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel().rows,\n ],\n fn: () => table_getGlobalFacetedRowModel(table),\n },\n table_getGlobalFacetedMinMaxValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedMinMaxValues(table),\n },\n table_getGlobalFacetedUniqueValues: {\n memoDeps: () => [\n callMemoOrStaticFn(\n table,\n 'getGlobalFacetedRowModel',\n table_getGlobalFacetedRowModel,\n ).flatRows,\n ],\n fn: () => table_getGlobalFacetedUniqueValues(table),\n },\n })\n },\n}\n"],"mappings":";;;;;;;AAkBA,MAAa,wBAAsC;CACjD,wBAAwB,WAAW,UAAU;EAC3C,oBAAoB,yBAAyB,WAAW,OAAO;GAC7D,2BAA2B;IACzB,gBAAgB;KACd,MAAM,uBAAuB,CAAC,CAAC;KAC/B,MAAM,MAAM,eAAe,IAAI;KAC/B,MAAM,MAAM,cAAc,IAAI;KAC9B,MAAM,oBAAoB,CAAC,CAAC;IAC9B;IACA,KAAK,WAAW,0BAA0B,QAAQ,OAAO,KAAK;GAChE;GACA,+BAA+B;IAC7B,WAAW,WAAW,CACpB,mBACE,QACA,sBACA,2BACA,OAAO,KACT,CAAC,CAAC,QACJ;IACA,KAAK,WAAW,8BAA8B,QAAQ,OAAO,KAAK;GACpE;GACA,+BAA+B;IAC7B,WAAW,WAAW,CACpB,mBACE,QACA,sBACA,2BACA,OAAO,KACT,CAAC,CAAC,QACJ;IACA,KAAK,WAAW,8BAA8B,QAAQ,OAAO,KAAK;GACpE;EACF,CAAC;CACH;CAEA,qBAAqB,UAAU;EAC7B,gBAAgB,yBAAyB,OAAO;GAC9C,gCAAgC;IAC9B,gBAAgB;KACd,MAAM,uBAAuB,CAAC,CAAC;KAC/B,MAAM,MAAM,eAAe,IAAI;KAC/B,MAAM,MAAM,cAAc,IAAI;KAC9B,MAAM,oBAAoB,CAAC,CAAC;IAC9B;IACA,UAAU,+BAA+B,KAAK;GAChD;GACA,oCAAoC;IAClC,gBAAgB,CACd,mBACE,OACA,4BACA,8BACF,CAAC,CAAC,QACJ;IACA,UAAU,mCAAmC,KAAK;GACpD;GACA,oCAAoC;IAClC,gBAAgB,CACd,mBACE,OACA,4BACA,8BACF,CAAC,CAAC,QACJ;IACA,UAAU,mCAAmC,KAAK;GACpD;EACF,CAAC;CACH;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.cjs";
|
|
2
|
-
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
3
2
|
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.cjs";
|
|
3
|
+
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
4
4
|
|
|
5
5
|
//#region src/features/column-faceting/columnFacetingFeature.types.d.ts
|
|
6
6
|
interface Column_ColumnFaceting<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RowData } from "../../types/type-utils.js";
|
|
2
|
-
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
3
2
|
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
3
|
+
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
4
4
|
|
|
5
5
|
//#region src/features/column-faceting/columnFacetingFeature.types.d.ts
|
|
6
6
|
interface Column_ColumnFaceting<in out TFeatures extends TableFeatures, in out TData extends RowData> {
|
|
@@ -15,10 +15,7 @@ const require_utils = require('../../utils.cjs');
|
|
|
15
15
|
function column_getFacetedMinMaxValues(column, table) {
|
|
16
16
|
const facetedMinMaxValues = table._rowModels.facetedMinMaxValues ??= require_utils.makeObjectMap();
|
|
17
17
|
let facetedMinMaxValuesFn = facetedMinMaxValues[column.id];
|
|
18
|
-
if (!facetedMinMaxValuesFn)
|
|
19
|
-
var _table$options$featur, _table$options$featur2;
|
|
20
|
-
facetedMinMaxValuesFn = facetedMinMaxValues[column.id] = ((_table$options$featur = (_table$options$featur2 = table.options.features).facetedMinMaxValues) === null || _table$options$featur === void 0 ? void 0 : _table$options$featur.call(_table$options$featur2, table, column.id)) ?? (() => void 0);
|
|
21
|
-
}
|
|
18
|
+
if (!facetedMinMaxValuesFn) facetedMinMaxValuesFn = facetedMinMaxValues[column.id] = table.options.features.facetedMinMaxValues?.(table, column.id) ?? (() => void 0);
|
|
22
19
|
return facetedMinMaxValuesFn();
|
|
23
20
|
}
|
|
24
21
|
/**
|
|
@@ -34,13 +31,10 @@ function column_getFacetedMinMaxValues(column, table) {
|
|
|
34
31
|
* ```
|
|
35
32
|
*/
|
|
36
33
|
function column_getFacetedRowModel(column, table) {
|
|
37
|
-
const columnId =
|
|
34
|
+
const columnId = column?.id ?? "";
|
|
38
35
|
const facetedRowModels = table._rowModels.facetedRowModels ??= require_utils.makeObjectMap();
|
|
39
36
|
let facetedRowModelFn = facetedRowModels[columnId];
|
|
40
|
-
if (!facetedRowModelFn)
|
|
41
|
-
var _table$options$featur3, _table$options$featur4;
|
|
42
|
-
facetedRowModelFn = facetedRowModels[columnId] = ((_table$options$featur3 = (_table$options$featur4 = table.options.features).facetedRowModel) === null || _table$options$featur3 === void 0 ? void 0 : _table$options$featur3.call(_table$options$featur4, table, columnId)) ?? (() => table.getPreFilteredRowModel());
|
|
43
|
-
}
|
|
37
|
+
if (!facetedRowModelFn) facetedRowModelFn = facetedRowModels[columnId] = table.options.features.facetedRowModel?.(table, columnId) ?? (() => table.getPreFilteredRowModel());
|
|
44
38
|
return facetedRowModelFn();
|
|
45
39
|
}
|
|
46
40
|
/**
|
|
@@ -57,10 +51,7 @@ function column_getFacetedRowModel(column, table) {
|
|
|
57
51
|
function column_getFacetedUniqueValues(column, table) {
|
|
58
52
|
const facetedUniqueValues = table._rowModels.facetedUniqueValues ??= require_utils.makeObjectMap();
|
|
59
53
|
let facetedUniqueValuesFn = facetedUniqueValues[column.id];
|
|
60
|
-
if (!facetedUniqueValuesFn)
|
|
61
|
-
var _table$options$featur5, _table$options$featur6;
|
|
62
|
-
facetedUniqueValuesFn = facetedUniqueValues[column.id] = ((_table$options$featur5 = (_table$options$featur6 = table.options.features).facetedUniqueValues) === null || _table$options$featur5 === void 0 ? void 0 : _table$options$featur5.call(_table$options$featur6, table, column.id)) ?? (() => /* @__PURE__ */ new Map());
|
|
63
|
-
}
|
|
54
|
+
if (!facetedUniqueValuesFn) facetedUniqueValuesFn = facetedUniqueValues[column.id] = table.options.features.facetedUniqueValues?.(table, column.id) ?? (() => /* @__PURE__ */ new Map());
|
|
64
55
|
return facetedUniqueValuesFn();
|
|
65
56
|
}
|
|
66
57
|
/**
|
|
@@ -75,10 +66,7 @@ function column_getFacetedUniqueValues(column, table) {
|
|
|
75
66
|
* ```
|
|
76
67
|
*/
|
|
77
68
|
function table_getGlobalFacetedMinMaxValues(table) {
|
|
78
|
-
if (!table._rowModels.globalFacetedMinMaxValues)
|
|
79
|
-
var _table$options$featur7, _table$options$featur8;
|
|
80
|
-
table._rowModels.globalFacetedMinMaxValues = ((_table$options$featur7 = (_table$options$featur8 = table.options.features).facetedMinMaxValues) === null || _table$options$featur7 === void 0 ? void 0 : _table$options$featur7.call(_table$options$featur8, table, "__global__")) ?? (() => void 0);
|
|
81
|
-
}
|
|
69
|
+
if (!table._rowModels.globalFacetedMinMaxValues) table._rowModels.globalFacetedMinMaxValues = table.options.features.facetedMinMaxValues?.(table, "__global__") ?? (() => void 0);
|
|
82
70
|
const facetedMinMaxValuesFn = table._rowModels.globalFacetedMinMaxValues;
|
|
83
71
|
return facetedMinMaxValuesFn();
|
|
84
72
|
}
|
|
@@ -95,10 +83,7 @@ function table_getGlobalFacetedMinMaxValues(table) {
|
|
|
95
83
|
* ```
|
|
96
84
|
*/
|
|
97
85
|
function table_getGlobalFacetedRowModel(table) {
|
|
98
|
-
if (!table._rowModels.globalFacetedRowModel)
|
|
99
|
-
var _table$options$featur9, _table$options$featur10;
|
|
100
|
-
table._rowModels.globalFacetedRowModel = ((_table$options$featur9 = (_table$options$featur10 = table.options.features).facetedRowModel) === null || _table$options$featur9 === void 0 ? void 0 : _table$options$featur9.call(_table$options$featur10, table, "__global__")) ?? (() => table.getPreFilteredRowModel());
|
|
101
|
-
}
|
|
86
|
+
if (!table._rowModels.globalFacetedRowModel) table._rowModels.globalFacetedRowModel = table.options.features.facetedRowModel?.(table, "__global__") ?? (() => table.getPreFilteredRowModel());
|
|
102
87
|
const facetedRowModelFn = table._rowModels.globalFacetedRowModel;
|
|
103
88
|
return facetedRowModelFn();
|
|
104
89
|
}
|
|
@@ -114,10 +99,7 @@ function table_getGlobalFacetedRowModel(table) {
|
|
|
114
99
|
* ```
|
|
115
100
|
*/
|
|
116
101
|
function table_getGlobalFacetedUniqueValues(table) {
|
|
117
|
-
if (!table._rowModels.globalFacetedUniqueValues)
|
|
118
|
-
var _table$options$featur11, _table$options$featur12;
|
|
119
|
-
table._rowModels.globalFacetedUniqueValues = ((_table$options$featur11 = (_table$options$featur12 = table.options.features).facetedUniqueValues) === null || _table$options$featur11 === void 0 ? void 0 : _table$options$featur11.call(_table$options$featur12, table, "__global__")) ?? (() => /* @__PURE__ */ new Map());
|
|
120
|
-
}
|
|
102
|
+
if (!table._rowModels.globalFacetedUniqueValues) table._rowModels.globalFacetedUniqueValues = table.options.features.facetedUniqueValues?.(table, "__global__") ?? (() => /* @__PURE__ */ new Map());
|
|
121
103
|
const facetedUniqueValuesFn = table._rowModels.globalFacetedUniqueValues;
|
|
122
104
|
return facetedUniqueValuesFn();
|
|
123
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFacetingFeature.utils.cjs","names":["makeObjectMap"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValues = (table._rowModels.facetedMinMaxValues ??=\n makeObjectMap())\n let facetedMinMaxValuesFn = facetedMinMaxValues[column.id]\n\n if (!facetedMinMaxValuesFn) {\n facetedMinMaxValuesFn = facetedMinMaxValues[column.id] =\n table.options.features.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n }\n\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const columnId = column?.id ?? ''\n const facetedRowModels = (table._rowModels.facetedRowModels ??=\n makeObjectMap())\n let facetedRowModelFn = facetedRowModels[columnId]\n\n if (!facetedRowModelFn) {\n facetedRowModelFn = facetedRowModels[columnId] =\n table.options.features.facetedRowModel?.(table, columnId) ??\n (() => table.getPreFilteredRowModel())\n }\n\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValues = (table._rowModels.facetedUniqueValues ??=\n makeObjectMap())\n let facetedUniqueValuesFn = facetedUniqueValues[column.id]\n\n if (!facetedUniqueValuesFn) {\n facetedUniqueValuesFn = facetedUniqueValues[column.id] =\n table.options.features.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n }\n\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n if (!table._rowModels.globalFacetedMinMaxValues) {\n table._rowModels.globalFacetedMinMaxValues =\n table.options.features.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n }\n\n const facetedMinMaxValuesFn = table._rowModels.globalFacetedMinMaxValues\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.globalFacetedRowModel) {\n table._rowModels.globalFacetedRowModel =\n table.options.features.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n }\n\n const facetedRowModelFn = table._rowModels.globalFacetedRowModel\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n if (!table._rowModels.globalFacetedUniqueValues) {\n table._rowModels.globalFacetedUniqueValues =\n table.options.features.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n }\n\n const facetedUniqueValuesFn = table._rowModels.globalFacetedUniqueValues\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,8BAKd,QACA,OAC8B;CAC9B,MAAM,sBAAuB,MAAM,WAAW,wBAC5CA,4BAAc;CAChB,IAAI,wBAAwB,oBAAoB,OAAO;CAEvD,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"columnFacetingFeature.utils.cjs","names":["makeObjectMap"],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValues = (table._rowModels.facetedMinMaxValues ??=\n makeObjectMap())\n let facetedMinMaxValuesFn = facetedMinMaxValues[column.id]\n\n if (!facetedMinMaxValuesFn) {\n facetedMinMaxValuesFn = facetedMinMaxValues[column.id] =\n table.options.features.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n }\n\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const columnId = column?.id ?? ''\n const facetedRowModels = (table._rowModels.facetedRowModels ??=\n makeObjectMap())\n let facetedRowModelFn = facetedRowModels[columnId]\n\n if (!facetedRowModelFn) {\n facetedRowModelFn = facetedRowModels[columnId] =\n table.options.features.facetedRowModel?.(table, columnId) ??\n (() => table.getPreFilteredRowModel())\n }\n\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValues = (table._rowModels.facetedUniqueValues ??=\n makeObjectMap())\n let facetedUniqueValuesFn = facetedUniqueValues[column.id]\n\n if (!facetedUniqueValuesFn) {\n facetedUniqueValuesFn = facetedUniqueValues[column.id] =\n table.options.features.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n }\n\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n if (!table._rowModels.globalFacetedMinMaxValues) {\n table._rowModels.globalFacetedMinMaxValues =\n table.options.features.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n }\n\n const facetedMinMaxValuesFn = table._rowModels.globalFacetedMinMaxValues\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.globalFacetedRowModel) {\n table._rowModels.globalFacetedRowModel =\n table.options.features.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n }\n\n const facetedRowModelFn = table._rowModels.globalFacetedRowModel\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n if (!table._rowModels.globalFacetedUniqueValues) {\n table._rowModels.globalFacetedUniqueValues =\n table.options.features.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n }\n\n const facetedUniqueValuesFn = table._rowModels.globalFacetedUniqueValues\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,8BAKd,QACA,OAC8B;CAC9B,MAAM,sBAAuB,MAAM,WAAW,wBAC5CA,4BAAc;CAChB,IAAI,wBAAwB,oBAAoB,OAAO;CAEvD,IAAI,CAAC,uBACH,wBAAwB,oBAAoB,OAAO,MACjD,MAAM,QAAQ,SAAS,sBAAsB,OAAO,OAAO,EAAE,YACtD;CAGX,OAAO,sBAAsB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,0BAKd,QACA,OAC4B;CAC5B,MAAM,WAAW,QAAQ,MAAM;CAC/B,MAAM,mBAAoB,MAAM,WAAW,qBACzCA,4BAAc;CAChB,IAAI,oBAAoB,iBAAiB;CAEzC,IAAI,CAAC,mBACH,oBAAoB,iBAAiB,YACnC,MAAM,QAAQ,SAAS,kBAAkB,OAAO,QAAQ,YACjD,MAAM,uBAAuB;CAGxC,OAAO,kBAAkB;AAC3B;;;;;;;;;;;;AAaA,SAAgB,8BAKd,QACA,OACkB;CAClB,MAAM,sBAAuB,MAAM,WAAW,wBAC5CA,4BAAc;CAChB,IAAI,wBAAwB,oBAAoB,OAAO;CAEvD,IAAI,CAAC,uBACH,wBAAwB,oBAAoB,OAAO,MACjD,MAAM,QAAQ,SAAS,sBAAsB,OAAO,OAAO,EAAE,4BACtD,IAAI,IAAiB;CAGhC,OAAO,sBAAsB;AAC/B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAAuE;CACvE,IAAI,CAAC,MAAM,WAAW,2BACpB,MAAM,WAAW,4BACf,MAAM,QAAQ,SAAS,sBAAsB,OAAO,YAAY,YACzD;CAGX,MAAM,wBAAwB,MAAM,WAAW;CAC/C,OAAO,sBAAsB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,+BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,uBACpB,MAAM,WAAW,wBACf,MAAM,QAAQ,SAAS,kBAAkB,OAAO,YAAY,YACrD,MAAM,uBAAuB;CAGxC,MAAM,oBAAoB,MAAM,WAAW;CAC3C,OAAO,kBAAkB;AAC3B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAA2D;CAC3D,IAAI,CAAC,MAAM,WAAW,2BACpB,MAAM,WAAW,4BACf,MAAM,QAAQ,SAAS,sBAAsB,OAAO,YAAY,4BACzD,IAAI,IAAI;CAGnB,MAAM,wBAAwB,MAAM,WAAW;CAC/C,OAAO,sBAAsB;AAC/B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.cjs";
|
|
2
|
+
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.cjs";
|
|
2
3
|
import { Table } from "../../types/Table.cjs";
|
|
3
4
|
import { Column } from "../../types/Column.cjs";
|
|
4
5
|
import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
5
|
-
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/features/column-faceting/columnFacetingFeature.utils.d.ts
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CellData, RowData } from "../../types/type-utils.js";
|
|
2
|
+
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
2
3
|
import { Table } from "../../types/Table.js";
|
|
3
4
|
import { Column } from "../../types/Column.js";
|
|
4
5
|
import { TableFeatures } from "../../types/TableFeatures.js";
|
|
5
|
-
import { RowModel } from "../../core/row-models/coreRowModelsFeature.types.js";
|
|
6
6
|
|
|
7
7
|
//#region src/features/column-faceting/columnFacetingFeature.utils.d.ts
|
|
8
8
|
/**
|
|
@@ -15,10 +15,7 @@ import { makeObjectMap } from "../../utils.js";
|
|
|
15
15
|
function column_getFacetedMinMaxValues(column, table) {
|
|
16
16
|
const facetedMinMaxValues = table._rowModels.facetedMinMaxValues ??= makeObjectMap();
|
|
17
17
|
let facetedMinMaxValuesFn = facetedMinMaxValues[column.id];
|
|
18
|
-
if (!facetedMinMaxValuesFn)
|
|
19
|
-
var _table$options$featur, _table$options$featur2;
|
|
20
|
-
facetedMinMaxValuesFn = facetedMinMaxValues[column.id] = ((_table$options$featur = (_table$options$featur2 = table.options.features).facetedMinMaxValues) === null || _table$options$featur === void 0 ? void 0 : _table$options$featur.call(_table$options$featur2, table, column.id)) ?? (() => void 0);
|
|
21
|
-
}
|
|
18
|
+
if (!facetedMinMaxValuesFn) facetedMinMaxValuesFn = facetedMinMaxValues[column.id] = table.options.features.facetedMinMaxValues?.(table, column.id) ?? (() => void 0);
|
|
22
19
|
return facetedMinMaxValuesFn();
|
|
23
20
|
}
|
|
24
21
|
/**
|
|
@@ -34,13 +31,10 @@ function column_getFacetedMinMaxValues(column, table) {
|
|
|
34
31
|
* ```
|
|
35
32
|
*/
|
|
36
33
|
function column_getFacetedRowModel(column, table) {
|
|
37
|
-
const columnId =
|
|
34
|
+
const columnId = column?.id ?? "";
|
|
38
35
|
const facetedRowModels = table._rowModels.facetedRowModels ??= makeObjectMap();
|
|
39
36
|
let facetedRowModelFn = facetedRowModels[columnId];
|
|
40
|
-
if (!facetedRowModelFn)
|
|
41
|
-
var _table$options$featur3, _table$options$featur4;
|
|
42
|
-
facetedRowModelFn = facetedRowModels[columnId] = ((_table$options$featur3 = (_table$options$featur4 = table.options.features).facetedRowModel) === null || _table$options$featur3 === void 0 ? void 0 : _table$options$featur3.call(_table$options$featur4, table, columnId)) ?? (() => table.getPreFilteredRowModel());
|
|
43
|
-
}
|
|
37
|
+
if (!facetedRowModelFn) facetedRowModelFn = facetedRowModels[columnId] = table.options.features.facetedRowModel?.(table, columnId) ?? (() => table.getPreFilteredRowModel());
|
|
44
38
|
return facetedRowModelFn();
|
|
45
39
|
}
|
|
46
40
|
/**
|
|
@@ -57,10 +51,7 @@ function column_getFacetedRowModel(column, table) {
|
|
|
57
51
|
function column_getFacetedUniqueValues(column, table) {
|
|
58
52
|
const facetedUniqueValues = table._rowModels.facetedUniqueValues ??= makeObjectMap();
|
|
59
53
|
let facetedUniqueValuesFn = facetedUniqueValues[column.id];
|
|
60
|
-
if (!facetedUniqueValuesFn)
|
|
61
|
-
var _table$options$featur5, _table$options$featur6;
|
|
62
|
-
facetedUniqueValuesFn = facetedUniqueValues[column.id] = ((_table$options$featur5 = (_table$options$featur6 = table.options.features).facetedUniqueValues) === null || _table$options$featur5 === void 0 ? void 0 : _table$options$featur5.call(_table$options$featur6, table, column.id)) ?? (() => /* @__PURE__ */ new Map());
|
|
63
|
-
}
|
|
54
|
+
if (!facetedUniqueValuesFn) facetedUniqueValuesFn = facetedUniqueValues[column.id] = table.options.features.facetedUniqueValues?.(table, column.id) ?? (() => /* @__PURE__ */ new Map());
|
|
64
55
|
return facetedUniqueValuesFn();
|
|
65
56
|
}
|
|
66
57
|
/**
|
|
@@ -75,10 +66,7 @@ function column_getFacetedUniqueValues(column, table) {
|
|
|
75
66
|
* ```
|
|
76
67
|
*/
|
|
77
68
|
function table_getGlobalFacetedMinMaxValues(table) {
|
|
78
|
-
if (!table._rowModels.globalFacetedMinMaxValues)
|
|
79
|
-
var _table$options$featur7, _table$options$featur8;
|
|
80
|
-
table._rowModels.globalFacetedMinMaxValues = ((_table$options$featur7 = (_table$options$featur8 = table.options.features).facetedMinMaxValues) === null || _table$options$featur7 === void 0 ? void 0 : _table$options$featur7.call(_table$options$featur8, table, "__global__")) ?? (() => void 0);
|
|
81
|
-
}
|
|
69
|
+
if (!table._rowModels.globalFacetedMinMaxValues) table._rowModels.globalFacetedMinMaxValues = table.options.features.facetedMinMaxValues?.(table, "__global__") ?? (() => void 0);
|
|
82
70
|
const facetedMinMaxValuesFn = table._rowModels.globalFacetedMinMaxValues;
|
|
83
71
|
return facetedMinMaxValuesFn();
|
|
84
72
|
}
|
|
@@ -95,10 +83,7 @@ function table_getGlobalFacetedMinMaxValues(table) {
|
|
|
95
83
|
* ```
|
|
96
84
|
*/
|
|
97
85
|
function table_getGlobalFacetedRowModel(table) {
|
|
98
|
-
if (!table._rowModels.globalFacetedRowModel)
|
|
99
|
-
var _table$options$featur9, _table$options$featur10;
|
|
100
|
-
table._rowModels.globalFacetedRowModel = ((_table$options$featur9 = (_table$options$featur10 = table.options.features).facetedRowModel) === null || _table$options$featur9 === void 0 ? void 0 : _table$options$featur9.call(_table$options$featur10, table, "__global__")) ?? (() => table.getPreFilteredRowModel());
|
|
101
|
-
}
|
|
86
|
+
if (!table._rowModels.globalFacetedRowModel) table._rowModels.globalFacetedRowModel = table.options.features.facetedRowModel?.(table, "__global__") ?? (() => table.getPreFilteredRowModel());
|
|
102
87
|
const facetedRowModelFn = table._rowModels.globalFacetedRowModel;
|
|
103
88
|
return facetedRowModelFn();
|
|
104
89
|
}
|
|
@@ -114,10 +99,7 @@ function table_getGlobalFacetedRowModel(table) {
|
|
|
114
99
|
* ```
|
|
115
100
|
*/
|
|
116
101
|
function table_getGlobalFacetedUniqueValues(table) {
|
|
117
|
-
if (!table._rowModels.globalFacetedUniqueValues)
|
|
118
|
-
var _table$options$featur11, _table$options$featur12;
|
|
119
|
-
table._rowModels.globalFacetedUniqueValues = ((_table$options$featur11 = (_table$options$featur12 = table.options.features).facetedUniqueValues) === null || _table$options$featur11 === void 0 ? void 0 : _table$options$featur11.call(_table$options$featur12, table, "__global__")) ?? (() => /* @__PURE__ */ new Map());
|
|
120
|
-
}
|
|
102
|
+
if (!table._rowModels.globalFacetedUniqueValues) table._rowModels.globalFacetedUniqueValues = table.options.features.facetedUniqueValues?.(table, "__global__") ?? (() => /* @__PURE__ */ new Map());
|
|
121
103
|
const facetedUniqueValuesFn = table._rowModels.globalFacetedUniqueValues;
|
|
122
104
|
return facetedUniqueValuesFn();
|
|
123
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnFacetingFeature.utils.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValues = (table._rowModels.facetedMinMaxValues ??=\n makeObjectMap())\n let facetedMinMaxValuesFn = facetedMinMaxValues[column.id]\n\n if (!facetedMinMaxValuesFn) {\n facetedMinMaxValuesFn = facetedMinMaxValues[column.id] =\n table.options.features.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n }\n\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const columnId = column?.id ?? ''\n const facetedRowModels = (table._rowModels.facetedRowModels ??=\n makeObjectMap())\n let facetedRowModelFn = facetedRowModels[columnId]\n\n if (!facetedRowModelFn) {\n facetedRowModelFn = facetedRowModels[columnId] =\n table.options.features.facetedRowModel?.(table, columnId) ??\n (() => table.getPreFilteredRowModel())\n }\n\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValues = (table._rowModels.facetedUniqueValues ??=\n makeObjectMap())\n let facetedUniqueValuesFn = facetedUniqueValues[column.id]\n\n if (!facetedUniqueValuesFn) {\n facetedUniqueValuesFn = facetedUniqueValues[column.id] =\n table.options.features.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n }\n\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n if (!table._rowModels.globalFacetedMinMaxValues) {\n table._rowModels.globalFacetedMinMaxValues =\n table.options.features.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n }\n\n const facetedMinMaxValuesFn = table._rowModels.globalFacetedMinMaxValues\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.globalFacetedRowModel) {\n table._rowModels.globalFacetedRowModel =\n table.options.features.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n }\n\n const facetedRowModelFn = table._rowModels.globalFacetedRowModel\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n if (!table._rowModels.globalFacetedUniqueValues) {\n table._rowModels.globalFacetedUniqueValues =\n table.options.features.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n }\n\n const facetedUniqueValuesFn = table._rowModels.globalFacetedUniqueValues\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,8BAKd,QACA,OAC8B;CAC9B,MAAM,sBAAuB,MAAM,WAAW,wBAC5C,cAAc;CAChB,IAAI,wBAAwB,oBAAoB,OAAO;CAEvD,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"columnFacetingFeature.utils.js","names":[],"sources":["../../../src/features/column-faceting/columnFacetingFeature.utils.ts"],"sourcesContent":["import { makeObjectMap } from '../../utils'\nimport type { CellData, RowData } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\n\n/**\n * Computes min and max numeric facet values for one column.\n *\n * The configured `facetedMinMaxValues` row-model factory owns the calculation.\n * If no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = column_getFacetedMinMaxValues(column, table)\n * ```\n */\nexport function column_getFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): [number, number] | undefined {\n const facetedMinMaxValues = (table._rowModels.facetedMinMaxValues ??=\n makeObjectMap())\n let facetedMinMaxValuesFn = facetedMinMaxValues[column.id]\n\n if (!facetedMinMaxValuesFn) {\n facetedMinMaxValuesFn = facetedMinMaxValues[column.id] =\n table.options.features.facetedMinMaxValues?.(table, column.id) ??\n (() => undefined)\n }\n\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive one column's facet values.\n *\n * The faceted row model normally applies every other active filter while\n * excluding this column's own filter. If no factory is registered, the\n * pre-filtered row model is returned.\n *\n * @example\n * ```ts\n * const rows = column_getFacetedRowModel(column, table)\n * ```\n */\nexport function column_getFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue> | undefined,\n table: Table_Internal<TFeatures, TData>,\n): RowModel<TFeatures, TData> {\n const columnId = column?.id ?? ''\n const facetedRowModels = (table._rowModels.facetedRowModels ??=\n makeObjectMap())\n let facetedRowModelFn = facetedRowModels[columnId]\n\n if (!facetedRowModelFn) {\n facetedRowModelFn = facetedRowModels[columnId] =\n table.options.features.facetedRowModel?.(table, columnId) ??\n (() => table.getPreFilteredRowModel())\n }\n\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique facet values and their occurrence counts for one column.\n *\n * The configured `facetedUniqueValues` row-model factory owns the calculation.\n * If no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = column_getFacetedUniqueValues(column, table)\n * ```\n */\nexport function column_getFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n table: Table_Internal<TFeatures, TData>,\n): Map<any, number> {\n const facetedUniqueValues = (table._rowModels.facetedUniqueValues ??=\n makeObjectMap())\n let facetedUniqueValuesFn = facetedUniqueValues[column.id]\n\n if (!facetedUniqueValuesFn) {\n facetedUniqueValuesFn = facetedUniqueValues[column.id] =\n table.options.features.facetedUniqueValues?.(table, column.id) ??\n (() => new Map<any, number>())\n }\n\n return facetedUniqueValuesFn()\n}\n\n/**\n * Computes min and max numeric facet values for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, the result is `undefined`.\n *\n * @example\n * ```ts\n * const range = table_getGlobalFacetedMinMaxValues(table)\n * ```\n */\nexport function table_getGlobalFacetedMinMaxValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): undefined | [number, number] {\n if (!table._rowModels.globalFacetedMinMaxValues) {\n table._rowModels.globalFacetedMinMaxValues =\n table.options.features.facetedMinMaxValues?.(table, '__global__') ??\n (() => undefined)\n }\n\n const facetedMinMaxValuesFn = table._rowModels.globalFacetedMinMaxValues\n return facetedMinMaxValuesFn()\n}\n\n/**\n * Computes the row model used to derive global facet values.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no faceted row-model factory is registered, the pre-filtered row model is\n * returned.\n *\n * @example\n * ```ts\n * const rows = table_getGlobalFacetedRowModel(table)\n * ```\n */\nexport function table_getGlobalFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): RowModel<TFeatures, TData> {\n if (!table._rowModels.globalFacetedRowModel) {\n table._rowModels.globalFacetedRowModel =\n table.options.features.facetedRowModel?.(table, '__global__') ??\n (() => table.getPreFilteredRowModel())\n }\n\n const facetedRowModelFn = table._rowModels.globalFacetedRowModel\n return facetedRowModelFn()\n}\n\n/**\n * Computes unique values and occurrence counts for the global filter context.\n *\n * The global context is requested with the internal `__global__` column id. If\n * no factory is registered, an empty `Map` is returned.\n *\n * @example\n * ```ts\n * const values = table_getGlobalFacetedUniqueValues(table)\n * ```\n */\nexport function table_getGlobalFacetedUniqueValues<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): Map<any, number> {\n if (!table._rowModels.globalFacetedUniqueValues) {\n table._rowModels.globalFacetedUniqueValues =\n table.options.features.facetedUniqueValues?.(table, '__global__') ??\n (() => new Map())\n }\n\n const facetedUniqueValuesFn = table._rowModels.globalFacetedUniqueValues\n return facetedUniqueValuesFn()\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAgB,8BAKd,QACA,OAC8B;CAC9B,MAAM,sBAAuB,MAAM,WAAW,wBAC5C,cAAc;CAChB,IAAI,wBAAwB,oBAAoB,OAAO;CAEvD,IAAI,CAAC,uBACH,wBAAwB,oBAAoB,OAAO,MACjD,MAAM,QAAQ,SAAS,sBAAsB,OAAO,OAAO,EAAE,YACtD;CAGX,OAAO,sBAAsB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,0BAKd,QACA,OAC4B;CAC5B,MAAM,WAAW,QAAQ,MAAM;CAC/B,MAAM,mBAAoB,MAAM,WAAW,qBACzC,cAAc;CAChB,IAAI,oBAAoB,iBAAiB;CAEzC,IAAI,CAAC,mBACH,oBAAoB,iBAAiB,YACnC,MAAM,QAAQ,SAAS,kBAAkB,OAAO,QAAQ,YACjD,MAAM,uBAAuB;CAGxC,OAAO,kBAAkB;AAC3B;;;;;;;;;;;;AAaA,SAAgB,8BAKd,QACA,OACkB;CAClB,MAAM,sBAAuB,MAAM,WAAW,wBAC5C,cAAc;CAChB,IAAI,wBAAwB,oBAAoB,OAAO;CAEvD,IAAI,CAAC,uBACH,wBAAwB,oBAAoB,OAAO,MACjD,MAAM,QAAQ,SAAS,sBAAsB,OAAO,OAAO,EAAE,4BACtD,IAAI,IAAiB;CAGhC,OAAO,sBAAsB;AAC/B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAAuE;CACvE,IAAI,CAAC,MAAM,WAAW,2BACpB,MAAM,WAAW,4BACf,MAAM,QAAQ,SAAS,sBAAsB,OAAO,YAAY,YACzD;CAGX,MAAM,wBAAwB,MAAM,WAAW;CAC/C,OAAO,sBAAsB;AAC/B;;;;;;;;;;;;;AAcA,SAAgB,+BAGd,OAAqE;CACrE,IAAI,CAAC,MAAM,WAAW,uBACpB,MAAM,WAAW,wBACf,MAAM,QAAQ,SAAS,kBAAkB,OAAO,YAAY,YACrD,MAAM,uBAAuB;CAGxC,MAAM,oBAAoB,MAAM,WAAW;CAC3C,OAAO,kBAAkB;AAC3B;;;;;;;;;;;;AAaA,SAAgB,mCAGd,OAA2D;CAC3D,IAAI,CAAC,MAAM,WAAW,2BACpB,MAAM,WAAW,4BACf,MAAM,QAAQ,SAAS,sBAAsB,OAAO,YAAY,4BACzD,IAAI,IAAI;CAGnB,MAAM,wBAAwB,MAAM,WAAW;CAC/C,OAAO,sBAAsB;AAC/B"}
|
|
@@ -14,21 +14,18 @@ function createFacetedRowModel() {
|
|
|
14
14
|
feature: "columnFacetingFeature",
|
|
15
15
|
table,
|
|
16
16
|
fnName: "createFacetedRowModel",
|
|
17
|
-
memoDeps: () =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
table.getFilteredRowModel()
|
|
24
|
-
];
|
|
25
|
-
},
|
|
17
|
+
memoDeps: () => [
|
|
18
|
+
table.getPreFilteredRowModel(),
|
|
19
|
+
table.atoms.columnFilters?.get(),
|
|
20
|
+
table.atoms.globalFilter?.get(),
|
|
21
|
+
table.getFilteredRowModel()
|
|
22
|
+
],
|
|
26
23
|
fn: (preRowModel, columnFilters, globalFilter) => _createFacetedRowModel(table, columnId, preRowModel, columnFilters, globalFilter)
|
|
27
24
|
});
|
|
28
25
|
};
|
|
29
26
|
}
|
|
30
27
|
function _createFacetedRowModel(table, columnId, preRowModel, columnFilters, globalFilter) {
|
|
31
|
-
if (!preRowModel.rows.length || !
|
|
28
|
+
if (!preRowModel.rows.length || !columnFilters?.length && !globalFilter) return preRowModel;
|
|
32
29
|
const filterableIds = [];
|
|
33
30
|
if (columnFilters) for (let i = 0; i < columnFilters.length; i++) {
|
|
34
31
|
const id = columnFilters[i].id;
|
|
@@ -37,10 +34,7 @@ function _createFacetedRowModel(table, columnId, preRowModel, columnFilters, glo
|
|
|
37
34
|
if (globalFilter) filterableIds.push("__global__");
|
|
38
35
|
if (!filterableIds.length) return preRowModel;
|
|
39
36
|
const filterRowsImpl = (row) => {
|
|
40
|
-
for (let i = 0; i < filterableIds.length; i++)
|
|
41
|
-
var _row$columnFilters;
|
|
42
|
-
if (((_row$columnFilters = row.columnFilters) === null || _row$columnFilters === void 0 ? void 0 : _row$columnFilters[filterableIds[i]]) === false) return false;
|
|
43
|
-
}
|
|
37
|
+
for (let i = 0; i < filterableIds.length; i++) if (row.columnFilters?.[filterableIds[i]] === false) return false;
|
|
44
38
|
return true;
|
|
45
39
|
};
|
|
46
40
|
return require_filterRowsUtils.filterRows(preRowModel.rows, filterRowsImpl, table);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFacetedRowModel.cjs","names":["tableMemo","filterRows"],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table = _table as unknown as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds: Array<string> = []\n if (columnFilters) {\n for (let i = 0; i < columnFilters.length; i++) {\n const id = columnFilters[i]!.id\n if (id !== columnId) filterableIds.push(id)\n }\n }\n if (globalFilter) filterableIds.push('__global__')\n\n if (!filterableIds.length) {\n return preRowModel\n }\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters?.[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,wBAMsB;CACpC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAAQ;EACd,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB
|
|
1
|
+
{"version":3,"file":"createFacetedRowModel.cjs","names":["tableMemo","filterRows"],"sources":["../../../src/features/column-faceting/createFacetedRowModel.ts"],"sourcesContent":["import { tableMemo } from '../../utils'\nimport { filterRows } from '../column-filtering/filterRowsUtils'\nimport type { Table, Table_Internal } from '../../types/Table'\nimport type {\n ColumnFiltersState,\n Row_ColumnFiltering,\n} from '../column-filtering/columnFilteringFeature.types'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { RowModel } from '../../core/row-models/coreRowModelsFeature.types'\nimport type { Row } from '../../types/Row'\nimport type { RowData } from '../../types/type-utils'\n\n/**\n * Creates a memoized faceted row model factory.\n *\n * The factory reads the relevant table state atoms and options, then returns a row model function used by the table row-model pipeline.\n */\nexport function createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(): (\n table: Table<TFeatures, TData>,\n columnId: string,\n) => () => RowModel<TFeatures, TData> {\n return (_table, columnId) => {\n const table = _table as unknown as Table_Internal<TFeatures, TData>\n return tableMemo({\n feature: 'columnFacetingFeature',\n table,\n fnName: 'createFacetedRowModel',\n memoDeps: () => [\n table.getPreFilteredRowModel(),\n table.atoms.columnFilters?.get(),\n table.atoms.globalFilter?.get(),\n table.getFilteredRowModel(),\n ],\n fn: (preRowModel, columnFilters, globalFilter) =>\n _createFacetedRowModel(\n table,\n columnId,\n preRowModel,\n columnFilters,\n globalFilter,\n ),\n })\n }\n}\n\nfunction _createFacetedRowModel<\n TFeatures extends TableFeatures,\n TData extends RowData = any,\n>(\n table: Table_Internal<TFeatures, TData>,\n columnId: string,\n preRowModel: RowModel<TFeatures, TData>,\n columnFilters?: ColumnFiltersState,\n globalFilter?: string,\n) {\n if (!preRowModel.rows.length || (!columnFilters?.length && !globalFilter)) {\n return preRowModel\n }\n\n const filterableIds: Array<string> = []\n if (columnFilters) {\n for (let i = 0; i < columnFilters.length; i++) {\n const id = columnFilters[i]!.id\n if (id !== columnId) filterableIds.push(id)\n }\n }\n if (globalFilter) filterableIds.push('__global__')\n\n if (!filterableIds.length) {\n return preRowModel\n }\n\n const filterRowsImpl = (\n row: Row<TFeatures, TData> & Partial<Row_ColumnFiltering<TFeatures, TData>>,\n ) => {\n // Horizontally filter rows through each column\n for (let i = 0; i < filterableIds.length; i++) {\n if (row.columnFilters?.[filterableIds[i]!] === false) {\n return false\n }\n }\n return true\n }\n\n return filterRows(preRowModel.rows, filterRowsImpl, table)\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,wBAMsB;CACpC,QAAQ,QAAQ,aAAa;EAC3B,MAAM,QAAQ;EACd,OAAOA,wBAAU;GACf,SAAS;GACT;GACA,QAAQ;GACR,gBAAgB;IACd,MAAM,uBAAuB;IAC7B,MAAM,MAAM,eAAe,IAAI;IAC/B,MAAM,MAAM,cAAc,IAAI;IAC9B,MAAM,oBAAoB;GAC5B;GACA,KAAK,aAAa,eAAe,iBAC/B,uBACE,OACA,UACA,aACA,eACA,YACF;EACJ,CAAC;CACH;AACF;AAEA,SAAS,uBAIP,OACA,UACA,aACA,eACA,cACA;CACA,IAAI,CAAC,YAAY,KAAK,UAAW,CAAC,eAAe,UAAU,CAAC,cAC1D,OAAO;CAGT,MAAM,gBAA+B,CAAC;CACtC,IAAI,eACF,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KAAK;EAC7C,MAAM,KAAK,cAAc,EAAE,CAAE;EAC7B,IAAI,OAAO,UAAU,cAAc,KAAK,EAAE;CAC5C;CAEF,IAAI,cAAc,cAAc,KAAK,YAAY;CAEjD,IAAI,CAAC,cAAc,QACjB,OAAO;CAGT,MAAM,kBACJ,QACG;EAEH,KAAK,IAAI,IAAI,GAAG,IAAI,cAAc,QAAQ,KACxC,IAAI,IAAI,gBAAgB,cAAc,QAAS,OAC7C,OAAO;EAGX,OAAO;CACT;CAEA,OAAOC,mCAAW,YAAY,MAAM,gBAAgB,KAAK;AAC3D"}
|