@skygraph/react 0.5.1 → 0.5.3

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 (49) hide show
  1. package/README.md +70 -70
  2. package/dist/{Table-BmesoMje.d.ts → Table-CAay8MmA.d.ts} +8 -1
  3. package/dist/{Table-CpKMOH2x.d.cts → Table-CMKo6Pc3.d.cts} +8 -1
  4. package/dist/{chunk-ZJF6SJLP.js → chunk-45YW5VSP.js} +44 -10
  5. package/dist/chunk-45YW5VSP.js.map +1 -0
  6. package/dist/{chunk-Z5UGF7EO.js → chunk-EFDB2ENB.js} +87 -25
  7. package/dist/chunk-EFDB2ENB.js.map +1 -0
  8. package/dist/{chunk-UO6VJC3C.js → chunk-KGFFQGCM.js} +3 -3
  9. package/dist/{chunk-NXB3VAVF.js → chunk-P4J4PFBG.js} +54 -7
  10. package/dist/chunk-P4J4PFBG.js.map +1 -0
  11. package/dist/{chunk-FSV73JI4.js → chunk-PEX2UTNG.js} +2 -2
  12. package/dist/chunk-VLRLCHEL.js +184 -0
  13. package/dist/chunk-VLRLCHEL.js.map +1 -0
  14. package/dist/{chunk-MLEBVELO.js → chunk-YTPUWPWA.js} +51 -46
  15. package/dist/chunk-YTPUWPWA.js.map +1 -0
  16. package/dist/{chunk-GJDDPZH7.js → chunk-ZJC2QUWA.js} +12 -12
  17. package/dist/chunk-ZJC2QUWA.js.map +1 -0
  18. package/dist/datagrid.cjs +76 -21
  19. package/dist/datagrid.cjs.map +1 -1
  20. package/dist/datagrid.js +3 -3
  21. package/dist/devtools.cjs +11 -11
  22. package/dist/devtools.cjs.map +1 -1
  23. package/dist/devtools.js +1 -1
  24. package/dist/form.cjs +127 -86
  25. package/dist/form.cjs.map +1 -1
  26. package/dist/form.js +3 -3
  27. package/dist/index.cjs +1319 -945
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +153 -7
  30. package/dist/index.d.ts +153 -7
  31. package/dist/index.js +281 -141
  32. package/dist/index.js.map +1 -1
  33. package/dist/table.cjs +252 -169
  34. package/dist/table.cjs.map +1 -1
  35. package/dist/table.d.cts +1 -1
  36. package/dist/table.d.ts +1 -1
  37. package/dist/table.js +4 -4
  38. package/dist/tree.cjs.map +1 -1
  39. package/dist/tree.js +3 -3
  40. package/package.json +3 -3
  41. package/dist/chunk-2OCEO636.js +0 -91
  42. package/dist/chunk-2OCEO636.js.map +0 -1
  43. package/dist/chunk-GJDDPZH7.js.map +0 -1
  44. package/dist/chunk-MLEBVELO.js.map +0 -1
  45. package/dist/chunk-NXB3VAVF.js.map +0 -1
  46. package/dist/chunk-Z5UGF7EO.js.map +0 -1
  47. package/dist/chunk-ZJF6SJLP.js.map +0 -1
  48. /package/dist/{chunk-UO6VJC3C.js.map → chunk-KGFFQGCM.js.map} +0 -0
  49. /package/dist/{chunk-FSV73JI4.js.map → chunk-PEX2UTNG.js.map} +0 -0
package/dist/table.cjs CHANGED
@@ -43,7 +43,10 @@ __export(table_exports, {
43
43
  module.exports = __toCommonJS(table_exports);
44
44
 
45
45
  // src/components/complex/Table/Table.tsx
46
- var import_react13 = __toESM(require("react"), 1);
46
+ var import_react14 = __toESM(require("react"), 1);
47
+
48
+ // src/components/ui/Input.tsx
49
+ var import_react3 = __toESM(require("react"), 1);
47
50
 
48
51
  // src/components/ConfigProvider.tsx
49
52
  var import_react = require("react");
@@ -128,9 +131,14 @@ function Input({
128
131
  size: sizeProp,
129
132
  disabled: disabledProp,
130
133
  loading,
134
+ allowClear = false,
135
+ status,
136
+ prefix,
137
+ suffix,
131
138
  onChange,
132
139
  onBlur,
133
140
  onFocus,
141
+ onClear,
134
142
  "aria-invalid": ariaInvalid,
135
143
  "aria-required": ariaRequired,
136
144
  "aria-describedby": ariaDescribedBy,
@@ -142,45 +150,73 @@ function Input({
142
150
  const config = useConfig();
143
151
  const size = sizeProp ?? config.size ?? "middle";
144
152
  const disabled = disabledProp ?? config.disabled ?? false;
153
+ const [internalValue, setInternalValue] = import_react3.default.useState(defaultValue ?? "");
154
+ const currentValue = value ?? internalValue;
155
+ const isControlled = value !== void 0;
145
156
  const wrapperClasses = unstyled ? className ?? "" : [
146
157
  "sg-input-wrapper",
147
158
  `sg-input-wrapper-${size}`,
148
159
  loading ? "sg-input-wrapper-loading" : "",
149
160
  readOnly ? "sg-input-wrapper-readonly" : "",
161
+ status ? `sg-input-wrapper-status-${status}` : "",
150
162
  className
151
163
  ].filter(Boolean).join(" ");
152
164
  const inputClasses = unstyled ? "" : [
153
165
  "sg-input",
154
166
  `sg-input-${size}`,
155
- readOnly ? "sg-input-readonly" : ""
167
+ readOnly ? "sg-input-readonly" : "",
168
+ status ? `sg-input-status-${status}` : ""
156
169
  ].filter(Boolean).join(" ");
170
+ const clearLabel = config.locale?.input?.clear ?? "Clear";
171
+ const showClear = allowClear && !disabled && !readOnly && !loading && currentValue !== "";
172
+ const handleChange = (e) => {
173
+ if (!isControlled) setInternalValue(e.target.value);
174
+ onChange?.(e.target.value);
175
+ };
176
+ const handleClear = () => {
177
+ if (!isControlled) setInternalValue("");
178
+ onChange?.("");
179
+ onClear?.();
180
+ };
181
+ const resolvedAriaInvalid = ariaInvalid ?? (status === "error" ? true : void 0);
157
182
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: wrapperClasses, style, children: [
183
+ prefix && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sg-input-prefix", children: prefix }),
158
184
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
159
185
  "input",
160
186
  {
161
187
  id,
162
188
  type,
163
189
  className: inputClasses,
164
- value,
165
- defaultValue,
190
+ value: currentValue,
166
191
  placeholder,
167
192
  disabled: disabled || loading,
168
193
  readOnly,
169
- "aria-invalid": ariaInvalid,
194
+ "aria-invalid": resolvedAriaInvalid,
170
195
  "aria-required": ariaRequired,
171
196
  "aria-readonly": readOnly || void 0,
172
197
  "aria-describedby": ariaDescribedBy,
173
- onChange: (e) => onChange?.(e.target.value),
198
+ onChange: handleChange,
174
199
  onBlur,
175
200
  onFocus
176
201
  }
177
202
  ),
178
- loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spin, { size: "small", unstyled })
203
+ showClear && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
204
+ "button",
205
+ {
206
+ type: "button",
207
+ className: "sg-input-clear",
208
+ "aria-label": clearLabel,
209
+ onClick: handleClear,
210
+ children: "\xD7"
211
+ }
212
+ ),
213
+ loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Spin, { size: "small", unstyled }),
214
+ suffix && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "sg-input-suffix", children: suffix })
179
215
  ] });
180
216
  }
181
217
 
182
218
  // src/components/ui/Pagination.tsx
183
- var import_react3 = require("react");
219
+ var import_react4 = require("react");
184
220
  var import_jsx_runtime4 = require("react/jsx-runtime");
