@tanstack/table-core 9.0.0-alpha.43 → 9.0.0-alpha.46
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 +5 -0
- 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 +5 -0
- 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 +16 -9
- 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 +16 -9
- 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 +99 -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 +99 -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 +6 -1
- 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 +6 -1
- package/dist/core/headers/buildHeaderGroups.js.map +1 -1
- package/dist/core/headers/constructHeader.cjs +5 -0
- 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 +5 -0
- package/dist/core/headers/constructHeader.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.cjs +5 -0
- 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 +5 -0
- package/dist/core/headers/coreHeadersFeature.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.cjs +71 -2
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +60 -0
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +60 -0
- package/dist/core/headers/coreHeadersFeature.utils.js +72 -3
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- 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 +5 -0
- 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 +5 -0
- 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 +104 -4
- 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 +104 -4
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/constructTable.cjs +10 -0
- 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 +10 -0
- 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 +44 -0
- 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 +44 -0
- 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 +5 -0
- 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 +5 -0
- package/dist/features/column-faceting/createFacetedMinMaxValues.js.map +1 -1
- package/dist/features/column-faceting/createFacetedRowModel.cjs +5 -0
- 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 +5 -0
- package/dist/features/column-faceting/createFacetedRowModel.js.map +1 -1
- package/dist/features/column-faceting/createFacetedUniqueValues.cjs +5 -0
- 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 +5 -0
- 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 +5 -0
- 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 +5 -0
- 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 +98 -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 +98 -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 +360 -17
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +314 -3
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +314 -3
- package/dist/features/column-pinning/columnPinningFeature.utils.js +361 -18
- 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 +50 -12
- 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 +51 -13
- 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 +26 -25
- 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 +27 -26
- package/dist/features/column-visibility/columnVisibilityFeature.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +4 -3
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +4 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +172 -12
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +143 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +143 -3
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +173 -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 +151 -0
- 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 +151 -0
- 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 +112 -0
- 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 +112 -0
- 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 +259 -0
- 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 +259 -0
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/createSortedRowModel.cjs +5 -0
- 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 +5 -0
- 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 +151 -0
- 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 +151 -0
- 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 +5 -0
- 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 +5 -0
- 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/static-functions.cjs +1 -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.map +1 -1
- package/dist/store-reactivity-bindings.js.map +1 -1
- package/dist/utils.cjs +45 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +45 -0
- package/dist/utils.d.ts +45 -0
- package/dist/utils.js +45 -0
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/core/cells/constructCell.ts +5 -0
- package/src/core/cells/coreCellsFeature.ts +5 -0
- package/src/core/cells/coreCellsFeature.utils.ts +30 -0
- package/src/core/columns/constructColumn.ts +7 -1
- package/src/core/columns/coreColumnsFeature.ts +10 -0
- package/src/core/columns/coreColumnsFeature.types.ts +4 -0
- package/src/core/columns/coreColumnsFeature.utils.ts +109 -8
- package/src/core/coreFeatures.ts +5 -0
- package/src/core/headers/buildHeaderGroups.ts +7 -1
- package/src/core/headers/constructHeader.ts +5 -0
- package/src/core/headers/coreHeadersFeature.ts +5 -0
- package/src/core/headers/coreHeadersFeature.utils.ts +86 -8
- 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 +5 -0
- package/src/core/rows/coreRowsFeature.ts +5 -0
- package/src/core/rows/coreRowsFeature.types.ts +3 -0
- package/src/core/rows/coreRowsFeature.utils.ts +106 -7
- package/src/core/table/constructTable.ts +10 -0
- package/src/core/table/coreTablesFeature.ts +5 -0
- package/src/core/table/coreTablesFeature.types.ts +22 -12
- package/src/core/table/coreTablesFeature.utils.ts +44 -0
- 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 +5 -0
- package/src/features/column-faceting/createFacetedRowModel.ts +5 -0
- package/src/features/column-faceting/createFacetedUniqueValues.ts +5 -0
- 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 +5 -0
- 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 +110 -18
- 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 +390 -57
- 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 +38 -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 +15 -21
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +4 -3
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +179 -23
- 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 +151 -0
- 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 +112 -0
- 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 +259 -0
- package/src/features/row-sorting/createSortedRowModel.ts +5 -0
- 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 +151 -0
- package/src/features/stockFeatures.ts +5 -0
- package/src/flex-render.ts +10 -0
- package/src/fns/aggregationFns.ts +5 -0
- package/src/fns/filterFns.ts +5 -0
- package/src/fns/sortFns.ts +50 -5
- package/src/helpers/tableOptions.ts +32 -0
- package/src/utils.ts +45 -0
|
@@ -2,16 +2,57 @@ const require_utils = require('../../utils.cjs');
|
|
|
2
2
|
const require_sortFns = require('../../fns/sortFns.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/features/row-sorting/rowSortingFeature.utils.ts
|
|
5
|
+
/**
|
|
6
|
+
* Returns the default sorting state.
|
|
7
|
+
*
|
|
8
|
+
* Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const initialValue = getDefaultSortingState()
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
5
15
|
function getDefaultSortingState() {
|
|
6
16
|
return [];
|
|
7
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Updates the table's sorting state slice.
|
|
20
|
+
*
|
|
21
|
+
* The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* table_setSorting(table, (old) => old)
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
8
28
|
function table_setSorting(table, updater) {
|
|
9
29
|
var _table$options$onSort, _table$options;
|
|
10
30
|
(_table$options$onSort = (_table$options = table.options).onSortingChange) === null || _table$options$onSort === void 0 || _table$options$onSort.call(_table$options, updater);
|
|
11
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Resets the table's sorting state slice.
|
|
34
|
+
*
|
|
35
|
+
* By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* table_resetSorting(table)
|
|
40
|
+
* table_resetSorting(table, true)
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
12
43
|
function table_resetSorting(table, defaultState) {
|
|
13
44
|
table_setSorting(table, defaultState ? [] : require_utils.cloneState(table.initialState.sorting ?? []));
|
|
14
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Infers sort fn for a column.
|
|
48
|
+
*
|
|
49
|
+
* The inference uses the column definition, table options, and sampled row values when needed.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const value = column_getAutoSortFn(column)
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
15
56
|
function column_getAutoSortFn(column) {
|
|
16
57
|
const sortFns = column.table._rowModelFns.sortFns;
|
|
17
58
|
let sortFn;
|
|
@@ -28,15 +69,45 @@ function column_getAutoSortFn(column) {
|
|
|
28
69
|
if (isString) sortFn = sortFns === null || sortFns === void 0 ? void 0 : sortFns.text;
|
|
29
70
|
return sortFn ?? require_sortFns.sortFn_basic;
|
|
30
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Infers sort dir for a column.
|
|
74
|
+
*
|
|
75
|
+
* The inference uses the column definition, table options, and sampled row values when needed.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* const value = column_getAutoSortDir(column)
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
31
82
|
function column_getAutoSortDir(column) {
|
|
32
83
|
const firstRow = column.table.getFilteredRowModel().flatRows[0];
|
|
33
84
|
if (typeof (firstRow ? firstRow.getValue(column.id) : void 0) === "string") return "asc";
|
|
34
85
|
return "desc";
|
|
35
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns sort fn for a column.
|
|
89
|
+
*
|
|
90
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* const value = column_getSortFn(column)
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
36
97
|
function column_getSortFn(column) {
|
|
37
98
|
const sortFns = column.table._rowModelFns.sortFns;
|
|
38
99
|
return require_utils.isFunction(column.columnDef.sortFn) ? column.columnDef.sortFn : column.columnDef.sortFn === "auto" ? column_getAutoSortFn(column) : (sortFns === null || sortFns === void 0 ? void 0 : sortFns[column.columnDef.sortFn]) ?? require_sortFns.sortFn_basic;
|
|
39
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Toggles sorting for a column.
|
|
103
|
+
*
|
|
104
|
+
* The update is applied through the owning table state slice and respects the feature options for that column.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* column_toggleSorting(column)
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
40
111
|
function column_toggleSorting(column, desc, multi) {
|
|
41
112
|
const nextSortingOrder = column_getNextSortingOrder(column);
|
|
42
113
|
const hasManualValue = typeof desc !== "undefined";
|
|
@@ -77,9 +148,29 @@ function column_toggleSorting(column, desc, multi) {
|
|
|
77
148
|
return newSorting;
|
|
78
149
|
});
|
|
79
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Returns first sort dir for a column.
|
|
153
|
+
*
|
|
154
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const value = column_getFirstSortDir(column)
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
80
161
|
function column_getFirstSortDir(column) {
|
|
81
162
|
return column.columnDef.sortDescFirst ?? column.table.options.sortDescFirst ?? column_getAutoSortDir(column) === "desc" ? "desc" : "asc";
|
|
82
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Returns next sorting order for a column.
|
|
166
|
+
*
|
|
167
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const value = column_getNextSortingOrder(column)
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
83
174
|
function column_getNextSortingOrder(column, multi) {
|
|
84
175
|
const firstSortDirection = column_getFirstSortDir(column);
|
|
85
176
|
const isSorted = column_getIsSorted(column);
|
|
@@ -87,24 +178,84 @@ function column_getNextSortingOrder(column, multi) {
|
|
|
87
178
|
if (isSorted !== firstSortDirection && (column.table.options.enableSortingRemoval ?? true) && (multi ? column.table.options.enableMultiRemove ?? true : true)) return false;
|
|
88
179
|
return isSorted === "desc" ? "asc" : "desc";
|
|
89
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Returns whether a column can use sort.
|
|
183
|
+
*
|
|
184
|
+
* This combines column options, table options, and any required accessor or feature state for the capability.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```ts
|
|
188
|
+
* const value = column_getCanSort(column)
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
90
191
|
function column_getCanSort(column) {
|
|
91
192
|
return (column.columnDef.enableSorting ?? true) && (column.table.options.enableSorting ?? true) && !!column.accessorFn;
|
|
92
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns whether a column can use multi sort.
|
|
196
|
+
*
|
|
197
|
+
* This combines column options, table options, and any required accessor or feature state for the capability.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* const value = column_getCanMultiSort(column)
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
93
204
|
function column_getCanMultiSort(column) {
|
|
94
205
|
return column.columnDef.enableMultiSort ?? column.table.options.enableMultiSort ?? !!column.accessorFn;
|
|
95
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Returns is sorted for a column.
|
|
209
|
+
*
|
|
210
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* const value = column_getIsSorted(column)
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
96
217
|
function column_getIsSorted(column) {
|
|
97
218
|
var _column$table$atoms$s;
|
|
98
219
|
const columnSort = (_column$table$atoms$s = column.table.atoms.sorting) === null || _column$table$atoms$s === void 0 || (_column$table$atoms$s = _column$table$atoms$s.get()) === null || _column$table$atoms$s === void 0 ? void 0 : _column$table$atoms$s.find((d) => d.id === column.id);
|
|
99
220
|
return !columnSort ? false : columnSort.desc ? "desc" : "asc";
|
|
100
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns sort index for a column.
|
|
224
|
+
*
|
|
225
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* const value = column_getSortIndex(column)
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
101
232
|
function column_getSortIndex(column) {
|
|
102
233
|
var _column$table$atoms$s2;
|
|
103
234
|
return ((_column$table$atoms$s2 = column.table.atoms.sorting) === null || _column$table$atoms$s2 === void 0 || (_column$table$atoms$s2 = _column$table$atoms$s2.get()) === null || _column$table$atoms$s2 === void 0 ? void 0 : _column$table$atoms$s2.findIndex((d) => d.id === column.id)) ?? -1;
|
|
104
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Clear Sorting. for a column.
|
|
238
|
+
*
|
|
239
|
+
* This is the static implementation behind the matching column instance API.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* const value = column_clearSorting(column)
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
105
246
|
function column_clearSorting(column) {
|
|
106
247
|
table_setSorting(column.table, (old) => old.length ? old.filter((d) => d.id !== column.id) : []);
|
|
107
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Returns an event handler for toggling sorting handler.
|
|
251
|
+
*
|
|
252
|
+
* The handler is intended for direct use in column header controls such as buttons or checkboxes.
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* const value = column_getToggleSortingHandler(column)
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
108
259
|
function column_getToggleSortingHandler(column) {
|
|
109
260
|
const canSort = column_getCanSort(column);
|
|
110
261
|
return (e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowSortingFeature.utils.cjs","names":["cloneState","reSplitAlphaNumeric","sortFn_basic","isFunction"],"sources":["../../../src/features/row-sorting/rowSortingFeature.utils.ts"],"sourcesContent":["import { reSplitAlphaNumeric, sortFn_basic } from '../../fns/sortFns'\nimport { cloneState, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n SortDirection,\n SortFn,\n SortingState,\n} from './rowSortingFeature.types'\n\n// State Utils\n\nexport function getDefaultSortingState(): SortingState {\n return []\n}\n\nexport function table_setSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<SortingState>) {\n table.options.onSortingChange?.(updater)\n}\n\nexport function table_resetSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setSorting(\n table,\n defaultState ? [] : cloneState(table.initialState.sorting ?? []),\n )\n}\n\n// Column Utils\n\nexport function column_getAutoSortFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData> {\n const sortFns: Record<string, SortFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.sortFns\n\n let sortFn: SortFn<TFeatures, TData> | undefined\n\n const firstRows = column.table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n sortFn = sortFns?.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n sortFn = sortFns?.alphanumeric\n }\n }\n }\n\n if (isString) {\n sortFn = sortFns?.text\n }\n\n return sortFn ?? sortFn_basic\n}\n\nexport function column_getAutoSortDir<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const firstRow = column.table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow ? firstRow.getValue(column.id) : undefined\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n}\n\nexport function column_getSortFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData> {\n const sortFns: Record<string, SortFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.sortFns\n\n return isFunction(column.columnDef.sortFn)\n ? column.columnDef.sortFn\n : column.columnDef.sortFn === 'auto'\n ? column_getAutoSortFn(column)\n : (sortFns?.[column.columnDef.sortFn as string] ?? sortFn_basic)\n}\n\nexport function column_toggleSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n desc?: boolean,\n multi?: boolean,\n) {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column_getNextSortingOrder(column)\n const hasManualValue = typeof desc !== 'undefined'\n\n table_setSorting(column.table, (old) => {\n // Find any existing sorting for this column\n const existingSorting = old.find((d) => d.id === column.id)\n const existingIndex = old.findIndex((d) => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n const nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old.length && column_getCanMultiSort(column) && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (column.table.options.maxMultiSortColCount ??\n Number.MAX_SAFE_INTEGER),\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map((d) => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter((d) => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n}\n\nexport function column_getFirstSortDir<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n column.table.options.sortDescFirst ??\n column_getAutoSortDir(column) === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n}\n\nexport function column_getNextSortingOrder<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, multi?: boolean) {\n const firstSortDirection = column_getFirstSortDir(column)\n const isSorted = column_getIsSorted(column)\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (column.table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? (column.table.options.enableMultiRemove ?? true) : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n}\n\nexport function column_getCanSort<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (column.table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n}\n\nexport function column_getCanMultiSort<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n return (\n column.columnDef.enableMultiSort ??\n column.table.options.enableMultiSort ??\n !!column.accessorFn\n )\n}\n\nexport function column_getIsSorted<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): false | SortDirection {\n const columnSort = column.table.atoms.sorting\n ?.get()\n ?.find((d) => d.id === column.id)\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n}\n\nexport function column_getSortIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return (\n column.table.atoms.sorting?.get()?.findIndex((d) => d.id === column.id) ??\n -1\n )\n}\n\nexport function column_clearSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n // clear sorting for just 1 column\n table_setSorting(column.table, (old) =>\n old.length ? old.filter((d) => d.id !== column.id) : [],\n )\n}\n\nexport function column_getToggleSortingHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const canSort = column_getCanSort(column)\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column_toggleSorting(\n column,\n\n undefined,\n column_getCanMultiSort(column)\n ? column.table.options.isMultiSortEvent?.(e)\n : false,\n )\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"rowSortingFeature.utils.cjs","names":["cloneState","reSplitAlphaNumeric","sortFn_basic","isFunction"],"sources":["../../../src/features/row-sorting/rowSortingFeature.utils.ts"],"sourcesContent":["import { reSplitAlphaNumeric, sortFn_basic } from '../../fns/sortFns'\nimport { cloneState, isFunction } from '../../utils'\nimport type { CellData, RowData, Updater } from '../../types/type-utils'\nimport type { TableFeatures } from '../../types/TableFeatures'\nimport type { Table_Internal } from '../../types/Table'\nimport type { Column_Internal } from '../../types/Column'\nimport type {\n SortDirection,\n SortFn,\n SortingState,\n} from './rowSortingFeature.types'\n\n// State Utils\n\n/**\n * Returns the default sorting state.\n *\n * Feature constructors use this value to initialize the table state or option defaults when no user value is provided.\n *\n * @example\n * ```ts\n * const initialValue = getDefaultSortingState()\n * ```\n */\nexport function getDefaultSortingState(): SortingState {\n return []\n}\n\n/**\n * Updates the table's sorting state slice.\n *\n * The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.\n *\n * @example\n * ```ts\n * table_setSorting(table, (old) => old)\n * ```\n */\nexport function table_setSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, updater: Updater<SortingState>) {\n table.options.onSortingChange?.(updater)\n}\n\n/**\n * Resets the table's sorting state slice.\n *\n * By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.\n *\n * @example\n * ```ts\n * table_resetSorting(table)\n * table_resetSorting(table, true)\n * ```\n */\nexport function table_resetSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean) {\n table_setSorting(\n table,\n defaultState ? [] : cloneState(table.initialState.sorting ?? []),\n )\n}\n\n// Column Utils\n\n/**\n * Infers sort fn for a column.\n *\n * The inference uses the column definition, table options, and sampled row values when needed.\n *\n * @example\n * ```ts\n * const value = column_getAutoSortFn(column)\n * ```\n */\nexport function column_getAutoSortFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData> {\n const sortFns: Record<string, SortFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.sortFns\n\n let sortFn: SortFn<TFeatures, TData> | undefined\n\n const firstRows = column.table.getFilteredRowModel().flatRows.slice(10)\n\n let isString = false\n\n for (const row of firstRows) {\n const value = row.getValue(column.id)\n\n if (Object.prototype.toString.call(value) === '[object Date]') {\n sortFn = sortFns?.datetime\n }\n\n if (typeof value === 'string') {\n isString = true\n\n if (value.split(reSplitAlphaNumeric).length > 1) {\n sortFn = sortFns?.alphanumeric\n }\n }\n }\n\n if (isString) {\n sortFn = sortFns?.text\n }\n\n return sortFn ?? sortFn_basic\n}\n\n/**\n * Infers sort dir for a column.\n *\n * The inference uses the column definition, table options, and sampled row values when needed.\n *\n * @example\n * ```ts\n * const value = column_getAutoSortDir(column)\n * ```\n */\nexport function column_getAutoSortDir<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const firstRow = column.table.getFilteredRowModel().flatRows[0]\n\n const value = firstRow ? firstRow.getValue(column.id) : undefined\n\n if (typeof value === 'string') {\n return 'asc'\n }\n\n return 'desc'\n}\n\n/**\n * Returns sort fn for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getSortFn(column)\n * ```\n */\nexport function column_getSortFn<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData> {\n const sortFns: Record<string, SortFn<TFeatures, TData>> | undefined =\n column.table._rowModelFns.sortFns\n\n return isFunction(column.columnDef.sortFn)\n ? column.columnDef.sortFn\n : column.columnDef.sortFn === 'auto'\n ? column_getAutoSortFn(column)\n : (sortFns?.[column.columnDef.sortFn as string] ?? sortFn_basic)\n}\n\n/**\n * Toggles sorting for a column.\n *\n * The update is applied through the owning table state slice and respects the feature options for that column.\n *\n * @example\n * ```ts\n * column_toggleSorting(column)\n * ```\n */\nexport function column_toggleSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(\n column: Column_Internal<TFeatures, TData, TValue>,\n desc?: boolean,\n multi?: boolean,\n) {\n // if (column.columns.length) {\n // column.columns.forEach((c, i) => {\n // if (c.id) {\n // table.toggleColumnSorting(c.id, undefined, multi || !!i)\n // }\n // })\n // return\n // }\n\n // this needs to be outside of table.setSorting to be in sync with rerender\n const nextSortingOrder = column_getNextSortingOrder(column)\n const hasManualValue = typeof desc !== 'undefined'\n\n table_setSorting(column.table, (old) => {\n // Find any existing sorting for this column\n const existingSorting = old.find((d) => d.id === column.id)\n const existingIndex = old.findIndex((d) => d.id === column.id)\n\n let newSorting: SortingState = []\n\n // What should we do with this sort action?\n let sortAction: 'add' | 'remove' | 'toggle' | 'replace'\n const nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'\n\n // Multi-mode\n if (old.length && column_getCanMultiSort(column) && multi) {\n if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (old.length && existingIndex !== old.length - 1) {\n sortAction = 'replace'\n } else if (existingSorting) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sorting\n if (sortAction === 'toggle') {\n // If we are \"actually\" toggling (not a manual set value), should we remove the sorting?\n if (!hasManualValue) {\n // Is our intention to remove?\n if (!nextSortingOrder) {\n sortAction = 'remove'\n }\n }\n }\n\n if (sortAction === 'add') {\n newSorting = [\n ...old,\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n // Take latest n columns\n newSorting.splice(\n 0,\n newSorting.length -\n (column.table.options.maxMultiSortColCount ??\n Number.MAX_SAFE_INTEGER),\n )\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSorting = old.map((d) => {\n if (d.id === column.id) {\n return {\n ...d,\n desc: nextDesc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSorting = old.filter((d) => d.id !== column.id)\n } else {\n newSorting = [\n {\n id: column.id,\n desc: nextDesc,\n },\n ]\n }\n\n return newSorting\n })\n}\n\n/**\n * Returns first sort dir for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getFirstSortDir(column)\n * ```\n */\nexport function column_getFirstSortDir<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const sortDescFirst =\n column.columnDef.sortDescFirst ??\n column.table.options.sortDescFirst ??\n column_getAutoSortDir(column) === 'desc'\n return sortDescFirst ? 'desc' : 'asc'\n}\n\n/**\n * Returns next sorting order for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getNextSortingOrder(column)\n * ```\n */\nexport function column_getNextSortingOrder<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>, multi?: boolean) {\n const firstSortDirection = column_getFirstSortDir(column)\n const isSorted = column_getIsSorted(column)\n\n if (!isSorted) {\n return firstSortDirection\n }\n\n if (\n isSorted !== firstSortDirection &&\n (column.table.options.enableSortingRemoval ?? true) && // If enableSortRemove, enable in general\n (multi ? (column.table.options.enableMultiRemove ?? true) : true) // If multi, don't allow if enableMultiRemove))\n ) {\n return false\n }\n return isSorted === 'desc' ? 'asc' : 'desc'\n}\n\n/**\n * Returns whether a column can use sort.\n *\n * This combines column options, table options, and any required accessor or feature state for the capability.\n *\n * @example\n * ```ts\n * const value = column_getCanSort(column)\n * ```\n */\nexport function column_getCanSort<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n return (\n (column.columnDef.enableSorting ?? true) &&\n (column.table.options.enableSorting ?? true) &&\n !!column.accessorFn\n )\n}\n\n/**\n * Returns whether a column can use multi sort.\n *\n * This combines column options, table options, and any required accessor or feature state for the capability.\n *\n * @example\n * ```ts\n * const value = column_getCanMultiSort(column)\n * ```\n */\nexport function column_getCanMultiSort<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): boolean {\n return (\n column.columnDef.enableMultiSort ??\n column.table.options.enableMultiSort ??\n !!column.accessorFn\n )\n}\n\n/**\n * Returns is sorted for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getIsSorted(column)\n * ```\n */\nexport function column_getIsSorted<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): false | SortDirection {\n const columnSort = column.table.atoms.sorting\n ?.get()\n ?.find((d) => d.id === column.id)\n return !columnSort ? false : columnSort.desc ? 'desc' : 'asc'\n}\n\n/**\n * Returns sort index for a column.\n *\n * This derives the value from the column definition, table options, and the feature state atoms registered on the table.\n *\n * @example\n * ```ts\n * const value = column_getSortIndex(column)\n * ```\n */\nexport function column_getSortIndex<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>): number {\n return (\n column.table.atoms.sorting?.get()?.findIndex((d) => d.id === column.id) ??\n -1\n )\n}\n\n/**\n * Clear Sorting. for a column.\n *\n * This is the static implementation behind the matching column instance API.\n *\n * @example\n * ```ts\n * const value = column_clearSorting(column)\n * ```\n */\nexport function column_clearSorting<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n // clear sorting for just 1 column\n table_setSorting(column.table, (old) =>\n old.length ? old.filter((d) => d.id !== column.id) : [],\n )\n}\n\n/**\n * Returns an event handler for toggling sorting handler.\n *\n * The handler is intended for direct use in column header controls such as buttons or checkboxes.\n *\n * @example\n * ```ts\n * const value = column_getToggleSortingHandler(column)\n * ```\n */\nexport function column_getToggleSortingHandler<\n TFeatures extends TableFeatures,\n TData extends RowData,\n TValue extends CellData = CellData,\n>(column: Column_Internal<TFeatures, TData, TValue>) {\n const canSort = column_getCanSort(column)\n\n return (e: unknown) => {\n if (!canSort) return\n ;(e as any).persist?.()\n column_toggleSorting(\n column,\n\n undefined,\n column_getCanMultiSort(column)\n ? column.table.options.isMultiSortEvent?.(e)\n : false,\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAwBA,SAAgB,yBAAuC;CACrD,OAAO,EAAE;;;;;;;;;;;;AAaX,SAAgB,iBAGd,OAAyC,SAAgC;;CACzE,iDAAM,SAAQ,4GAAkB,QAAQ;;;;;;;;;;;;;AAc1C,SAAgB,mBAGd,OAAyC,cAAwB;CACjE,iBACE,OACA,eAAe,EAAE,GAAGA,yBAAW,MAAM,aAAa,WAAW,EAAE,CAAC,CACjE;;;;;;;;;;;;AAeH,SAAgB,qBAId,QAA6E;CAC7E,MAAM,UACJ,OAAO,MAAM,aAAa;CAE5B,IAAI;CAEJ,MAAM,YAAY,OAAO,MAAM,qBAAqB,CAAC,SAAS,MAAM,GAAG;CAEvE,IAAI,WAAW;CAEf,KAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,QAAQ,IAAI,SAAS,OAAO,GAAG;EAErC,IAAI,OAAO,UAAU,SAAS,KAAK,MAAM,KAAK,iBAC5C,2DAAS,QAAS;EAGpB,IAAI,OAAO,UAAU,UAAU;GAC7B,WAAW;GAEX,IAAI,MAAM,MAAMC,oCAAoB,CAAC,SAAS,GAC5C,2DAAS,QAAS;;;CAKxB,IAAI,UACF,2DAAS,QAAS;CAGpB,OAAO,UAAUC;;;;;;;;;;;;AAanB,SAAgB,sBAId,QAAmD;CACnD,MAAM,WAAW,OAAO,MAAM,qBAAqB,CAAC,SAAS;CAI7D,IAAI,QAFU,WAAW,SAAS,SAAS,OAAO,GAAG,GAAG,YAEnC,UACnB,OAAO;CAGT,OAAO;;;;;;;;;;;;AAaT,SAAgB,iBAId,QAA6E;CAC7E,MAAM,UACJ,OAAO,MAAM,aAAa;CAE5B,OAAOC,yBAAW,OAAO,UAAU,OAAO,GACtC,OAAO,UAAU,SACjB,OAAO,UAAU,WAAW,SAC1B,qBAAqB,OAAO,sDAC3B,QAAU,OAAO,UAAU,YAAqBD;;;;;;;;;;;;AAazD,SAAgB,qBAKd,QACA,MACA,OACA;CAWA,MAAM,mBAAmB,2BAA2B,OAAO;CAC3D,MAAM,iBAAiB,OAAO,SAAS;CAEvC,iBAAiB,OAAO,QAAQ,QAAQ;EAEtC,MAAM,kBAAkB,IAAI,MAAM,MAAM,EAAE,OAAO,OAAO,GAAG;EAC3D,MAAM,gBAAgB,IAAI,WAAW,MAAM,EAAE,OAAO,OAAO,GAAG;EAE9D,IAAI,aAA2B,EAAE;EAGjC,IAAI;EACJ,MAAM,WAAW,iBAAiB,OAAO,qBAAqB;EAG9D,IAAI,IAAI,UAAU,uBAAuB,OAAO,IAAI,OAClD,IAAI,iBACF,aAAa;OAEb,aAAa;OAIf,IAAI,IAAI,UAAU,kBAAkB,IAAI,SAAS,GAC/C,aAAa;OACR,IAAI,iBACT,aAAa;OAEb,aAAa;EAKjB,IAAI,eAAe,UAEjB;OAAI,CAAC,gBAEH;QAAI,CAAC,kBACH,aAAa;;;EAKnB,IAAI,eAAe,OAAO;GACxB,aAAa,CACX,GAAG,KACH;IACE,IAAI,OAAO;IACX,MAAM;IACP,CACF;GAED,WAAW,OACT,GACA,WAAW,UACR,OAAO,MAAM,QAAQ,wBACpB,OAAO,kBACZ;SACI,IAAI,eAAe,UAExB,aAAa,IAAI,KAAK,MAAM;GAC1B,IAAI,EAAE,OAAO,OAAO,IAClB,OAAO;IACL,GAAG;IACH,MAAM;IACP;GAEH,OAAO;IACP;OACG,IAAI,eAAe,UACxB,aAAa,IAAI,QAAQ,MAAM,EAAE,OAAO,OAAO,GAAG;OAElD,aAAa,CACX;GACE,IAAI,OAAO;GACX,MAAM;GACP,CACF;EAGH,OAAO;GACP;;;;;;;;;;;;AAaJ,SAAgB,uBAId,QAAmD;CAKnD,OAHE,OAAO,UAAU,iBACjB,OAAO,MAAM,QAAQ,iBACrB,sBAAsB,OAAO,KAAK,SACb,SAAS;;;;;;;;;;;;AAalC,SAAgB,2BAId,QAAmD,OAAiB;CACpE,MAAM,qBAAqB,uBAAuB,OAAO;CACzD,MAAM,WAAW,mBAAmB,OAAO;CAE3C,IAAI,CAAC,UACH,OAAO;CAGT,IACE,aAAa,uBACZ,OAAO,MAAM,QAAQ,wBAAwB,UAC7C,QAAS,OAAO,MAAM,QAAQ,qBAAqB,OAAQ,OAE5D,OAAO;CAET,OAAO,aAAa,SAAS,QAAQ;;;;;;;;;;;;AAavC,SAAgB,kBAId,QAAmD;CACnD,QACG,OAAO,UAAU,iBAAiB,UAClC,OAAO,MAAM,QAAQ,iBAAiB,SACvC,CAAC,CAAC,OAAO;;;;;;;;;;;;AAcb,SAAgB,uBAId,QAA4D;CAC5D,OACE,OAAO,UAAU,mBACjB,OAAO,MAAM,QAAQ,mBACrB,CAAC,CAAC,OAAO;;;;;;;;;;;;AAcb,SAAgB,mBAId,QAA0E;;CAC1E,MAAM,sCAAa,OAAO,MAAM,MAAM,wGAClC,KAAK,gFACL,MAAM,MAAM,EAAE,OAAO,OAAO,GAAG;CACnC,OAAO,CAAC,aAAa,QAAQ,WAAW,OAAO,SAAS;;;;;;;;;;;;AAa1D,SAAgB,oBAId,QAA2D;;CAC3D,kCACE,OAAO,MAAM,MAAM,2GAAS,KAAK,kFAAE,WAAW,MAAM,EAAE,OAAO,OAAO,GAAG,KACvE;;;;;;;;;;;;AAcJ,SAAgB,oBAId,QAAmD;CAEnD,iBAAiB,OAAO,QAAQ,QAC9B,IAAI,SAAS,IAAI,QAAQ,MAAM,EAAE,OAAO,OAAO,GAAG,GAAG,EAAE,CACxD;;;;;;;;;;;;AAaH,SAAgB,+BAId,QAAmD;CACnD,MAAM,UAAU,kBAAkB,OAAO;CAEzC,QAAQ,MAAe;;EACrB,IAAI,CAAC,SAAS;EACb,YAAC,EAAU,4DAAW;EACvB,qBACE,QAEA,QACA,uBAAuB,OAAO,sDAC1B,OAAO,MAAM,SAAQ,6HAAmB,EAAE,GAC1C,MACL"}
|
|
@@ -5,20 +5,171 @@ import { TableFeatures } from "../../types/TableFeatures.cjs";
|
|
|
5
5
|
import { Table_Internal } from "../../types/Table.cjs";
|
|
6
6
|
|
|
7
7
|
//#region src/features/row-sorting/rowSortingFeature.utils.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns the default sorting state.
|
|
10
|
+
*
|
|
11
|
+
* Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const initialValue = getDefaultSortingState()
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
8
18
|
declare function getDefaultSortingState(): SortingState;
|
|
19
|
+
/**
|
|
20
|
+
* Updates the table's sorting state slice.
|
|
21
|
+
*
|
|
22
|
+
* The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* table_setSorting(table, (old) => old)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
9
29
|
declare function table_setSorting<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<SortingState>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Resets the table's sorting state slice.
|
|
32
|
+
*
|
|
33
|
+
* By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* table_resetSorting(table)
|
|
38
|
+
* table_resetSorting(table, true)
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
10
41
|
declare function table_resetSorting<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* Infers sort fn for a column.
|
|
44
|
+
*
|
|
45
|
+
* The inference uses the column definition, table options, and sampled row values when needed.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const value = column_getAutoSortFn(column)
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
11
52
|
declare function column_getAutoSortFn<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData>;
|
|
53
|
+
/**
|
|
54
|
+
* Infers sort dir for a column.
|
|
55
|
+
*
|
|
56
|
+
* The inference uses the column definition, table options, and sampled row values when needed.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const value = column_getAutoSortDir(column)
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
12
63
|
declare function column_getAutoSortDir<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): "asc" | "desc";
|
|
64
|
+
/**
|
|
65
|
+
* Returns sort fn for a column.
|
|
66
|
+
*
|
|
67
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const value = column_getSortFn(column)
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
13
74
|
declare function column_getSortFn<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData>;
|
|
75
|
+
/**
|
|
76
|
+
* Toggles sorting for a column.
|
|
77
|
+
*
|
|
78
|
+
* The update is applied through the owning table state slice and respects the feature options for that column.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* column_toggleSorting(column)
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
14
85
|
declare function column_toggleSorting<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, desc?: boolean, multi?: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* Returns first sort dir for a column.
|
|
88
|
+
*
|
|
89
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const value = column_getFirstSortDir(column)
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
15
96
|
declare function column_getFirstSortDir<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): "asc" | "desc";
|
|
97
|
+
/**
|
|
98
|
+
* Returns next sorting order for a column.
|
|
99
|
+
*
|
|
100
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* const value = column_getNextSortingOrder(column)
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
16
107
|
declare function column_getNextSortingOrder<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, multi?: boolean): false | "asc" | "desc";
|
|
108
|
+
/**
|
|
109
|
+
* Returns whether a column can use sort.
|
|
110
|
+
*
|
|
111
|
+
* This combines column options, table options, and any required accessor or feature state for the capability.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const value = column_getCanSort(column)
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
17
118
|
declare function column_getCanSort<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Returns whether a column can use multi sort.
|
|
121
|
+
*
|
|
122
|
+
* This combines column options, table options, and any required accessor or feature state for the capability.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const value = column_getCanMultiSort(column)
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
18
129
|
declare function column_getCanMultiSort<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Returns is sorted for a column.
|
|
132
|
+
*
|
|
133
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const value = column_getIsSorted(column)
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
19
140
|
declare function column_getIsSorted<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): false | SortDirection;
|
|
141
|
+
/**
|
|
142
|
+
* Returns sort index for a column.
|
|
143
|
+
*
|
|
144
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* const value = column_getSortIndex(column)
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
20
151
|
declare function column_getSortIndex<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): number;
|
|
152
|
+
/**
|
|
153
|
+
* Clear Sorting. for a column.
|
|
154
|
+
*
|
|
155
|
+
* This is the static implementation behind the matching column instance API.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* const value = column_clearSorting(column)
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
21
162
|
declare function column_clearSorting<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): void;
|
|
163
|
+
/**
|
|
164
|
+
* Returns an event handler for toggling sorting handler.
|
|
165
|
+
*
|
|
166
|
+
* The handler is intended for direct use in column header controls such as buttons or checkboxes.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* const value = column_getToggleSortingHandler(column)
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
22
173
|
declare function column_getToggleSortingHandler<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): (e: unknown) => void;
|
|
23
174
|
//#endregion
|
|
24
175
|
export { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, column_getCanMultiSort, column_getCanSort, column_getFirstSortDir, column_getIsSorted, column_getNextSortingOrder, column_getSortFn, column_getSortIndex, column_getToggleSortingHandler, column_toggleSorting, getDefaultSortingState, table_resetSorting, table_setSorting };
|
|
@@ -5,20 +5,171 @@ import { TableFeatures } from "../../types/TableFeatures.js";
|
|
|
5
5
|
import { Table_Internal } from "../../types/Table.js";
|
|
6
6
|
|
|
7
7
|
//#region src/features/row-sorting/rowSortingFeature.utils.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns the default sorting state.
|
|
10
|
+
*
|
|
11
|
+
* Feature constructors use this value to initialize the table state or option defaults when no user value is provided.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const initialValue = getDefaultSortingState()
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
8
18
|
declare function getDefaultSortingState(): SortingState;
|
|
19
|
+
/**
|
|
20
|
+
* Updates the table's sorting state slice.
|
|
21
|
+
*
|
|
22
|
+
* The updater follows TanStack Table updater semantics and is routed through the corresponding `on*Change` option or backing atom.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* table_setSorting(table, (old) => old)
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
9
29
|
declare function table_setSorting<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, updater: Updater<SortingState>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Resets the table's sorting state slice.
|
|
32
|
+
*
|
|
33
|
+
* By default the reset uses `table.initialState`; when supported, a blank/default reset bypasses the saved initial value.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* table_resetSorting(table)
|
|
38
|
+
* table_resetSorting(table, true)
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
10
41
|
declare function table_resetSorting<TFeatures extends TableFeatures, TData extends RowData>(table: Table_Internal<TFeatures, TData>, defaultState?: boolean): void;
|
|
42
|
+
/**
|
|
43
|
+
* Infers sort fn for a column.
|
|
44
|
+
*
|
|
45
|
+
* The inference uses the column definition, table options, and sampled row values when needed.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const value = column_getAutoSortFn(column)
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
11
52
|
declare function column_getAutoSortFn<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData>;
|
|
53
|
+
/**
|
|
54
|
+
* Infers sort dir for a column.
|
|
55
|
+
*
|
|
56
|
+
* The inference uses the column definition, table options, and sampled row values when needed.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const value = column_getAutoSortDir(column)
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
12
63
|
declare function column_getAutoSortDir<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): "asc" | "desc";
|
|
64
|
+
/**
|
|
65
|
+
* Returns sort fn for a column.
|
|
66
|
+
*
|
|
67
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const value = column_getSortFn(column)
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
13
74
|
declare function column_getSortFn<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData>;
|
|
75
|
+
/**
|
|
76
|
+
* Toggles sorting for a column.
|
|
77
|
+
*
|
|
78
|
+
* The update is applied through the owning table state slice and respects the feature options for that column.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* column_toggleSorting(column)
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
14
85
|
declare function column_toggleSorting<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, desc?: boolean, multi?: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* Returns first sort dir for a column.
|
|
88
|
+
*
|
|
89
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const value = column_getFirstSortDir(column)
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
15
96
|
declare function column_getFirstSortDir<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): "asc" | "desc";
|
|
97
|
+
/**
|
|
98
|
+
* Returns next sorting order for a column.
|
|
99
|
+
*
|
|
100
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* const value = column_getNextSortingOrder(column)
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
16
107
|
declare function column_getNextSortingOrder<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>, multi?: boolean): false | "asc" | "desc";
|
|
108
|
+
/**
|
|
109
|
+
* Returns whether a column can use sort.
|
|
110
|
+
*
|
|
111
|
+
* This combines column options, table options, and any required accessor or feature state for the capability.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const value = column_getCanSort(column)
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
17
118
|
declare function column_getCanSort<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Returns whether a column can use multi sort.
|
|
121
|
+
*
|
|
122
|
+
* This combines column options, table options, and any required accessor or feature state for the capability.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const value = column_getCanMultiSort(column)
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
18
129
|
declare function column_getCanMultiSort<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Returns is sorted for a column.
|
|
132
|
+
*
|
|
133
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const value = column_getIsSorted(column)
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
19
140
|
declare function column_getIsSorted<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): false | SortDirection;
|
|
141
|
+
/**
|
|
142
|
+
* Returns sort index for a column.
|
|
143
|
+
*
|
|
144
|
+
* This derives the value from the column definition, table options, and the feature state atoms registered on the table.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* const value = column_getSortIndex(column)
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
20
151
|
declare function column_getSortIndex<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): number;
|
|
152
|
+
/**
|
|
153
|
+
* Clear Sorting. for a column.
|
|
154
|
+
*
|
|
155
|
+
* This is the static implementation behind the matching column instance API.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* const value = column_clearSorting(column)
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
21
162
|
declare function column_clearSorting<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): void;
|
|
163
|
+
/**
|
|
164
|
+
* Returns an event handler for toggling sorting handler.
|
|
165
|
+
*
|
|
166
|
+
* The handler is intended for direct use in column header controls such as buttons or checkboxes.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* const value = column_getToggleSortingHandler(column)
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
22
173
|
declare function column_getToggleSortingHandler<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(column: Column_Internal<TFeatures, TData, TValue>): (e: unknown) => void;
|
|
23
174
|
//#endregion
|
|
24
175
|
export { column_clearSorting, column_getAutoSortDir, column_getAutoSortFn, column_getCanMultiSort, column_getCanSort, column_getFirstSortDir, column_getIsSorted, column_getNextSortingOrder, column_getSortFn, column_getSortIndex, column_getToggleSortingHandler, column_toggleSorting, getDefaultSortingState, table_resetSorting, table_setSorting };
|