@skygraph/react 0.5.2 → 0.6.4

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 (51) 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-NXB3VAVF.js → chunk-7AA2JPZB.js} +148 -61
  7. package/dist/chunk-7AA2JPZB.js.map +1 -0
  8. package/dist/{chunk-Z5UGF7EO.js → chunk-EFDB2ENB.js} +87 -25
  9. package/dist/chunk-EFDB2ENB.js.map +1 -0
  10. package/dist/{chunk-UO6VJC3C.js → chunk-KGFFQGCM.js} +3 -3
  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-Y6XZ5TLD.js} +93 -47
  15. package/dist/chunk-Y6XZ5TLD.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 +168 -86
  25. package/dist/form.cjs.map +1 -1
  26. package/dist/form.d.cts +1 -1
  27. package/dist/form.d.ts +1 -1
  28. package/dist/form.js +3 -3
  29. package/dist/index.cjs +1549 -1021
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +157 -7
  32. package/dist/index.d.ts +157 -7
  33. package/dist/index.js +444 -231
  34. package/dist/index.js.map +1 -1
  35. package/dist/table.cjs +344 -221
  36. package/dist/table.cjs.map +1 -1
  37. package/dist/table.d.cts +1 -1
  38. package/dist/table.d.ts +1 -1
  39. package/dist/table.js +4 -4
  40. package/dist/tree.cjs.map +1 -1
  41. package/dist/tree.js +3 -3
  42. package/package.json +2 -2
  43. package/dist/chunk-2OCEO636.js +0 -91
  44. package/dist/chunk-2OCEO636.js.map +0 -1
  45. package/dist/chunk-GJDDPZH7.js.map +0 -1
  46. package/dist/chunk-MLEBVELO.js.map +0 -1
  47. package/dist/chunk-NXB3VAVF.js.map +0 -1
  48. package/dist/chunk-Z5UGF7EO.js.map +0 -1
  49. package/dist/chunk-ZJF6SJLP.js.map +0 -1
  50. /package/dist/{chunk-UO6VJC3C.js.map → chunk-KGFFQGCM.js.map} +0 -0
  51. /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,14 +1741,11 @@ function TableBody(props) {
1658
1741
  onContextMenu({ x: e.clientX, y: e.clientY, items });
1659
1742
  }
1660
1743
  };
