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