react-glide-table 1.1.0 → 1.1.2
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 +75 -15
- package/dist/compound.cjs +2085 -0
- package/dist/compound.d.cts +63 -0
- package/dist/compound.d.ts +63 -0
- package/dist/compound.js +2067 -0
- package/dist/core.cjs +1198 -0
- package/dist/core.d.cts +255 -0
- package/dist/core.d.ts +255 -0
- package/dist/core.js +1154 -0
- package/dist/index.cjs +948 -3
- package/dist/index.d.cts +5 -414
- package/dist/index.d.ts +5 -414
- package/dist/index.js +942 -0
- package/dist/types-ByOoRY8x.d.cts +177 -0
- package/dist/types-ByOoRY8x.d.ts +177 -0
- package/package.json +12 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,415 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { D as DEFAULT_DATA_TABLE_LABELS, a as DataTableLabels, b as DataTableProps, c as DataTableSlots, R as RowSelectionMode, T as TableColumnProps, d as TableProps, r as resolveDataTableLabels } from './types-ByOoRY8x.cjs';
|
|
2
|
+
export { CELL_SELECTION_EDGES_CLASS, CellSelectionBounds, ColumnRowSpanMap, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DragState, EditingCell, RowSpanInfo, TreeRow, UseConvertTreeDataParams, UseGlideTableOptions, UseGlideTableResult, applyCellEdit, applyFillData, applySelectionUpdater, buildColumnRowSpanMap, canExpandRow, collectFillChanges, collectRowSpanColumns, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, parseCellEditValue, resolveRowSelection, resolveRowSpanAt, toggleExpandedRowId, useCellEdit, useCellSelection, useConvertTreeData, useGlideTable } from './core.cjs';
|
|
3
|
+
export { DataTable, Table, TableCompoundComponent, createTable } from './compound.cjs';
|
|
4
4
|
export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
type DataTableLabels = {
|
|
8
|
-
empty: string;
|
|
9
|
-
loading: string;
|
|
10
|
-
selection: (selectedCount: number) => ReactNode;
|
|
11
|
-
expandRow: string;
|
|
12
|
-
collapseRow: string;
|
|
13
|
-
};
|
|
14
|
-
/** Default copy. Override via the `labels` option. */
|
|
15
|
-
declare const DEFAULT_DATA_TABLE_LABELS: DataTableLabels;
|
|
16
|
-
declare function resolveDataTableLabels(partial?: Partial<DataTableLabels>): DataTableLabels;
|
|
17
|
-
|
|
18
|
-
/** Neutral default field names for tree conversion */
|
|
19
|
-
declare const DEFAULT_TREE_ID_FIELD = "id";
|
|
20
|
-
declare const DEFAULT_TREE_PARENT_ID_FIELD = "parentId";
|
|
21
|
-
declare const DEFAULT_TREE_CHILDREN_FIELD = "children";
|
|
22
|
-
declare const DEFAULT_TREE_QTY_FIELD = "qty";
|
|
23
|
-
|
|
24
|
-
type RowSelectionMode = "none" | "single" | "multi";
|
|
25
|
-
type CellEditType = "text" | "number";
|
|
26
|
-
|
|
27
|
-
declare module "@tanstack/react-table" {
|
|
28
|
-
interface ColumnMeta<TData, TValue> {
|
|
29
|
-
/** Whether this column participates in vertical row spanning */
|
|
30
|
-
rowSpan?: boolean;
|
|
31
|
-
/** Merge key field. Falls back to the column id when omitted */
|
|
32
|
-
rowSpanKey?: string;
|
|
33
|
-
align?: "left" | "center" | "right";
|
|
34
|
-
className?: string;
|
|
35
|
-
headerClassName?: string;
|
|
36
|
-
/** When true, double-click starts inline editing */
|
|
37
|
-
editable?: boolean;
|
|
38
|
-
/** Inline editor input type. Defaults to text */
|
|
39
|
-
editType?: CellEditType;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
type DataTableProps<T extends Record<string, unknown>> = {
|
|
43
|
-
data: T[];
|
|
44
|
-
columns: ColumnDef<T, unknown>[];
|
|
45
|
-
rowSelectionMode?: RowSelectionMode;
|
|
46
|
-
rowSelection?: RowSelectionState;
|
|
47
|
-
onRowSelectionChange?: (updater: Updater<RowSelectionState>) => void;
|
|
48
|
-
/** Total row count before filtering */
|
|
49
|
-
totalCount?: number;
|
|
50
|
-
/** Visible row count after filtering */
|
|
51
|
-
filteredCount?: number;
|
|
52
|
-
/** Left-side summary slot */
|
|
53
|
-
summary?: ReactNode;
|
|
54
|
-
/** Right-side action slot */
|
|
55
|
-
toolbar?: ReactNode;
|
|
56
|
-
/**
|
|
57
|
-
* UI copy overrides.
|
|
58
|
-
* Takes precedence over `emptyText` / `selectionLabel`.
|
|
59
|
-
*/
|
|
60
|
-
labels?: Partial<DataTableLabels>;
|
|
61
|
-
/** @deprecated Prefer `labels.selection` */
|
|
62
|
-
selectionLabel?: (selectedCount: number) => ReactNode;
|
|
63
|
-
isPending?: boolean;
|
|
64
|
-
/** @deprecated Prefer `labels.empty` */
|
|
65
|
-
emptyText?: string;
|
|
66
|
-
/** @deprecated Prefer `labels.loading` */
|
|
67
|
-
loadingText?: string;
|
|
68
|
-
enableRowSpan?: boolean;
|
|
69
|
-
getRowId?: (row: T, index: number) => string;
|
|
70
|
-
onRowClick?: (row: T, index: number) => void;
|
|
71
|
-
preserveRowSelection?: boolean;
|
|
72
|
-
getRowClassName?: (row: T, index: number) => string | undefined;
|
|
73
|
-
/** Return false to make the row unselectable (row click and checkbox) */
|
|
74
|
-
getRowCanSelect?: (row: T, index: number) => boolean;
|
|
75
|
-
/** When false, row click does not toggle selection (checkbox-only) */
|
|
76
|
-
selectOnRowClick?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Enable cell drag selection and fill handle. Defaults to true.
|
|
79
|
-
* When false, browser text selection is allowed and cell selection UI is off.
|
|
80
|
-
*/
|
|
81
|
-
enableCellSelection?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated Combining with paged/tree-transformed data can corrupt the source.
|
|
84
|
-
* Prefer onCellChange / onBatchChange.
|
|
85
|
-
*/
|
|
86
|
-
onDataChange?: (data: T[]) => void;
|
|
87
|
-
/** Single-cell change (edit commit). Takes precedence over onDataChange */
|
|
88
|
-
onCellChange?: (rowId: string, columnId: string, value: unknown) => void;
|
|
89
|
-
/** Multi-cell change (fill handle, etc.). Takes precedence over onDataChange */
|
|
90
|
-
onBatchChange?: (changes: Array<{
|
|
91
|
-
rowId: string;
|
|
92
|
-
columnId: string;
|
|
93
|
-
value: unknown;
|
|
94
|
-
}>) => void;
|
|
95
|
-
className?: string;
|
|
96
|
-
/** Expand key field. Enables tree conversion / expand UI when set. Default `id` */
|
|
97
|
-
toggleField?: string;
|
|
98
|
-
/** Child → parent reference field. Default `parentId` */
|
|
99
|
-
childField?: string;
|
|
100
|
-
/** Nested children array field. Default `children` */
|
|
101
|
-
flattenField?: string;
|
|
102
|
-
/** Parent quantity field used for parentCount. Default `qty` */
|
|
103
|
-
qtyField?: string;
|
|
104
|
-
/** Expanded row key set (controlled) */
|
|
105
|
-
expandedRows?: Set<string>;
|
|
106
|
-
onExpandedRowsChange?: (next: Set<string>) => void;
|
|
107
|
-
/** When true, expand is disabled (children always visible) */
|
|
108
|
-
preventExpand?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* Enable row virtualization. Defaults to true.
|
|
111
|
-
* Forced off when enableRowSpan is true to preserve merges
|
|
112
|
-
* (HTML table + spacer rows; no absolute/translateY positioning).
|
|
113
|
-
*/
|
|
114
|
-
enableVirtualization?: boolean;
|
|
115
|
-
/** Estimated virtual row height in px. Default 44; refined via measureElement */
|
|
116
|
-
estimateRowHeight?: number;
|
|
117
|
-
/** Virtualization overscan row count. Default 8 */
|
|
118
|
-
virtualOverscan?: number;
|
|
119
|
-
/**
|
|
120
|
-
* Optional UI part replacements for the reference DataTable renderer.
|
|
121
|
-
* Works with the playground `createTable` / `Table.Column` API.
|
|
122
|
-
*/
|
|
123
|
-
slots?: DataTableSlots<T>;
|
|
124
|
-
};
|
|
125
|
-
type DataTableToolbarSlotProps = {
|
|
126
|
-
filteredCount?: number;
|
|
127
|
-
totalCount?: number;
|
|
128
|
-
summary?: ReactNode;
|
|
129
|
-
selectedCount: number;
|
|
130
|
-
selectionLabel?: (selectedCount: number) => ReactNode;
|
|
131
|
-
toolbar?: ReactNode;
|
|
132
|
-
className?: string;
|
|
133
|
-
};
|
|
134
|
-
type DataTableRowSlotProps<T extends Record<string, unknown>> = {
|
|
135
|
-
row: Row<T>;
|
|
136
|
-
onToggleSelect: () => void;
|
|
137
|
-
virtualIndex?: number;
|
|
138
|
-
measureElement?: (node: Element | null) => void;
|
|
139
|
-
};
|
|
140
|
-
type DataTableSlots<T extends Record<string, unknown>> = {
|
|
141
|
-
Toolbar?: ComponentType<DataTableToolbarSlotProps>;
|
|
142
|
-
Row?: ComponentType<DataTableRowSlotProps<T>>;
|
|
143
|
-
/** Replace the pending state view */
|
|
144
|
-
Pending?: ComponentType<{
|
|
145
|
-
loadingText: string;
|
|
146
|
-
className?: string;
|
|
147
|
-
}>;
|
|
148
|
-
/** Replace the empty-state cell content */
|
|
149
|
-
Empty?: ComponentType<{
|
|
150
|
-
emptyText: string;
|
|
151
|
-
columnCount: number;
|
|
152
|
-
}>;
|
|
153
|
-
};
|
|
154
|
-
type TableColumnProps<T extends Record<string, unknown>, K extends string = keyof T & string> = {
|
|
155
|
-
/** Column id: data field name, or an arbitrary id for virtual columns */
|
|
156
|
-
field: K;
|
|
157
|
-
/** When true, uses id only (no accessorKey) — e.g. checkbox / No. columns */
|
|
158
|
-
virtual?: boolean;
|
|
159
|
-
children?: ReactNode;
|
|
160
|
-
sortable?: boolean;
|
|
161
|
-
width?: number;
|
|
162
|
-
align?: "left" | "center" | "right";
|
|
163
|
-
rowSpan?: boolean;
|
|
164
|
-
rowSpanKey?: string;
|
|
165
|
-
editable?: boolean;
|
|
166
|
-
editType?: CellEditType;
|
|
167
|
-
className?: string;
|
|
168
|
-
headerClassName?: string;
|
|
169
|
-
render?: (value: K extends keyof T ? T[K] : unknown, row: Row<T>, index: number) => ReactNode;
|
|
170
|
-
};
|
|
171
|
-
type TableProps<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "columns"> & {
|
|
172
|
-
children: ReactNode;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
type EditingCell = {
|
|
176
|
-
rowIndex: number;
|
|
177
|
-
colIndex: number;
|
|
178
|
-
};
|
|
179
|
-
type ColumnDefLike = {
|
|
180
|
-
id?: string;
|
|
181
|
-
accessorKey?: unknown;
|
|
182
|
-
meta?: {
|
|
183
|
-
editable?: boolean;
|
|
184
|
-
editType?: CellEditType;
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
declare function isColumnEditable(columnDef: ColumnDefLike): boolean;
|
|
188
|
-
declare function getColumnEditType(columnDef: ColumnDefLike): CellEditType;
|
|
189
|
-
declare function parseCellEditValue(raw: string, editType: CellEditType): {
|
|
190
|
-
ok: true;
|
|
191
|
-
value: string | number | null;
|
|
192
|
-
} | {
|
|
193
|
-
ok: false;
|
|
194
|
-
};
|
|
195
|
-
declare function getCellEditDraftValue(value: unknown): string;
|
|
196
|
-
/** Returns updated data on success; null if parsing fails or the cell is not editable */
|
|
197
|
-
declare function applyCellEdit<T extends Record<string, unknown>>(data: T[], rows: Row<T>[], rowIndex: number, colIndex: number, raw: string): T[] | null;
|
|
198
|
-
|
|
199
|
-
type CellPosition = {
|
|
200
|
-
row: number;
|
|
201
|
-
col: number;
|
|
202
|
-
};
|
|
203
|
-
type CellSelectionBounds = {
|
|
204
|
-
startRow: number;
|
|
205
|
-
endRow: number;
|
|
206
|
-
startCol: number;
|
|
207
|
-
endCol: number;
|
|
208
|
-
};
|
|
209
|
-
type DragState = {
|
|
210
|
-
isSelecting: boolean;
|
|
211
|
-
isFillDragging: boolean;
|
|
212
|
-
start: CellPosition | null;
|
|
213
|
-
end: CellPosition | null;
|
|
214
|
-
/** Fixed anchor opposite the fill handle (top-left) */
|
|
215
|
-
fillAnchor: CellPosition | null;
|
|
216
|
-
fillEnd: CellPosition | null;
|
|
217
|
-
};
|
|
218
|
-
declare function getRowIndexInMergedCell(clientY: number, cellElement: HTMLElement, rowIndex: number, rowSpan: number): number;
|
|
219
|
-
declare function isCellInSelection(rowIndex: number, colIndex: number, bounds: CellSelectionBounds | null, rowSpan?: number): boolean;
|
|
220
|
-
declare const CELL_SELECTION_EDGES_CLASS = "cell-selection-edges";
|
|
221
|
-
type CellSelectionEdgeStyle = {
|
|
222
|
-
/** Full-side inset border applied via ::after */
|
|
223
|
-
["--selection-edge-shadows"]?: string;
|
|
224
|
-
/** Partial vertical border for merged-cell step (stair) segments */
|
|
225
|
-
["--selection-edge-gradients"]?: string;
|
|
226
|
-
["--selection-edge-sizes"]?: string;
|
|
227
|
-
["--selection-edge-positions"]?: string;
|
|
228
|
-
/** Hide internal horizontal grid lines inside the selection with background color */
|
|
229
|
-
borderBottomColor?: string;
|
|
230
|
-
};
|
|
231
|
-
/**
|
|
232
|
-
* Draws the selection border with ::after (extended -1px at the bottom) plus
|
|
233
|
-
* inset box-shadow / partial gradients so it does not break on the cell's
|
|
234
|
-
* border-bottom.
|
|
235
|
-
*
|
|
236
|
-
* @param isVisuallySelectedAt Whether a logical cell is visually selected
|
|
237
|
-
* (including adjacent merged cells). Used to suppress internal step borders
|
|
238
|
-
* when multiple columns have rowSpan.
|
|
239
|
-
*/
|
|
240
|
-
declare function getCellSelectionEdgeStyle(rowIndex: number, colIndex: number, bounds: CellSelectionBounds | null, rowSpan?: number, isVisuallySelectedAt?: (row: number, col: number) => boolean): CellSelectionEdgeStyle | undefined;
|
|
241
|
-
declare function hasCellSelectionEdges(style: CellSelectionEdgeStyle | undefined): boolean;
|
|
242
|
-
|
|
243
|
-
type RowSpanInfo = {
|
|
244
|
-
/** 0 means skip render (merged into a parent row) */
|
|
245
|
-
rowSpan: number;
|
|
246
|
-
isFirstInGroup: boolean;
|
|
247
|
-
};
|
|
248
|
-
type ColumnRowSpanMap = Map<string, RowSpanInfo[]>;
|
|
249
|
-
/**
|
|
250
|
-
* Returns the start row and rowSpan of the merged cell covering a given row.
|
|
251
|
-
* Rows with rowSpan === 0 walk up to the merge origin.
|
|
252
|
-
*/
|
|
253
|
-
declare function resolveRowSpanAt(rowSpans: RowSpanInfo[] | undefined, rowIndex: number): {
|
|
254
|
-
startRow: number;
|
|
255
|
-
rowSpan: number;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Computes merge info for every column that has rowSpan meta.
|
|
259
|
-
*/
|
|
260
|
-
declare function buildColumnRowSpanMap<T extends Record<string, unknown>>(data: T[], columnKeys: Array<{
|
|
261
|
-
columnId: string;
|
|
262
|
-
rowSpanKey: string;
|
|
263
|
-
}>): ColumnRowSpanMap;
|
|
264
|
-
declare function collectRowSpanColumns<T extends Record<string, unknown>>(columns: ColumnDef<T, unknown>[]): Array<{
|
|
265
|
-
columnId: string;
|
|
266
|
-
rowSpanKey: string;
|
|
267
|
-
}>;
|
|
268
|
-
|
|
269
|
-
type RowData = Record<string, unknown>;
|
|
270
|
-
type DataTableRowContextValue = {
|
|
271
|
-
rowSpan: {
|
|
272
|
-
enableRowSpan: boolean;
|
|
273
|
-
primaryRowSpanKey?: string;
|
|
274
|
-
columnRowSpanMap: ColumnRowSpanMap;
|
|
275
|
-
hoveredRowIndex: number | null;
|
|
276
|
-
hoveredGroupKey: string | null;
|
|
277
|
-
selectedGroupKeys: Set<string>;
|
|
278
|
-
onRowHover: (rowIndex: number, rowData: RowData) => void;
|
|
279
|
-
};
|
|
280
|
-
selection: {
|
|
281
|
-
rowSelectionMode: RowSelectionMode;
|
|
282
|
-
selectOnRowClick: boolean;
|
|
283
|
-
onRowClick?: (row: RowData, index: number) => void;
|
|
284
|
-
getRowClassName?: (row: RowData, index: number) => string | undefined;
|
|
285
|
-
};
|
|
286
|
-
cellSelection: {
|
|
287
|
-
enableCellSelection: boolean;
|
|
288
|
-
activeSelectionBounds: CellSelectionBounds | null;
|
|
289
|
-
dragState: DragState;
|
|
290
|
-
onCellMouseDown: (rowIndex: number, colIndex: number) => void;
|
|
291
|
-
onCellMouseEnter: (rowIndex: number, colIndex: number) => void;
|
|
292
|
-
onFillHandleMouseDown: (rowIndex: number, colIndex: number) => void;
|
|
293
|
-
};
|
|
294
|
-
cellEdit: {
|
|
295
|
-
editingCell: EditingCell | null;
|
|
296
|
-
draftValue: string;
|
|
297
|
-
onDraftValueChange: (value: string) => void;
|
|
298
|
-
onStartEdit: (rowIndex: number, colIndex: number) => void;
|
|
299
|
-
onCommitEdit: (raw?: string) => boolean;
|
|
300
|
-
onCancelEdit: () => void;
|
|
301
|
-
};
|
|
302
|
-
expand: {
|
|
303
|
-
enableExpand: boolean;
|
|
304
|
-
toggleField?: string;
|
|
305
|
-
expandedRows?: Set<string>;
|
|
306
|
-
preventExpand: boolean;
|
|
307
|
-
onToggleExpand?: (rowKey: string) => void;
|
|
308
|
-
expandRowLabel: string;
|
|
309
|
-
collapseRowLabel: string;
|
|
310
|
-
};
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
type UseGlideTableOptions<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "className" | "slots" | "summary" | "toolbar" | "isPending" | "totalCount" | "filteredCount">;
|
|
314
|
-
type UseGlideTableResult<T extends Record<string, unknown>> = {
|
|
315
|
-
table: Table<T>;
|
|
316
|
-
tableData: T[];
|
|
317
|
-
rows: Row<T>[];
|
|
318
|
-
columnCount: number;
|
|
319
|
-
selectedCount: number;
|
|
320
|
-
labels: DataTableLabels;
|
|
321
|
-
emptyText: string;
|
|
322
|
-
loadingText: string;
|
|
323
|
-
selectionLabel: DataTableLabels["selection"];
|
|
324
|
-
enableCellSelection: boolean;
|
|
325
|
-
shouldVirtualize: boolean;
|
|
326
|
-
scrollRef: RefObject<HTMLDivElement | null>;
|
|
327
|
-
rowVirtualizer: Virtualizer<HTMLDivElement, Element>;
|
|
328
|
-
virtualRows: VirtualItem[];
|
|
329
|
-
paddingTop: number;
|
|
330
|
-
paddingBottom: number;
|
|
331
|
-
rowContextValue: DataTableRowContextValue;
|
|
332
|
-
handleToggleSelect: (row: Row<T>) => void;
|
|
333
|
-
clearHover: () => void;
|
|
334
|
-
};
|
|
335
|
-
declare function useGlideTable<T extends Record<string, unknown>>(options: UseGlideTableOptions<T>): UseGlideTableResult<T>;
|
|
336
|
-
|
|
337
|
-
type UseCellEditOptions<T extends Record<string, unknown>> = {
|
|
338
|
-
data: T[];
|
|
339
|
-
rows: Row<T>[];
|
|
340
|
-
onDataChange?: (data: T[]) => void;
|
|
341
|
-
onCellChange?: (rowId: string, columnId: string, value: unknown) => void;
|
|
342
|
-
};
|
|
343
|
-
declare function useCellEdit<T extends Record<string, unknown>>({ data, rows, onDataChange, onCellChange, }: UseCellEditOptions<T>): {
|
|
344
|
-
editingCell: EditingCell | null;
|
|
345
|
-
draftValue: string;
|
|
346
|
-
setDraftValue: react.Dispatch<react.SetStateAction<string>>;
|
|
347
|
-
startEdit: (rowIndex: number, colIndex: number) => void;
|
|
348
|
-
commitEdit: (raw?: string) => boolean;
|
|
349
|
-
cancelEdit: () => void;
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
type UseCellSelectionOptions<T extends Record<string, unknown>> = {
|
|
353
|
-
data: T[];
|
|
354
|
-
rows: Row<T>[];
|
|
355
|
-
enabled?: boolean;
|
|
356
|
-
onDataChange?: (data: T[]) => void;
|
|
357
|
-
onBatchChange?: (changes: Array<{
|
|
358
|
-
rowId: string;
|
|
359
|
-
columnId: string;
|
|
360
|
-
value: unknown;
|
|
361
|
-
}>) => void;
|
|
362
|
-
};
|
|
363
|
-
declare function useCellSelection<T extends Record<string, unknown>>({ data, rows, enabled, onDataChange, onBatchChange, }: UseCellSelectionOptions<T>): {
|
|
364
|
-
dragState: DragState;
|
|
365
|
-
activeSelectionBounds: CellSelectionBounds | null;
|
|
366
|
-
handleCellMouseDown: (rowIndex: number, colIndex: number) => void;
|
|
367
|
-
handleCellMouseEnter: (rowIndex: number, colIndex: number) => void;
|
|
368
|
-
handleFillHandleMouseDown: (rowIndex: number, colIndex: number) => void;
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
type CellChange = {
|
|
372
|
-
rowId: string;
|
|
373
|
-
columnId: string;
|
|
374
|
-
value: unknown;
|
|
375
|
-
};
|
|
376
|
-
declare function collectFillChanges<T extends Record<string, unknown>>(rows: Row<T>[], sourceBounds: CellSelectionBounds, fillBounds: CellSelectionBounds): CellChange[];
|
|
377
|
-
declare function applyFillData<T extends Record<string, unknown>>(data: T[], rows: Row<T>[], sourceBounds: CellSelectionBounds, fillBounds: CellSelectionBounds): T[];
|
|
378
|
-
|
|
379
|
-
type TreeRow<T extends Record<string, unknown> = Record<string, unknown>> = T & {
|
|
380
|
-
level: number;
|
|
381
|
-
children: TreeRow<T>[];
|
|
382
|
-
treeNo?: string;
|
|
383
|
-
uniqueId?: string;
|
|
384
|
-
parentCount?: number;
|
|
385
|
-
processed?: boolean;
|
|
386
|
-
};
|
|
387
|
-
type UseConvertTreeDataParams<T extends Record<string, unknown>> = {
|
|
388
|
-
data: T[] | null;
|
|
389
|
-
/** When false, returns data unchanged (plain DataTable) */
|
|
390
|
-
enabled?: boolean;
|
|
391
|
-
/** Row id / expand key field (idField). Defaults to `id` */
|
|
392
|
-
toggleField?: string;
|
|
393
|
-
/** Child → parent reference field (parentIdField). Defaults to `parentId` */
|
|
394
|
-
childField?: string;
|
|
395
|
-
/** Nested children array field (childrenField). Defaults to `children` */
|
|
396
|
-
flattenField?: string;
|
|
397
|
-
/** Parent quantity field (qtyField). Used for parentCount. Defaults to `qty` */
|
|
398
|
-
qtyField?: string;
|
|
399
|
-
preventExpand?: boolean;
|
|
400
|
-
startIndex?: number;
|
|
401
|
-
expandedRows?: Set<string>;
|
|
402
|
-
onExpandedRowsChange?: (next: Set<string>) => void;
|
|
403
|
-
};
|
|
404
|
-
declare function canExpandRow(row: Record<string, unknown>): boolean;
|
|
405
|
-
declare function toggleExpandedRowId(rowId: string, previous: Set<string>): Set<string>;
|
|
406
|
-
/**
|
|
407
|
-
* Builds a tree from flat/nested data, then returns only rows visible under expandedRows.
|
|
408
|
-
* When enabled=false, returns data as-is.
|
|
409
|
-
*/
|
|
410
|
-
declare const useConvertTreeData: <T extends Record<string, unknown>>({ data, enabled, toggleField, childField, flattenField, qtyField, preventExpand, startIndex, expandedRows, onExpandedRowsChange, }: UseConvertTreeDataParams<T>) => T[];
|
|
411
|
-
|
|
412
|
-
declare function resolveRowSelection(mode: RowSelectionMode, controlledSelection: RowSelectionState | undefined, internalSelection: RowSelectionState): RowSelectionState;
|
|
413
|
-
declare function applySelectionUpdater(mode: RowSelectionMode, updater: Updater<RowSelectionState>, previous: RowSelectionState): RowSelectionState;
|
|
414
|
-
|
|
415
|
-
export { CELL_SELECTION_EDGES_CLASS, type CellSelectionBounds, type ColumnRowSpanMap, DEFAULT_DATA_TABLE_LABELS, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, type DataTableLabels, type DataTableProps, type DataTableSlots, type DragState, type EditingCell, type RowSelectionMode, type RowSpanInfo, type TableColumnProps, type TableProps, type TreeRow, type UseConvertTreeDataParams, type UseGlideTableOptions, type UseGlideTableResult, applyCellEdit, applyFillData, applySelectionUpdater, buildColumnRowSpanMap, canExpandRow, collectFillChanges, collectRowSpanColumns, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, parseCellEditValue, resolveDataTableLabels, resolveRowSelection, resolveRowSpanAt, toggleExpandedRowId, useCellEdit, useCellSelection, useConvertTreeData, useGlideTable };
|
|
5
|
+
import 'react';
|
|
6
|
+
import '@tanstack/react-virtual';
|