@tanstack/table-core 9.0.0-alpha.47 → 9.0.0-alpha.49
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/README.md +10 -0
- package/dist/core/cells/coreCellsFeature.utils.cjs +11 -8
- package/dist/core/cells/coreCellsFeature.utils.cjs.map +1 -1
- package/dist/core/cells/coreCellsFeature.utils.d.cts +11 -8
- package/dist/core/cells/coreCellsFeature.utils.d.ts +11 -8
- package/dist/core/cells/coreCellsFeature.utils.js +11 -8
- package/dist/core/cells/coreCellsFeature.utils.js.map +1 -1
- package/dist/core/columns/coreColumnsFeature.types.d.cts +7 -6
- package/dist/core/columns/coreColumnsFeature.types.d.ts +7 -6
- package/dist/core/columns/coreColumnsFeature.utils.cjs +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.cjs.map +1 -1
- package/dist/core/columns/coreColumnsFeature.utils.d.cts +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.d.ts +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.js +37 -27
- package/dist/core/columns/coreColumnsFeature.utils.js.map +1 -1
- package/dist/core/headers/coreHeadersFeature.types.d.cts +6 -4
- package/dist/core/headers/coreHeadersFeature.types.d.ts +6 -4
- package/dist/core/headers/coreHeadersFeature.utils.cjs +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.cjs.map +1 -1
- package/dist/core/headers/coreHeadersFeature.utils.d.cts +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.d.ts +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.js +23 -18
- package/dist/core/headers/coreHeadersFeature.utils.js.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.cjs.map +1 -1
- package/dist/core/row-models/coreRowModelsFeature.utils.d.cts +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.js +48 -36
- package/dist/core/row-models/coreRowModelsFeature.utils.js.map +1 -1
- package/dist/core/rows/coreRowsFeature.types.d.cts +4 -4
- package/dist/core/rows/coreRowsFeature.types.d.ts +4 -4
- package/dist/core/rows/coreRowsFeature.utils.cjs +34 -28
- package/dist/core/rows/coreRowsFeature.utils.cjs.map +1 -1
- package/dist/core/rows/coreRowsFeature.utils.d.cts +34 -28
- package/dist/core/rows/coreRowsFeature.utils.d.ts +34 -28
- package/dist/core/rows/coreRowsFeature.utils.js +34 -28
- package/dist/core/rows/coreRowsFeature.utils.js.map +1 -1
- package/dist/core/table/coreTablesFeature.types.d.cts +6 -2
- package/dist/core/table/coreTablesFeature.types.d.ts +6 -2
- package/dist/core/table/coreTablesFeature.utils.cjs +2 -2
- package/dist/core/table/coreTablesFeature.utils.cjs.map +1 -1
- package/dist/core/table/coreTablesFeature.utils.d.cts +2 -2
- package/dist/core/table/coreTablesFeature.utils.d.ts +2 -2
- package/dist/core/table/coreTablesFeature.utils.js +2 -2
- package/dist/core/table/coreTablesFeature.utils.js.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.types.d.cts +16 -10
- package/dist/features/column-faceting/columnFacetingFeature.types.d.ts +16 -10
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.cjs.map +1 -1
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.cts +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.js +26 -18
- package/dist/features/column-faceting/columnFacetingFeature.utils.js.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.types.d.cts +21 -11
- package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +21 -11
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.cts +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.js +39 -28
- package/dist/features/column-filtering/columnFilteringFeature.utils.js.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.types.d.cts +18 -14
- package/dist/features/column-grouping/columnGroupingFeature.types.d.ts +18 -14
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.cjs.map +1 -1
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.cts +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.js +55 -43
- package/dist/features/column-grouping/columnGroupingFeature.utils.js.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.types.d.cts +14 -5
- package/dist/features/column-ordering/columnOrderingFeature.types.d.ts +14 -5
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.cjs.map +1 -1
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.cts +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.d.ts +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.js +30 -23
- package/dist/features/column-ordering/columnOrderingFeature.utils.js.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.types.d.cts +43 -31
- package/dist/features/column-pinning/columnPinningFeature.types.d.ts +43 -31
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.cjs.map +1 -1
- package/dist/features/column-pinning/columnPinningFeature.utils.d.cts +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.js +111 -91
- package/dist/features/column-pinning/columnPinningFeature.utils.js.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.types.d.cts +9 -9
- package/dist/features/column-resizing/columnResizingFeature.types.d.ts +9 -9
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs +29 -20
- package/dist/features/column-resizing/columnResizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-resizing/columnResizingFeature.utils.d.cts +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.d.ts +28 -19
- package/dist/features/column-resizing/columnResizingFeature.utils.js +29 -20
- package/dist/features/column-resizing/columnResizingFeature.utils.js.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.types.d.cts +19 -12
- package/dist/features/column-sizing/columnSizingFeature.types.d.ts +19 -12
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.cjs.map +1 -1
- package/dist/features/column-sizing/columnSizingFeature.utils.d.cts +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.js +52 -41
- package/dist/features/column-sizing/columnSizingFeature.utils.js.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.cts +16 -13
- package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +16 -13
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.cjs.map +1 -1
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.cts +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js +54 -42
- package/dist/features/column-visibility/columnVisibilityFeature.utils.js.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.types.d.cts +10 -5
- package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +10 -5
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.cjs.map +1 -1
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.cts +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.js +20 -14
- package/dist/features/global-filtering/globalFilteringFeature.utils.js.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.types.d.cts +16 -15
- package/dist/features/row-expanding/rowExpandingFeature.types.d.ts +16 -15
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.cjs.map +1 -1
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.cts +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.js +56 -41
- package/dist/features/row-expanding/rowExpandingFeature.utils.js.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.types.d.cts +19 -12
- package/dist/features/row-pagination/rowPaginationFeature.types.d.ts +19 -12
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.cjs.map +1 -1
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.cts +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.d.ts +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.js +49 -32
- package/dist/features/row-pagination/rowPaginationFeature.utils.js.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.types.d.cts +12 -8
- package/dist/features/row-pinning/rowPinningFeature.types.d.ts +12 -8
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.cjs.map +1 -1
- package/dist/features/row-pinning/rowPinningFeature.utils.d.cts +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.js +39 -29
- package/dist/features/row-pinning/rowPinningFeature.utils.js.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.types.d.cts +30 -24
- package/dist/features/row-selection/rowSelectionFeature.types.d.ts +30 -24
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.cjs.map +1 -1
- package/dist/features/row-selection/rowSelectionFeature.utils.d.cts +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.js +89 -69
- package/dist/features/row-selection/rowSelectionFeature.utils.js.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.types.d.cts +10 -8
- package/dist/features/row-sorting/rowSortingFeature.types.d.ts +10 -8
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs +62 -45
- package/dist/features/row-sorting/rowSortingFeature.utils.cjs.map +1 -1
- package/dist/features/row-sorting/rowSortingFeature.utils.d.cts +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +61 -44
- package/dist/features/row-sorting/rowSortingFeature.utils.js +62 -45
- package/dist/features/row-sorting/rowSortingFeature.utils.js.map +1 -1
- package/dist/fns/aggregationFns.cjs +33 -9
- package/dist/fns/aggregationFns.cjs.map +1 -1
- package/dist/fns/aggregationFns.d.cts +33 -9
- package/dist/fns/aggregationFns.d.ts +33 -9
- package/dist/fns/aggregationFns.js +33 -9
- package/dist/fns/aggregationFns.js.map +1 -1
- package/dist/fns/filterFns.cjs +48 -17
- package/dist/fns/filterFns.cjs.map +1 -1
- package/dist/fns/filterFns.d.cts +42 -15
- package/dist/fns/filterFns.d.ts +42 -15
- package/dist/fns/filterFns.js +48 -17
- package/dist/fns/filterFns.js.map +1 -1
- package/dist/helpers/columnHelper.cjs +9 -4
- package/dist/helpers/columnHelper.cjs.map +1 -1
- package/dist/helpers/columnHelper.d.cts +9 -4
- package/dist/helpers/columnHelper.d.ts +9 -4
- package/dist/helpers/columnHelper.js +9 -4
- package/dist/helpers/columnHelper.js.map +1 -1
- package/dist/helpers/tableOptions.cjs.map +1 -1
- package/dist/helpers/tableOptions.d.cts +12 -9
- package/dist/helpers/tableOptions.d.ts +12 -9
- package/dist/helpers/tableOptions.js.map +1 -1
- package/dist/types/ColumnDef.d.cts +38 -0
- package/dist/types/ColumnDef.d.ts +38 -0
- package/dist/types/TableOptions.d.cts +15 -0
- package/dist/types/TableOptions.d.ts +15 -0
- package/dist/types/TableState.d.cts +12 -0
- package/dist/types/TableState.d.ts +12 -0
- package/package.json +5 -3
- package/skills/column-definitions/SKILL.md +333 -0
- package/skills/column-layout/SKILL.md +328 -0
- package/skills/column-layout/references/subsystems.md +220 -0
- package/skills/customizing-feature-behavior/SKILL.md +416 -0
- package/skills/filtering/SKILL.md +357 -0
- package/skills/filtering/references/faceting-and-fuzzy.md +191 -0
- package/skills/grouping/SKILL.md +448 -0
- package/skills/migrate-v8-to-v9/SKILL.md +495 -0
- package/skills/pagination/SKILL.md +385 -0
- package/skills/row-expanding/SKILL.md +348 -0
- package/skills/row-pinning/SKILL.md +269 -0
- package/skills/row-selection/SKILL.md +391 -0
- package/skills/setup/SKILL.md +400 -0
- package/skills/sorting/SKILL.md +344 -0
- package/skills/state-management/SKILL.md +388 -0
- package/src/core/cells/coreCellsFeature.utils.ts +11 -8
- package/src/core/columns/coreColumnsFeature.types.ts +7 -6
- package/src/core/columns/coreColumnsFeature.utils.ts +37 -27
- package/src/core/headers/coreHeadersFeature.types.ts +6 -4
- package/src/core/headers/coreHeadersFeature.utils.ts +23 -18
- package/src/core/row-models/coreRowModelsFeature.utils.ts +48 -36
- package/src/core/rows/coreRowsFeature.types.ts +4 -4
- package/src/core/rows/coreRowsFeature.utils.ts +34 -28
- package/src/core/table/coreTablesFeature.types.ts +6 -2
- package/src/core/table/coreTablesFeature.utils.ts +2 -2
- package/src/features/column-faceting/columnFacetingFeature.types.ts +16 -10
- package/src/features/column-faceting/columnFacetingFeature.utils.ts +26 -18
- package/src/features/column-filtering/columnFilteringFeature.types.ts +21 -11
- package/src/features/column-filtering/columnFilteringFeature.utils.ts +39 -28
- package/src/features/column-grouping/columnGroupingFeature.types.ts +18 -14
- package/src/features/column-grouping/columnGroupingFeature.utils.ts +55 -43
- package/src/features/column-ordering/columnOrderingFeature.types.ts +14 -5
- package/src/features/column-ordering/columnOrderingFeature.utils.ts +30 -23
- package/src/features/column-pinning/columnPinningFeature.types.ts +43 -31
- package/src/features/column-pinning/columnPinningFeature.utils.ts +111 -91
- package/src/features/column-resizing/columnResizingFeature.types.ts +9 -9
- package/src/features/column-resizing/columnResizingFeature.utils.ts +29 -21
- package/src/features/column-sizing/columnSizingFeature.types.ts +19 -12
- package/src/features/column-sizing/columnSizingFeature.utils.ts +52 -41
- package/src/features/column-visibility/columnVisibilityFeature.types.ts +16 -13
- package/src/features/column-visibility/columnVisibilityFeature.utils.ts +54 -42
- package/src/features/global-filtering/globalFilteringFeature.types.ts +10 -5
- package/src/features/global-filtering/globalFilteringFeature.utils.ts +20 -14
- package/src/features/row-expanding/rowExpandingFeature.types.ts +16 -15
- package/src/features/row-expanding/rowExpandingFeature.utils.ts +56 -41
- package/src/features/row-pagination/rowPaginationFeature.types.ts +19 -12
- package/src/features/row-pagination/rowPaginationFeature.utils.ts +49 -32
- package/src/features/row-pinning/rowPinningFeature.types.ts +12 -8
- package/src/features/row-pinning/rowPinningFeature.utils.ts +39 -29
- package/src/features/row-selection/rowSelectionFeature.types.ts +30 -24
- package/src/features/row-selection/rowSelectionFeature.utils.ts +89 -69
- package/src/features/row-sorting/rowSortingFeature.types.ts +10 -8
- package/src/features/row-sorting/rowSortingFeature.utils.ts +62 -45
- package/src/fns/aggregationFns.ts +33 -9
- package/src/fns/filterFns.ts +48 -17
- package/src/helpers/columnHelper.ts +9 -4
- package/src/helpers/tableOptions.ts +12 -9
- package/src/types/ColumnDef.ts +38 -0
- package/src/types/TableOptions.ts +15 -0
- package/src/types/TableState.ts +12 -0
|
@@ -14,13 +14,14 @@ import type { ColumnSizingState } from '../column-sizing/columnSizingFeature.typ
|
|
|
14
14
|
import type { columnResizingState } from './columnResizingFeature.types'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Creates the default transient column resizing state.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* The feature default represents no active drag interaction. Reset APIs use
|
|
20
|
+
* this value when `defaultState` is `true`.
|
|
20
21
|
*
|
|
21
22
|
* @example
|
|
22
23
|
* ```ts
|
|
23
|
-
* const
|
|
24
|
+
* const resizeInfo = getDefaultColumnResizingState()
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
27
|
export function getDefaultColumnResizingState(): columnResizingState {
|
|
@@ -35,13 +36,14 @@ export function getDefaultColumnResizingState(): columnResizingState {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
+
* Checks whether this column can start a resize interaction.
|
|
39
40
|
*
|
|
40
|
-
*
|
|
41
|
+
* Both `columnDef.enableResizing` and table `enableColumnResizing` default to
|
|
42
|
+
* `true`.
|
|
41
43
|
*
|
|
42
44
|
* @example
|
|
43
45
|
* ```ts
|
|
44
|
-
* const
|
|
46
|
+
* const canResize = column_getCanResize(column)
|
|
45
47
|
* ```
|
|
46
48
|
*/
|
|
47
49
|
export function column_getCanResize<
|
|
@@ -56,13 +58,13 @@ export function column_getCanResize<
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
61
|
+
* Checks whether this column is the active column resize target.
|
|
60
62
|
*
|
|
61
|
-
*
|
|
63
|
+
* The value is read from `state.columnResizing.isResizingColumn`.
|
|
62
64
|
*
|
|
63
65
|
* @example
|
|
64
66
|
* ```ts
|
|
65
|
-
* const
|
|
67
|
+
* const isResizing = column_getIsResizing(column)
|
|
66
68
|
* ```
|
|
67
69
|
*/
|
|
68
70
|
export function column_getIsResizing<
|
|
@@ -76,9 +78,11 @@ export function column_getIsResizing<
|
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
/**
|
|
79
|
-
*
|
|
81
|
+
* Creates the pointer/touch start handler for resizing a header.
|
|
80
82
|
*
|
|
81
|
-
*
|
|
83
|
+
* The handler records starting sizes for all leaf headers, tracks drag deltas,
|
|
84
|
+
* writes transient resize info, and commits column sizes on change or drag end
|
|
85
|
+
* depending on `columnResizeMode`.
|
|
82
86
|
*
|
|
83
87
|
* @example
|
|
84
88
|
* ```ts
|
|
@@ -263,13 +267,14 @@ export function header_getResizeHandler<
|
|
|
263
267
|
}
|
|
264
268
|
|
|
265
269
|
/**
|
|
266
|
-
*
|
|
270
|
+
* Routes a transient column resizing updater through the table's resize handler.
|
|
267
271
|
*
|
|
268
|
-
*
|
|
272
|
+
* This state tracks the active drag interaction; committed widths live in
|
|
273
|
+
* `columnSizing`.
|
|
269
274
|
*
|
|
270
275
|
* @example
|
|
271
276
|
* ```ts
|
|
272
|
-
* table_setColumnResizing(table, (old) => old)
|
|
277
|
+
* table_setColumnResizing(table, (old) => ({ ...old, deltaOffset: 12 }))
|
|
273
278
|
* ```
|
|
274
279
|
*/
|
|
275
280
|
export function table_setColumnResizing<
|
|
@@ -283,9 +288,11 @@ export function table_setColumnResizing<
|
|
|
283
288
|
}
|
|
284
289
|
|
|
285
290
|
/**
|
|
286
|
-
* Resets
|
|
291
|
+
* Resets `columnResizing` to the configured initial state or feature default.
|
|
287
292
|
*
|
|
288
|
-
*
|
|
293
|
+
* With no argument, the reset clones `table.initialState.columnResizing` when
|
|
294
|
+
* it exists. Passing `true` ignores initial state and resets to the no-drag
|
|
295
|
+
* default state.
|
|
289
296
|
*
|
|
290
297
|
* @example
|
|
291
298
|
* ```ts
|
|
@@ -307,10 +314,12 @@ export function table_resetHeaderSizeInfo<
|
|
|
307
314
|
)
|
|
308
315
|
}
|
|
309
316
|
|
|
317
|
+
let passiveSupported: boolean | null = null
|
|
310
318
|
/**
|
|
311
319
|
* Detects whether the current environment supports passive event listeners.
|
|
312
320
|
*
|
|
313
|
-
* Column resizing uses this to register pointer and touch listeners with
|
|
321
|
+
* Column resizing uses this to register pointer and touch listeners with
|
|
322
|
+
* `passive: false` only when the environment understands passive options.
|
|
314
323
|
*
|
|
315
324
|
* @example
|
|
316
325
|
* ```ts
|
|
@@ -318,8 +327,6 @@ export function table_resetHeaderSizeInfo<
|
|
|
318
327
|
* ```
|
|
319
328
|
*/
|
|
320
329
|
export function passiveEventSupported() {
|
|
321
|
-
let passiveSupported: boolean | null = null
|
|
322
|
-
|
|
323
330
|
if (typeof passiveSupported === 'boolean') return passiveSupported
|
|
324
331
|
|
|
325
332
|
let supported = false
|
|
@@ -343,9 +350,10 @@ export function passiveEventSupported() {
|
|
|
343
350
|
}
|
|
344
351
|
|
|
345
352
|
/**
|
|
346
|
-
*
|
|
353
|
+
* Narrows an unknown event to a `touchstart` event.
|
|
347
354
|
*
|
|
348
|
-
* Column resizing uses this
|
|
355
|
+
* Column resizing uses this before reading touch coordinates and installing
|
|
356
|
+
* touch-specific listeners.
|
|
349
357
|
*
|
|
350
358
|
* @example
|
|
351
359
|
* ```ts
|
|
@@ -23,19 +23,19 @@ export type ColumnSizingDefaultOptions = Pick<
|
|
|
23
23
|
|
|
24
24
|
export interface Table_ColumnSizing {
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Sums the current sizes of visible center-region leaf columns.
|
|
27
27
|
*/
|
|
28
28
|
getCenterTotalSize: () => number
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Sums the current sizes of visible left-pinned leaf columns.
|
|
31
31
|
*/
|
|
32
32
|
getLeftTotalSize: () => number
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Sums the current sizes of visible right-pinned leaf columns.
|
|
35
35
|
*/
|
|
36
36
|
getRightTotalSize: () => number
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Sums the current sizes of all visible leaf columns.
|
|
39
39
|
*/
|
|
40
40
|
getTotalSize: () => number
|
|
41
41
|
/**
|
|
@@ -44,37 +44,44 @@ export interface Table_ColumnSizing {
|
|
|
44
44
|
*/
|
|
45
45
|
resetColumnSizing: (defaultState?: boolean) => void
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Updates committed column sizing state with a next map or updater function.
|
|
48
48
|
*/
|
|
49
49
|
setColumnSizing: (updater: Updater<ColumnSizingState>) => void
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export interface ColumnDef_ColumnSizing {
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Upper bound used when resolving this column's size.
|
|
55
55
|
*/
|
|
56
56
|
maxSize?: number
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Lower bound used when resolving this column's size.
|
|
59
59
|
*/
|
|
60
60
|
minSize?: number
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Initial size used before column sizing state overrides it.
|
|
63
63
|
*/
|
|
64
64
|
size?: number
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export interface Column_ColumnSizing {
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* Measures the offset from this column's end edge to the end of its region.
|
|
70
|
+
*
|
|
71
|
+
* Pass a pinned region to measure within that region. The value is the sum
|
|
72
|
+
* of visible leaf column sizes after this column.
|
|
70
73
|
*/
|
|
71
74
|
getAfter: (position?: ColumnPinningPosition | 'center') => number
|
|
72
75
|
/**
|
|
73
|
-
*
|
|
76
|
+
* Resolves the column's current size after state and min/max constraints.
|
|
74
77
|
*/
|
|
75
78
|
getSize: () => number
|
|
76
79
|
/**
|
|
77
|
-
*
|
|
80
|
+
* Measures the offset from the start of this column's region to its start
|
|
81
|
+
* edge.
|
|
82
|
+
*
|
|
83
|
+
* Pass a pinned region to measure within that region. The value is the sum
|
|
84
|
+
* of visible leaf column sizes before this column.
|
|
78
85
|
*/
|
|
79
86
|
getStart: (position?: ColumnPinningPosition | 'center') => number
|
|
80
87
|
/**
|
|
@@ -85,7 +92,7 @@ export interface Column_ColumnSizing {
|
|
|
85
92
|
|
|
86
93
|
export interface Header_ColumnSizing {
|
|
87
94
|
/**
|
|
88
|
-
*
|
|
95
|
+
* Computes this header's rendered size from its leaf columns.
|
|
89
96
|
*/
|
|
90
97
|
getSize: () => number
|
|
91
98
|
/**
|
|
@@ -15,13 +15,14 @@ import type { Column_Internal } from '../../types/Column'
|
|
|
15
15
|
import type { ColumnSizingState } from './columnSizingFeature.types'
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Creates the default committed column sizing state.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* The feature default is an empty map, so columns fall back to their column def
|
|
21
|
+
* size or the built-in sizing defaults.
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
24
|
* ```ts
|
|
24
|
-
* const
|
|
25
|
+
* const sizing = getDefaultColumnSizingState()
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
28
|
export function getDefaultColumnSizingState(): ColumnSizingState {
|
|
@@ -29,13 +30,15 @@ export function getDefaultColumnSizingState(): ColumnSizingState {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Creates the built-in sizing defaults for column definitions.
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
+
* Columns default to `size: 150`, `minSize: 20`, and
|
|
36
|
+
* `maxSize: Number.MAX_SAFE_INTEGER` unless overridden by column definitions or
|
|
37
|
+
* table defaults.
|
|
35
38
|
*
|
|
36
39
|
* @example
|
|
37
40
|
* ```ts
|
|
38
|
-
* const
|
|
41
|
+
* const defaults = getDefaultColumnSizingColumnDef()
|
|
39
42
|
* ```
|
|
40
43
|
*/
|
|
41
44
|
export function getDefaultColumnSizingColumnDef() {
|
|
@@ -47,13 +50,14 @@ export function getDefaultColumnSizingColumnDef() {
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/**
|
|
50
|
-
*
|
|
53
|
+
* Resolves a column's current pixel size.
|
|
51
54
|
*
|
|
52
|
-
*
|
|
55
|
+
* Committed `state.columnSizing[column.id]` wins over `columnDef.size`, then the
|
|
56
|
+
* built-in default size. The result is clamped between min and max size.
|
|
53
57
|
*
|
|
54
58
|
* @example
|
|
55
59
|
* ```ts
|
|
56
|
-
* const
|
|
60
|
+
* const width = column_getSize(column)
|
|
57
61
|
* ```
|
|
58
62
|
*/
|
|
59
63
|
export function column_getSize<
|
|
@@ -74,13 +78,14 @@ export function column_getSize<
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
/**
|
|
77
|
-
*
|
|
81
|
+
* Computes the offset from the start edge of a pinning region to this column.
|
|
78
82
|
*
|
|
79
|
-
*
|
|
83
|
+
* The value is the sum of all previous visible leaf column sizes in the
|
|
84
|
+
* requested `'left'`, `'center'`, or `'right'` region.
|
|
80
85
|
*
|
|
81
86
|
* @example
|
|
82
87
|
* ```ts
|
|
83
|
-
* const
|
|
88
|
+
* const leftOffset = column_getStart(column, 'left')
|
|
84
89
|
* ```
|
|
85
90
|
*/
|
|
86
91
|
export function column_getStart<
|
|
@@ -114,13 +119,14 @@ export function column_getStart<
|
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
/**
|
|
117
|
-
*
|
|
122
|
+
* Computes the offset from the end edge of a pinning region after this column.
|
|
118
123
|
*
|
|
119
|
-
*
|
|
124
|
+
* The value is the sum of all following visible leaf column sizes in the
|
|
125
|
+
* requested region.
|
|
120
126
|
*
|
|
121
127
|
* @example
|
|
122
128
|
* ```ts
|
|
123
|
-
* const
|
|
129
|
+
* const rightOffset = column_getAfter(column, 'right')
|
|
124
130
|
* ```
|
|
125
131
|
*/
|
|
126
132
|
export function column_getAfter<
|
|
@@ -153,13 +159,14 @@ export function column_getAfter<
|
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
/**
|
|
156
|
-
*
|
|
162
|
+
* Removes this column's committed size override.
|
|
157
163
|
*
|
|
158
|
-
*
|
|
164
|
+
* After reset, the column resolves size from `columnDef.size` or built-in
|
|
165
|
+
* defaults again.
|
|
159
166
|
*
|
|
160
167
|
* @example
|
|
161
168
|
* ```ts
|
|
162
|
-
*
|
|
169
|
+
* column_resetSize(column)
|
|
163
170
|
* ```
|
|
164
171
|
*/
|
|
165
172
|
export function column_resetSize<
|
|
@@ -173,13 +180,14 @@ export function column_resetSize<
|
|
|
173
180
|
}
|
|
174
181
|
|
|
175
182
|
/**
|
|
176
|
-
*
|
|
183
|
+
* Computes a header's rendered size from its leaf headers.
|
|
177
184
|
*
|
|
178
|
-
*
|
|
185
|
+
* Group headers sum the sizes of all descendant leaf columns. Leaf headers use
|
|
186
|
+
* their column's current size.
|
|
179
187
|
*
|
|
180
188
|
* @example
|
|
181
189
|
* ```ts
|
|
182
|
-
* const
|
|
190
|
+
* const width = header_getSize(header)
|
|
183
191
|
* ```
|
|
184
192
|
*/
|
|
185
193
|
export function header_getSize<
|
|
@@ -203,13 +211,14 @@ export function header_getSize<
|
|
|
203
211
|
}
|
|
204
212
|
|
|
205
213
|
/**
|
|
206
|
-
*
|
|
214
|
+
* Computes a header's offset from the start of its header group.
|
|
207
215
|
*
|
|
208
|
-
*
|
|
216
|
+
* The offset is the previous sibling header's start plus size, or `0` for the
|
|
217
|
+
* first header in the group.
|
|
209
218
|
*
|
|
210
219
|
* @example
|
|
211
220
|
* ```ts
|
|
212
|
-
* const
|
|
221
|
+
* const offset = header_getStart(header)
|
|
213
222
|
* ```
|
|
214
223
|
*/
|
|
215
224
|
export function header_getStart<
|
|
@@ -233,13 +242,14 @@ export function header_getStart<
|
|
|
233
242
|
// Table APIs
|
|
234
243
|
|
|
235
244
|
/**
|
|
236
|
-
*
|
|
245
|
+
* Routes a committed column sizing updater through the table's sizing handler.
|
|
237
246
|
*
|
|
238
|
-
* The updater
|
|
247
|
+
* The updater may be a next size map or a function of the previous map,
|
|
248
|
+
* matching the instance `table.setColumnSizing` behavior.
|
|
239
249
|
*
|
|
240
250
|
* @example
|
|
241
251
|
* ```ts
|
|
242
|
-
* table_setColumnSizing(table, (old) => old)
|
|
252
|
+
* table_setColumnSizing(table, (old) => ({ ...old, age: 96 }))
|
|
243
253
|
* ```
|
|
244
254
|
*/
|
|
245
255
|
export function table_setColumnSizing<
|
|
@@ -253,9 +263,10 @@ export function table_setColumnSizing<
|
|
|
253
263
|
}
|
|
254
264
|
|
|
255
265
|
/**
|
|
256
|
-
* Resets the
|
|
266
|
+
* Resets `columnSizing` to the configured initial state or feature default.
|
|
257
267
|
*
|
|
258
|
-
*
|
|
268
|
+
* With no argument, the reset clones `table.initialState.columnSizing` when it
|
|
269
|
+
* exists. Passing `true` ignores initial state and resets to `{}`.
|
|
259
270
|
*
|
|
260
271
|
* @example
|
|
261
272
|
* ```ts
|
|
@@ -274,13 +285,13 @@ export function table_resetColumnSizing<
|
|
|
274
285
|
}
|
|
275
286
|
|
|
276
287
|
/**
|
|
277
|
-
*
|
|
288
|
+
* Sums the rendered size of the full table header row.
|
|
278
289
|
*
|
|
279
|
-
* This
|
|
290
|
+
* This includes left, center, and right columns in the main header group.
|
|
280
291
|
*
|
|
281
292
|
* @example
|
|
282
293
|
* ```ts
|
|
283
|
-
* const
|
|
294
|
+
* const width = table_getTotalSize(table)
|
|
284
295
|
* ```
|
|
285
296
|
*/
|
|
286
297
|
export function table_getTotalSize<
|
|
@@ -295,13 +306,13 @@ export function table_getTotalSize<
|
|
|
295
306
|
}
|
|
296
307
|
|
|
297
308
|
/**
|
|
298
|
-
*
|
|
309
|
+
* Sums the rendered size of the left pinned header region.
|
|
299
310
|
*
|
|
300
|
-
*
|
|
311
|
+
* An empty left pinning region returns `0`.
|
|
301
312
|
*
|
|
302
313
|
* @example
|
|
303
314
|
* ```ts
|
|
304
|
-
* const
|
|
315
|
+
* const width = table_getLeftTotalSize(table)
|
|
305
316
|
* ```
|
|
306
317
|
*/
|
|
307
318
|
export function table_getLeftTotalSize<
|
|
@@ -320,13 +331,13 @@ export function table_getLeftTotalSize<
|
|
|
320
331
|
}
|
|
321
332
|
|
|
322
333
|
/**
|
|
323
|
-
*
|
|
334
|
+
* Sums the rendered size of the center, unpinned header region.
|
|
324
335
|
*
|
|
325
|
-
*
|
|
336
|
+
* An empty center region returns `0`.
|
|
326
337
|
*
|
|
327
338
|
* @example
|
|
328
339
|
* ```ts
|
|
329
|
-
* const
|
|
340
|
+
* const width = table_getCenterTotalSize(table)
|
|
330
341
|
* ```
|
|
331
342
|
*/
|
|
332
343
|
export function table_getCenterTotalSize<
|
|
@@ -345,13 +356,13 @@ export function table_getCenterTotalSize<
|
|
|
345
356
|
}
|
|
346
357
|
|
|
347
358
|
/**
|
|
348
|
-
*
|
|
359
|
+
* Sums the rendered size of the right pinned header region.
|
|
349
360
|
*
|
|
350
|
-
*
|
|
361
|
+
* An empty right pinning region returns `0`.
|
|
351
362
|
*
|
|
352
363
|
* @example
|
|
353
364
|
* ```ts
|
|
354
|
-
* const
|
|
365
|
+
* const width = table_getRightTotalSize(table)
|
|
355
366
|
* ```
|
|
356
367
|
*/
|
|
357
368
|
export function table_getRightTotalSize<
|
|
@@ -32,31 +32,34 @@ export interface Table_ColumnVisibility<
|
|
|
32
32
|
TData extends RowData,
|
|
33
33
|
> {
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Checks whether every leaf column is currently visible.
|
|
36
36
|
*/
|
|
37
37
|
getIsAllColumnsVisible: () => boolean
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Checks whether at least one leaf column is currently visible.
|
|
40
40
|
*/
|
|
41
41
|
getIsSomeColumnsVisible: () => boolean
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Creates a checkbox-style handler that shows or hides all columns.
|
|
44
44
|
*/
|
|
45
45
|
getToggleAllColumnsVisibilityHandler: () => (event: unknown) => void
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Lists visible columns in flat table order, including parent columns that
|
|
48
|
+
* have visible descendants.
|
|
48
49
|
*/
|
|
49
50
|
getVisibleFlatColumns: () => Array<Column<TFeatures, TData, unknown>>
|
|
50
51
|
/**
|
|
51
|
-
*
|
|
52
|
+
* Lists visible leaf columns in the order used for row cells and headers.
|
|
52
53
|
*/
|
|
53
54
|
getVisibleLeafColumns: () => Array<Column<TFeatures, TData, unknown>>
|
|
54
55
|
/**
|
|
55
|
-
* Resets
|
|
56
|
+
* Resets `columnVisibility` to `initialState.columnVisibility`.
|
|
57
|
+
*
|
|
58
|
+
* Pass `true` to ignore initial state and reset to `{}`.
|
|
56
59
|
*/
|
|
57
60
|
resetColumnVisibility: (defaultState?: boolean) => void
|
|
58
61
|
/**
|
|
59
|
-
*
|
|
62
|
+
* Updates column visibility state with a next map or updater function.
|
|
60
63
|
*/
|
|
61
64
|
setColumnVisibility: (updater: Updater<ColumnVisibilityState>) => void
|
|
62
65
|
/**
|
|
@@ -67,7 +70,7 @@ export interface Table_ColumnVisibility<
|
|
|
67
70
|
|
|
68
71
|
export interface ColumnDef_ColumnVisibility {
|
|
69
72
|
/**
|
|
70
|
-
*
|
|
73
|
+
* Allows this column to be hidden. Defaults to `true`.
|
|
71
74
|
*/
|
|
72
75
|
enableHiding?: boolean
|
|
73
76
|
}
|
|
@@ -77,11 +80,11 @@ export interface Row_ColumnVisibility<
|
|
|
77
80
|
TData extends RowData,
|
|
78
81
|
> {
|
|
79
82
|
/**
|
|
80
|
-
*
|
|
83
|
+
* Gets this row's cells for currently visible columns.
|
|
81
84
|
*/
|
|
82
85
|
getVisibleCells: () => Array<Cell<TFeatures, TData, unknown>>
|
|
83
86
|
/**
|
|
84
|
-
*
|
|
87
|
+
* Maps this row's currently visible cells by column id.
|
|
85
88
|
*/
|
|
86
89
|
getVisibleCellsByColumnId: () => Record<
|
|
87
90
|
string,
|
|
@@ -91,15 +94,15 @@ export interface Row_ColumnVisibility<
|
|
|
91
94
|
|
|
92
95
|
export interface Column_ColumnVisibility {
|
|
93
96
|
/**
|
|
94
|
-
*
|
|
97
|
+
* Checks whether this column is allowed to be hidden.
|
|
95
98
|
*/
|
|
96
99
|
getCanHide: () => boolean
|
|
97
100
|
/**
|
|
98
|
-
*
|
|
101
|
+
* Checks whether this column is currently visible.
|
|
99
102
|
*/
|
|
100
103
|
getIsVisible: () => boolean
|
|
101
104
|
/**
|
|
102
|
-
*
|
|
105
|
+
* Creates a checkbox-style handler that toggles this column's visibility.
|
|
103
106
|
*/
|
|
104
107
|
getToggleVisibilityHandler: () => (event: unknown) => void
|
|
105
108
|
/**
|