1661
- const handleCellCopy = (0, import_react8.useCallback)(
1662
- async (rowId, colKey, value) => {
1663
- await copyToClipboard(String(value ?? ""));
1664
- setCopiedCell(`${rowId}:${colKey}`);
1665
- setTimeout(() => setCopiedCell(null), 1500);
1666
- },
1667
- []
1668
- );
1744
+ const handleCellCopy = (0, import_react9.useCallback)(async (rowId, colKey, value) => {
1745
+ await copyToClipboard(String(value ?? ""));
1746
+ setCopiedCell(`${rowId}:${colKey}`);
1747
+ setTimeout(() => setCopiedCell(null), 1500);
1748
+ }, []);
1669
1749
  if (flatRows.length === 0) {
1670
1750
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1671
1751
  "div",
@@ -1702,7 +1782,7 @@ function TableBody(props) {
1702
1782
  const isDragOver = dragOverRowIdx === rowIdx && dragRowIdx !== rowIdx;
1703
1783
  const isPinned = isPinnedSection;
1704
1784
  const virtualIndexAttr = rowIndexOffset !== void 0 ? rowIndexOffset + rowIdx : void 0;
1705
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react8.default.Fragment, { children: [
1785
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react9.default.Fragment, { children: [
1706
1786
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1707
1787
  "div",
1708
1788
  {
@@ -1730,7 +1810,13 @@ function TableBody(props) {
1730
1810
  {
1731
1811
  className: "sg-table-td sg-table-cell-drag-handle",
1732
1812
  role: "cell",
1733
- style: { cursor: "grab", userSelect: "none", display: "flex", alignItems: "center", justifyContent: "center" },
1813
+ style: {
1814
+ cursor: "grab",
1815
+ userSelect: "none",
1816
+ display: "flex",
1817
+ alignItems: "center",
1818
+ justifyContent: "center"
1819
+ },
1734
1820
  children: "\u283F"
1735
1821
  }
1736
1822
  ),
@@ -1742,10 +1828,24 @@ function TableBody(props) {
1742
1828
  role: "cell",
1743
1829
  onClick: (e) => {
1744
1830
  e.stopPropagation();
1745
- onSelectRow(row.id, row.data);
1831
+ if (e.target === e.currentTarget) {
1832
+ onSelectRow(row.id, row.data);
1833
+ }
1746
1834
  },
1747
- children: rowSelection.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", { type: "radio", checked: !!isSelected, readOnly: true }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Checkbox, { checked: !!isSelected, onChange: () => {
1748
- } })
1835
+ children: rowSelection.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1836
+ "input",
1837
+ {
1838
+ type: "radio",
1839
+ checked: !!isSelected,
1840
+ onChange: () => onSelectRow(row.id, row.data)
1841
+ }
1842
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1843
+ Checkbox,
1844
+ {
1845
+ checked: !!isSelected,
1846
+ onChange: () => onSelectRow(row.id, row.data)
1847
+ }
1848
+ )
1749
1849
  }
1750
1850
  ),
1751
1851
  expandable && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "sg-table-td sg-table-cell-expand", role: "cell", children: canExpand && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
@@ -1768,10 +1868,8 @@ function TableBody(props) {
1768
1868
  const isFocused = keyboardNavigation && focusedCell?.row === rowIdx && focusedCell?.col === colIndex;
1769
1869
  const isCopied = copiedCell === cellKey;
1770
1870
  const cellStyle = { ...fixedStyle(col) };
1771
- if (span?.colSpan && span.colSpan > 1)
1772
- cellStyle.gridColumn = `span ${span.colSpan}`;
1773
- if (span?.rowSpan && span.rowSpan > 1)
1774
- cellStyle.gridRow = `span ${span.rowSpan}`;
1871
+ if (span?.colSpan && span.colSpan > 1) cellStyle.gridColumn = `span ${span.colSpan}`;
1872
+ if (span?.rowSpan && span.rowSpan > 1) cellStyle.gridRow = `span ${span.rowSpan}`;
1775
1873
  const isFirstCol = colIndex === 0;
1776
1874
  const treeIndent = isTreeMode && isFirstCol ? row.depth * indentSize : 0;
1777
1875
  const cellClsExtra = typeof col.cellClassName === "function" ? col.cellClassName(val, row.data, row.id) : col.cellClassName ?? "";
@@ -1877,7 +1975,7 @@ function TableBody(props) {
1877
1975
  }
1878
1976
 
1879
1977
  // src/components/complex/Table/VirtualTableBody.tsx
1880
- var import_react9 = require("react");
1978
+ var import_react10 = require("react");
1881
1979
  var import_core = require("@skygraph/core");
1882
1980
  var import_jsx_runtime12 = require("react/jsx-runtime");
1883
1981
  var DEFAULT_ROW_HEIGHT = 40;
@@ -1907,7 +2005,7 @@ function VirtualTableBody(props) {
1907
2005
  } = props;
1908
2006
  const isDeclarative = typeof rowHeight === "function";
1909
2007
  const isDynamic = isDeclarative || estimateRowHeight != null;
1910
- const virtual = (0, import_react9.useMemo)(
2008
+ const virtual = (0, import_react10.useMemo)(
1911
2009
  () => (0, import_core.createVirtual)({
1912
2010
  itemCount: flatRows.length,
1913
2011
  itemHeight: buildEstimate(rowHeight, estimateRowHeight, flatRows),
@@ -1916,13 +2014,13 @@ function VirtualTableBody(props) {
1916
2014
  // eslint-disable-next-line react-hooks/exhaustive-deps
1917
2015
  []
1918
2016
  );
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)(() => {
2017
+ const [, forceUpdate] = (0, import_react10.useReducer)((n) => n + 1, 0);
2018
+ (0, import_react10.useEffect)(() => virtual.subscribe(() => forceUpdate()), [virtual]);
2019
+ (0, import_react10.useEffect)(() => {
1922
2020
  virtual.setItemCount(flatRows.length);
1923
2021
  virtual.setItemHeight(buildEstimate(rowHeight, estimateRowHeight, flatRows));
1924
2022
  }, [virtual, flatRows, rowHeight, estimateRowHeight]);
1925
- (0, import_react9.useEffect)(() => {
2023
+ (0, import_react10.useEffect)(() => {
1926
2024
  if (!isDeclarative) return;
1927
2025
  const fn = rowHeight;
1928
2026
  for (let i = 0; i < flatRows.length; i++) {
@@ -1934,9 +2032,9 @@ function VirtualTableBody(props) {
1934
2032
  }
1935
2033
  }
1936
2034
  }, [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)(() => {
2035
+ const [scrollTop, setScrollTop] = (0, import_react10.useState)(0);
2036
+ const [viewportHeight, setViewportHeight] = (0, import_react10.useState)(0);
2037
+ (0, import_react10.useEffect)(() => {
1940
2038
  const el = scrollContainerRef.current;
1941
2039
  if (!el) return;
1942
2040
  setViewportHeight(el.clientHeight);
@@ -1965,9 +2063,9 @@ function VirtualTableBody(props) {
1965
2063
  );
1966
2064
  const bottomPad = Math.max(0, totalHeight - topPad - visibleSize);
1967
2065
  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)(() => {
2066
+ const roRef = (0, import_react10.useRef)(null);
2067
+ const observedCellsRef = (0, import_react10.useRef)(/* @__PURE__ */ new Set());
2068
+ (0, import_react10.useEffect)(() => {
1971
2069
  if (!isDynamic) return;
1972
2070
  if (isDeclarative) return;
1973
2071
  if (typeof ResizeObserver === "undefined") return;
@@ -1987,7 +2085,7 @@ function VirtualTableBody(props) {
1987
2085
  observedCellsRef.current.clear();
1988
2086
  };
1989
2087
  }, [isDynamic, isDeclarative, virtual]);
1990
- (0, import_react9.useLayoutEffect)(() => {
2088
+ (0, import_react10.useLayoutEffect)(() => {
1991
2089
  if (!isDynamic) return;
1992
2090
  const grid = scrollContainerRef.current?.querySelector(".sg-table-grid");
1993
2091
  if (!grid) return;
@@ -2064,12 +2162,12 @@ function VirtualTableBody(props) {
2064
2162
  }
2065
2163
 
2066
2164
  // src/components/complex/Table/ContextMenu.tsx
2067
- var import_react10 = require("react");
2165
+ var import_react11 = require("react");
2068
2166
  var import_jsx_runtime13 = require("react/jsx-runtime");
2069
2167
  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)(() => {
2168
+ const ref = (0, import_react11.useRef)(null);
2169
+ const [subMenu, setSubMenu] = (0, import_react11.useState)(null);
2170
+ (0, import_react11.useEffect)(() => {
2073
2171
  if (!state) return;
2074
2172
  const handle = (e) => {
2075
2173
  if (ref.current && !ref.current.contains(e.target)) {
@@ -2151,13 +2249,13 @@ function ContextMenu({ state, onClose }) {
2151
2249
  }
2152
2250
 
2153
2251
  // src/components/complex/Table/useTableState.ts
2154
- var import_react12 = require("react");
2252
+ var import_react13 = require("react");
2155
2253
 
2156
2254
  // src/hooks/useTable.ts
2157
- var import_react11 = require("react");
2255
+ var import_react12 = require("react");
2158
2256
  var import_core2 = require("@skygraph/core");
2159
2257
  function useTable(options) {
2160
- const [{ core, table }] = (0, import_react11.useState)(() => {
2258
+ const [{ core, table }] = (0, import_react12.useState)(() => {
2161
2259
  const c = (0, import_core2.createCore)();
2162
2260
  const t = (0, import_core2.createTable)(c, options);
2163
2261
  if (options?.data) {
@@ -2165,14 +2263,14 @@ function useTable(options) {
2165
2263
  }
2166
2264
  return { core: c, table: t };
2167
2265
  });
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)(
2266
+ const [visibleRows, setVisibleRows] = (0, import_react12.useState)(() => table.getVisibleRows());
2267
+ const [tableState, setTableState] = (0, import_react12.useState)(() => table.getTableState());
2268
+ const [pinnedColumns, setPinnedColumns] = (0, import_react12.useState)(() => table.getPinnedColumns());
2269
+ const [columnWidths, setColumnWidthsState] = (0, import_react12.useState)(
2172
2270
  () => table.getColumnWidths()
2173
2271
  );
2174
- const prevDataRef = (0, import_react11.useRef)(options?.data);
2175
- (0, import_react11.useEffect)(() => {
2272
+ const prevDataRef = (0, import_react12.useRef)(options?.data);
2273
+ (0, import_react12.useEffect)(() => {
2176
2274
  const newData = options?.data;
2177
2275
  if (newData === prevDataRef.current) return;
2178
2276
  prevDataRef.current = newData;
@@ -2183,93 +2281,93 @@ function useTable(options) {
2183
2281
  setVisibleRows(table.getVisibleRows());
2184
2282
  setTableState(table.getTableState());
2185
2283
  }, [options?.data, table]);
2186
- const refresh = (0, import_react11.useCallback)(() => {
2284
+ const refresh = (0, import_react12.useCallback)(() => {
2187
2285
  setVisibleRows(table.getVisibleRows());
2188
2286
  setTableState(table.getTableState());
2189
2287
  setPinnedColumns(table.getPinnedColumns());
2190
2288
  setColumnWidthsState(table.getColumnWidths());
2191
2289
  }, [table]);
2192
- const pinColumn = (0, import_react11.useCallback)(
2290
+ const pinColumn = (0, import_react12.useCallback)(
2193
2291
  (column, side) => {
2194
2292
  table.pinColumn(column, side);
2195
2293
  setPinnedColumns(table.getPinnedColumns());
2196
2294
  },
2197
2295
  [table]
2198
2296
  );
2199
- const clearPinned = (0, import_react11.useCallback)(() => {
2297
+ const clearPinned = (0, import_react12.useCallback)(() => {
2200
2298
  table.clearPinned();
2201
2299
  setPinnedColumns(table.getPinnedColumns());
2202
2300
  }, [table]);
2203
- const setColumnWidth = (0, import_react11.useCallback)(
2301
+ const setColumnWidth = (0, import_react12.useCallback)(
2204
2302
  (column, width) => {
2205
2303
  table.setColumnWidth(column, width);
2206
2304
  setColumnWidthsState(table.getColumnWidths());
2207
2305
  },
2208
2306
  [table]
2209
2307
  );
2210
- const clearColumnWidths = (0, import_react11.useCallback)(() => {
2308
+ const clearColumnWidths = (0, import_react12.useCallback)(() => {
2211
2309
  table.clearColumnWidths();
2212
2310
  setColumnWidthsState(table.getColumnWidths());
2213
2311
  }, [table]);
2214
- const setSort = (0, import_react11.useCallback)(
2312
+ const setSort = (0, import_react12.useCallback)(
2215
2313
  (column, direction) => {
2216
2314
  table.setSort(column, direction);
2217
2315
  refresh();
2218
2316
  },
2219
2317
  [table, refresh]
2220
2318
  );
2221
- const setSorts = (0, import_react11.useCallback)(
2319
+ const setSorts = (0, import_react12.useCallback)(
2222
2320
  (sorts) => {
2223
2321
  table.setSorts(sorts);
2224
2322
  refresh();
2225
2323
  },
2226
2324
  [table, refresh]
2227
2325
  );
2228
- const clearSort = (0, import_react11.useCallback)(() => {
2326
+ const clearSort = (0, import_react12.useCallback)(() => {
2229
2327
  table.clearSort();
2230
2328
  refresh();
2231
2329
  }, [table, refresh]);
2232
- const addFilter = (0, import_react11.useCallback)(
2330
+ const addFilter = (0, import_react12.useCallback)(
2233
2331
  (filter) => {
2234
2332
  table.addFilter(filter);
2235
2333
  refresh();
2236
2334
  },
2237
2335
  [table, refresh]
2238
2336
  );
2239
- const removeFilter = (0, import_react11.useCallback)(
2337
+ const removeFilter = (0, import_react12.useCallback)(
2240
2338
  (column) => {
2241
2339
  table.removeFilter(column);
2242
2340
  refresh();
2243
2341
  },
2244
2342
  [table, refresh]
2245
2343
  );
2246
- const clearFilters = (0, import_react11.useCallback)(() => {
2344
+ const clearFilters = (0, import_react12.useCallback)(() => {
2247
2345
  table.clearFilters();
2248
2346
  refresh();
2249
2347
  }, [table, refresh]);
2250
- const setFilterFn = (0, import_react11.useCallback)(
2348
+ const setFilterFn = (0, import_react12.useCallback)(
2251
2349
  (fn) => {
2252
2350
  table.setFilterFn(fn);
2253
2351
  refresh();
2254
2352
  },
2255
2353
  [table, refresh]
2256
2354
  );
2257
- const setPage = (0, import_react11.useCallback)(
2355
+ const setPage = (0, import_react12.useCallback)(
2258
2356
  (page) => {
2259
2357
  table.setPage(page);
2260
2358
  refresh();
2261
2359
  },
2262
2360
  [table, refresh]
2263
2361
  );
2264
- const nextPage = (0, import_react11.useCallback)(() => {
2362
+ const nextPage = (0, import_react12.useCallback)(() => {
2265
2363
  table.nextPage();
2266
2364
  refresh();
2267
2365
  }, [table, refresh]);
2268
- const prevPage = (0, import_react11.useCallback)(() => {
2366
+ const prevPage = (0, import_react12.useCallback)(() => {
2269
2367
  table.prevPage();
2270
2368
  refresh();
2271
2369
  }, [table, refresh]);
2272
- return (0, import_react11.useMemo)(
2370
+ return (0, import_react12.useMemo)(
2273
2371
  () => ({
2274
2372
  core,
2275
2373
  table,
@@ -2690,36 +2788,36 @@ function useTableState(props) {
2690
2788
  setColumnWidth: persistColumnWidth,
2691
2789
  refresh
2692
2790
  } = useTable(tableOptions);
2693
- const t = (0, import_react12.useMemo)(() => ({ ...DEFAULT_LOCALE, ...locale }), [locale]);
2791
+ const t = (0, import_react13.useMemo)(() => ({ ...DEFAULT_LOCALE, ...locale }), [locale]);
2694
2792
  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)(
2793
+ const leafColumns = (0, import_react13.useMemo)(() => flattenLeafColumns(columnsProp), [columnsProp]);
2794
+ const headerRows = (0, import_react13.useMemo)(
2697
2795
  () => hasColumnGroups ? buildHeaderRows(columnsProp) : null,
2698
2796
  [columnsProp, hasColumnGroups]
2699
2797
  );
2700
- const [internalSorts, setInternalSorts] = (0, import_react12.useState)([]);
2798
+ const [internalSorts, setInternalSorts] = (0, import_react13.useState)([]);
2701
2799
  const sorts = controlledSorts ?? internalSorts;
2702
- const [colWidths, setColWidths] = (0, import_react12.useState)(() => {
2800
+ const [colWidths, setColWidths] = (0, import_react13.useState)(() => {
2703
2801
  const w = {};
2704
2802
  for (const c of leafColumns) {
2705
2803
  w[c.key] = persistedColWidths[c.key] ?? c.width ?? DEFAULT_COL_WIDTH;
2706
2804
  }
2707
2805
  return w;
2708
2806
  });
2709
- const [userResizedCols, setUserResizedCols] = (0, import_react12.useState)(
2807
+ const [userResizedCols, setUserResizedCols] = (0, import_react13.useState)(
2710
2808
  () => new Set(Object.keys(persistedColWidths))
2711
2809
  );
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)(
2810
+ const [colOrder, setColOrder] = (0, import_react13.useState)(() => leafColumns.map((c) => c.key));
2811
+ const [dragCol, setDragCol] = (0, import_react13.useState)(null);
2812
+ const [dragOver, setDragOver] = (0, import_react13.useState)(null);
2813
+ const [internalHidden, setInternalHidden] = (0, import_react13.useState)(
2716
2814
  () => new Set(hiddenColumnsProp ?? [])
2717
2815
  );
2718
- const hiddenSet = (0, import_react12.useMemo)(
2816
+ const hiddenSet = (0, import_react13.useMemo)(
2719
2817
  () => hiddenColumnsProp ? new Set(hiddenColumnsProp) : internalHidden,
2720
2818
  [hiddenColumnsProp, internalHidden]
2721
2819
  );
2722
- const toggleColumnVisibility = (0, import_react12.useCallback)(
2820
+ const toggleColumnVisibility = (0, import_react13.useCallback)(
2723
2821
  (key) => {
2724
2822
  if (onHiddenColumnsChange) {
2725
2823
  const current = hiddenColumnsProp ?? [];
@@ -2739,7 +2837,7 @@ function useTableState(props) {
2739
2837
  },
2740
2838
  [hiddenColumnsProp, onHiddenColumnsChange]
2741
2839
  );
2742
- const [internalExpanded, setInternalExpanded] = (0, import_react12.useState)(() => {
2840
+ const [internalExpanded, setInternalExpanded] = (0, import_react13.useState)(() => {
2743
2841
  if (tree?.defaultExpandAllRows) {
2744
2842
  const childrenKey2 = tree.childrenColumnName ?? "children";
2745
2843
  return new Set(collectAllTreeIds(props.data ?? [], childrenKey2));
@@ -2747,15 +2845,15 @@ function useTableState(props) {
2747
2845
  return new Set(expandable?.defaultExpandedRowKeys ?? []);
2748
2846
  });
2749
2847
  const expandedKeys = expandable?.expandedKeys ? new Set(expandable.expandedKeys) : internalExpanded;
2750
- const [treeExpanded, setTreeExpanded] = (0, import_react12.useState)(() => {
2848
+ const [treeExpanded, setTreeExpanded] = (0, import_react13.useState)(() => {
2751
2849
  if (tree?.defaultExpandAllRows) {
2752
2850
  const childrenKey2 = tree.childrenColumnName ?? "children";
2753
2851
  return new Set(collectAllTreeIds(props.data ?? [], childrenKey2));
2754
2852
  }
2755
2853
  return /* @__PURE__ */ new Set();
2756
2854
  });
2757
- const [searchText, setSearchText] = (0, import_react12.useState)("");
2758
- const [activeFilters, setActiveFilters] = (0, import_react12.useState)(() => {
2855
+ const [searchText, setSearchText] = (0, import_react13.useState)("");
2856
+ const [activeFilters, setActiveFilters] = (0, import_react13.useState)(() => {
2759
2857
  const init = {};
2760
2858
  for (const col of leafColumns) {
2761
2859
  if (col.filteredValue) {
@@ -2766,12 +2864,12 @@ function useTableState(props) {
2766
2864
  }
2767
2865
  return init;
2768
2866
  });
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)(
2867
+ const [filterSearchText, setFilterSearchText] = (0, import_react13.useState)({});
2868
+ const [openFilterDropdown, setOpenFilterDropdown] = (0, import_react13.useState)(null);
2869
+ const [advancedFilters, setAdvancedFiltersState] = (0, import_react13.useState)({});
2870
+ const filterRef = (0, import_react13.useRef)(null);
2871
+ const [filterAnchor, setFilterAnchor] = (0, import_react13.useState)(null);
2872
+ const setAdvancedFilter = (0, import_react13.useCallback)(
2775
2873
  (colKey, filter) => {
2776
2874
  setAdvancedFiltersState((prev) => {
2777
2875
  const next = { ...prev };
@@ -2784,16 +2882,23 @@ function useTableState(props) {
2784
2882
  },
2785
2883
  [table, refresh]
2786
2884
  );
2787
- const resizeRef = (0, import_react12.useRef)(null);
2788
- const [contextMenu, setContextMenu] = (0, import_react12.useState)(null);
2789
- const columns = (0, import_react12.useMemo)(() => {
2885
+ const resizeRef = (0, import_react13.useRef)(null);
2886
+ const resizeCleanupRef = (0, import_react13.useRef)(null);
2887
+ (0, import_react13.useEffect)(
2888
+ () => () => {
2889
+ resizeCleanupRef.current?.();
2890
+ },
2891
+ []
2892
+ );
2893
+ const [contextMenu, setContextMenu] = (0, import_react13.useState)(null);
2894
+ const columns = (0, import_react13.useMemo)(() => {
2790
2895
  const base = hasColumnGroups ? leafColumns : (() => {
2791
2896
  const map = new Map(leafColumns.map((c) => [c.key, c]));
2792
2897
  return colOrder.filter((k) => map.has(k)).map((k) => map.get(k));
2793
2898
  })();
2794
2899
  return base.filter((c) => !hiddenSet.has(c.key) && !c.hidden);
2795
2900
  }, [leafColumns, colOrder, hasColumnGroups, hiddenSet]);
2796
- (0, import_react12.useEffect)(() => {
2901
+ (0, import_react13.useEffect)(() => {
2797
2902
  const keys = leafColumns.map((c) => c.key);
2798
2903
  setColOrder((prev) => {
2799
2904
  const prevSet = new Set(prev);
@@ -2802,7 +2907,7 @@ function useTableState(props) {
2802
2907
  return [...valid, ...added];
2803
2908
  });
2804
2909
  }, [leafColumns]);
2805
- (0, import_react12.useEffect)(() => {
2910
+ (0, import_react13.useEffect)(() => {
2806
2911
  for (const col of leafColumns) {
2807
2912
  if (col.filteredValue !== void 0) {
2808
2913
  setActiveFilters((prev) => {
@@ -2812,7 +2917,7 @@ function useTableState(props) {
2812
2917
  }
2813
2918
  }
2814
2919
  }, [leafColumns]);
2815
- (0, import_react12.useEffect)(() => {
2920
+ (0, import_react13.useEffect)(() => {
2816
2921
  const colFilters = columns.filter((c) => c.onFilter && activeFilters[c.key]?.length);
2817
2922
  const hasSearch = searchable && searchText.length > 0;
2818
2923
  if (colFilters.length === 0 && !hasSearch) {
@@ -2835,7 +2940,7 @@ function useTableState(props) {
2835
2940
  return true;
2836
2941
  });
2837
2942
  }, [activeFilters, searchText, searchable, setFilterFn, columns]);
2838
- (0, import_react12.useEffect)(() => {
2943
+ (0, import_react13.useEffect)(() => {
2839
2944
  if (!openFilterDropdown) return;
2840
2945
  const handle = (e) => {
2841
2946
  if (filterRef.current && !filterRef.current.contains(e.target)) {
@@ -2845,7 +2950,7 @@ function useTableState(props) {
2845
2950
  document.addEventListener("mousedown", handle);
2846
2951
  return () => document.removeEventListener("mousedown", handle);
2847
2952
  }, [openFilterDropdown]);
2848
- const handleSort = (0, import_react12.useCallback)(
2953
+ const handleSort = (0, import_react13.useCallback)(
2849
2954
  (col, shiftKey) => {
2850
2955
  if (!col.sortable) return;
2851
2956
  if (multiSort && shiftKey) {
@@ -2894,14 +2999,14 @@ function useTableState(props) {
2894
2999
  },
2895
3000
  [multiSort, sorts, onSortsChange, setSort, setSorts, clearSort]
2896
3001
  );
2897
- const getSortIndex = (0, import_react12.useCallback)(
3002
+ const getSortIndex = (0, import_react13.useCallback)(
2898
3003
  (colKey) => {
2899
3004
  if (!multiSort || sorts.length <= 1) return -1;
2900
3005
  return sorts.findIndex((s) => s.column === colKey);
2901
3006
  },
2902
3007
  [multiSort, sorts]
2903
3008
  );
2904
- const getSortDirection = (0, import_react12.useCallback)(
3009
+ const getSortDirection = (0, import_react13.useCallback)(
2905
3010
  (colKey) => {
2906
3011
  const found = sorts.find((s) => s.column === colKey);
2907
3012
  return found?.direction ?? null;
@@ -2910,9 +3015,8 @@ function useTableState(props) {
2910
3015
  );
2911
3016
  const handleToggleExpand = (id) => {
2912
3017
  const open = expandedKeys.has(id);
2913
- if (expandable?.onExpand) {
2914
- expandable.onExpand(!open, id);
2915
- } else {
3018
+ expandable?.onExpand?.(!open, id);
3019
+ if (expandable?.expandedKeys == null) {
2916
3020
  setInternalExpanded((prev) => {
2917
3021
  const next = new Set(prev);
2918
3022
  if (open) {
@@ -2988,28 +3092,34 @@ function useTableState(props) {
2988
3092
  const handleResizeStart = (e, colKey) => {
2989
3093
  e.preventDefault();
2990
3094
  e.stopPropagation();
3095
+ resizeCleanupRef.current?.();
2991
3096
  resizeRef.current = {
2992
3097
  col: colKey,
2993
3098
  startX: e.clientX,
2994
3099
  startW: colWidths[colKey] ?? DEFAULT_COL_WIDTH
2995
3100
  };
2996
3101
  const onMove = (ev) => {
2997
- if (!resizeRef.current) return;
2998
- const diff = ev.clientX - resizeRef.current.startX;
2999
- const min = leafColumns.find((c) => c.key === resizeRef.current.col)?.minWidth ?? MIN_COL_WIDTH;
3102
+ const ref = resizeRef.current;
3103
+ if (!ref) return;
3104
+ const diff = ev.clientX - ref.startX;
3105
+ const min = leafColumns.find((c) => c.key === ref.col)?.minWidth ?? MIN_COL_WIDTH;
3106
+ const nextWidth = Math.max(min, ref.startW + diff);
3107
+ const col = ref.col;
3000
3108
  setColWidths((prev) => ({
3001
3109
  ...prev,
3002
- [resizeRef.current.col]: Math.max(min, resizeRef.current.startW + diff)
3110
+ [col]: nextWidth
3003
3111
  }));
3004
- setUserResizedCols(
3005
- (prev) => prev.has(resizeRef.current.col) ? prev : new Set(prev).add(resizeRef.current.col)
3006
- );
3112
+ setUserResizedCols((prev) => prev.has(col) ? prev : new Set(prev).add(col));
3007
3113
  };
3008
- const onUp = () => {
3009
- const ref = resizeRef.current;
3114
+ const cleanup = () => {
3010
3115
  resizeRef.current = null;
3011
3116
  document.removeEventListener("mousemove", onMove);
3012
3117
  document.removeEventListener("mouseup", onUp);
3118
+ resizeCleanupRef.current = null;
3119
+ };
3120
+ const onUp = () => {
3121
+ const ref = resizeRef.current;
3122
+ cleanup();
3013
3123
  if (!ref) return;
3014
3124
  setColWidths((prev) => {
3015
3125
  const w = prev[ref.col];
@@ -3017,6 +3127,7 @@ function useTableState(props) {
3017
3127
  return prev;
3018
3128
  });
3019
3129
  };
3130
+ resizeCleanupRef.current = cleanup;
3020
3131
  document.addEventListener("mousemove", onMove);
3021
3132
  document.addEventListener("mouseup", onUp);
3022
3133
  };
@@ -3037,13 +3148,11 @@ function useTableState(props) {
3037
3148
  setDragOver(null);
3038
3149
  return;
3039
3150
  }
3040
- setColOrder((prev) => {
3041
- const next = prev.filter((k) => k !== dragCol);
3042
- const idx = next.indexOf(targetKey);
3043
- next.splice(idx, 0, dragCol);
3044
- onColumnOrderChange?.(next);
3045
- return next;
3046
- });
3151
+ const next = colOrder.filter((k) => k !== dragCol);
3152
+ const idx = next.indexOf(targetKey);
3153
+ next.splice(idx, 0, dragCol);
3154
+ setColOrder(next);
3155
+ onColumnOrderChange?.(next);
3047
3156
  setDragCol(null);
3048
3157
  setDragOver(null);
3049
3158
  };
@@ -3051,19 +3160,19 @@ function useTableState(props) {
3051
3160
  setDragCol(null);
3052
3161
  setDragOver(null);
3053
3162
  };
3054
- const handlePinColumn = (0, import_react12.useCallback)(
3163
+ const handlePinColumn = (0, import_react13.useCallback)(
3055
3164
  (key, fixed) => {
3056
3165
  onColumnPinChange?.(key, fixed);
3057
3166
  },
3058
3167
  [onColumnPinChange]
3059
3168
  );
3060
- const [isFullscreen, setIsFullscreen] = (0, import_react12.useState)(false);
3061
- const wrapperRef = (0, import_react12.useRef)(null);
3062
- const toggleFullscreen = (0, import_react12.useCallback)(() => {
3169
+ const [isFullscreen, setIsFullscreen] = (0, import_react13.useState)(false);
3170
+ const wrapperRef = (0, import_react13.useRef)(null);
3171
+ const toggleFullscreen = (0, import_react13.useCallback)(() => {
3063
3172
  setIsFullscreen((prev) => !prev);
3064
3173
  }, []);
3065
- const [density, setDensity] = (0, import_react12.useState)("middle");
3066
- (0, import_react12.useEffect)(() => {
3174
+ const [density, setDensity] = (0, import_react13.useState)("middle");
3175
+ (0, import_react13.useEffect)(() => {
3067
3176
  if (!groupBy) {
3068
3177
  table.clearGroupBy();
3069
3178
  return;
@@ -3074,37 +3183,30 @@ function useTableState(props) {
3074
3183
  }));
3075
3184
  table.groupBy(groupBy, aggregates2);
3076
3185
  }, [groupBy, leafColumns, table]);
3077
- const [expandedGroups, setExpandedGroups] = (0, import_react12.useState)(() => {
3078
- return defaultGroupExpanded ? /* @__PURE__ */ new Set(["__all__"]) : /* @__PURE__ */ new Set();
3079
- });
3080
- const toggleGroupExpand = (0, import_react12.useCallback)(
3186
+ const [expandedGroups, setExpandedGroups] = (0, import_react13.useState)(() => /* @__PURE__ */ new Set());
3187
+ const allGroupKeysRef = (0, import_react13.useRef)([]);
3188
+ const groupsSeededRef = (0, import_react13.useRef)(false);
3189
+ const toggleGroupExpand = (0, import_react13.useCallback)(
3081
3190
  (groupKey) => {
3191
+ const willExpand = !expandedGroups.has(groupKey);
3082
3192
  setExpandedGroups((prev) => {
3083
3193
  const next = new Set(prev);
3084
- const wasExpanded = next.has(groupKey);
3085
- if (wasExpanded) {
3086
- next.delete(groupKey);
3087
- } else {
3088
- next.add(groupKey);
3089
- }
3090
- onGroupExpandChange?.(groupKey, !wasExpanded);
3194
+ if (next.has(groupKey)) next.delete(groupKey);
3195
+ else next.add(groupKey);
3091
3196
  return next;
3092
3197
  });
3198
+ onGroupExpandChange?.(groupKey, willExpand);
3093
3199
  },
3094
- [onGroupExpandChange]
3200
+ [onGroupExpandChange, expandedGroups]
3095
3201
  );
3096
- const expandAllGroups = (0, import_react12.useCallback)(() => {
3097
- setExpandedGroups((prev) => {
3098
- const next = new Set(prev);
3099
- next.add("__all__");
3100
- return next;
3101
- });
3202
+ const expandAllGroups = (0, import_react13.useCallback)(() => {
3203
+ setExpandedGroups(new Set(allGroupKeysRef.current));
3102
3204
  }, []);
3103
- const collapseAllGroups = (0, import_react12.useCallback)(() => {
3205
+ const collapseAllGroups = (0, import_react13.useCallback)(() => {
3104
3206
  setExpandedGroups(/* @__PURE__ */ new Set());
3105
3207
  }, []);
3106
- const [focusedCell, setFocusedCell] = (0, import_react12.useState)(null);
3107
- const handleKeyNav = (0, import_react12.useCallback)(
3208
+ const [focusedCell, setFocusedCell] = (0, import_react13.useState)(null);
3209
+ const handleKeyNav = (0, import_react13.useCallback)(
3108
3210
  (e) => {
3109
3211
  if (!keyboardNavigation || !focusedCell) return;
3110
3212
  const maxRow = visibleRows.length - 1;
@@ -3160,7 +3262,7 @@ function useTableState(props) {
3160
3262
  },
3161
3263
  [keyboardNavigation, focusedCell, visibleRows.length, columns.length]
3162
3264
  );
3163
- const handleAutoResize = (0, import_react12.useCallback)(
3265
+ const handleAutoResize = (0, import_react13.useCallback)(
3164
3266
  (colKey) => {
3165
3267
  const maxLen = visibleRows.reduce((max, row) => {
3166
3268
  const val = String(row.data[colKey] ?? "");
@@ -3180,7 +3282,7 @@ function useTableState(props) {
3180
3282
  const isTreeMode = !!tree;
3181
3283
  const childrenKey = tree?.childrenColumnName ?? "children";
3182
3284
  const indentSize = tree?.indentSize ?? 20;
3183
- const baseFlatRows = (0, import_react12.useMemo)(() => {
3285
+ const baseFlatRows = (0, import_react13.useMemo)(() => {
3184
3286
  if (!isTreeMode) {
3185
3287
  return visibleRows.map((r) => ({
3186
3288
  id: r.id,
@@ -3191,22 +3293,43 @@ function useTableState(props) {
3191
3293
  }
3192
3294
  return flattenTreeRows(visibleRows, childrenKey, treeExpanded);
3193
3295
  }, [visibleRows, isTreeMode, childrenKey, treeExpanded]);
3194
- const groupedRows = (0, import_react12.useMemo)(() => {
3296
+ const allGroupKeys = (0, import_react13.useMemo)(() => {
3297
+ if (!groupBy) return [];
3298
+ const seen = /* @__PURE__ */ new Set();
3299
+ const keys = [];
3300
+ for (const r of baseFlatRows) {
3301
+ const k = String(r.data[groupBy] ?? "Other");
3302
+ if (!seen.has(k)) {
3303
+ seen.add(k);
3304
+ keys.push(k);
3305
+ }
3306
+ }
3307
+ return keys;
3308
+ }, [baseFlatRows, groupBy]);
3309
+ allGroupKeysRef.current = allGroupKeys;
3310
+ (0, import_react13.useEffect)(() => {
3311
+ groupsSeededRef.current = false;
3312
+ }, [groupBy]);
3313
+ (0, import_react13.useEffect)(() => {
3314
+ if (!groupBy || !defaultGroupExpanded) return;
3315
+ if (groupsSeededRef.current || allGroupKeys.length === 0) return;
3316
+ groupsSeededRef.current = true;
3317
+ setExpandedGroups(new Set(allGroupKeys));
3318
+ }, [groupBy, defaultGroupExpanded, allGroupKeys]);
3319
+ const groupedRows = (0, import_react13.useMemo)(() => {
3195
3320
  if (!groupBy) return baseFlatRows;
3196
- const allExpanded = expandedGroups.has("__all__");
3197
- const effectiveExpanded = allExpanded ? /* @__PURE__ */ new Set([...expandedGroups, ...baseFlatRows.map((r) => String(r.data[groupBy] ?? "Other"))]) : expandedGroups;
3198
- return groupByColumn(baseFlatRows, groupBy, columns, effectiveExpanded);
3321
+ return groupByColumn(baseFlatRows, groupBy, columns, expandedGroups);
3199
3322
  }, [baseFlatRows, groupBy, columns, expandedGroups]);
3200
3323
  const {
3201
3324
  top: pinnedTop,
3202
3325
  middle: middleRows,
3203
3326
  bottom: pinnedBottom
3204
- } = (0, import_react12.useMemo)(
3327
+ } = (0, import_react13.useMemo)(
3205
3328
  () => separatePinnedRows(groupedRows, pinnedRowsConfig?.top, pinnedRowsConfig?.bottom),
3206
3329
  [groupedRows, pinnedRowsConfig]
3207
3330
  );
3208
3331
  const flatRows = groupedRows;
3209
- const aggregates = (0, import_react12.useMemo)(
3332
+ const aggregates = (0, import_react13.useMemo)(
3210
3333
  () => computeColumnAggregates(columns, baseFlatRows),
3211
3334
  [columns, baseFlatRows]
3212
3335
  );
@@ -3242,7 +3365,7 @@ function useTableState(props) {
3242
3365
  });
3243
3366
  const gridTemplate = [...extraBefore, ...colTemplates].join(" ");
3244
3367
  const totalCols = extraBefore.length + columns.length;
3245
- const fixedLeftOffsets = (0, import_react12.useMemo)(() => {
3368
+ const fixedLeftOffsets = (0, import_react13.useMemo)(() => {
3246
3369
  const o = {};
3247
3370
  const selW = parseInt(SELECTION_COL_WIDTH);
3248
3371
  let left = (rowSelection ? selW : 0) + (expandable ? selW : 0);
@@ -3254,7 +3377,7 @@ function useTableState(props) {
3254
3377
  }
3255
3378
  return o;
3256
3379
  }, [columns, colWidths, rowSelection, expandable]);
3257
- const fixedRightOffsets = (0, import_react12.useMemo)(() => {
3380
+ const fixedRightOffsets = (0, import_react13.useMemo)(() => {
3258
3381
  const o = {};
3259
3382
  let right = 0;
3260
3383
  for (let i = columns.length - 1; i >= 0; i--) {
@@ -3268,8 +3391,8 @@ function useTableState(props) {
3268
3391
  const fixedStyle = (col, isHeader) => getFixedStyle(col, fixedLeftOffsets, fixedRightOffsets, isHeader);
3269
3392
  const allSelected = rowSelection ? visibleRows.length > 0 && visibleRows.every((r) => rowSelection.selectedKeys.includes(r.id)) : false;
3270
3393
  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)(
3394
+ const spanMap = (0, import_react13.useMemo)(() => computeSpanMap(columns, flatRows), [columns, flatRows]);
3395
+ const hiddenCells = (0, import_react13.useMemo)(
3273
3396
  () => computeHiddenCells(columns, flatRows, spanMap),
3274
3397
  [columns, flatRows, spanMap]
3275
3398
  );
@@ -3524,14 +3647,14 @@ function TableInner(props, forwardedRef) {
3524
3647
  const bordered = borderedProp ?? config.bordered ?? false;
3525
3648
  const loading = loadingProp ?? false;
3526
3649
  const state = useTableState(props);
3527
- const tableRef = (0, import_react13.useRef)(null);
3528
- const scrollRef = (0, import_react13.useRef)(null);
3650
+ const tableRef = (0, import_react14.useRef)(null);
3651
+ const scrollRef = (0, import_react14.useRef)(null);
3529
3652
  const effectiveSize = densityToggle ? state.density : sizeFromProp;
3530
- const rowNumConfig = (0, import_react13.useMemo)(
3653
+ const rowNumConfig = (0, import_react14.useMemo)(
3531
3654
  () => showRowNumber ? typeof showRowNumber === "object" ? showRowNumber : {} : null,
3532
3655
  [showRowNumber]
3533
3656
  );
3534
- const getExportData = (0, import_react13.useCallback)(() => {
3657
+ const getExportData = (0, import_react14.useCallback)(() => {
3535
3658
  const cols = state.columns.map((c) => c.key);
3536
3659
  const headers = state.columns.map((c) => typeof c.title === "string" ? c.title : c.key);
3537
3660
  const rows = state.flatRows.filter((r) => !r.__groupRow).map(
@@ -3542,7 +3665,7 @@ function TableInner(props, forwardedRef) {
3542
3665
  );
3543
3666
  return { cols, headers, rows };
3544
3667
  }, [state.columns, state.flatRows]);
3545
- const handleExportCSV = (0, import_react13.useCallback)(() => {
3668
+ const handleExportCSV = (0, import_react14.useCallback)(() => {
3546
3669
  const { headers, rows } = getExportData();
3547
3670
  const data = [headers, ...rows];
3548
3671
  if (onExport) {
@@ -3551,31 +3674,31 @@ function TableInner(props, forwardedRef) {
3551
3674
  downloadCSV(toCSVString(data));
3552
3675
  }
3553
3676
  }, [getExportData, onExport]);
3554
- const handleExportJSON = (0, import_react13.useCallback)(() => {
3677
+ const handleExportJSON = (0, import_react14.useCallback)(() => {
3555
3678
  const { headers, rows } = getExportData();
3556
3679
  downloadJSON(toJSONString(headers, rows));
3557
3680
  }, [getExportData]);
3558
- const handleCopy = (0, import_react13.useCallback)(async () => {
3681
+ const handleCopy = (0, import_react14.useCallback)(async () => {
3559
3682
  const { headers, rows } = getExportData();
3560
3683
  await copyToClipboard(toTSVString([headers, ...rows]));
3561
3684
  }, [getExportData]);
3562
- const printOptionsFromProp = (0, import_react13.useMemo)(() => {
3685
+ const printOptionsFromProp = (0, import_react14.useMemo)(() => {
3563
3686
  if (typeof printable === "object" && printable !== null) {
3564
3687
  return { fileName: printable.fileName };
3565
3688
  }
3566
3689
  return {};
3567
3690
  }, [printable]);
3568
- const doPrint = (0, import_react13.useCallback)(
3691
+ const doPrint = (0, import_react14.useCallback)(
3569
3692
  (opts) => {
3570
3693
  printElement(tableRef.current, { ...printOptionsFromProp, ...opts ?? {} });
3571
3694
  },
3572
3695
  [printOptionsFromProp]
3573
3696
  );
3574
- const handlePrint = (0, import_react13.useCallback)(() => {
3697
+ const handlePrint = (0, import_react14.useCallback)(() => {
3575
3698
  doPrint();
3576
3699
  }, [doPrint]);
3577
- (0, import_react13.useImperativeHandle)(forwardedRef, () => ({ print: doPrint }), [doPrint]);
3578
- const gridTemplate = (0, import_react13.useMemo)(() => {
3700
+ (0, import_react14.useImperativeHandle)(forwardedRef, () => ({ print: doPrint }), [doPrint]);
3701
+ const gridTemplate = (0, import_react14.useMemo)(() => {
3579
3702
  const parts = [];
3580
3703
  if (rowDraggable) parts.push(DRAG_HANDLE_WIDTH);
3581
3704
  if (rowNumConfig) parts.push(rowNumConfig.width ? `${rowNumConfig.width}px` : ROW_NUMBER_WIDTH);
@@ -4006,7 +4129,7 @@ function TableInner(props, forwardedRef) {
4006
4129
  }
4007
4130
  );
4008
4131
  }
4009
- var Table = (0, import_react13.forwardRef)(TableInner);
4132
+ var Table = (0, import_react14.forwardRef)(TableInner);
4010
4133
  Table.displayName = "Table";
4011
4134
  function ColumnVisibilityDropdown({
4012
4135
  leafColumns,
@@ -4014,9 +4137,9 @@ function ColumnVisibilityDropdown({
4014
4137
  onToggle,
4015
4138
  label
4016
4139
  }) {
4017
- const [open, setOpen] = import_react13.default.useState(false);
4018
- const ref = import_react13.default.useRef(null);
4019
- import_react13.default.useEffect(() => {
4140
+ const [open, setOpen] = import_react14.default.useState(false);
4141
+ const ref = import_react14.default.useRef(null);
4142
+ import_react14.default.useEffect(() => {
4020
4143
  if (!open) return;
4021
4144
  const h = (e) => {
4022
4145
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -4038,9 +4161,9 @@ function GroupByDropdown({
4038
4161
  onChange,
4039
4162
  t
4040
4163
  }) {
4041
- const [open, setOpen] = import_react13.default.useState(false);
4042
- const ref = import_react13.default.useRef(null);
4043
- import_react13.default.useEffect(() => {
4164
+ const [open, setOpen] = import_react14.default.useState(false);
4165
+ const ref = import_react14.default.useRef(null);
4166
+ import_react14.default.useEffect(() => {
4044
4167
  if (!open) return;
4045
4168
  const h = (e) => {
4046
4169
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -4088,9 +4211,9 @@ function DensityDropdown({
4088
4211
  onChange,
4089
4212
  t
4090
4213
  }) {
4091
- const [open, setOpen] = import_react13.default.useState(false);
4092
- const ref = import_react13.default.useRef(null);
4093
- import_react13.default.useEffect(() => {
4214
+ const [open, setOpen] = import_react14.default.useState(false);
4215
+ const ref = import_react14.default.useRef(null);
4216
+ import_react14.default.useEffect(() => {
4094
4217
  if (!open) return;
4095
4218
  const h = (e) => {
4096
4219
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);