185
221
  function Pagination({
186
222
  current,
@@ -205,7 +241,7 @@ function Pagination({
205
241
  const itemsPerPageLabel = locale?.itemsPerPage ?? "/ page";
206
242
  const jumpLabel = locale?.jump ?? "Go to";
207
243
  const ariaLabel = locale?.ariaLabel ?? "Pagination";
208
- const [jumpValue, setJumpValue] = (0, import_react3.useState)("");
244
+ const [jumpValue, setJumpValue] = (0, import_react4.useState)("");
209
245
  const totalPages = Math.max(1, Math.ceil(total / pageSize));
210
246
  const safeCurrentPage = Math.min(Math.max(1, current), totalPages);
211
247
  const rangeStart = (safeCurrentPage - 1) * pageSize + 1;
@@ -221,6 +257,29 @@ function Pagination({
221
257
  }
222
258
  setJumpValue("");
223
259
  };
260
+ const handleKeyDown = (e) => {
261
+ if (disabled) return;
262
+ const tag = e.target.tagName;
263
+ if (tag === "INPUT" || tag === "SELECT") return;
264
+ switch (e.key) {
265
+ case "ArrowLeft":
266
+ e.preventDefault();
267
+ go(safeCurrentPage - 1);
268
+ break;
269
+ case "ArrowRight":
270
+ e.preventDefault();
271
+ go(safeCurrentPage + 1);
272
+ break;
273
+ case "Home":
274
+ e.preventDefault();
275
+ go(1);
276
+ break;
277
+ case "End":
278
+ e.preventDefault();
279
+ go(totalPages);
280
+ break;
281
+ }
282
+ };
224
283
  const pages = buildPages(safeCurrentPage, totalPages);
225
284
  const renderTotal = () => {
226
285
  if (!showTotal) return null;
@@ -271,12 +330,21 @@ function Pagination({
271
330
  ] });
272
331
  };
273
332
  if (unstyled) {
274
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("nav", { className, style, "aria-label": ariaLabel, children: [
275
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { disabled: safeCurrentPage <= 1, onClick: () => go(safeCurrentPage - 1), children: "\u2039" }),
333
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("nav", { className, style, "aria-label": ariaLabel, onKeyDown: handleKeyDown, children: [
334
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
335
+ "button",
336
+ {
337
+ type: "button",
338
+ disabled: safeCurrentPage <= 1,
339
+ onClick: () => go(safeCurrentPage - 1),
340
+ children: "\u2039"
341
+ }
342
+ ),
276
343
  pages.map(
277
344
  (p, i) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u2026" }, `e${i}`) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
278
345
  "button",
279
346
  {
347
+ type: "button",
280
348
  onClick: () => go(p),
281
349
  "aria-current": p === safeCurrentPage ? "page" : void 0,
282
350
  children: p
@@ -284,7 +352,15 @@ function Pagination({
284
352
  p
285
353
  )
286
354
  ),
287
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { disabled: safeCurrentPage >= totalPages, onClick: () => go(safeCurrentPage + 1), children: "\u203A" })
355
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
356
+ "button",
357
+ {
358
+ type: "button",
359
+ disabled: safeCurrentPage >= totalPages,
360
+ onClick: () => go(safeCurrentPage + 1),
361
+ children: "\u203A"
362
+ }
363
+ )
288
364
  ] });
289
365
  }
290
366
  if (simple) {
@@ -298,10 +374,12 @@ function Pagination({
298
374
  ].filter(Boolean).join(" "),
299
375
  style,
300
376
  "aria-label": ariaLabel,
377
+ onKeyDown: handleKeyDown,
301
378
  children: [
302
379
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
303
380
  "button",
304
381
  {
382
+ type: "button",
305
383
  className: "sg-pagination-item sg-pagination-prev",
306
384
  disabled: safeCurrentPage <= 1,
307
385
  onClick: () => go(safeCurrentPage - 1),
@@ -316,6 +394,7 @@ function Pagination({
316
394
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
317
395
  "button",
318
396
  {
397
+ type: "button",
319
398
  className: "sg-pagination-item sg-pagination-next",
320
399
  disabled: safeCurrentPage >= totalPages,
321
400
  onClick: () => go(safeCurrentPage + 1),
@@ -332,11 +411,13 @@ function Pagination({
332
411
  className: ["sg-pagination", disabled ? "sg-pagination-disabled" : "", className].filter(Boolean).join(" "),
333
412
  style,
334
413
  "aria-label": ariaLabel,
414
+ onKeyDown: handleKeyDown,
335
415
  children: [
336
416
  renderTotal(),
337
417
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
338
418
  "button",
339
419
  {
420
+ type: "button",
340
421
  className: "sg-pagination-item sg-pagination-prev",
341
422
  disabled: safeCurrentPage <= 1,
342
423
  onClick: () => go(safeCurrentPage - 1),
@@ -347,6 +428,7 @@ function Pagination({
347
428
  (p, i) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "sg-pagination-ellipsis", children: "\u2026" }, `e${i}`) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
348
429
  "button",
349
430
  {
431
+ type: "button",
350
432
  className: `sg-pagination-item${p === safeCurrentPage ? " sg-pagination-item-active" : ""}`,
351
433
  onClick: () => go(p),
352
434
  "aria-current": p === safeCurrentPage ? "page" : void 0,
@@ -358,6 +440,7 @@ function Pagination({
358
440
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
359
441
  "button",
360
442
  {
443
+ type: "button",
361
444
  className: "sg-pagination-item sg-pagination-next",
362
445
  disabled: safeCurrentPage >= totalPages,
363
446
  onClick: () => go(safeCurrentPage + 1),
@@ -384,7 +467,7 @@ function buildPages(current, total) {
384
467
  }
385
468
 
386
469
  // src/components/ui/Checkbox.tsx
387
- var import_react4 = __toESM(require("react"), 1);
470
+ var import_react5 = __toESM(require("react"), 1);
388
471
  var import_jsx_runtime5 = require("react/jsx-runtime");
389
472
  function Checkbox({
390
473
  checked,
@@ -400,8 +483,8 @@ function Checkbox({
400
483
  }) {
401
484
  const config = useConfig();
402
485
  const disabled = disabledProp ?? config.disabled ?? false;
403
- const inputRef = import_react4.default.useRef(null);
404
- import_react4.default.useEffect(() => {
486
+ const inputRef = import_react5.default.useRef(null);
487
+ import_react5.default.useEffect(() => {
405
488
  if (inputRef.current) {
406
489
  inputRef.current.indeterminate = indeterminate ?? false;
407
490
  }
@@ -433,7 +516,7 @@ function Checkbox({
433
516
  }
434
517
 
435
518
  // src/components/complex/Table/FilterDropdown.tsx
436
- var import_react7 = __toESM(require("react"), 1);
519
+ var import_react8 = __toESM(require("react"), 1);
437
520
  var import_react_dom = require("react-dom");
438
521
 
439
522
  // src/components/ui/Button.tsx
@@ -483,10 +566,10 @@ function Button({
483
566
  }
484
567
 
485
568
  // src/components/ui/Select.tsx
486
- var import_react6 = require("react");
569
+ var import_react7 = require("react");
487
570
 
488
571
  // src/components/ui/Transition.tsx
489
- var import_react5 = __toESM(require("react"), 1);
572
+ var import_react6 = __toESM(require("react"), 1);
490
573
  function Transition({
491
574
  visible,
492
575
  name = "sg-fade",
@@ -500,20 +583,20 @@ function Transition({
500
583
  children,
501
584
  unmountOnExit = true
502
585
  }) {
503
- const [mounted, setMounted] = (0, import_react5.useState)(visible);
504
- const [phase, setPhase] = (0, import_react5.useState)(visible ? "idle" : "idle");
505
- const nodeRef = (0, import_react5.useRef)(null);
506
- const timerRef = (0, import_react5.useRef)(void 0);
507
- const prevVisible = (0, import_react5.useRef)(visible);
508
- const getEnterClasses = (0, import_react5.useCallback)(() => {
586
+ const [mounted, setMounted] = (0, import_react6.useState)(visible);
587
+ const [phase, setPhase] = (0, import_react6.useState)(visible ? "idle" : "idle");
588
+ const nodeRef = (0, import_react6.useRef)(null);
589
+ const timerRef = (0, import_react6.useRef)(void 0);
590
+ const prevVisible = (0, import_react6.useRef)(visible);
591
+ const getEnterClasses = (0, import_react6.useCallback)(() => {
509
592
  if (enterFrom && enterTo) return { from: enterFrom, active: `${name}-enter-active`, to: enterTo };
510
593
  return { from: `${name}-enter-from`, active: `${name}-enter-active`, to: `${name}-enter-to` };
511
594
  }, [name, enterFrom, enterTo]);
512
- const getLeaveClasses = (0, import_react5.useCallback)(() => {
595
+ const getLeaveClasses = (0, import_react6.useCallback)(() => {
513
596
  if (leaveFrom && leaveTo) return { from: leaveFrom, active: `${name}-leave-active`, to: leaveTo };
514
597
  return { from: `${name}-leave-from`, active: `${name}-leave-active`, to: `${name}-leave-to` };
515
598
  }, [name, leaveFrom, leaveTo]);
516
- (0, import_react5.useEffect)(() => {
599
+ (0, import_react6.useEffect)(() => {
517
600
  if (visible === prevVisible.current) return;
518
601
  prevVisible.current = visible;
519
602
  clearTimeout(timerRef.current);
@@ -539,7 +622,7 @@ function Transition({
539
622
  }, duration);
540
623
  }
541
624
  }, [visible, duration, unmountOnExit, onAfterEnter, onAfterLeave]);
542
- (0, import_react5.useEffect)(() => {
625
+ (0, import_react6.useEffect)(() => {
543
626
  return () => clearTimeout(timerRef.current);
544
627
  }, []);
545
628
  if (!mounted && unmountOnExit) return null;
@@ -560,7 +643,7 @@ function Transition({
560
643
  transitionClass = `${leaveC.to} ${leaveC.active}`;
561
644
  break;
562
645
  }
563
- return import_react5.default.cloneElement(children, {
646
+ return import_react6.default.cloneElement(children, {
564
647
  ref: nodeRef,
565
648
  className: [children.props.className, transitionClass].filter(Boolean).join(" ")
566
649
  });
@@ -588,17 +671,17 @@ function Select(props) {
588
671
  const disabled = disabledProp ?? config.disabled ?? false;
589
672
  const initialSingle = isMultiple ? void 0 : props.value ?? props.defaultValue;
590
673
  const initialMultiple = isMultiple ? props.value ?? props.defaultValue ?? [] : [];
591
- const [internalSingle, setInternalSingle] = (0, import_react6.useState)(initialSingle);
592
- const [internalMultiple, setInternalMultiple] = (0, import_react6.useState)(initialMultiple);
593
- const [open, setOpen] = (0, import_react6.useState)(false);
594
- const [focusedIndex, setFocusedIndex] = (0, import_react6.useState)(-1);
595
- const ref = (0, import_react6.useRef)(null);
596
- const listboxId = (0, import_react6.useId)();
674
+ const [internalSingle, setInternalSingle] = (0, import_react7.useState)(initialSingle);
675
+ const [internalMultiple, setInternalMultiple] = (0, import_react7.useState)(initialMultiple);
676
+ const [open, setOpen] = (0, import_react7.useState)(false);
677
+ const [focusedIndex, setFocusedIndex] = (0, import_react7.useState)(-1);
678
+ const ref = (0, import_react7.useRef)(null);
679
+ const listboxId = (0, import_react7.useId)();
597
680
  const currentSingle = isMultiple ? void 0 : props.value ?? internalSingle;
598
681
  const currentMultiple = isMultiple ? props.value ?? internalMultiple : [];
599
682
  const selectedOption = isMultiple ? void 0 : options.find((o) => o.value === currentSingle);
600
683
  const selectedOptions = isMultiple ? options.filter((o) => currentMultiple.includes(o.value)) : [];
601
- (0, import_react6.useEffect)(() => {
684
+ (0, import_react7.useEffect)(() => {
602
685
  const handleClickOutside = (e) => {
603
686
  if (ref.current && !ref.current.contains(e.target)) {
604
687
  setOpen(false);
@@ -607,7 +690,7 @@ function Select(props) {
607
690
  document.addEventListener("mousedown", handleClickOutside);
608
691
  return () => document.removeEventListener("mousedown", handleClickOutside);
609
692
  }, []);
610
- (0, import_react6.useEffect)(() => {
693
+ (0, import_react7.useEffect)(() => {
611
694
  if (!open) setFocusedIndex(-1);
612
695
  }, [open]);
613
696
  const emitSingle = (val) => {
@@ -855,8 +938,8 @@ function FilterPortal({
855
938
  anchor,
856
939
  children
857
940
  }) {
858
- const [coords, setCoords] = import_react7.default.useState(null);
859
- import_react7.default.useLayoutEffect(() => {
941
+ const [coords, setCoords] = import_react8.default.useState(null);
942
+ import_react8.default.useLayoutEffect(() => {
860
943
  if (!anchor) return;
861
944
  const update = () => {
862
945
  const r = anchor.getBoundingClientRect();
@@ -1029,14 +1112,14 @@ function AdvancedFilterPanel({ col, t, state, actions, filterRef }) {
1029
1112
  const defaultOps = isNumeric ? NUMBER_OPS : TEXT_OPS;
1030
1113
  const ops = col.advancedFilterOperators ?? defaultOps;
1031
1114
  const current = state.advancedFilters[col.key];
1032
- const [draftOp, setDraftOp] = import_react7.default.useState(current?.op ?? ops[0]);
1033
- const [draftValue, setDraftValue] = import_react7.default.useState(() => formatDraftValue(current?.value));
1034
- const [draftValue2, setDraftValue2] = import_react7.default.useState(() => {
1115
+ const [draftOp, setDraftOp] = import_react8.default.useState(current?.op ?? ops[0]);
1116
+ const [draftValue, setDraftValue] = import_react8.default.useState(() => formatDraftValue(current?.value));
1117
+ const [draftValue2, setDraftValue2] = import_react8.default.useState(() => {
1035
1118
  const v = current?.value;
1036
1119
  if (Array.isArray(v) && v.length === 2) return String(v[1] ?? "");
1037
1120
  return "";
1038
1121
  });
1039
- import_react7.default.useEffect(() => {
1122
+ import_react8.default.useEffect(() => {
1040
1123
  if (current) {
1041
1124
  setDraftOp(current.op);
1042
1125
  setDraftValue(formatDraftValue(current.value));
@@ -1444,7 +1527,7 @@ function TableHeader(props) {
1444
1527
  }
1445
1528
 
1446
1529
  // src/components/complex/Table/TableBody.tsx
1447
- var import_react8 = __toESM(require("react"), 1);
1530
+ var import_react9 = __toESM(require("react"), 1);
1448
1531
 
1449
1532
  // src/components/complex/Table/export.ts
1450
1533
  function toCSVString(data) {
@@ -1609,13 +1692,13 @@ function TableBody(props) {
1609
1692
  } = props;
1610
1693
  const sCls = slotClassNames ?? {};
1611
1694
  const sSty = slotStyles ?? {};
1612
- const [editingCell, setEditingCell] = (0, import_react8.useState)(null);
1613
- const [editValue, setEditValue] = (0, import_react8.useState)("");
1614
- const editRef = (0, import_react8.useRef)(null);
1615
- const [dragRowIdx, setDragRowIdx] = (0, import_react8.useState)(null);
1616
- const [dragOverRowIdx, setDragOverRowIdx] = (0, import_react8.useState)(null);
1617
- const [copiedCell, setCopiedCell] = (0, import_react8.useState)(null);
1618
- (0, import_react8.useEffect)(() => {
1695
+ const [editingCell, setEditingCell] = (0, import_react9.useState)(null);
1696
+ const [editValue, setEditValue] = (0, import_react9.useState)("");
1697
+ const editRef = (0, import_react9.useRef)(null);
1698
+ const [dragRowIdx, setDragRowIdx] = (0, import_react9.useState)(null);
1699
+ const [dragOverRowIdx, setDragOverRowIdx] = (0, import_react9.useState)(null);
1700
+ const [copiedCell, setCopiedCell] = (0, import_react9.useState)(null);
1701
+ (0, import_react9.useEffect)(() => {
1619
1702
  if (editingCell && editRef.current) editRef.current.focus();
1620
1703
  }, [editingCell]);
1621
1704
  const handleEditStart = (rowId, col, val) => {
@@ -1658,7 +1741,7 @@ function TableBody(props) {
1658
1741
  onContextMenu({ x: e.clientX, y: e.clientY, items });
1659
1742
  }
1660
1743
  };
1661
- const handleCellCopy = (0, import_react8.useCallback)(
1744
+ const handleCellCopy = (0, import_react9.useCallback)(
1662
1745
  async (rowId, colKey, value) => {
1663
1746
  await copyToClipboard(String(value ?? ""));
1664
1747
  setCopiedCell(`${rowId}:${colKey}`);
@@ -1702,7 +1785,7 @@ function TableBody(props) {
1702
1785
  const isDragOver = dragOverRowIdx === rowIdx && dragRowIdx !== rowIdx;
1703
1786
  const isPinned = isPinnedSection;
1704
1787
  const virtualIndexAttr = rowIndexOffset !== void 0 ? rowIndexOffset + rowIdx : void 0;
1705
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react8.default.Fragment, { children: [
1788
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react9.default.Fragment, { children: [
1706
1789
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1707
1790
  "div",
1708
1791
  {
@@ -1877,7 +1960,7 @@ function TableBody(props) {
1877
1960
  }
1878
1961
 
1879
1962
  // src/components/complex/Table/VirtualTableBody.tsx
1880
- var import_react9 = require("react");
1963
+ var import_react10 = require("react");
1881
1964
  var import_core = require("@skygraph/core");
1882
1965
  var import_jsx_runtime12 = require("react/jsx-runtime");
1883
1966
  var DEFAULT_ROW_HEIGHT = 40;
@@ -1907,7 +1990,7 @@ function VirtualTableBody(props) {
1907
1990
  } = props;
1908
1991
  const isDeclarative = typeof rowHeight === "function";
1909
1992
  const isDynamic = isDeclarative || estimateRowHeight != null;
1910
- const virtual = (0, import_react9.useMemo)(
1993
+ const virtual = (0, import_react10.useMemo)(
1911
1994
  () => (0, import_core.createVirtual)({
1912
1995
  itemCount: flatRows.length,
1913
1996
  itemHeight: buildEstimate(rowHeight, estimateRowHeight, flatRows),
@@ -1916,13 +1999,13 @@ function VirtualTableBody(props) {
1916
1999
  // eslint-disable-next-line react-hooks/exhaustive-deps
1917
2000
  []
1918
2001
  );
1919
- const [, forceUpdate] = (0, import_react9.useReducer)((n) => n + 1, 0);
1920
- (0, import_react9.useEffect)(() => virtual.subscribe(() => forceUpdate()), [virtual]);
1921
- (0, import_react9.useEffect)(() => {
2002
+ const [, forceUpdate] = (0, import_react10.useReducer)((n) => n + 1, 0);
2003
+ (0, import_react10.useEffect)(() => virtual.subscribe(() => forceUpdate()), [virtual]);
2004
+ (0, import_react10.useEffect)(() => {
1922
2005
  virtual.setItemCount(flatRows.length);
1923
2006
  virtual.setItemHeight(buildEstimate(rowHeight, estimateRowHeight, flatRows));
1924
2007
  }, [virtual, flatRows, rowHeight, estimateRowHeight]);
1925
- (0, import_react9.useEffect)(() => {
2008
+ (0, import_react10.useEffect)(() => {
1926
2009
  if (!isDeclarative) return;
1927
2010
  const fn = rowHeight;
1928
2011
  for (let i = 0; i < flatRows.length; i++) {
@@ -1934,9 +2017,9 @@ function VirtualTableBody(props) {
1934
2017
  }
1935
2018
  }
1936
2019
  }, [virtual, flatRows, rowHeight, isDeclarative]);
1937
- const [scrollTop, setScrollTop] = (0, import_react9.useState)(0);
1938
- const [viewportHeight, setViewportHeight] = (0, import_react9.useState)(0);
1939
- (0, import_react9.useEffect)(() => {
2020
+ const [scrollTop, setScrollTop] = (0, import_react10.useState)(0);
2021
+ const [viewportHeight, setViewportHeight] = (0, import_react10.useState)(0);
2022
+ (0, import_react10.useEffect)(() => {
1940
2023
  const el = scrollContainerRef.current;
1941
2024
  if (!el) return;
1942
2025
  setViewportHeight(el.clientHeight);
@@ -1965,9 +2048,9 @@ function VirtualTableBody(props) {
1965
2048
  );
1966
2049
  const bottomPad = Math.max(0, totalHeight - topPad - visibleSize);
1967
2050
  const normalizeHeight = (h) => Math.round(h);
1968
- const roRef = (0, import_react9.useRef)(null);
1969
- const observedCellsRef = (0, import_react9.useRef)(/* @__PURE__ */ new Set());
1970
- (0, import_react9.useEffect)(() => {
2051
+ const roRef = (0, import_react10.useRef)(null);
2052
+ const observedCellsRef = (0, import_react10.useRef)(/* @__PURE__ */ new Set());
2053
+ (0, import_react10.useEffect)(() => {
1971
2054
  if (!isDynamic) return;
1972
2055
  if (isDeclarative) return;
1973
2056
  if (typeof ResizeObserver === "undefined") return;
@@ -1987,7 +2070,7 @@ function VirtualTableBody(props) {
1987
2070
  observedCellsRef.current.clear();
1988
2071
  };
1989
2072
  }, [isDynamic, isDeclarative, virtual]);
1990
- (0, import_react9.useLayoutEffect)(() => {
2073
+ (0, import_react10.useLayoutEffect)(() => {
1991
2074
  if (!isDynamic) return;
1992
2075
  const grid = scrollContainerRef.current?.querySelector(".sg-table-grid");
1993
2076
  if (!grid) return;
@@ -2064,12 +2147,12 @@ function VirtualTableBody(props) {
2064
2147
  }
2065
2148
 
2066
2149
  // src/components/complex/Table/ContextMenu.tsx
2067
- var import_react10 = require("react");
2150
+ var import_react11 = require("react");
2068
2151
  var import_jsx_runtime13 = require("react/jsx-runtime");
2069
2152
  function ContextMenu({ state, onClose }) {
2070
- const ref = (0, import_react10.useRef)(null);
2071
- const [subMenu, setSubMenu] = (0, import_react10.useState)(null);
2072
- (0, import_react10.useEffect)(() => {
2153
+ const ref = (0, import_react11.useRef)(null);
2154
+ const [subMenu, setSubMenu] = (0, import_react11.useState)(null);
2155
+ (0, import_react11.useEffect)(() => {
2073
2156
  if (!state) return;
2074
2157
  const handle = (e) => {
2075
2158
  if (ref.current && !ref.current.contains(e.target)) {
@@ -2151,13 +2234,13 @@ function ContextMenu({ state, onClose }) {
2151
2234
  }
2152
2235
 
2153
2236
  // src/components/complex/Table/useTableState.ts
2154
- var import_react12 = require("react");
2237
+ var import_react13 = require("react");
2155
2238
 
2156
2239
  // src/hooks/useTable.ts
2157
- var import_react11 = require("react");
2240
+ var import_react12 = require("react");
2158
2241
  var import_core2 = require("@skygraph/core");
2159
2242
  function useTable(options) {
2160
- const [{ core, table }] = (0, import_react11.useState)(() => {
2243
+ const [{ core, table }] = (0, import_react12.useState)(() => {
2161
2244
  const c = (0, import_core2.createCore)();
2162
2245
  const t = (0, import_core2.createTable)(c, options);
2163
2246
  if (options?.data) {
@@ -2165,14 +2248,14 @@ function useTable(options) {
2165
2248
  }
2166
2249
  return { core: c, table: t };
2167
2250
  });
2168
- const [visibleRows, setVisibleRows] = (0, import_react11.useState)(() => table.getVisibleRows());
2169
- const [tableState, setTableState] = (0, import_react11.useState)(() => table.getTableState());
2170
- const [pinnedColumns, setPinnedColumns] = (0, import_react11.useState)(() => table.getPinnedColumns());
2171
- const [columnWidths, setColumnWidthsState] = (0, import_react11.useState)(
2251
+ const [visibleRows, setVisibleRows] = (0, import_react12.useState)(() => table.getVisibleRows());
2252
+ const [tableState, setTableState] = (0, import_react12.useState)(() => table.getTableState());
2253
+ const [pinnedColumns, setPinnedColumns] = (0, import_react12.useState)(() => table.getPinnedColumns());
2254
+ const [columnWidths, setColumnWidthsState] = (0, import_react12.useState)(
2172
2255
  () => table.getColumnWidths()
2173
2256
  );
2174
- const prevDataRef = (0, import_react11.useRef)(options?.data);
2175
- (0, import_react11.useEffect)(() => {
2257
+ const prevDataRef = (0, import_react12.useRef)(options?.data);
2258
+ (0, import_react12.useEffect)(() => {
2176
2259
  const newData = options?.data;
2177
2260
  if (newData === prevDataRef.current) return;
2178
2261
  prevDataRef.current = newData;
@@ -2183,93 +2266,93 @@ function useTable(options) {
2183
2266
  setVisibleRows(table.getVisibleRows());
2184
2267
  setTableState(table.getTableState());
2185
2268
  }, [options?.data, table]);
2186
- const refresh = (0, import_react11.useCallback)(() => {
2269
+ const refresh = (0, import_react12.useCallback)(() => {
2187
2270
  setVisibleRows(table.getVisibleRows());
2188
2271
  setTableState(table.getTableState());
2189
2272
  setPinnedColumns(table.getPinnedColumns());
2190
2273
  setColumnWidthsState(table.getColumnWidths());
2191
2274
  }, [table]);
2192
- const pinColumn = (0, import_react11.useCallback)(
2275
+ const pinColumn = (0, import_react12.useCallback)(
2193
2276
  (column, side) => {
2194
2277
  table.pinColumn(column, side);
2195
2278
  setPinnedColumns(table.getPinnedColumns());
2196
2279
  },
2197
2280
  [table]
2198
2281
  );
2199
- const clearPinned = (0, import_react11.useCallback)(() => {
2282
+ const clearPinned = (0, import_react12.useCallback)(() => {
2200
2283
  table.clearPinned();
2201
2284
  setPinnedColumns(table.getPinnedColumns());
2202
2285
  }, [table]);
2203
- const setColumnWidth = (0, import_react11.useCallback)(
2286
+ const setColumnWidth = (0, import_react12.useCallback)(
2204
2287
  (column, width) => {
2205
2288
  table.setColumnWidth(column, width);
2206
2289
  setColumnWidthsState(table.getColumnWidths());
2207
2290
  },
2208
2291
  [table]
2209
2292
  );
2210
- const clearColumnWidths = (0, import_react11.useCallback)(() => {
2293
+ const clearColumnWidths = (0, import_react12.useCallback)(() => {
2211
2294
  table.clearColumnWidths();
2212
2295
  setColumnWidthsState(table.getColumnWidths());
2213
2296
  }, [table]);
2214
- const setSort = (0, import_react11.useCallback)(
2297
+ const setSort = (0, import_react12.useCallback)(
2215
2298
  (column, direction) => {
2216
2299
  table.setSort(column, direction);
2217
2300
  refresh();
2218
2301
  },
2219
2302
  [table, refresh]
2220
2303
  );
2221
- const setSorts = (0, import_react11.useCallback)(
2304
+ const setSorts = (0, import_react12.useCallback)(
2222
2305
  (sorts) => {
2223
2306
  table.setSorts(sorts);
2224
2307
  refresh();
2225
2308
  },
2226
2309
  [table, refresh]
2227
2310
  );
2228
- const clearSort = (0, import_react11.useCallback)(() => {
2311
+ const clearSort = (0, import_react12.useCallback)(() => {
2229
2312
  table.clearSort();
2230
2313
  refresh();
2231
2314
  }, [table, refresh]);
2232
- const addFilter = (0, import_react11.useCallback)(
2315
+ const addFilter = (0, import_react12.useCallback)(
2233
2316
  (filter) => {
2234
2317
  table.addFilter(filter);
2235
2318
  refresh();
2236
2319
  },
2237
2320
  [table, refresh]
2238
2321
  );
2239
- const removeFilter = (0, import_react11.useCallback)(
2322
+ const removeFilter = (0, import_react12.useCallback)(
2240
2323
  (column) => {
2241
2324
  table.removeFilter(column);
2242
2325
  refresh();
2243
2326
  },
2244
2327
  [table, refresh]
2245
2328
  );
2246
- const clearFilters = (0, import_react11.useCallback)(() => {
2329
+ const clearFilters = (0, import_react12.useCallback)(() => {
2247
2330
  table.clearFilters();
2248
2331
  refresh();
2249
2332
  }, [table, refresh]);
2250
- const setFilterFn = (0, import_react11.useCallback)(
2333
+ const setFilterFn = (0, import_react12.useCallback)(
2251
2334
  (fn) => {
2252
2335
  table.setFilterFn(fn);
2253
2336
  refresh();
2254
2337
  },
2255
2338
  [table, refresh]
2256
2339
  );
2257
- const setPage = (0, import_react11.useCallback)(
2340
+ const setPage = (0, import_react12.useCallback)(
2258
2341
  (page) => {
2259
2342
  table.setPage(page);
2260
2343
  refresh();
2261
2344
  },
2262
2345
  [table, refresh]
2263
2346
  );
2264
- const nextPage = (0, import_react11.useCallback)(() => {
2347
+ const nextPage = (0, import_react12.useCallback)(() => {
2265
2348
  table.nextPage();
2266
2349
  refresh();
2267
2350
  }, [table, refresh]);
2268
- const prevPage = (0, import_react11.useCallback)(() => {
2351
+ const prevPage = (0, import_react12.useCallback)(() => {
2269
2352
  table.prevPage();
2270
2353
  refresh();
2271
2354
  }, [table, refresh]);
2272
- return (0, import_react11.useMemo)(
2355
+ return (0, import_react12.useMemo)(
2273
2356
  () => ({
2274
2357
  core,
2275
2358
  table,
@@ -2690,36 +2773,36 @@ function useTableState(props) {
2690
2773
  setColumnWidth: persistColumnWidth,
2691
2774
  refresh
2692
2775
  } = useTable(tableOptions);
2693
- const t = (0, import_react12.useMemo)(() => ({ ...DEFAULT_LOCALE, ...locale }), [locale]);
2776
+ const t = (0, import_react13.useMemo)(() => ({ ...DEFAULT_LOCALE, ...locale }), [locale]);
2694
2777
  const hasColumnGroups = columnsProp.some((c) => c.children && c.children.length > 0);
2695
- const leafColumns = (0, import_react12.useMemo)(() => flattenLeafColumns(columnsProp), [columnsProp]);
2696
- const headerRows = (0, import_react12.useMemo)(
2778
+ const leafColumns = (0, import_react13.useMemo)(() => flattenLeafColumns(columnsProp), [columnsProp]);
2779
+ const headerRows = (0, import_react13.useMemo)(
2697
2780
  () => hasColumnGroups ? buildHeaderRows(columnsProp) : null,
2698
2781
  [columnsProp, hasColumnGroups]
2699
2782
  );
2700
- const [internalSorts, setInternalSorts] = (0, import_react12.useState)([]);
2783
+ const [internalSorts, setInternalSorts] = (0, import_react13.useState)([]);
2701
2784
  const sorts = controlledSorts ?? internalSorts;
2702
- const [colWidths, setColWidths] = (0, import_react12.useState)(() => {
2785
+ const [colWidths, setColWidths] = (0, import_react13.useState)(() => {
2703
2786
  const w = {};
2704
2787
  for (const c of leafColumns) {
2705
2788
  w[c.key] = persistedColWidths[c.key] ?? c.width ?? DEFAULT_COL_WIDTH;
2706
2789
  }
2707
2790
  return w;
2708
2791
  });
2709
- const [userResizedCols, setUserResizedCols] = (0, import_react12.useState)(
2792
+ const [userResizedCols, setUserResizedCols] = (0, import_react13.useState)(
2710
2793
  () => new Set(Object.keys(persistedColWidths))
2711
2794
  );
2712
- const [colOrder, setColOrder] = (0, import_react12.useState)(() => leafColumns.map((c) => c.key));
2713
- const [dragCol, setDragCol] = (0, import_react12.useState)(null);
2714
- const [dragOver, setDragOver] = (0, import_react12.useState)(null);
2715
- const [internalHidden, setInternalHidden] = (0, import_react12.useState)(
2795
+ const [colOrder, setColOrder] = (0, import_react13.useState)(() => leafColumns.map((c) => c.key));
2796
+ const [dragCol, setDragCol] = (0, import_react13.useState)(null);
2797
+ const [dragOver, setDragOver] = (0, import_react13.useState)(null);
2798
+ const [internalHidden, setInternalHidden] = (0, import_react13.useState)(
2716
2799
  () => new Set(hiddenColumnsProp ?? [])
2717
2800
  );
2718
- const hiddenSet = (0, import_react12.useMemo)(
2801
+ const hiddenSet = (0, import_react13.useMemo)(
2719
2802
  () => hiddenColumnsProp ? new Set(hiddenColumnsProp) : internalHidden,
2720
2803
  [hiddenColumnsProp, internalHidden]
2721
2804
  );
2722
- const toggleColumnVisibility = (0, import_react12.useCallback)(
2805
+ const toggleColumnVisibility = (0, import_react13.useCallback)(
2723
2806
  (key) => {
2724
2807
  if (onHiddenColumnsChange) {
2725
2808
  const current = hiddenColumnsProp ?? [];
@@ -2739,7 +2822,7 @@ function useTableState(props) {
2739
2822
  },
2740
2823
  [hiddenColumnsProp, onHiddenColumnsChange]
2741
2824
  );
2742
- const [internalExpanded, setInternalExpanded] = (0, import_react12.useState)(() => {
2825
+ const [internalExpanded, setInternalExpanded] = (0, import_react13.useState)(() => {
2743
2826
  if (tree?.defaultExpandAllRows) {
2744
2827
  const childrenKey2 = tree.childrenColumnName ?? "children";
2745
2828
  return new Set(collectAllTreeIds(props.data ?? [], childrenKey2));
@@ -2747,15 +2830,15 @@ function useTableState(props) {
2747
2830
  return new Set(expandable?.defaultExpandedRowKeys ?? []);
2748
2831
  });
2749
2832
  const expandedKeys = expandable?.expandedKeys ? new Set(expandable.expandedKeys) : internalExpanded;
2750
- const [treeExpanded, setTreeExpanded] = (0, import_react12.useState)(() => {
2833
+ const [treeExpanded, setTreeExpanded] = (0, import_react13.useState)(() => {
2751
2834
  if (tree?.defaultExpandAllRows) {
2752
2835
  const childrenKey2 = tree.childrenColumnName ?? "children";
2753
2836
  return new Set(collectAllTreeIds(props.data ?? [], childrenKey2));
2754
2837
  }
2755
2838
  return /* @__PURE__ */ new Set();
2756
2839
  });
2757
- const [searchText, setSearchText] = (0, import_react12.useState)("");
2758
- const [activeFilters, setActiveFilters] = (0, import_react12.useState)(() => {
2840
+ const [searchText, setSearchText] = (0, import_react13.useState)("");
2841
+ const [activeFilters, setActiveFilters] = (0, import_react13.useState)(() => {
2759
2842
  const init = {};
2760
2843
  for (const col of leafColumns) {
2761
2844
  if (col.filteredValue) {
@@ -2766,12 +2849,12 @@ function useTableState(props) {
2766
2849
  }
2767
2850
  return init;
2768
2851
  });
2769
- const [filterSearchText, setFilterSearchText] = (0, import_react12.useState)({});
2770
- const [openFilterDropdown, setOpenFilterDropdown] = (0, import_react12.useState)(null);
2771
- const [advancedFilters, setAdvancedFiltersState] = (0, import_react12.useState)({});
2772
- const filterRef = (0, import_react12.useRef)(null);
2773
- const [filterAnchor, setFilterAnchor] = (0, import_react12.useState)(null);
2774
- const setAdvancedFilter = (0, import_react12.useCallback)(
2852
+ const [filterSearchText, setFilterSearchText] = (0, import_react13.useState)({});
2853
+ const [openFilterDropdown, setOpenFilterDropdown] = (0, import_react13.useState)(null);
2854
+ const [advancedFilters, setAdvancedFiltersState] = (0, import_react13.useState)({});
2855
+ const filterRef = (0, import_react13.useRef)(null);
2856
+ const [filterAnchor, setFilterAnchor] = (0, import_react13.useState)(null);
2857
+ const setAdvancedFilter = (0, import_react13.useCallback)(
2775
2858
  (colKey, filter) => {
2776
2859
  setAdvancedFiltersState((prev) => {
2777
2860
  const next = { ...prev };
@@ -2784,16 +2867,16 @@ function useTableState(props) {
2784
2867
  },
2785
2868
  [table, refresh]
2786
2869
  );
2787
- const resizeRef = (0, import_react12.useRef)(null);
2788
- const [contextMenu, setContextMenu] = (0, import_react12.useState)(null);
2789
- const columns = (0, import_react12.useMemo)(() => {
2870
+ const resizeRef = (0, import_react13.useRef)(null);
2871
+ const [contextMenu, setContextMenu] = (0, import_react13.useState)(null);
2872
+ const columns = (0, import_react13.useMemo)(() => {
2790
2873
  const base = hasColumnGroups ? leafColumns : (() => {
2791
2874
  const map = new Map(leafColumns.map((c) => [c.key, c]));
2792
2875
  return colOrder.filter((k) => map.has(k)).map((k) => map.get(k));
2793
2876
  })();
2794
2877
  return base.filter((c) => !hiddenSet.has(c.key) && !c.hidden);
2795
2878
  }, [leafColumns, colOrder, hasColumnGroups, hiddenSet]);
2796
- (0, import_react12.useEffect)(() => {
2879
+ (0, import_react13.useEffect)(() => {
2797
2880
  const keys = leafColumns.map((c) => c.key);
2798
2881
  setColOrder((prev) => {
2799
2882
  const prevSet = new Set(prev);
@@ -2802,7 +2885,7 @@ function useTableState(props) {
2802
2885
  return [...valid, ...added];
2803
2886
  });
2804
2887
  }, [leafColumns]);
2805
- (0, import_react12.useEffect)(() => {
2888
+ (0, import_react13.useEffect)(() => {
2806
2889
  for (const col of leafColumns) {
2807
2890
  if (col.filteredValue !== void 0) {
2808
2891
  setActiveFilters((prev) => {
@@ -2812,7 +2895,7 @@ function useTableState(props) {
2812
2895
  }
2813
2896
  }
2814
2897
  }, [leafColumns]);
2815
- (0, import_react12.useEffect)(() => {
2898
+ (0, import_react13.useEffect)(() => {
2816
2899
  const colFilters = columns.filter((c) => c.onFilter && activeFilters[c.key]?.length);
2817
2900
  const hasSearch = searchable && searchText.length > 0;
2818
2901
  if (colFilters.length === 0 && !hasSearch) {
@@ -2835,7 +2918,7 @@ function useTableState(props) {
2835
2918
  return true;
2836
2919
  });
2837
2920
  }, [activeFilters, searchText, searchable, setFilterFn, columns]);
2838
- (0, import_react12.useEffect)(() => {
2921
+ (0, import_react13.useEffect)(() => {
2839
2922
  if (!openFilterDropdown) return;
2840
2923
  const handle = (e) => {
2841
2924
  if (filterRef.current && !filterRef.current.contains(e.target)) {
@@ -2845,7 +2928,7 @@ function useTableState(props) {
2845
2928
  document.addEventListener("mousedown", handle);
2846
2929
  return () => document.removeEventListener("mousedown", handle);
2847
2930
  }, [openFilterDropdown]);
2848
- const handleSort = (0, import_react12.useCallback)(
2931
+ const handleSort = (0, import_react13.useCallback)(
2849
2932
  (col, shiftKey) => {
2850
2933
  if (!col.sortable) return;
2851
2934
  if (multiSort && shiftKey) {
@@ -2894,14 +2977,14 @@ function useTableState(props) {
2894
2977
  },
2895
2978
  [multiSort, sorts, onSortsChange, setSort, setSorts, clearSort]
2896
2979
  );
2897
- const getSortIndex = (0, import_react12.useCallback)(
2980
+ const getSortIndex = (0, import_react13.useCallback)(
2898
2981
  (colKey) => {
2899
2982
  if (!multiSort || sorts.length <= 1) return -1;
2900
2983
  return sorts.findIndex((s) => s.column === colKey);
2901
2984
  },
2902
2985
  [multiSort, sorts]
2903
2986
  );
2904
- const getSortDirection = (0, import_react12.useCallback)(
2987
+ const getSortDirection = (0, import_react13.useCallback)(
2905
2988
  (colKey) => {
2906
2989
  const found = sorts.find((s) => s.column === colKey);
2907
2990
  return found?.direction ?? null;
@@ -3051,19 +3134,19 @@ function useTableState(props) {
3051
3134
  setDragCol(null);
3052
3135
  setDragOver(null);
3053
3136
  };
3054
- const handlePinColumn = (0, import_react12.useCallback)(
3137
+ const handlePinColumn = (0, import_react13.useCallback)(
3055
3138
  (key, fixed) => {
3056
3139
  onColumnPinChange?.(key, fixed);
3057
3140
  },
3058
3141
  [onColumnPinChange]
3059
3142
  );
3060
- const [isFullscreen, setIsFullscreen] = (0, import_react12.useState)(false);
3061
- const wrapperRef = (0, import_react12.useRef)(null);
3062
- const toggleFullscreen = (0, import_react12.useCallback)(() => {
3143
+ const [isFullscreen, setIsFullscreen] = (0, import_react13.useState)(false);
3144
+ const wrapperRef = (0, import_react13.useRef)(null);
3145
+ const toggleFullscreen = (0, import_react13.useCallback)(() => {
3063
3146
  setIsFullscreen((prev) => !prev);
3064
3147
  }, []);
3065
- const [density, setDensity] = (0, import_react12.useState)("middle");
3066
- (0, import_react12.useEffect)(() => {
3148
+ const [density, setDensity] = (0, import_react13.useState)("middle");
3149
+ (0, import_react13.useEffect)(() => {
3067
3150
  if (!groupBy) {
3068
3151
  table.clearGroupBy();
3069
3152
  return;
@@ -3074,10 +3157,10 @@ function useTableState(props) {
3074
3157
  }));
3075
3158
  table.groupBy(groupBy, aggregates2);
3076
3159
  }, [groupBy, leafColumns, table]);
3077
- const [expandedGroups, setExpandedGroups] = (0, import_react12.useState)(() => {
3160
+ const [expandedGroups, setExpandedGroups] = (0, import_react13.useState)(() => {
3078
3161
  return defaultGroupExpanded ? /* @__PURE__ */ new Set(["__all__"]) : /* @__PURE__ */ new Set();
3079
3162
  });
3080
- const toggleGroupExpand = (0, import_react12.useCallback)(
3163
+ const toggleGroupExpand = (0, import_react13.useCallback)(
3081
3164
  (groupKey) => {
3082
3165
  setExpandedGroups((prev) => {
3083
3166
  const next = new Set(prev);
@@ -3093,18 +3176,18 @@ function useTableState(props) {
3093
3176
  },
3094
3177
  [onGroupExpandChange]
3095
3178
  );
3096
- const expandAllGroups = (0, import_react12.useCallback)(() => {
3179
+ const expandAllGroups = (0, import_react13.useCallback)(() => {
3097
3180
  setExpandedGroups((prev) => {
3098
3181
  const next = new Set(prev);
3099
3182
  next.add("__all__");
3100
3183
  return next;
3101
3184
  });
3102
3185
  }, []);
3103
- const collapseAllGroups = (0, import_react12.useCallback)(() => {
3186
+ const collapseAllGroups = (0, import_react13.useCallback)(() => {
3104
3187
  setExpandedGroups(/* @__PURE__ */ new Set());
3105
3188
  }, []);
3106
- const [focusedCell, setFocusedCell] = (0, import_react12.useState)(null);
3107
- const handleKeyNav = (0, import_react12.useCallback)(
3189
+ const [focusedCell, setFocusedCell] = (0, import_react13.useState)(null);
3190
+ const handleKeyNav = (0, import_react13.useCallback)(
3108
3191
  (e) => {
3109
3192
  if (!keyboardNavigation || !focusedCell) return;
3110
3193
  const maxRow = visibleRows.length - 1;
@@ -3160,7 +3243,7 @@ function useTableState(props) {
3160
3243
  },
3161
3244
  [keyboardNavigation, focusedCell, visibleRows.length, columns.length]
3162
3245
  );
3163
- const handleAutoResize = (0, import_react12.useCallback)(
3246
+ const handleAutoResize = (0, import_react13.useCallback)(
3164
3247
  (colKey) => {
3165
3248
  const maxLen = visibleRows.reduce((max, row) => {
3166
3249
  const val = String(row.data[colKey] ?? "");
@@ -3180,7 +3263,7 @@ function useTableState(props) {
3180
3263
  const isTreeMode = !!tree;
3181
3264
  const childrenKey = tree?.childrenColumnName ?? "children";
3182
3265
  const indentSize = tree?.indentSize ?? 20;
3183
- const baseFlatRows = (0, import_react12.useMemo)(() => {
3266
+ const baseFlatRows = (0, import_react13.useMemo)(() => {
3184
3267
  if (!isTreeMode) {
3185
3268
  return visibleRows.map((r) => ({
3186
3269
  id: r.id,
@@ -3191,7 +3274,7 @@ function useTableState(props) {
3191
3274
  }
3192
3275
  return flattenTreeRows(visibleRows, childrenKey, treeExpanded);
3193
3276
  }, [visibleRows, isTreeMode, childrenKey, treeExpanded]);
3194
- const groupedRows = (0, import_react12.useMemo)(() => {
3277
+ const groupedRows = (0, import_react13.useMemo)(() => {
3195
3278
  if (!groupBy) return baseFlatRows;
3196
3279
  const allExpanded = expandedGroups.has("__all__");
3197
3280
  const effectiveExpanded = allExpanded ? /* @__PURE__ */ new Set([...expandedGroups, ...baseFlatRows.map((r) => String(r.data[groupBy] ?? "Other"))]) : expandedGroups;
@@ -3201,12 +3284,12 @@ function useTableState(props) {
3201
3284
  top: pinnedTop,
3202
3285
  middle: middleRows,
3203
3286
  bottom: pinnedBottom
3204
- } = (0, import_react12.useMemo)(
3287
+ } = (0, import_react13.useMemo)(
3205
3288
  () => separatePinnedRows(groupedRows, pinnedRowsConfig?.top, pinnedRowsConfig?.bottom),
3206
3289
  [groupedRows, pinnedRowsConfig]
3207
3290
  );
3208
3291
  const flatRows = groupedRows;
3209
- const aggregates = (0, import_react12.useMemo)(
3292
+ const aggregates = (0, import_react13.useMemo)(
3210
3293
  () => computeColumnAggregates(columns, baseFlatRows),
3211
3294
  [columns, baseFlatRows]
3212
3295
  );
@@ -3242,7 +3325,7 @@ function useTableState(props) {
3242
3325
  });
3243
3326
  const gridTemplate = [...extraBefore, ...colTemplates].join(" ");
3244
3327
  const totalCols = extraBefore.length + columns.length;
3245
- const fixedLeftOffsets = (0, import_react12.useMemo)(() => {
3328
+ const fixedLeftOffsets = (0, import_react13.useMemo)(() => {
3246
3329
  const o = {};
3247
3330
  const selW = parseInt(SELECTION_COL_WIDTH);
3248
3331
  let left = (rowSelection ? selW : 0) + (expandable ? selW : 0);
@@ -3254,7 +3337,7 @@ function useTableState(props) {
3254
3337
  }
3255
3338
  return o;
3256
3339
  }, [columns, colWidths, rowSelection, expandable]);
3257
- const fixedRightOffsets = (0, import_react12.useMemo)(() => {
3340
+ const fixedRightOffsets = (0, import_react13.useMemo)(() => {
3258
3341
  const o = {};
3259
3342
  let right = 0;
3260
3343
  for (let i = columns.length - 1; i >= 0; i--) {
@@ -3268,8 +3351,8 @@ function useTableState(props) {
3268
3351
  const fixedStyle = (col, isHeader) => getFixedStyle(col, fixedLeftOffsets, fixedRightOffsets, isHeader);
3269
3352
  const allSelected = rowSelection ? visibleRows.length > 0 && visibleRows.every((r) => rowSelection.selectedKeys.includes(r.id)) : false;
3270
3353
  const someSelected = rowSelection ? visibleRows.some((r) => rowSelection.selectedKeys.includes(r.id)) && !allSelected : false;
3271
- const spanMap = (0, import_react12.useMemo)(() => computeSpanMap(columns, flatRows), [columns, flatRows]);
3272
- const hiddenCells = (0, import_react12.useMemo)(
3354
+ const spanMap = (0, import_react13.useMemo)(() => computeSpanMap(columns, flatRows), [columns, flatRows]);
3355
+ const hiddenCells = (0, import_react13.useMemo)(
3273
3356
  () => computeHiddenCells(columns, flatRows, spanMap),
3274
3357
  [columns, flatRows, spanMap]
3275
3358
  );
@@ -3524,14 +3607,14 @@ function TableInner(props, forwardedRef) {
3524
3607
  const bordered = borderedProp ?? config.bordered ?? false;
3525
3608
  const loading = loadingProp ?? false;
3526
3609
  const state = useTableState(props);
3527
- const tableRef = (0, import_react13.useRef)(null);
3528
- const scrollRef = (0, import_react13.useRef)(null);
3610
+ const tableRef = (0, import_react14.useRef)(null);
3611
+ const scrollRef = (0, import_react14.useRef)(null);
3529
3612
  const effectiveSize = densityToggle ? state.density : sizeFromProp;
3530
- const rowNumConfig = (0, import_react13.useMemo)(
3613
+ const rowNumConfig = (0, import_react14.useMemo)(
3531
3614
  () => showRowNumber ? typeof showRowNumber === "object" ? showRowNumber : {} : null,
3532
3615
  [showRowNumber]
3533
3616
  );
3534
- const getExportData = (0, import_react13.useCallback)(() => {
3617
+ const getExportData = (0, import_react14.useCallback)(() => {
3535
3618
  const cols = state.columns.map((c) => c.key);
3536
3619
  const headers = state.columns.map((c) => typeof c.title === "string" ? c.title : c.key);
3537
3620
  const rows = state.flatRows.filter((r) => !r.__groupRow).map(
@@ -3542,7 +3625,7 @@ function TableInner(props, forwardedRef) {
3542
3625
  );
3543
3626
  return { cols, headers, rows };
3544
3627
  }, [state.columns, state.flatRows]);
3545
- const handleExportCSV = (0, import_react13.useCallback)(() => {
3628
+ const handleExportCSV = (0, import_react14.useCallback)(() => {
3546
3629
  const { headers, rows } = getExportData();
3547
3630
  const data = [headers, ...rows];
3548
3631
  if (onExport) {
@@ -3551,31 +3634,31 @@ function TableInner(props, forwardedRef) {
3551
3634
  downloadCSV(toCSVString(data));
3552
3635
  }
3553
3636
  }, [getExportData, onExport]);
3554
- const handleExportJSON = (0, import_react13.useCallback)(() => {
3637
+ const handleExportJSON = (0, import_react14.useCallback)(() => {
3555
3638
  const { headers, rows } = getExportData();
3556
3639
  downloadJSON(toJSONString(headers, rows));
3557
3640
  }, [getExportData]);
3558
- const handleCopy = (0, import_react13.useCallback)(async () => {
3641
+ const handleCopy = (0, import_react14.useCallback)(async () => {
3559
3642
  const { headers, rows } = getExportData();
3560
3643
  await copyToClipboard(toTSVString([headers, ...rows]));
3561
3644
  }, [getExportData]);
3562
- const printOptionsFromProp = (0, import_react13.useMemo)(() => {
3645
+ const printOptionsFromProp = (0, import_react14.useMemo)(() => {
3563
3646
  if (typeof printable === "object" && printable !== null) {
3564
3647
  return { fileName: printable.fileName };
3565
3648
  }
3566
3649
  return {};
3567
3650
  }, [printable]);
3568
- const doPrint = (0, import_react13.useCallback)(
3651
+ const doPrint = (0, import_react14.useCallback)(
3569
3652
  (opts) => {
3570
3653
  printElement(tableRef.current, { ...printOptionsFromProp, ...opts ?? {} });
3571
3654
  },
3572
3655
  [printOptionsFromProp]
3573
3656
  );
3574
- const handlePrint = (0, import_react13.useCallback)(() => {
3657
+ const handlePrint = (0, import_react14.useCallback)(() => {
3575
3658
  doPrint();
3576
3659
  }, [doPrint]);
3577
- (0, import_react13.useImperativeHandle)(forwardedRef, () => ({ print: doPrint }), [doPrint]);
3578
- const gridTemplate = (0, import_react13.useMemo)(() => {
3660
+ (0, import_react14.useImperativeHandle)(forwardedRef, () => ({ print: doPrint }), [doPrint]);
3661
+ const gridTemplate = (0, import_react14.useMemo)(() => {
3579
3662
  const parts = [];
3580
3663
  if (rowDraggable) parts.push(DRAG_HANDLE_WIDTH);
3581
3664
  if (rowNumConfig) parts.push(rowNumConfig.width ? `${rowNumConfig.width}px` : ROW_NUMBER_WIDTH);
@@ -4006,7 +4089,7 @@ function TableInner(props, forwardedRef) {
4006
4089
  }
4007
4090
  );
4008
4091
  }
4009
- var Table = (0, import_react13.forwardRef)(TableInner);
4092
+ var Table = (0, import_react14.forwardRef)(TableInner);
4010
4093
  Table.displayName = "Table";
4011
4094
  function ColumnVisibilityDropdown({
4012
4095
  leafColumns,
@@ -4014,9 +4097,9 @@ function ColumnVisibilityDropdown({
4014
4097
  onToggle,
4015
4098
  label
4016
4099
  }) {
4017
- const [open, setOpen] = import_react13.default.useState(false);
4018
- const ref = import_react13.default.useRef(null);
4019
- import_react13.default.useEffect(() => {
4100
+ const [open, setOpen] = import_react14.default.useState(false);
4101
+ const ref = import_react14.default.useRef(null);
4102
+ import_react14.default.useEffect(() => {
4020
4103
  if (!open) return;
4021
4104
  const h = (e) => {
4022
4105
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -4038,9 +4121,9 @@ function GroupByDropdown({
4038
4121
  onChange,
4039
4122
  t
4040
4123
  }) {
4041
- const [open, setOpen] = import_react13.default.useState(false);
4042
- const ref = import_react13.default.useRef(null);
4043
- import_react13.default.useEffect(() => {
4124
+ const [open, setOpen] = import_react14.default.useState(false);
4125
+ const ref = import_react14.default.useRef(null);
4126
+ import_react14.default.useEffect(() => {
4044
4127
  if (!open) return;
4045
4128
  const h = (e) => {
4046
4129
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -4088,9 +4171,9 @@ function DensityDropdown({
4088
4171
  onChange,
4089
4172
  t
4090
4173
  }) {
4091
- const [open, setOpen] = import_react13.default.useState(false);
4092
- const ref = import_react13.default.useRef(null);
4093
- import_react13.default.useEffect(() => {
4174
+ const [open, setOpen] = import_react14.default.useState(false);
4175
+ const ref = import_react14.default.useRef(null);
4176
+ import_react14.default.useEffect(() => {
4094
4177
  if (!open) return;
4095
4178
  const h = (e) => {
4096
4179
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);