react-glide-table 2.2.0 → 2.3.0
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 +58 -37
- package/dist/compound.cjs +589 -145
- package/dist/compound.d.cts +2 -2
- package/dist/compound.d.ts +2 -2
- package/dist/compound.js +493 -49
- package/dist/core.cjs +509 -141
- package/dist/core.d.cts +54 -10
- package/dist/core.d.ts +54 -10
- package/dist/core.js +396 -29
- package/dist/index.cjs +618 -172
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +494 -49
- package/dist/{types-Iot4g4sq.d.cts → types-DdeVn-9s.d.cts} +33 -2
- package/dist/{types-Iot4g4sq.d.ts → types-DdeVn-9s.d.ts} +33 -2
- package/package.json +1 -1
package/dist/core.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-
|
|
2
|
-
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-
|
|
1
|
+
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-DdeVn-9s.cjs';
|
|
2
|
+
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-DdeVn-9s.cjs';
|
|
3
3
|
import { Row, ColumnDef, CellContext, Table, Cell, ColumnOrderState, Updater, RowSelectionState } from '@tanstack/react-table';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
|
5
5
|
import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
|
|
@@ -190,6 +190,8 @@ type DataTableRowContextValue = {
|
|
|
190
190
|
};
|
|
191
191
|
columnResize: {
|
|
192
192
|
enableColumnResize: boolean;
|
|
193
|
+
/** Resolved pixel widths for fixed / min-max columns (not resize mode). */
|
|
194
|
+
layoutWidths?: Map<string, number>;
|
|
193
195
|
};
|
|
194
196
|
columnFreeze: {
|
|
195
197
|
enableColumnFreeze: boolean;
|
|
@@ -340,11 +342,39 @@ declare function ResolvedTableCell<T extends Record<string, unknown>>({ info, }:
|
|
|
340
342
|
info: CellContext<T, unknown>;
|
|
341
343
|
}): react.ReactNode;
|
|
342
344
|
|
|
343
|
-
|
|
344
|
-
declare function getColumnSizeStyle(size: number, options?: {
|
|
345
|
+
type ColumnSizeStyleOptions = {
|
|
345
346
|
force?: boolean;
|
|
346
347
|
lockMax?: boolean;
|
|
347
|
-
|
|
348
|
+
/** CSS min-width for the cell. Ignored when `lockMax` is on. */
|
|
349
|
+
minWidth?: number;
|
|
350
|
+
/** CSS max-width for the cell. Ignored when `lockMax` is on. */
|
|
351
|
+
maxWidth?: number;
|
|
352
|
+
/**
|
|
353
|
+
* Layout-resolved width from `resolveColumnLayoutWidths`.
|
|
354
|
+
* When set (and not resize-locked), applied as the cell `width`.
|
|
355
|
+
*/
|
|
356
|
+
layoutWidth?: number;
|
|
357
|
+
};
|
|
358
|
+
type ColumnLayoutInput = {
|
|
359
|
+
id: string;
|
|
360
|
+
/** Present when `Column.width` was set. */
|
|
361
|
+
width?: number;
|
|
362
|
+
minWidth?: number;
|
|
363
|
+
maxWidth?: number;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Resolve pixel widths for fixed and bounded columns.
|
|
367
|
+
*
|
|
368
|
+
* - Explicit `width` columns keep that size (clamped by min/max when set).
|
|
369
|
+
* - Columns with only min/max resolve inside that range, preferring `maxWidth`
|
|
370
|
+
* so content can stay on one line when space allows.
|
|
371
|
+
* - Unconstrained columns (no `width`, no min/max) are omitted so they absorb
|
|
372
|
+
* leftover space after bounded columns take their preferred size.
|
|
373
|
+
* - When space is tight, bounded columns shrink toward `minWidth` first.
|
|
374
|
+
*/
|
|
375
|
+
declare function resolveColumnLayoutWidths(containerWidth: number, columns: ColumnLayoutInput[]): Map<string, number>;
|
|
376
|
+
/** Width styles for header/body cells when column sizing is active. */
|
|
377
|
+
declare function getColumnSizeStyle(size: number, options?: ColumnSizeStyleOptions): CSSProperties | undefined;
|
|
348
378
|
|
|
349
379
|
type ColumnDropEdge = "before" | "after";
|
|
350
380
|
declare function collectLeafColumnIds<T>(columns: readonly ColumnDef<T, unknown>[]): string[];
|
|
@@ -422,8 +452,12 @@ type UseCellSelectionOptions<T extends Record<string, unknown>> = {
|
|
|
422
452
|
onRowsPaste?: (payload: RowsPastePayload) => void;
|
|
423
453
|
/** Called after keyboard navigation moves the active (end) cell. */
|
|
424
454
|
onCellNavigate?: (position: CellPosition) => void;
|
|
455
|
+
/** Resolves `meta.kind` renderers so copied text matches the visible cell. */
|
|
456
|
+
cellRendererRegistry?: CellRendererRegistry;
|
|
457
|
+
/** Scopes copy's DOM image-url lookup to this table when several are mounted at once. */
|
|
458
|
+
rootRef?: RefObject<HTMLElement | null>;
|
|
425
459
|
};
|
|
426
|
-
declare function useCellSelection<T extends Record<string, unknown>>({ data, rows, enabled, columnCount, enableSubtreeCopy, enableInsertPaste, onDataChange, onBatchChange, onRowsPaste, onCellNavigate, }: UseCellSelectionOptions<T>): {
|
|
460
|
+
declare function useCellSelection<T extends Record<string, unknown>>({ data, rows, enabled, columnCount, enableSubtreeCopy, enableInsertPaste, onDataChange, onBatchChange, onRowsPaste, onCellNavigate, cellRendererRegistry, rootRef, }: UseCellSelectionOptions<T>): {
|
|
427
461
|
dragState: DragState;
|
|
428
462
|
activeSelectionBounds: CellSelectionBounds | null;
|
|
429
463
|
handleCellMouseDown: (rowIndex: number, colIndex: number, options?: CellMouseDownOptions) => void;
|
|
@@ -438,6 +472,16 @@ type CopyRowEntry<T extends Record<string, unknown>> = {
|
|
|
438
472
|
/** Tree depth relative to the table root (0 = top-level). */
|
|
439
473
|
depth: number;
|
|
440
474
|
};
|
|
475
|
+
/**
|
|
476
|
+
* `registry` resolves `meta.kind` renderers (built-ins like `protected`, plus
|
|
477
|
+
* custom `cellRenderers`) so copy text matches the visible cell instead of the
|
|
478
|
+
* raw value. `root` scopes the DOM image-url lookup to one table when several
|
|
479
|
+
* are mounted at once.
|
|
480
|
+
*/
|
|
481
|
+
type CopyRenderOptions = {
|
|
482
|
+
registry?: CellRendererRegistry;
|
|
483
|
+
root?: ParentNode | null;
|
|
484
|
+
};
|
|
441
485
|
/**
|
|
442
486
|
* Clipboard / Excel paste expects one plain string per cell.
|
|
443
487
|
* Avoids `String(object)` → `[object Object]` and joins arrays with `, `.
|
|
@@ -450,9 +494,9 @@ declare function flattenSubtreeRows<T extends Record<string, unknown>>(row: T):
|
|
|
450
494
|
*/
|
|
451
495
|
declare function collectCopyRowEntries<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): CopyRowEntry<T>[];
|
|
452
496
|
declare function collectCopyRows<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): T[];
|
|
453
|
-
declare function serializeCopyRowsToTSV<T extends Record<string, unknown>>(copyRows: T[], visibleRows: Row<T>[], bounds: CellSelectionBounds, depths?: number[]): string;
|
|
454
|
-
declare function serializeSelectionToTSV<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): string;
|
|
455
|
-
declare function writeSelectionToClipboard<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): Promise<boolean>;
|
|
497
|
+
declare function serializeCopyRowsToTSV<T extends Record<string, unknown>>(copyRows: T[], visibleRows: Row<T>[], bounds: CellSelectionBounds, depths?: number[], options?: CopyRenderOptions): string;
|
|
498
|
+
declare function serializeSelectionToTSV<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode, options?: CopyRenderOptions): string;
|
|
499
|
+
declare function writeSelectionToClipboard<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode, options?: CopyRenderOptions): Promise<boolean>;
|
|
456
500
|
|
|
457
501
|
type CellChange = {
|
|
458
502
|
rowId: string;
|
|
@@ -502,4 +546,4 @@ declare const useConvertTreeData: <T extends Record<string, unknown>>({ data, en
|
|
|
502
546
|
declare function resolveRowSelection(mode: RowSelectionMode, controlledSelection: RowSelectionState | undefined, internalSelection: RowSelectionState): RowSelectionState;
|
|
503
547
|
declare function applySelectionUpdater(mode: RowSelectionMode, updater: Updater<RowSelectionState>, previous: RowSelectionState): RowSelectionState;
|
|
504
548
|
|
|
505
|
-
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, type CellContextWithUpdate, CellKind, CellRenderContext, CellRenderer, type CellRendererRegistry, type CellSelectionBounds, type ColumnDropEdge, ColumnFreezeOffset, type ColumnRowSpanMap, type CopyRowEntry, type CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DataTableCopyActions, DataTableLabels, DataTableProps, type DragState, type EditingCell, PasteMode, ResolvedTableCell, RowSelectionMode, type RowSpanColumnSpec, type RowSpanInfo, RowsPastePayload, SearchResultItem, SearchStatus, type TreeRow, type UseConvertTreeDataParams, type UseGlideTableOptions, type UseGlideTableResult, type UseInlineSearchOptions, type UseInlineSearchResult, applyCellEdit, applyFillData, applyLeafColumnOrder, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectLeafColumnIds, collectRowSpanColumns, commitCellValue, createCellRendererRegistry, flattenSubtreeRows, formatCellValue, formatDefaultCellValue, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getColumnSizeStyle, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, moveColumnIds, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolveCellRenderer, resolveDropEdge, resolveLeafColumnOrder, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useColumnReorder, useConvertTreeData, useGlideTable, useInlineSearch, withCellUpdate, writeSelectionToClipboard };
|
|
549
|
+
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, type CellContextWithUpdate, CellKind, CellRenderContext, CellRenderer, type CellRendererRegistry, type CellSelectionBounds, type ColumnDropEdge, ColumnFreezeOffset, type ColumnLayoutInput, type ColumnRowSpanMap, type CopyRowEntry, type CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DataTableCopyActions, DataTableLabels, DataTableProps, type DragState, type EditingCell, PasteMode, ResolvedTableCell, RowSelectionMode, type RowSpanColumnSpec, type RowSpanInfo, RowsPastePayload, SearchResultItem, SearchStatus, type TreeRow, type UseConvertTreeDataParams, type UseGlideTableOptions, type UseGlideTableResult, type UseInlineSearchOptions, type UseInlineSearchResult, applyCellEdit, applyFillData, applyLeafColumnOrder, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectLeafColumnIds, collectRowSpanColumns, commitCellValue, createCellRendererRegistry, flattenSubtreeRows, formatCellValue, formatDefaultCellValue, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getColumnSizeStyle, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, moveColumnIds, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolveCellRenderer, resolveColumnLayoutWidths, resolveDropEdge, resolveLeafColumnOrder, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useColumnReorder, useConvertTreeData, useGlideTable, useInlineSearch, withCellUpdate, writeSelectionToClipboard };
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-
|
|
2
|
-
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-
|
|
1
|
+
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-DdeVn-9s.js';
|
|
2
|
+
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-DdeVn-9s.js';
|
|
3
3
|
import { Row, ColumnDef, CellContext, Table, Cell, ColumnOrderState, Updater, RowSelectionState } from '@tanstack/react-table';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
|
5
5
|
import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
|
|
@@ -190,6 +190,8 @@ type DataTableRowContextValue = {
|
|
|
190
190
|
};
|
|
191
191
|
columnResize: {
|
|
192
192
|
enableColumnResize: boolean;
|
|
193
|
+
/** Resolved pixel widths for fixed / min-max columns (not resize mode). */
|
|
194
|
+
layoutWidths?: Map<string, number>;
|
|
193
195
|
};
|
|
194
196
|
columnFreeze: {
|
|
195
197
|
enableColumnFreeze: boolean;
|
|
@@ -340,11 +342,39 @@ declare function ResolvedTableCell<T extends Record<string, unknown>>({ info, }:
|
|
|
340
342
|
info: CellContext<T, unknown>;
|
|
341
343
|
}): react.ReactNode;
|
|
342
344
|
|
|
343
|
-
|
|
344
|
-
declare function getColumnSizeStyle(size: number, options?: {
|
|
345
|
+
type ColumnSizeStyleOptions = {
|
|
345
346
|
force?: boolean;
|
|
346
347
|
lockMax?: boolean;
|
|
347
|
-
|
|
348
|
+
/** CSS min-width for the cell. Ignored when `lockMax` is on. */
|
|
349
|
+
minWidth?: number;
|
|
350
|
+
/** CSS max-width for the cell. Ignored when `lockMax` is on. */
|
|
351
|
+
maxWidth?: number;
|
|
352
|
+
/**
|
|
353
|
+
* Layout-resolved width from `resolveColumnLayoutWidths`.
|
|
354
|
+
* When set (and not resize-locked), applied as the cell `width`.
|
|
355
|
+
*/
|
|
356
|
+
layoutWidth?: number;
|
|
357
|
+
};
|
|
358
|
+
type ColumnLayoutInput = {
|
|
359
|
+
id: string;
|
|
360
|
+
/** Present when `Column.width` was set. */
|
|
361
|
+
width?: number;
|
|
362
|
+
minWidth?: number;
|
|
363
|
+
maxWidth?: number;
|
|
364
|
+
};
|
|
365
|
+
/**
|
|
366
|
+
* Resolve pixel widths for fixed and bounded columns.
|
|
367
|
+
*
|
|
368
|
+
* - Explicit `width` columns keep that size (clamped by min/max when set).
|
|
369
|
+
* - Columns with only min/max resolve inside that range, preferring `maxWidth`
|
|
370
|
+
* so content can stay on one line when space allows.
|
|
371
|
+
* - Unconstrained columns (no `width`, no min/max) are omitted so they absorb
|
|
372
|
+
* leftover space after bounded columns take their preferred size.
|
|
373
|
+
* - When space is tight, bounded columns shrink toward `minWidth` first.
|
|
374
|
+
*/
|
|
375
|
+
declare function resolveColumnLayoutWidths(containerWidth: number, columns: ColumnLayoutInput[]): Map<string, number>;
|
|
376
|
+
/** Width styles for header/body cells when column sizing is active. */
|
|
377
|
+
declare function getColumnSizeStyle(size: number, options?: ColumnSizeStyleOptions): CSSProperties | undefined;
|
|
348
378
|
|
|
349
379
|
type ColumnDropEdge = "before" | "after";
|
|
350
380
|
declare function collectLeafColumnIds<T>(columns: readonly ColumnDef<T, unknown>[]): string[];
|
|
@@ -422,8 +452,12 @@ type UseCellSelectionOptions<T extends Record<string, unknown>> = {
|
|
|
422
452
|
onRowsPaste?: (payload: RowsPastePayload) => void;
|
|
423
453
|
/** Called after keyboard navigation moves the active (end) cell. */
|
|
424
454
|
onCellNavigate?: (position: CellPosition) => void;
|
|
455
|
+
/** Resolves `meta.kind` renderers so copied text matches the visible cell. */
|
|
456
|
+
cellRendererRegistry?: CellRendererRegistry;
|
|
457
|
+
/** Scopes copy's DOM image-url lookup to this table when several are mounted at once. */
|
|
458
|
+
rootRef?: RefObject<HTMLElement | null>;
|
|
425
459
|
};
|
|
426
|
-
declare function useCellSelection<T extends Record<string, unknown>>({ data, rows, enabled, columnCount, enableSubtreeCopy, enableInsertPaste, onDataChange, onBatchChange, onRowsPaste, onCellNavigate, }: UseCellSelectionOptions<T>): {
|
|
460
|
+
declare function useCellSelection<T extends Record<string, unknown>>({ data, rows, enabled, columnCount, enableSubtreeCopy, enableInsertPaste, onDataChange, onBatchChange, onRowsPaste, onCellNavigate, cellRendererRegistry, rootRef, }: UseCellSelectionOptions<T>): {
|
|
427
461
|
dragState: DragState;
|
|
428
462
|
activeSelectionBounds: CellSelectionBounds | null;
|
|
429
463
|
handleCellMouseDown: (rowIndex: number, colIndex: number, options?: CellMouseDownOptions) => void;
|
|
@@ -438,6 +472,16 @@ type CopyRowEntry<T extends Record<string, unknown>> = {
|
|
|
438
472
|
/** Tree depth relative to the table root (0 = top-level). */
|
|
439
473
|
depth: number;
|
|
440
474
|
};
|
|
475
|
+
/**
|
|
476
|
+
* `registry` resolves `meta.kind` renderers (built-ins like `protected`, plus
|
|
477
|
+
* custom `cellRenderers`) so copy text matches the visible cell instead of the
|
|
478
|
+
* raw value. `root` scopes the DOM image-url lookup to one table when several
|
|
479
|
+
* are mounted at once.
|
|
480
|
+
*/
|
|
481
|
+
type CopyRenderOptions = {
|
|
482
|
+
registry?: CellRendererRegistry;
|
|
483
|
+
root?: ParentNode | null;
|
|
484
|
+
};
|
|
441
485
|
/**
|
|
442
486
|
* Clipboard / Excel paste expects one plain string per cell.
|
|
443
487
|
* Avoids `String(object)` → `[object Object]` and joins arrays with `, `.
|
|
@@ -450,9 +494,9 @@ declare function flattenSubtreeRows<T extends Record<string, unknown>>(row: T):
|
|
|
450
494
|
*/
|
|
451
495
|
declare function collectCopyRowEntries<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): CopyRowEntry<T>[];
|
|
452
496
|
declare function collectCopyRows<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): T[];
|
|
453
|
-
declare function serializeCopyRowsToTSV<T extends Record<string, unknown>>(copyRows: T[], visibleRows: Row<T>[], bounds: CellSelectionBounds, depths?: number[]): string;
|
|
454
|
-
declare function serializeSelectionToTSV<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): string;
|
|
455
|
-
declare function writeSelectionToClipboard<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode): Promise<boolean>;
|
|
497
|
+
declare function serializeCopyRowsToTSV<T extends Record<string, unknown>>(copyRows: T[], visibleRows: Row<T>[], bounds: CellSelectionBounds, depths?: number[], options?: CopyRenderOptions): string;
|
|
498
|
+
declare function serializeSelectionToTSV<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode, options?: CopyRenderOptions): string;
|
|
499
|
+
declare function writeSelectionToClipboard<T extends Record<string, unknown>>(visibleRows: Row<T>[], bounds: CellSelectionBounds, mode?: CopySelectionMode, options?: CopyRenderOptions): Promise<boolean>;
|
|
456
500
|
|
|
457
501
|
type CellChange = {
|
|
458
502
|
rowId: string;
|
|
@@ -502,4 +546,4 @@ declare const useConvertTreeData: <T extends Record<string, unknown>>({ data, en
|
|
|
502
546
|
declare function resolveRowSelection(mode: RowSelectionMode, controlledSelection: RowSelectionState | undefined, internalSelection: RowSelectionState): RowSelectionState;
|
|
503
547
|
declare function applySelectionUpdater(mode: RowSelectionMode, updater: Updater<RowSelectionState>, previous: RowSelectionState): RowSelectionState;
|
|
504
548
|
|
|
505
|
-
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, type CellContextWithUpdate, CellKind, CellRenderContext, CellRenderer, type CellRendererRegistry, type CellSelectionBounds, type ColumnDropEdge, ColumnFreezeOffset, type ColumnRowSpanMap, type CopyRowEntry, type CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DataTableCopyActions, DataTableLabels, DataTableProps, type DragState, type EditingCell, PasteMode, ResolvedTableCell, RowSelectionMode, type RowSpanColumnSpec, type RowSpanInfo, RowsPastePayload, SearchResultItem, SearchStatus, type TreeRow, type UseConvertTreeDataParams, type UseGlideTableOptions, type UseGlideTableResult, type UseInlineSearchOptions, type UseInlineSearchResult, applyCellEdit, applyFillData, applyLeafColumnOrder, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectLeafColumnIds, collectRowSpanColumns, commitCellValue, createCellRendererRegistry, flattenSubtreeRows, formatCellValue, formatDefaultCellValue, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getColumnSizeStyle, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, moveColumnIds, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolveCellRenderer, resolveDropEdge, resolveLeafColumnOrder, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useColumnReorder, useConvertTreeData, useGlideTable, useInlineSearch, withCellUpdate, writeSelectionToClipboard };
|
|
549
|
+
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, type CellContextWithUpdate, CellKind, CellRenderContext, CellRenderer, type CellRendererRegistry, type CellSelectionBounds, type ColumnDropEdge, ColumnFreezeOffset, type ColumnLayoutInput, type ColumnRowSpanMap, type CopyRowEntry, type CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DataTableCopyActions, DataTableLabels, DataTableProps, type DragState, type EditingCell, PasteMode, ResolvedTableCell, RowSelectionMode, type RowSpanColumnSpec, type RowSpanInfo, RowsPastePayload, SearchResultItem, SearchStatus, type TreeRow, type UseConvertTreeDataParams, type UseGlideTableOptions, type UseGlideTableResult, type UseInlineSearchOptions, type UseInlineSearchResult, applyCellEdit, applyFillData, applyLeafColumnOrder, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectLeafColumnIds, collectRowSpanColumns, commitCellValue, createCellRendererRegistry, flattenSubtreeRows, formatCellValue, formatDefaultCellValue, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getColumnSizeStyle, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, moveColumnIds, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolveCellRenderer, resolveColumnLayoutWidths, resolveDropEdge, resolveLeafColumnOrder, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useColumnReorder, useConvertTreeData, useGlideTable, useInlineSearch, withCellUpdate, writeSelectionToClipboard };
|