@crisp-ui-kit/crisp 0.54.8 → 0.54.10
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/dist/board.css +32 -8
- package/dist/board.layered.css +32 -8
- package/dist/cjs/components/contextmenu/contextmenu.js +2 -2
- package/dist/cjs/components/contextmenu/contextmenu.recipe.js +24 -0
- package/dist/cjs/components/datatable/datatable.js +593 -51
- package/dist/cjs/components/datatable/datatable.recipe.js +67 -3
- package/dist/cjs/components/dialog/dialog.js +65 -1
- package/dist/cjs/components/tabletoolbar/tabletoolbar.chrome.js +37 -2
- package/dist/cjs/components/tabletoolbar/tabletoolbar.js +218 -39
- package/dist/cjs/components/tabletoolbar/tabletoolbar.recipe.js +48 -1
- package/dist/cjs/components/text/text.recipe.js +17 -7
- package/dist/cjs/product/board/board.js +62 -28
- package/dist/cjs/product/board/board.recipe.js +42 -2
- package/dist/cjs/product/comments/comments.js +11 -2
- package/dist/cjs/product/comments/comments.recipe.js +14 -4
- package/dist/cjs/product/recordstable/recordstable.js +1 -17
- package/dist/cjs/product/savedviews/savedviews.js +55 -24
- package/dist/cjs/product/savedviews/savedviews.recipe.js +27 -0
- package/dist/comments.css +14 -4
- package/dist/comments.layered.css +14 -4
- package/dist/contextmenu.css +24 -0
- package/dist/contextmenu.layered.css +24 -0
- package/dist/datatable.css +106 -77
- package/dist/datatable.layered.css +106 -77
- package/dist/esm/components/contextmenu/contextmenu.js +2 -2
- package/dist/esm/components/contextmenu/contextmenu.recipe.js +24 -0
- package/dist/esm/components/datatable/datatable.js +593 -52
- package/dist/esm/components/datatable/datatable.recipe.js +68 -4
- package/dist/esm/components/dialog/dialog.js +65 -1
- package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +37 -2
- package/dist/esm/components/tabletoolbar/tabletoolbar.js +219 -40
- package/dist/esm/components/tabletoolbar/tabletoolbar.recipe.js +50 -3
- package/dist/esm/components/text/text.recipe.js +17 -7
- package/dist/esm/product/board/board.js +63 -29
- package/dist/esm/product/board/board.recipe.js +42 -2
- package/dist/esm/product/comments/comments.js +12 -3
- package/dist/esm/product/comments/comments.recipe.js +14 -4
- package/dist/esm/product/recordstable/recordstable.js +2 -18
- package/dist/esm/product/savedviews/savedviews.js +57 -26
- package/dist/esm/product/savedviews/savedviews.recipe.js +27 -0
- package/dist/recordstable.css +33 -31
- package/dist/recordstable.layered.css +33 -31
- package/dist/savedviews.css +27 -0
- package/dist/savedviews.layered.css +27 -0
- package/dist/styles.css +282 -125
- package/dist/styles.layered.css +282 -125
- package/dist/tabletoolbar.css +45 -4
- package/dist/tabletoolbar.layered.css +45 -4
- package/dist/text.css +1 -1
- package/dist/text.layered.css +1 -1
- package/dist/types/components/contextmenu/contextmenu.d.ts +8 -1
- package/dist/types/components/datatable/datatable.d.ts +98 -2
- package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +72 -2
- package/dist/types/components/text/text.recipe.d.ts +1 -1
- package/dist/types/product/board/board.d.ts +48 -2
- package/dist/types/product/comments/comments.d.ts +6 -1
- package/dist/types/product/recordstable/recordstable.d.ts +0 -1
- package/dist/types/product/savedviews/savedviews.d.ts +45 -8
- package/package.json +1 -1
|
@@ -34,13 +34,24 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.isLabelTruncated = isLabelTruncated;
|
|
37
|
+
exports.reorderColumns = reorderColumns;
|
|
37
38
|
exports.DataTable = DataTable;
|
|
38
39
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
40
|
const lucide_react_1 = require("lucide-react");
|
|
40
41
|
const React = __importStar(require("react"));
|
|
41
42
|
const core_1 = require("../../core");
|
|
43
|
+
// crisp/#601 supersession: a deliberate exception to "DS atoms stay
|
|
44
|
+
// generic; product components compose them" (AUTHORING.md) -- the row's
|
|
45
|
+
// own comment affordance is `CommentCountBadge` (product/comments, #625),
|
|
46
|
+
// already correctly built and measured for the dot/hover-count states this
|
|
47
|
+
// plain icon path can't express on its own. Reaching into `product/` from
|
|
48
|
+
// `components/` runs backwards from every other import in this file; it's
|
|
49
|
+
// scoped to this one component, not a precedent for the rest of DataTable.
|
|
50
|
+
const comments_1 = require("../../product/comments");
|
|
42
51
|
const avatar_1 = require("../avatar");
|
|
43
52
|
const checkbox_1 = require("../checkbox");
|
|
53
|
+
const columncalc_1 = require("../columncalc");
|
|
54
|
+
const contextmenu_1 = require("../contextmenu");
|
|
44
55
|
const menu_1 = require("../menu");
|
|
45
56
|
const select_1 = require("../select");
|
|
46
57
|
const spinner_1 = require("../spinner");
|
|
@@ -55,6 +66,35 @@ const datatable_recipe_1 = require("./datatable.recipe");
|
|
|
55
66
|
function isLabelTruncated(el) {
|
|
56
67
|
return el.scrollWidth > el.clientWidth;
|
|
57
68
|
}
|
|
69
|
+
// #731: the pure resequencing behind both the controlled `columnOrder` prop
|
|
70
|
+
// and the drag/Move-left-right mutations that produce one -- exported so the
|
|
71
|
+
// "does this actually reorder, and does it survive a stale/unknown key"
|
|
72
|
+
// logic can be mutation-tested without mounting the table. Every key in
|
|
73
|
+
// `order` that matches a real column is placed first, in `order`'s own
|
|
74
|
+
// sequence; every column NOT named in `order` (a brand-new column a
|
|
75
|
+
// consumer's persisted order hasn't caught up to yet) keeps its relative
|
|
76
|
+
// position at the end, in `cols`' own order -- so a column can never be
|
|
77
|
+
// dropped or duplicated by this, only resequenced. An `order` entry with no
|
|
78
|
+
// matching column (one that was removed, or a stale value from a saved
|
|
79
|
+
// view) is silently skipped rather than throwing.
|
|
80
|
+
function reorderColumns(cols, order) {
|
|
81
|
+
if (!order || order.length === 0)
|
|
82
|
+
return cols;
|
|
83
|
+
const byKey = new Map(cols.map((c) => [c.key, c]));
|
|
84
|
+
const seen = new Set();
|
|
85
|
+
const ordered = [];
|
|
86
|
+
for (const key of order) {
|
|
87
|
+
const c = byKey.get(key);
|
|
88
|
+
if (c && !seen.has(key)) {
|
|
89
|
+
ordered.push(c);
|
|
90
|
+
seen.add(key);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const c of cols)
|
|
94
|
+
if (!seen.has(c.key))
|
|
95
|
+
ordered.push(c);
|
|
96
|
+
return ordered;
|
|
97
|
+
}
|
|
58
98
|
/**
|
|
59
99
|
* The header label span: a `Tooltip` (full text, `asChild` so the wrapper
|
|
60
100
|
* never displaces the ellipsis CSS the span already carries -- see
|
|
@@ -260,7 +300,7 @@ function formatCell(type, v, symbol, locale = "en-US") {
|
|
|
260
300
|
// silently drop the cell's data. Each branch decides for itself where a
|
|
261
301
|
// display string belongs -- as an entity's name, a status' label -- while the
|
|
262
302
|
// raw value keeps driving structure and tone.
|
|
263
|
-
function renderTyped(col, value, avatarTone, row, display, locale = "en-US") {
|
|
303
|
+
function renderTyped(col, value, avatarTone, row, display, locale = "en-US", openPreviewLabel = "Open preview", rowHovered = false) {
|
|
264
304
|
// Attio's own empty cell is genuinely blank -- no placeholder character at
|
|
265
305
|
// all, for any column type (#412).
|
|
266
306
|
const empty = null;
|
|
@@ -279,7 +319,10 @@ function renderTyped(col, value, avatarTone, row, display, locale = "en-US") {
|
|
|
279
319
|
// at a DIFFERENT record than the row itself (#501).
|
|
280
320
|
ev.stopPropagation();
|
|
281
321
|
col.onEntityClick?.(row);
|
|
282
|
-
}, children: e.name })) : ((0, jsx_runtime_1.jsx)("span", { className: "crisp-datatable-entity-name", children: e.name }))
|
|
322
|
+
}, children: e.name })) : ((0, jsx_runtime_1.jsx)("span", { className: "crisp-datatable-entity-name", children: e.name })), col.onOpenComments ? ((0, jsx_runtime_1.jsx)("span", { className: "crisp-datatable-entity-actions", children: (0, jsx_runtime_1.jsx)(comments_1.CommentCountBadge, { count: col.commentCount?.(row) ?? 0, hovered: rowHovered, onOpen: () => col.onOpenComments?.(row), onOpenPreview: col.onOpenPreview ? () => col.onOpenPreview?.(row) : undefined, previewLabel: openPreviewLabel }) })) : (col.onOpenPreview && ((0, jsx_runtime_1.jsx)("span", { className: "crisp-datatable-entity-actions", children: (0, jsx_runtime_1.jsx)("button", { type: "button", className: "crisp-datatable-entity-action", "aria-label": openPreviewLabel, onClick: (ev) => {
|
|
323
|
+
ev.stopPropagation();
|
|
324
|
+
col.onOpenPreview?.(row);
|
|
325
|
+
}, children: (0, jsx_runtime_1.jsx)(lucide_react_1.PanelRight, { "data-rtl-flip": "", size: 16, strokeWidth: 1.75, "aria-hidden": "true" }) }) })))] }));
|
|
283
326
|
}
|
|
284
327
|
case "tags": {
|
|
285
328
|
// asking for a format on a tag column means "render it your way" -- show
|
|
@@ -452,7 +495,7 @@ function DataReferenceEditor({ col, value, isPending, onCommit, onCancel, }) {
|
|
|
452
495
|
onCommit(v);
|
|
453
496
|
} }) }));
|
|
454
497
|
}
|
|
455
|
-
function DataTable({ columns: columnsProp, data, selectable = false, selectedIds, onSelectionChange, selectAllLabel: selectAllLabelProp, selectRowLabel = (row) => `Select row ${row.id}`, selectionAnnouncement, columnMenu = false, onColumnsChange, groupBy, onRowsReorder, error, sort: sortProp, defaultSort, onSortChange, filterable = false, searchPlaceholder: searchPlaceholderProp, searchLabel: searchLabelProp, onEdit, stickyFirst = true, stickyLast = false, scrollProps, locale: localeProp, avatarTone = "brand", surface, interactive = false, onRowClick, onAddRow, addRowLabel: addRowLabelProp, empty: emptyProp, showCount = true, countLabel, toolbar, height, className, reorderRowLabel: reorderRowLabelProp, sortAscendingLabel: sortAscendingLabelProp, sortDescendingLabel: sortDescendingLabelProp, moveColumnLeftLabel: moveColumnLeftLabelProp, moveColumnRightLabel: moveColumnRightLabelProp, editColumnLabel: editColumnLabelProp, hideColumnLabel: hideColumnLabelProp, renameColumnLabel: renameColumnLabelProp, viewSettingsLabel: viewSettingsLabelProp, columnsGroupLabel: columnsGroupLabelProp, ...rest }) {
|
|
498
|
+
function DataTable({ columns: columnsProp, data, selectable = false, selectedIds, onSelectionChange, selectAllLabel: selectAllLabelProp, selectRowLabel = (row) => `Select row ${row.id}`, selectionAnnouncement, columnMenu = false, onColumnsChange, columnOrder, onColumnOrderChange, groupBy, onRowsReorder, error, sort: sortProp, defaultSort, onSortChange, filterable = false, searchPlaceholder: searchPlaceholderProp, searchLabel: searchLabelProp, onEdit, onViewEditHistory, stickyFirst = true, stickyLast = false, scrollProps, locale: localeProp, avatarTone = "brand", surface, interactive = false, onRowClick, onAddRow, addRowLabel: addRowLabelProp, empty: emptyProp, showCount = true, countLabel, toolbar, height, className, reorderRowLabel: reorderRowLabelProp, openPreviewLabel: openPreviewLabelProp, sortAscendingLabel: sortAscendingLabelProp, sortDescendingLabel: sortDescendingLabelProp, moveColumnLeftLabel: moveColumnLeftLabelProp, moveColumnRightLabel: moveColumnRightLabelProp, editColumnLabel: editColumnLabelProp, hideColumnLabel: hideColumnLabelProp, renameColumnLabel: renameColumnLabelProp, viewSettingsLabel: viewSettingsLabelProp, columnsGroupLabel: columnsGroupLabelProp, cellMenuLabel: cellMenuLabelProp, copyLabel: copyLabelProp, pasteLabel: pasteLabelProp, viewEditHistoryLabel: viewEditHistoryLabelProp, clearValueLabel: clearValueLabelProp, ...rest }) {
|
|
456
499
|
// crisp/#471: same resolution order as TableToolbar's own — an explicit
|
|
457
500
|
// prop wins, then the provider's translation of the built-in English
|
|
458
501
|
// default, then that default itself with no provider in the tree.
|
|
@@ -469,6 +512,7 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
469
512
|
// wants shown); only the built-in string default translates.
|
|
470
513
|
const empty = emptyProp ?? crispMessages["No results."] ?? "No results.";
|
|
471
514
|
const reorderRowLabel = (0, core_1.useCrispMessage)(reorderRowLabelProp, "Reorder row");
|
|
515
|
+
const openPreviewLabel = (0, core_1.useCrispMessage)(openPreviewLabelProp, "Open preview");
|
|
472
516
|
const sortAscendingLabel = (0, core_1.useCrispMessage)(sortAscendingLabelProp, "Sort ascending");
|
|
473
517
|
const sortDescendingLabel = (0, core_1.useCrispMessage)(sortDescendingLabelProp, "Sort descending");
|
|
474
518
|
const moveColumnLeftLabel = (0, core_1.useCrispMessage)(moveColumnLeftLabelProp, "Move left");
|
|
@@ -478,6 +522,11 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
478
522
|
const renameColumnLabel = (0, core_1.useCrispMessage)(renameColumnLabelProp, "Rename column");
|
|
479
523
|
const viewSettingsLabel = (0, core_1.useCrispMessage)(viewSettingsLabelProp, "View settings");
|
|
480
524
|
const columnsGroupLabel = (0, core_1.useCrispMessage)(columnsGroupLabelProp, "Columns");
|
|
525
|
+
const cellMenuLabel = (0, core_1.useCrispMessage)(cellMenuLabelProp, "Cell options");
|
|
526
|
+
const copyLabel = (0, core_1.useCrispMessage)(copyLabelProp, "Copy");
|
|
527
|
+
const pasteLabel = (0, core_1.useCrispMessage)(pasteLabelProp, "Paste");
|
|
528
|
+
const viewEditHistoryLabel = (0, core_1.useCrispMessage)(viewEditHistoryLabelProp, "View edit history");
|
|
529
|
+
const clearValueLabel = (0, core_1.useCrispMessage)(clearValueLabelProp, "Clear value");
|
|
481
530
|
// countLabel/selectionAnnouncement stay formatter props, same escape hatch
|
|
482
531
|
// as TableToolbar's sortTriggerLabel — word order and pluralisation rules
|
|
483
532
|
// differ too much across languages for a template. Their BUILT-IN default
|
|
@@ -506,14 +555,32 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
506
555
|
// menu mutates this copy and reports upward via `onColumnsChange`.
|
|
507
556
|
const [internalCols, setInternalCols] = React.useState(columnsProp);
|
|
508
557
|
React.useEffect(() => setInternalCols(columnsProp), [columnsProp]);
|
|
509
|
-
/** Every column, hidden ones included — what the column manager lists.
|
|
510
|
-
|
|
558
|
+
/** Every column, hidden ones included — what the column manager lists.
|
|
559
|
+
* `columnOrder`, controlled or not, is the one source of truth for ORDER;
|
|
560
|
+
* `internalCols` still carries each column's hidden/renamed state, so
|
|
561
|
+
* resequencing it here never loses either. */
|
|
562
|
+
const allColumns = React.useMemo(() => reorderColumns(internalCols, columnOrder), [internalCols, columnOrder]);
|
|
511
563
|
/** What the grid actually renders. */
|
|
512
|
-
const columns = React.useMemo(() =>
|
|
564
|
+
const columns = React.useMemo(() => allColumns.filter((c) => !c.hidden), [allColumns]);
|
|
513
565
|
const applyColumns = React.useCallback((next) => {
|
|
514
566
|
setInternalCols(next);
|
|
515
567
|
onColumnsChange?.(next);
|
|
516
568
|
}, [onColumnsChange]);
|
|
569
|
+
// Reordering specifically (a header drag, or the menu's Move left/right) —
|
|
570
|
+
// separate from `applyColumns` above (hide/rename, which never touch
|
|
571
|
+
// order) because this is the one path that also owns `columnOrder`:
|
|
572
|
+
// uncontrolled, it seeds `internalCols`' own order same as any other
|
|
573
|
+
// mutation; controlled, the next render's `allColumns` re-derives order
|
|
574
|
+
// from the (now stale, until the consumer updates it) `columnOrder` prop
|
|
575
|
+
// instead — the same contract `sort`/`selectedIds` already use — so this
|
|
576
|
+
// deliberately does NOT touch `internalCols`' order when controlled.
|
|
577
|
+
const applyOrder = React.useCallback((nextOrder) => {
|
|
578
|
+
const next = reorderColumns(allColumns, nextOrder);
|
|
579
|
+
if (columnOrder === undefined)
|
|
580
|
+
setInternalCols(next);
|
|
581
|
+
onColumnsChange?.(next);
|
|
582
|
+
onColumnOrderChange?.(next.map((c) => c.key));
|
|
583
|
+
}, [allColumns, columnOrder, onColumnsChange, onColumnOrderChange]);
|
|
517
584
|
const moveColumn = React.useCallback((key, dir) => {
|
|
518
585
|
const i = allColumns.findIndex((c) => c.key === key);
|
|
519
586
|
const j = i + dir;
|
|
@@ -521,14 +588,57 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
521
588
|
return;
|
|
522
589
|
const next = [...allColumns];
|
|
523
590
|
[next[i], next[j]] = [next[j], next[i]];
|
|
524
|
-
|
|
525
|
-
}, [allColumns,
|
|
591
|
+
applyOrder(next.map((c) => c.key));
|
|
592
|
+
}, [allColumns, applyOrder]);
|
|
526
593
|
const hideColumn = React.useCallback((key) => applyColumns(allColumns.map((c) => (c.key === key ? { ...c, hidden: true } : c))), [allColumns, applyColumns]);
|
|
527
594
|
const renameColumn = React.useCallback((key, header) => applyColumns(allColumns.map((c) => (c.key === key ? { ...c, header } : c))), [allColumns, applyColumns]);
|
|
528
595
|
const [renaming, setRenaming] = React.useState(null);
|
|
529
596
|
const showColumn = React.useCallback((key) => applyColumns(allColumns.map((c) => (c.key === key ? { ...c, hidden: false } : c))), [allColumns, applyColumns]);
|
|
530
597
|
const [selCell, setSelCell] = React.useState(null);
|
|
598
|
+
// crisp/#625/#601 supersession: `CommentCountBadge` branches its own
|
|
599
|
+
// render (a plain dot vs. the icon+count row) on a `hovered` boolean it
|
|
600
|
+
// takes as a prop -- unlike the plain #601 icons this replaces, which
|
|
601
|
+
// reveal on pure `tr:hover` CSS, the badge has no hover detection of its
|
|
602
|
+
// own (see its own doc comment) and needs the row's hover state IN JS.
|
|
603
|
+
// A single id, not a Set: only one row is ever hovered at a time, so this
|
|
604
|
+
// is one extra re-render on enter/leave, not per-row state.
|
|
605
|
+
const [hoveredRowId, setHoveredRowId] = React.useState(null);
|
|
606
|
+
// crisp/#645, checklist G-101: a Shift+Click extends a RANGE from the last
|
|
607
|
+
// plain-click anchor to the newly clicked cell (spreadsheet convention --
|
|
608
|
+
// Attio's own trigger is "Click cell A, Shift+Click cell B"). `selAnchor`
|
|
609
|
+
// is the fixed corner; `selCell` (above) keeps doubling as the moving
|
|
610
|
+
// corner/focus cell, so every existing single-cell consumer (editing,
|
|
611
|
+
// arrow-key nav, Enter) is unaffected -- a plain click resets `selAnchor`
|
|
612
|
+
// to null, collapsing back to single-cell mode.
|
|
613
|
+
const [selAnchor, setSelAnchor] = React.useState(null);
|
|
614
|
+
// crisp/#749: Shift+ArrowUp/Down extends the ROW (checkbox) selection --
|
|
615
|
+
// confirmed live on Attio's own Companies grid, a DIFFERENT gesture from
|
|
616
|
+
// `selAnchor` above (that's Shift+CLICK extending a cell-value range;
|
|
617
|
+
// this issue's own text is explicit the two are independent, and arrow
|
|
618
|
+
// keys were never measured as a cell-range trigger, G-101). Same
|
|
619
|
+
// fixed-anchor/moving-cell shape as `selAnchor` -- a spreadsheet's own
|
|
620
|
+
// Shift+Arrow both moves the active cell AND grows/shrinks the selection
|
|
621
|
+
// relative to wherever the drag started, which recomputing the anchor→
|
|
622
|
+
// new-row span from scratch on every press gives for free (arrowing back
|
|
623
|
+
// toward the anchor shrinks the same way arrowing away grows it). Reset
|
|
624
|
+
// to null on any plain (non-shift) navigation or click, same as
|
|
625
|
+
// `selAnchor`'s own reset points.
|
|
626
|
+
const [rowSelectAnchor, setRowSelectAnchor] = React.useState(null);
|
|
531
627
|
const gridRef = React.useRef(null);
|
|
628
|
+
// The native-copy-event proxy (crisp/#645): Attio "has no Mousetrap/
|
|
629
|
+
// JS-keydown binding for c/mod+c ... it copies purely via the native
|
|
630
|
+
// browser copy event" -- confirmed live, `document.execCommand('copy')`
|
|
631
|
+
// on the focused element is what reliably fires it, a synthetic keydown
|
|
632
|
+
// does not. A plain focused `<div>` (what `gridRef` is) never receives a
|
|
633
|
+
// native `copy` event at all (no selection, nothing editable) -- verified
|
|
634
|
+
// empirically (Playwright, a focused non-editable div, real Ctrl+C: no
|
|
635
|
+
// `copy` event fires; the same page's `<input>` with selected text does).
|
|
636
|
+
// This hidden, always-selected textarea is what a spreadsheet-style grid
|
|
637
|
+
// needs to give the browser something copyable while the VISIBLE focus
|
|
638
|
+
// styling stays on the grid: it's the same visually-hidden-but-focusable
|
|
639
|
+
// shape as `.crisp-datatable-live` below, just interactive instead of
|
|
640
|
+
// `aria-live`.
|
|
641
|
+
const clipboardProxyRef = React.useRef(null);
|
|
532
642
|
// #579: the click-to-expand overlay for a truncated cell. Only one is ever
|
|
533
643
|
// open (a second click-to-expand elsewhere closes the first, matching "one
|
|
534
644
|
// live session"-style singular UI state already used for `selCell`).
|
|
@@ -672,6 +782,25 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
672
782
|
const [widths, setWidths] = React.useState({});
|
|
673
783
|
const [resizingKey, setResizingKey] = React.useState(null);
|
|
674
784
|
const resizeRef = React.useRef(null);
|
|
785
|
+
// crisp/#731 -- column drag-to-reorder. Pointer events, not native HTML5
|
|
786
|
+
// `draggable`: measured live on Attio's own grid (#731's issue comment) --
|
|
787
|
+
// `aria-roledescription="draggable"` etc. on every draggable header is
|
|
788
|
+
// dnd-kit's own signature, itself pointer-events-based, the same primitive
|
|
789
|
+
// `board.tsx` moved to in #724 (mousedown -> several mousemoves -> mouseup,
|
|
790
|
+
// no `[draggable]` anywhere). Mirrors that fix's own shape: a ref for the
|
|
791
|
+
// in-flight gesture (so a pointermove before the 2px threshold never
|
|
792
|
+
// re-renders), React state for what actually needs to paint.
|
|
793
|
+
const [dragColKey, setDragColKey] = React.useState(null);
|
|
794
|
+
const [dropCol, setDropCol] = React.useState(null);
|
|
795
|
+
const colDragRef = React.useRef(null);
|
|
796
|
+
// Keyed by column key, not index -- #577's own column virtualization means
|
|
797
|
+
// an off-screen column's `TableHead` unmounts entirely (confirmed live:
|
|
798
|
+
// Attio does the same, a column scrolled far enough away disappears from
|
|
799
|
+
// the DOM), so this only ever holds the currently-mounted ones, same as
|
|
800
|
+
// `board.tsx`'s `colRefs`.
|
|
801
|
+
const colRefs = React.useRef(new Map());
|
|
802
|
+
const autoScrollRef = React.useRef(null);
|
|
803
|
+
const COL_DRAG_THRESHOLD = 2; // crisp/#736 review fix: measured ~2px, not 4px
|
|
675
804
|
const colWidth = (col) => widths[col.key] ?? col.width ?? (col.type === "entity" ? 220 : 160);
|
|
676
805
|
const minWidth = (showGrip ? GRIP_W : 0) +
|
|
677
806
|
(selectable ? CHECK_W : 0) +
|
|
@@ -920,21 +1049,196 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
920
1049
|
return { type: "text", inputMode: "text" };
|
|
921
1050
|
}
|
|
922
1051
|
}
|
|
1052
|
+
/** The rectangular range's index bounds (inclusive), or null outside range
|
|
1053
|
+
* mode (`selAnchor` unset -- single-cell selection, the common case).
|
|
1054
|
+
* Indices, not ids/keys, so it always reads against the CURRENT rendered
|
|
1055
|
+
* `rows`/`columns` order -- the same order arrow-key nav already uses. */
|
|
1056
|
+
function getSelRangeIndices() {
|
|
1057
|
+
if (!selAnchor || !selCell)
|
|
1058
|
+
return null;
|
|
1059
|
+
const ar = rows.findIndex((row) => row.id === selAnchor.id);
|
|
1060
|
+
const ac = columns.findIndex((col) => col.key === selAnchor.key);
|
|
1061
|
+
const fr = rows.findIndex((row) => row.id === selCell.id);
|
|
1062
|
+
const fc = columns.findIndex((col) => col.key === selCell.key);
|
|
1063
|
+
if (ar < 0 || ac < 0 || fr < 0 || fc < 0)
|
|
1064
|
+
return null;
|
|
1065
|
+
return {
|
|
1066
|
+
r0: Math.min(ar, fr),
|
|
1067
|
+
r1: Math.max(ar, fr),
|
|
1068
|
+
c0: Math.min(ac, fc),
|
|
1069
|
+
c1: Math.max(ac, fc),
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* crisp/#645: Attio copies the RAW, unformatted value (`asText`, not
|
|
1074
|
+
* `formatCell` -- G-070: a formatted "28,946,065" cell copies as raw
|
|
1075
|
+
* "28946065"), writes nothing at all for a `readOnly`/computed cell
|
|
1076
|
+
* (G-100 -- no clipboard write occurs, not an empty string), and a
|
|
1077
|
+
* Shift+Click range copies as TSV: `\t` between columns, `\r\n` between
|
|
1078
|
+
* rows, no header row, raw values (G-101). Returns null for "no clipboard
|
|
1079
|
+
* write" (the single-readOnly-cell case, or nothing selected) rather than
|
|
1080
|
+
* "" -- the caller must not fall back to writing an empty string either.
|
|
1081
|
+
*/
|
|
1082
|
+
function buildCopyText() {
|
|
1083
|
+
const range = getSelRangeIndices();
|
|
1084
|
+
if (range) {
|
|
1085
|
+
const { r0, r1, c0, c1 } = range;
|
|
1086
|
+
const lines = [];
|
|
1087
|
+
for (let ri = r0; ri <= r1; ri++) {
|
|
1088
|
+
const row = rows[ri];
|
|
1089
|
+
const cells = [];
|
|
1090
|
+
for (let ci = c0; ci <= c1; ci++) {
|
|
1091
|
+
const col = columns[ci];
|
|
1092
|
+
cells.push(col.readOnly ? "" : asText(cellValue(col, row)));
|
|
1093
|
+
}
|
|
1094
|
+
lines.push(cells.join("\t"));
|
|
1095
|
+
}
|
|
1096
|
+
return lines.join("\r\n");
|
|
1097
|
+
}
|
|
1098
|
+
if (!selCell)
|
|
1099
|
+
return null;
|
|
1100
|
+
const row = rows.find((rw) => rw.id === selCell.id);
|
|
1101
|
+
const col = columns.find((cc) => cc.key === selCell.key);
|
|
1102
|
+
if (!row || !col || col.readOnly)
|
|
1103
|
+
return null;
|
|
1104
|
+
return asText(cellValue(col, row));
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* crisp/#645: the native `copy`/`paste` events, not a keydown handler --
|
|
1108
|
+
* Attio "has no Mousetrap/JS-keydown binding for c/mod+c ... it copies
|
|
1109
|
+
* purely via the native browser copy event" (confirmed live). These fire
|
|
1110
|
+
* on `clipboardProxyRef`'s hidden textarea (see its own comment), which
|
|
1111
|
+
* `onGridKeyDown` below no longer intercepts Cmd/Ctrl+C for.
|
|
1112
|
+
*/
|
|
1113
|
+
function onGridCopy(e) {
|
|
1114
|
+
e.preventDefault();
|
|
1115
|
+
const text = buildCopyText();
|
|
1116
|
+
if (text != null)
|
|
1117
|
+
e.clipboardData.setData("text/plain", text);
|
|
1118
|
+
}
|
|
1119
|
+
/** crisp/#598, G-071: Attio's own context-menu Paste "looked like it would
|
|
1120
|
+
* commit immediately with no safe cancel step" -- matched here: paste
|
|
1121
|
+
* commits straight to `onEdit`, it doesn't open the cell's editor first.
|
|
1122
|
+
* Single-cell only -- a range-fill paste isn't measured (G-071 was
|
|
1123
|
+
* deliberately not exercised against real clipboard content), so it isn't
|
|
1124
|
+
* built rather than guessed. */
|
|
1125
|
+
function onGridPaste(e) {
|
|
1126
|
+
e.preventDefault();
|
|
1127
|
+
if (!selCell || editing)
|
|
1128
|
+
return;
|
|
1129
|
+
const col = columns.find((cc) => cc.key === selCell.key);
|
|
1130
|
+
if (!col?.editable || col.readOnly)
|
|
1131
|
+
return;
|
|
1132
|
+
const text = e.clipboardData.getData("text/plain");
|
|
1133
|
+
onEdit?.(selCell.id, selCell.key, text);
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* crisp/#598, checklist G-043: Attio's cell context menu is "identical
|
|
1137
|
+
* regardless of field type" — Copy, Paste, View edit history, Clear
|
|
1138
|
+
* value, every time, just some items disabled. No row-level menu exists
|
|
1139
|
+
* at all (G-044 — RecordsTable's own Copy/Duplicate/Pin/Delete row menu
|
|
1140
|
+
* was dropped rather than carried onto DataTable, per the consolidation
|
|
1141
|
+
* plan's own decision: Attio has no row menu to match).
|
|
1142
|
+
*/
|
|
1143
|
+
function cellMenuItems(row, col) {
|
|
1144
|
+
return [
|
|
1145
|
+
{
|
|
1146
|
+
label: copyLabel,
|
|
1147
|
+
icon: (0, jsx_runtime_1.jsx)(lucide_react_1.Copy, { size: 16, strokeWidth: 1.75 }),
|
|
1148
|
+
// G-100: Attio has "no copy handler at all" for a computed/
|
|
1149
|
+
// read-only field -- disabled here, not just silently a no-op, so
|
|
1150
|
+
// the menu itself tells the reader why.
|
|
1151
|
+
disabled: !!col.readOnly,
|
|
1152
|
+
onSelect: () => {
|
|
1153
|
+
if (col.readOnly)
|
|
1154
|
+
return;
|
|
1155
|
+
navigator.clipboard
|
|
1156
|
+
?.writeText(asText(cellValue(col, row)))
|
|
1157
|
+
.catch(() => { });
|
|
1158
|
+
},
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
label: pasteLabel,
|
|
1162
|
+
icon: (0, jsx_runtime_1.jsx)(lucide_react_1.ClipboardPaste, { size: 16, strokeWidth: 1.75 }),
|
|
1163
|
+
disabled: !col.editable || !!col.readOnly,
|
|
1164
|
+
onSelect: () => {
|
|
1165
|
+
navigator.clipboard
|
|
1166
|
+
?.readText()
|
|
1167
|
+
.then((text) => onEdit?.(row.id, col.key, text))
|
|
1168
|
+
.catch(() => { });
|
|
1169
|
+
},
|
|
1170
|
+
},
|
|
1171
|
+
{ separator: true },
|
|
1172
|
+
{
|
|
1173
|
+
label: viewEditHistoryLabel,
|
|
1174
|
+
icon: (0, jsx_runtime_1.jsx)(lucide_react_1.History, { size: 16, strokeWidth: 1.75 }),
|
|
1175
|
+
// Attio's own item carries a "Pro" pill (crisp has no billing
|
|
1176
|
+
// concept to gate on, see this prop's own doc comment) -- disabled
|
|
1177
|
+
// only when the consumer gave nothing for it to open, not gated on
|
|
1178
|
+
// a plan crisp doesn't model.
|
|
1179
|
+
disabled: !onViewEditHistory,
|
|
1180
|
+
onSelect: () => onViewEditHistory?.(row.id, col.key),
|
|
1181
|
+
},
|
|
1182
|
+
{ separator: true },
|
|
1183
|
+
{
|
|
1184
|
+
label: clearValueLabel,
|
|
1185
|
+
icon: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { size: 16, strokeWidth: 1.75 }),
|
|
1186
|
+
danger: true,
|
|
1187
|
+
disabled: !col.editable,
|
|
1188
|
+
onSelect: () => onEdit?.(row.id, col.key, ""),
|
|
1189
|
+
},
|
|
1190
|
+
];
|
|
1191
|
+
}
|
|
923
1192
|
/**
|
|
924
1193
|
* Spreadsheet keyboard model, ported from RecordsTable: arrows move the
|
|
925
1194
|
* selected cell, Enter opens its editor (or, on a non-editable cell,
|
|
926
|
-
* activates the row via `onRowClick`), Escape clears
|
|
927
|
-
*
|
|
1195
|
+
* activates the row via `onRowClick`), Escape clears. Cmd/Ctrl+C is
|
|
1196
|
+
* deliberately NOT handled here (crisp/#645) -- copy is the native `copy`
|
|
1197
|
+
* event on `clipboardProxyRef`, see `onGridCopy` above.
|
|
928
1198
|
*/
|
|
929
1199
|
function onGridKeyDown(e) {
|
|
930
1200
|
if (!selCell || editing)
|
|
931
1201
|
return;
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1202
|
+
// crisp/#607, G-069: Attio's own Cmd+A selects every row (confirmed
|
|
1203
|
+
// live, `metaKey:true`, all 37/37 rows, header checkbox fully checked)
|
|
1204
|
+
// -- a real SELECT ALL, not `toggleAll`'s flip-if-already-all-selected,
|
|
1205
|
+
// so a second Cmd+A with everything already picked stays a no-op
|
|
1206
|
+
// instead of clearing the selection out from under the user.
|
|
1207
|
+
if ((e.metaKey || e.ctrlKey) && (e.key === "a" || e.key === "A")) {
|
|
1208
|
+
if (!selectable)
|
|
1209
|
+
return;
|
|
1210
|
+
e.preventDefault();
|
|
1211
|
+
setSelected(new Set(rows.map((rw) => rw.id)));
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
// crisp/#749: Shift+ArrowUp/Down extends the row-checkbox selection --
|
|
1215
|
+
// confirmed live, distinct from Shift+Click's cell-range gesture above
|
|
1216
|
+
// (that one is `selAnchor`; this is `rowSelectAnchor`, and the two
|
|
1217
|
+
// don't interact). Recomputes the whole anchor→destination span on
|
|
1218
|
+
// every press rather than accumulating, so arrowing back toward the
|
|
1219
|
+
// anchor shrinks the selection the same way arrowing away grows it --
|
|
1220
|
+
// the "shrink-from-the-anchor" behavior a spreadsheet's own Shift+Arrow
|
|
1221
|
+
// gives, which a plain add-on-each-press approach can't express.
|
|
1222
|
+
if (selectable &&
|
|
1223
|
+
e.shiftKey &&
|
|
1224
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
1225
|
+
const r0 = rows.findIndex((row) => row.id === selCell.id);
|
|
1226
|
+
if (r0 < 0)
|
|
1227
|
+
return;
|
|
1228
|
+
const nr0 = e.key === "ArrowDown"
|
|
1229
|
+
? Math.min(rows.length - 1, r0 + 1)
|
|
1230
|
+
: Math.max(0, r0 - 1);
|
|
937
1231
|
e.preventDefault();
|
|
1232
|
+
const anchorId = rowSelectAnchor ?? selCell.id;
|
|
1233
|
+
const anchorIdx = rows.findIndex((row) => row.id === anchorId);
|
|
1234
|
+
if (anchorIdx < 0)
|
|
1235
|
+
return;
|
|
1236
|
+
setRowSelectAnchor(anchorId);
|
|
1237
|
+
const lo = Math.min(anchorIdx, nr0);
|
|
1238
|
+
const hi = Math.max(anchorIdx, nr0);
|
|
1239
|
+
setSelected(new Set(rows.slice(lo, hi + 1).map((row) => row.id)));
|
|
1240
|
+
setSelCell({ id: rows[nr0].id, key: selCell.key });
|
|
1241
|
+
clipboardProxyRef.current?.select();
|
|
938
1242
|
return;
|
|
939
1243
|
}
|
|
940
1244
|
const r = rows.findIndex((row) => row.id === selCell.id);
|
|
@@ -954,8 +1258,28 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
954
1258
|
const forward = e.key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
955
1259
|
nc = forward ? Math.min(columns.length - 1, c + 1) : Math.max(0, c - 1);
|
|
956
1260
|
}
|
|
1261
|
+
// crisp/#607, G-066/G-068: End jumps to the last row (confirmed live --
|
|
1262
|
+
// it also triggers Attio's own lazy-load, which is a data-loading
|
|
1263
|
+
// concern outside this component; the #577 scroll-into-view effect
|
|
1264
|
+
// below already re-runs on every `selCell` change, on a virtualized
|
|
1265
|
+
// grid too, so jumping straight to the last row is enough to reveal it
|
|
1266
|
+
// the same way arrowing down one row at a time would). PageUp/PageDown
|
|
1267
|
+
// move a viewport's worth of rows -- `scrollRef`'s own rendered height
|
|
1268
|
+
// divided by the uniform row height, at least one row so a viewport
|
|
1269
|
+
// shorter than one row can't get stuck.
|
|
1270
|
+
else if (e.key === "End")
|
|
1271
|
+
nr = rows.length - 1;
|
|
1272
|
+
else if (e.key === "PageDown" || e.key === "PageUp") {
|
|
1273
|
+
const viewportRows = Math.max(1, Math.floor((scrollRef.current?.clientHeight ?? 0) / ROW_HEIGHT));
|
|
1274
|
+
nr =
|
|
1275
|
+
e.key === "PageDown"
|
|
1276
|
+
? Math.min(rows.length - 1, r + viewportRows)
|
|
1277
|
+
: Math.max(0, r - viewportRows);
|
|
1278
|
+
}
|
|
957
1279
|
else if (e.key === "Escape") {
|
|
958
1280
|
setSelCell(null);
|
|
1281
|
+
setSelAnchor(null);
|
|
1282
|
+
setRowSelectAnchor(null);
|
|
959
1283
|
return;
|
|
960
1284
|
}
|
|
961
1285
|
else if (e.key === "Enter") {
|
|
@@ -977,7 +1301,18 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
977
1301
|
else
|
|
978
1302
|
return;
|
|
979
1303
|
e.preventDefault();
|
|
1304
|
+
// A plain arrow key moves the single-cell selection and drops any active
|
|
1305
|
+
// range -- Attio's own range trigger is Shift+Click only (G-101), arrow
|
|
1306
|
+
// keys were never measured as a range-extend gesture, so this doesn't
|
|
1307
|
+
// invent one. Also drops an in-progress Shift+Arrow row-selection drag
|
|
1308
|
+
// (crisp/#749) for the same reason -- a plain arrow ends that gesture.
|
|
1309
|
+
setSelAnchor(null);
|
|
1310
|
+
setRowSelectAnchor(null);
|
|
980
1311
|
setSelCell({ id: rows[nr].id, key: columns[nc].key });
|
|
1312
|
+
// keeps the clipboard proxy's selection non-collapsed after a move, so
|
|
1313
|
+
// a Cmd+C right after an arrow key still has something native `copy`
|
|
1314
|
+
// can fire on (see `clipboardProxyRef`'s own comment).
|
|
1315
|
+
clipboardProxyRef.current?.select();
|
|
981
1316
|
}
|
|
982
1317
|
// Opening a cell's editor also clears any stale error left over from a
|
|
983
1318
|
// PREVIOUS failed commit on it (#385) -- otherwise a rejection from three
|
|
@@ -1089,7 +1424,8 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
1089
1424
|
renderItems,
|
|
1090
1425
|
]);
|
|
1091
1426
|
const totalCols = columns.length + (selectable ? 1 : 0) + (showGrip ? 1 : 0);
|
|
1092
|
-
const hasSummary = columns.some((c) => c.summary);
|
|
1427
|
+
const hasSummary = columns.some((c) => c.summary || c.calc);
|
|
1428
|
+
const hasCommentColumn = columns.some((c) => c.onOpenComments);
|
|
1093
1429
|
// sticky attrs for the leading column(s): grip col (index -2) + selection
|
|
1094
1430
|
// col (-1) + first data column (0). Each offsets by whatever leading
|
|
1095
1431
|
// columns come before it, so the group stays contiguous when scrolled.
|
|
@@ -1186,13 +1522,135 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
1186
1522
|
setResizingKey(null);
|
|
1187
1523
|
e.target.releasePointerCapture(e.pointerId);
|
|
1188
1524
|
}
|
|
1525
|
+
// Which mounted column (if any) `clientX` is over, and which side of it --
|
|
1526
|
+
// X only, not the full box: like `board.tsx`'s own `columnAt` (#724), the
|
|
1527
|
+
// header row is a single non-wrapping row, so X alone already identifies a
|
|
1528
|
+
// column unambiguously, and checking Y too only risks the same short-row
|
|
1529
|
+
// miss that #724 found the hard way. The midpoint split is what turns
|
|
1530
|
+
// "over column C" into an insertion point: left half means "before C",
|
|
1531
|
+
// right half means "after C" -- exposed as `dropCol` so the render can draw
|
|
1532
|
+
// the measured blue line on the correct edge.
|
|
1533
|
+
function columnDropAt(clientX) {
|
|
1534
|
+
for (const [key, el] of colRefs.current) {
|
|
1535
|
+
const r = el.getBoundingClientRect();
|
|
1536
|
+
if (clientX >= r.left && clientX <= r.right) {
|
|
1537
|
+
return {
|
|
1538
|
+
key,
|
|
1539
|
+
side: clientX < r.left + r.width / 2 ? "before" : "after",
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return null;
|
|
1544
|
+
}
|
|
1545
|
+
function stopColAutoScroll() {
|
|
1546
|
+
if (autoScrollRef.current != null) {
|
|
1547
|
+
cancelAnimationFrame(autoScrollRef.current);
|
|
1548
|
+
autoScrollRef.current = null;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
// Edge auto-scroll (measured live, #731's issue comment: dragging a header
|
|
1552
|
+
// toward the viewport edge scrolls the grid to reveal more columns). A
|
|
1553
|
+
// `requestAnimationFrame` loop, not a one-shot nudge per pointermove: the
|
|
1554
|
+
// scroll has to keep going even while the pointer itself sits still near
|
|
1555
|
+
// the edge, which a per-event nudge can't do. Guarded for environments with
|
|
1556
|
+
// no `requestAnimationFrame` (bun test's happy-dom) -- never throws, just a
|
|
1557
|
+
// no-op there, same as the `ResizeObserver` guards elsewhere in this file.
|
|
1558
|
+
function updateColAutoScroll(clientX) {
|
|
1559
|
+
if (typeof requestAnimationFrame === "undefined")
|
|
1560
|
+
return;
|
|
1561
|
+
const el = scrollRef.current;
|
|
1562
|
+
if (!el)
|
|
1563
|
+
return;
|
|
1564
|
+
const r = el.getBoundingClientRect();
|
|
1565
|
+
const EDGE = 40;
|
|
1566
|
+
const dir = clientX < r.left + EDGE ? -1 : clientX > r.right - EDGE ? 1 : 0;
|
|
1567
|
+
stopColAutoScroll();
|
|
1568
|
+
if (dir === 0)
|
|
1569
|
+
return;
|
|
1570
|
+
const step = () => {
|
|
1571
|
+
el.scrollLeft += dir * 12;
|
|
1572
|
+
autoScrollRef.current = requestAnimationFrame(step);
|
|
1573
|
+
};
|
|
1574
|
+
autoScrollRef.current = requestAnimationFrame(step);
|
|
1575
|
+
}
|
|
1576
|
+
function onColHeaderPointerDown(e, key) {
|
|
1577
|
+
if (!e.isPrimary)
|
|
1578
|
+
return;
|
|
1579
|
+
colDragRef.current = {
|
|
1580
|
+
key,
|
|
1581
|
+
pointerId: e.pointerId,
|
|
1582
|
+
startX: e.clientX,
|
|
1583
|
+
startY: e.clientY,
|
|
1584
|
+
active: false,
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
function onColHeaderPointerMove(e) {
|
|
1588
|
+
const st = colDragRef.current;
|
|
1589
|
+
if (!st || st.pointerId !== e.pointerId)
|
|
1590
|
+
return;
|
|
1591
|
+
if (!st.active) {
|
|
1592
|
+
if (Math.hypot(e.clientX - st.startX, e.clientY - st.startY) <
|
|
1593
|
+
COL_DRAG_THRESHOLD)
|
|
1594
|
+
return;
|
|
1595
|
+
st.active = true;
|
|
1596
|
+
setDragColKey(st.key);
|
|
1597
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
1598
|
+
}
|
|
1599
|
+
const at = columnDropAt(e.clientX);
|
|
1600
|
+
setDropCol(at && at.key !== st.key ? at : null);
|
|
1601
|
+
updateColAutoScroll(e.clientX);
|
|
1602
|
+
}
|
|
1603
|
+
function endColHeaderDrag(e, commit) {
|
|
1604
|
+
const st = colDragRef.current;
|
|
1605
|
+
if (!st || st.pointerId !== e.pointerId)
|
|
1606
|
+
return;
|
|
1607
|
+
if (commit && st.active && dropCol) {
|
|
1608
|
+
const keys = allColumns.map((c) => c.key);
|
|
1609
|
+
const from = keys.indexOf(st.key);
|
|
1610
|
+
const to = keys.indexOf(dropCol.key);
|
|
1611
|
+
if (from >= 0 && to >= 0) {
|
|
1612
|
+
keys.splice(from, 1);
|
|
1613
|
+
let insertAt = keys.indexOf(dropCol.key);
|
|
1614
|
+
if (dropCol.side === "after")
|
|
1615
|
+
insertAt += 1;
|
|
1616
|
+
keys.splice(insertAt, 0, st.key);
|
|
1617
|
+
applyOrder(keys);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
colDragRef.current = null;
|
|
1621
|
+
setDragColKey(null);
|
|
1622
|
+
setDropCol(null);
|
|
1623
|
+
stopColAutoScroll();
|
|
1624
|
+
}
|
|
1625
|
+
// Escape cancels the drag without committing (measured live, #731's issue
|
|
1626
|
+
// comment: verified twice against the real grid) -- a document listener,
|
|
1627
|
+
// not a React `onKeyDown` on the header, for the same reason
|
|
1628
|
+
// `useEscapeExitsEditing` above uses one: focus during a pointer drag isn't
|
|
1629
|
+
// reliably inside the dragged element.
|
|
1630
|
+
React.useEffect(() => {
|
|
1631
|
+
if (!dragColKey)
|
|
1632
|
+
return;
|
|
1633
|
+
const onKey = (e) => {
|
|
1634
|
+
if (e.key !== "Escape")
|
|
1635
|
+
return;
|
|
1636
|
+
colDragRef.current = null;
|
|
1637
|
+
setDragColKey(null);
|
|
1638
|
+
setDropCol(null);
|
|
1639
|
+
if (autoScrollRef.current != null) {
|
|
1640
|
+
cancelAnimationFrame(autoScrollRef.current);
|
|
1641
|
+
autoScrollRef.current = null;
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
document.addEventListener("keydown", onKey);
|
|
1645
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
1646
|
+
}, [dragColKey]);
|
|
1189
1647
|
function ChevronFor({ colKey }) {
|
|
1190
1648
|
const dir = sortDirByKey.get(colKey);
|
|
1191
1649
|
if (dir)
|
|
1192
1650
|
return dir === "asc" ? ((0, jsx_runtime_1.jsx)(lucide_react_1.ArrowUp, { className: "crisp-datatable-chevron", size: 13, strokeWidth: 2 })) : ((0, jsx_runtime_1.jsx)(lucide_react_1.ArrowDown, { className: "crisp-datatable-chevron", size: 13, strokeWidth: 2 }));
|
|
1193
1651
|
return ((0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "crisp-datatable-chevron", size: 13, strokeWidth: 2 }));
|
|
1194
1652
|
}
|
|
1195
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ref: gridRef, className: (0, datatable_recipe_1.datatableRecipe)({ className }), tabIndex: -1, onKeyDown: onGridKeyDown, ...rest, children: [(0, jsx_runtime_1.jsx)("div", { className: "crisp-datatable-live", role: "status", "aria-live": "polite", children: selectionText }), (filterable || showCount || toolbar || columnMenu) && ((0, jsx_runtime_1.jsxs)("div", { className: "crisp-datatable-toolbar", children: [columnMenu && ((0, jsx_runtime_1.jsxs)(menu_1.Menu, { align: "start", trigger: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "crisp-datatable-viewsettings", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.SlidersHorizontal, { size: 14, strokeWidth: 1.75 }), viewSettingsLabel] }), children: [(0, jsx_runtime_1.jsx)("div", { className: "crisp-datatable-group-label", children: columnsGroupLabel }), allColumns.map((c) => ((0, jsx_runtime_1.jsxs)(menu_1.MenuItem, { onSelect: () => c.hidden ? showColumn(c.key) : hideColumn(c.key), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 14, strokeWidth: 2, style: { opacity: c.hidden ? 0 : 1 } }), typeof c.header === "string" ? c.header : c.key] }, c.key)))] })), filterable && ((0, jsx_runtime_1.jsxs)("span", { className: "crisp-datatable-search", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Search, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("input", { type: "search", placeholder: searchPlaceholder, value: query, onChange: (e) => setQuery(e.target.value), "aria-label": searchLabel })] })), showCount && ((0, jsx_runtime_1.jsx)("span", { className: "crisp-datatable-count", children: resolvedCountLabel(rows.length, data.length) })), toolbar] })), (0, jsx_runtime_1.jsxs)(table_1.Table, { interactive: interactive, surface: surface,
|
|
1653
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: gridRef, className: (0, datatable_recipe_1.datatableRecipe)({ className }), tabIndex: -1, onKeyDown: onGridKeyDown, ...rest, children: [(0, jsx_runtime_1.jsx)("div", { className: "crisp-datatable-live", role: "status", "aria-live": "polite", children: selectionText }), (0, jsx_runtime_1.jsx)("textarea", { ref: clipboardProxyRef, className: "crisp-datatable-clipboard-proxy", readOnly: true, value: " ", "aria-label": cellMenuLabel, tabIndex: -1, onCopy: onGridCopy, onPaste: onGridPaste }), (filterable || showCount || toolbar || columnMenu) && ((0, jsx_runtime_1.jsxs)("div", { className: "crisp-datatable-toolbar", children: [columnMenu && ((0, jsx_runtime_1.jsxs)(menu_1.Menu, { align: "start", trigger: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "crisp-datatable-viewsettings", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.SlidersHorizontal, { size: 14, strokeWidth: 1.75 }), viewSettingsLabel] }), children: [(0, jsx_runtime_1.jsx)("div", { className: "crisp-datatable-group-label", children: columnsGroupLabel }), allColumns.map((c) => ((0, jsx_runtime_1.jsxs)(menu_1.MenuItem, { onSelect: () => c.hidden ? showColumn(c.key) : hideColumn(c.key), children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Check, { size: 14, strokeWidth: 2, style: { opacity: c.hidden ? 0 : 1 } }), typeof c.header === "string" ? c.header : c.key] }, c.key)))] })), filterable && ((0, jsx_runtime_1.jsxs)("span", { className: "crisp-datatable-search", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Search, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("input", { type: "search", placeholder: searchPlaceholder, value: query, onChange: (e) => setQuery(e.target.value), "aria-label": searchLabel })] })), showCount && ((0, jsx_runtime_1.jsx)("span", { className: "crisp-datatable-count", children: resolvedCountLabel(rows.length, data.length) })), toolbar] })), (0, jsx_runtime_1.jsxs)(table_1.Table, { interactive: interactive, surface: surface,
|
|
1196
1654
|
// crisp/#581: on the <table> itself (`tableStyle`), not the outer
|
|
1197
1655
|
// wrapper (`style`) -- see `Table`'s own doc comment on why. This is
|
|
1198
1656
|
// what lets the grid actually scroll horizontally INSIDE its own
|
|
@@ -1263,7 +1721,30 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
1263
1721
|
: "descending"
|
|
1264
1722
|
: "none";
|
|
1265
1723
|
const inner = ((0, jsx_runtime_1.jsxs)("span", { className: "crisp-datatable-th-inner", children: [Icon ? (0, jsx_runtime_1.jsx)(Icon, { size: 16, strokeWidth: 1.75 }) : null, (0, jsx_runtime_1.jsx)(ThLabel, { header: col.header, referencedType: col.referencedType }), col.sortable ? (0, jsx_runtime_1.jsx)(ChevronFor, { colKey: col.key }) : null] }));
|
|
1266
|
-
return ((0, jsx_runtime_1.jsxs)(table_1.TableHead, {
|
|
1724
|
+
return ((0, jsx_runtime_1.jsxs)(table_1.TableHead, { ref: isPrimary
|
|
1725
|
+
? undefined
|
|
1726
|
+
: (el) => {
|
|
1727
|
+
if (el)
|
|
1728
|
+
colRefs.current.set(col.key, el);
|
|
1729
|
+
else
|
|
1730
|
+
colRefs.current.delete(col.key);
|
|
1731
|
+
}, align: alignFor(col), "aria-sort": ariaSort, "aria-colindex": colAriaIndex(i), "data-dragging": dragColKey === col.key ? "" : undefined, "data-drop-before": dropCol?.key === col.key && dropCol.side === "before"
|
|
1732
|
+
? ""
|
|
1733
|
+
: undefined, "data-drop-after": dropCol?.key === col.key && dropCol.side === "after"
|
|
1734
|
+
? ""
|
|
1735
|
+
: undefined,
|
|
1736
|
+
// #731: column drag-to-reorder lives on the TH itself, not
|
|
1737
|
+
// a dedicated grip -- Attio's own header is draggable by
|
|
1738
|
+
// its whole surface (measured live). A plain click (no
|
|
1739
|
+
// movement past the 2px threshold) never calls
|
|
1740
|
+
// `setPointerCapture`/`preventDefault`, so the sort
|
|
1741
|
+
// button/menu trigger/resize handle nested inside still get
|
|
1742
|
+
// their own click normally; `startResize`'s own
|
|
1743
|
+
// `stopPropagation` (above) keeps a resize drag from ever
|
|
1744
|
+
// reaching this handler in the first place.
|
|
1745
|
+
onPointerDown: isPrimary
|
|
1746
|
+
? undefined
|
|
1747
|
+
: (e) => onColHeaderPointerDown(e, col.key), onPointerMove: isPrimary ? undefined : onColHeaderPointerMove, onPointerUp: isPrimary ? undefined : (e) => endColHeaderDrag(e, true), onPointerCancel: isPrimary ? undefined : (e) => endColHeaderDrag(e, false), ...dataStickyCol(i), children: [renaming === col.key ? ((0, jsx_runtime_1.jsx)("input", {
|
|
1267
1748
|
// biome-ignore lint/a11y/noAutofocus: the rename item opens this field
|
|
1268
1749
|
autoFocus: true, className: "crisp-datatable-th-rename", defaultValue: typeof col.header === "string" ? col.header : "", "aria-label": renameColumnLabel, onBlur: (e) => {
|
|
1269
1750
|
renameColumn(col.key, e.currentTarget.value);
|
|
@@ -1295,7 +1776,9 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
1295
1776
|
dragRowId !== row.id &&
|
|
1296
1777
|
dropRowId === row.id
|
|
1297
1778
|
? ""
|
|
1298
|
-
: undefined, onClick: onRowClick ? () => onRowClick(row) : undefined, style: onRowClick ? { cursor: "pointer" } : undefined,
|
|
1779
|
+
: undefined, onClick: onRowClick ? () => onRowClick(row) : undefined, style: onRowClick ? { cursor: "pointer" } : undefined, onMouseEnter: hasCommentColumn
|
|
1780
|
+
? () => setHoveredRowId(row.id)
|
|
1781
|
+
: undefined, onMouseLeave: hasCommentColumn ? () => setHoveredRowId(null) : undefined, onDragOver: showGrip && dragRowId
|
|
1299
1782
|
? (e) => {
|
|
1300
1783
|
e.preventDefault();
|
|
1301
1784
|
if (dropRowId !== row.id)
|
|
@@ -1379,46 +1862,105 @@ function DataTable({ columns: columnsProp, data, selectable = false, selectedIds
|
|
|
1379
1862
|
commitEdit(row.id, col.key, e.currentTarget.value);
|
|
1380
1863
|
} }), isPending && ((0, jsx_runtime_1.jsx)(spinner_1.Spinner, { size: 14, className: "crisp-datatable-edit-pending" }))] }, col.key));
|
|
1381
1864
|
}
|
|
1865
|
+
// `itemIndex` is the row's position in the full
|
|
1866
|
+
// `rows` array (getSelRangeIndices' own r0/r1 are
|
|
1867
|
+
// indices into that same array) for the common,
|
|
1868
|
+
// ungrouped case. A `groupBy` view interleaves group-
|
|
1869
|
+
// header items into `visibleItems`, which this
|
|
1870
|
+
// doesn't correct for -- Shift+Click ranging across a
|
|
1871
|
+
// grouped view isn't a measured Attio interaction
|
|
1872
|
+
// (G-101's own trigger is a plain table), so it's a
|
|
1873
|
+
// known gap rather than a guess at behaviour there.
|
|
1874
|
+
const inRange = (() => {
|
|
1875
|
+
const range = getSelRangeIndices();
|
|
1876
|
+
if (!range)
|
|
1877
|
+
return false;
|
|
1878
|
+
return (itemIndex >= range.r0 &&
|
|
1879
|
+
itemIndex <= range.r1 &&
|
|
1880
|
+
i >= range.c0 &&
|
|
1881
|
+
i <= range.c1);
|
|
1882
|
+
})();
|
|
1382
1883
|
const rendered = col.render
|
|
1383
1884
|
? col.render(value, row)
|
|
1384
|
-
: renderTyped(col, value, avatarTone, row, col.format?.(value, row), locale);
|
|
1885
|
+
: renderTyped(col, value, avatarTone, row, col.format?.(value, row), locale, openPreviewLabel, hoveredRowId === row.id);
|
|
1385
1886
|
const isExpanded = expandedCell?.id === row.id &&
|
|
1386
1887
|
expandedCell?.key === col.key;
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1888
|
+
const cellContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!isExpanded && rendered, errorHere && ((0, jsx_runtime_1.jsx)("span", { className: "crisp-datatable-edit-error", children: errorHere })), isExpanded && ((0, jsx_runtime_1.jsx)("div", { className: "crisp-datatable-cell-overlay", onClick: (e) => e.stopPropagation(), children: rendered }))] }));
|
|
1889
|
+
return ((0, jsx_runtime_1.jsx)(contextmenu_1.ContextMenu, { asChild: true, variant: "dark", menuLabel: cellMenuLabel, items: cellMenuItems(row, col), children: (0, jsx_runtime_1.jsx)(table_1.TableCell, { align: alignFor(col), "aria-colindex": colAriaIndex(i), ...sticky, className: col.editable
|
|
1890
|
+
? "crisp-datatable-editable"
|
|
1891
|
+
: undefined, "data-selected": selCell?.id === row.id && selCell?.key === col.key
|
|
1892
|
+
? ""
|
|
1893
|
+
: undefined, "data-in-range": inRange ? "" : undefined, "data-cell-expanded": isExpanded ? "" : undefined, "data-enriched": col.enriched ? "" : undefined, onClick: (e) => {
|
|
1894
|
+
// the keyboard model's anchor -- a single click
|
|
1895
|
+
// only selects. A genuine double-click (or Enter
|
|
1896
|
+
// on the selected cell) opens the editor (#411),
|
|
1897
|
+
// matching RecordsTable's own onDoubleClick.
|
|
1898
|
+
// crisp/#645, G-101: Shift+Click extends a
|
|
1899
|
+
// range from the last plain-click anchor
|
|
1900
|
+
// ("Click cell A, Shift+Click cell B") --
|
|
1901
|
+
// `selCell` keeps doubling as the moving
|
|
1902
|
+
// corner, `selAnchor` is the fixed one.
|
|
1903
|
+
if (e.shiftKey && selCell) {
|
|
1904
|
+
setSelAnchor(selAnchor ?? selCell);
|
|
1905
|
+
}
|
|
1906
|
+
else {
|
|
1907
|
+
setSelAnchor(null);
|
|
1908
|
+
// crisp/#749: a plain click also ends an
|
|
1909
|
+
// in-progress Shift+Arrow row-selection drag
|
|
1910
|
+
// -- Shift+Click itself doesn't touch it,
|
|
1911
|
+
// the two gestures are independent.
|
|
1912
|
+
setRowSelectAnchor(null);
|
|
1913
|
+
}
|
|
1914
|
+
setSelCell({ id: row.id, key: col.key });
|
|
1915
|
+
// Focuses the clipboard proxy, not `gridRef`
|
|
1916
|
+
// itself (crisp/#645) -- it's a DESCENDANT of
|
|
1917
|
+
// `gridRef`, so `onGridKeyDown` still sees
|
|
1918
|
+
// every key via bubbling, but now the browser
|
|
1919
|
+
// also has a focused, selectable text node to
|
|
1920
|
+
// fire a native `copy`/`paste` on. `focus()`
|
|
1921
|
+
// then `select()`, not `select()` alone --
|
|
1922
|
+
// `select()` only guarantees the SELECTION,
|
|
1923
|
+
// focus is a side effect some engines don't
|
|
1924
|
+
// give it for free.
|
|
1925
|
+
clipboardProxyRef.current?.focus();
|
|
1926
|
+
clipboardProxyRef.current?.select();
|
|
1927
|
+
// #579: a truncated cell also opens a read-only
|
|
1928
|
+
// overlay with its full value -- settled live
|
|
1929
|
+
// that this is click, not Attio's usual
|
|
1930
|
+
// hover-expand (a 1s hover on a truncated
|
|
1931
|
+
// Description cell produced nothing). Measured
|
|
1932
|
+
// the same way as `ThLabel`'s header tooltip
|
|
1933
|
+
// (#534): scrollWidth vs clientWidth on the
|
|
1934
|
+
// element the CSS ellipsis actually applies to,
|
|
1935
|
+
// which for a data cell is the `td` itself
|
|
1936
|
+
// (table.recipe.ts's own `overflow: hidden;
|
|
1937
|
+
// text-overflow: ellipsis`), not a nested span.
|
|
1938
|
+
// Skipped on a Shift+Click (crisp/#645) -- that
|
|
1939
|
+
// gesture's own intent is extending the range,
|
|
1940
|
+
// not popping open a read-only overlay on top
|
|
1941
|
+
// of it.
|
|
1942
|
+
setExpandedCell(!e.shiftKey && isLabelTruncated(e.currentTarget)
|
|
1943
|
+
? { id: row.id, key: col.key }
|
|
1944
|
+
: null);
|
|
1945
|
+
}, onDoubleClick: col.editable
|
|
1946
|
+
? () => openEditing(row.id, col.key)
|
|
1947
|
+
: undefined, onContextMenu: () => {
|
|
1948
|
+
// Right-clicking targets THAT cell for the
|
|
1949
|
+
// menu regardless of what was previously
|
|
1950
|
+
// selected (crisp/#598) -- collapses any
|
|
1951
|
+
// active range, same as a plain left-click.
|
|
1952
|
+
setSelAnchor(null);
|
|
1953
|
+
setRowSelectAnchor(null);
|
|
1954
|
+
setSelCell({ id: row.id, key: col.key });
|
|
1955
|
+
clipboardProxyRef.current?.focus();
|
|
1956
|
+
clipboardProxyRef.current?.select();
|
|
1957
|
+
}, children: cellContent }) }, col.key));
|
|
1415
1958
|
})] }, row.id));
|
|
1416
1959
|
}), bottomSpacerHeight > 0 && ((0, jsx_runtime_1.jsx)("tr", { "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)("td", { colSpan: totalCols, style: {
|
|
1417
1960
|
height: bottomSpacerHeight,
|
|
1418
1961
|
padding: 0,
|
|
1419
1962
|
border: "none",
|
|
1420
|
-
} }) }))] })) }), (hasSummary || onAddRow) && ((0, jsx_runtime_1.jsxs)(table_1.TableFooter, { children: [hasSummary && ((0, jsx_runtime_1.jsxs)(table_1.TableRow, { children: [showGrip && (0, jsx_runtime_1.jsx)(table_1.TableCell, { ...stickyCol(-2) }), selectable && (0, jsx_runtime_1.jsx)(table_1.TableCell, { ...stickyCol(-1) }), colSlots.map((slot) => slot.type === "spacer" ? ((0, jsx_runtime_1.jsx)("td", { role: "presentation", "aria-hidden": "true", style: { padding: 0, border: "none" } }, `__spacer_${slot.side}`)) : ((0, jsx_runtime_1.jsx)(table_1.TableCell, { align: alignFor(columns[slot.i]), "aria-colindex": colAriaIndex(slot.i), ...dataStickyCol(slot.i), children: columns[slot.i].
|
|
1421
|
-
|
|
1422
|
-
: null }, columns[slot.i].key)))] })), onAddRow && ((0, jsx_runtime_1.jsx)(table_1.TableRow, { children: (0, jsx_runtime_1.jsx)(table_1.TableCell, { className: "crisp-datatable-addcell", colSpan: totalCols, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "crisp-datatable-addrow", onClick: onAddRow, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }), addRowLabel] }) }) }))] }))] })] }));
|
|
1963
|
+
} }) }))] })) }), (hasSummary || onAddRow) && ((0, jsx_runtime_1.jsxs)(table_1.TableFooter, { children: [hasSummary && ((0, jsx_runtime_1.jsxs)(table_1.TableRow, { children: [showGrip && (0, jsx_runtime_1.jsx)(table_1.TableCell, { ...stickyCol(-2) }), selectable && (0, jsx_runtime_1.jsx)(table_1.TableCell, { ...stickyCol(-1) }), colSlots.map((slot) => slot.type === "spacer" ? ((0, jsx_runtime_1.jsx)("td", { role: "presentation", "aria-hidden": "true", style: { padding: 0, border: "none" } }, `__spacer_${slot.side}`)) : ((0, jsx_runtime_1.jsx)(table_1.TableCell, { align: alignFor(columns[slot.i]), "aria-colindex": colAriaIndex(slot.i), ...dataStickyCol(slot.i), children: columns[slot.i].calc ? ((0, jsx_runtime_1.jsx)(columncalc_1.ColumnCalc, { rows: rows, value: (row) => cellValue(columns[slot.i], row), numeric: columns[slot.i].type === "number" ||
|
|
1964
|
+
columns[slot.i].type === "currency", defaultOp: columns[slot.i].calc?.defaultOp, op: columns[slot.i].calc?.op, onOpChange: columns[slot.i].calc?.onOpChange, align: alignFor(columns[slot.i]) })) : columns[slot.i].summary ? (columns[slot.i].summary?.(rows)) : null }, columns[slot.i].key)))] })), onAddRow && ((0, jsx_runtime_1.jsx)(table_1.TableRow, { children: (0, jsx_runtime_1.jsx)(table_1.TableCell, { className: "crisp-datatable-addcell", colSpan: totalCols, children: (0, jsx_runtime_1.jsxs)("button", { type: "button", className: "crisp-datatable-addrow", onClick: onAddRow, children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }), addRowLabel] }) }) }))] }))] })] }));
|
|
1423
1965
|
}
|
|
1424
1966
|
DataTable.displayName = "DataTable";
|