@lensui/lens-table 0.1.63 → 0.1.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/Table.tsx
2
- import { forwardRef, useImperativeHandle, Fragment as Fragment2, useCallback as useCallback2, useEffect as useEffect2, useLayoutEffect as useLayoutEffect2, useMemo, useRef as useRef2, useState as useState4 } from "react";
2
+ import { forwardRef, useImperativeHandle, Fragment as Fragment2, useCallback as useCallback2, useEffect as useEffect3, useLayoutEffect as useLayoutEffect3, useMemo as useMemo2, useRef as useRef4, useState as useState6 } from "react";
3
3
  import { flushSync } from "react-dom";
4
4
 
5
5
  // src/components/EmptyState.tsx
@@ -199,6 +199,7 @@ function DefaultEmptyState({ label = ZH_CN_GRID_LABELS.empty }) {
199
199
  // src/components/editors/ChoiceEditor.tsx
200
200
  import { Portal } from "@ark-ui/react/portal";
201
201
  import { Select, createListCollection } from "@ark-ui/react/select";
202
+ import { useEffect, useId as useId2, useLayoutEffect, useMemo, useRef, useState } from "react";
202
203
 
203
204
  // src/icons/gridIcons.tsx
204
205
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
@@ -231,6 +232,13 @@ function ChoiceChevronIcon() {
231
232
  function ChoiceCheckIcon() {
232
233
  return /* @__PURE__ */ jsx2("svg", { className: "rvg-choice-check", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "m3.5 8 2.6 2.6L12.5 4" }) });
233
234
  }
