@xcelsior/ui-spreadsheets 1.0.6 → 1.0.8
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/.turbo/turbo-build.log +22 -0
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +87 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/CommentModals.tsx +63 -6
- package/src/components/Spreadsheet.stories.tsx +11 -0
- package/src/components/Spreadsheet.tsx +35 -17
- package/src/components/SpreadsheetCell.tsx +200 -197
- package/src/types.ts +5 -3
- package/.turbo/turbo-lint.log +0 -61
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
> @xcelsior/ui-spreadsheets@1.0.8 build /home/circleci/repo/packages/ui/ui-spreadsheets
|
|
3
|
+
> tsup && tsc --noEmit
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.5.1
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/circleci/repo/packages/ui/ui-spreadsheets/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: es2020
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mCJS[39m Build start
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m147.91 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m4.62 MB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 418ms
|
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m159.10 KB[39m
|
|
17
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m4.61 MB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 418ms
|
|
19
|
+
[34mDTS[39m Build start
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 3997ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m22.18 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m22.18 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -253,6 +253,8 @@ interface SpreadsheetProps<T = any> {
|
|
|
253
253
|
onRowDoubleClick?: (row: T, rowIndex: number) => void;
|
|
254
254
|
/** Callback when a row is cloned/duplicated */
|
|
255
255
|
onRowClone?: (row: T, rowId: string | number) => void;
|
|
256
|
+
/** Callback when a row is deleted */
|
|
257
|
+
onRowDelete?: (row: T, rowId: string | number) => void;
|
|
256
258
|
/** Callback when a cell comment is added */
|
|
257
259
|
onAddCellComment?: (rowId: string | number, columnId: string, comment: string) => void;
|
|
258
260
|
/** Callback when row highlight is toggled */
|
|
@@ -377,10 +379,10 @@ interface SpreadsheetCellProps {
|
|
|
377
379
|
rightOffset?: number;
|
|
378
380
|
/** Callback when cell is clicked */
|
|
379
381
|
onClick?: (event: React$1.MouseEvent) => void;
|
|
380
|
-
/** Callback when cell value changes */
|
|
382
|
+
/** Callback when cell value changes (only called on blur/confirm, not during typing) */
|
|
381
383
|
onChange?: (newValue: any) => void;
|
|
382
|
-
/** Callback when editing is confirmed */
|
|
383
|
-
onConfirm?: () => void;
|
|
384
|
+
/** Callback when editing is confirmed, receives the final value */
|
|
385
|
+
onConfirm?: (finalValue?: any) => void;
|
|
384
386
|
/** Callback when editing is cancelled */
|
|
385
387
|
onCancel?: () => void;
|
|
386
388
|
/** Callback to copy value down */
|
|
@@ -554,7 +556,7 @@ interface SpreadsheetColumnGroupHeaderProps {
|
|
|
554
556
|
* />
|
|
555
557
|
* ```
|
|
556
558
|
*/
|
|
557
|
-
declare function Spreadsheet<T extends Record<string, any>>({ data, columns, columnGroups, getRowId, onCellEdit, onSelectionChange, onSortChange, onFilterChange, onRowClick, onRowDoubleClick, onRowClone, onAddCellComment, onRowHighlight, showToolbar, showPagination, showRowIndex, enableRowSelection, enableCellEditing, enableComments, enableHighlighting, enableUndoRedo, defaultPageSize, pageSizeOptions, defaultZoom, autoSave, compactMode, isLoading, className, emptyMessage, rowHighlights: externalRowHighlights, cellComments: externalCellComments, rowActions, serverSide, totalItems, currentPage: controlledCurrentPage, pageSize: controlledPageSize, onPageChange, sortConfig: controlledSortConfig, filters: controlledFilters, }: SpreadsheetProps<T>): react_jsx_runtime.JSX.Element;
|
|
559
|
+
declare function Spreadsheet<T extends Record<string, any>>({ data, columns, columnGroups, getRowId, onCellEdit, onSelectionChange, onSortChange, onFilterChange, onRowClick, onRowDoubleClick, onRowClone, onRowDelete, onAddCellComment, onRowHighlight, showToolbar, showPagination, showRowIndex, enableRowSelection, enableCellEditing, enableComments, enableHighlighting, enableUndoRedo, defaultPageSize, pageSizeOptions, defaultZoom, autoSave, compactMode, isLoading, className, emptyMessage, rowHighlights: externalRowHighlights, cellComments: externalCellComments, rowActions, serverSide, totalItems, currentPage: controlledCurrentPage, pageSize: controlledPageSize, onPageChange, sortConfig: controlledSortConfig, filters: controlledFilters, }: SpreadsheetProps<T>): react_jsx_runtime.JSX.Element;
|
|
558
560
|
declare namespace Spreadsheet {
|
|
559
561
|
var displayName: string;
|
|
560
562
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -253,6 +253,8 @@ interface SpreadsheetProps<T = any> {
|
|
|
253
253
|
onRowDoubleClick?: (row: T, rowIndex: number) => void;
|
|
254
254
|
/** Callback when a row is cloned/duplicated */
|
|
255
255
|
onRowClone?: (row: T, rowId: string | number) => void;
|
|
256
|
+
/** Callback when a row is deleted */
|
|
257
|
+
onRowDelete?: (row: T, rowId: string | number) => void;
|
|
256
258
|
/** Callback when a cell comment is added */
|
|
257
259
|
onAddCellComment?: (rowId: string | number, columnId: string, comment: string) => void;
|
|
258
260
|
/** Callback when row highlight is toggled */
|
|
@@ -377,10 +379,10 @@ interface SpreadsheetCellProps {
|
|
|
377
379
|
rightOffset?: number;
|
|
378
380
|
/** Callback when cell is clicked */
|
|
379
381
|
onClick?: (event: React$1.MouseEvent) => void;
|
|
380
|
-
/** Callback when cell value changes */
|
|
382
|
+
/** Callback when cell value changes (only called on blur/confirm, not during typing) */
|
|
381
383
|
onChange?: (newValue: any) => void;
|
|
382
|
-
/** Callback when editing is confirmed */
|
|
383
|
-
onConfirm?: () => void;
|
|
384
|
+
/** Callback when editing is confirmed, receives the final value */
|
|
385
|
+
onConfirm?: (finalValue?: any) => void;
|
|
384
386
|
/** Callback when editing is cancelled */
|
|
385
387
|
onCancel?: () => void;
|
|
386
388
|
/** Callback to copy value down */
|
|
@@ -554,7 +556,7 @@ interface SpreadsheetColumnGroupHeaderProps {
|
|
|
554
556
|
* />
|
|
555
557
|
* ```
|
|
556
558
|
*/
|
|
557
|
-
declare function Spreadsheet<T extends Record<string, any>>({ data, columns, columnGroups, getRowId, onCellEdit, onSelectionChange, onSortChange, onFilterChange, onRowClick, onRowDoubleClick, onRowClone, onAddCellComment, onRowHighlight, showToolbar, showPagination, showRowIndex, enableRowSelection, enableCellEditing, enableComments, enableHighlighting, enableUndoRedo, defaultPageSize, pageSizeOptions, defaultZoom, autoSave, compactMode, isLoading, className, emptyMessage, rowHighlights: externalRowHighlights, cellComments: externalCellComments, rowActions, serverSide, totalItems, currentPage: controlledCurrentPage, pageSize: controlledPageSize, onPageChange, sortConfig: controlledSortConfig, filters: controlledFilters, }: SpreadsheetProps<T>): react_jsx_runtime.JSX.Element;
|
|
559
|
+
declare function Spreadsheet<T extends Record<string, any>>({ data, columns, columnGroups, getRowId, onCellEdit, onSelectionChange, onSortChange, onFilterChange, onRowClick, onRowDoubleClick, onRowClone, onRowDelete, onAddCellComment, onRowHighlight, showToolbar, showPagination, showRowIndex, enableRowSelection, enableCellEditing, enableComments, enableHighlighting, enableUndoRedo, defaultPageSize, pageSizeOptions, defaultZoom, autoSave, compactMode, isLoading, className, emptyMessage, rowHighlights: externalRowHighlights, cellComments: externalCellComments, rowActions, serverSide, totalItems, currentPage: controlledCurrentPage, pageSize: controlledPageSize, onPageChange, sortConfig: controlledSortConfig, filters: controlledFilters, }: SpreadsheetProps<T>): react_jsx_runtime.JSX.Element;
|
|
558
560
|
declare namespace Spreadsheet {
|
|
559
561
|
var displayName: string;
|
|
560
562
|
}
|
package/dist/index.js
CHANGED
|
@@ -152,6 +152,9 @@ function HiReply(props) {
|
|
|
152
152
|
function HiSortAscending(props) {
|
|
153
153
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "d": "M3 3a1 1 0 000 2h11a1 1 0 100-2H3zM3 7a1 1 0 000 2h5a1 1 0 000-2H3zM3 11a1 1 0 100 2h4a1 1 0 100-2H3zM13 16a1 1 0 102 0v-5.586l1.293 1.293a1 1 0 001.414-1.414l-3-3a1 1 0 00-1.414 0l-3 3a1 1 0 101.414 1.414L13 10.414V16z" } }] })(props);
|
|
154
154
|
}
|
|
155
|
+
function HiTrash(props) {
|
|
156
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z", "clipRule": "evenodd" } }] })(props);
|
|
157
|
+
}
|
|
155
158
|
function HiViewBoards(props) {
|
|
156
159
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "d": "M2 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1H3a1 1 0 01-1-1V4zM8 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1H9a1 1 0 01-1-1V4zM15 3a1 1 0 00-1 1v12a1 1 0 001 1h2a1 1 0 001-1V4a1 1 0 00-1-1h-2z" } }] })(props);
|
|
157
160
|
}
|
|
@@ -253,12 +256,11 @@ var SpreadsheetCell = ({
|
|
|
253
256
|
const handleKeyDown = (e) => {
|
|
254
257
|
if (e.key === "Enter") {
|
|
255
258
|
e.preventDefault();
|
|
256
|
-
onConfirm?.();
|
|
259
|
+
onConfirm?.(localValue);
|
|
257
260
|
} else if (e.key === "Escape") {
|
|
258
261
|
e.preventDefault();
|
|
259
262
|
e.stopPropagation();
|
|
260
263
|
setLocalValue(value);
|
|
261
|
-
onChange?.(value);
|
|
262
264
|
onCancel?.();
|
|
263
265
|
}
|
|
264
266
|
};
|
|
@@ -291,12 +293,12 @@ var SpreadsheetCell = ({
|
|
|
291
293
|
ref: selectRef,
|
|
292
294
|
value: localValue ?? "",
|
|
293
295
|
onChange: (e) => {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
onConfirm?.();
|
|
296
|
+
const newValue = e.target.value;
|
|
297
|
+
setLocalValue(newValue);
|
|
298
|
+
onConfirm?.(newValue);
|
|
297
299
|
},
|
|
298
300
|
onKeyDown: handleKeyDown,
|
|
299
|
-
onBlur: () => onConfirm?.(),
|
|
301
|
+
onBlur: () => onConfirm?.(localValue),
|
|
300
302
|
className: cn(
|
|
301
303
|
"w-full border border-gray-300 rounded text-xs focus:outline-none focus:ring-1 focus:ring-blue-500",
|
|
302
304
|
compactMode ? "px-1 py-0.5" : "px-2 py-1"
|
|
@@ -315,10 +317,13 @@ var SpreadsheetCell = ({
|
|
|
315
317
|
onChange: (e) => {
|
|
316
318
|
const newValue = column.type === "number" ? e.target.value === "" ? "" : parseFloat(e.target.value) : e.target.value;
|
|
317
319
|
setLocalValue(newValue);
|
|
318
|
-
onChange?.(newValue);
|
|
319
320
|
},
|
|
320
321
|
onKeyDown: handleKeyDown,
|
|
321
|
-
onBlur: () => onConfirm?.(),
|
|
322
|
+
onBlur: () => onConfirm?.(localValue),
|
|
323
|
+
autoComplete: "off",
|
|
324
|
+
autoCorrect: "off",
|
|
325
|
+
autoCapitalize: "off",
|
|
326
|
+
spellCheck: false,
|
|
322
327
|
className: cn(
|
|
323
328
|
"w-full border border-gray-300 rounded text-xs focus:outline-none focus:ring-1 focus:ring-blue-500 bg-yellow-50",
|
|
324
329
|
compactMode ? "px-1 py-0.5" : "px-2 py-1"
|
|
@@ -328,7 +333,7 @@ var SpreadsheetCell = ({
|
|
|
328
333
|
};
|
|
329
334
|
const cellPadding = compactMode ? cellPaddingCompact : cellPaddingNormal;
|
|
330
335
|
const handleCellKeyDown = (e) => {
|
|
331
|
-
if (e.key === " ") {
|
|
336
|
+
if (e.key === " " && !isEditing) {
|
|
332
337
|
e.preventDefault();
|
|
333
338
|
onClick?.(e);
|
|
334
339
|
}
|
|
@@ -2037,12 +2042,7 @@ SpreadsheetSettingsModal.displayName = "SpreadsheetSettingsModal";
|
|
|
2037
2042
|
// src/components/CommentModals.tsx
|
|
2038
2043
|
var import_react9 = require("react");
|
|
2039
2044
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2040
|
-
function AddCommentModal({
|
|
2041
|
-
isOpen,
|
|
2042
|
-
columnLabel,
|
|
2043
|
-
onAdd,
|
|
2044
|
-
onClose
|
|
2045
|
-
}) {
|
|
2045
|
+
function AddCommentModal({ isOpen, columnLabel, onAdd, onClose }) {
|
|
2046
2046
|
const [commentText, setCommentText] = (0, import_react9.useState)("");
|
|
2047
2047
|
(0, import_react9.useEffect)(() => {
|
|
2048
2048
|
if (!isOpen) {
|
|
@@ -2070,6 +2070,10 @@ function AddCommentModal({
|
|
|
2070
2070
|
{
|
|
2071
2071
|
value: commentText,
|
|
2072
2072
|
onChange: (e) => setCommentText(e.target.value),
|
|
2073
|
+
onKeyDown: (e) => {
|
|
2074
|
+
e.stopPropagation();
|
|
2075
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
2076
|
+
},
|
|
2073
2077
|
placeholder: "Enter your comment...",
|
|
2074
2078
|
className: "w-full h-24 p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none",
|
|
2075
2079
|
autoFocus: true
|
|
@@ -2170,6 +2174,44 @@ function ViewCommentsModal({
|
|
|
2170
2174
|
] }) });
|
|
2171
2175
|
}
|
|
2172
2176
|
ViewCommentsModal.displayName = "ViewCommentsModal";
|
|
2177
|
+
function DeleteConfirmationModal({
|
|
2178
|
+
isOpen,
|
|
2179
|
+
title = "Delete Row",
|
|
2180
|
+
message = "Are you sure you want to delete this row? This action cannot be undone.",
|
|
2181
|
+
confirmLabel = "Delete",
|
|
2182
|
+
onConfirm,
|
|
2183
|
+
onClose
|
|
2184
|
+
}) {
|
|
2185
|
+
if (!isOpen) return null;
|
|
2186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-white rounded-lg shadow-xl p-6 w-96 max-w-full mx-4", children: [
|
|
2187
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold mb-2", children: title }),
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-gray-600 mb-6", children: message }),
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-end gap-2", children: [
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2191
|
+
"button",
|
|
2192
|
+
{
|
|
2193
|
+
type: "button",
|
|
2194
|
+
onClick: onClose,
|
|
2195
|
+
className: "px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg transition-colors",
|
|
2196
|
+
children: "Cancel"
|
|
2197
|
+
}
|
|
2198
|
+
),
|
|
2199
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2200
|
+
"button",
|
|
2201
|
+
{
|
|
2202
|
+
type: "button",
|
|
2203
|
+
onClick: () => {
|
|
2204
|
+
onConfirm();
|
|
2205
|
+
onClose();
|
|
2206
|
+
},
|
|
2207
|
+
className: "px-4 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors",
|
|
2208
|
+
children: confirmLabel
|
|
2209
|
+
}
|
|
2210
|
+
)
|
|
2211
|
+
] })
|
|
2212
|
+
] }) });
|
|
2213
|
+
}
|
|
2214
|
+
DeleteConfirmationModal.displayName = "DeleteConfirmationModal";
|
|
2173
2215
|
|
|
2174
2216
|
// src/components/KeyboardShortcutsModal.tsx
|
|
2175
2217
|
var import_react10 = __toESM(require("react"));
|
|
@@ -2836,6 +2878,7 @@ function Spreadsheet({
|
|
|
2836
2878
|
onRowClick,
|
|
2837
2879
|
onRowDoubleClick,
|
|
2838
2880
|
onRowClone,
|
|
2881
|
+
onRowDelete,
|
|
2839
2882
|
onAddCellComment,
|
|
2840
2883
|
onRowHighlight,
|
|
2841
2884
|
showToolbar = true,
|
|
@@ -2953,7 +2996,6 @@ function Spreadsheet({
|
|
|
2953
2996
|
const [lastSelectedRow, setLastSelectedRow] = (0, import_react15.useState)(null);
|
|
2954
2997
|
const [focusedCell, setFocusedCell] = (0, import_react15.useState)(null);
|
|
2955
2998
|
const [editingCell, setEditingCell] = (0, import_react15.useState)(null);
|
|
2956
|
-
const [editValue, setEditValue] = (0, import_react15.useState)("");
|
|
2957
2999
|
const [hoveredRow, setHoveredRow] = (0, import_react15.useState)(null);
|
|
2958
3000
|
const [internalCurrentPage, setInternalCurrentPage] = (0, import_react15.useState)(1);
|
|
2959
3001
|
const [internalPageSize, setInternalPageSize] = (0, import_react15.useState)(defaultPageSize);
|
|
@@ -3100,9 +3142,7 @@ function Spreadsheet({
|
|
|
3100
3142
|
if (column?.editable && enableCellEditing) {
|
|
3101
3143
|
const row = (data || []).find((r) => getRowId(r) === focusedCell.rowId);
|
|
3102
3144
|
if (row) {
|
|
3103
|
-
const value = column.getValue ? column.getValue(row) : row[focusedCell.columnId];
|
|
3104
3145
|
setEditingCell({ rowId: focusedCell.rowId, columnId: focusedCell.columnId });
|
|
3105
|
-
setEditValue(value);
|
|
3106
3146
|
}
|
|
3107
3147
|
}
|
|
3108
3148
|
}, [focusedCell, columns, data, getRowId, enableCellEditing]);
|
|
@@ -3182,9 +3222,7 @@ function Spreadsheet({
|
|
|
3182
3222
|
if (column?.editable && enableCellEditing) {
|
|
3183
3223
|
const row = (data || []).find((r) => getRowId(r) === rowId);
|
|
3184
3224
|
if (row) {
|
|
3185
|
-
const value = column.getValue ? column.getValue(row) : row[columnId];
|
|
3186
3225
|
setEditingCell({ rowId, columnId });
|
|
3187
|
-
setEditValue(value);
|
|
3188
3226
|
}
|
|
3189
3227
|
}
|
|
3190
3228
|
},
|
|
@@ -3211,15 +3249,17 @@ function Spreadsheet({
|
|
|
3211
3249
|
},
|
|
3212
3250
|
[data, getRowId, enableUndoRedo, onCellEdit, pushToUndoStack, markAsChanged]
|
|
3213
3251
|
);
|
|
3214
|
-
const handleConfirmEdit = (0, import_react15.useCallback)(
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3252
|
+
const handleConfirmEdit = (0, import_react15.useCallback)(
|
|
3253
|
+
(finalValue) => {
|
|
3254
|
+
if (editingCell && finalValue !== void 0) {
|
|
3255
|
+
handleCellChange(editingCell.rowId, editingCell.columnId, finalValue);
|
|
3256
|
+
setEditingCell(null);
|
|
3257
|
+
}
|
|
3258
|
+
},
|
|
3259
|
+
[editingCell, handleCellChange]
|
|
3260
|
+
);
|
|
3220
3261
|
const handleCancelEdit = (0, import_react15.useCallback)(() => {
|
|
3221
3262
|
setEditingCell(null);
|
|
3222
|
-
setEditValue("");
|
|
3223
3263
|
}, []);
|
|
3224
3264
|
const handleRowClone = (0, import_react15.useCallback)(
|
|
3225
3265
|
(row, rowId) => {
|
|
@@ -3227,6 +3267,12 @@ function Spreadsheet({
|
|
|
3227
3267
|
},
|
|
3228
3268
|
[onRowClone]
|
|
3229
3269
|
);
|
|
3270
|
+
const handleRowDelete = (0, import_react15.useCallback)(
|
|
3271
|
+
(row, rowId) => {
|
|
3272
|
+
onRowDelete?.(row, rowId);
|
|
3273
|
+
},
|
|
3274
|
+
[onRowDelete]
|
|
3275
|
+
);
|
|
3230
3276
|
const handleRowIndexHighlightClick = (0, import_react15.useCallback)(() => {
|
|
3231
3277
|
setHighlightPickerColumn(ROW_INDEX_COLUMN_ID);
|
|
3232
3278
|
}, [setHighlightPickerColumn]);
|
|
@@ -3430,6 +3476,19 @@ function Spreadsheet({
|
|
|
3430
3476
|
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HiDuplicate, { className: "h-2.5 w-2.5 text-gray-500" })
|
|
3431
3477
|
}
|
|
3432
3478
|
),
|
|
3479
|
+
onRowDelete && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3480
|
+
"button",
|
|
3481
|
+
{
|
|
3482
|
+
type: "button",
|
|
3483
|
+
onClick: (e) => {
|
|
3484
|
+
e.stopPropagation();
|
|
3485
|
+
handleRowDelete(row, rowId);
|
|
3486
|
+
},
|
|
3487
|
+
className: "opacity-0 group-hover:opacity-100 transition-opacity p-0.5 bg-gray-100 hover:bg-red-100 rounded",
|
|
3488
|
+
title: "Delete row",
|
|
3489
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HiTrash, { className: "h-2.5 w-2.5 text-gray-500 hover:text-red-500" })
|
|
3490
|
+
}
|
|
3491
|
+
),
|
|
3433
3492
|
enableHighlighting && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3434
3493
|
"button",
|
|
3435
3494
|
{
|
|
@@ -3537,7 +3596,7 @@ function Spreadsheet({
|
|
|
3537
3596
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3538
3597
|
MemoizedSpreadsheetCell,
|
|
3539
3598
|
{
|
|
3540
|
-
value
|
|
3599
|
+
value,
|
|
3541
3600
|
column,
|
|
3542
3601
|
row,
|
|
3543
3602
|
rowIndex,
|
|
@@ -3554,7 +3613,6 @@ function Spreadsheet({
|
|
|
3554
3613
|
pinSide: colPinSide,
|
|
3555
3614
|
leftOffset: getColumnLeftOffset(column.id),
|
|
3556
3615
|
onClick: (e) => handleCellClick(rowId, column.id, e),
|
|
3557
|
-
onChange: (newValue) => setEditValue(newValue),
|
|
3558
3616
|
onConfirm: handleConfirmEdit,
|
|
3559
3617
|
onCancel: handleCancelEdit,
|
|
3560
3618
|
onHighlight: enableHighlighting ? () => {
|