@skygraph/react 0.0.0-placeholder.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Table-BqN2u5ma.d.cts +1015 -0
  3. package/dist/Table-IvijKCyd.d.ts +1015 -0
  4. package/dist/chunk-2OCEO636.js +91 -0
  5. package/dist/chunk-2OCEO636.js.map +1 -0
  6. package/dist/chunk-6SHHUUAE.js +1667 -0
  7. package/dist/chunk-6SHHUUAE.js.map +1 -0
  8. package/dist/chunk-BNMJSYI2.js +54 -0
  9. package/dist/chunk-BNMJSYI2.js.map +1 -0
  10. package/dist/chunk-DRBAZI46.js +57 -0
  11. package/dist/chunk-DRBAZI46.js.map +1 -0
  12. package/dist/chunk-GJDDPZH7.js +226 -0
  13. package/dist/chunk-GJDDPZH7.js.map +1 -0
  14. package/dist/chunk-KCFWFDSP.js +847 -0
  15. package/dist/chunk-KCFWFDSP.js.map +1 -0
  16. package/dist/chunk-MJAEAFPN.js +3791 -0
  17. package/dist/chunk-MJAEAFPN.js.map +1 -0
  18. package/dist/chunk-MLEBVELO.js +1412 -0
  19. package/dist/chunk-MLEBVELO.js.map +1 -0
  20. package/dist/chunk-SEQI65CF.js +61 -0
  21. package/dist/chunk-SEQI65CF.js.map +1 -0
  22. package/dist/chunk-ZJF6SJLP.js +200 -0
  23. package/dist/chunk-ZJF6SJLP.js.map +1 -0
  24. package/dist/common-CdpocIEz.d.cts +27 -0
  25. package/dist/common-CdpocIEz.d.ts +27 -0
  26. package/dist/datagrid-B6hg5yJh.d.cts +200 -0
  27. package/dist/datagrid-B6hg5yJh.d.ts +200 -0
  28. package/dist/datagrid.cjs +1052 -0
  29. package/dist/datagrid.cjs.map +1 -0
  30. package/dist/datagrid.d.cts +2 -0
  31. package/dist/datagrid.d.ts +2 -0
  32. package/dist/datagrid.js +10 -0
  33. package/dist/datagrid.js.map +1 -0
  34. package/dist/devtools.cjs +253 -0
  35. package/dist/devtools.cjs.map +1 -0
  36. package/dist/devtools.d.cts +29 -0
  37. package/dist/devtools.d.ts +29 -0
  38. package/dist/devtools.js +9 -0
  39. package/dist/devtools.js.map +1 -0
  40. package/dist/form.cjs +1723 -0
  41. package/dist/form.cjs.map +1 -0
  42. package/dist/form.d.cts +530 -0
  43. package/dist/form.d.ts +530 -0
  44. package/dist/form.js +49 -0
  45. package/dist/form.js.map +1 -0
  46. package/dist/index.cjs +22419 -0
  47. package/dist/index.cjs.map +1 -0
  48. package/dist/index.d.cts +3671 -0
  49. package/dist/index.d.ts +3671 -0
  50. package/dist/index.js +14087 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/table.cjs +4130 -0
  53. package/dist/table.cjs.map +1 -0
  54. package/dist/table.d.cts +31 -0
  55. package/dist/table.d.ts +31 -0
  56. package/dist/table.js +26 -0
  57. package/dist/table.js.map +1 -0
  58. package/dist/tree.cjs +1821 -0
  59. package/dist/tree.cjs.map +1 -0
  60. package/dist/tree.d.cts +348 -0
  61. package/dist/tree.d.ts +348 -0
  62. package/dist/tree.js +13 -0
  63. package/dist/tree.js.map +1 -0
  64. package/dist/virtual.cjs +145 -0
  65. package/dist/virtual.cjs.map +1 -0
  66. package/dist/virtual.d.cts +50 -0
  67. package/dist/virtual.d.ts +50 -0
  68. package/dist/virtual.js +11 -0
  69. package/dist/virtual.js.map +1 -0
  70. package/package.json +108 -18
  71. package/README.md +0 -12
  72. package/index.js +0 -3