235
+ function MultilineEditorIcon() {
236
+ return /* @__PURE__ */ jsxs2("svg", { className: "rvg-multiline-icon", viewBox: "0 0 16 16", "aria-hidden": "true", children: [
237
+ /* @__PURE__ */ jsx2("circle", { cx: "3.5", cy: "8", r: "1" }),
238
+ /* @__PURE__ */ jsx2("circle", { cx: "8", cy: "8", r: "1" }),
239
+ /* @__PURE__ */ jsx2("circle", { cx: "12.5", cy: "8", r: "1" })
240
+ ] });
241
+ }
234
242
  function HeaderDragIcon({ className, style }) {
235
243
  return /* @__PURE__ */ jsxs2("svg", { className, style, viewBox: "0 0 14 14", "aria-hidden": "true", children: [
236
244
  /* @__PURE__ */ jsx2("circle", { cx: "7", cy: "2.5", r: "1.25" }),
@@ -294,12 +302,126 @@ function LoadingSpinnerIcon() {
294
302
 
295
303
  // src/components/editors/ChoiceEditor.tsx
296
304
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
297
- function ChoiceEditor({ value, options, style, labels, onChange, onCommit, onCancel }) {
298
- const collection = createListCollection({
299
- items: options,
300
- itemToValue: (item) => item.value,
301
- itemToString: (item) => item.label
302
- });
305
+ function SearchableChoiceEditor({ value, options, allowCustomValue, maxDropdownHeight, style, labels, onChange, onCommit, onCancel }) {
306
+ const editorRef = useRef(null);
307
+ const popupRef = useRef(null);
308
+ const originalValueRef = useRef(value);
309
+ const listboxId = useId2();
310
+ const originalValue = originalValueRef.current;
311
+ const [inputValue, setInputValue] = useState(value);
312
+ const [activeIndex, setActiveIndex] = useState(0);
313
+ const [popupStyle, setPopupStyle] = useState({});
314
+ const filteredOptions = useMemo(() => {
315
+ const query = inputValue.trim().toLocaleLowerCase();
316
+ if (!query || query === originalValue.toLocaleLowerCase()) return options;
317
+ return options.filter((option) => option.label.toLocaleLowerCase().includes(query) || option.value.toLocaleLowerCase().includes(query));
318
+ }, [inputValue, options, originalValue]);
319
+ useLayoutEffect(() => {
320
+ const positionPopup = () => {
321
+ const rect = editorRef.current?.getBoundingClientRect();
322
+ if (!rect) return;
323
+ const availableBelow = window.innerHeight - rect.bottom - 8;
324
+ const availableAbove = rect.top - 8;
325
+ if (availableBelow < 120 && availableAbove > availableBelow) {
326
+ setPopupStyle({
327
+ position: "fixed",
328
+ bottom: window.innerHeight - rect.top + 4,
329
+ left: rect.left,
330
+ width: rect.width,
331
+ maxHeight: Math.min(maxDropdownHeight, availableAbove)
332
+ });
333
+ return;
334
+ }
335
+ setPopupStyle({
336
+ position: "fixed",
337
+ top: rect.bottom + 4,
338
+ left: rect.left,
339
+ width: rect.width,
340
+ maxHeight: Math.min(maxDropdownHeight, Math.max(80, availableBelow))
341
+ });
342
+ };
343
+ positionPopup();
344
+ window.addEventListener("resize", positionPopup);
345
+ window.addEventListener("scroll", positionPopup, true);
346
+ return () => {
347
+ window.removeEventListener("resize", positionPopup);
348
+ window.removeEventListener("scroll", positionPopup, true);
349
+ };
350
+ }, [maxDropdownHeight]);
351
+ useEffect(() => {
352
+ const handleOutsidePointer = (event) => {
353
+ const target = event.target;
354
+ if (!(target instanceof Node)) return;
355
+ if (editorRef.current?.contains(target) || popupRef.current?.contains(target)) return;
356
+ onCommit(allowCustomValue ? inputValue || originalValue : originalValue);
357
+ };
358
+ document.addEventListener("pointerdown", handleOutsidePointer, true);
359
+ return () => document.removeEventListener("pointerdown", handleOutsidePointer, true);
360
+ }, [allowCustomValue, inputValue, onCommit, originalValue]);
361
+ const selectOption = (option) => {
362
+ onChange(option.value);
363
+ onCommit(option.value);
364
+ };
365
+ const handleKeyDown = (event) => {
366
+ event.stopPropagation();
367
+ if (event.key === "Escape") onCancel();
368
+ if (event.key === "ArrowDown") {
369
+ event.preventDefault();
370
+ setActiveIndex((index) => Math.min(filteredOptions.length - 1, index + 1));
371
+ }
372
+ if (event.key === "ArrowUp") {
373
+ event.preventDefault();
374
+ setActiveIndex((index) => Math.max(0, index - 1));
375
+ }
376
+ if (event.key === "Enter") {
377
+ event.preventDefault();
378
+ const option = filteredOptions[activeIndex];
379
+ if (option) selectOption(option);
380
+ else if (allowCustomValue) onCommit(inputValue || originalValue);
381
+ }
382
+ };
383
+ return /* @__PURE__ */ jsxs3("div", { ref: editorRef, className: "rvg-choice-editor rvg-searchable-choice-editor", style, children: [
384
+ /* @__PURE__ */ jsx3(
385
+ "input",
386
+ {
387
+ className: inputValue === originalValue ? "is-pristine" : void 0,
388
+ value: inputValue,
389
+ autoFocus: true,
390
+ "aria-label": labels.search,
391
+ "aria-controls": listboxId,
392
+ onFocus: (event) => event.currentTarget.select(),
393
+ onChange: (event) => {
394
+ setInputValue(event.target.value);
395
+ onChange(event.target.value);
396
+ setActiveIndex(0);
397
+ },
398
+ onKeyDown: handleKeyDown
399
+ }
400
+ ),
401
+ /* @__PURE__ */ jsx3("span", { className: "rvg-searchable-choice-indicator", children: /* @__PURE__ */ jsx3(ChoiceChevronIcon, {}) }),
402
+ /* @__PURE__ */ jsx3(Portal, { children: /* @__PURE__ */ jsx3("div", { ref: popupRef, id: listboxId, role: "listbox", className: "rvg-choice-content rvg-searchable-choice-content", style: popupStyle, children: filteredOptions.map((option, index) => /* @__PURE__ */ jsxs3(
403
+ "button",
404
+ {
405
+ type: "button",
406
+ role: "option",
407
+ "aria-selected": option.value === originalValue,
408
+ className: `rvg-choice-item${index === activeIndex ? " is-active" : ""}${option.value === originalValue ? " is-selected" : ""}`,
409
+ onPointerDown: (event) => event.preventDefault(),
410
+ onMouseEnter: () => setActiveIndex(index),
411
+ onClick: () => selectOption(option),
412
+ children: [
413
+ /* @__PURE__ */ jsx3("span", { children: option.label }),
414
+ option.value === originalValue && /* @__PURE__ */ jsx3(ChoiceCheckIcon, {})
415
+ ]
416
+ },
417
+ option.value
418
+ )) }) })
419
+ ] });
420
+ }
421
+ function ChoiceEditor(props) {
422
+ const { value, options, searchable = false, maxDropdownHeight = 240, style, labels, onChange, onCommit, onCancel } = props;
423
+ if (searchable) return /* @__PURE__ */ jsx3(SearchableChoiceEditor, { ...props, maxDropdownHeight });
424
+ const collection = createListCollection({ items: options, itemToValue: (item) => item.value, itemToString: (item) => item.label });
303
425
  return /* @__PURE__ */ jsxs3(
304
426
  Select.Root,
305
427
  {
@@ -330,7 +452,7 @@ function ChoiceEditor({ value, options, style, labels, onChange, onCommit, onCan
330
452
  /* @__PURE__ */ jsx3(Select.ValueText, { placeholder: labels.choose }),
331
453
  /* @__PURE__ */ jsx3(Select.Indicator, { children: /* @__PURE__ */ jsx3(ChoiceChevronIcon, {}) })
332
454
  ] }) }),
333
- /* @__PURE__ */ jsx3(Portal, { children: /* @__PURE__ */ jsx3(Select.Positioner, { children: /* @__PURE__ */ jsx3(Select.Content, { className: "rvg-choice-content", children: options.map((option) => /* @__PURE__ */ jsxs3(Select.Item, { className: "rvg-choice-item", item: option, children: [
455
+ /* @__PURE__ */ jsx3(Portal, { children: /* @__PURE__ */ jsx3(Select.Positioner, { children: /* @__PURE__ */ jsx3(Select.Content, { className: "rvg-choice-content", style: { maxHeight: maxDropdownHeight, overflowY: "auto" }, children: options.map((option) => /* @__PURE__ */ jsxs3(Select.Item, { className: "rvg-choice-item", item: option, children: [
334
456
  /* @__PURE__ */ jsx3(Select.ItemText, { children: option.label }),
335
457
  /* @__PURE__ */ jsx3(Select.ItemIndicator, { children: /* @__PURE__ */ jsx3(ChoiceCheckIcon, {}) })
336
458
  ] }, option.value)) }) }) }),
@@ -341,7 +463,7 @@ function ChoiceEditor({ value, options, style, labels, onChange, onCommit, onCan
341
463
  }
342
464
 
343
465
  // src/components/editors/DateEditor.tsx
344
- import { useState as useState2 } from "react";
466
+ import { useState as useState3 } from "react";
345
467
  import { DatePicker } from "@ark-ui/react/date-picker";
346
468
  import { Portal as Portal2 } from "@ark-ui/react/portal";
347
469
  import { parseDate as parseDate2 } from "@internationalized/date";
@@ -388,22 +510,22 @@ function timeFormatHasSeconds(format, value) {
388
510
  }
389
511
 
390
512
  // src/components/editors/TimeEditors.tsx
391
- import { useEffect, useLayoutEffect, useRef, useState } from "react";
513
+ import { useEffect as useEffect2, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
392
514
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
393
515
  function CompactTimeEditor({ value, range, showSeconds, style, labels, onChange, onCommit, onCancel }) {
394
516
  const values = range ? value.split(" ~ ") : [value];
395
- const [dropdownOpen, setDropdownOpen] = useState(true);
396
- const optionRefs = useRef([[], []]);
397
- const editorRef = useRef(null);
398
- const hasPositionedTimeRef = useRef(false);
399
- useEffect(() => {
517
+ const [dropdownOpen, setDropdownOpen] = useState2(true);
518
+ const optionRefs = useRef2([[], []]);
519
+ const editorRef = useRef2(null);
520
+ const hasPositionedTimeRef = useRef2(false);
521
+ useEffect2(() => {
400
522
  const closeOnOutsidePointer = (event) => {
401
523
  if (!editorRef.current?.contains(event.target)) setDropdownOpen(false);
402
524
  };
403
525
  document.addEventListener("pointerdown", closeOnOutsidePointer, true);
404
526
  return () => document.removeEventListener("pointerdown", closeOnOutsidePointer, true);
405
527
  }, []);
406
- useLayoutEffect(() => {
528
+ useLayoutEffect2(() => {
407
529
  if (!dropdownOpen) return;
408
530
  const behavior = hasPositionedTimeRef.current ? "smooth" : "auto";
409
531
  values.forEach((time, index) => {
@@ -478,14 +600,14 @@ function CompactTimeEditor({ value, range, showSeconds, style, labels, onChange,
478
600
  ] });
479
601
  }
480
602
  function DateTimePanel({ values, labels, showSeconds, onChange }) {
481
- const [activeIndex, setActiveIndex] = useState(0);
603
+ const [activeIndex, setActiveIndex] = useState2(0);
482
604
  const activeValue = values[activeIndex] ?? "";
483
605
  const [, hour = "00", minute = "00", second = "00"] = activeValue.match(/[T ](\d{2}):(\d{2})(?::(\d{2}))?/) ?? [];
484
- const hoursRef = useRef(null);
485
- const minutesRef = useRef(null);
486
- const secondsRef = useRef(null);
487
- const positionedRef = useRef(false);
488
- useLayoutEffect(() => {
606
+ const hoursRef = useRef2(null);
607
+ const minutesRef = useRef2(null);
608
+ const secondsRef = useRef2(null);
609
+ const positionedRef = useRef2(false);
610
+ useLayoutEffect2(() => {
489
611
  const behavior = positionedRef.current ? "smooth" : "auto";
490
612
  hoursRef.current?.scrollTo({ top: Number(hour) * 28, behavior });
491
613
  minutesRef.current?.scrollTo({ top: Number(minute) * 28, behavior });
@@ -520,7 +642,7 @@ function DateTimePanel({ values, labels, showSeconds, onChange }) {
520
642
  // src/components/editors/DateEditor.tsx
521
643
  import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
522
644
  function DateEditor({ editor, value: draft, style, locale, labels, onChange, onCommit, onCancel }) {
523
- const [rangeHoverValue, setRangeHoverValue] = useState2();
645
+ const [rangeHoverValue, setRangeHoverValue] = useState3();
524
646
  const editorType = editor.type;
525
647
  const isRange = editorType === "date-range" || editorType === "date-time-range";
526
648
  const isYear = editorType === "year";
@@ -663,11 +785,21 @@ function DateEditor({ editor, value: draft, style, locale, labels, onChange, onC
663
785
  }
664
786
 
665
787
  // src/components/editors/TextEditor.tsx
788
+ import { useRef as useRef3 } from "react";
666
789
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
667
- function TextEditor({ value, type, style, labels, onChange, onCommit, onCancel }) {
790
+ function TextEditor({ value, type, min, max, integer = false, style, labels, onChange, onCommit, onCancel }) {
791
+ const originalValueRef = useRef3(value);
792
+ const normalizeNumber = (draft) => {
793
+ if (draft.trim() === "") return "";
794
+ const parsed = Number(draft);
795
+ if (!Number.isFinite(parsed)) return originalValueRef.current;
796
+ const integral = integer ? Math.trunc(parsed) : parsed;
797
+ return String(Math.min(max ?? Infinity, Math.max(min ?? -Infinity, integral)));
798
+ };
799
+ const commitValue = () => onCommit(type === "number" ? normalizeNumber(value) : value);
668
800
  const handleKeyDown = (event) => {
669
801
  event.stopPropagation();
670
- if (event.key === "Enter") onCommit();
802
+ if (event.key === "Enter") commitValue();
671
803
  if (event.key === "Escape") onCancel();
672
804
  };
673
805
  return /* @__PURE__ */ jsxs6("div", { className: "rvg-native-editor has-clear", style, children: [
@@ -675,11 +807,19 @@ function TextEditor({ value, type, style, labels, onChange, onCommit, onCancel }
675
807
  "input",
676
808
  {
677
809
  type,
810
+ min: type === "number" ? min : void 0,
811
+ max: type === "number" ? max : void 0,
812
+ step: type === "number" && integer ? 1 : void 0,
813
+ inputMode: type === "number" ? "numeric" : void 0,
678
814
  style: { font: "var(--rvg-font-size-body) Inter, ui-sans-serif, system-ui, sans-serif", textAlign: style.textAlign },
679
815
  value,
680
816
  autoFocus: true,
681
- onChange: (event) => onChange(event.target.value),
682
- onBlur: () => onCommit(),
817
+ onChange: (event) => {
818
+ const next = event.target.value;
819
+ if (type === "number" && integer && next !== "" && !/^-?\d+$/.test(next)) return;
820
+ onChange(next);
821
+ },
822
+ onBlur: commitValue,
683
823
  onKeyDown: handleKeyDown
684
824
  }
685
825
  ),
@@ -703,6 +843,66 @@ function TextEditor({ value, type, style, labels, onChange, onCommit, onCancel }
703
843
  ] });
704
844
  }
705
845
 
846
+ // src/components/editors/TextAreaEditor.tsx
847
+ import { useState as useState4 } from "react";
848
+ import { createPortal } from "react-dom";
849
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
850
+ function TextAreaEditor({ value, title, maxLength, style, labels, onChange, onCommit, onCancel }) {
851
+ const [open, setOpen] = useState4(false);
852
+ const handleKeyDown = (event) => {
853
+ event.stopPropagation();
854
+ if (event.key === "Enter") onCommit(value);
855
+ if (event.key === "Escape") onCancel();
856
+ };
857
+ return /* @__PURE__ */ jsxs7("div", { className: "rvg-native-editor rvg-textarea-editor", style, children: [
858
+ /* @__PURE__ */ jsx7(
859
+ "input",
860
+ {
861
+ value,
862
+ autoFocus: true,
863
+ maxLength,
864
+ onChange: (event) => onChange(event.target.value),
865
+ onKeyDown: handleKeyDown
866
+ }
867
+ ),
868
+ /* @__PURE__ */ jsx7(
869
+ "button",
870
+ {
871
+ type: "button",
872
+ className: "rvg-textarea-trigger",
873
+ "aria-label": title,
874
+ onPointerDown: (event) => {
875
+ event.preventDefault();
876
+ event.stopPropagation();
877
+ },
878
+ onClick: () => setOpen(true),
879
+ children: /* @__PURE__ */ jsx7(MultilineEditorIcon, {})
880
+ }
881
+ ),
882
+ open && createPortal(
883
+ /* @__PURE__ */ jsx7("div", { className: "rvg-textarea-backdrop", role: "presentation", children: /* @__PURE__ */ jsxs7("section", { className: "rvg-textarea-dialog", role: "dialog", "aria-modal": "true", "aria-label": title, children: [
884
+ /* @__PURE__ */ jsx7("header", { children: title }),
885
+ /* @__PURE__ */ jsx7(
886
+ "textarea",
887
+ {
888
+ value,
889
+ autoFocus: true,
890
+ maxLength,
891
+ onChange: (event) => onChange(event.target.value),
892
+ onKeyDown: (event) => {
893
+ event.stopPropagation();
894
+ if ((event.metaKey || event.ctrlKey) && event.key === "Enter") onCommit(value);
895
+ if (event.key === "Escape") setOpen(false);
896
+ }
897
+ }
898
+ ),
899
+ /* @__PURE__ */ jsx7("footer", { children: /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => onCommit(value), children: labels.confirm }) })
900
+ ] }) }),
901
+ document.body
902
+ )
903
+ ] });
904
+ }
905
+
706
906
  // src/icons/domIcons.ts
707
907
  function createRowDragHandleSvg() {
708
908
  const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
@@ -747,9 +947,7 @@ function isColumnFilterable(column) {
747
947
  return isDataColumn(column) && column.filterable !== false;
748
948
  }
749
949
  function getHeaderTitleRequiredWidth(column, titleWidth) {
750
- const minimumReadableTitleWidth = Math.min(Math.ceil(titleWidth), 28);
751
- const horizontalPadding = titleWidth > 48 ? 24 : 0;
752
- return minimumReadableTitleWidth + horizontalPadding + (column.align === "center" ? 20 : 22);
950
+ return Math.ceil(titleWidth) + (column.align === "center" ? 20 : 22);
753
951
  }
754
952
  function getVisibleHeaderActions(column, width, columnDraggable = false, titleWidth = 26, actionSlotWidth = HEADER_ACTION_SLOT_WIDTH) {
755
953
  const capacity = Math.max(0, Math.floor((width - getHeaderTitleRequiredWidth(column, titleWidth)) / actionSlotWidth));
@@ -1000,7 +1198,7 @@ function paintGrid(options) {
1000
1198
  ctx.fillStyle = colors.insertedFill;
1001
1199
  ctx.fillRect(x, y, cellWidth, cellHeight);
1002
1200
  }
1003
- const isSelectedCell = !column.rowDragHandle && !column.rowSelection && !column.rowNumber && selection?.rowIndex === rowIndex && selection.columnIndex === columnIndex && selection.rowKey === rowKey && selection.columnKey === column.key;
1201
+ const isSelectedCell = !column.rowDragHandle && !column.rowSelection && !column.rowNumber && column.suppressSelectionStyle !== true && selection?.rowIndex === rowIndex && selection.columnIndex === columnIndex && selection.rowKey === rowKey && selection.columnKey === column.key;
1004
1202
  const annotation = cellAnnotations.get(`${typeof rowKey}:${String(rowKey)}\0${column.key}`);
1005
1203
  const rawValue = column.dataIndex === void 0 ? void 0 : row[column.dataIndex];
1006
1204
  const cellStyle = column.cellStyle?.(rawValue, row, rowIndex);
@@ -1332,7 +1530,7 @@ function paintGrid(options) {
1332
1530
  }
1333
1531
  const selectedRow = selection ? rows[selection.rowIndex] : void 0;
1334
1532
  const hasValidSelection = Boolean(selection && selectedRow && getRowKey(selectedRow, selection.rowIndex) === selection.rowKey);
1335
- if (selection && hasValidSelection && !selectionRange && !rowDragPreview) {
1533
+ if (selection && hasValidSelection && !selectionRange && !rowDragPreview && columns[selection.columnIndex]?.suppressSelectionStyle !== true) {
1336
1534
  const metric = metrics[selection.columnIndex];
1337
1535
  if (metric) {
1338
1536
  const fixedSide = columns[selection.columnIndex].fixed;
@@ -1404,9 +1602,9 @@ function paintGrid(options) {
1404
1602
  }
1405
1603
 
1406
1604
  // src/hooks/useControllable.ts
1407
- import { useCallback, useState as useState3 } from "react";
1605
+ import { useCallback, useState as useState5 } from "react";
1408
1606
  function useControllableKeys(value, defaultValue, onChange) {
1409
- const [internal, setInternal] = useState3(defaultValue ?? []);
1607
+ const [internal, setInternal] = useState5(defaultValue ?? []);
1410
1608
  const keys = value === void 0 ? internal : value;
1411
1609
  const setKeys = useCallback((next) => {
1412
1610
  if (value === void 0) setInternal(next);
@@ -1415,7 +1613,7 @@ function useControllableKeys(value, defaultValue, onChange) {
1415
1613
  return [keys, setKeys];
1416
1614
  }
1417
1615
  function useControllableValue(value, defaultValue, onChange) {
1418
- const [internal, setInternal] = useState3(defaultValue ?? null);
1616
+ const [internal, setInternal] = useState5(defaultValue ?? null);
1419
1617
  const selected = value === void 0 ? internal : value;
1420
1618
  const setSelected = useCallback((next) => {
1421
1619
  if (value === void 0) setInternal(next);
@@ -1425,7 +1623,7 @@ function useControllableValue(value, defaultValue, onChange) {
1425
1623
  }
1426
1624
 
1427
1625
  // src/Table.tsx
1428
- import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1626
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1429
1627
  function resolveColumnDropIndex(sourceIndex, targetIndex, edge, columnCount) {
1430
1628
  const insertionIndex = targetIndex + (edge === "right" ? 1 : 0) - (sourceIndex < targetIndex ? 1 : 0);
1431
1629
  return Math.max(0, Math.min(columnCount - 1, insertionIndex));
@@ -1662,21 +1860,21 @@ function TableInner({
1662
1860
  style,
1663
1861
  ariaLabel = "Data grid"
1664
1862
  }, ref) {
1665
- const [sourceColumns, setSourceColumns] = useState4(columnProps);
1666
- useEffect2(() => {
1863
+ const [sourceColumns, setSourceColumns] = useState6(columnProps);
1864
+ useEffect3(() => {
1667
1865
  setSourceColumns((current) => reconcileColumns(current, columnProps));
1668
1866
  }, [columnProps]);
1669
1867
  const rowHeight = layout?.rowHeight ?? rowHeightProp ?? 36;
1670
1868
  const headerActionSize = Math.max(8, layout?.headerActionSize ?? 14);
1671
1869
  const headerActionSlotWidth = headerActionSize + 2;
1672
1870
  const baseHeaderHeight = layout?.headerHeight ?? headerHeightProp ?? 40;
1673
- const headerDepth = useMemo(() => Math.max(1, ...sourceColumns.map(getColumnDepth)), [sourceColumns]);
1674
- const { language, labels } = useMemo(() => resolveGridLocale(locale), [locale]);
1675
- const customHeaderContentRefs = useRef2(/* @__PURE__ */ new Map());
1676
- const customHeaderMeasurementsRef = useRef2(/* @__PURE__ */ new Map());
1677
- const [measuredHeaderRowHeights, setMeasuredHeaderRowHeights] = useState4([]);
1678
- const headerRowHeights = useMemo(() => Array.from({ length: headerDepth }, (_, level) => Math.max(baseHeaderHeight, measuredHeaderRowHeights[level] ?? 0)), [baseHeaderHeight, headerDepth, measuredHeaderRowHeights]);
1679
- const headerRowOffsets = useMemo(() => {
1871
+ const headerDepth = useMemo2(() => Math.max(1, ...sourceColumns.map(getColumnDepth)), [sourceColumns]);
1872
+ const { language, labels } = useMemo2(() => resolveGridLocale(locale), [locale]);
1873
+ const customHeaderContentRefs = useRef4(/* @__PURE__ */ new Map());
1874
+ const customHeaderMeasurementsRef = useRef4(/* @__PURE__ */ new Map());
1875
+ const [measuredHeaderRowHeights, setMeasuredHeaderRowHeights] = useState6([]);
1876
+ const headerRowHeights = useMemo2(() => Array.from({ length: headerDepth }, (_, level) => Math.max(baseHeaderHeight, measuredHeaderRowHeights[level] ?? 0)), [baseHeaderHeight, headerDepth, measuredHeaderRowHeights]);
1877
+ const headerRowOffsets = useMemo2(() => {
1680
1878
  const offsets = [];
1681
1879
  let top = 0;
1682
1880
  headerRowHeights.forEach((height2) => {
@@ -1707,18 +1905,18 @@ function TableInner({
1707
1905
  const summaryEmptyValue = typeof summary === "object" ? summary.emptyValue ?? "" : "";
1708
1906
  const contextMenuEnabled = contextMenuConfig !== false;
1709
1907
  const customContextMenuConfig = typeof contextMenuConfig === "object" ? contextMenuConfig : void 0;
1710
- const [resizedColumnWidths, setResizedColumnWidths] = useState4({});
1711
- const leafSourceColumns = useMemo(() => flattenDataColumns(sourceColumns), [sourceColumns]);
1712
- const sourceColumnWidthsRef = useRef2(new Map(leafSourceColumns.map((column) => [column.key, column.width])));
1908
+ const [resizedColumnWidths, setResizedColumnWidths] = useState6({});
1909
+ const leafSourceColumns = useMemo2(() => flattenDataColumns(sourceColumns), [sourceColumns]);
1910
+ const sourceColumnWidthsRef = useRef4(new Map(leafSourceColumns.map((column) => [column.key, column.width])));
1713
1911
  const showRowCheckbox = Boolean(rowSelection) && (typeof rowSelection !== "object" || rowSelection.showCheckbox !== false);
1714
1912
  const rowSelectionIndicator = typeof rowSelection === "object" ? rowSelection.indicator ?? "checkbox" : "checkbox";
1715
1913
  const rowSelectionColumnWidth = typeof rowSelection === "object" ? Math.max(24, rowSelection.columnWidth ?? 44) : 44;
1716
- useEffect2(() => {
1914
+ useEffect3(() => {
1717
1915
  if (!isProductionRuntime() && hasNestedFixedColumns(sourceColumns)) {
1718
1916
  console.warn("[Table] Multi-level headers only support fixed columns on top-level columns. Nested fixed values are ignored.");
1719
1917
  }
1720
1918
  }, [sourceColumns]);
1721
- const columns = useMemo(() => {
1919
+ const columns = useMemo2(() => {
1722
1920
  const utilityColumns = [];
1723
1921
  if (rowDraggable) {
1724
1922
  utilityColumns.push({ key: "__rvg_row_drag__", title: "", width: 36, align: "center", fixed: "left", rowDragHandle: true });
@@ -1736,8 +1934,8 @@ function TableInner({
1736
1934
  return [...utilityColumns, ...dataColumns];
1737
1935
  }, [leafSourceColumns, resizedColumnWidths, rowDraggable, rowNumber, rowSelectionColumnWidth, rowSelectionIndicator, showRowCheckbox, sourceRows.length]);
1738
1936
  const utilityColumnCount = (rowDraggable ? 1 : 0) + (showRowCheckbox ? 1 : 0) + (rowNumber ? 1 : 0);
1739
- const headerCells = useMemo(() => buildHeaderCells(sourceColumns, utilityColumnCount, headerDepth), [headerDepth, sourceColumns, utilityColumnCount]);
1740
- const activeCustomHeaderLevels = useMemo(() => {
1937
+ const headerCells = useMemo2(() => buildHeaderCells(sourceColumns, utilityColumnCount, headerDepth), [headerDepth, sourceColumns, utilityColumnCount]);
1938
+ const activeCustomHeaderLevels = useMemo2(() => {
1741
1939
  const levels = /* @__PURE__ */ new Map();
1742
1940
  columns.forEach((column) => {
1743
1941
  if (column.renderHeader) levels.set(column.key, headerDepth - 1);
@@ -1747,52 +1945,52 @@ function TableInner({
1747
1945
  });
1748
1946
  return levels;
1749
1947
  }, [columns, headerCells, headerDepth]);
1750
- const canvasRef = useRef2(null);
1751
- const scrollerRef = useRef2(null);
1752
- const rootRef = useRef2(null);
1753
- const frameRef = useRef2(null);
1754
- const textFrameRef = useRef2(null);
1755
- const toastTimerRef = useRef2(null);
1756
- const headerTooltipTimerRef = useRef2(null);
1757
- const cellTooltipTimerRef = useRef2(null);
1758
- const pendingHeaderTooltipKeyRef = useRef2("");
1759
- const pendingCellTooltipKeyRef = useRef2("");
1760
- const clickedCellRef = useRef2(null);
1761
- const rowAnchorRef = useRef2(null);
1762
- const columnAnchorRef = useRef2(null);
1763
- const columnDragRef = useRef2(null);
1764
- const columnOrderDragRef = useRef2(null);
1765
- const columnOrderLongPressTimerRef = useRef2(null);
1766
- const dragGuideRef = useRef2(null);
1767
- const rowDragGuideRef = useRef2(null);
1768
- const selectionFocusRef = useRef2(null);
1769
- const selectionEdgeTargetRef = useRef2(null);
1770
- const verticalScrollbarRef = useRef2(null);
1771
- const verticalScrollbarThumbRef = useRef2(null);
1772
- const verticalScrollbarDragRef = useRef2(null);
1773
- const horizontalScrollbarRef = useRef2(null);
1774
- const horizontalScrollbarThumbRef = useRef2(null);
1775
- const horizontalScrollbarDragRef = useRef2(null);
1776
- const verticalScrollbarVisibilityTimerRef = useRef2(null);
1777
- const horizontalScrollbarVisibilityTimerRef = useRef2(null);
1778
- const rowByKeyRef = useRef2(/* @__PURE__ */ new Map());
1779
- const rowIndexByKeyRef = useRef2(/* @__PURE__ */ new Map());
1780
- const headerIconsRef = useRef2(null);
1781
- const scrollingHeaderIconsRef = useRef2(null);
1782
- const scrollingTextRef = useRef2(null);
1783
- const filterRef = useRef2(null);
1784
- const contextMenuRef = useRef2(null);
1785
- const suppressClickRef = useRef2(false);
1786
- const hasCompletedLoadRef = useRef2(!loading);
1787
- const validColumnDropRef = useRef2(null);
1788
- const hoveredHeaderActionRef = useRef2(null);
1789
- const hoveredRowIndexRef = useRef2(null);
1790
- const [viewport, setViewport] = useState4({ width: 0, height: typeof height === "number" ? height : FALLBACK_HEIGHT });
1791
- const [horizontalScrollbarHeight, setHorizontalScrollbarHeight] = useState4(0);
1792
- const [availableHeight, setAvailableHeight] = useState4(FALLBACK_HEIGHT);
1948
+ const canvasRef = useRef4(null);
1949
+ const scrollerRef = useRef4(null);
1950
+ const rootRef = useRef4(null);
1951
+ const frameRef = useRef4(null);
1952
+ const textFrameRef = useRef4(null);
1953
+ const toastTimerRef = useRef4(null);
1954
+ const headerTooltipTimerRef = useRef4(null);
1955
+ const cellTooltipTimerRef = useRef4(null);
1956
+ const pendingHeaderTooltipKeyRef = useRef4("");
1957
+ const pendingCellTooltipKeyRef = useRef4("");
1958
+ const clickedCellRef = useRef4(null);
1959
+ const rowAnchorRef = useRef4(null);
1960
+ const columnAnchorRef = useRef4(null);
1961
+ const columnDragRef = useRef4(null);
1962
+ const columnOrderDragRef = useRef4(null);
1963
+ const columnOrderLongPressTimerRef = useRef4(null);
1964
+ const dragGuideRef = useRef4(null);
1965
+ const rowDragGuideRef = useRef4(null);
1966
+ const selectionFocusRef = useRef4(null);
1967
+ const selectionEdgeTargetRef = useRef4(null);
1968
+ const verticalScrollbarRef = useRef4(null);
1969
+ const verticalScrollbarThumbRef = useRef4(null);
1970
+ const verticalScrollbarDragRef = useRef4(null);
1971
+ const horizontalScrollbarRef = useRef4(null);
1972
+ const horizontalScrollbarThumbRef = useRef4(null);
1973
+ const horizontalScrollbarDragRef = useRef4(null);
1974
+ const verticalScrollbarVisibilityTimerRef = useRef4(null);
1975
+ const horizontalScrollbarVisibilityTimerRef = useRef4(null);
1976
+ const rowByKeyRef = useRef4(/* @__PURE__ */ new Map());
1977
+ const rowIndexByKeyRef = useRef4(/* @__PURE__ */ new Map());
1978
+ const headerIconsRef = useRef4(null);
1979
+ const scrollingHeaderIconsRef = useRef4(null);
1980
+ const scrollingTextRef = useRef4(null);
1981
+ const filterRef = useRef4(null);
1982
+ const contextMenuRef = useRef4(null);
1983
+ const suppressClickRef = useRef4(false);
1984
+ const hasCompletedLoadRef = useRef4(!loading);
1985
+ const validColumnDropRef = useRef4(null);
1986
+ const hoveredHeaderActionRef = useRef4(null);
1987
+ const hoveredRowIndexRef = useRef4(null);
1988
+ const [viewport, setViewport] = useState6({ width: 0, height: typeof height === "number" ? height : FALLBACK_HEIGHT });
1989
+ const [horizontalScrollbarHeight, setHorizontalScrollbarHeight] = useState6(0);
1990
+ const [availableHeight, setAvailableHeight] = useState6(FALLBACK_HEIGHT);
1793
1991
  const resolvedHeight = typeof height === "number" ? height : availableHeight;
1794
- const [scrollPosition, setScrollPosition] = useState4({ left: 0, top: 0 });
1795
- const scrollRef = useRef2({ left: 0, top: 0 });
1992
+ const [scrollPosition, setScrollPosition] = useState6({ left: 0, top: 0 });
1993
+ const scrollRef = useRef4({ left: 0, top: 0 });
1796
1994
  const [rowKeys, setRowKeys] = useControllableKeys(selectedRowKeys, defaultSelectedRowKeys, (keys) => {
1797
1995
  if (!onSelectedRowChange) return;
1798
1996
  const missing = new Set(keys.filter((key) => !rowByKeyRef.current.has(key)));
@@ -1814,20 +2012,20 @@ function TableInner({
1814
2012
  onSelectedRowChange(keys, entries.map(({ row }) => row), entries.map(({ index }) => index));
1815
2013
  });
1816
2014
  const [columnKeys, setColumnKeys] = useControllableKeys(selectedColumnKeys, defaultSelectedColumnKeys, onSelectedColumnChange);
1817
- const [editing, setEditing] = useState4(null);
1818
- const [draft, setDraft] = useState4("");
1819
- const [rowDragPreview, setRowDragPreview] = useState4(null);
1820
- const [columnDragPreview, setColumnDragPreview] = useState4(null);
1821
- const [columnDropTarget, setColumnDropTarget] = useState4(null);
1822
- useEffect2(() => {
2015
+ const [editing, setEditing] = useState6(null);
2016
+ const [draft, setDraft] = useState6("");
2017
+ const [rowDragPreview, setRowDragPreview] = useState6(null);
2018
+ const [columnDragPreview, setColumnDragPreview] = useState6(null);
2019
+ const [columnDropTarget, setColumnDropTarget] = useState6(null);
2020
+ useEffect3(() => {
1823
2021
  if (!loading) hasCompletedLoadRef.current = true;
1824
2022
  }, [loading]);
1825
- useEffect2(() => {
2023
+ useEffect3(() => {
1826
2024
  if (rangeSelection) return;
1827
2025
  rangeDragRef.current = null;
1828
2026
  setSelectionRange(null);
1829
2027
  }, [rangeSelection]);
1830
- useEffect2(() => {
2028
+ useEffect3(() => {
1831
2029
  const previousSourceWidths = sourceColumnWidthsRef.current;
1832
2030
  const nextSourceWidths = new Map(leafSourceColumns.map((column) => [column.key, column.width]));
1833
2031
  sourceColumnWidthsRef.current = nextSourceWidths;
@@ -1851,7 +2049,7 @@ function TableInner({
1851
2049
  return changed ? next : current;
1852
2050
  });
1853
2051
  }, [leafSourceColumns]);
1854
- useEffect2(() => () => {
2052
+ useEffect3(() => () => {
1855
2053
  if (headerTooltipTimerRef.current !== null) clearTimeout(headerTooltipTimerRef.current);
1856
2054
  if (cellTooltipTimerRef.current !== null) clearTimeout(cellTooltipTimerRef.current);
1857
2055
  }, []);
@@ -1873,7 +2071,7 @@ function TableInner({
1873
2071
  return changed ? nextHeights : current;
1874
2072
  });
1875
2073
  }, [activeCustomHeaderLevels, baseHeaderHeight, headerDepth]);
1876
- useLayoutEffect2(() => {
2074
+ useLayoutEffect3(() => {
1877
2075
  customHeaderContentRefs.current.forEach((_, key) => {
1878
2076
  if (!activeCustomHeaderLevels.has(key)) customHeaderContentRefs.current.delete(key);
1879
2077
  });
@@ -1890,22 +2088,22 @@ function TableInner({
1890
2088
  customHeaderContentRefs.current.forEach((node) => observer.observe(node));
1891
2089
  return () => observer.disconnect();
1892
2090
  }, [activeCustomHeaderLevels, measureCustomHeaderHeight, viewport.width]);
1893
- const [filterEditor, setFilterEditor] = useState4(null);
1894
- const [filterValues, setFilterValues] = useState4({});
1895
- const [sortState, setSortState] = useState4(null);
1896
- const [contextMenu, setContextMenu] = useState4(null);
1897
- const [insertCounts, setInsertCounts] = useState4({ before: 1, after: 1 });
1898
- const [confirmAction, setConfirmAction] = useState4(null);
1899
- const [confirmLoading, setConfirmLoading] = useState4(false);
1900
- const [insertBusy, setInsertBusy] = useState4(false);
1901
- const [deleteBusy, setDeleteBusy] = useState4(false);
1902
- const [toast, setToast] = useState4(null);
1903
- const [resizeGuideX, setResizeGuideX] = useState4(null);
1904
- const [resizeGuideTop, setResizeGuideTop] = useState4(0);
1905
- const [hoveredHeaderColumnIndex, setHoveredHeaderColumnIndex] = useState4(null);
1906
- const [hoveredHeaderAction, setHoveredHeaderAction] = useState4(null);
1907
- const [visibleHeaderTooltip, setVisibleHeaderTooltip] = useState4(null);
1908
- const [hoveredCellTooltip, setHoveredCellTooltip] = useState4(null);
2091
+ const [filterEditor, setFilterEditor] = useState6(null);
2092
+ const [filterValues, setFilterValues] = useState6({});
2093
+ const [sortState, setSortState] = useState6(null);
2094
+ const [contextMenu, setContextMenu] = useState6(null);
2095
+ const [insertCounts, setInsertCounts] = useState6({ before: 1, after: 1 });
2096
+ const [confirmAction, setConfirmAction] = useState6(null);
2097
+ const [confirmLoading, setConfirmLoading] = useState6(false);
2098
+ const [insertBusy, setInsertBusy] = useState6(false);
2099
+ const [deleteBusy, setDeleteBusy] = useState6(false);
2100
+ const [toast, setToast] = useState6(null);
2101
+ const [resizeGuideX, setResizeGuideX] = useState6(null);
2102
+ const [resizeGuideTop, setResizeGuideTop] = useState6(0);
2103
+ const [hoveredHeaderColumnIndex, setHoveredHeaderColumnIndex] = useState6(null);
2104
+ const [hoveredHeaderAction, setHoveredHeaderAction] = useState6(null);
2105
+ const [visibleHeaderTooltip, setVisibleHeaderTooltip] = useState6(null);
2106
+ const [hoveredCellTooltip, setHoveredCellTooltip] = useState6(null);
1909
2107
  const hideDragTooltips = useCallback2(() => {
1910
2108
  if (headerTooltipTimerRef.current !== null) {
1911
2109
  clearTimeout(headerTooltipTimerRef.current);
@@ -1920,19 +2118,19 @@ function TableInner({
1920
2118
  setVisibleHeaderTooltip(null);
1921
2119
  setHoveredCellTooltip(null);
1922
2120
  }, []);
1923
- const [editedCellKeys, setEditedCellKeys] = useState4(() => /* @__PURE__ */ new Set());
1924
- const [cellAnnotations, setCellAnnotations] = useState4(() => /* @__PURE__ */ new Map());
1925
- const [annotationType, setAnnotationType] = useState4("corner");
1926
- const [annotationColor, setAnnotationColor] = useState4(ANNOTATION_COLORS[0]);
1927
- const [annotationContent, setAnnotationContent] = useState4("");
1928
- const [annotationOpen, setAnnotationOpen] = useState4(false);
1929
- const [annotationPlacement, setAnnotationPlacement] = useState4("right-down");
1930
- const originalCellValuesRef = useRef2(/* @__PURE__ */ new Map());
1931
- const [pendingDeletedRowKeys, setPendingDeletedRowKeys] = useState4(() => /* @__PURE__ */ new Set());
1932
- const [pendingInserts, setPendingInserts] = useState4(() => []);
1933
- const [insertedRowKeys, setInsertedRowKeys] = useState4(() => /* @__PURE__ */ new Set());
1934
- const [rowOrderKeys, setRowOrderKeys] = useState4(null);
1935
- const settledPendingInsertIdsRef = useRef2(/* @__PURE__ */ new Set());
2121
+ const [editedCellKeys, setEditedCellKeys] = useState6(() => /* @__PURE__ */ new Set());
2122
+ const [cellAnnotations, setCellAnnotations] = useState6(() => /* @__PURE__ */ new Map());
2123
+ const [annotationType, setAnnotationType] = useState6("corner");
2124
+ const [annotationColor, setAnnotationColor] = useState6(ANNOTATION_COLORS[0]);
2125
+ const [annotationContent, setAnnotationContent] = useState6("");
2126
+ const [annotationOpen, setAnnotationOpen] = useState6(false);
2127
+ const [annotationPlacement, setAnnotationPlacement] = useState6("right-down");
2128
+ const originalCellValuesRef = useRef4(/* @__PURE__ */ new Map());
2129
+ const [pendingDeletedRowKeys, setPendingDeletedRowKeys] = useState6(() => /* @__PURE__ */ new Set());
2130
+ const [pendingInserts, setPendingInserts] = useState6(() => []);
2131
+ const [insertedRowKeys, setInsertedRowKeys] = useState6(() => /* @__PURE__ */ new Set());
2132
+ const [rowOrderKeys, setRowOrderKeys] = useState6(null);
2133
+ const settledPendingInsertIdsRef = useRef4(/* @__PURE__ */ new Set());
1936
2134
  const getDataRowKey = useCallback2((row, index) => {
1937
2135
  return typeof rowKey === "function" ? rowKey(row, index) : rowKey ? row[rowKey] : getDefaultRowKey(row, index);
1938
2136
  }, [rowKey]);
@@ -1946,7 +2144,7 @@ function TableInner({
1946
2144
  }
1947
2145
  return sourceRows.findIndex((sourceRow, index) => getDataRowKey(sourceRow, index) === key);
1948
2146
  }, [getDataRowKey, sourceRows]);
1949
- const orderedRows = useMemo(() => {
2147
+ const orderedRows = useMemo2(() => {
1950
2148
  let next = sourceRows;
1951
2149
  if (pendingInserts.length > 0) {
1952
2150
  const activeInserts = pendingInserts.filter((insert) => {
@@ -1982,10 +2180,10 @@ function TableInner({
1982
2180
  });
1983
2181
  return ordered;
1984
2182
  }, [getDataRowKey, pendingDeletedRowKeys, pendingInserts, rowOrderKeys, sourceRows]);
1985
- const activeFilterValues = useMemo(() => Object.fromEntries(
2183
+ const activeFilterValues = useMemo2(() => Object.fromEntries(
1986
2184
  Object.entries(filterValues).filter(([, value]) => value.trim() !== "")
1987
2185
  ), [filterValues]);
1988
- const filteredRows = useMemo(() => {
2186
+ const filteredRows = useMemo2(() => {
1989
2187
  if (Object.keys(activeFilterValues).length === 0) return orderedRows;
1990
2188
  if (onFilterChange) return onFilterChange(orderedRows, activeFilterValues);
1991
2189
  return orderedRows.filter((row, rowIndex) => Object.entries(activeFilterValues).every(([columnKey, query]) => {
@@ -1994,7 +2192,7 @@ function TableInner({
1994
2192
  return getDisplayLabel(column, row, rowIndex).toLocaleLowerCase().includes(query.trim().toLocaleLowerCase());
1995
2193
  }));
1996
2194
  }, [activeFilterValues, columns, onFilterChange, orderedRows]);
1997
- const rows = useMemo(() => {
2195
+ const rows = useMemo2(() => {
1998
2196
  if (!sortState) return filteredRows;
1999
2197
  if (onSortChange) return onSortChange(filteredRows, sortState);
2000
2198
  const column = columns.find((candidate) => candidate.key === sortState.columnKey);
@@ -2020,8 +2218,8 @@ function TableInner({
2020
2218
  columnKey: target.columnKey
2021
2219
  };
2022
2220
  }, [columns, getDataRowKey, rows]);
2023
- const resolvedSelectedCell = useMemo(() => resolveSelectionTarget(selectedCell), [resolveSelectionTarget, selectedCell]);
2024
- const resolvedDefaultSelectedCell = useMemo(() => resolveSelectionTarget(defaultSelectedCell), [defaultSelectedCell, resolveSelectionTarget]);
2221
+ const resolvedSelectedCell = useMemo2(() => resolveSelectionTarget(selectedCell), [resolveSelectionTarget, selectedCell]);
2222
+ const resolvedDefaultSelectedCell = useMemo2(() => resolveSelectionTarget(defaultSelectedCell), [defaultSelectedCell, resolveSelectionTarget]);
2025
2223
  const handleSelectedCellChange = useCallback2((next) => {
2026
2224
  if (!onSelectedCellChange) return;
2027
2225
  if (!next) {
@@ -2034,15 +2232,16 @@ function TableInner({
2034
2232
  onSelectedCellChange({ ...next, value });
2035
2233
  }, [columns, onSelectedCellChange, rows]);
2036
2234
  const [selection, setSelection] = useControllableValue(resolvedSelectedCell, resolvedDefaultSelectedCell, handleSelectedCellChange);
2037
- const [selectionRange, setSelectionRange] = useState4(null);
2038
- const rangeDragRef = useRef2(null);
2039
- useEffect2(() => {
2235
+ const [selectionRange, setSelectionRange] = useState6(null);
2236
+ const rangeDragRef = useRef4(null);
2237
+ useEffect3(() => {
2040
2238
  if (!selection) return void 0;
2041
2239
  const handleOutsidePointerDown = (event) => {
2042
2240
  const target = event.target;
2043
2241
  if (!(target instanceof Node)) return;
2044
2242
  if (rootRef.current?.contains(target)) return;
2045
2243
  if (target instanceof Element && target.closest(".rvg-choice-content, .rvg-date-content, .rvg-time-dropdown")) return;
2244
+ if (target instanceof Element && target.closest(".rvg-textarea-dialog")) return;
2046
2245
  clickedCellRef.current = null;
2047
2246
  setSelectionRange(null);
2048
2247
  setSelection(null);
@@ -2064,7 +2263,7 @@ function TableInner({
2064
2263
  setSourceColumns(nextColumns);
2065
2264
  onColumnsReorder?.(nextColumns, { sourceIndex, targetIndex, ...detail });
2066
2265
  }, [onColumnsReorder, sourceColumns]);
2067
- useEffect2(() => {
2266
+ useEffect3(() => {
2068
2267
  if (insertBusy || settledPendingInsertIdsRef.current.size === 0) return;
2069
2268
  setPendingInserts((current) => {
2070
2269
  const next = current.filter((insert) => !settledPendingInsertIdsRef.current.has(insert.id));
@@ -2075,7 +2274,7 @@ function TableInner({
2075
2274
  return next;
2076
2275
  });
2077
2276
  }, [insertBusy, pendingInserts]);
2078
- useEffect2(() => {
2277
+ useEffect3(() => {
2079
2278
  if (pendingDeletedRowKeys.size === 0) return;
2080
2279
  setPendingDeletedRowKeys((current) => {
2081
2280
  if (current.size === 0) return current;
@@ -2089,20 +2288,20 @@ function TableInner({
2089
2288
  return changed ? next : current;
2090
2289
  });
2091
2290
  }, [getDataRowKey, pendingDeletedRowKeys.size, sourceRows]);
2092
- useLayoutEffect2(() => {
2291
+ useLayoutEffect3(() => {
2093
2292
  if (!editing) return;
2094
2293
  if (selection?.rowKey === editing.rowKey && selection.columnKey === editing.columnKey) return;
2095
2294
  setEditing(null);
2096
2295
  }, [editing, selection]);
2097
2296
  const hasManualColumnWidths = Object.keys(resizedColumnWidths).length > 0;
2098
- const metrics = useMemo(() => buildColumnMetrics(columns, {
2297
+ const metrics = useMemo2(() => buildColumnMetrics(columns, {
2099
2298
  columnDraggable,
2100
2299
  viewportWidth: !stretchColumns || hasManualColumnWidths ? 0 : viewport.width
2101
2300
  }), [columnDraggable, columns, hasManualColumnWidths, stretchColumns, viewport.width]);
2102
2301
  const contentWidth = metrics.length > 0 ? metrics[metrics.length - 1].right : 0;
2103
2302
  const contentHeight = rows.length * rowHeight;
2104
- const fixedWidth = useMemo(() => columns.reduce((width2, column, index) => column.fixed === "left" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
2105
- const leftFixedOffsets = useMemo(() => {
2303
+ const fixedWidth = useMemo2(() => columns.reduce((width2, column, index) => column.fixed === "left" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
2304
+ const leftFixedOffsets = useMemo2(() => {
2106
2305
  const offsets = /* @__PURE__ */ new Map();
2107
2306
  let offset = 0;
2108
2307
  for (let index = 0; index < columns.length; index += 1) {
@@ -2112,8 +2311,8 @@ function TableInner({
2112
2311
  }
2113
2312
  return offsets;
2114
2313
  }, [columns, metrics]);
2115
- const rightFixedWidth = useMemo(() => columns.reduce((width2, column, index) => column.fixed === "right" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
2116
- const rightFixedOffsets = useMemo(() => {
2314
+ const rightFixedWidth = useMemo2(() => columns.reduce((width2, column, index) => column.fixed === "right" ? width2 + metrics[index].width : width2, 0), [columns, metrics]);
2315
+ const rightFixedOffsets = useMemo2(() => {
2117
2316
  const offsets = /* @__PURE__ */ new Map();
2118
2317
  let offset = 0;
2119
2318
  for (let index = columns.length - 1; index >= 0; index -= 1) {
@@ -2123,7 +2322,7 @@ function TableInner({
2123
2322
  }
2124
2323
  return offsets;
2125
2324
  }, [columns, metrics]);
2126
- const scrollableColumnLefts = useMemo(() => {
2325
+ const scrollableColumnLefts = useMemo2(() => {
2127
2326
  const lefts = [];
2128
2327
  let width2 = fixedWidth;
2129
2328
  for (let index = 0; index < columns.length; index += 1) {
@@ -2133,9 +2332,9 @@ function TableInner({
2133
2332
  return lefts;
2134
2333
  }, [columns, fixedWidth, metrics]);
2135
2334
  const getScrollableColumnLeft = useCallback2((columnIndex) => scrollableColumnLefts[columnIndex] ?? fixedWidth, [fixedWidth, scrollableColumnLefts]);
2136
- const hasRowSelectionColumn = useMemo(() => columns.some((column) => column.rowSelection), [columns]);
2335
+ const hasRowSelectionColumn = useMemo2(() => columns.some((column) => column.rowSelection), [columns]);
2137
2336
  const rowSelectionMode = typeof rowSelection === "object" ? rowSelection.mode ?? "multiple" : "multiple";
2138
- const summarySignature = useMemo(() => getSummarySignature(columns), [columns]);
2337
+ const summarySignature = useMemo2(() => getSummarySignature(columns), [columns]);
2139
2338
  const hasSummaryRow = rows.length > 0 && summaryEnabled && summarySignature.length > 0;
2140
2339
  const topSummaryHeight = hasSummaryRow && summaryPosition === "top" ? rowHeight : 0;
2141
2340
  const bottomSummaryHeight = hasSummaryRow && summaryPosition === "bottom" ? rowHeight : 0;
@@ -2145,10 +2344,10 @@ function TableInner({
2145
2344
  const effectiveHeight = autoHeight ? Math.max(bodyTop + bottomSummaryHeight, Math.min(resolvedHeight, realContentHeight)) : resolvedHeight;
2146
2345
  const renderHeight = Math.max(0, effectiveHeight - bottomSummaryHeight);
2147
2346
  const bodyViewportHeight = Math.max(0, renderHeight - (fixedHeader ? headerHeight + topSummaryHeight : 0));
2148
- const [summaryState, setSummaryState] = useState4(() => ({ signature: "", rows: null, values: /* @__PURE__ */ new Map(), pending: false }));
2347
+ const [summaryState, setSummaryState] = useState6(() => ({ signature: "", rows: null, values: /* @__PURE__ */ new Map(), pending: false }));
2149
2348
  const summaryPending = hasSummaryRow && (loading || summaryState.pending || summaryState.signature !== summarySignature || summaryState.rows !== rows);
2150
2349
  const summaryValues = hasSummaryRow && summaryState.signature === summarySignature && summaryState.rows === rows ? summaryState.values : /* @__PURE__ */ new Map();
2151
- useEffect2(() => {
2350
+ useEffect3(() => {
2152
2351
  let cancelled = false;
2153
2352
  if (!hasSummaryRow) {
2154
2353
  setSummaryState((current) => current.signature === "" && current.rows === null && current.values.size === 0 && !current.pending ? current : { signature: "", rows: null, values: /* @__PURE__ */ new Map(), pending: false });
@@ -2179,7 +2378,7 @@ function TableInner({
2179
2378
  cancelled = true;
2180
2379
  };
2181
2380
  }, [hasSummaryRow, loading, rows, summarySignature]);
2182
- const domRange = useMemo(() => {
2381
+ const domRange = useMemo2(() => {
2183
2382
  if (!isVirtualized) return { rowStart: 0, rowEnd: rows.length, columnStart: 0, columnEnd: columns.length };
2184
2383
  const currentScroll2 = scrollRef.current;
2185
2384
  const rowScrollTop = fixedHeader ? currentScroll2.top : Math.max(0, currentScroll2.top - bodyTop);
@@ -2191,7 +2390,7 @@ function TableInner({
2191
2390
  rowIndexByKeyRef.current.set(key, index);
2192
2391
  return key;
2193
2392
  }, [getDataRowKey]);
2194
- const resolvedCellSpans = useMemo(() => {
2393
+ const resolvedCellSpans = useMemo2(() => {
2195
2394
  if (Array.isArray(cellSpans)) return cellSpans;
2196
2395
  const spans = [];
2197
2396
  rows.forEach((row, rowIndex) => {
@@ -2207,7 +2406,7 @@ function TableInner({
2207
2406
  });
2208
2407
  return spans;
2209
2408
  }, [cellSpans, columns, rows]);
2210
- const cellSpanLookup = useMemo(() => {
2409
+ const cellSpanLookup = useMemo2(() => {
2211
2410
  if (resolvedCellSpans.length === 0) return createEmptyCellSpanLookup();
2212
2411
  const rowIndexByKey = /* @__PURE__ */ new Map();
2213
2412
  rows.forEach((row, index) => rowIndexByKey.set(getRowKey(row, index), index));
@@ -2251,9 +2450,9 @@ function TableInner({
2251
2450
  }
2252
2451
  return lookup;
2253
2452
  }, [columns, getRowKey, resolvedCellSpans, rows]);
2254
- const selectedRowKeySet = useMemo(() => new Set(rowKeys), [rowKeys]);
2255
- const selectedColumnKeySet = useMemo(() => new Set(columnKeys), [columnKeys]);
2256
- const insertedRowKeySet = useMemo(() => insertedRowKeys, [insertedRowKeys]);
2453
+ const selectedRowKeySet = useMemo2(() => new Set(rowKeys), [rowKeys]);
2454
+ const selectedColumnKeySet = useMemo2(() => new Set(columnKeys), [columnKeys]);
2455
+ const insertedRowKeySet = useMemo2(() => insertedRowKeys, [insertedRowKeys]);
2257
2456
  const measureHeaderTitleWidth = useCallback2((columnIndex) => {
2258
2457
  const title = columns[columnIndex]?.title ?? "";
2259
2458
  const context = canvasRef.current?.getContext("2d");
@@ -2283,7 +2482,7 @@ function TableInner({
2283
2482
  }
2284
2483
  return width2;
2285
2484
  }, [columns.length, metrics]);
2286
- useEffect2(() => {
2485
+ useEffect3(() => {
2287
2486
  if (!selection) return;
2288
2487
  const nextRowIndex = rows.findIndex((row, index) => getRowKey(row, index) === selection.rowKey);
2289
2488
  const nextColumnIndex = columns.findIndex((column) => column.key === selection.columnKey);
@@ -2492,7 +2691,7 @@ function TableInner({
2492
2691
  target.classList.remove("is-shape-syncing");
2493
2692
  }
2494
2693
  }, [getSelectionEdgeIndicator]);
2495
- useLayoutEffect2(() => {
2694
+ useLayoutEffect3(() => {
2496
2695
  const element = scrollerRef.current;
2497
2696
  if (!element) return;
2498
2697
  const root = element.parentElement;
@@ -2518,7 +2717,7 @@ function TableInner({
2518
2717
  if (root?.parentElement) observer.observe(root.parentElement);
2519
2718
  return () => observer.disconnect();
2520
2719
  }, [height]);
2521
- useEffect2(() => {
2720
+ useEffect3(() => {
2522
2721
  scheduleDraw();
2523
2722
  return () => {
2524
2723
  if (frameRef.current !== null) {
@@ -2527,13 +2726,13 @@ function TableInner({
2527
2726
  }
2528
2727
  };
2529
2728
  }, [scheduleDraw]);
2530
- useEffect2(() => () => {
2729
+ useEffect3(() => () => {
2531
2730
  if (textFrameRef.current !== null) cancelAnimationFrame(textFrameRef.current);
2532
2731
  if (toastTimerRef.current !== null) clearTimeout(toastTimerRef.current);
2533
2732
  if (verticalScrollbarVisibilityTimerRef.current !== null) clearTimeout(verticalScrollbarVisibilityTimerRef.current);
2534
2733
  if (horizontalScrollbarVisibilityTimerRef.current !== null) clearTimeout(horizontalScrollbarVisibilityTimerRef.current);
2535
2734
  }, []);
2536
- useEffect2(() => {
2735
+ useEffect3(() => {
2537
2736
  const scroller = scrollerRef.current;
2538
2737
  if (!scroller) return;
2539
2738
  const containHorizontalOverscroll = (event) => {
@@ -2545,7 +2744,7 @@ function TableInner({
2545
2744
  scroller.addEventListener("wheel", containHorizontalOverscroll, { passive: false });
2546
2745
  return () => scroller.removeEventListener("wheel", containHorizontalOverscroll);
2547
2746
  }, []);
2548
- useEffect2(() => {
2747
+ useEffect3(() => {
2549
2748
  if (!filterEditor) return;
2550
2749
  const closeOnOutsidePointer = (event) => {
2551
2750
  if (!filterRef.current?.contains(event.target)) setFilterEditor(null);
@@ -2553,7 +2752,7 @@ function TableInner({
2553
2752
  document.addEventListener("pointerdown", closeOnOutsidePointer);
2554
2753
  return () => document.removeEventListener("pointerdown", closeOnOutsidePointer);
2555
2754
  }, [filterEditor]);
2556
- useEffect2(() => {
2755
+ useEffect3(() => {
2557
2756
  if (!contextMenu) return;
2558
2757
  const close = (event) => {
2559
2758
  if (!contextMenuRef.current?.contains(event.target)) setContextMenu(null);
@@ -2568,10 +2767,10 @@ function TableInner({
2568
2767
  document.removeEventListener("keydown", closeOnEscape);
2569
2768
  };
2570
2769
  }, [contextMenu]);
2571
- useEffect2(() => {
2770
+ useEffect3(() => {
2572
2771
  if (!confirmAction) setConfirmLoading(false);
2573
2772
  }, [confirmAction]);
2574
- useEffect2(() => {
2773
+ useEffect3(() => {
2575
2774
  const scroller = scrollerRef.current;
2576
2775
  if (!scroller || !insertBusy) return;
2577
2776
  const left = scroller.scrollLeft;
@@ -2665,7 +2864,7 @@ function TableInner({
2665
2864
  horizontalThumb.style.width = `${Math.min(trackWidth, thumbWidth)}px`;
2666
2865
  horizontalThumb.style.transform = `translateX(${thumbLeft}px)`;
2667
2866
  }, [autoHeight, bodyTop, bottomSummaryHeight, effectiveHeight, fixedHeader, fixedWidth, realContentHeight, renderHeight, rightFixedWidth, viewport.width]);
2668
- useLayoutEffect2(() => {
2867
+ useLayoutEffect3(() => {
2669
2868
  updateCustomScrollbars();
2670
2869
  }, [contentHeight, contentWidth, updateCustomScrollbars, viewport.height, viewport.width]);
2671
2870
  const handleVerticalScrollbarPointerDown = useCallback2((event) => {
@@ -2884,7 +3083,7 @@ function TableInner({
2884
3083
  if (columns[columnIndex].fixed === "right") return viewport.width - (rightFixedOffsets.get(columnIndex) ?? 0) - metric.width;
2885
3084
  return getScrollableColumnLeft(columnIndex) - scrollRef.current.left;
2886
3085
  }, [columns, getScrollableColumnLeft, leftFixedOffsets, metrics, rightFixedOffsets, viewport.width]);
2887
- const trailingColumnBorderLeft = useMemo(() => {
3086
+ const trailingColumnBorderLeft = useMemo2(() => {
2888
3087
  const displayedContentRight = columns.reduce((right, _column, columnIndex) => Math.max(right, getDisplayedColumnLeft(columnIndex) + metrics[columnIndex].width), 0);
2889
3088
  return displayedContentRight > 0 && displayedContentRight < viewport.width ? Math.round(displayedContentRight) - 1 : null;
2890
3089
  }, [columns, getDisplayedColumnLeft, metrics, scrollPosition.left, viewport.width]);
@@ -3049,7 +3248,7 @@ function TableInner({
3049
3248
  const rowIndex = Math.floor((localY - bodyTop + scrollRef.current.top) / rowHeight);
3050
3249
  return rowIndex >= 0 && rowIndex < rows.length ? rowIndex : -1;
3051
3250
  }, [bodyTop, rowHeight, rows.length]);
3052
- useEffect2(() => {
3251
+ useEffect3(() => {
3053
3252
  const canvas = canvasRef.current;
3054
3253
  if (!canvas || !rowDraggable) return;
3055
3254
  const cleanupDrag = draggable({
@@ -3404,11 +3603,29 @@ function TableInner({
3404
3603
  if (!editing || !editorStyle) return null;
3405
3604
  const column = columns[editing.columnIndex];
3406
3605
  if (column.editor?.type === "select") {
3407
- return /* @__PURE__ */ jsx7(
3606
+ return /* @__PURE__ */ jsx8(
3408
3607
  ChoiceEditor,
3409
3608
  {
3410
3609
  value: draft,
3411
3610
  options: column.editor.options,
3611
+ searchable: column.editor.searchable,
3612
+ allowCustomValue: column.editor.allowCustomValue,
3613
+ maxDropdownHeight: column.editor.maxDropdownHeight,
3614
+ style: editorStyle,
3615
+ labels,
3616
+ onChange: setDraft,
3617
+ onCommit: (next) => commitEdit(next),
3618
+ onCancel: () => setEditing(null)
3619
+ }
3620
+ );
3621
+ }
3622
+ if (column.editor?.type === "textarea") {
3623
+ return /* @__PURE__ */ jsx8(
3624
+ TextAreaEditor,
3625
+ {
3626
+ value: draft,
3627
+ title: column.editor.title ?? column.title,
3628
+ maxLength: column.editor.maxLength,
3412
3629
  style: editorStyle,
3413
3630
  labels,
3414
3631
  onChange: setDraft,
@@ -3418,7 +3635,7 @@ function TableInner({
3418
3635
  );
3419
3636
  }
3420
3637
  if (column.editor?.type === "time" || column.editor?.type === "time-range") {
3421
- return /* @__PURE__ */ jsx7(
3638
+ return /* @__PURE__ */ jsx8(
3422
3639
  CompactTimeEditor,
3423
3640
  {
3424
3641
  value: draft,
@@ -3433,7 +3650,7 @@ function TableInner({
3433
3650
  );
3434
3651
  }
3435
3652
  if (column.editor && ["date", "date-range", "date-time", "date-time-range", "year", "month"].includes(column.editor.type)) {
3436
- return /* @__PURE__ */ jsx7(
3653
+ return /* @__PURE__ */ jsx8(
3437
3654
  DateEditor,
3438
3655
  {
3439
3656
  editor: column.editor,
@@ -3449,11 +3666,14 @@ function TableInner({
3449
3666
  }
3450
3667
  const row = rows[editing.rowIndex];
3451
3668
  const cellValue = column.dataIndex === void 0 ? void 0 : row?.[column.dataIndex];
3452
- return /* @__PURE__ */ jsx7(
3669
+ return /* @__PURE__ */ jsx8(
3453
3670
  TextEditor,
3454
3671
  {
3455
3672
  value: draft,
3456
- type: typeof cellValue === "number" ? "number" : "text",
3673
+ type: column.editor?.type === "number" || typeof cellValue === "number" ? "number" : "text",
3674
+ min: column.editor?.type === "number" ? column.editor.min : void 0,
3675
+ max: column.editor?.type === "number" ? column.editor.max : void 0,
3676
+ integer: column.editor?.type === "number" ? column.editor.integer : void 0,
3457
3677
  style: editorStyle,
3458
3678
  labels,
3459
3679
  onChange: setDraft,
@@ -3495,7 +3715,7 @@ function TableInner({
3495
3715
  }
3496
3716
  }
3497
3717
  }, [beginEdit, bodyTop, columns, editing, renderHeight, fixedHeader, fixedWidth, getCellDisplayWidth, getCellSpan, getRowKey, getScrollableColumnLeft, metrics, rightFixedWidth, rowHeight, rows, selection, setSelection, viewport.width]);
3498
- const editorStyle = useMemo(() => {
3718
+ const editorStyle = useMemo2(() => {
3499
3719
  if (!editing) return void 0;
3500
3720
  const metric = metrics[editing.columnIndex];
3501
3721
  const column = columns[editing.columnIndex];
@@ -3794,21 +4014,21 @@ function TableInner({
3794
4014
  if (visibleActions.drag) {
3795
4015
  const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "drag";
3796
4016
  icons.push(
3797
- /* @__PURE__ */ jsx7(HeaderDragIcon, { className: `rvg-header-icon rvg-header-drag-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}`, style: { left: left + metrics[columnIndex].width - headerActionSlotWidth, top } }, "drag")
4017
+ /* @__PURE__ */ jsx8(HeaderDragIcon, { className: `rvg-header-icon rvg-header-drag-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}`, style: { left: left + metrics[columnIndex].width - headerActionSlotWidth, top } }, "drag")
3798
4018
  );
3799
4019
  }
3800
4020
  if (visibleActions.sort) {
3801
4021
  const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "sort";
3802
4022
  const direction = sortState?.columnKey === column.key ? sortState.direction : null;
3803
4023
  icons.push(
3804
- /* @__PURE__ */ jsx7(HeaderSortIcon, { className: `rvg-header-icon${selectedClassName}${hoveredColumnClassName}${direction ? " is-active" : ""}${hovered ? " is-hovered" : ""}`, style: { left: right - headerActionSlotWidth, top }, direction }, "sort")
4024
+ /* @__PURE__ */ jsx8(HeaderSortIcon, { className: `rvg-header-icon${selectedClassName}${hoveredColumnClassName}${direction ? " is-active" : ""}${hovered ? " is-hovered" : ""}`, style: { left: right - headerActionSlotWidth, top }, direction }, "sort")
3805
4025
  );
3806
4026
  right -= headerActionSlotWidth;
3807
4027
  }
3808
4028
  if (visibleActions.filter) {
3809
4029
  const hovered = hoveredHeaderAction?.columnIndex === columnIndex && hoveredHeaderAction.action === "filter";
3810
4030
  icons.push(
3811
- /* @__PURE__ */ jsx7(HeaderSearchIcon, { className: `rvg-header-icon rvg-header-search-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}${filterValues[column.key] ? " is-active" : ""}`, style: { left: right - headerActionSlotWidth, top: top + 1 } }, "filter")
4031
+ /* @__PURE__ */ jsx8(HeaderSearchIcon, { className: `rvg-header-icon rvg-header-search-icon${selectedClassName}${hoveredColumnClassName}${hovered ? " is-hovered" : ""}${filterValues[column.key] ? " is-active" : ""}`, style: { left: right - headerActionSlotWidth, top: top + 1 } }, "filter")
3812
4032
  );
3813
4033
  }
3814
4034
  return icons;
@@ -4097,20 +4317,20 @@ function TableInner({
4097
4317
  setAnnotationOpen(false);
4098
4318
  setContextMenu(null);
4099
4319
  };
4100
- return /* @__PURE__ */ jsxs7(Fragment3, { children: [
4101
- /* @__PURE__ */ jsxs7("div", { className: `rvg-annotation-submenu is-${annotationPlacement}`, onMouseEnter: openAnnotation, onMouseLeave: () => setAnnotationOpen(false), children: [
4102
- /* @__PURE__ */ jsxs7("button", { type: "button", role: "menuitem", className: "rvg-context-annotation-trigger", "aria-expanded": annotationOpen, children: [
4103
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "annotation" }) }),
4104
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-label", children: labels.annotation }),
4105
- /* @__PURE__ */ jsx7(SubmenuArrowIcon, {})
4320
+ return /* @__PURE__ */ jsxs8(Fragment3, { children: [
4321
+ /* @__PURE__ */ jsxs8("div", { className: `rvg-annotation-submenu is-${annotationPlacement}`, onMouseEnter: openAnnotation, onMouseLeave: () => setAnnotationOpen(false), children: [
4322
+ /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", className: "rvg-context-annotation-trigger", "aria-expanded": annotationOpen, children: [
4323
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "annotation" }) }),
4324
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-label", children: labels.annotation }),
4325
+ /* @__PURE__ */ jsx8(SubmenuArrowIcon, {})
4106
4326
  ] }),
4107
- annotationOpen && /* @__PURE__ */ jsxs7("div", { className: `rvg-annotation-panel is-${annotationPlacement}`, role: "menu", children: [
4108
- /* @__PURE__ */ jsxs7("div", { className: `rvg-annotation-types${annotationType === "corner" ? " is-corner" : ""}`, role: "group", "aria-label": labels.annotationMode, children: [
4109
- /* @__PURE__ */ jsx7("button", { type: "button", className: annotationType === "background" ? "is-active" : "", onClick: () => setAnnotationType("background"), children: labels.annotationBackground }),
4110
- /* @__PURE__ */ jsx7("button", { type: "button", className: annotationType === "corner" ? "is-active" : "", onClick: () => setAnnotationType("corner"), children: labels.annotationCorner })
4327
+ annotationOpen && /* @__PURE__ */ jsxs8("div", { className: `rvg-annotation-panel is-${annotationPlacement}`, role: "menu", children: [
4328
+ /* @__PURE__ */ jsxs8("div", { className: `rvg-annotation-types${annotationType === "corner" ? " is-corner" : ""}`, role: "group", "aria-label": labels.annotationMode, children: [
4329
+ /* @__PURE__ */ jsx8("button", { type: "button", className: annotationType === "background" ? "is-active" : "", onClick: () => setAnnotationType("background"), children: labels.annotationBackground }),
4330
+ /* @__PURE__ */ jsx8("button", { type: "button", className: annotationType === "corner" ? "is-active" : "", onClick: () => setAnnotationType("corner"), children: labels.annotationCorner })
4111
4331
  ] }),
4112
- /* @__PURE__ */ jsx7("div", { className: "rvg-annotation-colors", children: ANNOTATION_COLORS.map((color, index) => /* @__PURE__ */ jsx7("button", { type: "button", className: annotationColor === color ? "is-active" : "", "aria-label": labels.annotationColor(index + 1), title: labels.annotationColor(index + 1), style: { backgroundColor: color, "--annotation-color": color }, onClick: () => setAnnotationColor(color) }, color)) }),
4113
- /* @__PURE__ */ jsx7(
4332
+ /* @__PURE__ */ jsx8("div", { className: "rvg-annotation-colors", children: ANNOTATION_COLORS.map((color, index) => /* @__PURE__ */ jsx8("button", { type: "button", className: annotationColor === color ? "is-active" : "", "aria-label": labels.annotationColor(index + 1), title: labels.annotationColor(index + 1), style: { backgroundColor: color, "--annotation-color": color }, onClick: () => setAnnotationColor(color) }, color)) }),
4333
+ /* @__PURE__ */ jsx8(
4114
4334
  "textarea",
4115
4335
  {
4116
4336
  className: "rvg-annotation-content",
@@ -4122,16 +4342,16 @@ function TableInner({
4122
4342
  onChange: (event) => setAnnotationContent(event.target.value)
4123
4343
  }
4124
4344
  ),
4125
- /* @__PURE__ */ jsxs7("div", { className: "rvg-annotation-actions", children: [
4126
- /* @__PURE__ */ jsxs7("span", { children: [
4345
+ /* @__PURE__ */ jsxs8("div", { className: "rvg-annotation-actions", children: [
4346
+ /* @__PURE__ */ jsxs8("span", { children: [
4127
4347
  annotationContent.length,
4128
4348
  "/100"
4129
4349
  ] }),
4130
- /* @__PURE__ */ jsx7("button", { type: "button", onClick: saveAnnotation, children: labels.confirm })
4350
+ /* @__PURE__ */ jsx8("button", { type: "button", onClick: saveAnnotation, children: labels.confirm })
4131
4351
  ] })
4132
4352
  ] })
4133
4353
  ] }),
4134
- hasAnnotation && /* @__PURE__ */ jsxs7("button", { type: "button", role: "menuitem", onClick: () => {
4354
+ hasAnnotation && /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", onClick: () => {
4135
4355
  setCellAnnotations((current) => {
4136
4356
  const next = new Map(current);
4137
4357
  targetCells.forEach((cell) => next.delete(getKey(cell)));
@@ -4139,8 +4359,8 @@ function TableInner({
4139
4359
  });
4140
4360
  setContextMenu(null);
4141
4361
  }, children: [
4142
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "remove-annotation" }) }),
4143
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-label", children: labels.removeAnnotation })
4362
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "remove-annotation" }) }),
4363
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-label", children: labels.removeAnnotation })
4144
4364
  ] })
4145
4365
  ] });
4146
4366
  };
@@ -4212,7 +4432,7 @@ function TableInner({
4212
4432
  if (column.renderCell && !(editing?.rowIndex === rowIndex && editing.columnIndex === columnIndex)) {
4213
4433
  const row = rows[rowIndex];
4214
4434
  const value = column.dataIndex === void 0 ? void 0 : row[column.dataIndex];
4215
- return /* @__PURE__ */ jsx7(
4435
+ return /* @__PURE__ */ jsx8(
4216
4436
  "div",
4217
4437
  {
4218
4438
  className: `rvg-cell-render${selectedRowKeySet.has(getRowKey(row, rowIndex)) || selectedColumnKeySet.has(column.key) ? " is-axis-selected" : ""}`,
@@ -4240,12 +4460,12 @@ function TableInner({
4240
4460
  const headerTop = fixedHeader ? 0 : -currentScrollTop;
4241
4461
  const leafTop = headerTop + headerLeafTop;
4242
4462
  if (column.rowNumber) {
4243
- return /* @__PURE__ */ jsx7(
4463
+ return /* @__PURE__ */ jsx8(
4244
4464
  "div",
4245
4465
  {
4246
4466
  className: `rvg-header-title${isDropTarget ? " is-drop-target" : ""}`,
4247
4467
  style: { left, top: headerTop, width: metrics[columnIndex].width, height: headerHeight, justifyContent: "center", padding: 0, textAlign: "center" },
4248
- children: /* @__PURE__ */ jsx7("span", { children: column.title })
4468
+ children: /* @__PURE__ */ jsx8("span", { children: column.title })
4249
4469
  },
4250
4470
  column.key
4251
4471
  );
@@ -4254,12 +4474,12 @@ function TableInner({
4254
4474
  if (rowSelectionMode === "single" || column.rowSelectionIndicator === "arrow" || column.rowSelectionIndicator === "none") return null;
4255
4475
  const allSelected = rows.length > 0 && selectedRowKeySet.size === rows.length;
4256
4476
  const indeterminate = selectedRowKeySet.size > 0 && !allSelected;
4257
- return /* @__PURE__ */ jsx7(
4477
+ return /* @__PURE__ */ jsx8(
4258
4478
  "div",
4259
4479
  {
4260
4480
  className: "rvg-header-selection-icon",
4261
4481
  style: { left, top: headerTop, width: metrics[columnIndex].width, height: headerHeight },
4262
- children: /* @__PURE__ */ jsx7(SelectionIcon, { checked: allSelected, indeterminate })
4482
+ children: /* @__PURE__ */ jsx8(SelectionIcon, { checked: allSelected, indeterminate })
4263
4483
  },
4264
4484
  column.key
4265
4485
  );
@@ -4268,7 +4488,7 @@ function TableInner({
4268
4488
  const visibleActions = getVisibleHeaderActions(column, metrics[columnIndex].width, columnDraggable, measureHeaderTitleWidth(columnIndex), headerActionSlotWidth);
4269
4489
  const actionWidth = (Number(visibleActions.drag) + Number(visibleActions.filter) + Number(visibleActions.sort)) * headerActionSlotWidth;
4270
4490
  const isHeaderHovered = hoveredHeaderColumnIndex === columnIndex;
4271
- return /* @__PURE__ */ jsx7(
4491
+ return /* @__PURE__ */ jsx8(
4272
4492
  "div",
4273
4493
  {
4274
4494
  className: `rvg-header-title is-custom${isHeaderHovered ? " is-header-hovered" : ""}${isAxisSelected ? " is-axis-selected" : ""}${isDropTarget ? " is-drop-target" : ""}`,
@@ -4283,7 +4503,7 @@ function TableInner({
4283
4503
  justifyContent: column.align === "right" ? "flex-end" : column.align === "center" ? "center" : "flex-start",
4284
4504
  textAlign: column.align === "right" ? "right" : column.align === "center" ? "center" : "left"
4285
4505
  },
4286
- children: /* @__PURE__ */ jsx7(
4506
+ children: /* @__PURE__ */ jsx8(
4287
4507
  "span",
4288
4508
  {
4289
4509
  style: { width: "100%" },
@@ -4317,7 +4537,7 @@ function TableInner({
4317
4537
  const actionWidth = visibleActions ? (Number(visibleActions.drag) + Number(visibleActions.filter) + Number(visibleActions.sort)) * headerActionSlotWidth : columnDraggable && !cell.leaf ? headerActionSlotWidth : 0;
4318
4538
  const isDropTarget = Boolean(columnDropTarget && cell.endIndex >= columnDropTarget.startIndex && cell.startIndex <= columnDropTarget.endIndex);
4319
4539
  const isAxisSelected = cell.leaf && selectedColumnKeySet.has(column.key);
4320
- return /* @__PURE__ */ jsxs7(
4540
+ return /* @__PURE__ */ jsxs8(
4321
4541
  "div",
4322
4542
  {
4323
4543
  className: `rvg-header-title rvg-header-group${column.renderHeader ? " is-custom" : ""}${cell.leaf ? " is-leaf" : ""}${isAxisSelected ? " is-axis-selected" : ""}${cell.endIndex === columns.length - 1 ? " is-frame-right" : ""}${isDropTarget ? " is-drop-target" : ""}`,
@@ -4336,7 +4556,7 @@ function TableInner({
4336
4556
  textAlign: column.align === "right" ? "right" : column.align === "center" ? "center" : "left"
4337
4557
  },
4338
4558
  children: [
4339
- /* @__PURE__ */ jsx7(
4559
+ /* @__PURE__ */ jsx8(
4340
4560
  "span",
4341
4561
  {
4342
4562
  ref: (node) => {
@@ -4350,7 +4570,7 @@ function TableInner({
4350
4570
  children: column.renderHeader ? column.renderHeader(column) : column.title
4351
4571
  }
4352
4572
  ),
4353
- !cell.leaf && columnDraggable && /* @__PURE__ */ jsx7(
4573
+ !cell.leaf && columnDraggable && /* @__PURE__ */ jsx8(
4354
4574
  HeaderDragIcon,
4355
4575
  {
4356
4576
  className: `rvg-header-icon rvg-header-drag-icon${hoveredHeaderAction?.columnIndex === cell.startIndex && hoveredHeaderAction.action === "drag" ? " is-hovered" : ""}`,
@@ -4417,7 +4637,7 @@ function TableInner({
4417
4637
  "--rvg-corner-hover-height-extension": "4px"
4418
4638
  } : null
4419
4639
  } : void 0;
4420
- useLayoutEffect2(() => {
4640
+ useLayoutEffect3(() => {
4421
4641
  syncSelectionEdgeTarget(scrollPosition.left, scrollPosition.top);
4422
4642
  }, [scrollPosition.left, scrollPosition.top, syncSelectionEdgeTarget]);
4423
4643
  const handleContextMenu = (event) => {
@@ -4452,7 +4672,7 @@ function TableInner({
4452
4672
  if (override?.render !== void 0 || override?.childrens !== void 0) {
4453
4673
  return renderContextMenuSubmenu(key, context, override?.label ?? label, override, icon, disabled, danger);
4454
4674
  }
4455
- return /* @__PURE__ */ jsxs7(
4675
+ return /* @__PURE__ */ jsxs8(
4456
4676
  "button",
4457
4677
  {
4458
4678
  type: "button",
@@ -4466,9 +4686,9 @@ function TableInner({
4466
4686
  setContextMenu(null);
4467
4687
  },
4468
4688
  children: [
4469
- icon && /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-icon", children: icon }),
4470
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-label", children: override?.label ?? label }),
4471
- override?.shortcut && /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-shortcut", children: override.shortcut })
4689
+ icon && /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-icon", children: icon }),
4690
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-label", children: override?.label ?? label }),
4691
+ override?.shortcut && /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-shortcut", children: override.shortcut })
4472
4692
  ]
4473
4693
  },
4474
4694
  key
@@ -4487,20 +4707,20 @@ function TableInner({
4487
4707
  }
4488
4708
  const node = renderCustomContextMenuItem(child, context);
4489
4709
  if (!node) return null;
4490
- const wrapped = /* @__PURE__ */ jsxs7(Fragment2, { children: [
4491
- separatorPending && /* @__PURE__ */ jsx7("div", { className: "rvg-context-separator" }),
4710
+ const wrapped = /* @__PURE__ */ jsxs8(Fragment2, { children: [
4711
+ separatorPending && /* @__PURE__ */ jsx8("div", { className: "rvg-context-separator" }),
4492
4712
  node
4493
4713
  ] }, child.key);
4494
4714
  separatorPending = false;
4495
4715
  return wrapped;
4496
4716
  });
4497
- return /* @__PURE__ */ jsxs7("div", { className: "rvg-context-submenu", children: [
4498
- /* @__PURE__ */ jsxs7("button", { type: "button", role: "menuitem", className: danger ? "rvg-context-danger" : void 0, disabled, "aria-haspopup": "menu", children: [
4499
- icon && /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-icon", children: icon }),
4500
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-label", children: label }),
4501
- /* @__PURE__ */ jsx7(SubmenuArrowIcon, {})
4717
+ return /* @__PURE__ */ jsxs8("div", { className: "rvg-context-submenu", children: [
4718
+ /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", className: danger ? "rvg-context-danger" : void 0, disabled, "aria-haspopup": "menu", children: [
4719
+ icon && /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-icon", children: icon }),
4720
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-label", children: label }),
4721
+ /* @__PURE__ */ jsx8(SubmenuArrowIcon, {})
4502
4722
  ] }),
4503
- /* @__PURE__ */ jsx7("div", { className: "rvg-context-submenu-panel", role: "menu", children: content })
4723
+ /* @__PURE__ */ jsx8("div", { className: "rvg-context-submenu-panel", role: "menu", children: content })
4504
4724
  ] }, key);
4505
4725
  };
4506
4726
  const renderConfiguredContextMenu = (items, context, renderBuiltin) => {
@@ -4517,10 +4737,10 @@ function TableInner({
4517
4737
  const node = renderBuiltin(key, override) ?? (override ? renderCustomContextMenuItem(override, context) : null);
4518
4738
  if (!node) return;
4519
4739
  if (separatorPending) {
4520
- nodes.push(/* @__PURE__ */ jsx7("div", { className: "rvg-context-separator" }, `separator:${index}`));
4740
+ nodes.push(/* @__PURE__ */ jsx8("div", { className: "rvg-context-separator" }, `separator:${index}`));
4521
4741
  separatorPending = false;
4522
4742
  }
4523
- nodes.push(/* @__PURE__ */ jsx7(Fragment2, { children: node }, typeof item === "string" ? `${item}:${index}` : item.key));
4743
+ nodes.push(/* @__PURE__ */ jsx8(Fragment2, { children: node }, typeof item === "string" ? `${item}:${index}` : item.key));
4524
4744
  });
4525
4745
  return nodes;
4526
4746
  };
@@ -4530,8 +4750,8 @@ function TableInner({
4530
4750
  const hasSummaryValue = summaryValues.has(column.key);
4531
4751
  const summaryContent = hasSummaryValue ? summaryValues.get(column.key) : summaryEmptyValue;
4532
4752
  const showSummarySkeleton = Boolean(column.summary) && summaryPending;
4533
- const content = columnIndex === 0 ? language === "zh-CN" ? "\u5408\u8BA1" : "Total" : showSummarySkeleton ? /* @__PURE__ */ jsx7("span", { className: "rvg-summary-skeleton" }) : summaryContent;
4534
- return /* @__PURE__ */ jsx7(
4753
+ const content = columnIndex === 0 ? language === "zh-CN" ? "\u5408\u8BA1" : "Total" : showSummarySkeleton ? /* @__PURE__ */ jsx8("span", { className: "rvg-summary-skeleton" }) : summaryContent;
4754
+ return /* @__PURE__ */ jsx8(
4535
4755
  "div",
4536
4756
  {
4537
4757
  className: `rvg-summary-cell${isUtility ? " is-utility" : ""}${column.summary ? " is-summary" : ""}${summaryVerticalBordered ? "" : " is-borderless"}`,
@@ -4633,9 +4853,9 @@ function TableInner({
4633
4853
  const draggingSelectedColumn = Boolean(
4634
4854
  columnDragPreview && selectedColumnKeySet.has(columns[columnDragPreview.sourceIndex]?.key)
4635
4855
  );
4636
- return /* @__PURE__ */ jsxs7("div", { ref: rootRef, className: `rvg-root${!hasVerticalBorders ? " is-vertical-borderless" : ""}${horizontalBorderless ? " is-horizontal-borderless" : ""}${frameBorderless ? " is-frame-borderless" : ""}${hasStripedRows ? " is-striped" : ""}${insertBusy ? " is-inserting" : ""}${deleteBusy ? " is-deleting" : ""}${draggingSelectedColumn ? " is-dragging-selected-column" : ""} ${loading && !hasCompletedLoadRef.current && !hasCustomLoading ? "is-initial-loading" : ""} ${className}`, style: rootStyle, children: [
4637
- /* @__PURE__ */ jsxs7("div", { ref: scrollerRef, className: `rvg-scroller${contextMenu ? " is-context-menu-open" : ""}`, style: { bottom: scrollerBottom }, onScroll: handleScroll, onCopy: handleCopy, onContextMenu: handleContextMenu, tabIndex: 0, role: "grid", "aria-label": ariaLabel, "aria-rowcount": rows.length, "aria-colcount": columns.length, onKeyDown: handleKeyDown, children: [
4638
- /* @__PURE__ */ jsx7(
4856
+ return /* @__PURE__ */ jsxs8("div", { ref: rootRef, className: `rvg-root${!hasVerticalBorders ? " is-vertical-borderless" : ""}${horizontalBorderless ? " is-horizontal-borderless" : ""}${frameBorderless ? " is-frame-borderless" : ""}${hasStripedRows ? " is-striped" : ""}${insertBusy ? " is-inserting" : ""}${deleteBusy ? " is-deleting" : ""}${draggingSelectedColumn ? " is-dragging-selected-column" : ""} ${loading && !hasCompletedLoadRef.current && !hasCustomLoading ? "is-initial-loading" : ""} ${className}`, style: rootStyle, children: [
4857
+ /* @__PURE__ */ jsxs8("div", { ref: scrollerRef, className: `rvg-scroller${contextMenu ? " is-context-menu-open" : ""}`, style: { bottom: scrollerBottom }, onScroll: handleScroll, onCopy: handleCopy, onContextMenu: handleContextMenu, tabIndex: 0, role: "grid", "aria-label": ariaLabel, "aria-rowcount": rows.length, "aria-colcount": columns.length, onKeyDown: handleKeyDown, children: [
4858
+ /* @__PURE__ */ jsx8(
4639
4859
  "canvas",
4640
4860
  {
4641
4861
  ref: canvasRef,
@@ -4873,48 +5093,48 @@ function TableInner({
4873
5093
  onContextMenu: handleContextMenu
4874
5094
  }
4875
5095
  ),
4876
- /* @__PURE__ */ jsxs7("div", { className: "rvg-text-layer", style: { width: viewport.width, height: renderHeight, marginTop: -renderHeight }, onContextMenu: handleContextMenu, children: [
4877
- /* @__PURE__ */ jsx7("div", { className: "rvg-text-scroll-clip", style: { left: fixedWidth, right: rightFixedWidth }, children: /* @__PURE__ */ jsxs7(
5096
+ /* @__PURE__ */ jsxs8("div", { className: "rvg-text-layer", style: { width: viewport.width, height: renderHeight, marginTop: -renderHeight }, onContextMenu: handleContextMenu, children: [
5097
+ /* @__PURE__ */ jsx8("div", { className: "rvg-text-scroll-clip", style: { left: fixedWidth, right: rightFixedWidth }, children: /* @__PURE__ */ jsxs8(
4878
5098
  "div",
4879
5099
  {
4880
5100
  ref: scrollingTextRef,
4881
5101
  className: "rvg-text-scroll-content",
4882
5102
  style: { left: -fixedWidth, width: contentWidth, transform: `translateX(${-currentScroll.left}px)` },
4883
5103
  children: [
4884
- columns.map((column, columnIndex) => column.fixed || columnIndex >= utilityColumnCount && headerDepth > 1 ? null : columnIndex >= domRange.columnStart && columnIndex < domRange.columnEnd ? /* @__PURE__ */ jsx7("span", { children: renderHeaderTitle(columnIndex, getScrollableColumnLeft(columnIndex)) }, column.key) : null),
5104
+ columns.map((column, columnIndex) => column.fixed || columnIndex >= utilityColumnCount && headerDepth > 1 ? null : columnIndex >= domRange.columnStart && columnIndex < domRange.columnEnd ? /* @__PURE__ */ jsx8("span", { children: renderHeaderTitle(columnIndex, getScrollableColumnLeft(columnIndex)) }, column.key) : null),
4885
5105
  headerCells.map((cell) => {
4886
5106
  if (columns[cell.startIndex]?.fixed) return null;
4887
5107
  if (cell.endIndex < domRange.columnStart || cell.startIndex >= domRange.columnEnd) return null;
4888
5108
  return renderGroupedHeaderCell(cell);
4889
5109
  }),
4890
- /* @__PURE__ */ jsx7("div", { className: "rvg-body-text-clip", style: { top: fixedHeader ? bodyTop : 0, bottom: 0 }, children: Array.from({ length: domRange.rowEnd - domRange.rowStart }, (_, offset) => domRange.rowStart + offset).flatMap((rowIndex) => columns.map((column, columnIndex) => {
5110
+ /* @__PURE__ */ jsx8("div", { className: "rvg-body-text-clip", style: { top: fixedHeader ? bodyTop : 0, bottom: 0 }, children: Array.from({ length: domRange.rowEnd - domRange.rowStart }, (_, offset) => domRange.rowStart + offset).flatMap((rowIndex) => columns.map((column, columnIndex) => {
4891
5111
  if (column.fixed || columnIndex < domRange.columnStart || columnIndex >= domRange.columnEnd) return null;
4892
5112
  return renderCellText(rowIndex, columnIndex, getScrollableColumnLeft(columnIndex));
4893
5113
  })) })
4894
5114
  ]
4895
5115
  }
4896
5116
  ) }),
4897
- /* @__PURE__ */ jsx7("div", { className: "rvg-body-text-clip", style: { top: fixedHeader ? bodyTop : 0, bottom: 0 }, children: Array.from({ length: domRange.rowEnd - domRange.rowStart }, (_, offset) => domRange.rowStart + offset).flatMap((rowIndex) => columns.map((column, columnIndex) => {
5117
+ /* @__PURE__ */ jsx8("div", { className: "rvg-body-text-clip", style: { top: fixedHeader ? bodyTop : 0, bottom: 0 }, children: Array.from({ length: domRange.rowEnd - domRange.rowStart }, (_, offset) => domRange.rowStart + offset).flatMap((rowIndex) => columns.map((column, columnIndex) => {
4898
5118
  if (!column.fixed) return null;
4899
5119
  const left = column.fixed === "left" ? leftFixedOffsets.get(columnIndex) ?? 0 : viewport.width - (rightFixedOffsets.get(columnIndex) ?? 0) - metrics[columnIndex].width;
4900
5120
  return renderCellText(rowIndex, columnIndex, left);
4901
5121
  })) }),
4902
5122
  columns.map((column, columnIndex) => column.fixed && (columnIndex < utilityColumnCount || headerDepth === 1) ? renderHeaderTitle(columnIndex, column.fixed === "right" ? viewport.width - (rightFixedOffsets.get(columnIndex) ?? 0) - metrics[columnIndex].width : column.fixed === "left" ? leftFixedOffsets.get(columnIndex) ?? 0 : getScrollableColumnLeft(columnIndex)) : null),
4903
5123
  headerCells.map((cell) => columns[cell.startIndex]?.fixed ? renderGroupedHeaderCell(cell) : null),
4904
- fixedWidth > 0 && currentScroll.left > 0 && /* @__PURE__ */ jsx7("div", { className: "rvg-text-fixed-shadow is-left", style: { left: fixedWidth } }),
4905
- rightFixedWidth > 0 && currentScroll.left < contentWidth - viewport.width && /* @__PURE__ */ jsx7("div", { className: "rvg-text-fixed-shadow is-right", style: { right: rightFixedWidth } }),
4906
- hasVerticalBorders && fixedWidth > 0 && /* @__PURE__ */ jsx7("div", { className: "rvg-text-fixed-border is-left", style: { left: fixedWidth - 1 } }),
4907
- hasVerticalBorders && rightFixedWidth > 0 && /* @__PURE__ */ jsx7("div", { className: "rvg-text-fixed-border is-right", style: { right: rightFixedWidth } })
5124
+ fixedWidth > 0 && currentScroll.left > 0 && /* @__PURE__ */ jsx8("div", { className: "rvg-text-fixed-shadow is-left", style: { left: fixedWidth } }),
5125
+ rightFixedWidth > 0 && currentScroll.left < contentWidth - viewport.width && /* @__PURE__ */ jsx8("div", { className: "rvg-text-fixed-shadow is-right", style: { right: rightFixedWidth } }),
5126
+ hasVerticalBorders && fixedWidth > 0 && /* @__PURE__ */ jsx8("div", { className: "rvg-text-fixed-border is-left", style: { left: fixedWidth - 1 } }),
5127
+ hasVerticalBorders && rightFixedWidth > 0 && /* @__PURE__ */ jsx8("div", { className: "rvg-text-fixed-border is-right", style: { right: rightFixedWidth } })
4908
5128
  ] }),
4909
- /* @__PURE__ */ jsx7("div", { className: "rvg-spacer", style: { width: contentWidth, height: contentHeight + bodyTop, marginTop: -renderHeight } })
5129
+ /* @__PURE__ */ jsx8("div", { className: "rvg-spacer", style: { width: contentWidth, height: contentHeight + bodyTop, marginTop: -renderHeight } })
4910
5130
  ] }),
4911
- hasSummaryRow && /* @__PURE__ */ jsxs7(
5131
+ hasSummaryRow && /* @__PURE__ */ jsxs8(
4912
5132
  "div",
4913
5133
  {
4914
5134
  className: `rvg-summary-row is-${summaryPosition}${hasVerticalBorders ? "" : " is-vertical-borderless"}`,
4915
5135
  style: { height: rowHeight, top: summaryPosition === "top" ? fixedHeader ? headerHeight : headerHeight - currentScroll.top : void 0 },
4916
5136
  children: [
4917
- /* @__PURE__ */ jsx7("div", { className: "rvg-summary-scroll-clip", style: { left: fixedWidth, right: rightFixedWidth }, children: /* @__PURE__ */ jsx7(
5137
+ /* @__PURE__ */ jsx8("div", { className: "rvg-summary-scroll-clip", style: { left: fixedWidth, right: rightFixedWidth }, children: /* @__PURE__ */ jsx8(
4918
5138
  "div",
4919
5139
  {
4920
5140
  className: "rvg-summary-scroll-content",
@@ -4922,41 +5142,41 @@ function TableInner({
4922
5142
  children: columns.map((column, columnIndex) => column.fixed ? null : renderSummaryCell(columnIndex, getScrollableColumnLeft(columnIndex)))
4923
5143
  }
4924
5144
  ) }),
4925
- /* @__PURE__ */ jsxs7("div", { className: "rvg-summary-fixed-layer", children: [
5145
+ /* @__PURE__ */ jsxs8("div", { className: "rvg-summary-fixed-layer", children: [
4926
5146
  columns.map((column, columnIndex) => column.fixed === "left" ? renderSummaryCell(columnIndex, leftFixedOffsets.get(columnIndex) ?? 0) : null),
4927
5147
  columns.map((column, columnIndex) => column.fixed === "right" ? renderSummaryCell(columnIndex, viewport.width - (rightFixedOffsets.get(columnIndex) ?? 0) - metrics[columnIndex].width) : null)
4928
5148
  ] }),
4929
- fixedWidth > 0 && currentScroll.left > 0 && /* @__PURE__ */ jsx7("div", { className: "rvg-summary-fixed-shadow is-left", style: { left: fixedWidth } }),
4930
- rightFixedWidth > 0 && currentScroll.left < contentWidth - viewport.width && /* @__PURE__ */ jsx7("div", { className: "rvg-summary-fixed-shadow is-right", style: { right: rightFixedWidth } }),
4931
- summaryVerticalBordered && fixedWidth > 0 && /* @__PURE__ */ jsx7("div", { className: "rvg-summary-fixed-border is-left", style: { left: fixedWidth - 1 } }),
4932
- summaryVerticalBordered && rightFixedWidth > 0 && /* @__PURE__ */ jsx7("div", { className: "rvg-summary-fixed-border is-right", style: { right: rightFixedWidth } })
5149
+ fixedWidth > 0 && currentScroll.left > 0 && /* @__PURE__ */ jsx8("div", { className: "rvg-summary-fixed-shadow is-left", style: { left: fixedWidth } }),
5150
+ rightFixedWidth > 0 && currentScroll.left < contentWidth - viewport.width && /* @__PURE__ */ jsx8("div", { className: "rvg-summary-fixed-shadow is-right", style: { right: rightFixedWidth } }),
5151
+ summaryVerticalBordered && fixedWidth > 0 && /* @__PURE__ */ jsx8("div", { className: "rvg-summary-fixed-border is-left", style: { left: fixedWidth - 1 } }),
5152
+ summaryVerticalBordered && rightFixedWidth > 0 && /* @__PURE__ */ jsx8("div", { className: "rvg-summary-fixed-border is-right", style: { right: rightFixedWidth } })
4933
5153
  ]
4934
5154
  }
4935
5155
  ),
4936
- /* @__PURE__ */ jsxs7("div", { ref: headerIconsRef, className: "rvg-header-icons", style: { height: headerHeight, transform: `translateY(${fixedHeader ? 0 : -scrollRef.current.top}px)` }, children: [
4937
- /* @__PURE__ */ jsx7("div", { className: "rvg-header-scroll-clip", style: { left: fixedWidth, right: rightFixedWidth }, children: /* @__PURE__ */ jsx7(
5156
+ /* @__PURE__ */ jsxs8("div", { ref: headerIconsRef, className: "rvg-header-icons", style: { height: headerHeight, transform: `translateY(${fixedHeader ? 0 : -scrollRef.current.top}px)` }, children: [
5157
+ /* @__PURE__ */ jsx8("div", { className: "rvg-header-scroll-clip", style: { left: fixedWidth, right: rightFixedWidth }, children: /* @__PURE__ */ jsx8(
4938
5158
  "div",
4939
5159
  {
4940
5160
  ref: scrollingHeaderIconsRef,
4941
5161
  className: "rvg-header-icon-layer rvg-header-icon-layer-scroll",
4942
5162
  style: { left: -fixedWidth, width: contentWidth, transform: `translateX(${-scrollRef.current.left}px)` },
4943
- children: columns.map((column, index) => column.fixed ? null : /* @__PURE__ */ jsx7("span", { children: renderHeaderIcons(index, getScrollableColumnLeft(index)) }, column.key))
5163
+ children: columns.map((column, index) => column.fixed ? null : /* @__PURE__ */ jsx8("span", { children: renderHeaderIcons(index, getScrollableColumnLeft(index)) }, column.key))
4944
5164
  }
4945
5165
  ) }),
4946
- /* @__PURE__ */ jsxs7("div", { className: "rvg-header-icon-layer", children: [
4947
- columns.map((column, index) => column.fixed === "left" ? /* @__PURE__ */ jsx7("span", { children: renderHeaderIcons(index, leftFixedOffsets.get(index) ?? 0) }, column.key) : null),
4948
- columns.map((column, index) => column.fixed === "right" ? /* @__PURE__ */ jsx7("span", { children: renderHeaderIcons(index, viewport.width - (rightFixedOffsets.get(index) ?? 0) - metrics[index].width) }, column.key) : null)
5166
+ /* @__PURE__ */ jsxs8("div", { className: "rvg-header-icon-layer", children: [
5167
+ columns.map((column, index) => column.fixed === "left" ? /* @__PURE__ */ jsx8("span", { children: renderHeaderIcons(index, leftFixedOffsets.get(index) ?? 0) }, column.key) : null),
5168
+ columns.map((column, index) => column.fixed === "right" ? /* @__PURE__ */ jsx8("span", { children: renderHeaderIcons(index, viewport.width - (rightFixedOffsets.get(index) ?? 0) - metrics[index].width) }, column.key) : null)
4949
5169
  ] })
4950
5170
  ] }),
4951
- hasVerticalBorders && trailingColumnBorderLeft !== null && /* @__PURE__ */ jsx7(
5171
+ hasVerticalBorders && trailingColumnBorderLeft !== null && /* @__PURE__ */ jsx8(
4952
5172
  "div",
4953
5173
  {
4954
5174
  className: "rvg-trailing-column-border",
4955
5175
  style: { left: trailingColumnBorderLeft, height: renderHeight }
4956
5176
  }
4957
5177
  ),
4958
- headerTooltip && /* @__PURE__ */ jsx7("div", { className: `rvg-header-tooltip is-${headerTooltip.placement}`, role: "tooltip", style: { left: headerTooltip.left, top: headerTooltip.top }, children: headerTooltip.label }),
4959
- hoveredCellTooltip && /* @__PURE__ */ jsx7(
5178
+ headerTooltip && /* @__PURE__ */ jsx8("div", { className: `rvg-header-tooltip is-${headerTooltip.placement}`, role: "tooltip", style: { left: headerTooltip.left, top: headerTooltip.top }, children: headerTooltip.label }),
5179
+ hoveredCellTooltip && /* @__PURE__ */ jsx8(
4960
5180
  "div",
4961
5181
  {
4962
5182
  className: `rvg-cell-tooltip${hoveredCellTooltip.annotation ? " is-annotation" : ` is-${hoveredCellTooltip.placement ?? "right"}`}`,
@@ -4978,7 +5198,7 @@ function TableInner({
4978
5198
  children: hoveredCellTooltip.label
4979
5199
  }
4980
5200
  ),
4981
- rangeHandlePosition && /* @__PURE__ */ jsx7(
5201
+ rangeHandlePosition && /* @__PURE__ */ jsx8(
4982
5202
  "div",
4983
5203
  {
4984
5204
  className: "rvg-range-handle",
@@ -5002,8 +5222,8 @@ function TableInner({
5002
5222
  }
5003
5223
  }
5004
5224
  ),
5005
- selectionOutlineStyle && /* @__PURE__ */ jsx7("div", { ref: selectionFocusRef, className: "rvg-selection-focus", style: selectionOutlineStyle, "aria-hidden": "true" }),
5006
- selectionEdgeIndicator && selection && /* @__PURE__ */ jsx7(
5225
+ selectionOutlineStyle && /* @__PURE__ */ jsx8("div", { ref: selectionFocusRef, className: "rvg-selection-focus", style: selectionOutlineStyle, "aria-hidden": "true" }),
5226
+ selectionEdgeIndicator && selection && /* @__PURE__ */ jsx8(
5007
5227
  "button",
5008
5228
  {
5009
5229
  ref: selectionEdgeTargetRef,
@@ -5021,10 +5241,10 @@ function TableInner({
5021
5241
  scrollerRef.current?.focus({ preventScroll: true });
5022
5242
  revealCell(selection);
5023
5243
  },
5024
- children: /* @__PURE__ */ jsx7("span", { className: "rvg-selection-edge-halo", "aria-hidden": "true", children: /* @__PURE__ */ jsx7("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx7("path", { d: "M 0 100 L 0 0 L 100 0" }) }) })
5244
+ children: /* @__PURE__ */ jsx8("span", { className: "rvg-selection-edge-halo", "aria-hidden": "true", children: /* @__PURE__ */ jsx8("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", children: /* @__PURE__ */ jsx8("path", { d: "M 0 100 L 0 0 L 100 0" }) }) })
5025
5245
  }
5026
5246
  ),
5027
- contextMenu && /* @__PURE__ */ jsx7("div", { ref: contextMenuRef, className: "rvg-context-menu", role: "menu", style: { left: contextMenu.left, top: contextMenu.top }, children: contextMenu.type === "header" ? (() => {
5247
+ contextMenu && /* @__PURE__ */ jsx8("div", { ref: contextMenuRef, className: "rvg-context-menu", role: "menu", style: { left: contextMenu.left, top: contextMenu.top }, children: contextMenu.type === "header" ? (() => {
5028
5248
  const column = columns[contextMenu.columnIndex];
5029
5249
  const headerContext = { column, columnIndex: contextMenu.columnIndex };
5030
5250
  return renderConfiguredContextMenu(resolveContextMenuSection(customContextMenuConfig?.header, DEFAULT_HEADER_CONTEXT_MENU), headerContext, (item, override) => {
@@ -5035,12 +5255,12 @@ function TableInner({
5035
5255
  } catch {
5036
5256
  showToast("error", labels.copyError);
5037
5257
  }
5038
- }, override, { icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "copy" }) });
5258
+ }, override, { icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "copy" }) });
5039
5259
  if (item === "select-column") {
5040
5260
  if (!columnSelection) return null;
5041
5261
  return renderContextMenuButton("header-select-column", headerContext, selectedColumnKeySet.has(column.key) ? labels.deselectColumn : labels.selectColumn, () => {
5042
5262
  toggleColumnFromMenu(contextMenu.columnIndex);
5043
- }, override, { icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "select-column" }) });
5263
+ }, override, { icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "select-column" }) });
5044
5264
  }
5045
5265
  return null;
5046
5266
  });
@@ -5061,7 +5281,7 @@ function TableInner({
5061
5281
  } catch {
5062
5282
  showToast("error", labels.copyError);
5063
5283
  }
5064
- }, override, { icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "copy" }) });
5284
+ }, override, { icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "copy" }) });
5065
5285
  if (item === "annotation") return renderAnnotationControls(rangeCells);
5066
5286
  if (item === "undo") {
5067
5287
  const changedCells = rangeCells.flatMap((cell) => {
@@ -5088,7 +5308,7 @@ function TableInner({
5088
5308
  });
5089
5309
  onCellChange?.({ ...cell, row, previousValue, value });
5090
5310
  });
5091
- }, override, { disabled: !onCellChange, icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "undo" }) });
5311
+ }, override, { disabled: !onCellChange, icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "undo" }) });
5092
5312
  }
5093
5313
  if (item === "clear") {
5094
5314
  const hasClearableCell = rangeCells.some((cell) => {
@@ -5105,7 +5325,7 @@ function TableInner({
5105
5325
  markCellEdited(cell, row[column.dataIndex], "");
5106
5326
  onCellChange?.({ ...cell, row, previousValue: row[column.dataIndex], value: "" });
5107
5327
  });
5108
- }, override, { disabled: !onCellChange, icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "clear" }) });
5328
+ }, override, { disabled: !onCellChange, icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "clear" }) });
5109
5329
  }
5110
5330
  return null;
5111
5331
  });
@@ -5123,7 +5343,7 @@ function TableInner({
5123
5343
  const affectedRows = selectedIndices.includes(cell.rowIndex) ? selectedIndices : [cell.rowIndex];
5124
5344
  const cellContext = { ...cell, row, column, value: dataIndex === void 0 ? void 0 : row[dataIndex] };
5125
5345
  return renderConfiguredContextMenu(resolveContextMenuSection(customContextMenuConfig?.cell, DEFAULT_CELL_CONTEXT_MENU), cellContext, (item, override) => {
5126
- if (item === "edit") return renderContextMenuButton("cell-edit", cellContext, labels.edit, () => beginEdit(cell), override, { disabled: !isCellEditable(cell), icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "edit" }) });
5346
+ if (item === "edit") return renderContextMenuButton("cell-edit", cellContext, labels.edit, () => beginEdit(cell), override, { disabled: !isCellEditable(cell), icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "edit" }) });
5127
5347
  if (item === "copy") return renderContextMenuButton("cell-copy", cellContext, labels.copyContent, async () => {
5128
5348
  try {
5129
5349
  await navigator.clipboard.writeText(getCellLabel(cell.rowIndex, cell.columnIndex));
@@ -5131,20 +5351,20 @@ function TableInner({
5131
5351
  } catch {
5132
5352
  showToast("error", labels.copyError);
5133
5353
  }
5134
- }, override, { icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "copy" }) });
5354
+ }, override, { icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "copy" }) });
5135
5355
  if (item === "undo") return renderContextMenuButton("cell-undo", cellContext, labels.undoChange, () => {
5136
5356
  if (dataIndex === void 0 || originalValue === void 0) return;
5137
5357
  const previousValue = row[dataIndex];
5138
5358
  const value = typeof previousValue === "number" && originalValue !== "" ? Number(originalValue) : originalValue;
5139
5359
  setConfirmAction({ type: "undo", cell, row, dataIndex, previousValue, value });
5140
- }, override, { disabled: !onCellChange || dataIndex === void 0 || originalValue === void 0, icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "undo" }) });
5360
+ }, override, { disabled: !onCellChange || dataIndex === void 0 || originalValue === void 0, icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "undo" }) });
5141
5361
  if (item === "clear") {
5142
5362
  if (dataIndex === void 0 || isEmptyCellValue(row[dataIndex])) return null;
5143
5363
  return renderContextMenuButton("cell-clear", cellContext, labels.clearContent, () => {
5144
5364
  if (dataIndex === void 0) return;
5145
5365
  const previousValue = row[dataIndex];
5146
5366
  setConfirmAction({ type: "clear", cell, row, dataIndex, previousValue });
5147
- }, override, { disabled: !onCellChange || dataIndex === void 0, danger: true, icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "clear" }) });
5367
+ }, override, { disabled: !onCellChange || dataIndex === void 0, danger: true, icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "clear" }) });
5148
5368
  }
5149
5369
  if (item === "annotation") return renderAnnotationControls([cell]);
5150
5370
  if (item === "select-row") {
@@ -5154,54 +5374,54 @@ function TableInner({
5154
5374
  setSelection(null);
5155
5375
  if (selectedRowKeySet.has(cell.rowKey)) setRowKeys(rowKeys.filter((key) => key !== cell.rowKey));
5156
5376
  else setRowKeys(rowSelectionMode === "single" ? [cell.rowKey] : [...rowKeys, cell.rowKey]);
5157
- }, override, { icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "select-row" }) });
5377
+ }, override, { icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "select-row" }) });
5158
5378
  }
5159
5379
  if (item === "select-column") {
5160
5380
  if (!columnSelection) return null;
5161
5381
  return renderContextMenuButton("cell-select-column", cellContext, selectedColumnKeySet.has(cell.columnKey) ? labels.deselectColumn : labels.selectColumn, () => {
5162
5382
  toggleColumnFromMenu(cell.columnIndex);
5163
- }, override, { icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "select-column" }) });
5383
+ }, override, { icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "select-column" }) });
5164
5384
  }
5165
- if (item === "insert-above") return /* @__PURE__ */ jsxs7("div", { className: "rvg-context-insert", children: [
5166
- /* @__PURE__ */ jsxs7("button", { type: "button", role: "menuitem", disabled: !onInsertRows, onClick: () => {
5385
+ if (item === "insert-above") return /* @__PURE__ */ jsxs8("div", { className: "rvg-context-insert", children: [
5386
+ /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", disabled: !onInsertRows, onClick: () => {
5167
5387
  void insertRowsOptimistically(cell, "before", insertCounts.before);
5168
5388
  }, children: [
5169
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "insert-above" }) }),
5170
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-label", children: labels.insertAbove })
5389
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "insert-above" }) }),
5390
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-label", children: labels.insertAbove })
5171
5391
  ] }),
5172
- /* @__PURE__ */ jsx7("input", { "aria-label": labels.insertAboveCount, type: "number", min: 1, max: 5, step: 1, value: insertCounts.before, onChange: (event) => setInsertCounts((current) => ({ ...current, before: Math.max(1, Math.min(5, Math.floor(Number(event.target.value) || 1))) })) }),
5173
- /* @__PURE__ */ jsx7("span", { children: labels.rowUnit })
5392
+ /* @__PURE__ */ jsx8("input", { "aria-label": labels.insertAboveCount, type: "number", min: 1, max: 5, step: 1, value: insertCounts.before, onChange: (event) => setInsertCounts((current) => ({ ...current, before: Math.max(1, Math.min(5, Math.floor(Number(event.target.value) || 1))) })) }),
5393
+ /* @__PURE__ */ jsx8("span", { children: labels.rowUnit })
5174
5394
  ] });
5175
- if (item === "insert-below") return /* @__PURE__ */ jsxs7("div", { className: "rvg-context-insert", children: [
5176
- /* @__PURE__ */ jsxs7("button", { type: "button", role: "menuitem", disabled: !onInsertRows, onClick: () => {
5395
+ if (item === "insert-below") return /* @__PURE__ */ jsxs8("div", { className: "rvg-context-insert", children: [
5396
+ /* @__PURE__ */ jsxs8("button", { type: "button", role: "menuitem", disabled: !onInsertRows, onClick: () => {
5177
5397
  void insertRowsOptimistically(cell, "after", insertCounts.after);
5178
5398
  }, children: [
5179
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "insert-below" }) }),
5180
- /* @__PURE__ */ jsx7("span", { className: "rvg-context-menu-label", children: labels.insertBelow })
5399
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-icon", children: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "insert-below" }) }),
5400
+ /* @__PURE__ */ jsx8("span", { className: "rvg-context-menu-label", children: labels.insertBelow })
5181
5401
  ] }),
5182
- /* @__PURE__ */ jsx7("input", { "aria-label": labels.insertBelowCount, type: "number", min: 1, max: 5, step: 1, value: insertCounts.after, onChange: (event) => setInsertCounts((current) => ({ ...current, after: Math.max(1, Math.min(5, Math.floor(Number(event.target.value) || 1))) })) }),
5183
- /* @__PURE__ */ jsx7("span", { children: labels.rowUnit })
5402
+ /* @__PURE__ */ jsx8("input", { "aria-label": labels.insertBelowCount, type: "number", min: 1, max: 5, step: 1, value: insertCounts.after, onChange: (event) => setInsertCounts((current) => ({ ...current, after: Math.max(1, Math.min(5, Math.floor(Number(event.target.value) || 1))) })) }),
5403
+ /* @__PURE__ */ jsx8("span", { children: labels.rowUnit })
5184
5404
  ] });
5185
5405
  if (item === "move-up") {
5186
5406
  if (!rowDraggable) return null;
5187
- return renderContextMenuButton("cell-move-up", cellContext, labels.moveUp, () => applyRowOrder(cell.rowIndex, cell.rowIndex - 1), override, { disabled: cell.rowIndex === 0, icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "move-up" }) });
5407
+ return renderContextMenuButton("cell-move-up", cellContext, labels.moveUp, () => applyRowOrder(cell.rowIndex, cell.rowIndex - 1), override, { disabled: cell.rowIndex === 0, icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "move-up" }) });
5188
5408
  }
5189
5409
  if (item === "move-down") {
5190
5410
  if (!rowDraggable) return null;
5191
- return renderContextMenuButton("cell-move-down", cellContext, labels.moveDown, () => applyRowOrder(cell.rowIndex, cell.rowIndex + 1), override, { disabled: cell.rowIndex === rows.length - 1, icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "move-down" }) });
5411
+ return renderContextMenuButton("cell-move-down", cellContext, labels.moveDown, () => applyRowOrder(cell.rowIndex, cell.rowIndex + 1), override, { disabled: cell.rowIndex === rows.length - 1, icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "move-down" }) });
5192
5412
  }
5193
- if (item === "delete-row") return renderContextMenuButton("cell-delete-row", cellContext, labels.deleteRow, () => setConfirmAction({ type: "delete-row", rows: affectedRows.map((rowIndex) => ({ rowIndex, row: rows[rowIndex] })) }), override, { disabled: !onDeleteRows, danger: true, icon: /* @__PURE__ */ jsx7(ContextMenuIcon, { type: "delete" }) });
5413
+ if (item === "delete-row") return renderContextMenuButton("cell-delete-row", cellContext, labels.deleteRow, () => setConfirmAction({ type: "delete-row", rows: affectedRows.map((rowIndex) => ({ rowIndex, row: rows[rowIndex] })) }), override, { disabled: !onDeleteRows, danger: true, icon: /* @__PURE__ */ jsx8(ContextMenuIcon, { type: "delete" }) });
5194
5414
  return null;
5195
5415
  });
5196
5416
  })() }),
5197
- confirmAction && /* @__PURE__ */ jsx7("div", { className: "rvg-confirm-backdrop", role: "presentation", onMouseDown: (event) => {
5417
+ confirmAction && /* @__PURE__ */ jsx8("div", { className: "rvg-confirm-backdrop", role: "presentation", onMouseDown: (event) => {
5198
5418
  if (!confirmLoading && event.target === event.currentTarget) setConfirmAction(null);
5199
- }, children: /* @__PURE__ */ jsxs7("div", { className: "rvg-confirm", role: "alertdialog", "aria-modal": "true", "aria-labelledby": "rvg-delete-title", children: [
5200
- /* @__PURE__ */ jsx7("strong", { id: "rvg-delete-title", children: confirmAction.type === "undo" ? labels.undoConfirmTitle : confirmAction.type === "clear" ? labels.clearConfirmTitle : labels.deleteConfirmTitle }),
5201
- /* @__PURE__ */ jsx7("p", { children: confirmAction.type === "undo" ? labels.undoConfirmDescription : confirmAction.type === "clear" ? labels.clearConfirmDescription : labels.deleteConfirmDescription(confirmAction.rows.length) }),
5202
- /* @__PURE__ */ jsxs7("div", { className: "rvg-confirm-actions", children: [
5203
- /* @__PURE__ */ jsx7("button", { type: "button", disabled: confirmLoading, onClick: () => setConfirmAction(null), children: labels.cancel }),
5204
- /* @__PURE__ */ jsxs7("button", { type: "button", className: "rvg-confirm-danger", disabled: confirmLoading, autoFocus: true, onClick: () => {
5419
+ }, children: /* @__PURE__ */ jsxs8("div", { className: "rvg-confirm", role: "alertdialog", "aria-modal": "true", "aria-labelledby": "rvg-delete-title", children: [
5420
+ /* @__PURE__ */ jsx8("strong", { id: "rvg-delete-title", children: confirmAction.type === "undo" ? labels.undoConfirmTitle : confirmAction.type === "clear" ? labels.clearConfirmTitle : labels.deleteConfirmTitle }),
5421
+ /* @__PURE__ */ jsx8("p", { children: confirmAction.type === "undo" ? labels.undoConfirmDescription : confirmAction.type === "clear" ? labels.clearConfirmDescription : labels.deleteConfirmDescription(confirmAction.rows.length) }),
5422
+ /* @__PURE__ */ jsxs8("div", { className: "rvg-confirm-actions", children: [
5423
+ /* @__PURE__ */ jsx8("button", { type: "button", disabled: confirmLoading, onClick: () => setConfirmAction(null), children: labels.cancel }),
5424
+ /* @__PURE__ */ jsxs8("button", { type: "button", className: "rvg-confirm-danger", disabled: confirmLoading, autoFocus: true, onClick: () => {
5205
5425
  if (confirmLoading) return;
5206
5426
  flushSync(() => setConfirmLoading(true));
5207
5427
  window.requestAnimationFrame(async () => {
@@ -5254,13 +5474,13 @@ function TableInner({
5254
5474
  }
5255
5475
  });
5256
5476
  }, children: [
5257
- confirmLoading && /* @__PURE__ */ jsx7(LoadingSpinnerIcon, {}),
5477
+ confirmLoading && /* @__PURE__ */ jsx8(LoadingSpinnerIcon, {}),
5258
5478
  confirmAction.type === "undo" ? labels.undoChange : confirmAction.type === "clear" ? labels.clear : labels.delete
5259
5479
  ] })
5260
5480
  ] })
5261
5481
  ] }) }),
5262
- toast && /* @__PURE__ */ jsx7("div", { className: `rvg-toast is-${toast.type}`, role: "status", children: toast.message }),
5263
- /* @__PURE__ */ jsx7(
5482
+ toast && /* @__PURE__ */ jsx8("div", { className: `rvg-toast is-${toast.type}`, role: "status", children: toast.message }),
5483
+ /* @__PURE__ */ jsx8(
5264
5484
  "div",
5265
5485
  {
5266
5486
  ref: verticalScrollbarRef,
@@ -5271,10 +5491,10 @@ function TableInner({
5271
5491
  onPointerMove: handleVerticalScrollbarPointerMove,
5272
5492
  onPointerUp: handleVerticalScrollbarPointerUp,
5273
5493
  onPointerCancel: handleVerticalScrollbarPointerUp,
5274
- children: /* @__PURE__ */ jsx7("div", { ref: verticalScrollbarThumbRef, className: "rvg-vertical-scrollbar-thumb" })
5494
+ children: /* @__PURE__ */ jsx8("div", { ref: verticalScrollbarThumbRef, className: "rvg-vertical-scrollbar-thumb" })
5275
5495
  }
5276
5496
  ),
5277
- /* @__PURE__ */ jsx7(
5497
+ /* @__PURE__ */ jsx8(
5278
5498
  "div",
5279
5499
  {
5280
5500
  ref: horizontalScrollbarRef,
@@ -5285,11 +5505,11 @@ function TableInner({
5285
5505
  onPointerMove: handleHorizontalScrollbarPointerMove,
5286
5506
  onPointerUp: handleHorizontalScrollbarPointerUp,
5287
5507
  onPointerCancel: handleHorizontalScrollbarPointerUp,
5288
- children: /* @__PURE__ */ jsx7("div", { ref: horizontalScrollbarThumbRef, className: "rvg-horizontal-scrollbar-thumb" })
5508
+ children: /* @__PURE__ */ jsx8("div", { ref: horizontalScrollbarThumbRef, className: "rvg-horizontal-scrollbar-thumb" })
5289
5509
  }
5290
5510
  ),
5291
- /* @__PURE__ */ jsx7("div", { ref: dragGuideRef, className: "rvg-column-guide" }),
5292
- columnDragPreview && /* @__PURE__ */ jsxs7(
5511
+ /* @__PURE__ */ jsx8("div", { ref: dragGuideRef, className: "rvg-column-guide" }),
5512
+ columnDragPreview && /* @__PURE__ */ jsxs8(
5293
5513
  "div",
5294
5514
  {
5295
5515
  "aria-hidden": "true",
@@ -5305,7 +5525,7 @@ function TableInner({
5305
5525
  backgroundSize: `${viewport.width}px ${renderHeight}px`
5306
5526
  },
5307
5527
  children: [
5308
- /* @__PURE__ */ jsxs7(
5528
+ /* @__PURE__ */ jsxs8(
5309
5529
  "div",
5310
5530
  {
5311
5531
  className: `rvg-column-drag-preview-header${selectedColumnKeySet.has(columns[columnDragPreview.sourceIndex]?.key) ? " is-axis-selected" : ""}`,
@@ -5318,7 +5538,7 @@ function TableInner({
5318
5538
  ),
5319
5539
  rows.slice(domRange.rowStart, domRange.rowEnd).map((_row, visibleRowOffset) => {
5320
5540
  const rowIndex = domRange.rowStart + visibleRowOffset;
5321
- return /* @__PURE__ */ jsx7(
5541
+ return /* @__PURE__ */ jsx8(
5322
5542
  "div",
5323
5543
  {
5324
5544
  className: `rvg-column-drag-preview-cell${selectedColumnKeySet.has(columns[columnDragPreview.sourceIndex]?.key) ? " is-axis-selected" : ""}${hasStripedRows && rowIndex % 2 === 1 ? " is-striped" : ""}`,
@@ -5331,16 +5551,16 @@ function TableInner({
5331
5551
  ]
5332
5552
  }
5333
5553
  ),
5334
- resizeGuideX !== null && /* @__PURE__ */ jsx7(
5554
+ resizeGuideX !== null && /* @__PURE__ */ jsx8(
5335
5555
  "div",
5336
5556
  {
5337
5557
  className: "rvg-column-guide is-resizing",
5338
5558
  style: { display: "block", top: resizeGuideTop, transform: `translateX(${Math.round(resizeGuideX)}px)` }
5339
5559
  }
5340
5560
  ),
5341
- /* @__PURE__ */ jsx7("div", { ref: rowDragGuideRef, className: "rvg-row-guide" }),
5342
- filterEditor && /* @__PURE__ */ jsxs7("div", { ref: filterRef, className: "rvg-filter", style: { left: filterEditor.left, top: filterEditor.top }, children: [
5343
- /* @__PURE__ */ jsx7(
5561
+ /* @__PURE__ */ jsx8("div", { ref: rowDragGuideRef, className: "rvg-row-guide" }),
5562
+ filterEditor && /* @__PURE__ */ jsxs8("div", { ref: filterRef, className: "rvg-filter", style: { left: filterEditor.left, top: filterEditor.top }, children: [
5563
+ /* @__PURE__ */ jsx8(
5344
5564
  "input",
5345
5565
  {
5346
5566
  autoFocus: true,
@@ -5364,15 +5584,15 @@ function TableInner({
5364
5584
  }
5365
5585
  }
5366
5586
  ),
5367
- /* @__PURE__ */ jsxs7("div", { className: "rvg-filter-actions", children: [
5368
- /* @__PURE__ */ jsx7("button", { type: "button", onClick: () => {
5587
+ /* @__PURE__ */ jsxs8("div", { className: "rvg-filter-actions", children: [
5588
+ /* @__PURE__ */ jsx8("button", { type: "button", onClick: () => {
5369
5589
  const key = columns[filterEditor.columnIndex].key;
5370
5590
  const next = { ...filterValues };
5371
5591
  delete next[key];
5372
5592
  setFilterValues(next);
5373
5593
  setFilterEditor(null);
5374
5594
  }, children: labels.reset }),
5375
- /* @__PURE__ */ jsx7("button", { type: "button", className: "rvg-filter-confirm", onClick: () => {
5595
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "rvg-filter-confirm", onClick: () => {
5376
5596
  const key = columns[filterEditor.columnIndex].key;
5377
5597
  const next = { ...filterValues };
5378
5598
  if (filterEditor.draft) next[key] = filterEditor.draft;
@@ -5383,28 +5603,28 @@ function TableInner({
5383
5603
  ] })
5384
5604
  ] }),
5385
5605
  renderEditor(),
5386
- rows.length === 0 && !loading && /* @__PURE__ */ jsx7("div", { className: "rvg-empty", style: { top: bodyTop }, children: emptyContent ?? /* @__PURE__ */ jsx7(DefaultEmptyState, { label: labels.empty }) }),
5387
- loading && hasCustomLoading && /* @__PURE__ */ jsx7("div", { className: "rvg-custom-loading", "aria-label": labels.refreshing, children: loadingContent }),
5388
- loading && !hasCustomLoading && !hasCompletedLoadRef.current && /* @__PURE__ */ jsxs7("div", { className: "rvg-initial-loading", style: { top: headerHeight }, "aria-label": labels.initialLoading, children: [
5389
- Array.from({ length: Math.ceil((renderHeight - headerHeight) / rowHeight) }, (_, rowIndex) => /* @__PURE__ */ jsx7("div", { className: "rvg-loading-row", style: { height: rowHeight }, children: columns.map((column, columnIndex) => {
5606
+ rows.length === 0 && !loading && /* @__PURE__ */ jsx8("div", { className: "rvg-empty", style: { top: bodyTop }, children: emptyContent ?? /* @__PURE__ */ jsx8(DefaultEmptyState, { label: labels.empty }) }),
5607
+ loading && hasCustomLoading && /* @__PURE__ */ jsx8("div", { className: "rvg-custom-loading", "aria-label": labels.refreshing, children: loadingContent }),
5608
+ loading && !hasCustomLoading && !hasCompletedLoadRef.current && /* @__PURE__ */ jsxs8("div", { className: "rvg-initial-loading", style: { top: headerHeight }, "aria-label": labels.initialLoading, children: [
5609
+ Array.from({ length: Math.ceil((renderHeight - headerHeight) / rowHeight) }, (_, rowIndex) => /* @__PURE__ */ jsx8("div", { className: "rvg-loading-row", style: { height: rowHeight }, children: columns.map((column, columnIndex) => {
5390
5610
  const left = getDisplayedColumnLeft(columnIndex);
5391
5611
  const columnWidth = metrics[columnIndex].width;
5392
5612
  if (left + columnWidth <= 0 || left >= viewport.width) return null;
5393
5613
  const isUtility = column.rowSelection || column.rowDragHandle || column.rowNumber;
5394
- return /* @__PURE__ */ jsx7(
5614
+ return /* @__PURE__ */ jsx8(
5395
5615
  "span",
5396
5616
  {
5397
5617
  className: column.rowDragHandle ? "is-utility is-drag" : column.rowSelection ? "is-utility is-selection" : void 0,
5398
5618
  style: { left, width: columnWidth, zIndex: column.fixed ? 1 : 0, background: column.fixed ? "#fff" : void 0, justifyContent: column.align === "right" ? "flex-end" : column.align === "center" || isUtility ? "center" : "flex-start" },
5399
- children: /* @__PURE__ */ jsx7("i", { style: { width: isUtility ? 14 : `${38 + (rowIndex * 17 + columnIndex * 13) % 43}%`, animationDelay: `${(rowIndex * columns.length + columnIndex) * 24}ms` } })
5619
+ children: /* @__PURE__ */ jsx8("i", { style: { width: isUtility ? 14 : `${38 + (rowIndex * 17 + columnIndex * 13) % 43}%`, animationDelay: `${(rowIndex * columns.length + columnIndex) * 24}ms` } })
5400
5620
  },
5401
5621
  column.key
5402
5622
  );
5403
5623
  }) }, rowIndex)),
5404
- fixedWidth > 0 && currentScroll.left > 0 && /* @__PURE__ */ jsx7("div", { className: "rvg-loading-fixed-shadow is-left", style: { left: fixedWidth } }),
5405
- rightFixedWidth > 0 && currentScroll.left < contentWidth - viewport.width && /* @__PURE__ */ jsx7("div", { className: "rvg-loading-fixed-shadow is-right", style: { right: rightFixedWidth } })
5624
+ fixedWidth > 0 && currentScroll.left > 0 && /* @__PURE__ */ jsx8("div", { className: "rvg-loading-fixed-shadow is-left", style: { left: fixedWidth } }),
5625
+ rightFixedWidth > 0 && currentScroll.left < contentWidth - viewport.width && /* @__PURE__ */ jsx8("div", { className: "rvg-loading-fixed-shadow is-right", style: { right: rightFixedWidth } })
5406
5626
  ] }),
5407
- loading && !hasCustomLoading && hasCompletedLoadRef.current && /* @__PURE__ */ jsx7("div", { className: "rvg-refresh-loading", "aria-label": labels.refreshing, children: /* @__PURE__ */ jsx7(LoadingSpinnerIcon, {}) })
5627
+ loading && !hasCustomLoading && hasCompletedLoadRef.current && /* @__PURE__ */ jsx8("div", { className: "rvg-refresh-loading", "aria-label": labels.refreshing, children: /* @__PURE__ */ jsx8(LoadingSpinnerIcon, {}) })
5408
5628
  ] });
5409
5629
  }
5410
5630
  var Table = forwardRef(TableInner);