@tanstack/table-core 9.0.0-beta.55 → 9.0.0-beta.58

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.
Files changed (95) hide show
  1. package/dist/core/cells/constructCell.d.ts +2 -2
  2. package/dist/core/cells/constructCell.js +2 -0
  3. package/dist/core/cells/coreCellsFeature.types.d.ts +2 -2
  4. package/dist/core/cells/coreCellsFeature.utils.d.ts +2 -2
  5. package/dist/core/columns/constructColumn.js +2 -2
  6. package/dist/core/headers/buildHeaderGroups.js +2 -0
  7. package/dist/core/headers/constructHeader.js +2 -0
  8. package/dist/core/row-models/coreRowModelsFeature.types.d.ts +4 -4
  9. package/dist/core/row-models/coreRowModelsFeature.utils.d.ts +1 -1
  10. package/dist/core/row-models/createCoreRowModel.d.ts +1 -1
  11. package/dist/core/row-models/createCoreRowModel.js +5 -1
  12. package/dist/core/rows/constructRow.d.ts +1 -1
  13. package/dist/core/rows/constructRow.js +2 -2
  14. package/dist/core/rows/coreRowsFeature.types.d.ts +2 -2
  15. package/dist/core/rows/coreRowsFeature.utils.d.ts +4 -4
  16. package/dist/core/rows/coreRowsFeature.utils.js +4 -3
  17. package/dist/core/table/constructTable.js +19 -1
  18. package/dist/core/table/coreTablesFeature.types.d.ts +21 -1
  19. package/dist/features/cell-selection/cellSelectionFeature.d.ts +9 -0
  20. package/dist/features/cell-selection/cellSelectionFeature.js +117 -0
  21. package/dist/features/cell-selection/cellSelectionFeature.types.d.ts +273 -0
  22. package/dist/features/cell-selection/cellSelectionFeature.utils.d.ts +288 -0
  23. package/dist/features/cell-selection/cellSelectionFeature.utils.js +732 -0
  24. package/dist/features/column-faceting/columnFacetingFeature.utils.d.ts +1 -1
  25. package/dist/features/column-faceting/createFacetedRowModel.d.ts +1 -1
  26. package/dist/features/column-filtering/columnFilteringFeature.types.d.ts +1 -1
  27. package/dist/features/column-filtering/columnFilteringFeature.utils.d.ts +1 -1
  28. package/dist/features/column-filtering/columnFilteringFeature.utils.js +9 -2
  29. package/dist/features/column-filtering/createFilteredRowModel.d.ts +1 -1
  30. package/dist/features/column-grouping/columnGroupingFeature.utils.d.ts +3 -3
  31. package/dist/features/column-grouping/createGroupedRowModel.d.ts +1 -1
  32. package/dist/features/column-pinning/columnPinningFeature.types.d.ts +1 -1
  33. package/dist/features/column-pinning/columnPinningFeature.utils.d.ts +3 -3
  34. package/dist/features/column-resizing/columnResizingFeature.utils.js +0 -1
  35. package/dist/features/column-sizing/columnSizingFeature.utils.d.ts +1 -1
  36. package/dist/features/column-visibility/columnVisibilityFeature.types.d.ts +1 -1
  37. package/dist/features/column-visibility/columnVisibilityFeature.utils.d.ts +3 -3
  38. package/dist/features/global-filtering/globalFilteringFeature.types.d.ts +1 -1
  39. package/dist/features/global-filtering/globalFilteringFeature.utils.d.ts +1 -1
  40. package/dist/features/row-aggregation/rowAggregationFeature.types.d.ts +9 -9
  41. package/dist/features/row-aggregation/rowAggregationFeature.utils.d.ts +2 -2
  42. package/dist/features/row-expanding/createExpandedRowModel.d.ts +1 -1
  43. package/dist/features/row-expanding/createExpandedRowModel.js +3 -2
  44. package/dist/features/row-expanding/rowExpandingFeature.utils.d.ts +2 -5
  45. package/dist/features/row-expanding/rowExpandingFeature.utils.js +1 -5
  46. package/dist/features/row-pagination/createPaginatedRowModel.d.ts +1 -1
  47. package/dist/features/row-pinning/rowPinningFeature.utils.d.ts +1 -1
  48. package/dist/features/row-selection/rowSelectionFeature.utils.d.ts +2 -3
  49. package/dist/features/row-selection/rowSelectionFeature.utils.js +1 -3
  50. package/dist/features/row-sorting/createSortedRowModel.d.ts +1 -1
  51. package/dist/features/row-sorting/rowSortingFeature.utils.d.ts +2 -3
  52. package/dist/features/row-sorting/rowSortingFeature.utils.js +2 -4
  53. package/dist/features/stockFeatures.d.ts +3 -1
  54. package/dist/features/stockFeatures.js +3 -1
  55. package/dist/index.d.ts +24 -22
  56. package/dist/index.js +2 -1
  57. package/dist/static-functions.d.ts +2 -1
  58. package/dist/static-functions.js +2 -1
  59. package/dist/types/Cell.d.ts +5 -3
  60. package/dist/types/Column.d.ts +9 -9
  61. package/dist/types/ColumnDef.d.ts +14 -12
  62. package/dist/types/Header.d.ts +1 -1
  63. package/dist/types/Row.d.ts +5 -5
  64. package/dist/types/RowModel.d.ts +4 -4
  65. package/dist/types/RowModelFns.d.ts +3 -3
  66. package/dist/types/Table.d.ts +15 -13
  67. package/dist/types/TableFeatures.d.ts +40 -5
  68. package/dist/types/TableOptions.d.ts +17 -15
  69. package/dist/types/TableState.d.ts +11 -9
  70. package/dist/types/type-utils.d.ts +1 -1
  71. package/dist/worker/createWorkerRowModel.d.ts +1 -1
  72. package/package.json +1 -1
  73. package/skills/aggregation/SKILL.md +2 -2
  74. package/skills/api-not-found/SKILL.md +1 -1
  75. package/skills/cell-selection/SKILL.md +180 -0
  76. package/skills/client-vs-server/SKILL.md +1 -1
  77. package/skills/column-faceting/SKILL.md +1 -1
  78. package/skills/column-filtering/SKILL.md +1 -1
  79. package/skills/column-ordering/SKILL.md +1 -1
  80. package/skills/column-pinning/SKILL.md +1 -1
  81. package/skills/column-resizing/SKILL.md +1 -1
  82. package/skills/column-sizing/SKILL.md +1 -1
  83. package/skills/column-visibility/SKILL.md +1 -1
  84. package/skills/core/SKILL.md +1 -1
  85. package/skills/custom-features/SKILL.md +1 -1
  86. package/skills/expanding/SKILL.md +1 -1
  87. package/skills/global-filtering/SKILL.md +1 -1
  88. package/skills/grouping/SKILL.md +1 -1
  89. package/skills/migrate-v8-to-v9/SKILL.md +1 -1
  90. package/skills/pagination/SKILL.md +1 -1
  91. package/skills/row-pinning/SKILL.md +1 -1
  92. package/skills/row-selection/SKILL.md +1 -1
  93. package/skills/sorting/SKILL.md +1 -1
  94. package/skills/table-features/SKILL.md +1 -1
  95. package/skills/typescript/SKILL.md +1 -1
