react-glide-table 2.3.1 → 2.3.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 +27 -0
- package/dist/compound.cjs +98 -30
- package/dist/compound.d.cts +2 -2
- package/dist/compound.d.ts +2 -2
- package/dist/compound.js +98 -30
- package/dist/core.cjs +95 -29
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +95 -29
- package/dist/index.cjs +98 -30
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +98 -30
- package/dist/{types-DdeVn-9s.d.cts → types-hf2ruVdu.d.cts} +25 -1
- package/dist/{types-DdeVn-9s.d.ts → types-hf2ruVdu.d.ts} +25 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -625,6 +625,39 @@ function isEditablePasteTarget(target) {
|
|
|
625
625
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
626
626
|
var import_react3 = require("react");
|
|
627
627
|
|
|
628
|
+
// src/components/ui/table/features/cell-selection/activeCellSelectionOwner.ts
|
|
629
|
+
var activeOwner = null;
|
|
630
|
+
var clearByOwner = /* @__PURE__ */ new Map();
|
|
631
|
+
function createCellSelectionOwner() {
|
|
632
|
+
return /* @__PURE__ */ Symbol("cell-selection-owner");
|
|
633
|
+
}
|
|
634
|
+
function registerCellSelectionOwner(owner, clearSelection) {
|
|
635
|
+
clearByOwner.set(owner, clearSelection);
|
|
636
|
+
return () => {
|
|
637
|
+
clearByOwner.delete(owner);
|
|
638
|
+
if (activeOwner === owner) {
|
|
639
|
+
activeOwner = null;
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
}
|
|
643
|
+
function claimCellSelectionOwner(owner) {
|
|
644
|
+
if (activeOwner === owner) return;
|
|
645
|
+
activeOwner = owner;
|
|
646
|
+
for (const [id, clearSelection] of clearByOwner) {
|
|
647
|
+
if (id !== owner) {
|
|
648
|
+
clearSelection();
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function isActiveCellSelectionOwner(owner) {
|
|
653
|
+
return activeOwner === owner;
|
|
654
|
+
}
|
|
655
|
+
function releaseCellSelectionOwner(owner) {
|
|
656
|
+
if (activeOwner === owner) {
|
|
657
|
+
activeOwner = null;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
628
661
|
// src/components/ui/table/features/cell-selection/cellSelection.ts
|
|
629
662
|
var INITIAL_DRAG_STATE = {
|
|
630
663
|
isSelecting: false,
|
|
@@ -1102,19 +1135,31 @@ function extractRenderedCopyText(node, value, cellPosition, root) {
|
|
|
1102
1135
|
function formatCopyCellText(rowData, columnDef, columnId, visibleRow, fallbackIndex, sourceCell, cellPosition, options) {
|
|
1103
1136
|
const meta = columnDef.meta;
|
|
1104
1137
|
const value = sourceCell ? sourceCell.getValue() : readRowColumnValue(rowData, columnDef);
|
|
1138
|
+
const row = visibleRow ?? createCopyRenderRow(rowData, fallbackIndex);
|
|
1139
|
+
const ctx = {
|
|
1140
|
+
value,
|
|
1141
|
+
row,
|
|
1142
|
+
index: row.index,
|
|
1143
|
+
columnId,
|
|
1144
|
+
cellProps: meta?.cellProps,
|
|
1145
|
+
update: () => {
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
const copyValue = meta?.copyValue;
|
|
1149
|
+
if (typeof copyValue === "function") {
|
|
1150
|
+
try {
|
|
1151
|
+
return sanitizeClipboardCell(copyValue(ctx));
|
|
1152
|
+
} catch {
|
|
1153
|
+
return formatCellValue(value);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
if (copyValue === "value") {
|
|
1157
|
+
return formatCellValue(value);
|
|
1158
|
+
}
|
|
1105
1159
|
const cellRender = meta?.cellRender;
|
|
1106
1160
|
if (typeof cellRender === "function") {
|
|
1107
1161
|
try {
|
|
1108
|
-
const
|
|
1109
|
-
const node = cellRender({
|
|
1110
|
-
value,
|
|
1111
|
-
row,
|
|
1112
|
-
index: row.index,
|
|
1113
|
-
columnId,
|
|
1114
|
-
cellProps: meta?.cellProps,
|
|
1115
|
-
update: () => {
|
|
1116
|
-
}
|
|
1117
|
-
});
|
|
1162
|
+
const node = cellRender(ctx);
|
|
1118
1163
|
return extractRenderedCopyText(node, value, cellPosition, options?.root);
|
|
1119
1164
|
} catch {
|
|
1120
1165
|
return formatCellValue(value);
|
|
@@ -1122,16 +1167,6 @@ function formatCopyCellText(rowData, columnDef, columnId, visibleRow, fallbackIn
|
|
|
1122
1167
|
}
|
|
1123
1168
|
if (options?.registry && meta?.kind && isPrimitiveCopyValue(value)) {
|
|
1124
1169
|
try {
|
|
1125
|
-
const row = visibleRow ?? createCopyRenderRow(rowData, fallbackIndex);
|
|
1126
|
-
const ctx = {
|
|
1127
|
-
value,
|
|
1128
|
-
row,
|
|
1129
|
-
index: row.index,
|
|
1130
|
-
columnId,
|
|
1131
|
-
cellProps: meta.cellProps,
|
|
1132
|
-
update: () => {
|
|
1133
|
-
}
|
|
1134
|
-
};
|
|
1135
1170
|
const renderer = resolveCellRenderer(options.registry, meta.kind, ctx);
|
|
1136
1171
|
if (renderer) {
|
|
1137
1172
|
const node = renderer.render(ctx);
|
|
@@ -1257,11 +1292,16 @@ function serializeCopyRowsToTSV(copyRows, visibleRows, bounds, depths, options)
|
|
|
1257
1292
|
const resolvedDepths = depths && depths.length === copyRows.length ? depths : copyRows.map((row) => getRowDepth(row));
|
|
1258
1293
|
const minDepth = Math.min(...resolvedDepths);
|
|
1259
1294
|
const visibleRowByOriginal = buildVisibleRowLookup(visibleRows);
|
|
1295
|
+
const copyableColumns = columnCells.flatMap((templateCell, colOffset) => {
|
|
1296
|
+
const meta = templateCell.column.columnDef.meta;
|
|
1297
|
+
if (meta?.copyValue === "omit") return [];
|
|
1298
|
+
return [{ templateCell, colOffset }];
|
|
1299
|
+
});
|
|
1260
1300
|
return copyRows.map((rowData, index) => {
|
|
1261
1301
|
const relativeDepth = Math.max(0, (resolvedDepths[index] ?? 0) - minDepth);
|
|
1262
1302
|
const visibleRow = visibleRowByOriginal.get(rowData);
|
|
1263
1303
|
const matchingCells = visibleRow?.getVisibleCells().slice(startCol, endCol + 1);
|
|
1264
|
-
const line =
|
|
1304
|
+
const line = copyableColumns.map(({ templateCell, colOffset }) => {
|
|
1265
1305
|
const sourceCell = matchingCells?.[colOffset];
|
|
1266
1306
|
const column = sourceCell?.column ?? templateCell.column;
|
|
1267
1307
|
return formatCopyCellText(
|
|
@@ -1370,6 +1410,7 @@ function useCellSelection({
|
|
|
1370
1410
|
cellRendererRegistry,
|
|
1371
1411
|
rootRef
|
|
1372
1412
|
}) {
|
|
1413
|
+
const ownerRef = (0, import_react3.useRef)(createCellSelectionOwner());
|
|
1373
1414
|
const [dragState, setDragState] = (0, import_react3.useState)(INITIAL_DRAG_STATE);
|
|
1374
1415
|
const pendingPasteModeRef = (0, import_react3.useRef)(null);
|
|
1375
1416
|
const dragStateRef = (0, import_react3.useRef)(dragState);
|
|
@@ -1381,6 +1422,7 @@ function useCellSelection({
|
|
|
1381
1422
|
const handleCellMouseDown = (0, import_react3.useCallback)(
|
|
1382
1423
|
(rowIndex, colIndex, options) => {
|
|
1383
1424
|
if (!enabled) return;
|
|
1425
|
+
claimCellSelectionOwner(ownerRef.current);
|
|
1384
1426
|
setDragState((prev) => {
|
|
1385
1427
|
if (options?.shiftKey && prev.start) {
|
|
1386
1428
|
return {
|
|
@@ -1422,6 +1464,7 @@ function useCellSelection({
|
|
|
1422
1464
|
const handleFillHandleMouseDown = (0, import_react3.useCallback)(
|
|
1423
1465
|
(rowIndex, colIndex) => {
|
|
1424
1466
|
if (!enabled) return;
|
|
1467
|
+
claimCellSelectionOwner(ownerRef.current);
|
|
1425
1468
|
setDragState((prev) => {
|
|
1426
1469
|
const bounds = getCellSelectionBounds(prev.start, prev.end);
|
|
1427
1470
|
if (!bounds) return prev;
|
|
@@ -1441,6 +1484,7 @@ function useCellSelection({
|
|
|
1441
1484
|
if (prev.start === null && prev.end === null && !prev.isSelecting && !prev.isFillDragging) {
|
|
1442
1485
|
return;
|
|
1443
1486
|
}
|
|
1487
|
+
releaseCellSelectionOwner(ownerRef.current);
|
|
1444
1488
|
dragStateRef.current = INITIAL_DRAG_STATE;
|
|
1445
1489
|
setDragState(INITIAL_DRAG_STATE);
|
|
1446
1490
|
}, []);
|
|
@@ -1449,9 +1493,13 @@ function useCellSelection({
|
|
|
1449
1493
|
clearSelection();
|
|
1450
1494
|
}
|
|
1451
1495
|
}, [clearSelection, enabled]);
|
|
1496
|
+
(0, import_react3.useEffect)(() => {
|
|
1497
|
+
return registerCellSelectionOwner(ownerRef.current, clearSelection);
|
|
1498
|
+
}, [clearSelection]);
|
|
1452
1499
|
(0, import_react3.useEffect)(() => {
|
|
1453
1500
|
if (!enabled) return;
|
|
1454
1501
|
const handleKeyDown = (e) => {
|
|
1502
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1455
1503
|
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
1456
1504
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1457
1505
|
return;
|
|
@@ -1517,6 +1565,7 @@ function useCellSelection({
|
|
|
1517
1565
|
(0, import_react3.useEffect)(() => {
|
|
1518
1566
|
if (!enabled) return;
|
|
1519
1567
|
const handleKeyDown = (e) => {
|
|
1568
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1520
1569
|
if (!activeSelectionBounds) return;
|
|
1521
1570
|
if (!(e.ctrlKey || e.metaKey)) return;
|
|
1522
1571
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
@@ -1553,6 +1602,7 @@ function useCellSelection({
|
|
|
1553
1602
|
const pasteHandledRef = { current: false };
|
|
1554
1603
|
const ignoreNextPasteRef = { current: false };
|
|
1555
1604
|
const handleKeyDown = (e) => {
|
|
1605
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1556
1606
|
if (!activeSelectionBounds) return;
|
|
1557
1607
|
if (!(e.ctrlKey || e.metaKey)) return;
|
|
1558
1608
|
if (e.key.toLowerCase() !== "v") return;
|
|
@@ -1573,6 +1623,7 @@ function useCellSelection({
|
|
|
1573
1623
|
const text = await navigator.clipboard.readText();
|
|
1574
1624
|
if (pasteHandledRef.current) return;
|
|
1575
1625
|
if (pendingPasteModeRef.current !== mode) return;
|
|
1626
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1576
1627
|
if (!text) return;
|
|
1577
1628
|
pasteHandledRef.current = true;
|
|
1578
1629
|
emitRowsPaste(text, mode);
|
|
@@ -1582,6 +1633,7 @@ function useCellSelection({
|
|
|
1582
1633
|
})();
|
|
1583
1634
|
};
|
|
1584
1635
|
const handlePaste = (e) => {
|
|
1636
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1585
1637
|
if (!activeSelectionBounds) return;
|
|
1586
1638
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1587
1639
|
return;
|
|
@@ -1667,6 +1719,25 @@ function useCellSelection({
|
|
|
1667
1719
|
};
|
|
1668
1720
|
}
|
|
1669
1721
|
|
|
1722
|
+
// src/components/ui/table/features/selection-dismiss/isOutsideDismissTarget.ts
|
|
1723
|
+
var OVERLAY_DISMISS_IGNORE_SELECTOR = [
|
|
1724
|
+
'[role="dialog"]',
|
|
1725
|
+
'[role="alertdialog"]',
|
|
1726
|
+
'[role="menu"]',
|
|
1727
|
+
'[role="listbox"]',
|
|
1728
|
+
'[role="tooltip"]',
|
|
1729
|
+
'[aria-modal="true"]',
|
|
1730
|
+
"[data-radix-portal]",
|
|
1731
|
+
"[data-radix-popper-content-wrapper]",
|
|
1732
|
+
"[data-floating-ui-portal]",
|
|
1733
|
+
"[data-table-ignore-outside-dismiss]"
|
|
1734
|
+
].join(",");
|
|
1735
|
+
function isOverlayDismissIgnoreTarget(target) {
|
|
1736
|
+
const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;
|
|
1737
|
+
if (!element) return false;
|
|
1738
|
+
return element.closest(OVERLAY_DISMISS_IGNORE_SELECTOR) !== null;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1670
1741
|
// src/components/ui/table/features/column-reorder/columnReorder.ts
|
|
1671
1742
|
function getColumnDefId(column) {
|
|
1672
1743
|
if (column.id != null && column.id !== "") return column.id;
|
|
@@ -2983,19 +3054,14 @@ function useGlideTable(options) {
|
|
|
2983
3054
|
if (isEditablePasteTarget(event.target) || isEditablePasteTarget(document.activeElement)) {
|
|
2984
3055
|
return;
|
|
2985
3056
|
}
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
const root = rootRef.current;
|
|
2990
|
-
if (!root) return;
|
|
2991
|
-
if (event.target instanceof Node && root.contains(event.target)) return;
|
|
3057
|
+
if (isOverlayDismissIgnoreTarget(event.target) || isOverlayDismissIgnoreTarget(document.activeElement)) {
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
2992
3060
|
clearAllSelections();
|
|
2993
3061
|
};
|
|
2994
3062
|
window.addEventListener("keydown", handleKeyDown);
|
|
2995
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
2996
3063
|
return () => {
|
|
2997
3064
|
window.removeEventListener("keydown", handleKeyDown);
|
|
2998
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
2999
3065
|
};
|
|
3000
3066
|
}, [clearCellSelection, clearRowSelection]);
|
|
3001
3067
|
const {
|
|
@@ -5087,7 +5153,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
5087
5153
|
cellProps,
|
|
5088
5154
|
className,
|
|
5089
5155
|
headerClassName,
|
|
5090
|
-
render
|
|
5156
|
+
render,
|
|
5157
|
+
copyValue
|
|
5091
5158
|
} = props;
|
|
5092
5159
|
return {
|
|
5093
5160
|
id: field,
|
|
@@ -5121,6 +5188,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
5121
5188
|
kind,
|
|
5122
5189
|
cellProps,
|
|
5123
5190
|
cellRender: render,
|
|
5191
|
+
copyValue,
|
|
5124
5192
|
frozen,
|
|
5125
5193
|
reorderable,
|
|
5126
5194
|
width,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as
|
|
1
|
+
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as ColumnCopyValue, e as ColumnFreezeColumnInput, f as ColumnFreezeEdgeSide, g as ColumnFreezeMeta, h as ColumnFreezeOffset, i as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, j as DataTableClassNames, k as DataTableCopyActions, l as DataTableLabels, m as DataTableProps, n as DataTableScrollSlotProps, o as DataTableSlots, I as INLINE_SEARCH_MAX_RESULTS, P as PasteMode, R as RowSelectionMode, p as RowsPastePayload, S as SearchCorpusRow, q as SearchResultItem, r as SearchStatus, T as TableColumnGroupProps, s as TableColumnProps, t as TableProps, u as buildColumnFreezeOffsets, v as buildFlatSearchCorpus, w as buildSearchMatchKey, x as buildSearchMatchKeys, y as buildTreeSearchCorpus, z as cellValueToSearchText, A as collectAncestorKeysToExpand, E as collectSearchMatchesInRange, F as createSearchRegex, G as escapeSearchRegex, H as formatSearchResultLabel, J as getColumnFreezeEdgeAttr, K as getColumnFreezeStyle, L as mapSearchResultToVisibleItem, M as mapSearchResultsToVisibleKeys, N as nextSearchIndex, O as nextSearchStride, Q as previousSearchIndex, U as resolveColumnFreezeSide, V as resolveDataTableLabels, W as resolveHeaderFreezeOffset } from './types-hf2ruVdu.cjs';
|
|
2
2
|
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, CellContextWithUpdate, CellRendererRegistry, CellSelectionBounds, ColumnDropEdge, ColumnLayoutInput, ColumnRowSpanMap, CopyRowEntry, CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DragState, EditingCell, ResolvedTableCell, RowSpanColumnSpec, RowSpanInfo, TreeRow, UseConvertTreeDataParams, UseGlideTableOptions, UseGlideTableResult, UseInlineSearchOptions, 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 } from './core.cjs';
|
|
3
3
|
export { DataTable, Table, TableCompoundComponent, createTable } from './compound.cjs';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as
|
|
1
|
+
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as ColumnCopyValue, e as ColumnFreezeColumnInput, f as ColumnFreezeEdgeSide, g as ColumnFreezeMeta, h as ColumnFreezeOffset, i as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, j as DataTableClassNames, k as DataTableCopyActions, l as DataTableLabels, m as DataTableProps, n as DataTableScrollSlotProps, o as DataTableSlots, I as INLINE_SEARCH_MAX_RESULTS, P as PasteMode, R as RowSelectionMode, p as RowsPastePayload, S as SearchCorpusRow, q as SearchResultItem, r as SearchStatus, T as TableColumnGroupProps, s as TableColumnProps, t as TableProps, u as buildColumnFreezeOffsets, v as buildFlatSearchCorpus, w as buildSearchMatchKey, x as buildSearchMatchKeys, y as buildTreeSearchCorpus, z as cellValueToSearchText, A as collectAncestorKeysToExpand, E as collectSearchMatchesInRange, F as createSearchRegex, G as escapeSearchRegex, H as formatSearchResultLabel, J as getColumnFreezeEdgeAttr, K as getColumnFreezeStyle, L as mapSearchResultToVisibleItem, M as mapSearchResultsToVisibleKeys, N as nextSearchIndex, O as nextSearchStride, Q as previousSearchIndex, U as resolveColumnFreezeSide, V as resolveDataTableLabels, W as resolveHeaderFreezeOffset } from './types-hf2ruVdu.js';
|
|
2
2
|
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, CellContextWithUpdate, CellRendererRegistry, CellSelectionBounds, ColumnDropEdge, ColumnLayoutInput, ColumnRowSpanMap, CopyRowEntry, CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DragState, EditingCell, ResolvedTableCell, RowSpanColumnSpec, RowSpanInfo, TreeRow, UseConvertTreeDataParams, UseGlideTableOptions, UseGlideTableResult, UseInlineSearchOptions, 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 } from './core.js';
|
|
3
3
|
export { DataTable, Table, TableCompoundComponent, createTable } from './compound.js';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
package/dist/index.js
CHANGED
|
@@ -528,6 +528,39 @@ function isEditablePasteTarget(target) {
|
|
|
528
528
|
// src/components/ui/table/features/cell-selection/useCellSelection.ts
|
|
529
529
|
import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
530
530
|
|
|
531
|
+
// src/components/ui/table/features/cell-selection/activeCellSelectionOwner.ts
|
|
532
|
+
var activeOwner = null;
|
|
533
|
+
var clearByOwner = /* @__PURE__ */ new Map();
|
|
534
|
+
function createCellSelectionOwner() {
|
|
535
|
+
return /* @__PURE__ */ Symbol("cell-selection-owner");
|
|
536
|
+
}
|
|
537
|
+
function registerCellSelectionOwner(owner, clearSelection) {
|
|
538
|
+
clearByOwner.set(owner, clearSelection);
|
|
539
|
+
return () => {
|
|
540
|
+
clearByOwner.delete(owner);
|
|
541
|
+
if (activeOwner === owner) {
|
|
542
|
+
activeOwner = null;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function claimCellSelectionOwner(owner) {
|
|
547
|
+
if (activeOwner === owner) return;
|
|
548
|
+
activeOwner = owner;
|
|
549
|
+
for (const [id, clearSelection] of clearByOwner) {
|
|
550
|
+
if (id !== owner) {
|
|
551
|
+
clearSelection();
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function isActiveCellSelectionOwner(owner) {
|
|
556
|
+
return activeOwner === owner;
|
|
557
|
+
}
|
|
558
|
+
function releaseCellSelectionOwner(owner) {
|
|
559
|
+
if (activeOwner === owner) {
|
|
560
|
+
activeOwner = null;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
531
564
|
// src/components/ui/table/features/cell-selection/cellSelection.ts
|
|
532
565
|
var INITIAL_DRAG_STATE = {
|
|
533
566
|
isSelecting: false,
|
|
@@ -1005,19 +1038,31 @@ function extractRenderedCopyText(node, value, cellPosition, root) {
|
|
|
1005
1038
|
function formatCopyCellText(rowData, columnDef, columnId, visibleRow, fallbackIndex, sourceCell, cellPosition, options) {
|
|
1006
1039
|
const meta = columnDef.meta;
|
|
1007
1040
|
const value = sourceCell ? sourceCell.getValue() : readRowColumnValue(rowData, columnDef);
|
|
1041
|
+
const row = visibleRow ?? createCopyRenderRow(rowData, fallbackIndex);
|
|
1042
|
+
const ctx = {
|
|
1043
|
+
value,
|
|
1044
|
+
row,
|
|
1045
|
+
index: row.index,
|
|
1046
|
+
columnId,
|
|
1047
|
+
cellProps: meta?.cellProps,
|
|
1048
|
+
update: () => {
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
const copyValue = meta?.copyValue;
|
|
1052
|
+
if (typeof copyValue === "function") {
|
|
1053
|
+
try {
|
|
1054
|
+
return sanitizeClipboardCell(copyValue(ctx));
|
|
1055
|
+
} catch {
|
|
1056
|
+
return formatCellValue(value);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
if (copyValue === "value") {
|
|
1060
|
+
return formatCellValue(value);
|
|
1061
|
+
}
|
|
1008
1062
|
const cellRender = meta?.cellRender;
|
|
1009
1063
|
if (typeof cellRender === "function") {
|
|
1010
1064
|
try {
|
|
1011
|
-
const
|
|
1012
|
-
const node = cellRender({
|
|
1013
|
-
value,
|
|
1014
|
-
row,
|
|
1015
|
-
index: row.index,
|
|
1016
|
-
columnId,
|
|
1017
|
-
cellProps: meta?.cellProps,
|
|
1018
|
-
update: () => {
|
|
1019
|
-
}
|
|
1020
|
-
});
|
|
1065
|
+
const node = cellRender(ctx);
|
|
1021
1066
|
return extractRenderedCopyText(node, value, cellPosition, options?.root);
|
|
1022
1067
|
} catch {
|
|
1023
1068
|
return formatCellValue(value);
|
|
@@ -1025,16 +1070,6 @@ function formatCopyCellText(rowData, columnDef, columnId, visibleRow, fallbackIn
|
|
|
1025
1070
|
}
|
|
1026
1071
|
if (options?.registry && meta?.kind && isPrimitiveCopyValue(value)) {
|
|
1027
1072
|
try {
|
|
1028
|
-
const row = visibleRow ?? createCopyRenderRow(rowData, fallbackIndex);
|
|
1029
|
-
const ctx = {
|
|
1030
|
-
value,
|
|
1031
|
-
row,
|
|
1032
|
-
index: row.index,
|
|
1033
|
-
columnId,
|
|
1034
|
-
cellProps: meta.cellProps,
|
|
1035
|
-
update: () => {
|
|
1036
|
-
}
|
|
1037
|
-
};
|
|
1038
1073
|
const renderer = resolveCellRenderer(options.registry, meta.kind, ctx);
|
|
1039
1074
|
if (renderer) {
|
|
1040
1075
|
const node = renderer.render(ctx);
|
|
@@ -1160,11 +1195,16 @@ function serializeCopyRowsToTSV(copyRows, visibleRows, bounds, depths, options)
|
|
|
1160
1195
|
const resolvedDepths = depths && depths.length === copyRows.length ? depths : copyRows.map((row) => getRowDepth(row));
|
|
1161
1196
|
const minDepth = Math.min(...resolvedDepths);
|
|
1162
1197
|
const visibleRowByOriginal = buildVisibleRowLookup(visibleRows);
|
|
1198
|
+
const copyableColumns = columnCells.flatMap((templateCell, colOffset) => {
|
|
1199
|
+
const meta = templateCell.column.columnDef.meta;
|
|
1200
|
+
if (meta?.copyValue === "omit") return [];
|
|
1201
|
+
return [{ templateCell, colOffset }];
|
|
1202
|
+
});
|
|
1163
1203
|
return copyRows.map((rowData, index) => {
|
|
1164
1204
|
const relativeDepth = Math.max(0, (resolvedDepths[index] ?? 0) - minDepth);
|
|
1165
1205
|
const visibleRow = visibleRowByOriginal.get(rowData);
|
|
1166
1206
|
const matchingCells = visibleRow?.getVisibleCells().slice(startCol, endCol + 1);
|
|
1167
|
-
const line =
|
|
1207
|
+
const line = copyableColumns.map(({ templateCell, colOffset }) => {
|
|
1168
1208
|
const sourceCell = matchingCells?.[colOffset];
|
|
1169
1209
|
const column = sourceCell?.column ?? templateCell.column;
|
|
1170
1210
|
return formatCopyCellText(
|
|
@@ -1273,6 +1313,7 @@ function useCellSelection({
|
|
|
1273
1313
|
cellRendererRegistry,
|
|
1274
1314
|
rootRef
|
|
1275
1315
|
}) {
|
|
1316
|
+
const ownerRef = useRef2(createCellSelectionOwner());
|
|
1276
1317
|
const [dragState, setDragState] = useState2(INITIAL_DRAG_STATE);
|
|
1277
1318
|
const pendingPasteModeRef = useRef2(null);
|
|
1278
1319
|
const dragStateRef = useRef2(dragState);
|
|
@@ -1284,6 +1325,7 @@ function useCellSelection({
|
|
|
1284
1325
|
const handleCellMouseDown = useCallback2(
|
|
1285
1326
|
(rowIndex, colIndex, options) => {
|
|
1286
1327
|
if (!enabled) return;
|
|
1328
|
+
claimCellSelectionOwner(ownerRef.current);
|
|
1287
1329
|
setDragState((prev) => {
|
|
1288
1330
|
if (options?.shiftKey && prev.start) {
|
|
1289
1331
|
return {
|
|
@@ -1325,6 +1367,7 @@ function useCellSelection({
|
|
|
1325
1367
|
const handleFillHandleMouseDown = useCallback2(
|
|
1326
1368
|
(rowIndex, colIndex) => {
|
|
1327
1369
|
if (!enabled) return;
|
|
1370
|
+
claimCellSelectionOwner(ownerRef.current);
|
|
1328
1371
|
setDragState((prev) => {
|
|
1329
1372
|
const bounds = getCellSelectionBounds(prev.start, prev.end);
|
|
1330
1373
|
if (!bounds) return prev;
|
|
@@ -1344,6 +1387,7 @@ function useCellSelection({
|
|
|
1344
1387
|
if (prev.start === null && prev.end === null && !prev.isSelecting && !prev.isFillDragging) {
|
|
1345
1388
|
return;
|
|
1346
1389
|
}
|
|
1390
|
+
releaseCellSelectionOwner(ownerRef.current);
|
|
1347
1391
|
dragStateRef.current = INITIAL_DRAG_STATE;
|
|
1348
1392
|
setDragState(INITIAL_DRAG_STATE);
|
|
1349
1393
|
}, []);
|
|
@@ -1352,9 +1396,13 @@ function useCellSelection({
|
|
|
1352
1396
|
clearSelection();
|
|
1353
1397
|
}
|
|
1354
1398
|
}, [clearSelection, enabled]);
|
|
1399
|
+
useEffect2(() => {
|
|
1400
|
+
return registerCellSelectionOwner(ownerRef.current, clearSelection);
|
|
1401
|
+
}, [clearSelection]);
|
|
1355
1402
|
useEffect2(() => {
|
|
1356
1403
|
if (!enabled) return;
|
|
1357
1404
|
const handleKeyDown = (e) => {
|
|
1405
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1358
1406
|
if (e.ctrlKey || e.metaKey || e.altKey) return;
|
|
1359
1407
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1360
1408
|
return;
|
|
@@ -1420,6 +1468,7 @@ function useCellSelection({
|
|
|
1420
1468
|
useEffect2(() => {
|
|
1421
1469
|
if (!enabled) return;
|
|
1422
1470
|
const handleKeyDown = (e) => {
|
|
1471
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1423
1472
|
if (!activeSelectionBounds) return;
|
|
1424
1473
|
if (!(e.ctrlKey || e.metaKey)) return;
|
|
1425
1474
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
@@ -1456,6 +1505,7 @@ function useCellSelection({
|
|
|
1456
1505
|
const pasteHandledRef = { current: false };
|
|
1457
1506
|
const ignoreNextPasteRef = { current: false };
|
|
1458
1507
|
const handleKeyDown = (e) => {
|
|
1508
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1459
1509
|
if (!activeSelectionBounds) return;
|
|
1460
1510
|
if (!(e.ctrlKey || e.metaKey)) return;
|
|
1461
1511
|
if (e.key.toLowerCase() !== "v") return;
|
|
@@ -1476,6 +1526,7 @@ function useCellSelection({
|
|
|
1476
1526
|
const text = await navigator.clipboard.readText();
|
|
1477
1527
|
if (pasteHandledRef.current) return;
|
|
1478
1528
|
if (pendingPasteModeRef.current !== mode) return;
|
|
1529
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1479
1530
|
if (!text) return;
|
|
1480
1531
|
pasteHandledRef.current = true;
|
|
1481
1532
|
emitRowsPaste(text, mode);
|
|
@@ -1485,6 +1536,7 @@ function useCellSelection({
|
|
|
1485
1536
|
})();
|
|
1486
1537
|
};
|
|
1487
1538
|
const handlePaste = (e) => {
|
|
1539
|
+
if (!isActiveCellSelectionOwner(ownerRef.current)) return;
|
|
1488
1540
|
if (!activeSelectionBounds) return;
|
|
1489
1541
|
if (isEditablePasteTarget(e.target) || isEditablePasteTarget(document.activeElement)) {
|
|
1490
1542
|
return;
|
|
@@ -1570,6 +1622,25 @@ function useCellSelection({
|
|
|
1570
1622
|
};
|
|
1571
1623
|
}
|
|
1572
1624
|
|
|
1625
|
+
// src/components/ui/table/features/selection-dismiss/isOutsideDismissTarget.ts
|
|
1626
|
+
var OVERLAY_DISMISS_IGNORE_SELECTOR = [
|
|
1627
|
+
'[role="dialog"]',
|
|
1628
|
+
'[role="alertdialog"]',
|
|
1629
|
+
'[role="menu"]',
|
|
1630
|
+
'[role="listbox"]',
|
|
1631
|
+
'[role="tooltip"]',
|
|
1632
|
+
'[aria-modal="true"]',
|
|
1633
|
+
"[data-radix-portal]",
|
|
1634
|
+
"[data-radix-popper-content-wrapper]",
|
|
1635
|
+
"[data-floating-ui-portal]",
|
|
1636
|
+
"[data-table-ignore-outside-dismiss]"
|
|
1637
|
+
].join(",");
|
|
1638
|
+
function isOverlayDismissIgnoreTarget(target) {
|
|
1639
|
+
const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;
|
|
1640
|
+
if (!element) return false;
|
|
1641
|
+
return element.closest(OVERLAY_DISMISS_IGNORE_SELECTOR) !== null;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1573
1644
|
// src/components/ui/table/features/column-reorder/columnReorder.ts
|
|
1574
1645
|
function getColumnDefId(column) {
|
|
1575
1646
|
if (column.id != null && column.id !== "") return column.id;
|
|
@@ -2893,19 +2964,14 @@ function useGlideTable(options) {
|
|
|
2893
2964
|
if (isEditablePasteTarget(event.target) || isEditablePasteTarget(document.activeElement)) {
|
|
2894
2965
|
return;
|
|
2895
2966
|
}
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
const root = rootRef.current;
|
|
2900
|
-
if (!root) return;
|
|
2901
|
-
if (event.target instanceof Node && root.contains(event.target)) return;
|
|
2967
|
+
if (isOverlayDismissIgnoreTarget(event.target) || isOverlayDismissIgnoreTarget(document.activeElement)) {
|
|
2968
|
+
return;
|
|
2969
|
+
}
|
|
2902
2970
|
clearAllSelections();
|
|
2903
2971
|
};
|
|
2904
2972
|
window.addEventListener("keydown", handleKeyDown);
|
|
2905
|
-
document.addEventListener("mousedown", handleMouseDown);
|
|
2906
2973
|
return () => {
|
|
2907
2974
|
window.removeEventListener("keydown", handleKeyDown);
|
|
2908
|
-
document.removeEventListener("mousedown", handleMouseDown);
|
|
2909
2975
|
};
|
|
2910
2976
|
}, [clearCellSelection, clearRowSelection]);
|
|
2911
2977
|
const {
|
|
@@ -5002,7 +5068,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
5002
5068
|
cellProps,
|
|
5003
5069
|
className,
|
|
5004
5070
|
headerClassName,
|
|
5005
|
-
render
|
|
5071
|
+
render,
|
|
5072
|
+
copyValue
|
|
5006
5073
|
} = props;
|
|
5007
5074
|
return {
|
|
5008
5075
|
id: field,
|
|
@@ -5036,6 +5103,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
5036
5103
|
kind,
|
|
5037
5104
|
cellProps,
|
|
5038
5105
|
cellRender: render,
|
|
5106
|
+
copyValue,
|
|
5039
5107
|
frozen,
|
|
5040
5108
|
reorderable,
|
|
5041
5109
|
width,
|
|
@@ -177,6 +177,14 @@ declare function resolveDataTableLabels(partial?: Partial<DataTableLabels>): Dat
|
|
|
177
177
|
type RowSelectionMode = "none" | "single" | "multi";
|
|
178
178
|
type CellEditType = "text" | "number";
|
|
179
179
|
type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue">;
|
|
180
|
+
/**
|
|
181
|
+
* Per-column clipboard serialization.
|
|
182
|
+
* - `"display"`: text extracted from the rendered cell
|
|
183
|
+
* - `"value"`: raw accessor / field value
|
|
184
|
+
* - `"omit"`: exclude this column from clipboard TSV entirely
|
|
185
|
+
* - function: custom clipboard string
|
|
186
|
+
*/
|
|
187
|
+
type ColumnCopyValue<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = "display" | "value" | "omit" | ((ctx: CellRenderContext<T, V>) => string);
|
|
180
188
|
|
|
181
189
|
declare module "@tanstack/react-table" {
|
|
182
190
|
interface ColumnMeta<TData, TValue> {
|
|
@@ -209,6 +217,14 @@ declare module "@tanstack/react-table" {
|
|
|
209
217
|
cellProps?: Record<string, unknown>;
|
|
210
218
|
/** Compound `Column.render` stored for `ResolvedTableCell` */
|
|
211
219
|
cellRender?: CellRenderFn<Record<string, unknown>>;
|
|
220
|
+
/**
|
|
221
|
+
* Clipboard serialization for this column.
|
|
222
|
+
* - `"display"`: rendered cell text (default when `render` / `kind` is set)
|
|
223
|
+
* - `"value"`: raw accessor / field value
|
|
224
|
+
* - `"omit"`: exclude this column from clipboard TSV entirely
|
|
225
|
+
* - function: custom string for the clipboard
|
|
226
|
+
*/
|
|
227
|
+
copyValue?: ColumnCopyValue;
|
|
212
228
|
/**
|
|
213
229
|
* Freeze (sticky) this column without reordering.
|
|
214
230
|
* `true` / `"left"` stick to the scrollport left; `"right"` to the right.
|
|
@@ -623,6 +639,14 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
|
|
|
623
639
|
* Use `update` to commit via `onCellChange` / `onDataChange`.
|
|
624
640
|
*/
|
|
625
641
|
render?: CellRenderFn<T, K extends keyof T ? T[K] : unknown>;
|
|
642
|
+
/**
|
|
643
|
+
* Clipboard serialization for this column.
|
|
644
|
+
* - `"display"`: rendered cell text (default when `render` / `kind` is set)
|
|
645
|
+
* - `"value"`: raw accessor / field value (useful for button cells that still wrap real data)
|
|
646
|
+
* - `"omit"`: exclude this column from clipboard TSV (shifts neighbors; prefer empty string for in-table paste)
|
|
647
|
+
* - function: custom string for the clipboard
|
|
648
|
+
*/
|
|
649
|
+
copyValue?: ColumnCopyValue<T, K extends keyof T ? T[K] : unknown>;
|
|
626
650
|
};
|
|
627
651
|
/** Declares a multi-row header group wrapping leaf `Table.Column`s. */
|
|
628
652
|
type TableColumnGroupProps = {
|
|
@@ -638,4 +662,4 @@ type TableProps<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "co
|
|
|
638
662
|
children: ReactNode;
|
|
639
663
|
};
|
|
640
664
|
|
|
641
|
-
export {
|
|
665
|
+
export { collectAncestorKeysToExpand as A, type BuiltinCellKind as B, type CellKind as C, DEFAULT_DATA_TABLE_LABELS as D, collectSearchMatchesInRange as E, createSearchRegex as F, escapeSearchRegex as G, formatSearchResultLabel as H, INLINE_SEARCH_MAX_RESULTS as I, getColumnFreezeEdgeAttr as J, getColumnFreezeStyle as K, mapSearchResultToVisibleItem as L, mapSearchResultsToVisibleKeys as M, nextSearchIndex as N, nextSearchStride as O, type PasteMode as P, previousSearchIndex as Q, type RowSelectionMode as R, type SearchCorpusRow as S, type TableColumnGroupProps as T, resolveColumnFreezeSide as U, resolveDataTableLabels as V, resolveHeaderFreezeOffset as W, type CellEditType as X, type CellRenderContext as a, type CellRenderFn as b, type CellRenderer as c, type ColumnCopyValue as d, type ColumnFreezeColumnInput as e, type ColumnFreezeEdgeSide as f, type ColumnFreezeMeta as g, type ColumnFreezeOffset as h, type ColumnFreezeSide as i, type DataTableClassNames as j, type DataTableCopyActions as k, type DataTableLabels as l, type DataTableProps as m, type DataTableScrollSlotProps as n, type DataTableSlots as o, type RowsPastePayload as p, type SearchResultItem as q, type SearchStatus as r, type TableColumnProps as s, type TableProps as t, buildColumnFreezeOffsets as u, buildFlatSearchCorpus as v, buildSearchMatchKey as w, buildSearchMatchKeys as x, buildTreeSearchCorpus as y, cellValueToSearchText as z };
|
|
@@ -177,6 +177,14 @@ declare function resolveDataTableLabels(partial?: Partial<DataTableLabels>): Dat
|
|
|
177
177
|
type RowSelectionMode = "none" | "single" | "multi";
|
|
178
178
|
type CellEditType = "text" | "number";
|
|
179
179
|
type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue">;
|
|
180
|
+
/**
|
|
181
|
+
* Per-column clipboard serialization.
|
|
182
|
+
* - `"display"`: text extracted from the rendered cell
|
|
183
|
+
* - `"value"`: raw accessor / field value
|
|
184
|
+
* - `"omit"`: exclude this column from clipboard TSV entirely
|
|
185
|
+
* - function: custom clipboard string
|
|
186
|
+
*/
|
|
187
|
+
type ColumnCopyValue<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = "display" | "value" | "omit" | ((ctx: CellRenderContext<T, V>) => string);
|
|
180
188
|
|
|
181
189
|
declare module "@tanstack/react-table" {
|
|
182
190
|
interface ColumnMeta<TData, TValue> {
|
|
@@ -209,6 +217,14 @@ declare module "@tanstack/react-table" {
|
|
|
209
217
|
cellProps?: Record<string, unknown>;
|
|
210
218
|
/** Compound `Column.render` stored for `ResolvedTableCell` */
|
|
211
219
|
cellRender?: CellRenderFn<Record<string, unknown>>;
|
|
220
|
+
/**
|
|
221
|
+
* Clipboard serialization for this column.
|
|
222
|
+
* - `"display"`: rendered cell text (default when `render` / `kind` is set)
|
|
223
|
+
* - `"value"`: raw accessor / field value
|
|
224
|
+
* - `"omit"`: exclude this column from clipboard TSV entirely
|
|
225
|
+
* - function: custom string for the clipboard
|
|
226
|
+
*/
|
|
227
|
+
copyValue?: ColumnCopyValue;
|
|
212
228
|
/**
|
|
213
229
|
* Freeze (sticky) this column without reordering.
|
|
214
230
|
* `true` / `"left"` stick to the scrollport left; `"right"` to the right.
|
|
@@ -623,6 +639,14 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
|
|
|
623
639
|
* Use `update` to commit via `onCellChange` / `onDataChange`.
|
|
624
640
|
*/
|
|
625
641
|
render?: CellRenderFn<T, K extends keyof T ? T[K] : unknown>;
|
|
642
|
+
/**
|
|
643
|
+
* Clipboard serialization for this column.
|
|
644
|
+
* - `"display"`: rendered cell text (default when `render` / `kind` is set)
|
|
645
|
+
* - `"value"`: raw accessor / field value (useful for button cells that still wrap real data)
|
|
646
|
+
* - `"omit"`: exclude this column from clipboard TSV (shifts neighbors; prefer empty string for in-table paste)
|
|
647
|
+
* - function: custom string for the clipboard
|
|
648
|
+
*/
|
|
649
|
+
copyValue?: ColumnCopyValue<T, K extends keyof T ? T[K] : unknown>;
|
|
626
650
|
};
|
|
627
651
|
/** Declares a multi-row header group wrapping leaf `Table.Column`s. */
|
|
628
652
|
type TableColumnGroupProps = {
|
|
@@ -638,4 +662,4 @@ type TableProps<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "co
|
|
|
638
662
|
children: ReactNode;
|
|
639
663
|
};
|
|
640
664
|
|
|
641
|
-
export {
|
|
665
|
+
export { collectAncestorKeysToExpand as A, type BuiltinCellKind as B, type CellKind as C, DEFAULT_DATA_TABLE_LABELS as D, collectSearchMatchesInRange as E, createSearchRegex as F, escapeSearchRegex as G, formatSearchResultLabel as H, INLINE_SEARCH_MAX_RESULTS as I, getColumnFreezeEdgeAttr as J, getColumnFreezeStyle as K, mapSearchResultToVisibleItem as L, mapSearchResultsToVisibleKeys as M, nextSearchIndex as N, nextSearchStride as O, type PasteMode as P, previousSearchIndex as Q, type RowSelectionMode as R, type SearchCorpusRow as S, type TableColumnGroupProps as T, resolveColumnFreezeSide as U, resolveDataTableLabels as V, resolveHeaderFreezeOffset as W, type CellEditType as X, type CellRenderContext as a, type CellRenderFn as b, type CellRenderer as c, type ColumnCopyValue as d, type ColumnFreezeColumnInput as e, type ColumnFreezeEdgeSide as f, type ColumnFreezeMeta as g, type ColumnFreezeOffset as h, type ColumnFreezeSide as i, type DataTableClassNames as j, type DataTableCopyActions as k, type DataTableLabels as l, type DataTableProps as m, type DataTableScrollSlotProps as n, type DataTableSlots as o, type RowsPastePayload as p, type SearchResultItem as q, type SearchStatus as r, type TableColumnProps as s, type TableProps as t, buildColumnFreezeOffsets as u, buildFlatSearchCorpus as v, buildSearchMatchKey as w, buildSearchMatchKeys as x, buildTreeSearchCorpus as y, cellValueToSearchText as z };
|