@@ -0,0 +1,1052 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/datagrid.ts
31
+ var datagrid_exports = {};
32
+ __export(datagrid_exports, {
33
+ DataGrid: () => DataGrid
34
+ });
35
+ module.exports = __toCommonJS(datagrid_exports);
36
+
37
+ // src/components/complex/DataGrid/DataGrid.tsx
38
+ var import_react6 = __toESM(require("react"), 1);
39
+
40
+ // src/hooks/useVirtualScroll.ts
41
+ var import_react = require("react");
42
+ var import_core = require("@skygraph/core");
43
+ function useVirtualScroll(options) {
44
+ const containerRef = (0, import_react.useRef)(null);
45
+ const engineRef = (0, import_react.useRef)(null);
46
+ if (!engineRef.current) {
47
+ engineRef.current = (0, import_core.createVirtual)({
48
+ itemCount: options.itemCount,
49
+ itemHeight: options.itemHeight,
50
+ overscan: options.overscan
51
+ });
52
+ }
53
+ const engine = engineRef.current;
54
+ (0, import_react.useEffect)(() => {
55
+ engine.setItemCount(options.itemCount);
56
+ }, [engine, options.itemCount]);
57
+ (0, import_react.useEffect)(() => {
58
+ engine.setItemHeight(options.itemHeight);
59
+ }, [engine, options.itemHeight]);
60
+ const [range, setRange] = (0, import_react.useState)(
61
+ () => engine.getRange(0, 0)
62
+ );
63
+ const recalc = (0, import_react.useCallback)(() => {
64
+ const el = containerRef.current;
65
+ if (!el) return;
66
+ setRange(engine.getRange(el.scrollTop, el.clientHeight));
67
+ }, [engine]);
68
+ (0, import_react.useEffect)(() => {
69
+ const el = containerRef.current;
70
+ if (!el) return;
71
+ recalc();
72
+ el.addEventListener("scroll", recalc, { passive: true });
73
+ const ro = new ResizeObserver(recalc);
74
+ ro.observe(el);
75
+ return () => {
76
+ el.removeEventListener("scroll", recalc);
77
+ ro.disconnect();
78
+ };
79
+ }, [recalc]);
80
+ (0, import_react.useEffect)(() => {
81
+ recalc();
82
+ }, [options.itemCount, recalc]);
83
+ const scrollToIndex = (0, import_react.useCallback)(
84
+ (index, align = "start") => {
85
+ const el = containerRef.current;
86
+ if (!el) return;
87
+ el.scrollTop = engine.scrollToIndex(index, el.clientHeight, align);
88
+ },
89
+ [engine]
90
+ );
91
+ return (0, import_react.useMemo)(
92
+ () => ({ range, containerRef, scrollToIndex, engine }),
93
+ [range, scrollToIndex, engine]
94
+ );
95
+ }
96
+
97
+ // src/components/ui/Spin.tsx
98
+ var import_react3 = __toESM(require("react"), 1);
99
+
100
+ // src/components/ConfigProvider.tsx
101
+ var import_react2 = require("react");
102
+ var import_jsx_runtime = require("react/jsx-runtime");
103
+ var SgConfigContext = (0, import_react2.createContext)({});
104
+ function useConfig() {
105
+ return (0, import_react2.useContext)(SgConfigContext);
106
+ }
107
+
108
+ // src/components/ui/Spin.tsx
109
+ var import_jsx_runtime2 = require("react/jsx-runtime");
110
+ function Spin({
111
+ spinning = true,
112
+ size: sizeProp,
113
+ delay,
114
+ tip,
115
+ fullscreen,
116
+ indicator,
117
+ children,
118
+ className,
119
+ style,
120
+ unstyled
121
+ }) {
122
+ const config = useConfig();
123
+ const resolvedSize = sizeProp ?? config.size ?? "middle";
124
+ const [visible, setVisible] = import_react3.default.useState(delay ? false : spinning);
125
+ import_react3.default.useEffect(() => {
126
+ if (!delay) {
127
+ setVisible(spinning);
128
+ return;
129
+ }
130
+ if (spinning) {
131
+ const timer = setTimeout(() => setVisible(true), delay);
132
+ return () => clearTimeout(timer);
133
+ }
134
+ setVisible(false);
135
+ }, [spinning, delay]);
136
+ if (!visible && !children) return null;
137
+ if (!visible && children) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
138
+ const spinSizeClass = resolvedSize === "middle" ? "default" : resolvedSize;
139
+ const spinClasses = unstyled ? className ?? "" : ["sg-spin", `sg-spin-${spinSizeClass}`, className].filter(Boolean).join(" ");
140
+ const spinElement = indicator ?? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
141
+ "span",
142
+ {
143
+ className: spinClasses,
144
+ style,
145
+ role: "status",
146
+ "aria-live": "polite",
147
+ "aria-label": config.locale?.spin?.loading ?? "Loading"
148
+ }
149
+ );
150
+ if (fullscreen) {
151
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: unstyled ? "" : "sg-spin-fullscreen", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: unstyled ? "" : "sg-spin-fullscreen-inner", children: [
152
+ spinElement,
153
+ tip && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: unstyled ? "" : "sg-spin-tip", children: tip })
154
+ ] }) });
155
+ }
156
+ if (!children) {
157
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: unstyled ? "" : "sg-spin-standalone", style, children: [
158
+ spinElement,
159
+ tip && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: unstyled ? "" : "sg-spin-tip", children: tip })
160
+ ] });
161
+ }
162
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: unstyled ? "" : "sg-spin-container", style, children: [
163
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: unstyled ? "" : "sg-spin-overlay", children: [
164
+ spinElement,
165
+ tip && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: unstyled ? "" : "sg-spin-tip", children: tip })
166
+ ] }),
167
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: visible ? unstyled ? "" : "sg-spin-blur" : "", children })
168
+ ] });
169
+ }
170
+
171
+ // src/components/ui/Checkbox.tsx
172
+ var import_react4 = __toESM(require("react"), 1);
173
+ var import_jsx_runtime3 = require("react/jsx-runtime");
174
+ function Checkbox({
175
+ checked,
176
+ defaultChecked,
177
+ disabled: disabledProp,
178
+ loading,
179
+ indeterminate,
180
+ onChange,
181
+ children,
182
+ className,
183
+ style,
184
+ unstyled
185
+ }) {
186
+ const config = useConfig();
187
+ const disabled = disabledProp ?? config.disabled ?? false;
188
+ const inputRef = import_react4.default.useRef(null);
189
+ import_react4.default.useEffect(() => {
190
+ if (inputRef.current) {
191
+ inputRef.current.indeterminate = indeterminate ?? false;
192
+ }
193
+ }, [indeterminate]);
194
+ const wrapperClass = unstyled ? className ?? "" : [
195
+ "sg-checkbox",
196
+ disabled || loading ? "sg-checkbox-disabled" : "",
197
+ loading ? "sg-checkbox-loading" : "",
198
+ className
199
+ ].filter(Boolean).join(" ");
200
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { className: wrapperClass, style, children: [
201
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
202
+ "input",
203
+ {
204
+ ref: inputRef,
205
+ type: "checkbox",
206
+ "aria-checked": checked,
207
+ className: unstyled ? "" : "sg-checkbox-input",
208
+ checked,
209
+ defaultChecked,
210
+ disabled: disabled || loading,
211
+ onChange: (e) => onChange?.(e.target.checked)
212
+ }
213
+ ),
214
+ children && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: unstyled ? "" : "sg-checkbox-label", children }),
215
+ loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spin, { size: "small", unstyled })
216
+ ] });
217
+ }
218
+
219
+ // src/components/complex/DataGrid/useDataGridState.ts
220
+ var import_react5 = require("react");
221
+ function useDataGridState(columns, data) {
222
+ const [activeCell, setActiveCell] = (0, import_react5.useState)(null);
223
+ const [editingCell, setEditingCell] = (0, import_react5.useState)(null);
224
+ const [selection, setSelection] = (0, import_react5.useState)(null);
225
+ const [columnWidths, setColumnWidths] = (0, import_react5.useState)(() => {
226
+ const map = /* @__PURE__ */ new Map();
227
+ for (const col of columns) {
228
+ if (col.width) map.set(col.key, col.width);
229
+ }
230
+ return map;
231
+ });
232
+ const [columnOrder, setColumnOrder] = (0, import_react5.useState)(null);
233
+ const editValueRef = (0, import_react5.useRef)(void 0);
234
+ const dragColumnRef = (0, import_react5.useRef)(null);
235
+ const startEditing = (0, import_react5.useCallback)(
236
+ (pos) => {
237
+ const col = columns[pos.col];
238
+ if (!col) return;
239
+ const isEditable = typeof col.editable === "function" ? col.editable(data[pos.row], pos.row) : col.editable !== false;
240
+ if (!isEditable) return;
241
+ editValueRef.current = data[pos.row][col.key];
242
+ setEditingCell(pos);
243
+ },
244
+ [columns, data]
245
+ );
246
+ const stopEditing = (0, import_react5.useCallback)(() => {
247
+ setEditingCell(null);
248
+ editValueRef.current = void 0;
249
+ }, []);
250
+ const navigate = (0, import_react5.useCallback)(
251
+ (from, direction, shiftKey = false) => {
252
+ let { row, col } = from;
253
+ switch (direction) {
254
+ case "up":
255
+ row = Math.max(0, row - 1);
256
+ break;
257
+ case "down":
258
+ row = Math.min(data.length - 1, row + 1);
259
+ break;
260
+ case "left":
261
+ col = Math.max(0, col - 1);
262
+ break;
263
+ case "right":
264
+ col = Math.min(columns.length - 1, col + 1);
265
+ break;
266
+ }
267
+ const next = { row, col };
268
+ if (shiftKey) {
269
+ setSelection((prev) => ({
270
+ start: prev?.start ?? from,
271
+ end: next
272
+ }));
273
+ } else {
274
+ setSelection(null);
275
+ }
276
+ setActiveCell(next);
277
+ return next;
278
+ },
279
+ [data.length, columns.length]
280
+ );
281
+ const resizeColumn = (0, import_react5.useCallback)(
282
+ (key, width) => {
283
+ const col = columns.find((c) => c.key === key);
284
+ const minW = col?.minWidth ?? 50;
285
+ const maxW = col?.maxWidth ?? Infinity;
286
+ const clamped = Math.max(minW, Math.min(maxW, width));
287
+ setColumnWidths((prev) => new Map(prev).set(key, clamped));
288
+ },
289
+ [columns]
290
+ );
291
+ const getColumnWidth = (0, import_react5.useCallback)(
292
+ (key) => {
293
+ return columnWidths.get(key) ?? columns.find((c) => c.key === key)?.width ?? 120;
294
+ },
295
+ [columnWidths, columns]
296
+ );
297
+ const reorderColumns = (0, import_react5.useCallback)(
298
+ (fromKey, toKey) => {
299
+ const order = columnOrder ?? columns.map((c) => c.key);
300
+ const fromIdx = order.indexOf(fromKey);
301
+ const toIdx = order.indexOf(toKey);
302
+ if (fromIdx === -1 || toIdx === -1 || fromIdx === toIdx) return order;
303
+ const next = [...order];
304
+ const [moved] = next.splice(fromIdx, 1);
305
+ next.splice(toIdx, 0, moved);
306
+ setColumnOrder(next);
307
+ return next;
308
+ },
309
+ [columnOrder, columns]
310
+ );
311
+ return {
312
+ activeCell,
313
+ setActiveCell,
314
+ editingCell,
315
+ startEditing,
316
+ stopEditing,
317
+ editValueRef,
318
+ selection,
319
+ setSelection,
320
+ navigate,
321
+ resizeColumn,
322
+ getColumnWidth,
323
+ columnOrder,
324
+ setColumnOrder,
325
+ reorderColumns,
326
+ dragColumnRef
327
+ };
328
+ }
329
+
330
+ // src/components/complex/DataGrid/DataGrid.tsx
331
+ var import_jsx_runtime4 = require("react/jsx-runtime");
332
+ var cls = {
333
+ root: "sg-datagrid",
334
+ header: "sg-datagrid-header",
335
+ headerCell: "sg-datagrid-header-cell",
336
+ body: "sg-datagrid-body",
337
+ row: "sg-datagrid-row",
338
+ rowEven: "sg-datagrid-row--even",
339
+ rowOdd: "sg-datagrid-row--odd",
340
+ rowHoverable: "sg-datagrid-row--hoverable",
341
+ rowSelected: "sg-datagrid-row--selected",
342
+ cell: "sg-datagrid-cell",
343
+ cellActive: "sg-datagrid-cell--active",
344
+ cellEditing: "sg-datagrid-cell--editing",
345
+ cellSelected: "sg-datagrid-cell--selected",
346
+ frozen: "sg-datagrid-cell--frozen",
347
+ sortable: "sg-datagrid-header-cell--sortable",
348
+ sortAsc: "sg-datagrid-header-cell--asc",
349
+ sortDesc: "sg-datagrid-header-cell--desc",
350
+ resizer: "sg-datagrid-resizer",
351
+ empty: "sg-datagrid-empty",
352
+ summary: "sg-datagrid-summary",
353
+ summaryRow: "sg-datagrid-summary-row",
354
+ summaryCell: "sg-datagrid-summary-cell",
355
+ contextMenu: "sg-datagrid-context-menu",
356
+ contextMenuItem: "sg-datagrid-context-menu-item",
357
+ contextMenuDanger: "sg-datagrid-context-menu-item--danger",
358
+ contextMenuDisabled: "sg-datagrid-context-menu-item--disabled",
359
+ contextMenuDivider: "sg-datagrid-context-menu-divider",
360
+ loading: "sg-datagrid-loading",
361
+ selectionCell: "sg-datagrid-selection-cell",
362
+ rowNumberCell: "sg-datagrid-row-number-cell",
363
+ headerDragOver: "sg-datagrid-header-cell--drag-over"
364
+ };
365
+ var SELECTION_COL_WIDTH = 40;
366
+ var ROW_NUMBER_COL_WIDTH = 48;
367
+ function DefaultEditor({ value, onChange, onCommit, onCancel }) {
368
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
369
+ "input",
370
+ {
371
+ autoFocus: true,
372
+ defaultValue: value == null ? "" : String(value),
373
+ onChange: (e) => onChange(e.target.value),
374
+ onBlur: onCommit,
375
+ onKeyDown: (e) => {
376
+ if (e.key === "Enter") onCommit();
377
+ if (e.key === "Escape") onCancel();
378
+ },
379
+ style: {
380
+ width: "100%",
381
+ height: "100%",
382
+ border: "none",
383
+ outline: "none",
384
+ padding: "0 8px",
385
+ background: "transparent",
386
+ font: "inherit"
387
+ }
388
+ }
389
+ );
390
+ }
391
+ function isCellInRange(row, col, range) {
392
+ if (!range) return false;
393
+ const minRow = Math.min(range.start.row, range.end.row);
394
+ const maxRow = Math.max(range.start.row, range.end.row);
395
+ const minCol = Math.min(range.start.col, range.end.col);
396
+ const maxCol = Math.max(range.start.col, range.end.col);
397
+ return row >= minRow && row <= maxRow && col >= minCol && col <= maxCol;
398
+ }
399
+ function ContextMenuPopup({
400
+ items,
401
+ position,
402
+ onClose
403
+ }) {
404
+ const ref = (0, import_react6.useRef)(null);
405
+ import_react6.default.useEffect(() => {
406
+ const handler = (e) => {
407
+ if (ref.current && !ref.current.contains(e.target)) onClose();
408
+ };
409
+ document.addEventListener("mousedown", handler);
410
+ return () => document.removeEventListener("mousedown", handler);
411
+ }, [onClose]);
412
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
413
+ "div",
414
+ {
415
+ ref,
416
+ className: cls.contextMenu,
417
+ style: { position: "fixed", top: position.y, left: position.x },
418
+ children: items.map(
419
+ (item) => item.divider ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cls.contextMenuDivider }, item.key) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
420
+ "div",
421
+ {
422
+ className: [
423
+ cls.contextMenuItem,
424
+ item.danger ? cls.contextMenuDanger : "",
425
+ item.disabled ? cls.contextMenuDisabled : ""
426
+ ].filter(Boolean).join(" "),
427
+ onClick: () => {
428
+ if (!item.disabled) {
429
+ item.onClick();
430
+ onClose();
431
+ }
432
+ },
433
+ children: item.label
434
+ },
435
+ item.key
436
+ )
437
+ )
438
+ }
439
+ );
440
+ }
441
+ function DataGridInner(props, ref) {
442
+ const {
443
+ columns,
444
+ data,
445
+ rowKey,
446
+ rowHeight = 36,
447
+ headerHeight = 40,
448
+ width = "100%",
449
+ height = 400,
450
+ className,
451
+ style,
452
+ onCellEdit,
453
+ sortColumn,
454
+ sortDirection,
455
+ onSort,
456
+ onCopy,
457
+ onPaste,
458
+ overscan = 5,
459
+ locale,
460
+ rowSelection,
461
+ selectedRows,
462
+ onSelectedRowsChange,
463
+ striped,
464
+ highlightOnHover = true,
465
+ showRowNumber,
466
+ summaryRows,
467
+ cellClassName,
468
+ cellStyle: cellStyleFn,
469
+ columnReorder,
470
+ onColumnOrderChange,
471
+ onContextMenu,
472
+ onRowClick,
473
+ onRowDoubleClick,
474
+ rowClassName,
475
+ loading,
476
+ emptyContent
477
+ } = props;
478
+ const containerRef = (0, import_react6.useRef)(null);
479
+ const state = useDataGridState(columns, data);
480
+ const {
481
+ activeCell,
482
+ setActiveCell,
483
+ editingCell,
484
+ startEditing,
485
+ stopEditing,
486
+ editValueRef,
487
+ selection,
488
+ navigate,
489
+ resizeColumn,
490
+ getColumnWidth,
491
+ columnOrder,
492
+ reorderColumns,
493
+ dragColumnRef
494
+ } = state;
495
+ const [ctxMenu, setCtxMenu] = (0, import_react6.useState)(null);
496
+ const [dragOverCol, setDragOverCol] = (0, import_react6.useState)(null);
497
+ const { range, containerRef: scrollRef, scrollToIndex } = useVirtualScroll({
498
+ itemCount: data.length,
499
+ itemHeight: rowHeight,
500
+ overscan
501
+ });
502
+ const getRowKey = (0, import_react6.useCallback)(
503
+ (row, index) => {
504
+ if (typeof rowKey === "function") return rowKey(row, index);
505
+ return row[rowKey];
506
+ },
507
+ [rowKey]
508
+ );
509
+ const frozenLeft = (0, import_react6.useMemo)(
510
+ () => columns.filter((c) => c.frozen === "left"),
511
+ [columns]
512
+ );
513
+ const frozenRight = (0, import_react6.useMemo)(
514
+ () => columns.filter((c) => c.frozen === "right"),
515
+ [columns]
516
+ );
517
+ const scrollable = (0, import_react6.useMemo)(
518
+ () => columns.filter((c) => !c.frozen),
519
+ [columns]
520
+ );
521
+ const orderedColumns = (0, import_react6.useMemo)(() => {
522
+ const base = [...frozenLeft, ...scrollable, ...frozenRight];
523
+ if (!columnOrder) return base;
524
+ const map = new Map(base.map((c) => [c.key, c]));
525
+ const ordered = [];
526
+ for (const key of columnOrder) {
527
+ const col = map.get(key);
528
+ if (col) ordered.push(col);
529
+ }
530
+ for (const col of base) {
531
+ if (!columnOrder.includes(col.key)) ordered.push(col);
532
+ }
533
+ return ordered;
534
+ }, [frozenLeft, scrollable, frozenRight, columnOrder]);
535
+ const extraColsWidth = (rowSelection ? SELECTION_COL_WIDTH : 0) + (showRowNumber ? ROW_NUMBER_COL_WIDTH : 0);
536
+ const totalWidth = (0, import_react6.useMemo)(
537
+ () => orderedColumns.reduce((sum, col) => sum + getColumnWidth(col.key), 0) + extraColsWidth,
538
+ [orderedColumns, getColumnWidth, extraColsWidth]
539
+ );
540
+ const allSelected = (0, import_react6.useMemo)(() => {
541
+ if (!selectedRows || data.length === 0) return false;
542
+ return data.every((row, i) => selectedRows.has(getRowKey(row, i)));
543
+ }, [selectedRows, data, getRowKey]);
544
+ const someSelected = (0, import_react6.useMemo)(() => {
545
+ if (!selectedRows || data.length === 0) return false;
546
+ const count = data.filter((row, i) => selectedRows.has(getRowKey(row, i))).length;
547
+ return count > 0 && count < data.length;
548
+ }, [selectedRows, data, getRowKey]);
549
+ const handleSelectAll = (0, import_react6.useCallback)(() => {
550
+ if (!onSelectedRowsChange) return;
551
+ if (allSelected) {
552
+ onSelectedRowsChange(/* @__PURE__ */ new Set());
553
+ } else {
554
+ const all = new Set(data.map((row, i) => getRowKey(row, i)));
555
+ onSelectedRowsChange(all);
556
+ }
557
+ }, [allSelected, data, getRowKey, onSelectedRowsChange]);
558
+ const handleSelectRow = (0, import_react6.useCallback)(
559
+ (row, index) => {
560
+ if (!onSelectedRowsChange || !selectedRows) return;
561
+ const key = getRowKey(row, index);
562
+ const next = new Set(selectedRows);
563
+ if (next.has(key)) next.delete(key);
564
+ else next.add(key);
565
+ onSelectedRowsChange(next);
566
+ },
567
+ [getRowKey, onSelectedRowsChange, selectedRows]
568
+ );
569
+ const handleCellClick = (0, import_react6.useCallback)(
570
+ (rowIndex, colIndex) => {
571
+ if (editingCell) {
572
+ if (onCellEdit && editValueRef.current !== void 0) {
573
+ onCellEdit(editingCell.row, orderedColumns[editingCell.col].key, editValueRef.current);
574
+ }
575
+ stopEditing();
576
+ }
577
+ setActiveCell({ row: rowIndex, col: colIndex });
578
+ },
579
+ [editingCell, onCellEdit, editValueRef, orderedColumns, stopEditing, setActiveCell]
580
+ );
581
+ const handleCellDoubleClick = (0, import_react6.useCallback)(
582
+ (rowIndex, colIndex) => {
583
+ startEditing({ row: rowIndex, col: colIndex });
584
+ },
585
+ [startEditing]
586
+ );
587
+ const handleCommitEdit = (0, import_react6.useCallback)(() => {
588
+ if (editingCell && onCellEdit && editValueRef.current !== void 0) {
589
+ onCellEdit(editingCell.row, orderedColumns[editingCell.col].key, editValueRef.current);
590
+ }
591
+ stopEditing();
592
+ }, [editingCell, onCellEdit, editValueRef, orderedColumns, stopEditing]);
593
+ const handleCancelEdit = (0, import_react6.useCallback)(() => {
594
+ stopEditing();
595
+ }, [stopEditing]);
596
+ const handleKeyDown = (0, import_react6.useCallback)(
597
+ (e) => {
598
+ if (!activeCell) return;
599
+ if (editingCell) return;
600
+ switch (e.key) {
601
+ case "ArrowUp":
602
+ e.preventDefault();
603
+ navigate(activeCell, "up", e.shiftKey);
604
+ break;
605
+ case "ArrowDown":
606
+ e.preventDefault();
607
+ navigate(activeCell, "down", e.shiftKey);
608
+ break;
609
+ case "ArrowLeft":
610
+ e.preventDefault();
611
+ navigate(activeCell, "left", e.shiftKey);
612
+ break;
613
+ case "ArrowRight":
614
+ e.preventDefault();
615
+ navigate(activeCell, "right", e.shiftKey);
616
+ break;
617
+ case "Enter":
618
+ e.preventDefault();
619
+ startEditing(activeCell);
620
+ break;
621
+ case "Tab":
622
+ e.preventDefault();
623
+ navigate(activeCell, e.shiftKey ? "left" : "right");
624
+ break;
625
+ case "Escape":
626
+ setActiveCell(null);
627
+ break;
628
+ case " ":
629
+ if (rowSelection && selectedRows) {
630
+ e.preventDefault();
631
+ const row = data[activeCell.row];
632
+ if (row) handleSelectRow(row, activeCell.row);
633
+ }
634
+ break;
635
+ case "a":
636
+ if ((e.ctrlKey || e.metaKey) && rowSelection) {
637
+ e.preventDefault();
638
+ handleSelectAll();
639
+ }
640
+ break;
641
+ case "c":
642
+ if ((e.ctrlKey || e.metaKey) && onCopy) {
643
+ e.preventDefault();
644
+ const col = orderedColumns[activeCell.col];
645
+ const val = data[activeCell.row]?.[col.key];
646
+ onCopy(val == null ? "" : String(val));
647
+ }
648
+ break;
649
+ case "v":
650
+ if ((e.ctrlKey || e.metaKey) && onPaste) {
651
+ e.preventDefault();
652
+ navigator.clipboard?.readText().then((text) => {
653
+ onPaste(text, activeCell);
654
+ });
655
+ }
656
+ break;
657
+ }
658
+ },
659
+ [
660
+ activeCell,
661
+ editingCell,
662
+ navigate,
663
+ startEditing,
664
+ setActiveCell,
665
+ onCopy,
666
+ onPaste,
667
+ orderedColumns,
668
+ data,
669
+ rowSelection,
670
+ selectedRows,
671
+ handleSelectRow,
672
+ handleSelectAll
673
+ ]
674
+ );
675
+ const handleSort = (0, import_react6.useCallback)(
676
+ (col) => {
677
+ if (!col.sortable || !onSort) return;
678
+ const dir = sortColumn === col.key && sortDirection === "asc" ? "desc" : "asc";
679
+ onSort(col.key, dir);
680
+ },
681
+ [sortColumn, sortDirection, onSort]
682
+ );
683
+ const handleCellContextMenu = (0, import_react6.useCallback)(
684
+ (e, rowIndex, col) => {
685
+ if (!onContextMenu) return;
686
+ e.preventDefault();
687
+ const row = data[rowIndex];
688
+ if (!row) return;
689
+ const items = onContextMenu(rowIndex, col.key, row);
690
+ if (items.length === 0) return;
691
+ setCtxMenu({ items, position: { x: e.clientX, y: e.clientY } });
692
+ },
693
+ [onContextMenu, data]
694
+ );
695
+ const handleHeaderDragStart = (0, import_react6.useCallback)(
696
+ (e, colKey) => {
697
+ if (!columnReorder) return;
698
+ dragColumnRef.current = colKey;
699
+ e.dataTransfer.effectAllowed = "move";
700
+ },
701
+ [columnReorder, dragColumnRef]
702
+ );
703
+ const handleHeaderDragOver = (0, import_react6.useCallback)(
704
+ (e, colKey) => {
705
+ if (!columnReorder || !dragColumnRef.current) return;
706
+ e.preventDefault();
707
+ setDragOverCol(colKey);
708
+ },
709
+ [columnReorder, dragColumnRef]
710
+ );
711
+ const handleHeaderDrop = (0, import_react6.useCallback)(
712
+ (e, colKey) => {
713
+ e.preventDefault();
714
+ if (!columnReorder || !dragColumnRef.current) return;
715
+ const newOrder = reorderColumns(dragColumnRef.current, colKey);
716
+ dragColumnRef.current = null;
717
+ setDragOverCol(null);
718
+ onColumnOrderChange?.(newOrder);
719
+ },
720
+ [columnReorder, dragColumnRef, reorderColumns, onColumnOrderChange]
721
+ );
722
+ const handleHeaderDragEnd = (0, import_react6.useCallback)(() => {
723
+ dragColumnRef.current = null;
724
+ setDragOverCol(null);
725
+ }, [dragColumnRef]);
726
+ (0, import_react6.useImperativeHandle)(
727
+ ref,
728
+ () => ({
729
+ scrollToRow: scrollToIndex,
730
+ scrollToColumn: () => {
731
+ },
732
+ getActiveCell: () => activeCell,
733
+ setActiveCell
734
+ }),
735
+ [scrollToIndex, activeCell, setActiveCell]
736
+ );
737
+ const handleResizeStart = (0, import_react6.useCallback)(
738
+ (colKey, startX) => {
739
+ const startWidth = getColumnWidth(colKey);
740
+ const onMouseMove = (e) => {
741
+ const delta = e.clientX - startX;
742
+ resizeColumn(colKey, startWidth + delta);
743
+ };
744
+ const onMouseUp = () => {
745
+ document.removeEventListener("mousemove", onMouseMove);
746
+ document.removeEventListener("mouseup", onMouseUp);
747
+ };
748
+ document.addEventListener("mousemove", onMouseMove);
749
+ document.addEventListener("mouseup", onMouseUp);
750
+ },
751
+ [getColumnWidth, resizeColumn]
752
+ );
753
+ const renderCell = (0, import_react6.useCallback)(
754
+ (row, rowIndex, col, colIndex) => {
755
+ const isActive = activeCell?.row === rowIndex && activeCell?.col === colIndex;
756
+ const isEditing = editingCell?.row === rowIndex && editingCell?.col === colIndex;
757
+ const isSelected = isCellInRange(rowIndex, colIndex, selection);
758
+ const rawValue = col.formula ? col.formula(row) : row[col.key];
759
+ const extraClass = cellClassName?.(rawValue, row, rowIndex, col) ?? "";
760
+ const extraStyle = cellStyleFn?.(rawValue, row, rowIndex, col);
761
+ const cellClassNames = [
762
+ cls.cell,
763
+ isActive ? cls.cellActive : "",
764
+ isEditing ? cls.cellEditing : "",
765
+ isSelected ? cls.cellSelected : "",
766
+ col.frozen ? cls.frozen : "",
767
+ col.className ?? "",
768
+ extraClass
769
+ ].filter(Boolean).join(" ");
770
+ const baseCellStyle = {
771
+ width: getColumnWidth(col.key),
772
+ minWidth: getColumnWidth(col.key),
773
+ textAlign: col.align ?? "left",
774
+ ...extraStyle
775
+ };
776
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
777
+ "div",
778
+ {
779
+ className: cellClassNames,
780
+ style: baseCellStyle,
781
+ onClick: () => handleCellClick(rowIndex, colIndex),
782
+ onDoubleClick: () => handleCellDoubleClick(rowIndex, colIndex),
783
+ onContextMenu: (e) => handleCellContextMenu(e, rowIndex, col),
784
+ role: "gridcell",
785
+ "aria-colindex": colIndex + 1 + (rowSelection ? 1 : 0) + (showRowNumber ? 1 : 0),
786
+ "aria-selected": isActive || isSelected,
787
+ children: isEditing ? (col.editor ?? DefaultEditor)({
788
+ value: rawValue,
789
+ row,
790
+ rowIndex,
791
+ column: col,
792
+ onChange: (v) => {
793
+ editValueRef.current = v;
794
+ },
795
+ onCommit: handleCommitEdit,
796
+ onCancel: handleCancelEdit
797
+ }) : col.render ? col.render(rawValue, row, rowIndex) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: rawValue == null ? "" : String(rawValue) })
798
+ },
799
+ col.key
800
+ );
801
+ },
802
+ [
803
+ activeCell,
804
+ editingCell,
805
+ selection,
806
+ getColumnWidth,
807
+ handleCellClick,
808
+ handleCellDoubleClick,
809
+ handleCommitEdit,
810
+ handleCancelEdit,
811
+ editValueRef,
812
+ cellClassName,
813
+ cellStyleFn,
814
+ handleCellContextMenu,
815
+ rowSelection,
816
+ showRowNumber
817
+ ]
818
+ );
819
+ const heightValue = typeof height === "number" ? height : void 0;
820
+ const bodyHeight = heightValue ? heightValue - headerHeight : void 0;
821
+ const rootCls = [
822
+ cls.root,
823
+ striped ? "sg-datagrid--striped" : "",
824
+ loading ? "sg-datagrid--loading" : "",
825
+ className ?? ""
826
+ ].filter(Boolean).join(" ");
827
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
828
+ "div",
829
+ {
830
+ ref: containerRef,
831
+ className: rootCls,
832
+ style: { width, height, display: "flex", flexDirection: "column", position: "relative", ...style },
833
+ onKeyDown: handleKeyDown,
834
+ tabIndex: 0,
835
+ role: "grid",
836
+ "aria-rowcount": data.length,
837
+ "aria-colcount": orderedColumns.length,
838
+ children: [
839
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
840
+ "div",
841
+ {
842
+ className: cls.header,
843
+ style: {
844
+ display: "flex",
845
+ height: headerHeight,
846
+ minHeight: headerHeight,
847
+ minWidth: totalWidth
848
+ },
849
+ role: "row",
850
+ children: [
851
+ rowSelection && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
852
+ "div",
853
+ {
854
+ className: `${cls.headerCell} ${cls.selectionCell}`,
855
+ style: { width: SELECTION_COL_WIDTH, minWidth: SELECTION_COL_WIDTH, display: "flex", alignItems: "center", justifyContent: "center" },
856
+ role: "columnheader",
857
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
858
+ Checkbox,
859
+ {
860
+ checked: allSelected,
861
+ indeterminate: someSelected,
862
+ onChange: handleSelectAll
863
+ }
864
+ )
865
+ }
866
+ ),
867
+ showRowNumber && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
868
+ "div",
869
+ {
870
+ className: `${cls.headerCell} ${cls.rowNumberCell}`,
871
+ style: { width: ROW_NUMBER_COL_WIDTH, minWidth: ROW_NUMBER_COL_WIDTH, display: "flex", alignItems: "center", justifyContent: "center", userSelect: "none" },
872
+ role: "columnheader",
873
+ children: "#"
874
+ }
875
+ ),
876
+ orderedColumns.map((col) => {
877
+ const isSorted = sortColumn === col.key;
878
+ const headerCls = [
879
+ cls.headerCell,
880
+ col.sortable ? cls.sortable : "",
881
+ isSorted && sortDirection === "asc" ? cls.sortAsc : "",
882
+ isSorted && sortDirection === "desc" ? cls.sortDesc : "",
883
+ col.headerClassName ?? "",
884
+ dragOverCol === col.key ? cls.headerDragOver : ""
885
+ ].filter(Boolean).join(" ");
886
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
887
+ "div",
888
+ {
889
+ className: headerCls,
890
+ style: {
891
+ width: getColumnWidth(col.key),
892
+ minWidth: getColumnWidth(col.key),
893
+ position: "relative",
894
+ display: "flex",
895
+ alignItems: "center",
896
+ padding: "0 8px",
897
+ cursor: col.sortable ? "pointer" : "default",
898
+ userSelect: "none"
899
+ },
900
+ onClick: () => handleSort(col),
901
+ draggable: !!columnReorder,
902
+ onDragStart: (e) => handleHeaderDragStart(e, col.key),
903
+ onDragOver: (e) => handleHeaderDragOver(e, col.key),
904
+ onDrop: (e) => handleHeaderDrop(e, col.key),
905
+ onDragEnd: handleHeaderDragEnd,
906
+ onDragLeave: () => setDragOverCol(null),
907
+ role: "columnheader",
908
+ children: [
909
+ col.title,
910
+ isSorted && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { marginLeft: 4, fontSize: 10 }, children: sortDirection === "asc" ? "\u25B2" : "\u25BC" }),
911
+ col.resizable !== false && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
912
+ "div",
913
+ {
914
+ className: cls.resizer,
915
+ style: {
916
+ position: "absolute",
917
+ right: 0,
918
+ top: 0,
919
+ bottom: 0,
920
+ width: 4,
921
+ cursor: "col-resize"
922
+ },
923
+ onMouseDown: (e) => {
924
+ e.stopPropagation();
925
+ handleResizeStart(col.key, e.clientX);
926
+ }
927
+ }
928
+ )
929
+ ]
930
+ },
931
+ col.key
932
+ );
933
+ })
934
+ ]
935
+ }
936
+ ),
937
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
938
+ "div",
939
+ {
940
+ ref: scrollRef,
941
+ className: cls.body,
942
+ style: {
943
+ flex: 1,
944
+ overflow: "auto",
945
+ position: "relative",
946
+ height: bodyHeight
947
+ },
948
+ children: data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cls.empty, style: { padding: 24, textAlign: "center" }, children: emptyContent ?? locale?.noData ?? "No data" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { height: range.totalHeight, position: "relative", minWidth: totalWidth }, children: range.visibleItems.map((vi) => {
949
+ const row = data[vi.index];
950
+ if (!row) return null;
951
+ const rKey = getRowKey(row, vi.index);
952
+ const isRowSelected = selectedRows?.has(rKey) ?? false;
953
+ const rowExtraClass = typeof rowClassName === "function" ? rowClassName(row, vi.index) : rowClassName ?? "";
954
+ const rowCls = [
955
+ cls.row,
956
+ striped ? vi.index % 2 === 0 ? cls.rowEven : cls.rowOdd : "",
957
+ highlightOnHover ? cls.rowHoverable : "",
958
+ isRowSelected ? cls.rowSelected : "",
959
+ rowExtraClass
960
+ ].filter(Boolean).join(" ");
961
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
962
+ "div",
963
+ {
964
+ className: rowCls,
965
+ style: {
966
+ display: "flex",
967
+ position: "absolute",
968
+ top: vi.offsetTop,
969
+ height: vi.height,
970
+ width: "100%"
971
+ },
972
+ role: "row",
973
+ "aria-rowindex": vi.index + 1,
974
+ "aria-selected": isRowSelected,
975
+ onClick: () => onRowClick?.(row, vi.index),
976
+ onDoubleClick: () => onRowDoubleClick?.(row, vi.index),
977
+ children: [
978
+ rowSelection && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
979
+ "div",
980
+ {
981
+ className: `${cls.cell} ${cls.selectionCell}`,
982
+ style: { width: SELECTION_COL_WIDTH, minWidth: SELECTION_COL_WIDTH, display: "flex", alignItems: "center", justifyContent: "center" },
983
+ onClick: (e) => e.stopPropagation(),
984
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
985
+ Checkbox,
986
+ {
987
+ checked: isRowSelected,
988
+ onChange: () => handleSelectRow(row, vi.index)
989
+ }
990
+ )
991
+ }
992
+ ),
993
+ showRowNumber && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
994
+ "div",
995
+ {
996
+ className: `${cls.cell} ${cls.rowNumberCell}`,
997
+ style: { width: ROW_NUMBER_COL_WIDTH, minWidth: ROW_NUMBER_COL_WIDTH, display: "flex", alignItems: "center", justifyContent: "center", color: "var(--sg-text-tertiary, #999)" },
998
+ children: vi.index + 1
999
+ }
1000
+ ),
1001
+ orderedColumns.map((col, ci) => renderCell(row, vi.index, col, ci))
1002
+ ]
1003
+ },
1004
+ rKey
1005
+ );
1006
+ }) })
1007
+ }
1008
+ ),
1009
+ summaryRows && summaryRows.length > 0 && data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cls.summary, style: { minWidth: totalWidth }, children: summaryRows.map((sr, sri) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1010
+ "div",
1011
+ {
1012
+ className: `${cls.summaryRow} ${sr.className ?? ""}`,
1013
+ style: { display: "flex", height: rowHeight },
1014
+ children: [
1015
+ rowSelection && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${cls.summaryCell}`, style: { width: SELECTION_COL_WIDTH, minWidth: SELECTION_COL_WIDTH } }),
1016
+ showRowNumber && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: `${cls.summaryCell}`, style: { width: ROW_NUMBER_COL_WIDTH, minWidth: ROW_NUMBER_COL_WIDTH } }),
1017
+ orderedColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1018
+ "div",
1019
+ {
1020
+ className: cls.summaryCell,
1021
+ style: {
1022
+ width: getColumnWidth(col.key),
1023
+ minWidth: getColumnWidth(col.key),
1024
+ textAlign: col.align ?? "left"
1025
+ },
1026
+ children: sr.render(col.key, data)
1027
+ },
1028
+ col.key
1029
+ ))
1030
+ ]
1031
+ },
1032
+ sri
1033
+ )) }),
1034
+ ctxMenu && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1035
+ ContextMenuPopup,
1036
+ {
1037
+ items: ctxMenu.items,
1038
+ position: ctxMenu.position,
1039
+ onClose: () => setCtxMenu(null)
1040
+ }
1041
+ ),
1042
+ loading && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cls.loading, style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", background: "rgba(255,255,255,0.6)", zIndex: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Spin, { size: "large" }) })
1043
+ ]
1044
+ }
1045
+ );
1046
+ }
1047
+ var DataGrid = (0, import_react6.forwardRef)(DataGridInner);
1048
+ // Annotate the CommonJS export names for ESM import in node:
1049
+ 0 && (module.exports = {
1050
+ DataGrid
1051
+ });
1052
+ //# sourceMappingURL=datagrid.cjs.map