@@ -0,0 +1,273 @@
1
+ import { CellData, OnChangeFn, RowData, Updater } from "../../types/type-utils.js";
2
+ import { Cell } from "../../types/Cell.js";
3
+ import { TableFeatures } from "../../types/TableFeatures.js";
4
+
5
+ //#region src/features/cell-selection/cellSelectionFeature.types.d.ts
6
+ /**
7
+ * A single rectangular cell selection, stored as its two defining corners.
8
+ *
9
+ * The `anchor` corner stays put while the `focus` corner moves during a
10
+ * shift-extend or a drag, so the pair carries strictly more information than a
11
+ * normalized min/max rectangle would. Corners are stored as flat row and column
12
+ * ids rather than nested objects or a packed `rowId_columnId` key, because
13
+ * `getRowId` is user-supplied and may return ids containing any separator.
14
+ */
15
+ interface CellSelectionRange {
16
+ anchorColumnId: string;
17
+ anchorRowId: string;
18
+ focusColumnId: string;
19
+ focusRowId: string;
20
+ }
21
+ /**
22
+ * The selected rectangles. The last entry is the active one that shift-extend
23
+ * and drag operate on.
24
+ *
25
+ * A bare array, matching `SortingState` and `ColumnFiltersState`. Drag session
26
+ * state deliberately lives outside this slice as non-reactive instance data, so
27
+ * nothing here is transient and the whole slice is safe to persist.
28
+ */
29
+ type CellSelectionState = Array<CellSelectionRange>;
30
+ interface TableState_CellSelection {
31
+ cellSelection: CellSelectionState;
32
+ }
33
+ /**
34
+ * A range resolved into inclusive display-order indexes.
35
+ *
36
+ * Ranges whose corners no longer resolve are omitted rather than clamped, so a
37
+ * range with a filtered-out corner contributes nothing while remaining in state.
38
+ */
39
+ interface CellSelectionBounds {
40
+ maxColumnIndex: number;
41
+ maxRowIndex: number;
42
+ minColumnIndex: number;
43
+ minRowIndex: number;
44
+ }
45
+ /**
46
+ * Which sides of a selected cell sit on the outer boundary of the selection.
47
+ */
48
+ interface CellSelectionEdges {
49
+ bottom: boolean;
50
+ left: boolean;
51
+ right: boolean;
52
+ top: boolean;
53
+ }
54
+ type CellSelectionDirection = 'up' | 'down' | 'left' | 'right';
55
+ interface SelectCellRangeOptions {
56
+ /**
57
+ * Whether the range should be added alongside existing ranges rather than
58
+ * replacing them. Defaults to `false`.
59
+ */
60
+ additive?: boolean;
61
+ }
62
+ interface TableOptions_CellSelection<in out TFeatures extends TableFeatures, in out TData extends RowData> {
63
+ /**
64
+ * Resets cell selection to `initialState.cellSelection` whenever `data`
65
+ * changes. Defaults to `true`.
66
+ *
67
+ * Ranges are stored as row and column ids, so new data would otherwise leave
68
+ * a selection pointing at rows that no longer exist, or silently re-select
69
+ * cells if the new data happens to reuse ids. Set to `false` to keep ranges
70
+ * across data changes, and note `autoResetAll` overrides this.
71
+ */
72
+ autoResetCellSelection?: boolean;
73
+ /**
74
+ * Enables inclusive cell range selection through shift-click and drag.
75
+ * Defaults to `true`.
76
+ */
77
+ enableCellRangeSelection?: boolean;
78
+ /**
79
+ * Allows cells to be selected.
80
+ *
81
+ * Provide a predicate to decide per cell. A column def may also opt out with
82
+ * its own `enableCellSelection: false`. Defaults to `true`.
83
+ */
84
+ enableCellSelection?: boolean | ((cell: Cell<TFeatures, TData, any>) => boolean);
85
+ /**
86
+ * Enables extending a selection by dragging across cells. Defaults to `true`.
87
+ */
88
+ enableCellSelectionDrag?: boolean;
89
+ /**
90
+ * Allows multiple disjoint rectangles to be selected at once. Defaults to
91
+ * `true`.
92
+ */
93
+ enableMultiCellRangeSelection?: boolean;
94
+ /**
95
+ * Determines whether a selection-start event should extend the active range
96
+ * instead of replacing the selection.
97
+ *
98
+ * By default, events with `shiftKey` directly on the event or on
99
+ * `event.nativeEvent` are treated as range-selection events.
100
+ */
101
+ isCellRangeSelectionEvent?: (event: unknown) => boolean;
102
+ /**
103
+ * Determines whether a selection-start event should add a new rectangle
104
+ * alongside the existing ones.
105
+ *
106
+ * By default, events with `ctrlKey` or `metaKey` directly on the event or on
107
+ * `event.nativeEvent` are treated as multi-range events.
108
+ */
109
+ isMultiCellRangeSelectionEvent?: (event: unknown) => boolean;
110
+ /**
111
+ * Called with an updater when cell selection state changes. Pair this with
112
+ * `state.cellSelection` when using external state; external atoms can own the
113
+ * slice without this callback.
114
+ *
115
+ * A drag emits one change per cell crossed. Subscribe to
116
+ * `table.atoms.cellSelection` for finer-grained reads when that matters.
117
+ */
118
+ onCellSelectionChange?: OnChangeFn<CellSelectionState>;
119
+ }
120
+ interface ColumnDef_CellSelection {
121
+ /**
122
+ * Allows cells in this column to be selected. Defaults to `true`.
123
+ */
124
+ enableCellSelection?: boolean;
125
+ }
126
+ interface Cell_CellSelection {
127
+ /**
128
+ * Checks whether this cell can currently be selected.
129
+ */
130
+ getCanSelect: () => boolean;
131
+ /**
132
+ * Checks whether this cell is the active cell, i.e. the anchor of the most
133
+ * recent range.
134
+ */
135
+ getIsFocused: () => boolean;
136
+ /**
137
+ * Checks whether this cell falls inside any selected range.
138
+ */
139
+ getIsSelected: () => boolean;
140
+ /**
141
+ * Returns which sides of this cell sit on the outer boundary of the
142
+ * selection, for rendering a spreadsheet-style outline without each cell
143
+ * inspecting its neighbours.
144
+ *
145
+ * All sides are `false` when the cell is not selected.
146
+ */
147
+ getSelectionEdges: () => CellSelectionEdges;
148
+ /**
149
+ * Creates a handler that extends the active range to this cell while a drag
150
+ * is in progress. Bind it to `mouseenter`.
151
+ *
152
+ * The handler no-ops unless a drag is open, and skips redundant writes when
153
+ * the active range already focuses this cell.
154
+ */
155
+ getSelectionExtendHandler: () => (event: unknown) => void;
156
+ /**
157
+ * Creates a handler that begins a selection at this cell. Bind it to
158
+ * `mousedown`.
159
+ *
160
+ * Pass the original mouse event, or a framework event whose `nativeEvent` is
161
+ * that event, so modifier keys can be detected. The handler attaches its own
162
+ * document-level `mouseup` listener so a drag released outside the table
163
+ * still ends correctly; pass `contextDocument` when the table renders into
164
+ * another document, such as an iframe or popout window.
165
+ */
166
+ getSelectionStartHandler: (contextDocument?: Document) => (event: unknown) => void;
167
+ /**
168
+ * Returns `0` for the focused cell and `-1` otherwise, for roving tabindex.
169
+ */
170
+ getTabIndex: () => number;
171
+ }
172
+ interface Table_CellSelection<in out TFeatures extends TableFeatures, in out TData extends RowData> {
173
+ /**
174
+ * Whether a drag selection is currently open.
175
+ *
176
+ * Non-reactive instance data rather than state: only the mouse handlers read
177
+ * it, nothing renders from it, and keeping it out of the slice means a
178
+ * selection persisted mid-drag cannot rehydrate into a stuck drag.
179
+ *
180
+ * @internal
181
+ */
182
+ _isSelectingCells: boolean;
183
+ /**
184
+ * Schedules a cell selection reset after `data` changes.
185
+ *
186
+ * Honors `autoResetAll` and `autoResetCellSelection`. Called by the core row
187
+ * model; you rarely need to invoke it yourself.
188
+ */
189
+ autoResetCellSelection: () => void;
190
+ /**
191
+ * Extends the active range one step in a direction, keeping its anchor fixed.
192
+ */
193
+ extendCellSelection: (direction: CellSelectionDirection) => void;
194
+ /**
195
+ * Returns the selected ranges resolved into inclusive display-order indexes.
196
+ *
197
+ * This is the memoized cache every per-cell read goes through. Ranges whose
198
+ * corners no longer resolve are omitted.
199
+ */
200
+ getCellSelectionBounds: () => Array<CellSelectionBounds>;
201
+ /**
202
+ * Returns the ids of all columns intersected by the selection.
203
+ */
204
+ getCellSelectionColumnIds: () => Array<string>;
205
+ /**
206
+ * Returns a column id to display-index map for the current column order.
207
+ *
208
+ * Registered so the lookup stays memoized even when `columnOrderingFeature`
209
+ * is absent, since its `getColumnIndexes` static rebuilds on every call.
210
+ *
211
+ * @internal
212
+ */
213
+ getCellSelectionColumnIndexes: () => Record<string, number>;
214
+ /**
215
+ * Returns the ids of all rows intersected by the selection.
216
+ */
217
+ getCellSelectionRowIds: () => Array<string>;
218
+ /**
219
+ * Returns the active cell, i.e. the anchor of the most recent range.
220
+ */
221
+ getFocusedCell: () => Cell<TFeatures, TData, any> | undefined;
222
+ /**
223
+ * Returns the number of selected cells.
224
+ *
225
+ * Computed as rectangle arithmetic for one range. Falls back to enumerating
226
+ * cells for overlapping ranges or a per-cell `enableCellSelection` predicate.
227
+ */
228
+ getSelectedCellCount: () => number;
229
+ /**
230
+ * Returns the unique ids of all selected cells, in row-major order.
231
+ *
232
+ * This expands the selection, so it costs one pass over the selected area.
233
+ * It is memoized and never runs unless called.
234
+ */
235
+ getSelectedCellIds: () => Array<string>;
236
+ /**
237
+ * Returns each selected range's values as a row-major grid.
238
+ *
239
+ * Indexed as `[rangeIndex][rowIndex][columnIndex]`. Serializing this to
240
+ * clipboard text is left to userland, since the delimiter, the null
241
+ * representation, and any quoting rules are application decisions.
242
+ */
243
+ getSelectedCellRangesData: () => Array<Array<Array<unknown>>>;
244
+ /**
245
+ * Moves the selection one step in a direction, collapsing it to a single
246
+ * cell. Columns that cannot be selected are skipped over.
247
+ */
248
+ moveCellSelection: (direction: CellSelectionDirection) => void;
249
+ /**
250
+ * Resets `cellSelection` to `initialState.cellSelection`.
251
+ *
252
+ * Pass `true` to ignore initial state and reset to an empty selection.
253
+ */
254
+ resetCellSelection: (defaultState?: boolean) => void;
255
+ /**
256
+ * Selects every selectable cell in the table as one range.
257
+ */
258
+ selectAllCells: () => void;
259
+ /**
260
+ * Selects a rectangle, replacing the current selection unless `additive`.
261
+ */
262
+ selectCellRange: (range: CellSelectionRange, opts?: SelectCellRangeOptions) => void;
263
+ /**
264
+ * Updates cell selection state with a next value or updater function.
265
+ */
266
+ setCellSelection: (updater: Updater<CellSelectionState>) => void;
267
+ /**
268
+ * Collapses the selection to a single cell at the given coordinates.
269
+ */
270
+ setFocusedCell: (rowId: string, columnId: string) => void;
271
+ }
272
+ //#endregion
273
+ export { CellSelectionBounds, CellSelectionDirection, CellSelectionEdges, CellSelectionRange, CellSelectionState, Cell_CellSelection, ColumnDef_CellSelection, SelectCellRangeOptions, TableOptions_CellSelection, TableState_CellSelection, Table_CellSelection };
@@ -0,0 +1,288 @@
1
+ import { CellData, RowData, Updater } from "../../types/type-utils.js";
2
+ import { CellSelectionBounds, CellSelectionDirection, CellSelectionEdges, CellSelectionRange, CellSelectionState, SelectCellRangeOptions } from "./cellSelectionFeature.types.js";
3
+ import { Table } from "../../types/Table.js";
4
+ import { Cell } from "../../types/Cell.js";
5
+ import { TableFeatures } from "../../types/TableFeatures.js";
6
+
7
+ //#region src/features/cell-selection/cellSelectionFeature.utils.d.ts
8
+ /**
9
+ * Creates the default cell selection state.
10
+ *
11
+ * The feature default is an empty selection. Reset APIs use this value when
12
+ * `defaultState` is `true`.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const selection = getDefaultCellSelectionState()
17
+ * ```
18
+ */
19
+ declare function getDefaultCellSelectionState(): CellSelectionState;
20
+ /**
21
+ * Routes a cell selection updater through the table's selection change handler.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * table_setCellSelection(table, (old) => old.slice(0, -1))
26
+ * ```
27
+ */
28
+ declare function table_setCellSelection<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, updater: Updater<CellSelectionState>): void;
29
+ /**
30
+ * Resets `cellSelection` to the configured initial state or feature default.
31
+ *
32
+ * With no argument, the reset clones `table.initialState.cellSelection` when it
33
+ * exists. Passing `true` ignores initial state and resets to an empty selection.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * table_resetCellSelection(table, true)
38
+ * ```
39
+ */
40
+ declare function table_resetCellSelection<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, defaultState?: boolean): void;
41
+ /**
42
+ * Schedules a cell selection reset after `data` changes.
43
+ *
44
+ * Ranges are stored as row and column ids, so without this a data swap would
45
+ * leave a selection pointing at rows that no longer exist, or silently
46
+ * re-select cells whenever new data reuses ids. The reset runs when
47
+ * `autoResetAll` or `autoResetCellSelection` allows it, defaulting to on.
48
+ *
49
+ * Resetting to `initialState.cellSelection` rather than to empty means the
50
+ * first row-model computation is a no-op, matching `table_autoResetExpanded`.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * table_autoResetCellSelection(table)
55
+ * ```
56
+ */
57
+ declare function table_autoResetCellSelection<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): void;
58
+ /**
59
+ * Builds a column id to render-order index map.
60
+ *
61
+ * Registered by this feature so the lookup stays memoized even when
62
+ * `columnOrderingFeature` is absent, since that feature's `getColumnIndexes`
63
+ * static rebuilds all four maps on every call, which would make per-cell reads
64
+ * O(columns).
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * const index = table_getCellSelectionColumnIndexes(table)[columnId]
69
+ * ```
70
+ */
71
+ declare function table_getCellSelectionColumnIndexes<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Record<string, number>;
72
+ /**
73
+ * Resolves the selected ranges into inclusive display-order index rectangles.
74
+ *
75
+ * This is the single cache every per-cell read goes through, so index lookups
76
+ * happen once per invalidation rather than once per cell. A range whose corners
77
+ * no longer resolve, for example because its anchor row was filtered out, is
78
+ * omitted rather than clamped, so it contributes nothing while remaining in
79
+ * state and returns intact when the filter clears.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const bounds = table_getCellSelectionBounds(table)
84
+ * ```
85
+ */
86
+ declare function table_getCellSelectionBounds<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<CellSelectionBounds>;
87
+ /**
88
+ * Checks whether this cell can currently be selected.
89
+ *
90
+ * A column def opting out with `enableCellSelection: false` wins over the table
91
+ * option, matching how the other per-column enable flags resolve.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * const canSelect = cell_getCanSelect(cell)
96
+ * ```
97
+ */
98
+ declare function cell_getCanSelect<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): boolean;
99
+ /**
100
+ * Checks whether this cell falls inside any selected range.
101
+ *
102
+ * Deliberately not memoized. Registering this through `assignPrototypeAPIs`
103
+ * with `memoDeps` would allocate a memo closure and dependency array per cell,
104
+ * which costs more than the handful of integer comparisons it would save.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const isSelected = cell_getIsSelected(cell)
109
+ * ```
110
+ */
111
+ declare function cell_getIsSelected<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): boolean;
112
+ /**
113
+ * Checks whether this cell is the active cell.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * const isFocused = cell_getIsFocused(cell)
118
+ * ```
119
+ */
120
+ declare function cell_getIsFocused<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): boolean;
121
+ /**
122
+ * Returns `0` for the focused cell and `-1` otherwise, for roving tabindex.
123
+ *
124
+ * @example
125
+ * ```ts
126
+ * const tabIndex = cell_getTabIndex(cell)
127
+ * ```
128
+ */
129
+ declare function cell_getTabIndex<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): number;
130
+ /**
131
+ * Returns which sides of this cell sit on the outer boundary of the selection.
132
+ *
133
+ * A side is an edge when the neighbouring cell in that direction is not itself
134
+ * covered by a range, which is what lets a consumer draw a single outline
135
+ * around an arbitrary union of rectangles.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * const { top, right, bottom, left } = cell_getSelectionEdges(cell)
140
+ * ```
141
+ */
142
+ declare function cell_getSelectionEdges<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): CellSelectionEdges;
143
+ /**
144
+ * Returns the active cell, i.e. the anchor of the most recent range.
145
+ *
146
+ * Focus is derived rather than stored: in spreadsheet semantics, dragging from
147
+ * A1 to C5 leaves the active cell at A1, so the active range's anchor already
148
+ * is the active cell.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * const cell = table_getFocusedCell(table)
153
+ * ```
154
+ */
155
+ declare function table_getFocusedCell<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Cell<TFeatures, TData, any> | undefined;
156
+ /**
157
+ * Collapses the selection to a single cell at the given coordinates.
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * table_setFocusedCell(table, '3', 'firstName')
162
+ * ```
163
+ */
164
+ declare function table_setFocusedCell<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, rowId: string, columnId: string): void;
165
+ /**
166
+ * Selects a rectangle, replacing the current selection unless `additive`.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * table_selectCellRange(table, range, { additive: true })
171
+ * ```
172
+ */
173
+ declare function table_selectCellRange<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, range: CellSelectionRange, opts?: SelectCellRangeOptions): void;
174
+ /**
175
+ * Selects every selectable cell in the table as one range.
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * table_selectAllCells(table)
180
+ * ```
181
+ */
182
+ declare function table_selectAllCells<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): void;
183
+ /**
184
+ * Moves the selection one step in a direction, collapsing it to a single cell.
185
+ *
186
+ * With nothing selected, this selects the first selectable cell so keyboard
187
+ * navigation has somewhere to start.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * table_moveCellSelection(table, 'down')
192
+ * ```
193
+ */
194
+ declare function table_moveCellSelection<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, direction: CellSelectionDirection): void;
195
+ /**
196
+ * Extends the active range one step in a direction, keeping its anchor fixed.
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * table_extendCellSelection(table, 'right')
201
+ * ```
202
+ */
203
+ declare function table_extendCellSelection<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>, direction: CellSelectionDirection): void;
204
+ /**
205
+ * Returns the ids of all selected cells, in row-major order.
206
+ *
207
+ * Cells covered by overlapping ranges are returned once, at their first
208
+ * occurrence.
209
+ *
210
+ * @example
211
+ * ```ts
212
+ * const ids = table_getSelectedCellIds(table)
213
+ * ```
214
+ */
215
+ declare function table_getSelectedCellIds<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<string>;
216
+ /**
217
+ * Returns each selected range's values as a row-major grid.
218
+ *
219
+ * This is the raw material for clipboard export. Serializing it to text is left
220
+ * to userland, since the delimiter, the null representation, and whether values
221
+ * containing delimiters get quoted are all application decisions.
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * const [firstRange] = table_getSelectedCellRangesData(table)
226
+ * ```
227
+ */
228
+ declare function table_getSelectedCellRangesData<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<Array<Array<unknown>>>;
229
+ /**
230
+ * Returns the number of selected cells.
231
+ *
232
+ * Uses rectangle arithmetic for a single range, which needs no expansion.
233
+ * Multiple ranges are enumerated so overlapping cells are counted once. A
234
+ * per-cell `enableCellSelection` predicate also requires enumeration.
235
+ *
236
+ * @example
237
+ * ```ts
238
+ * const count = table_getSelectedCellCount(table)
239
+ * ```
240
+ */
241
+ declare function table_getSelectedCellCount<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): number;
242
+ /**
243
+ * Returns the ids of all rows intersected by the selection.
244
+ *
245
+ * @example
246
+ * ```ts
247
+ * const rowIds = table_getCellSelectionRowIds(table)
248
+ * ```
249
+ */
250
+ declare function table_getCellSelectionRowIds<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<string>;
251
+ /**
252
+ * Returns the ids of all columns intersected by the selection.
253
+ *
254
+ * @example
255
+ * ```ts
256
+ * const columnIds = table_getCellSelectionColumnIds(table)
257
+ * ```
258
+ */
259
+ declare function table_getCellSelectionColumnIds<TFeatures extends TableFeatures, TData extends RowData>(table: Table<TFeatures, TData>): Array<string>;
260
+ /**
261
+ * Creates a handler that begins a selection at this cell.
262
+ *
263
+ * Follows `header_getResizeHandler`: the enable check is resolved once outside
264
+ * the returned closure and guarded again inside it, the document is injectable
265
+ * for SSR and cross-document rendering, and the document-level `mouseup`
266
+ * listener is attached here so a drag released outside the table still ends.
267
+ *
268
+ * @example
269
+ * ```tsx
270
+ * <td onMouseDown={cell.getSelectionStartHandler()} />
271
+ * ```
272
+ */
273
+ declare function cell_getSelectionStartHandler<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>, _contextDocument?: Document): (e: unknown) => void;
274
+ /**
275
+ * Creates a handler that extends the active range to this cell during a drag.
276
+ *
277
+ * No rAF coalescing is needed here, unlike the resize handler: `mouseenter`
278
+ * fires once per cell boundary crossed rather than continuously, and deferring
279
+ * it by a frame would only delay the highlight.
280
+ *
281
+ * @example
282
+ * ```tsx
283
+ * <td onMouseEnter={cell.getSelectionExtendHandler()} />
284
+ * ```
285
+ */
286
+ declare function cell_getSelectionExtendHandler<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData = CellData>(cell: Cell<TFeatures, TData, TValue>): (_e: unknown) => void;
287
+ //#endregion
288
+ export { cell_getCanSelect, cell_getIsFocused, cell_getIsSelected, cell_getSelectionEdges, cell_getSelectionExtendHandler, cell_getSelectionStartHandler, cell_getTabIndex, getDefaultCellSelectionState, table_autoResetCellSelection, table_extendCellSelection, table_getCellSelectionBounds, table_getCellSelectionColumnIds, table_getCellSelectionColumnIndexes, table_getCellSelectionRowIds, table_getFocusedCell, table_getSelectedCellCount, table_getSelectedCellIds, table_getSelectedCellRangesData, table_moveCellSelection, table_resetCellSelection, table_selectAllCells, table_selectCellRange, table_setCellSelection, table_setFocusedCell };