@tanstack/table-core 9.0.0-alpha.43 → 9.0.0-alpha.47
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 +9 -3
- package/dist/core/cells/constructCell.cjs.map +1 -1
- package/dist/core/cells/constructCell.d.cts +5 -0
- package/dist/core/cells/constructCell.d.ts +5 -0
- package/dist/core/cells/constructCell.js +9 -3
- package/dist/core/cells/constructCell.js.map +1 -1
- package/dist/core/cells/coreCellsFeature.cjs +5 -0
- package/dist/core/cells/coreCellsFeature.cjs.map +1 -1
- package/dist/core/cells/coreCellsFeature.d.cts +5 -0
- package/dist/core/cells/coreCellsFeature.d.ts +5 -0
- package/dist/core/cells/coreCellsFeature.js +5 -0
- package/dist/core/cells/coreCellsFeature.js.map +1 -1
- package/dist/core/cells/coreCellsFeature.utils.cjs +30 -0
- package/dist/core/cells/coreCellsFeature.utils.cjs.map +1 -1
- package/dist/core/cells/coreCellsFeature.utils.d.cts +30 -0
- package/dist/core/cells/coreCellsFeature.utils.d.ts +30 -0
- package/dist/core/cells/coreCellsFeature.utils.js +30 -0
- package/dist/core/cells/coreCellsFeature.utils.js.map +1 -1
- package/dist/core/columns/constructColumn.cjs +21 -12
- package/dist/core/columns/constructColumn.cjs.map +1 -1
- package/dist/core/columns/constructColumn.d.cts +5 -0
- package/dist/core/columns/constructColumn.d.ts +5 -0
- package/dist/core/columns/constructColumn.js +21 -12
- package/dist/core/columns/constructColumn.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.cjs +9 -0
- package/dist/core/columns/coreColumnsFeature.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.d.cts +5 -0
- package/dist/core/columns/coreColumnsFeature.d.ts +5 -0
- package/dist/core/columns/coreColumnsFeature.js +10 -1
- package/dist/core/columns/coreColumnsFeature.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.types.d.cts +4 -0
- package/dist/core/columns/coreColumnsFeature.types.d.ts +4 -0
- package/dist/core/columns/coreColumnsFeature.utils.cjs +107 -4
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.d.cts +92 -1
- package/dist/core/columns/coreColumnsFeature.utils.d.ts +92 -1
- package/dist/core/columns/coreColumnsFeature.utils.js +107 -5
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/coreFeatures.cjs +5 -0
- package/dist/core/coreFeatures.cjs.map +1 -1
- package/dist/core/coreFeatures.d.cts +5 -0
- package/dist/core/coreFeatures.d.ts +5 -0
- package/dist/core/coreFeatures.js +5 -0
- package/dist/core/coreFeatures.js.map +1 -1
- package/dist/core/headers/buildHeaderGroups.cjs +33 -20
- package/dist/core/headers/buildHeaderGroups.cjs.map +1 -1
- package/dist/core/headers/buildHeaderGroups.d.cts +5 -0
- package/dist/core/headers/buildHeaderGroups.d.ts +5 -0
- package/dist/core/headers/buildHeaderGroups.js +33 -20
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/constructHeader.cjs +9 -3
- package/dist/core/headers/constructHeader.cjs.map +1 -1
- package/dist/core/headers/constructHeader.d.cts +5 -0
- package/dist/core/headers/constructHeader.d.ts +5 -0
- package/dist/core/headers/constructHeader.js +9 -3
- package/dist/core/headers/constructHeader.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.cjs +6 -6
- package/dist/core/headers/coreHeadersFeature.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.d.cts +5 -0
- package/dist/core/headers/coreHeadersFeature.d.ts +5 -0
- package/dist/core/headers/coreHeadersFeature.js +7 -7
- package/dist/core/headers/coreHeadersFeature.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.cjs +87 -16
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +61 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +61 -1
- package/dist/core/headers/coreHeadersFeature.utils.js +89 -18
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/reactivity/coreReactivityFeature.types.d.cts +4 -0
- package/dist/core/reactivity/coreReactivityFeature.types.d.ts +4 -0
- package/dist/core/reactivity/coreReactivityFeature.utils.cjs +5 -0
- package/dist/core/reactivity/coreReactivityFeature.utils.cjs.map +1 -1
- package/dist/core/reactivity/coreReactivityFeature.utils.d.cts +10 -0
- package/dist/core/reactivity/coreReactivityFeature.utils.d.ts +10 -0
- package/dist/core/reactivity/coreReactivityFeature.utils.js +5 -0
- package/dist/core/reactivity/coreReactivityFeature.utils.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.cjs +5 -0
- package/dist/core/row-models/coreRowModelsFeature.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.d.cts +5 -0
- package/dist/core/row-models/coreRowModelsFeature.d.ts +5 -0
- package/dist/core/row-models/coreRowModelsFeature.js +5 -0
- package/dist/core/row-models/coreRowModelsFeature.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.types.d.cts +2 -1
- package/dist/core/row-models/coreRowModelsFeature.types.d.ts +2 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +120 -0
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +120 -0
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +120 -0
- package/dist/core/row-models/coreRowModelsFeature.utils.js +120 -0
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/core/row-models/createCoreRowModel.cjs +5 -0
- package/dist/core/row-models/createCoreRowModel.cjs.map +1 -1
- package/dist/core/row-models/createCoreRowModel.d.cts +5 -0
- package/dist/core/row-models/createCoreRowModel.d.ts +5 -0
- package/dist/core/row-models/createCoreRowModel.js +5 -0
- package/dist/core/row-models/createCoreRowModel.js.map +1 -1
- package/dist/core/rows/constructRow.cjs +13 -6
- package/dist/core/rows/constructRow.cjs.map +1 -1
- package/dist/core/rows/constructRow.d.cts +5 -0
- package/dist/core/rows/constructRow.d.ts +5 -0
- package/dist/core/rows/constructRow.js +13 -6
- package/dist/core/rows/constructRow.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.cjs +5 -0
- package/dist/core/rows/coreRowsFeature.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.d.cts +5 -0
- package/dist/core/rows/coreRowsFeature.d.ts +5 -0
- package/dist/core/rows/coreRowsFeature.js +5 -0
- package/dist/core/rows/coreRowsFeature.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +3 -0
- package/dist/core/rows/coreRowsFeature.types.d.ts +3 -0
- package/dist/core/rows/coreRowsFeature.utils.cjs +112 -7
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.cts +101 -0
- package/dist/core/rows/coreRowsFeature.utils.d.ts +101 -0
- package/dist/core/rows/coreRowsFeature.utils.js +112 -7
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/constructTable.cjs +19 -5
- package/dist/core/table/constructTable.cjs.map +1 -1
- package/dist/core/table/constructTable.d.cts +10 -0
- package/dist/core/table/constructTable.d.ts +10 -0
- package/dist/core/table/constructTable.js +19 -5
- package/dist/core/table/constructTable.js.map +1 -1
- package/dist/core/table/coreTablesFeature.cjs +5 -0
- package/dist/core/table/coreTablesFeature.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.d.cts +5 -0
- package/dist/core/table/coreTablesFeature.d.ts +5 -0
- package/dist/core/table/coreTablesFeature.js +5 -0
- package/dist/core/table/coreTablesFeature.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +22 -12
- package/dist/core/table/coreTablesFeature.types.d.ts +22 -12
- package/dist/core/table/coreTablesFeature.utils.cjs +49 -1
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.d.cts +44 -0
- package/dist/core/table/coreTablesFeature.utils.d.ts +44 -0
- package/dist/core/table/coreTablesFeature.utils.js +49 -1
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.cjs +9 -1
- package/dist/features/column-faceting/columnFacetingFeature.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.d.cts +9 -1
- package/dist/features/column-faceting/columnFacetingFeature.d.ts +9 -1
- package/dist/features/column-faceting/columnFacetingFeature.js +9 -1
- package/dist/features/column-faceting/columnFacetingFeature.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +12 -6
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +12 -6
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +60 -0
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +60 -0
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +60 -0
- package/dist/features/column-faceting/columnFacetingFeature.utils.js +60 -0
- package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.cjs +13 -5
- package/dist/features/column-faceting/createFacetedMinMaxValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedMinMaxValues.d.cts +5 -0
- package/dist/features/column-faceting/createFacetedMinMaxValues.d.ts +5 -0
- package/dist/features/column-faceting/createFacetedMinMaxValues.js +13 -5
- package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs +13 -3
- package/dist/features/column-faceting/createFacetedRowModel.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.d.cts +5 -0
- package/dist/features/column-faceting/createFacetedRowModel.d.ts +5 -0
- package/dist/features/column-faceting/createFacetedRowModel.js +13 -3
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs +12 -4
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.d.cts +5 -0
- package/dist/features/column-faceting/createFacetedUniqueValues.d.ts +5 -0
- package/dist/features/column-faceting/createFacetedUniqueValues.js +12 -4
- package/dist/features/column-faceting/createFacetedUniqueValues.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.cjs +10 -2
- package/dist/features/column-filtering/columnFilteringFeature.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.d.cts +10 -2
- package/dist/features/column-filtering/columnFilteringFeature.d.ts +10 -2
- package/dist/features/column-filtering/columnFilteringFeature.js +10 -2
- package/dist/features/column-filtering/columnFilteringFeature.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +7 -4
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +7 -4
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +113 -2
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +111 -0
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +111 -0
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +113 -2
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.cjs +16 -5
- package/dist/features/column-filtering/createFilteredRowModel.cjs.map +1 -1
- package/dist/features/column-filtering/createFilteredRowModel.d.cts +5 -0
- package/dist/features/column-filtering/createFilteredRowModel.d.ts +5 -0
- package/dist/features/column-filtering/createFilteredRowModel.js +16 -5
- package/dist/features/column-filtering/createFilteredRowModel.js.map +1 -1
- package/dist/features/column-filtering/filterRowsUtils.cjs +5 -0
- package/dist/features/column-filtering/filterRowsUtils.cjs.map +1 -1
- package/dist/features/column-filtering/filterRowsUtils.js +5 -0
- package/dist/features/column-filtering/filterRowsUtils.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.cjs +9 -1
- package/dist/features/column-grouping/columnGroupingFeature.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.d.cts +9 -1
- package/dist/features/column-grouping/columnGroupingFeature.d.ts +9 -1
- package/dist/features/column-grouping/columnGroupingFeature.js +9 -1
- package/dist/features/column-grouping/columnGroupingFeature.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +7 -3
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +7 -3
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +151 -0
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +151 -0
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +151 -0
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +151 -0
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.cjs +5 -0
- package/dist/features/column-grouping/createGroupedRowModel.cjs.map +1 -1
- package/dist/features/column-grouping/createGroupedRowModel.d.cts +5 -0
- package/dist/features/column-grouping/createGroupedRowModel.d.ts +5 -0
- package/dist/features/column-grouping/createGroupedRowModel.js +5 -0
- package/dist/features/column-grouping/createGroupedRowModel.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.cjs +12 -3
- package/dist/features/column-ordering/columnOrderingFeature.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.d.cts +9 -1
- package/dist/features/column-ordering/columnOrderingFeature.d.ts +9 -1
- package/dist/features/column-ordering/columnOrderingFeature.js +12 -3
- package/dist/features/column-ordering/columnOrderingFeature.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +4 -2
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +4 -2
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +108 -8
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +81 -0
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +81 -0
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +108 -8
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.cjs +17 -30
- package/dist/features/column-pinning/columnPinningFeature.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.d.cts +9 -1
- package/dist/features/column-pinning/columnPinningFeature.d.ts +9 -1
- package/dist/features/column-pinning/columnPinningFeature.js +17 -30
- package/dist/features/column-pinning/columnPinningFeature.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +6 -2
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +6 -2
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +387 -27
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +318 -6
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +318 -6
- package/dist/features/column-pinning/columnPinningFeature.utils.js +388 -28
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.cjs +9 -2
- package/dist/features/column-resizing/columnResizingFeature.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.d.cts +9 -2
- package/dist/features/column-resizing/columnResizingFeature.d.ts +9 -2
- package/dist/features/column-resizing/columnResizingFeature.js +9 -2
- package/dist/features/column-resizing/columnResizingFeature.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.types.d.cts +14 -6
- package/dist/features/column-resizing/columnResizingFeature.types.d.ts +14 -6
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs +81 -0
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +81 -0
- package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +81 -0
- package/dist/features/column-resizing/columnResizingFeature.utils.js +81 -0
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.cjs +78 -16
- package/dist/features/column-sizing/columnSizingFeature.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.d.cts +10 -2
- package/dist/features/column-sizing/columnSizingFeature.d.ts +10 -2
- package/dist/features/column-sizing/columnSizingFeature.js +79 -17
- package/dist/features/column-sizing/columnSizingFeature.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.types.d.cts +6 -3
- package/dist/features/column-sizing/columnSizingFeature.types.d.ts +6 -3
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +151 -3
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +141 -0
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +141 -0
- package/dist/features/column-sizing/columnSizingFeature.utils.js +151 -3
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.cjs +30 -20
- package/dist/features/column-visibility/columnVisibilityFeature.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.d.cts +9 -1
- package/dist/features/column-visibility/columnVisibilityFeature.d.ts +9 -1
- package/dist/features/column-visibility/columnVisibilityFeature.js +31 -21
- package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +8 -3
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +8 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +199 -12
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +154 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +154 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +199 -12
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.cjs +9 -2
- package/dist/features/global-filtering/globalFilteringFeature.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.d.cts +9 -2
- package/dist/features/global-filtering/globalFilteringFeature.d.ts +9 -2
- package/dist/features/global-filtering/globalFilteringFeature.js +9 -2
- package/dist/features/global-filtering/globalFilteringFeature.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +4 -2
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +4 -2
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +51 -0
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +51 -0
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +51 -0
- package/dist/features/global-filtering/globalFilteringFeature.utils.js +51 -0
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.cjs +10 -0
- package/dist/features/row-expanding/createExpandedRowModel.cjs.map +1 -1
- package/dist/features/row-expanding/createExpandedRowModel.d.cts +10 -0
- package/dist/features/row-expanding/createExpandedRowModel.d.ts +10 -0
- package/dist/features/row-expanding/createExpandedRowModel.js +10 -0
- package/dist/features/row-expanding/createExpandedRowModel.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.cjs +9 -1
- package/dist/features/row-expanding/rowExpandingFeature.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.d.cts +9 -1
- package/dist/features/row-expanding/rowExpandingFeature.d.ts +9 -1
- package/dist/features/row-expanding/rowExpandingFeature.js +9 -1
- package/dist/features/row-expanding/rowExpandingFeature.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +10 -5
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +10 -5
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +153 -2
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +151 -0
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +151 -0
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +153 -2
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.cjs +5 -0
- package/dist/features/row-pagination/createPaginatedRowModel.cjs.map +1 -1
- package/dist/features/row-pagination/createPaginatedRowModel.d.cts +5 -0
- package/dist/features/row-pagination/createPaginatedRowModel.d.ts +5 -0
- package/dist/features/row-pagination/createPaginatedRowModel.js +5 -0
- package/dist/features/row-pagination/createPaginatedRowModel.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.cjs +9 -1
- package/dist/features/row-pagination/rowPaginationFeature.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.d.cts +9 -1
- package/dist/features/row-pagination/rowPaginationFeature.d.ts +9 -1
- package/dist/features/row-pagination/rowPaginationFeature.js +9 -1
- package/dist/features/row-pagination/rowPaginationFeature.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +11 -7
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +11 -7
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +175 -0
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +175 -0
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +175 -0
- package/dist/features/row-pagination/rowPaginationFeature.utils.js +175 -0
- package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.cjs +9 -1
- package/dist/features/row-pinning/rowPinningFeature.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.d.cts +9 -1
- package/dist/features/row-pinning/rowPinningFeature.d.ts +9 -1
- package/dist/features/row-pinning/rowPinningFeature.js +9 -1
- package/dist/features/row-pinning/rowPinningFeature.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +4 -2
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +4 -2
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs +125 -7
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +112 -0
- package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +112 -0
- package/dist/features/row-pinning/rowPinningFeature.utils.js +125 -7
- package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.cjs +9 -1
- package/dist/features/row-selection/rowSelectionFeature.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.d.cts +9 -1
- package/dist/features/row-selection/rowSelectionFeature.d.ts +9 -1
- package/dist/features/row-selection/rowSelectionFeature.js +9 -1
- package/dist/features/row-selection/rowSelectionFeature.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +4 -2
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +4 -2
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +265 -3
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +259 -0
- package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +259 -0
- package/dist/features/row-selection/rowSelectionFeature.utils.js +265 -3
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +18 -8
- package/dist/features/row-sorting/createSortedRowModel.cjs.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.d.cts +5 -0
- package/dist/features/row-sorting/createSortedRowModel.d.ts +5 -0
- package/dist/features/row-sorting/createSortedRowModel.js +18 -8
- package/dist/features/row-sorting/createSortedRowModel.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.cjs +11 -3
- package/dist/features/row-sorting/rowSortingFeature.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.d.cts +9 -1
- package/dist/features/row-sorting/rowSortingFeature.d.ts +9 -1
- package/dist/features/row-sorting/rowSortingFeature.js +11 -3
- package/dist/features/row-sorting/rowSortingFeature.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +7 -3
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +7 -3
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +153 -2
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +151 -0
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +151 -0
- package/dist/features/row-sorting/rowSortingFeature.utils.js +153 -2
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/features/stockFeatures.cjs +5 -0
- package/dist/features/stockFeatures.cjs.map +1 -1
- package/dist/features/stockFeatures.d.cts +5 -0
- package/dist/features/stockFeatures.d.ts +5 -0
- package/dist/features/stockFeatures.js +5 -0
- package/dist/features/stockFeatures.js.map +1 -1
- package/dist/flex-render.cjs +10 -0
- package/dist/flex-render.cjs.map +1 -1
- package/dist/flex-render.d.cts +10 -0
- package/dist/flex-render.d.ts +10 -0
- package/dist/flex-render.js +10 -0
- package/dist/flex-render.js.map +1 -1
- package/dist/fns/aggregationFns.cjs +19 -7
- package/dist/fns/aggregationFns.cjs.map +1 -1
- package/dist/fns/aggregationFns.d.cts +5 -0
- package/dist/fns/aggregationFns.d.ts +5 -0
- package/dist/fns/aggregationFns.js +19 -8
- package/dist/fns/aggregationFns.js.map +1 -1
- package/dist/fns/filterFns.cjs +5 -0
- package/dist/fns/filterFns.cjs.map +1 -1
- package/dist/fns/filterFns.d.cts +5 -0
- package/dist/fns/filterFns.d.ts +5 -0
- package/dist/fns/filterFns.js +5 -0
- package/dist/fns/filterFns.js.map +1 -1
- package/dist/fns/sortFns.cjs +49 -4
- package/dist/fns/sortFns.cjs.map +1 -1
- package/dist/fns/sortFns.d.cts +41 -0
- package/dist/fns/sortFns.d.ts +41 -0
- package/dist/fns/sortFns.js +49 -4
- package/dist/fns/sortFns.js.map +1 -1
- package/dist/helpers/columnHelper.cjs.map +1 -1
- package/dist/helpers/columnHelper.js.map +1 -1
- package/dist/helpers/tableFeatures.cjs.map +1 -1
- package/dist/helpers/tableFeatures.js.map +1 -1
- package/dist/helpers/tableOptions.cjs +6 -0
- package/dist/helpers/tableOptions.cjs.map +1 -1
- package/dist/helpers/tableOptions.d.cts +26 -0
- package/dist/helpers/tableOptions.d.ts +26 -0
- package/dist/helpers/tableOptions.js +6 -0
- package/dist/helpers/tableOptions.js.map +1 -1
- package/dist/index.cjs +0 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/static-functions.cjs +2 -1
- package/dist/static-functions.d.cts +3 -3
- package/dist/static-functions.d.ts +3 -3
- package/dist/static-functions.js +3 -3
- package/dist/store-reactivity-bindings.cjs +1 -0
- package/dist/store-reactivity-bindings.cjs.map +1 -1
- package/dist/store-reactivity-bindings.js +1 -0
- package/dist/store-reactivity-bindings.js.map +1 -1
- package/dist/utils.cjs +49 -25
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +33 -10
- package/dist/utils.d.ts +33 -10
- package/dist/utils.js +50 -22
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/core/cells/constructCell.ts +8 -2
- package/src/core/cells/coreCellsFeature.ts +5 -0
- package/src/core/cells/coreCellsFeature.utils.ts +30 -0
- package/src/core/columns/constructColumn.ts +11 -3
- package/src/core/columns/coreColumnsFeature.ts +10 -0
- package/src/core/columns/coreColumnsFeature.types.ts +4 -0
- package/src/core/columns/coreColumnsFeature.utils.ts +113 -8
- package/src/core/coreFeatures.ts +5 -0
- package/src/core/headers/buildHeaderGroups.ts +36 -31
- package/src/core/headers/constructHeader.ts +8 -2
- package/src/core/headers/coreHeadersFeature.ts +7 -27
- package/src/core/headers/coreHeadersFeature.utils.ts +110 -46
- package/src/core/reactivity/coreReactivityFeature.types.ts +4 -0
- package/src/core/reactivity/coreReactivityFeature.utils.ts +15 -0
- package/src/core/row-models/coreRowModelsFeature.ts +5 -0
- package/src/core/row-models/coreRowModelsFeature.types.ts +2 -1
- package/src/core/row-models/coreRowModelsFeature.utils.ts +120 -0
- package/src/core/row-models/createCoreRowModel.ts +5 -0
- package/src/core/rows/constructRow.ts +11 -4
- package/src/core/rows/coreRowsFeature.ts +5 -0
- package/src/core/rows/coreRowsFeature.types.ts +3 -0
- package/src/core/rows/coreRowsFeature.utils.ts +116 -10
- package/src/core/table/constructTable.ts +16 -4
- package/src/core/table/coreTablesFeature.ts +5 -0
- package/src/core/table/coreTablesFeature.types.ts +22 -12
- package/src/core/table/coreTablesFeature.utils.ts +47 -1
- package/src/features/column-faceting/columnFacetingFeature.ts +9 -1
- package/src/features/column-faceting/columnFacetingFeature.types.ts +12 -6
- package/src/features/column-faceting/columnFacetingFeature.utils.ts +60 -0
- package/src/features/column-faceting/createFacetedMinMaxValues.ts +13 -10
- package/src/features/column-faceting/createFacetedRowModel.ts +15 -6
- package/src/features/column-faceting/createFacetedUniqueValues.ts +9 -3
- package/src/features/column-filtering/columnFilteringFeature.ts +10 -2
- package/src/features/column-filtering/columnFilteringFeature.types.ts +7 -4
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +113 -2
- package/src/features/column-filtering/createFilteredRowModel.ts +19 -8
- package/src/features/column-filtering/filterRowsUtils.ts +5 -0
- package/src/features/column-grouping/columnGroupingFeature.ts +9 -1
- package/src/features/column-grouping/columnGroupingFeature.types.ts +7 -3
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +151 -0
- package/src/features/column-grouping/createGroupedRowModel.ts +5 -0
- package/src/features/column-ordering/columnOrderingFeature.ts +10 -1
- package/src/features/column-ordering/columnOrderingFeature.types.ts +4 -2
- package/src/features/column-ordering/columnOrderingFeature.utils.ts +117 -17
- package/src/features/column-pinning/columnPinningFeature.ts +11 -12
- package/src/features/column-pinning/columnPinningFeature.types.ts +6 -2
- package/src/features/column-pinning/columnPinningFeature.utils.ts +425 -76
- package/src/features/column-resizing/columnResizingFeature.ts +9 -2
- package/src/features/column-resizing/columnResizingFeature.types.ts +14 -6
- package/src/features/column-resizing/columnResizingFeature.utils.ts +81 -0
- package/src/features/column-sizing/columnSizingFeature.ts +54 -18
- package/src/features/column-sizing/columnSizingFeature.types.ts +6 -3
- package/src/features/column-sizing/columnSizingFeature.utils.ts +168 -9
- package/src/features/column-visibility/columnVisibilityFeature.ts +20 -18
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +11 -3
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +213 -24
- package/src/features/global-filtering/globalFilteringFeature.ts +9 -2
- package/src/features/global-filtering/globalFilteringFeature.types.ts +4 -2
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +51 -0
- package/src/features/row-expanding/createExpandedRowModel.ts +10 -0
- package/src/features/row-expanding/rowExpandingFeature.ts +9 -1
- package/src/features/row-expanding/rowExpandingFeature.types.ts +10 -5
- package/src/features/row-expanding/rowExpandingFeature.utils.ts +153 -2
- package/src/features/row-pagination/createPaginatedRowModel.ts +5 -0
- package/src/features/row-pagination/rowPaginationFeature.ts +9 -1
- package/src/features/row-pagination/rowPaginationFeature.types.ts +11 -7
- package/src/features/row-pagination/rowPaginationFeature.utils.ts +175 -0
- package/src/features/row-pinning/rowPinningFeature.ts +9 -1
- package/src/features/row-pinning/rowPinningFeature.types.ts +4 -2
- package/src/features/row-pinning/rowPinningFeature.utils.ts +132 -18
- package/src/features/row-selection/rowSelectionFeature.ts +9 -1
- package/src/features/row-selection/rowSelectionFeature.types.ts +4 -2
- package/src/features/row-selection/rowSelectionFeature.utils.ts +279 -19
- package/src/features/row-sorting/createSortedRowModel.ts +21 -13
- package/src/features/row-sorting/rowSortingFeature.ts +11 -3
- package/src/features/row-sorting/rowSortingFeature.types.ts +7 -3
- package/src/features/row-sorting/rowSortingFeature.utils.ts +153 -2
- package/src/features/stockFeatures.ts +5 -0
- package/src/flex-render.ts +10 -0
- package/src/fns/aggregationFns.ts +25 -8
- package/src/fns/filterFns.ts +5 -0
- package/src/fns/sortFns.ts +50 -5
- package/src/helpers/tableOptions.ts +32 -0
- package/src/store-reactivity-bindings.ts +1 -0
- package/src/utils.ts +52 -34
|
@@ -4,6 +4,11 @@ const require_coreFeatures = require('../coreFeatures.cjs');
|
|
|
4
4
|
const require_coreReactivityFeature_utils = require('../reactivity/coreReactivityFeature.utils.cjs');
|
|
5
5
|
|
|
6
6
|
//#region src/core/table/constructTable.ts
|
|
7
|
+
/**
|
|
8
|
+
* Builds the initial table state from registered features and user initial state.
|
|
9
|
+
*
|
|
10
|
+
* Each feature contributes its default state before user-provided `initialState` values are merged in.
|
|
11
|
+
*/
|
|
7
12
|
function getInitialTableState(features, initialState = {}) {
|
|
8
13
|
Object.values(features).forEach((feature) => {
|
|
9
14
|
var _feature$getInitialSt;
|
|
@@ -11,6 +16,11 @@ function getInitialTableState(features, initialState = {}) {
|
|
|
11
16
|
});
|
|
12
17
|
return require_utils.cloneState(initialState);
|
|
13
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a table instance from normalized table internals.
|
|
21
|
+
*
|
|
22
|
+
* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.
|
|
23
|
+
*/
|
|
14
24
|
function constructTable(tableOptions) {
|
|
15
25
|
const _reactivity = tableOptions._features.coreReativityFeature;
|
|
16
26
|
const table = {
|
|
@@ -47,7 +57,8 @@ function constructTable(tableOptions) {
|
|
|
47
57
|
} else table.options = mergedOptions;
|
|
48
58
|
table.initialState = getInitialTableState(table._features, table.options.initialState);
|
|
49
59
|
const stateKeys = Object.keys(table.initialState);
|
|
50
|
-
for (
|
|
60
|
+
for (let i = 0; i < stateKeys.length; i++) {
|
|
61
|
+
const key = stateKeys[i];
|
|
51
62
|
table.baseAtoms[key] = _reactivity.createWritableAtom(table.initialState[key], { debugName: `table/baseAtoms/${key}` });
|
|
52
63
|
table.atoms[key] = _reactivity.createReadonlyAtom(() => {
|
|
53
64
|
var _table$options$atoms;
|
|
@@ -59,7 +70,10 @@ function constructTable(tableOptions) {
|
|
|
59
70
|
require_coreTablesFeature_utils.table_syncExternalStateToBaseAtoms(table);
|
|
60
71
|
table.store = require_coreReactivityFeature_utils.atomToStore(_reactivity.createReadonlyAtom(() => {
|
|
61
72
|
const snapshot = {};
|
|
62
|
-
for (
|
|
73
|
+
for (let i = 0; i < stateKeys.length; i++) {
|
|
74
|
+
const key = stateKeys[i];
|
|
75
|
+
snapshot[key] = table.atoms[key].get();
|
|
76
|
+
}
|
|
63
77
|
return snapshot;
|
|
64
78
|
}, { debugName: "table/store" }));
|
|
65
79
|
if (process.env.NODE_ENV === "development" && (tableOptions.debugAll || tableOptions.debugTable)) {
|
|
@@ -74,9 +88,9 @@ function constructTable(tableOptions) {
|
|
|
74
88
|
|
|
75
89
|
States: ${states.join("\n ")}\n`, { table });
|
|
76
90
|
}
|
|
77
|
-
for (
|
|
78
|
-
var
|
|
79
|
-
(
|
|
91
|
+
for (let i = 0; i < featuresList.length; i++) {
|
|
92
|
+
var _constructTableAPIs, _ref;
|
|
93
|
+
(_constructTableAPIs = (_ref = featuresList[i]).constructTableAPIs) === null || _constructTableAPIs === void 0 || _constructTableAPIs.call(_ref, table);
|
|
80
94
|
}
|
|
81
95
|
return table;
|
|
82
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"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 { 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 } from '../../types/TableState'\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\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions._features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } 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.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<TFeatures>\n >\n\n for (
|
|
1
|
+
{"version":3,"file":"constructTable.cjs","names":["cloneState","coreFeatures","atomToStore"],"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 { 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 } 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.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } 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.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<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n // create writable base atom\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 externalAtom = table.options.atoms?.[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>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n snapshot[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.keys(table.options._rowModels || {})\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\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,qBACd,UACA,eAA2D,EAAE,EACtC;CACvB,OAAO,OAAO,SAAS,CAAC,SAAS,YAAY;;EAC3C,yCAAe,QAAQ,6GAAkB,aAAa,KAAI;GAC1D;CACF,OAAOA,yBAAW,aAAa;;;;;;;AAQjC,SAAgB,eAGd,cAAuE;CACvE,MAAM,cAAc,aAAa,UAAU;CAE3C,MAAM,QAAQ;EACZ;EACA,WAAW;GAAE,GAAGC;GAAc,GAAG,aAAa;GAAW;EACzD,YAAY,EAAE;EACd,cAAc,EAAE;EAChB,WAAW,EAAE;EACb,OAAO,EAAE;EACV;CAED,MAAM,eAAwC,OAAO,OAAO,MAAM,UAAU;CAM5E,MAAM,gBAAgB;EAAE,GAJD,aAAa,QAAQ,KAAK,YAAY;;GAC3D,OAAO,OAAO,OAAO,8BAAK,QAAQ,oHAAyB,MAAM,CAAC;KACjE,EAAE,CAEoC;EAAE,GAAG;EAAc;CAE5D,IAAI,YAAY,oBAAoB;EAElC,MAAM,eAAe,YAAY,mBAE/B,eAAe,EAAE,WAAW,sBAAsB,CAAC;EACrD,OAAO,eAAe,OAAO,WAAW;GACtC,cAAc;GACd,YAAY;GACZ,MAAM;IACJ,OAAO,MAAM,aAAc,KAAK;;GAElC,IAAI,OAAO;IACT,MAAM,aAAc,UAAU,MAAM;;GAEvC,CAAC;QAEF,MAAM,UAAU;CAGlB,MAAM,eAAe,qBACnB,MAAM,WACN,MAAM,QAAQ,aACf;CAED,MAAM,YAAY,OAAO,KAAK,MAAM,aAAa;CAIjD,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;EACzC,MAAM,MAAM,UAAU;EAEtB,MAAM,UAAU,OAAO,YAAY,mBACjC,MAAM,aAAa,MACnB,EACE,WAAW,mBAAmB,OAC/B,CACF;EAGA,AAAC,MAAM,MAAc,OAAO,YAAY,yBACjC;;GACJ,MAAM,uCAAe,MAAM,QAAQ,mFAAQ;GAC3C,IAAI,cACF,OAAO,aAAa,KAAK;GAE3B,OAAO,MAAM,UAAU,KAAK,KAAK;KAEnC,EAAE,WAAW,eAAe,OAAO,CACpC;;CAGH,mEAAmC,MAAM;CAEzC,MAAM,QAAQC,gDACZ,YAAY,yBACJ;EACJ,MAAM,WAAW,EAAE;EACnB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;GACzC,MAAM,MAAM,UAAU;GACtB,SAAS,OAAO,MAAM,MAAM,KAAK,KAAK;;EAExC,OAAO;IAET,EAAE,WAAW,eAAe,CAC7B,CACF;CAED,IACE,QAAQ,IAAI,aAAa,kBACxB,aAAa,YAAY,aAAa,aACvC;EACA,MAAM,WAAW,OAAO,KAAK,MAAM,UAAU;EAC7C,MAAM,YAAY,OAAO,KAAK,MAAM,QAAQ,cAAc,EAAE,CAAC;EAC7D,MAAM,SAAS,OAAO,KAAK,MAAM,aAAa;EAE9C,QAAQ,IACN;;gBAEU,SAAS,KAAK,mBAAmB,CAAC;;gBAElC,UAAU,SAAS,UAAU,KAAK,mBAAmB,GAAG,SAAS;;gBAEjE,OAAO,KAAK,mBAAmB,CAAC,KAC1C,EAAE,OAAO,CACV;;CAGH,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,MAAM;;CAG9C,OAAO"}
|
|
@@ -5,7 +5,17 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
5
5
|
import { Table } from "../../types/Table.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/core/table/constructTable.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Builds the initial table state from registered features and user initial state.
|
|
10
|
+
*
|
|
11
|
+
* Each feature contributes its default state before user-provided `initialState` values are merged in.
|
|
12
|
+
*/
|
|
8
13
|
declare function getInitialTableState<TFeatures extends TableFeatures>(features: TFeatures, initialState?: Partial<TableState<TFeatures>> | undefined): TableState<TFeatures>;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a table instance from normalized table internals.
|
|
16
|
+
*
|
|
17
|
+
* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.
|
|
18
|
+
*/
|
|
9
19
|
declare function constructTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData>;
|
|
10
20
|
//#endregion
|
|
11
21
|
export { constructTable, getInitialTableState };
|
|
@@ -5,7 +5,17 @@ import { TableFeatures } from "../../types/TableFeatures.js";
|
|
|
5
5
|
import { Table } from "../../types/Table.js";
|
|
6
6
|
|
|
7
7
|
//#region src/core/table/constructTable.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Builds the initial table state from registered features and user initial state.
|
|
10
|
+
*
|
|
11
|
+
* Each feature contributes its default state before user-provided `initialState` values are merged in.
|
|
12
|
+
*/
|
|
8
13
|
declare function getInitialTableState<TFeatures extends TableFeatures>(features: TFeatures, initialState?: Partial<TableState<TFeatures>> | undefined): TableState<TFeatures>;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a table instance from normalized table internals.
|
|
16
|
+
*
|
|
17
|
+
* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.
|
|
18
|
+
*/
|
|
9
19
|
declare function constructTable<TFeatures extends TableFeatures, TData extends RowData>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData>;
|
|
10
20
|
//#endregion
|
|
11
21
|
export { constructTable, getInitialTableState };
|
|
@@ -4,6 +4,11 @@ import { coreFeatures } from "../coreFeatures.js";
|
|
|
4
4
|
import { atomToStore } from "../reactivity/coreReactivityFeature.utils.js";
|
|
5
5
|
|
|
6
6
|
//#region src/core/table/constructTable.ts
|
|
7
|
+
/**
|
|
8
|
+
* Builds the initial table state from registered features and user initial state.
|
|
9
|
+
*
|
|
10
|
+
* Each feature contributes its default state before user-provided `initialState` values are merged in.
|
|
11
|
+
*/
|
|
7
12
|
function getInitialTableState(features, initialState = {}) {
|
|
8
13
|
Object.values(features).forEach((feature) => {
|
|
9
14
|
var _feature$getInitialSt;
|
|
@@ -11,6 +16,11 @@ function getInitialTableState(features, initialState = {}) {
|
|
|
11
16
|
});
|
|
12
17
|
return cloneState(initialState);
|
|
13
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a table instance from normalized table internals.
|
|
21
|
+
*
|
|
22
|
+
* This wires core properties, feature prototype APIs, and instance data used by table rendering and row-model operations.
|
|
23
|
+
*/
|
|
14
24
|
function constructTable(tableOptions) {
|
|
15
25
|
const _reactivity = tableOptions._features.coreReativityFeature;
|
|
16
26
|
const table = {
|
|
@@ -47,7 +57,8 @@ function constructTable(tableOptions) {
|
|
|
47
57
|
} else table.options = mergedOptions;
|
|
48
58
|
table.initialState = getInitialTableState(table._features, table.options.initialState);
|
|
49
59
|
const stateKeys = Object.keys(table.initialState);
|
|
50
|
-
for (
|
|
60
|
+
for (let i = 0; i < stateKeys.length; i++) {
|
|
61
|
+
const key = stateKeys[i];
|
|
51
62
|
table.baseAtoms[key] = _reactivity.createWritableAtom(table.initialState[key], { debugName: `table/baseAtoms/${key}` });
|
|
52
63
|
table.atoms[key] = _reactivity.createReadonlyAtom(() => {
|
|
53
64
|
var _table$options$atoms;
|
|
@@ -59,7 +70,10 @@ function constructTable(tableOptions) {
|
|
|
59
70
|
table_syncExternalStateToBaseAtoms(table);
|
|
60
71
|
table.store = atomToStore(_reactivity.createReadonlyAtom(() => {
|
|
61
72
|
const snapshot = {};
|
|
62
|
-
for (
|
|
73
|
+
for (let i = 0; i < stateKeys.length; i++) {
|
|
74
|
+
const key = stateKeys[i];
|
|
75
|
+
snapshot[key] = table.atoms[key].get();
|
|
76
|
+
}
|
|
63
77
|
return snapshot;
|
|
64
78
|
}, { debugName: "table/store" }));
|
|
65
79
|
if (process.env.NODE_ENV === "development" && (tableOptions.debugAll || tableOptions.debugTable)) {
|
|
@@ -74,9 +88,9 @@ function constructTable(tableOptions) {
|
|
|
74
88
|
|
|
75
89
|
States: ${states.join("\n ")}\n`, { table });
|
|
76
90
|
}
|
|
77
|
-
for (
|
|
78
|
-
var
|
|
79
|
-
(
|
|
91
|
+
for (let i = 0; i < featuresList.length; i++) {
|
|
92
|
+
var _constructTableAPIs, _ref;
|
|
93
|
+
(_constructTableAPIs = (_ref = featuresList[i]).constructTableAPIs) === null || _constructTableAPIs === void 0 || _constructTableAPIs.call(_ref, table);
|
|
80
94
|
}
|
|
81
95
|
return table;
|
|
82
96
|
}
|
|
@@ -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 { 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 } from '../../types/TableState'\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\nexport function constructTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const _reactivity = tableOptions._features.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } 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.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<TFeatures>\n >\n\n for (
|
|
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 { 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 } 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.coreReativityFeature!\n\n const table = {\n _reactivity,\n _features: { ...coreFeatures, ...tableOptions._features },\n _rowModels: {},\n _rowModelFns: {},\n baseAtoms: {},\n atoms: {},\n } 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.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<TFeatures>\n >\n\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n // create writable base atom\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 externalAtom = table.options.atoms?.[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>\n for (let i = 0; i < stateKeys.length; i++) {\n const key = stateKeys[i]!\n snapshot[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.keys(table.options._rowModels || {})\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\n}\n"],"mappings":";;;;;;;;;;;AAeA,SAAgB,qBACd,UACA,eAA2D,EAAE,EACtC;CACvB,OAAO,OAAO,SAAS,CAAC,SAAS,YAAY;;EAC3C,yCAAe,QAAQ,6GAAkB,aAAa,KAAI;GAC1D;CACF,OAAO,WAAW,aAAa;;;;;;;AAQjC,SAAgB,eAGd,cAAuE;CACvE,MAAM,cAAc,aAAa,UAAU;CAE3C,MAAM,QAAQ;EACZ;EACA,WAAW;GAAE,GAAG;GAAc,GAAG,aAAa;GAAW;EACzD,YAAY,EAAE;EACd,cAAc,EAAE;EAChB,WAAW,EAAE;EACb,OAAO,EAAE;EACV;CAED,MAAM,eAAwC,OAAO,OAAO,MAAM,UAAU;CAM5E,MAAM,gBAAgB;EAAE,GAJD,aAAa,QAAQ,KAAK,YAAY;;GAC3D,OAAO,OAAO,OAAO,8BAAK,QAAQ,oHAAyB,MAAM,CAAC;KACjE,EAAE,CAEoC;EAAE,GAAG;EAAc;CAE5D,IAAI,YAAY,oBAAoB;EAElC,MAAM,eAAe,YAAY,mBAE/B,eAAe,EAAE,WAAW,sBAAsB,CAAC;EACrD,OAAO,eAAe,OAAO,WAAW;GACtC,cAAc;GACd,YAAY;GACZ,MAAM;IACJ,OAAO,MAAM,aAAc,KAAK;;GAElC,IAAI,OAAO;IACT,MAAM,aAAc,UAAU,MAAM;;GAEvC,CAAC;QAEF,MAAM,UAAU;CAGlB,MAAM,eAAe,qBACnB,MAAM,WACN,MAAM,QAAQ,aACf;CAED,MAAM,YAAY,OAAO,KAAK,MAAM,aAAa;CAIjD,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;EACzC,MAAM,MAAM,UAAU;EAEtB,MAAM,UAAU,OAAO,YAAY,mBACjC,MAAM,aAAa,MACnB,EACE,WAAW,mBAAmB,OAC/B,CACF;EAGA,AAAC,MAAM,MAAc,OAAO,YAAY,yBACjC;;GACJ,MAAM,uCAAe,MAAM,QAAQ,mFAAQ;GAC3C,IAAI,cACF,OAAO,aAAa,KAAK;GAE3B,OAAO,MAAM,UAAU,KAAK,KAAK;KAEnC,EAAE,WAAW,eAAe,OAAO,CACpC;;CAGH,mCAAmC,MAAM;CAEzC,MAAM,QAAQ,YACZ,YAAY,yBACJ;EACJ,MAAM,WAAW,EAAE;EACnB,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;GACzC,MAAM,MAAM,UAAU;GACtB,SAAS,OAAO,MAAM,MAAM,KAAK,KAAK;;EAExC,OAAO;IAET,EAAE,WAAW,eAAe,CAC7B,CACF;CAED,IACE,QAAQ,IAAI,aAAa,kBACxB,aAAa,YAAY,aAAa,aACvC;EACA,MAAM,WAAW,OAAO,KAAK,MAAM,UAAU;EAC7C,MAAM,YAAY,OAAO,KAAK,MAAM,QAAQ,cAAc,EAAE,CAAC;EAC7D,MAAM,SAAS,OAAO,KAAK,MAAM,aAAa;EAE9C,QAAQ,IACN;;gBAEU,SAAS,KAAK,mBAAmB,CAAC;;gBAElC,UAAU,SAAS,UAAU,KAAK,mBAAmB,GAAG,SAAS;;gBAEjE,OAAO,KAAK,mBAAmB,CAAC,KAC1C,EAAE,OAAO,CACV;;CAGH,KAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;;EAC5C,4CAAa,IAAI,iGAAqB,MAAM;;CAG9C,OAAO"}
|
|
@@ -2,6 +2,11 @@ const require_utils = require('../../utils.cjs');
|
|
|
2
2
|
const require_coreTablesFeature_utils = require('./coreTablesFeature.utils.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/core/table/coreTablesFeature.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates the stock core tables feature.
|
|
7
|
+
*
|
|
8
|
+
* The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
|
|
9
|
+
*/
|
|
5
10
|
function constructCoreTablesFeature() {
|
|
6
11
|
return { constructTableAPIs: (table) => {
|
|
7
12
|
require_utils.assignTableAPIs("coreTablesFeature", table, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreTablesFeature.cjs","names":["table_reset","table_setOptions"],"sources":["../../../src/core/table/coreTablesFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport { table_reset, table_setOptions } from './coreTablesFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type { TableOptions_Table, Table_Table } from './coreTablesFeature.types'\n\nexport interface CoreTablesFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Table: Table_Table<TFeatures, TData>\n // TableOptions: TableOptions_Table<TFeatures, TData>\n}\n\nexport function constructCoreTablesFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreTablesFeatureConstructors<TFeatures, TData>> {\n return {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreTablesFeature', table, {\n table_reset: {\n fn: () => table_reset(table),\n },\n table_setOptions: {\n fn: (updater) => table_setOptions(table, updater),\n },\n })\n },\n }\n}\n\n/**\n * The Core Tables feature provides the core table functionality for handling state and options.\n */\nexport const coreTablesFeature = constructCoreTablesFeature()\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"coreTablesFeature.cjs","names":["table_reset","table_setOptions"],"sources":["../../../src/core/table/coreTablesFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport { table_reset, table_setOptions } from './coreTablesFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type { TableOptions_Table, Table_Table } from './coreTablesFeature.types'\n\nexport interface CoreTablesFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Table: Table_Table<TFeatures, TData>\n // TableOptions: TableOptions_Table<TFeatures, TData>\n}\n\n/**\n * Creates the stock core tables feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructCoreTablesFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreTablesFeatureConstructors<TFeatures, TData>> {\n return {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreTablesFeature', table, {\n table_reset: {\n fn: () => table_reset(table),\n },\n table_setOptions: {\n fn: (updater) => table_setOptions(table, updater),\n },\n })\n },\n }\n}\n\n/**\n * The Core Tables feature provides the core table functionality for handling state and options.\n */\nexport const coreTablesFeature = constructCoreTablesFeature()\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,6BAGmD;CACjE,OAAO,EACL,qBAAqB,UAAU;EAC7B,8BAAgB,qBAAqB,OAAO;GAC1C,aAAa,EACX,UAAUA,4CAAY,MAAM,EAC7B;GACD,kBAAkB,EAChB,KAAK,YAAYC,iDAAiB,OAAO,QAAQ,EAClD;GACF,CAAC;IAEL;;;;;AAMH,MAAa,oBAAoB,4BAA4B"}
|
|
@@ -3,6 +3,11 @@ import { TableFeature, TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/table/coreTablesFeature.d.ts
|
|
5
5
|
interface CoreTablesFeatureConstructors<TFeatures extends TableFeatures, TData extends RowData> {}
|
|
6
|
+
/**
|
|
7
|
+
* Creates the stock core tables feature.
|
|
8
|
+
*
|
|
9
|
+
* The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
|
|
10
|
+
*/
|
|
6
11
|
declare function constructCoreTablesFeature<TFeatures extends TableFeatures, TData extends RowData>(): TableFeature<CoreTablesFeatureConstructors<TFeatures, TData>>;
|
|
7
12
|
/**
|
|
8
13
|
* The Core Tables feature provides the core table functionality for handling state and options.
|
|
@@ -3,6 +3,11 @@ import { TableFeature, TableFeatures } from "../../types/TableFeatures.js";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/table/coreTablesFeature.d.ts
|
|
5
5
|
interface CoreTablesFeatureConstructors<TFeatures extends TableFeatures, TData extends RowData> {}
|
|
6
|
+
/**
|
|
7
|
+
* Creates the stock core tables feature.
|
|
8
|
+
*
|
|
9
|
+
* The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
|
|
10
|
+
*/
|
|
6
11
|
declare function constructCoreTablesFeature<TFeatures extends TableFeatures, TData extends RowData>(): TableFeature<CoreTablesFeatureConstructors<TFeatures, TData>>;
|
|
7
12
|
/**
|
|
8
13
|
* The Core Tables feature provides the core table functionality for handling state and options.
|
|
@@ -2,6 +2,11 @@ import { assignTableAPIs } from "../../utils.js";
|
|
|
2
2
|
import { table_reset, table_setOptions } from "./coreTablesFeature.utils.js";
|
|
3
3
|
|
|
4
4
|
//#region src/core/table/coreTablesFeature.ts
|
|
5
|
+
/**
|
|
6
|
+
* Creates the stock core tables feature.
|
|
7
|
+
*
|
|
8
|
+
* The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.
|
|
9
|
+
*/
|
|
5
10
|
function constructCoreTablesFeature() {
|
|
6
11
|
return { constructTableAPIs: (table) => {
|
|
7
12
|
assignTableAPIs("coreTablesFeature", table, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreTablesFeature.js","names":[],"sources":["../../../src/core/table/coreTablesFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport { table_reset, table_setOptions } from './coreTablesFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type { TableOptions_Table, Table_Table } from './coreTablesFeature.types'\n\nexport interface CoreTablesFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Table: Table_Table<TFeatures, TData>\n // TableOptions: TableOptions_Table<TFeatures, TData>\n}\n\nexport function constructCoreTablesFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreTablesFeatureConstructors<TFeatures, TData>> {\n return {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreTablesFeature', table, {\n table_reset: {\n fn: () => table_reset(table),\n },\n table_setOptions: {\n fn: (updater) => table_setOptions(table, updater),\n },\n })\n },\n }\n}\n\n/**\n * The Core Tables feature provides the core table functionality for handling state and options.\n */\nexport const coreTablesFeature = constructCoreTablesFeature()\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"coreTablesFeature.js","names":[],"sources":["../../../src/core/table/coreTablesFeature.ts"],"sourcesContent":["import { assignTableAPIs } from '../../utils'\nimport { table_reset, table_setOptions } from './coreTablesFeature.utils'\nimport type { RowData } from '../../types/type-utils'\nimport type { TableFeature, TableFeatures } from '../../types/TableFeatures'\n// import type { TableOptions_Table, Table_Table } from './coreTablesFeature.types'\n\nexport interface CoreTablesFeatureConstructors<\n TFeatures extends TableFeatures,\n TData extends RowData,\n> {\n // Table: Table_Table<TFeatures, TData>\n // TableOptions: TableOptions_Table<TFeatures, TData>\n}\n\n/**\n * Creates the stock core tables feature.\n *\n * The returned feature registers its state defaults, option defaults, and instance APIs so it can be included in a `tableFeatures({ ... })` call.\n */\nexport function constructCoreTablesFeature<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(): TableFeature<CoreTablesFeatureConstructors<TFeatures, TData>> {\n return {\n constructTableAPIs: (table) => {\n assignTableAPIs('coreTablesFeature', table, {\n table_reset: {\n fn: () => table_reset(table),\n },\n table_setOptions: {\n fn: (updater) => table_setOptions(table, updater),\n },\n })\n },\n }\n}\n\n/**\n * The Core Tables feature provides the core table functionality for handling state and options.\n */\nexport const coreTablesFeature = constructCoreTablesFeature()\n"],"mappings":";;;;;;;;;AAmBA,SAAgB,6BAGmD;CACjE,OAAO,EACL,qBAAqB,UAAU;EAC7B,gBAAgB,qBAAqB,OAAO;GAC1C,aAAa,EACX,UAAU,YAAY,MAAM,EAC7B;GACD,kBAAkB,EAChB,KAAK,YAAY,iBAAiB,OAAO,QAAQ,EAClD;GACF,CAAC;IAEL;;;;;AAMH,MAAa,oBAAoB,4BAA4B"}
|
|
@@ -54,9 +54,9 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
54
54
|
/**
|
|
55
55
|
* Optionally, provide your own external writable atoms for individual state slices.
|
|
56
56
|
* When an atom is provided for a given slice, it takes precedence over `options.state[key]`
|
|
57
|
-
* and the internal base atom for that slice.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* and the internal base atom for that slice. Feature state update APIs write through
|
|
58
|
+
* the corresponding atom updater, so external atoms are the preferred v9 ownership
|
|
59
|
+
* model for app-managed table state slices.
|
|
60
60
|
*/
|
|
61
61
|
readonly atoms?: ExternalAtoms<TFeatures>;
|
|
62
62
|
/**
|
|
@@ -68,8 +68,10 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
68
68
|
*/
|
|
69
69
|
readonly data: ReadonlyArray<TData>;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* Optionally provide starting values for registered table state slices.
|
|
72
|
+
* Feature reset APIs use this value by default, and many reset APIs accept
|
|
73
|
+
* `true` to reset to that feature's blank/default state instead. Changing this
|
|
74
|
+
* object later does not reset table state, so it does not need to be stable.
|
|
73
75
|
*/
|
|
74
76
|
readonly initialState?: Partial<TableState<TFeatures>>;
|
|
75
77
|
/**
|
|
@@ -81,7 +83,11 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
81
83
|
*/
|
|
82
84
|
readonly meta?: TableMeta<TFeatures, TData>;
|
|
83
85
|
/**
|
|
84
|
-
*
|
|
86
|
+
* Optionally provide externally managed values for individual state slices.
|
|
87
|
+
*
|
|
88
|
+
* Pair each slice with its matching `on[State]Change` callback so table state
|
|
89
|
+
* updates can be persisted outside the table. External atoms take precedence
|
|
90
|
+
* over this option when both are provided for the same slice.
|
|
85
91
|
*/
|
|
86
92
|
readonly state?: Partial<TableState<TFeatures>>;
|
|
87
93
|
}
|
|
@@ -138,10 +144,9 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
138
144
|
*/
|
|
139
145
|
readonly options: TableOptions<TFeatures, TData>;
|
|
140
146
|
/**
|
|
141
|
-
* Writable atom for table options. Only created when `createOptionsStore` is
|
|
142
|
-
* on
|
|
143
|
-
* options
|
|
144
|
-
* no writable atom backing the full options object. Use {@link getTableOptionsStore} to subscribe.
|
|
147
|
+
* Writable atom for table options. Only created when `createOptionsStore` is
|
|
148
|
+
* true on the active core reactivity bindings. Adapters that opt out keep
|
|
149
|
+
* options as plain resolved data instead of backing them with an atom.
|
|
145
150
|
*/
|
|
146
151
|
readonly optionsStore?: Atom<TableOptions<TFeatures, TData>> | undefined;
|
|
147
152
|
/**
|
|
@@ -152,11 +157,16 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
152
157
|
}
|
|
153
158
|
interface Table_Table<TFeatures extends TableFeatures, TData extends RowData> extends Table_CoreProperties<TFeatures, TData> {
|
|
154
159
|
/**
|
|
155
|
-
*
|
|
160
|
+
* Resets the table's internal base atoms to `table.initialState`.
|
|
161
|
+
*
|
|
162
|
+
* Prefer feature-specific reset APIs, such as `resetPagination`, when a state
|
|
163
|
+
* slice may be owned by an external atom or needs that feature's blank/default
|
|
164
|
+
* reset behavior.
|
|
156
165
|
*/
|
|
157
166
|
reset: () => void;
|
|
158
167
|
/**
|
|
159
|
-
*
|
|
168
|
+
* Updates the table options by applying a value or updater to the current
|
|
169
|
+
* resolved options and then merging them through `options.mergeOptions`.
|
|
160
170
|
*/
|
|
161
171
|
setOptions: (newOptions: Updater<TableOptions<TFeatures, TData>>) => void;
|
|
162
172
|
}
|
|
@@ -54,9 +54,9 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
54
54
|
/**
|
|
55
55
|
* Optionally, provide your own external writable atoms for individual state slices.
|
|
56
56
|
* When an atom is provided for a given slice, it takes precedence over `options.state[key]`
|
|
57
|
-
* and the internal base atom for that slice.
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* and the internal base atom for that slice. Feature state update APIs write through
|
|
58
|
+
* the corresponding atom updater, so external atoms are the preferred v9 ownership
|
|
59
|
+
* model for app-managed table state slices.
|
|
60
60
|
*/
|
|
61
61
|
readonly atoms?: ExternalAtoms<TFeatures>;
|
|
62
62
|
/**
|
|
@@ -68,8 +68,10 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
68
68
|
*/
|
|
69
69
|
readonly data: ReadonlyArray<TData>;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
71
|
+
* Optionally provide starting values for registered table state slices.
|
|
72
|
+
* Feature reset APIs use this value by default, and many reset APIs accept
|
|
73
|
+
* `true` to reset to that feature's blank/default state instead. Changing this
|
|
74
|
+
* object later does not reset table state, so it does not need to be stable.
|
|
73
75
|
*/
|
|
74
76
|
readonly initialState?: Partial<TableState<TFeatures>>;
|
|
75
77
|
/**
|
|
@@ -81,7 +83,11 @@ interface TableOptions_Table<TFeatures extends TableFeatures, TData extends RowD
|
|
|
81
83
|
*/
|
|
82
84
|
readonly meta?: TableMeta<TFeatures, TData>;
|
|
83
85
|
/**
|
|
84
|
-
*
|
|
86
|
+
* Optionally provide externally managed values for individual state slices.
|
|
87
|
+
*
|
|
88
|
+
* Pair each slice with its matching `on[State]Change` callback so table state
|
|
89
|
+
* updates can be persisted outside the table. External atoms take precedence
|
|
90
|
+
* over this option when both are provided for the same slice.
|
|
85
91
|
*/
|
|
86
92
|
readonly state?: Partial<TableState<TFeatures>>;
|
|
87
93
|
}
|
|
@@ -138,10 +144,9 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
138
144
|
*/
|
|
139
145
|
readonly options: TableOptions<TFeatures, TData>;
|
|
140
146
|
/**
|
|
141
|
-
* Writable atom for table options. Only created when `createOptionsStore` is
|
|
142
|
-
* on
|
|
143
|
-
* options
|
|
144
|
-
* no writable atom backing the full options object. Use {@link getTableOptionsStore} to subscribe.
|
|
147
|
+
* Writable atom for table options. Only created when `createOptionsStore` is
|
|
148
|
+
* true on the active core reactivity bindings. Adapters that opt out keep
|
|
149
|
+
* options as plain resolved data instead of backing them with an atom.
|
|
145
150
|
*/
|
|
146
151
|
readonly optionsStore?: Atom<TableOptions<TFeatures, TData>> | undefined;
|
|
147
152
|
/**
|
|
@@ -152,11 +157,16 @@ interface Table_CoreProperties<TFeatures extends TableFeatures, TData extends Ro
|
|
|
152
157
|
}
|
|
153
158
|
interface Table_Table<TFeatures extends TableFeatures, TData extends RowData> extends Table_CoreProperties<TFeatures, TData> {
|
|
154
159
|
/**
|
|
155
|
-
*
|
|
160
|
+
* Resets the table's internal base atoms to `table.initialState`.
|
|
161
|
+
*
|
|
162
|
+
* Prefer feature-specific reset APIs, such as `resetPagination`, when a state
|
|
163
|
+
* slice may be owned by an external atom or needs that feature's blank/default
|
|
164
|
+
* reset behavior.
|
|
156
165
|
*/
|
|
157
166
|
reset: () => void;
|
|
158
167
|
/**
|
|
159
|
-
*
|
|
168
|
+
* Updates the table options by applying a value or updater to the current
|
|
169
|
+
* resolved options and then merging them through `options.mergeOptions`.
|
|
160
170
|
*/
|
|
161
171
|
setOptions: (newOptions: Updater<TableOptions<TFeatures, TData>>) => void;
|
|
162
172
|
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
const require_utils = require('../../utils.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/core/table/coreTablesFeature.utils.ts
|
|
4
|
+
/**
|
|
5
|
+
* Synchronizes externally controlled state slices into the table's base atoms.
|
|
6
|
+
*
|
|
7
|
+
* This keeps legacy `options.state` values reflected in the atom graph so
|
|
8
|
+
* derived atoms, stores, and table APIs read a consistent snapshot.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const value = table_syncExternalStateToBaseAtoms(table)
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
4
15
|
function table_syncExternalStateToBaseAtoms(table) {
|
|
5
16
|
const state = table.options.state;
|
|
6
17
|
if (!state) return;
|
|
@@ -13,12 +24,38 @@ function table_syncExternalStateToBaseAtoms(table) {
|
|
|
13
24
|
}
|
|
14
25
|
});
|
|
15
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Resets all internal table base atoms to `table.initialState`.
|
|
29
|
+
*
|
|
30
|
+
* This resets internally owned state slices in a single reactivity batch. Use
|
|
31
|
+
* feature-specific reset APIs when a slice may be externally owned.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* table_reset(table)
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
16
38
|
function table_reset(table) {
|
|
17
39
|
const snap = require_utils.cloneState(table.initialState);
|
|
18
40
|
table._reactivity.batch(() => {
|
|
19
|
-
|
|
41
|
+
const keys = Object.keys(snap);
|
|
42
|
+
for (let i = 0; i < keys.length; i++) {
|
|
43
|
+
const key = keys[i];
|
|
44
|
+
table.baseAtoms[key].set(snap[key]);
|
|
45
|
+
}
|
|
20
46
|
});
|
|
21
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Merges new table options with the current resolved options.
|
|
50
|
+
*
|
|
51
|
+
* If `options.mergeOptions` is provided, it owns the merge behavior; otherwise
|
|
52
|
+
* options are shallow-merged.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const value = table_mergeOptions(table)
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
22
59
|
function table_mergeOptions(table, newOptions) {
|
|
23
60
|
if (table.options.mergeOptions) return table.options.mergeOptions(table.options, newOptions);
|
|
24
61
|
return {
|
|
@@ -26,6 +63,17 @@ function table_mergeOptions(table, newOptions) {
|
|
|
26
63
|
...newOptions
|
|
27
64
|
};
|
|
28
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Updates the table options object.
|
|
68
|
+
*
|
|
69
|
+
* The updater receives the current resolved options and the merged result is
|
|
70
|
+
* immediately assigned to the table instance.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* table_setOptions(table, (old) => old)
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
29
77
|
function table_setOptions(table, updater) {
|
|
30
78
|
const mergedOptions = table_mergeOptions(table, require_utils.functionalUpdate(updater, table.options));
|
|
31
79
|
if (table.optionsStore) table.optionsStore.set(() => mergedOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coreTablesFeature.utils.cjs","names":["cloneState","functionalUpdate"],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\nexport function table_syncExternalStateToBaseAtoms<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const state = table.options.state\n if (!state) {\n return\n }\n\n table._reactivity.batch(() => {\n for (const key in state) {\n const baseAtom = (table.baseAtoms as Record<string, any>)[key]\n if (!baseAtom) {\n continue\n }\n\n const externalState = state[key as keyof typeof state]\n if (externalState !== baseAtom.get()) {\n baseAtom.set(() => externalState)\n }\n }\n })\n}\n\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n table._reactivity.batch(() => {\n
|
|
1
|
+
{"version":3,"file":"coreTablesFeature.utils.cjs","names":["cloneState","functionalUpdate"],"sources":["../../../src/core/table/coreTablesFeature.utils.ts"],"sourcesContent":["import { cloneState, functionalUpdate } from '../../utils'\nimport type { RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { TableOptions } from '../../types/TableOptions'\n\n/**\n * Synchronizes externally controlled state slices into the table's base atoms.\n *\n * This keeps legacy `options.state` values reflected in the atom graph so\n * derived atoms, stores, and table APIs read a consistent snapshot.\n *\n * @example\n * ```ts\n * const value = table_syncExternalStateToBaseAtoms(table)\n * ```\n */\nexport function table_syncExternalStateToBaseAtoms<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const state = table.options.state\n if (!state) {\n return\n }\n\n table._reactivity.batch(() => {\n for (const key in state) {\n const baseAtom = (table.baseAtoms as Record<string, any>)[key]\n if (!baseAtom) {\n continue\n }\n\n const externalState = state[key as keyof typeof state]\n if (externalState !== baseAtom.get()) {\n baseAtom.set(() => externalState)\n }\n }\n })\n}\n\n/**\n * Resets all internal table base atoms to `table.initialState`.\n *\n * This resets internally owned state slices in a single reactivity batch. Use\n * feature-specific reset APIs when a slice may be externally owned.\n *\n * @example\n * ```ts\n * table_reset(table)\n * ```\n */\nexport function table_reset<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>): void {\n const snap = cloneState(table.initialState)\n table._reactivity.batch(() => {\n const keys = Object.keys(snap) as Array<keyof typeof snap>\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i]!\n ;(table.baseAtoms as any)[key].set(snap[key] as any)\n }\n })\n}\n\n/**\n * Merges new table options with the current resolved options.\n *\n * If `options.mergeOptions` is provided, it owns the merge behavior; otherwise\n * options are shallow-merged.\n *\n * @example\n * ```ts\n * const value = table_mergeOptions(table)\n * ```\n */\nexport function table_mergeOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n newOptions: TableOptions<TFeatures, TData>,\n) {\n if (table.options.mergeOptions) {\n return table.options.mergeOptions(table.options, newOptions)\n }\n\n return {\n ...table.options,\n ...newOptions,\n }\n}\n\n/**\n * Updates the table options object.\n *\n * The updater receives the current resolved options and the merged result is\n * immediately assigned to the table instance.\n *\n * @example\n * ```ts\n * table_setOptions(table, (old) => old)\n * ```\n */\nexport function table_setOptions<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(\n table: Table_Internal<TFeatures, TData>,\n updater: Updater<TableOptions<TFeatures, TData>>,\n): void {\n const newOptions = functionalUpdate(updater, table.options)\n const mergedOptions = table_mergeOptions(table, newOptions)\n if (table.optionsStore) {\n table.optionsStore.set(() => mergedOptions)\n } else {\n table.options = mergedOptions\n }\n table_syncExternalStateToBaseAtoms(table)\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mCAGd,OAA+C;CAC/C,MAAM,QAAQ,MAAM,QAAQ;CAC5B,IAAI,CAAC,OACH;CAGF,MAAM,YAAY,YAAY;EAC5B,KAAK,MAAM,OAAO,OAAO;GACvB,MAAM,WAAY,MAAM,UAAkC;GAC1D,IAAI,CAAC,UACH;GAGF,MAAM,gBAAgB,MAAM;GAC5B,IAAI,kBAAkB,SAAS,KAAK,EAClC,SAAS,UAAU,cAAc;;GAGrC;;;;;;;;;;;;;AAcJ,SAAgB,YAGd,OAA+C;CAC/C,MAAM,OAAOA,yBAAW,MAAM,aAAa;CAC3C,MAAM,YAAY,YAAY;EAC5B,MAAM,OAAO,OAAO,KAAK,KAAK;EAC9B,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,MAAM,KAAK;GAChB,AAAC,MAAM,UAAkB,KAAK,IAAI,KAAK,KAAY;;GAEtD;;;;;;;;;;;;;AAcJ,SAAgB,mBAId,OACA,YACA;CACA,IAAI,MAAM,QAAQ,cAChB,OAAO,MAAM,QAAQ,aAAa,MAAM,SAAS,WAAW;CAG9D,OAAO;EACL,GAAG,MAAM;EACT,GAAG;EACJ;;;;;;;;;;;;;AAcH,SAAgB,iBAId,OACA,SACM;CAEN,MAAM,gBAAgB,mBAAmB,OADtBC,+BAAiB,SAAS,MAAM,QACO,CAAC;CAC3D,IAAI,MAAM,cACR,MAAM,aAAa,UAAU,cAAc;MAE3C,MAAM,UAAU;CAElB,mCAAmC,MAAM"}
|
|
@@ -4,9 +4,53 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
4
4
|
import { Table_Internal } from "../../types/Table.cjs";
|
|
5
5
|
|
|
6
6
|
//#region src/core/table/coreTablesFeature.utils.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Synchronizes externally controlled state slices into the table's base atoms.
|
|
9
|
+
*
|
|
10
|
+
* This keeps legacy `options.state` values reflected in the atom graph so
|
|
11
|
+
* derived atoms, stores, and table APIs read a consistent snapshot.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const value = table_syncExternalStateToBaseAtoms(table)
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
7
18
|
declare function table_syncExternalStateToBaseAtoms<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
|
|
19
|
+
/**
|
|
20
|
+
* Resets all internal table base atoms to `table.initialState`.
|
|
21
|
+
*
|
|
22
|
+
* This resets internally owned state slices in a single reactivity batch. Use
|
|
23
|
+
* feature-specific reset APIs when a slice may be externally owned.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* table_reset(table)
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
8
30
|
declare function table_reset<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Merges new table options with the current resolved options.
|
|
33
|
+
*
|
|
34
|
+
* If `options.mergeOptions` is provided, it owns the merge behavior; otherwise
|
|
35
|
+
* options are shallow-merged.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const value = table_mergeOptions(table)
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
9
42
|
declare function table_mergeOptions<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, newOptions: TableOptions<TFeatures, TData>): TableOptions<TFeatures, TData>;
|
|
43
|
+
/**
|
|
44
|
+
* Updates the table options object.
|
|
45
|
+
*
|
|
46
|
+
* The updater receives the current resolved options and the merged result is
|
|
47
|
+
* immediately assigned to the table instance.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* table_setOptions(table, (old) => old)
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
10
54
|
declare function table_setOptions<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<TableOptions<TFeatures, TData>>): void;
|
|
11
55
|
//#endregion
|
|
12
56
|
export { table_mergeOptions, table_reset, table_setOptions, table_syncExternalStateToBaseAtoms };
|