@extend-ai/react-xlsx 0.9.2 → 0.10.1

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.cjs CHANGED
@@ -17376,6 +17376,15 @@ function rangesEqual(left, right) {
17376
17376
  function isPrintableKey(event) {
17377
17377
  return event.key.length === 1 && !event.altKey && !event.ctrlKey && !event.metaKey;
17378
17378
  }
17379
+ function isInteractiveFocusTarget(target, container) {
17380
+ if (!(target instanceof Element)) {
17381
+ return false;
17382
+ }
17383
+ const interactiveElement = target.closest(
17384
+ "a[href], button, input, select, textarea, [contenteditable=''], [contenteditable='true'], [role='button'], [role='menu'], [role='menuitem'], [role='textbox'], [tabindex]:not([tabindex='-1'])"
17385
+ );
17386
+ return Boolean(interactiveElement && interactiveElement !== container && container.contains(interactiveElement));
17387
+ }
17379
17388
  function buildPrefixSums(values) {
17380
17389
  const prefix = new Array(values.length + 1).fill(0);
17381
17390
  for (let index = 0; index < values.length; index += 1) {
@@ -21053,6 +21062,21 @@ function resolveFirstUsedVisibleIndex(visibleIndices, minUsedIndex) {
21053
21062
  const firstVisibleUsed = visibleIndices.find((index) => index >= minUsedIndex);
21054
21063
  return firstVisibleUsed ?? visibleIndices[0] ?? -1;
21055
21064
  }
21065
+ function resolveLastUsedVisibleIndex(visibleIndices, maxUsedIndex) {
21066
+ if (visibleIndices.length === 0) {
21067
+ return -1;
21068
+ }
21069
+ if (maxUsedIndex < 0) {
21070
+ return visibleIndices[visibleIndices.length - 1] ?? -1;
21071
+ }
21072
+ for (let index = visibleIndices.length - 1; index >= 0; index -= 1) {
21073
+ const visibleIndex = visibleIndices[index];
21074
+ if (visibleIndex !== void 0 && visibleIndex <= maxUsedIndex) {
21075
+ return visibleIndex;
21076
+ }
21077
+ }
21078
+ return visibleIndices[visibleIndices.length - 1] ?? -1;
21079
+ }
21056
21080
  function GridRow({
21057
21081
  actualRow,
21058
21082
  editingCell,
@@ -21465,6 +21489,7 @@ function XlsxGrid({
21465
21489
  renderImage,
21466
21490
  renderImageSelection,
21467
21491
  renderTableHeaderMenu,
21492
+ renderScroller,
21468
21493
  enableGestureZoom = true,
21469
21494
  experimentalCanvas = true,
21470
21495
  selectionColor,
@@ -23179,8 +23204,8 @@ function XlsxGrid({
23179
23204
  selectionPreviewRangeRef.current = null;
23180
23205
  setInteractionMode("idle");
23181
23206
  }, [activeSheetIndex, clearGlobalCursor, revision]);
23182
- const focusGrid = React4.useCallback(() => {
23183
- scrollRef.current?.focus();
23207
+ const focusGrid = React4.useCallback((options) => {
23208
+ scrollRef.current?.focus(options);
23184
23209
  }, []);
23185
23210
  const openHyperlink = React4.useCallback((target, location) => {
23186
23211
  const internalTarget = parseInternalSheetLink(location ?? target);
@@ -27606,708 +27631,842 @@ function XlsxGrid({
27606
27631
  }
27607
27632
  return { row: firstVisibleRow, col: firstVisibleCol };
27608
27633
  }
27634
+ function ensureCellVisible(rowIndex, colIndex) {
27635
+ const scroller = scrollRef.current;
27636
+ if (!scroller) {
27637
+ return;
27638
+ }
27639
+ let nextScrollTop = scroller.scrollTop;
27640
+ let nextScrollLeft = scroller.scrollLeft;
27641
+ const rowStart = displayHeaderHeight + (rowPrefixSums[rowIndex] ?? 0);
27642
+ const rowEnd = displayHeaderHeight + (rowPrefixSums[rowIndex + 1] ?? rowStart);
27643
+ const colStart = displayRowHeaderWidth + (colPrefixSums[colIndex] ?? 0);
27644
+ const colEnd = displayRowHeaderWidth + (colPrefixSums[colIndex + 1] ?? colStart);
27645
+ if (rowEnd > frozenPaneBottom) {
27646
+ const visibleTop = scroller.scrollTop + frozenPaneBottom;
27647
+ const visibleBottom = scroller.scrollTop + scroller.clientHeight;
27648
+ if (rowStart < visibleTop) {
27649
+ nextScrollTop = rowStart - frozenPaneBottom;
27650
+ } else if (rowEnd > visibleBottom) {
27651
+ nextScrollTop = rowEnd - scroller.clientHeight;
27652
+ }
27653
+ }
27654
+ if (colEnd > frozenPaneRight) {
27655
+ const visibleLeft = scroller.scrollLeft + frozenPaneRight;
27656
+ const visibleRight = scroller.scrollLeft + scroller.clientWidth;
27657
+ if (colStart < visibleLeft) {
27658
+ nextScrollLeft = colStart - frozenPaneRight;
27659
+ } else if (colEnd > visibleRight) {
27660
+ nextScrollLeft = colEnd - scroller.clientWidth;
27661
+ }
27662
+ }
27663
+ nextScrollTop = Math.max(0, Math.min(nextScrollTop, scroller.scrollHeight - scroller.clientHeight));
27664
+ nextScrollLeft = Math.max(0, Math.min(nextScrollLeft, scroller.scrollWidth - scroller.clientWidth));
27665
+ if (nextScrollTop !== scroller.scrollTop) {
27666
+ scroller.scrollTop = nextScrollTop;
27667
+ }
27668
+ if (nextScrollLeft !== scroller.scrollLeft) {
27669
+ scroller.scrollLeft = nextScrollLeft;
27670
+ }
27671
+ syncDrawingViewport(scroller, { immediate: true });
27672
+ }
27609
27673
  function moveSelection(nextRowIndex, nextColIndex, extend) {
27610
- const nextRow = visibleRows[nextRowIndex];
27611
- const nextCol = visibleCols[nextColIndex];
27674
+ const clampedRowIndex = Math.max(0, Math.min(nextRowIndex, visibleRows.length - 1));
27675
+ const clampedColIndex = Math.max(0, Math.min(nextColIndex, visibleCols.length - 1));
27676
+ const nextRow = visibleRows[clampedRowIndex];
27677
+ const nextCol = visibleCols[clampedColIndex];
27612
27678
  if (nextRow === void 0 || nextCol === void 0) {
27613
27679
  return;
27614
27680
  }
27615
27681
  selectCell({ row: nextRow, col: nextCol }, extend ? { extend: true } : void 0);
27682
+ ensureCellVisible(clampedRowIndex, clampedColIndex);
27616
27683
  }
27617
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { backgroundColor: palette.canvas, display: "flex", flex: 1, minHeight: 0, minWidth: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27618
- "div",
27619
- {
27620
- ref: scrollRef,
27621
- onScroll: handleScrollerScroll,
27622
- onCopy: (event) => {
27623
- if (editingCell) {
27624
- return;
27625
- }
27626
- const clipboard = event.clipboardData;
27627
- const clipboardData = getClipboardData();
27628
- if (!clipboardData) {
27629
- return;
27630
- }
27631
- event.preventDefault();
27632
- if (clipboard) {
27633
- clipboard.setData("text/plain", clipboardData.text);
27634
- clipboard.setData("text/html", clipboardData.html);
27635
- clipboard.setData(INTERNAL_CLIPBOARD_MIME2, clipboardData.structured);
27636
- return;
27637
- }
27638
- void copySelectionToClipboard();
27639
- },
27640
- onKeyDown: (event) => {
27641
- if (editingCell) {
27684
+ function resolvePageRowIndex(currentRowIndex, direction) {
27685
+ const scroller = scrollRef.current;
27686
+ const viewportHeight = Math.max(
27687
+ displayDefaultRowHeight,
27688
+ (scroller?.clientHeight ?? displayDefaultRowHeight * 20) - frozenPaneBottom
27689
+ );
27690
+ const currentOffset = rowPrefixSums[currentRowIndex] ?? 0;
27691
+ const targetOffset = direction > 0 ? currentOffset + viewportHeight : currentOffset - viewportHeight;
27692
+ return Math.max(0, Math.min(findIndexForOffsetPrefix(rowPrefixSums, targetOffset), visibleRows.length - 1));
27693
+ }
27694
+ function resolvePageColIndex(currentColIndex, direction) {
27695
+ const scroller = scrollRef.current;
27696
+ const viewportWidth = Math.max(
27697
+ displayDefaultColWidth,
27698
+ (scroller?.clientWidth ?? displayDefaultColWidth * 8) - frozenPaneRight
27699
+ );
27700
+ const currentOffset = colPrefixSums[currentColIndex] ?? 0;
27701
+ const targetOffset = direction > 0 ? currentOffset + viewportWidth : currentOffset - viewportWidth;
27702
+ return Math.max(0, Math.min(findIndexForOffsetPrefix(colPrefixSums, targetOffset), visibleCols.length - 1));
27703
+ }
27704
+ const scrollerViewportProps = {
27705
+ key: activeTabIndex,
27706
+ ref: scrollRef,
27707
+ "aria-colcount": Math.max(activeSheet?.colCount ?? 0, displayColLimit),
27708
+ "aria-keyshortcuts": "ArrowUp ArrowDown ArrowLeft ArrowRight Home End PageUp PageDown Control+Home Control+End",
27709
+ "aria-label": activeSheet ? `${activeSheet.name} worksheet grid` : "Workbook grid",
27710
+ "aria-readonly": readOnly,
27711
+ "aria-rowcount": Math.max(activeSheet?.rowCount ?? 0, displayRowLimit),
27712
+ role: "grid",
27713
+ onScroll: handleScrollerScroll,
27714
+ onCopy: (event) => {
27715
+ if (editingCell) {
27716
+ return;
27717
+ }
27718
+ const clipboard = event.clipboardData;
27719
+ const clipboardData = getClipboardData();
27720
+ if (!clipboardData) {
27721
+ return;
27722
+ }
27723
+ event.preventDefault();
27724
+ if (clipboard) {
27725
+ clipboard.setData("text/plain", clipboardData.text);
27726
+ clipboard.setData("text/html", clipboardData.html);
27727
+ clipboard.setData(INTERNAL_CLIPBOARD_MIME2, clipboardData.structured);
27728
+ return;
27729
+ }
27730
+ void copySelectionToClipboard();
27731
+ },
27732
+ onPointerDownCapture: (event) => {
27733
+ if (event.button !== 0) {
27734
+ return;
27735
+ }
27736
+ if (isInteractiveFocusTarget(event.target, event.currentTarget)) {
27737
+ return;
27738
+ }
27739
+ if (document.activeElement !== event.currentTarget) {
27740
+ event.currentTarget.focus({ preventScroll: true });
27741
+ }
27742
+ },
27743
+ onKeyDown: (event) => {
27744
+ if (editingCell) {
27745
+ return;
27746
+ }
27747
+ if (!readOnly && (event.metaKey || event.ctrlKey) && !event.altKey) {
27748
+ const normalizedKey = event.key.toLowerCase();
27749
+ if (normalizedKey === "z" && event.shiftKey) {
27750
+ event.preventDefault();
27751
+ redo();
27642
27752
  return;
27643
27753
  }
27644
- if (!readOnly && (event.metaKey || event.ctrlKey) && !event.altKey) {
27645
- const normalizedKey = event.key.toLowerCase();
27646
- if (normalizedKey === "z" && event.shiftKey) {
27647
- event.preventDefault();
27648
- redo();
27649
- return;
27650
- }
27651
- if (normalizedKey === "z") {
27652
- event.preventDefault();
27653
- undo();
27654
- return;
27655
- }
27656
- if (normalizedKey === "y") {
27657
- event.preventDefault();
27658
- redo();
27659
- return;
27660
- }
27661
- }
27662
- const currentCell = resolveCurrentCell();
27663
- if (!currentCell) {
27754
+ if (normalizedKey === "z") {
27755
+ event.preventDefault();
27756
+ undo();
27664
27757
  return;
27665
27758
  }
27666
- const currentRowIndex = rowIndexByActual.get(currentCell.row) ?? 0;
27667
- const currentColIndex = colIndexByActual.get(currentCell.col) ?? 0;
27668
- if (!readOnly && isPrintableKey(event)) {
27759
+ if (normalizedKey === "y") {
27669
27760
  event.preventDefault();
27670
- startEditing(currentCell, event.key);
27761
+ redo();
27671
27762
  return;
27672
27763
  }
27673
- switch (event.key) {
27674
- case "ArrowDown":
27675
- event.preventDefault();
27676
- moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, event.shiftKey);
27677
- break;
27678
- case "ArrowUp":
27679
- event.preventDefault();
27680
- moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, event.shiftKey);
27681
- break;
27682
- case "ArrowLeft":
27683
- event.preventDefault();
27684
- moveSelection(currentRowIndex, Math.max(currentColIndex - 1, 0), event.shiftKey);
27764
+ }
27765
+ const currentCell = resolveCurrentCell();
27766
+ if (!currentCell) {
27767
+ return;
27768
+ }
27769
+ const currentRowIndex = rowIndexByActual.get(currentCell.row) ?? 0;
27770
+ const currentColIndex = colIndexByActual.get(currentCell.col) ?? 0;
27771
+ const isCommandNavigation = event.ctrlKey || event.metaKey;
27772
+ if (!readOnly && isPrintableKey(event)) {
27773
+ event.preventDefault();
27774
+ startEditing(currentCell, event.key);
27775
+ return;
27776
+ }
27777
+ switch (event.key) {
27778
+ case "ArrowDown":
27779
+ event.preventDefault();
27780
+ moveSelection(
27781
+ isCommandNavigation ? rowIndexByActual.get(resolveLastUsedVisibleIndex(visibleRows, activeSheet?.maxUsedRow ?? -1)) ?? visibleRows.length - 1 : currentRowIndex + 1,
27782
+ currentColIndex,
27783
+ event.shiftKey
27784
+ );
27785
+ break;
27786
+ case "ArrowUp":
27787
+ event.preventDefault();
27788
+ moveSelection(
27789
+ isCommandNavigation ? rowIndexByActual.get(resolveFirstUsedVisibleIndex(visibleRows, activeSheet?.minUsedRow ?? -1)) ?? 0 : currentRowIndex - 1,
27790
+ currentColIndex,
27791
+ event.shiftKey
27792
+ );
27793
+ break;
27794
+ case "ArrowLeft":
27795
+ event.preventDefault();
27796
+ moveSelection(
27797
+ currentRowIndex,
27798
+ isCommandNavigation ? colIndexByActual.get(resolveFirstUsedVisibleIndex(visibleCols, activeSheet?.minUsedCol ?? -1)) ?? 0 : currentColIndex - 1,
27799
+ event.shiftKey
27800
+ );
27801
+ break;
27802
+ case "ArrowRight":
27803
+ event.preventDefault();
27804
+ moveSelection(
27805
+ currentRowIndex,
27806
+ isCommandNavigation ? colIndexByActual.get(resolveLastUsedVisibleIndex(visibleCols, activeSheet?.maxUsedCol ?? -1)) ?? visibleCols.length - 1 : currentColIndex + 1,
27807
+ event.shiftKey
27808
+ );
27809
+ break;
27810
+ case "Home":
27811
+ event.preventDefault();
27812
+ moveSelection(
27813
+ isCommandNavigation ? rowIndexByActual.get(resolveFirstUsedVisibleIndex(visibleRows, activeSheet?.minUsedRow ?? -1)) ?? 0 : currentRowIndex,
27814
+ colIndexByActual.get(resolveFirstUsedVisibleIndex(visibleCols, activeSheet?.minUsedCol ?? -1)) ?? 0,
27815
+ event.shiftKey
27816
+ );
27817
+ break;
27818
+ case "End":
27819
+ event.preventDefault();
27820
+ moveSelection(
27821
+ isCommandNavigation ? rowIndexByActual.get(resolveLastUsedVisibleIndex(visibleRows, activeSheet?.maxUsedRow ?? -1)) ?? visibleRows.length - 1 : currentRowIndex,
27822
+ colIndexByActual.get(resolveLastUsedVisibleIndex(visibleCols, activeSheet?.maxUsedCol ?? -1)) ?? visibleCols.length - 1,
27823
+ event.shiftKey
27824
+ );
27825
+ break;
27826
+ case "PageDown":
27827
+ event.preventDefault();
27828
+ if (event.altKey) {
27829
+ moveSelection(currentRowIndex, resolvePageColIndex(currentColIndex, 1), event.shiftKey);
27685
27830
  break;
27686
- case "ArrowRight":
27687
- event.preventDefault();
27688
- moveSelection(currentRowIndex, Math.min(currentColIndex + 1, visibleCols.length - 1), event.shiftKey);
27831
+ }
27832
+ moveSelection(resolvePageRowIndex(currentRowIndex, 1), currentColIndex, event.shiftKey);
27833
+ break;
27834
+ case "PageUp":
27835
+ event.preventDefault();
27836
+ if (event.altKey) {
27837
+ moveSelection(currentRowIndex, resolvePageColIndex(currentColIndex, -1), event.shiftKey);
27689
27838
  break;
27690
- case "Tab":
27691
- event.preventDefault();
27839
+ }
27840
+ moveSelection(resolvePageRowIndex(currentRowIndex, -1), currentColIndex, event.shiftKey);
27841
+ break;
27842
+ case "Tab":
27843
+ event.preventDefault();
27844
+ if (event.shiftKey) {
27692
27845
  moveSelection(
27693
- currentRowIndex,
27694
- event.shiftKey ? Math.max(currentColIndex - 1, 0) : Math.min(currentColIndex + 1, visibleCols.length - 1),
27846
+ currentColIndex > 0 ? currentRowIndex : currentRowIndex - 1,
27847
+ currentColIndex > 0 ? currentColIndex - 1 : visibleCols.length - 1,
27695
27848
  false
27696
27849
  );
27850
+ } else {
27851
+ moveSelection(
27852
+ currentColIndex < visibleCols.length - 1 ? currentRowIndex : currentRowIndex + 1,
27853
+ currentColIndex < visibleCols.length - 1 ? currentColIndex + 1 : 0,
27854
+ false
27855
+ );
27856
+ }
27857
+ break;
27858
+ case "Enter":
27859
+ event.preventDefault();
27860
+ if (event.metaKey || event.ctrlKey || event.altKey) {
27697
27861
  break;
27698
- case "Enter":
27699
- event.preventDefault();
27700
- if (event.metaKey || event.ctrlKey || event.altKey) {
27701
- break;
27702
- }
27703
- if (event.shiftKey) {
27704
- moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, false);
27705
- break;
27706
- }
27707
- moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, false);
27708
- break;
27709
- case "Backspace":
27710
- case "Delete":
27711
- if (!readOnly) {
27712
- event.preventDefault();
27713
- clearSelectedCells();
27714
- }
27715
- break;
27716
- case "F2":
27717
- if (!readOnly) {
27718
- event.preventDefault();
27719
- startEditing(currentCell);
27720
- }
27721
- break;
27722
- default:
27862
+ }
27863
+ if (event.shiftKey) {
27864
+ moveSelection(currentRowIndex - 1, currentColIndex, false);
27723
27865
  break;
27724
- }
27725
- },
27726
- onPaste: (event) => {
27727
- if (editingCell || readOnly) {
27728
- return;
27729
- }
27730
- const clipboard = event.clipboardData;
27731
- if (!clipboard) {
27732
- event.preventDefault();
27733
- void pasteFromClipboard();
27734
- return;
27735
- }
27736
- const structuredPayload = clipboard.getData(INTERNAL_CLIPBOARD_MIME2);
27737
- const textPayload = clipboard.getData("text/plain");
27738
- if (!structuredPayload && !textPayload) {
27739
- return;
27740
- }
27866
+ }
27867
+ moveSelection(currentRowIndex + 1, currentColIndex, false);
27868
+ break;
27869
+ case "Backspace":
27870
+ case "Delete":
27871
+ if (!readOnly) {
27872
+ event.preventDefault();
27873
+ clearSelectedCells();
27874
+ }
27875
+ break;
27876
+ case "F2":
27877
+ if (!readOnly) {
27878
+ event.preventDefault();
27879
+ startEditing(currentCell);
27880
+ }
27881
+ break;
27882
+ default:
27883
+ break;
27884
+ }
27885
+ },
27886
+ onPaste: (event) => {
27887
+ if (editingCell || readOnly) {
27888
+ return;
27889
+ }
27890
+ const clipboard = event.clipboardData;
27891
+ if (!clipboard) {
27741
27892
  event.preventDefault();
27742
- if (structuredPayload) {
27743
- pasteStructuredClipboardData(structuredPayload);
27744
- return;
27745
- }
27746
- pasteText(textPayload);
27747
- },
27748
- tabIndex: 0,
27893
+ void pasteFromClipboard();
27894
+ return;
27895
+ }
27896
+ const structuredPayload = clipboard.getData(INTERNAL_CLIPBOARD_MIME2);
27897
+ const textPayload = clipboard.getData("text/plain");
27898
+ if (!structuredPayload && !textPayload) {
27899
+ return;
27900
+ }
27901
+ event.preventDefault();
27902
+ if (structuredPayload) {
27903
+ pasteStructuredClipboardData(structuredPayload);
27904
+ return;
27905
+ }
27906
+ pasteText(textPayload);
27907
+ },
27908
+ tabIndex: 0,
27909
+ style: {
27910
+ ["--xlsx-menu-active"]: selectionFill,
27911
+ ["--xlsx-menu-border"]: palette.strongBorder,
27912
+ ["--xlsx-menu-surface"]: palette.surface,
27913
+ ["--xlsx-selection-header"]: selectionHeaderSurface,
27914
+ backgroundColor: palette.canvas,
27915
+ color: palette.text,
27916
+ cursor: resizeGuide?.type === "column" ? "col-resize" : resizeGuide?.type === "row" ? "row-resize" : void 0,
27917
+ flex: 1,
27918
+ height: "100%",
27919
+ minHeight: 0,
27920
+ minWidth: 0,
27921
+ outline: "none",
27922
+ overflow: "auto",
27923
+ width: "100%"
27924
+ }
27925
+ };
27926
+ const scrollerContent = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27927
+ "div",
27928
+ {
27749
27929
  style: {
27750
- ["--xlsx-menu-active"]: selectionFill,
27751
- ["--xlsx-menu-border"]: palette.strongBorder,
27752
- ["--xlsx-menu-surface"]: palette.surface,
27753
- ["--xlsx-selection-header"]: selectionHeaderSurface,
27754
- backgroundColor: palette.canvas,
27755
- color: palette.text,
27756
- cursor: resizeGuide?.type === "column" ? "col-resize" : resizeGuide?.type === "row" ? "row-resize" : void 0,
27757
- flex: 1,
27758
- height: "100%",
27759
- minHeight: 0,
27760
- minWidth: 0,
27761
- outline: "none",
27762
- overflow: "auto",
27763
- width: "100%"
27930
+ backgroundColor: resolveSheetSurface(activeSheet, palette),
27931
+ minHeight: "100%",
27932
+ minWidth: "100%",
27933
+ position: "relative",
27934
+ width: totalWidth,
27935
+ height: sheetContentHeight
27764
27936
  },
27765
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27937
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
27766
27938
  "div",
27767
27939
  {
27940
+ ref: wrapperRef,
27768
27941
  style: {
27769
- backgroundColor: resolveSheetSurface(activeSheet, palette),
27770
- minHeight: "100%",
27771
- minWidth: "100%",
27772
- position: "relative",
27773
- width: totalWidth,
27774
- height: sheetContentHeight
27942
+ height: sheetContentHeight,
27943
+ left: 0,
27944
+ position: "absolute",
27945
+ top: 0,
27946
+ transform: !experimentalCanvas && isLiveZooming ? `translate3d(${liveZoomTranslateX}px, ${liveZoomTranslateY}px, 0) scale(${liveZoomScale})` : void 0,
27947
+ transformOrigin: "0 0",
27948
+ transition: "none",
27949
+ willChange: !experimentalCanvas && isLiveZooming ? "transform" : void 0,
27950
+ width: totalWidth
27775
27951
  },
27776
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
27777
- "div",
27778
- {
27779
- ref: wrapperRef,
27780
- style: {
27781
- height: sheetContentHeight,
27782
- left: 0,
27783
- position: "absolute",
27784
- top: 0,
27785
- transform: !experimentalCanvas && isLiveZooming ? `translate3d(${liveZoomTranslateX}px, ${liveZoomTranslateY}px, 0) scale(${liveZoomScale})` : void 0,
27786
- transformOrigin: "0 0",
27787
- transition: "none",
27788
- willChange: !experimentalCanvas && isLiveZooming ? "transform" : void 0,
27789
- width: totalWidth
27790
- },
27791
- children: [
27792
- showImages && !experimentalCanvas ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27793
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: topOverlayStyle, children: paneDrawingNodes.top }),
27794
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: leftOverlayStyle, children: paneDrawingNodes.left }),
27795
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cornerOverlayStyle, children: paneDrawingNodes.corner }),
27796
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: scrollOverlayStyle, children: paneDrawingNodes.scroll })
27797
- ] }) : null,
27798
- experimentalCanvas ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27799
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: canvasBodyViewportLayerStyle, children: [
27800
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27801
- "canvas",
27802
- {
27803
- ref: scrollBodyCanvasRef,
27804
- onClick: handleCanvasBodyClick,
27805
- onDoubleClick: handleCanvasBodyDoubleClick,
27806
- onPointerDown: handleCanvasBodyPointerDown,
27807
- style: canvasScrollBodyStyle
27808
- }
27809
- ),
27810
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27811
- "canvas",
27812
- {
27813
- ref: topBodyCanvasRef,
27814
- onClick: handleCanvasBodyClick,
27815
- onDoubleClick: handleCanvasBodyDoubleClick,
27816
- onPointerDown: handleCanvasBodyPointerDown,
27817
- style: canvasTopBodyStyle
27818
- }
27819
- ),
27820
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27821
- "canvas",
27822
- {
27823
- ref: leftBodyCanvasRef,
27824
- onClick: handleCanvasBodyClick,
27825
- onDoubleClick: handleCanvasBodyDoubleClick,
27826
- onPointerDown: handleCanvasBodyPointerDown,
27827
- style: canvasLeftBodyStyle
27828
- }
27829
- ),
27830
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27831
- "canvas",
27832
- {
27833
- ref: cornerBodyCanvasRef,
27834
- onClick: handleCanvasBodyClick,
27835
- onDoubleClick: handleCanvasBodyDoubleClick,
27836
- onPointerDown: handleCanvasBodyPointerDown,
27837
- style: canvasCornerBodyStyle
27838
- }
27839
- ),
27840
- hasCanvasDomDrawingOverlays ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27841
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasScrollOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27842
- "div",
27843
- {
27844
- ref: canvasScrollOverlayContentRef,
27845
- style: {
27846
- height: sheetContentHeight,
27847
- left: 0,
27848
- pointerEvents: "none",
27849
- position: "absolute",
27850
- top: 0,
27851
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27852
- transformOrigin: "0 0",
27853
- width: totalWidth
27854
- },
27855
- children: paneDrawingNodes.scroll
27856
- }
27857
- ) }),
27858
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27859
- "div",
27860
- {
27861
- ref: canvasTopOverlayContentRef,
27862
- style: {
27863
- height: sheetContentHeight,
27864
- left: 0,
27865
- pointerEvents: "none",
27866
- position: "absolute",
27867
- top: 0,
27868
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
27869
- transformOrigin: "0 0",
27870
- width: totalWidth
27871
- },
27872
- children: paneDrawingNodes.top
27873
- }
27874
- ) }),
27875
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27876
- "div",
27877
- {
27878
- ref: canvasLeftOverlayContentRef,
27879
- style: {
27880
- height: sheetContentHeight,
27881
- left: 0,
27882
- pointerEvents: "none",
27883
- position: "absolute",
27884
- top: 0,
27885
- transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27886
- transformOrigin: "0 0",
27887
- width: totalWidth
27888
- },
27889
- children: paneDrawingNodes.left
27890
- }
27891
- ) }),
27892
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27893
- "div",
27894
- {
27895
- ref: canvasCornerOverlayContentRef,
27896
- style: {
27897
- height: sheetContentHeight,
27898
- left: 0,
27899
- pointerEvents: "none",
27900
- position: "absolute",
27901
- top: 0,
27902
- transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
27903
- transformOrigin: "0 0",
27904
- width: totalWidth
27905
- },
27906
- children: paneDrawingNodes.corner
27907
- }
27908
- ) })
27909
- ] }) : null
27910
- ] }),
27911
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: canvasHeaderViewportLayerStyle, children: [
27912
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27913
- "canvas",
27914
- {
27915
- ref: topFrozenHeaderCanvasRef,
27916
- onPointerLeave: handleCanvasHeaderPointerLeave,
27917
- onPointerMove: handleCanvasColumnHeaderPointerMove,
27918
- onPointerDown: handleCanvasColumnHeaderPointerDown,
27919
- style: canvasTopFrozenHeaderStyle
27920
- }
27921
- ),
27922
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27923
- "canvas",
27924
- {
27925
- ref: topScrollHeaderCanvasRef,
27926
- onPointerLeave: handleCanvasHeaderPointerLeave,
27927
- onPointerMove: handleCanvasColumnHeaderPointerMove,
27928
- onPointerDown: handleCanvasColumnHeaderPointerDown,
27929
- style: canvasTopScrollHeaderStyle
27930
- }
27931
- ),
27932
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27933
- "canvas",
27934
- {
27935
- ref: leftFrozenHeaderCanvasRef,
27936
- onPointerLeave: handleCanvasHeaderPointerLeave,
27937
- onPointerMove: handleCanvasRowHeaderPointerMove,
27938
- onPointerDown: handleCanvasRowHeaderPointerDown,
27939
- style: canvasLeftFrozenHeaderStyle
27940
- }
27941
- ),
27942
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27943
- "canvas",
27944
- {
27945
- ref: leftScrollHeaderCanvasRef,
27946
- onPointerLeave: handleCanvasHeaderPointerLeave,
27947
- onPointerMove: handleCanvasRowHeaderPointerMove,
27948
- onPointerDown: handleCanvasRowHeaderPointerDown,
27949
- style: canvasLeftScrollHeaderStyle
27950
- }
27951
- ),
27952
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
27953
- ] }),
27954
- editingCell && editingOverlayRect ? (() => {
27955
- const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
27956
- const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
27957
- const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
27958
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27959
- "div",
27960
- {
27961
- style: {
27962
- left: editingOverlayRect.left,
27963
- position: "absolute",
27964
- top: editingOverlayRect.top,
27965
- width: editingOverlayRect.width,
27966
- height: editingOverlayRect.height,
27967
- zIndex: 28
27968
- },
27969
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27970
- "input",
27971
- {
27972
- ref: editingInputRef,
27973
- autoFocus: true,
27974
- onBlur: commitEditing,
27975
- onChange: (event) => setEditingValue(event.target.value),
27976
- onKeyDown: (event) => {
27977
- event.stopPropagation();
27978
- if (event.key === "Enter") {
27979
- event.preventDefault();
27980
- commitEditing();
27981
- return;
27982
- }
27983
- if (event.key === "Escape") {
27984
- event.preventDefault();
27985
- cancelEditing();
27986
- }
27987
- },
27988
- style: {
27989
- backgroundColor: editingBackground,
27990
- border: 0,
27991
- boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
27992
- boxSizing: "border-box",
27993
- color: editingColor,
27994
- display: "block",
27995
- font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
27996
- height: "100%",
27997
- margin: 0,
27998
- minHeight: 0,
27999
- outline: "none",
28000
- overflow: "hidden",
28001
- padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
28002
- width: "100%"
28003
- },
28004
- value: editingValue
28005
- }
28006
- )
28007
- }
28008
- );
28009
- })() : null,
28010
- activeCellAdornment && activeCellAdornmentRect ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27952
+ children: [
27953
+ showImages && !experimentalCanvas ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27954
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: topOverlayStyle, children: paneDrawingNodes.top }),
27955
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: leftOverlayStyle, children: paneDrawingNodes.left }),
27956
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cornerOverlayStyle, children: paneDrawingNodes.corner }),
27957
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: scrollOverlayStyle, children: paneDrawingNodes.scroll })
27958
+ ] }) : null,
27959
+ experimentalCanvas ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27960
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: canvasBodyViewportLayerStyle, children: [
27961
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27962
+ "canvas",
27963
+ {
27964
+ ref: scrollBodyCanvasRef,
27965
+ onClick: handleCanvasBodyClick,
27966
+ onDoubleClick: handleCanvasBodyDoubleClick,
27967
+ onPointerDown: handleCanvasBodyPointerDown,
27968
+ style: canvasScrollBodyStyle
27969
+ }
27970
+ ),
27971
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27972
+ "canvas",
27973
+ {
27974
+ ref: topBodyCanvasRef,
27975
+ onClick: handleCanvasBodyClick,
27976
+ onDoubleClick: handleCanvasBodyDoubleClick,
27977
+ onPointerDown: handleCanvasBodyPointerDown,
27978
+ style: canvasTopBodyStyle
27979
+ }
27980
+ ),
27981
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27982
+ "canvas",
27983
+ {
27984
+ ref: leftBodyCanvasRef,
27985
+ onClick: handleCanvasBodyClick,
27986
+ onDoubleClick: handleCanvasBodyDoubleClick,
27987
+ onPointerDown: handleCanvasBodyPointerDown,
27988
+ style: canvasLeftBodyStyle
27989
+ }
27990
+ ),
27991
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27992
+ "canvas",
27993
+ {
27994
+ ref: cornerBodyCanvasRef,
27995
+ onClick: handleCanvasBodyClick,
27996
+ onDoubleClick: handleCanvasBodyDoubleClick,
27997
+ onPointerDown: handleCanvasBodyPointerDown,
27998
+ style: canvasCornerBodyStyle
27999
+ }
28000
+ ),
28001
+ hasCanvasDomDrawingOverlays ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
28002
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasScrollOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28003
+ "div",
28004
+ {
28005
+ ref: canvasScrollOverlayContentRef,
28006
+ style: {
28007
+ height: sheetContentHeight,
28008
+ left: 0,
28009
+ pointerEvents: "none",
28010
+ position: "absolute",
28011
+ top: 0,
28012
+ transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
28013
+ transformOrigin: "0 0",
28014
+ width: totalWidth
28015
+ },
28016
+ children: paneDrawingNodes.scroll
28017
+ }
28018
+ ) }),
28019
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28020
+ "div",
28021
+ {
28022
+ ref: canvasTopOverlayContentRef,
28023
+ style: {
28024
+ height: sheetContentHeight,
28025
+ left: 0,
28026
+ pointerEvents: "none",
28027
+ position: "absolute",
28028
+ top: 0,
28029
+ transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
28030
+ transformOrigin: "0 0",
28031
+ width: totalWidth
28032
+ },
28033
+ children: paneDrawingNodes.top
28034
+ }
28035
+ ) }),
28036
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28037
+ "div",
28038
+ {
28039
+ ref: canvasLeftOverlayContentRef,
28040
+ style: {
28041
+ height: sheetContentHeight,
28042
+ left: 0,
28043
+ pointerEvents: "none",
28044
+ position: "absolute",
28045
+ top: 0,
28046
+ transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
28047
+ transformOrigin: "0 0",
28048
+ width: totalWidth
28049
+ },
28050
+ children: paneDrawingNodes.left
28051
+ }
28052
+ ) }),
28053
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28011
28054
  "div",
28012
28055
  {
28056
+ ref: canvasCornerOverlayContentRef,
28013
28057
  style: {
28014
- height: activeCellAdornmentRect.height,
28015
- left: activeCellAdornmentRect.left,
28058
+ height: sheetContentHeight,
28059
+ left: 0,
28016
28060
  pointerEvents: "none",
28017
28061
  position: "absolute",
28018
- top: activeCellAdornmentRect.top,
28019
- width: activeCellAdornmentRect.width,
28020
- zIndex: 27
28062
+ top: 0,
28063
+ transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
28064
+ transformOrigin: "0 0",
28065
+ width: totalWidth
28021
28066
  },
28022
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { height: "100%", pointerEvents: "auto", position: "relative", width: "100%" }, children: activeCellAdornment })
28067
+ children: paneDrawingNodes.corner
28023
28068
  }
28024
- ) : null
28025
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
28026
- "table",
28069
+ ) })
28070
+ ] }) : null
28071
+ ] }),
28072
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: canvasHeaderViewportLayerStyle, children: [
28073
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28074
+ "canvas",
28027
28075
  {
28028
- ref: tableRef,
28029
- style: {
28030
- borderCollapse: "collapse",
28031
- color: "#000000",
28032
- flex: "0 0 auto",
28033
- tableLayout: "fixed",
28034
- width: totalWidth
28035
- },
28036
- children: [
28037
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("colgroup", { children: [
28038
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: displayRowHeaderWidth } }),
28039
- leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: leadingColumnSpacerWidth } }) : null,
28040
- renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28041
- "col",
28042
- {
28043
- ref: (element) => {
28044
- if (element) {
28045
- colElementRefs.current.set(column.actualCol, element);
28046
- } else {
28047
- colElementRefs.current.delete(column.actualCol);
28048
- }
28049
- },
28050
- style: { width: column.size }
28051
- },
28052
- column.key
28053
- )),
28054
- trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: trailingColumnSpacerWidth } }) : null
28055
- ] }),
28056
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { style: { position: "sticky", top: 0, zIndex: canvasHeaderOverlayZIndex }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { children: [
28057
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28058
- "th",
28059
- {
28060
- style: {
28061
- ...headerCellStyle,
28062
- backgroundColor: palette.headerSurface,
28063
- left: 0,
28064
- width: displayRowHeaderWidth,
28065
- zIndex: cornerHeaderOverlayZIndex
28066
- }
28067
- }
28068
- ),
28069
- leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: leadingColumnSpacerWidth } }) : null,
28070
- renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28071
- "th",
28072
- {
28073
- "data-xlsx-col-header": column.actualCol,
28074
- ref: (element) => setColHeaderRef(column.actualCol, element),
28075
- onPointerDown: (event) => handleColumnPointerDown(event, column.actualCol),
28076
- style: {
28077
- ...headerCellStyle,
28078
- left: stickyLeftByCol.get(column.actualCol),
28079
- zIndex: stickyLeftByCol.has(column.actualCol) ? stickyHeaderOverlayZIndex : headerCellStyle.zIndex
28080
- },
28081
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { position: "relative" }, children: [
28082
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28083
- "span",
28084
- {
28085
- style: {
28086
- display: "inline-block",
28087
- transform: headerLabelLiveScale !== 1 ? `scale(${1 / headerLabelLiveScale})` : void 0,
28088
- transformOrigin: "center center"
28089
- },
28090
- children: columnLabel2(column.actualCol)
28091
- }
28092
- ),
28093
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28094
- "div",
28095
- {
28096
- onPointerDown: (event) => {
28097
- if (!canResizeHeaders) {
28098
- return;
28099
- }
28100
- event.preventDefault();
28101
- event.stopPropagation();
28102
- startColumnResize(
28103
- event.pointerId,
28104
- column.actualCol,
28105
- column.size,
28106
- event.clientX
28107
- );
28108
- },
28109
- style: columnResizeHandleStyle
28110
- }
28111
- )
28112
- ] })
28113
- },
28114
- column.key
28115
- )),
28116
- trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: trailingColumnSpacerWidth } }) : null
28117
- ] }) }),
28118
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tbody", { children: [
28119
- virtualRows.map((virtualRow, index) => {
28120
- const actualRow = visibleRows[virtualRow.index];
28121
- if (actualRow === void 0) {
28122
- return null;
28123
- }
28124
- const previousEnd = index === 0 ? 0 : virtualRows[index - 1]?.end ?? 0;
28125
- const gapHeight = Math.max(0, virtualRow.start - previousEnd);
28126
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React4.Fragment, { children: [
28127
- gapHeight > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tr", { "aria-hidden": "true", style: { height: gapHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { colSpan: rowColSpan }) }) : null,
28128
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28129
- MemoGridRow,
28130
- {
28131
- actualRow,
28132
- editingCell,
28133
- editingValue,
28134
- frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
28135
- getCellData,
28136
- leadingSpacerWidth: leadingColumnSpacerWidth,
28137
- onCellClick: handleCellClick,
28138
- onCellDoubleClick: handleCellDoubleClick,
28139
- onCellPointerDown: handleCellPointerDown,
28140
- onEditingCancel: cancelEditing,
28141
- onEditingCommit: commitEditing,
28142
- onEditingValueChange: setEditingValue,
28143
- headerLabelLiveScale,
28144
- onRowHeaderRef: setRowHeaderRef,
28145
- onRowPointerDown: handleRowPointerDown,
28146
- onRowResizePointerDown: handleRowResizePointerDown,
28147
- palette,
28148
- readOnly,
28149
- renderCellAdornment,
28150
- rowHeight: virtualRow.size,
28151
- rowHeaderZIndex: rowHeaderOverlayZIndex,
28152
- rowHeaderWidth: displayRowHeaderWidth,
28153
- stickyLeftByCol,
28154
- stickyTop: stickyTopByRow.get(actualRow),
28155
- trailingSpacerWidth: trailingColumnSpacerWidth,
28156
- visibleCols: renderedCols,
28157
- zoomFactor
28158
- },
28159
- virtualRow.key
28160
- )
28161
- ] }, `row-fragment-${virtualRow.key}`);
28162
- }),
28163
- virtualRows.length > 0 && totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28164
- "tr",
28165
- {
28166
- style: {
28167
- height: totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight)
28168
- },
28169
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { colSpan: rowColSpan })
28170
- }
28171
- ) : null
28172
- ] })
28173
- ]
28076
+ ref: topFrozenHeaderCanvasRef,
28077
+ onPointerLeave: handleCanvasHeaderPointerLeave,
28078
+ onPointerMove: handleCanvasColumnHeaderPointerMove,
28079
+ onPointerDown: handleCanvasColumnHeaderPointerDown,
28080
+ style: canvasTopFrozenHeaderStyle
28174
28081
  }
28175
28082
  ),
28176
28083
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28177
- "div",
28084
+ "canvas",
28178
28085
  {
28179
- ref: selectionOverlayRef,
28180
- style: {
28181
- backgroundColor: selectionFill,
28182
- boxSizing: "border-box",
28183
- boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
28184
- contain: "layout paint",
28185
- height: resolvedSelectionOverlay?.height ?? 0,
28186
- left: resolvedSelectionOverlay?.left ?? 0,
28187
- opacity: resolvedSelectionOverlay ? 1 : 0,
28188
- pointerEvents: "none",
28189
- position: "absolute",
28190
- top: resolvedSelectionOverlay?.top ?? 0,
28191
- transition: canvasSelectionTransition,
28192
- visibility: resolvedSelectionOverlay ? "visible" : "hidden",
28193
- willChange: shouldAnimateCanvasSelection ? "left, top, width, height" : void 0,
28194
- width: resolvedSelectionOverlay?.width ?? 0,
28195
- zIndex: 24
28196
- }
28086
+ ref: topScrollHeaderCanvasRef,
28087
+ onPointerLeave: handleCanvasHeaderPointerLeave,
28088
+ onPointerMove: handleCanvasColumnHeaderPointerMove,
28089
+ onPointerDown: handleCanvasColumnHeaderPointerDown,
28090
+ style: canvasTopScrollHeaderStyle
28197
28091
  }
28198
28092
  ),
28199
28093
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28200
- "div",
28094
+ "canvas",
28201
28095
  {
28202
- ref: activeValidationOverlayRef,
28203
- "aria-hidden": "true",
28204
- style: {
28205
- alignItems: "center",
28206
- color: palette.mutedText,
28207
- display: "inline-flex",
28208
- fontSize: 10 * zoomFactor,
28209
- fontWeight: 700,
28210
- height: 16 * zoomFactor,
28211
- justifyContent: "center",
28212
- opacity: 0,
28213
- pointerEvents: "none",
28214
- position: "absolute",
28215
- transform: "translateY(-50%)",
28216
- visibility: "hidden",
28217
- width: 12 * zoomFactor,
28218
- zIndex: 26
28219
- },
28220
- children: "\u25BE"
28096
+ ref: leftFrozenHeaderCanvasRef,
28097
+ onPointerLeave: handleCanvasHeaderPointerLeave,
28098
+ onPointerMove: handleCanvasRowHeaderPointerMove,
28099
+ onPointerDown: handleCanvasRowHeaderPointerDown,
28100
+ style: canvasLeftFrozenHeaderStyle
28221
28101
  }
28222
28102
  ),
28223
28103
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28224
- "div",
28104
+ "canvas",
28225
28105
  {
28226
- ref: fillHandleRef,
28227
- onPointerDown: (event) => {
28228
- if (readOnly || event.button !== 0 || !normalizedSelection || !resolvedSelectionOverlay) {
28229
- return;
28230
- }
28231
- event.preventDefault();
28232
- event.stopPropagation();
28233
- startFillDrag(event.pointerId, normalizedSelection);
28234
- },
28235
- style: {
28236
- backgroundColor: selectionStroke,
28237
- border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
28238
- contain: "layout paint",
28239
- cursor: "crosshair",
28240
- display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
28241
- height: 8 * zoomFactor,
28242
- left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
28243
- pointerEvents: "auto",
28244
- position: "absolute",
28245
- top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
28246
- transition: shouldAnimateCanvasSelection ? "left 120ms cubic-bezier(0.22, 1, 0.36, 1), top 120ms cubic-bezier(0.22, 1, 0.36, 1)" : "none",
28247
- willChange: shouldAnimateCanvasSelection ? "left, top" : void 0,
28248
- width: 8 * zoomFactor,
28249
- zIndex: 25
28250
- }
28106
+ ref: leftScrollHeaderCanvasRef,
28107
+ onPointerLeave: handleCanvasHeaderPointerLeave,
28108
+ onPointerMove: handleCanvasRowHeaderPointerMove,
28109
+ onPointerDown: handleCanvasRowHeaderPointerDown,
28110
+ style: canvasLeftScrollHeaderStyle
28251
28111
  }
28252
28112
  ),
28253
- resizeGuide ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28113
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
28114
+ ] }),
28115
+ editingCell && editingOverlayRect ? (() => {
28116
+ const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
28117
+ const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
28118
+ const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
28119
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28254
28120
  "div",
28255
28121
  {
28256
- "aria-hidden": "true",
28257
28122
  style: {
28258
- backgroundColor: selectionStroke,
28259
- borderRadius: Math.max(999, 3 * zoomFactor),
28260
- boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
28261
- height: resizeGuide.type === "column" ? Math.max(12, 14 * zoomFactor) : Math.max(3, 2 * zoomFactor),
28262
- left: resizeGuide.type === "column" ? resizeGuide.position - Math.max(2, 1.5 * zoomFactor) : Math.max(3, 4 * zoomFactor),
28263
- pointerEvents: "none",
28123
+ left: editingOverlayRect.left,
28264
28124
  position: "absolute",
28265
- top: resizeGuide.type === "column" ? Math.max(2 * zoomFactor, displayHeaderHeight - Math.max(14, 16 * zoomFactor)) : resizeGuide.position - Math.max(2, 1.5 * zoomFactor),
28266
- width: resizeGuide.type === "column" ? Math.max(3, 2 * zoomFactor) : Math.max(12, 14 * zoomFactor),
28267
- zIndex: 52
28268
- }
28269
- }
28270
- ) : null,
28271
- !renderTableHeaderMenu && openTableMenuState ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28272
- "div",
28273
- {
28274
- ref: tableMenuRef,
28275
- style: {
28276
- color: palette.text,
28277
- left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
28278
- position: "absolute",
28279
- top: openTableMenuState.top,
28280
- zIndex: 50
28125
+ top: editingOverlayRect.top,
28126
+ width: editingOverlayRect.width,
28127
+ height: editingOverlayRect.height,
28128
+ zIndex: 28
28281
28129
  },
28282
28130
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28283
- DefaultTableHeaderMenu,
28131
+ "input",
28284
28132
  {
28285
- cell: { col: openTableMenuState.column.index + openTableMenuState.table.start.col, row: openTableMenuState.table.start.row },
28286
- column: openTableMenuState.column,
28287
- direction: sortState && sortState.tableName === openTableMenuState.table.name && sortState.columnIndex === openTableMenuState.column.index ? sortState.direction : null,
28288
- sortAscending: () => {
28289
- sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "ascending");
28290
- setOpenTableMenu(null);
28133
+ ref: editingInputRef,
28134
+ autoFocus: true,
28135
+ onBlur: commitEditing,
28136
+ onChange: (event) => setEditingValue(event.target.value),
28137
+ onKeyDown: (event) => {
28138
+ event.stopPropagation();
28139
+ if (event.key === "Enter") {
28140
+ event.preventDefault();
28141
+ commitEditing();
28142
+ return;
28143
+ }
28144
+ if (event.key === "Escape") {
28145
+ event.preventDefault();
28146
+ cancelEditing();
28147
+ }
28291
28148
  },
28292
- sortDescending: () => {
28293
- sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "descending");
28294
- setOpenTableMenu(null);
28149
+ style: {
28150
+ backgroundColor: editingBackground,
28151
+ border: 0,
28152
+ boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
28153
+ boxSizing: "border-box",
28154
+ color: editingColor,
28155
+ display: "block",
28156
+ font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
28157
+ height: "100%",
28158
+ margin: 0,
28159
+ minHeight: 0,
28160
+ outline: "none",
28161
+ overflow: "hidden",
28162
+ padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
28163
+ width: "100%"
28295
28164
  },
28296
- table: openTableMenuState.table,
28297
- triggerIcon: "\u25BE",
28298
- triggerProps: { type: "button" }
28165
+ value: editingValue
28299
28166
  }
28300
28167
  )
28301
28168
  }
28302
- ) : null
28303
- ]
28304
- }
28305
- )
28169
+ );
28170
+ })() : null,
28171
+ activeCellAdornment && activeCellAdornmentRect ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28172
+ "div",
28173
+ {
28174
+ style: {
28175
+ height: activeCellAdornmentRect.height,
28176
+ left: activeCellAdornmentRect.left,
28177
+ pointerEvents: "none",
28178
+ position: "absolute",
28179
+ top: activeCellAdornmentRect.top,
28180
+ width: activeCellAdornmentRect.width,
28181
+ zIndex: 27
28182
+ },
28183
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { height: "100%", pointerEvents: "auto", position: "relative", width: "100%" }, children: activeCellAdornment })
28184
+ }
28185
+ ) : null
28186
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
28187
+ "table",
28188
+ {
28189
+ ref: tableRef,
28190
+ style: {
28191
+ borderCollapse: "collapse",
28192
+ color: "#000000",
28193
+ flex: "0 0 auto",
28194
+ tableLayout: "fixed",
28195
+ width: totalWidth
28196
+ },
28197
+ children: [
28198
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("colgroup", { children: [
28199
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: displayRowHeaderWidth } }),
28200
+ leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: leadingColumnSpacerWidth } }) : null,
28201
+ renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28202
+ "col",
28203
+ {
28204
+ ref: (element) => {
28205
+ if (element) {
28206
+ colElementRefs.current.set(column.actualCol, element);
28207
+ } else {
28208
+ colElementRefs.current.delete(column.actualCol);
28209
+ }
28210
+ },
28211
+ style: { width: column.size }
28212
+ },
28213
+ column.key
28214
+ )),
28215
+ trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: trailingColumnSpacerWidth } }) : null
28216
+ ] }),
28217
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { style: { position: "sticky", top: 0, zIndex: canvasHeaderOverlayZIndex }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { children: [
28218
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28219
+ "th",
28220
+ {
28221
+ style: {
28222
+ ...headerCellStyle,
28223
+ backgroundColor: palette.headerSurface,
28224
+ left: 0,
28225
+ width: displayRowHeaderWidth,
28226
+ zIndex: cornerHeaderOverlayZIndex
28227
+ }
28228
+ }
28229
+ ),
28230
+ leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: leadingColumnSpacerWidth } }) : null,
28231
+ renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28232
+ "th",
28233
+ {
28234
+ "data-xlsx-col-header": column.actualCol,
28235
+ ref: (element) => setColHeaderRef(column.actualCol, element),
28236
+ onPointerDown: (event) => handleColumnPointerDown(event, column.actualCol),
28237
+ style: {
28238
+ ...headerCellStyle,
28239
+ left: stickyLeftByCol.get(column.actualCol),
28240
+ zIndex: stickyLeftByCol.has(column.actualCol) ? stickyHeaderOverlayZIndex : headerCellStyle.zIndex
28241
+ },
28242
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { position: "relative" }, children: [
28243
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28244
+ "span",
28245
+ {
28246
+ style: {
28247
+ display: "inline-block",
28248
+ transform: headerLabelLiveScale !== 1 ? `scale(${1 / headerLabelLiveScale})` : void 0,
28249
+ transformOrigin: "center center"
28250
+ },
28251
+ children: columnLabel2(column.actualCol)
28252
+ }
28253
+ ),
28254
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28255
+ "div",
28256
+ {
28257
+ onPointerDown: (event) => {
28258
+ if (!canResizeHeaders) {
28259
+ return;
28260
+ }
28261
+ event.preventDefault();
28262
+ event.stopPropagation();
28263
+ startColumnResize(
28264
+ event.pointerId,
28265
+ column.actualCol,
28266
+ column.size,
28267
+ event.clientX
28268
+ );
28269
+ },
28270
+ style: columnResizeHandleStyle
28271
+ }
28272
+ )
28273
+ ] })
28274
+ },
28275
+ column.key
28276
+ )),
28277
+ trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: trailingColumnSpacerWidth } }) : null
28278
+ ] }) }),
28279
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tbody", { children: [
28280
+ virtualRows.map((virtualRow, index) => {
28281
+ const actualRow = visibleRows[virtualRow.index];
28282
+ if (actualRow === void 0) {
28283
+ return null;
28284
+ }
28285
+ const previousEnd = index === 0 ? 0 : virtualRows[index - 1]?.end ?? 0;
28286
+ const gapHeight = Math.max(0, virtualRow.start - previousEnd);
28287
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React4.Fragment, { children: [
28288
+ gapHeight > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tr", { "aria-hidden": "true", style: { height: gapHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { colSpan: rowColSpan }) }) : null,
28289
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28290
+ MemoGridRow,
28291
+ {
28292
+ actualRow,
28293
+ editingCell,
28294
+ editingValue,
28295
+ frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
28296
+ getCellData,
28297
+ leadingSpacerWidth: leadingColumnSpacerWidth,
28298
+ onCellClick: handleCellClick,
28299
+ onCellDoubleClick: handleCellDoubleClick,
28300
+ onCellPointerDown: handleCellPointerDown,
28301
+ onEditingCancel: cancelEditing,
28302
+ onEditingCommit: commitEditing,
28303
+ onEditingValueChange: setEditingValue,
28304
+ headerLabelLiveScale,
28305
+ onRowHeaderRef: setRowHeaderRef,
28306
+ onRowPointerDown: handleRowPointerDown,
28307
+ onRowResizePointerDown: handleRowResizePointerDown,
28308
+ palette,
28309
+ readOnly,
28310
+ renderCellAdornment,
28311
+ rowHeight: virtualRow.size,
28312
+ rowHeaderZIndex: rowHeaderOverlayZIndex,
28313
+ rowHeaderWidth: displayRowHeaderWidth,
28314
+ stickyLeftByCol,
28315
+ stickyTop: stickyTopByRow.get(actualRow),
28316
+ trailingSpacerWidth: trailingColumnSpacerWidth,
28317
+ visibleCols: renderedCols,
28318
+ zoomFactor
28319
+ },
28320
+ virtualRow.key
28321
+ )
28322
+ ] }, `row-fragment-${virtualRow.key}`);
28323
+ }),
28324
+ virtualRows.length > 0 && totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28325
+ "tr",
28326
+ {
28327
+ style: {
28328
+ height: totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight)
28329
+ },
28330
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { colSpan: rowColSpan })
28331
+ }
28332
+ ) : null
28333
+ ] })
28334
+ ]
28335
+ }
28336
+ ),
28337
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28338
+ "div",
28339
+ {
28340
+ ref: selectionOverlayRef,
28341
+ style: {
28342
+ backgroundColor: selectionFill,
28343
+ boxSizing: "border-box",
28344
+ boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
28345
+ contain: "layout paint",
28346
+ height: resolvedSelectionOverlay?.height ?? 0,
28347
+ left: resolvedSelectionOverlay?.left ?? 0,
28348
+ opacity: resolvedSelectionOverlay ? 1 : 0,
28349
+ pointerEvents: "none",
28350
+ position: "absolute",
28351
+ top: resolvedSelectionOverlay?.top ?? 0,
28352
+ transition: canvasSelectionTransition,
28353
+ visibility: resolvedSelectionOverlay ? "visible" : "hidden",
28354
+ willChange: shouldAnimateCanvasSelection ? "left, top, width, height" : void 0,
28355
+ width: resolvedSelectionOverlay?.width ?? 0,
28356
+ zIndex: 24
28357
+ }
28358
+ }
28359
+ ),
28360
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28361
+ "div",
28362
+ {
28363
+ ref: activeValidationOverlayRef,
28364
+ "aria-hidden": "true",
28365
+ style: {
28366
+ alignItems: "center",
28367
+ color: palette.mutedText,
28368
+ display: "inline-flex",
28369
+ fontSize: 10 * zoomFactor,
28370
+ fontWeight: 700,
28371
+ height: 16 * zoomFactor,
28372
+ justifyContent: "center",
28373
+ opacity: 0,
28374
+ pointerEvents: "none",
28375
+ position: "absolute",
28376
+ transform: "translateY(-50%)",
28377
+ visibility: "hidden",
28378
+ width: 12 * zoomFactor,
28379
+ zIndex: 26
28380
+ },
28381
+ children: "\u25BE"
28382
+ }
28383
+ ),
28384
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28385
+ "div",
28386
+ {
28387
+ ref: fillHandleRef,
28388
+ onPointerDown: (event) => {
28389
+ if (readOnly || event.button !== 0 || !normalizedSelection || !resolvedSelectionOverlay) {
28390
+ return;
28391
+ }
28392
+ event.preventDefault();
28393
+ event.stopPropagation();
28394
+ startFillDrag(event.pointerId, normalizedSelection);
28395
+ },
28396
+ style: {
28397
+ backgroundColor: selectionStroke,
28398
+ border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
28399
+ contain: "layout paint",
28400
+ cursor: "crosshair",
28401
+ display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
28402
+ height: 8 * zoomFactor,
28403
+ left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
28404
+ pointerEvents: "auto",
28405
+ position: "absolute",
28406
+ top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
28407
+ transition: shouldAnimateCanvasSelection ? "left 120ms cubic-bezier(0.22, 1, 0.36, 1), top 120ms cubic-bezier(0.22, 1, 0.36, 1)" : "none",
28408
+ willChange: shouldAnimateCanvasSelection ? "left, top" : void 0,
28409
+ width: 8 * zoomFactor,
28410
+ zIndex: 25
28411
+ }
28412
+ }
28413
+ ),
28414
+ resizeGuide ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28415
+ "div",
28416
+ {
28417
+ "aria-hidden": "true",
28418
+ style: {
28419
+ backgroundColor: selectionStroke,
28420
+ borderRadius: Math.max(999, 3 * zoomFactor),
28421
+ boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
28422
+ height: resizeGuide.type === "column" ? Math.max(12, 14 * zoomFactor) : Math.max(3, 2 * zoomFactor),
28423
+ left: resizeGuide.type === "column" ? resizeGuide.position - Math.max(2, 1.5 * zoomFactor) : Math.max(3, 4 * zoomFactor),
28424
+ pointerEvents: "none",
28425
+ position: "absolute",
28426
+ top: resizeGuide.type === "column" ? Math.max(2 * zoomFactor, displayHeaderHeight - Math.max(14, 16 * zoomFactor)) : resizeGuide.position - Math.max(2, 1.5 * zoomFactor),
28427
+ width: resizeGuide.type === "column" ? Math.max(3, 2 * zoomFactor) : Math.max(12, 14 * zoomFactor),
28428
+ zIndex: 52
28429
+ }
28430
+ }
28431
+ ) : null,
28432
+ !renderTableHeaderMenu && openTableMenuState ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28433
+ "div",
28434
+ {
28435
+ ref: tableMenuRef,
28436
+ style: {
28437
+ color: palette.text,
28438
+ left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
28439
+ position: "absolute",
28440
+ top: openTableMenuState.top,
28441
+ zIndex: 50
28442
+ },
28443
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28444
+ DefaultTableHeaderMenu,
28445
+ {
28446
+ cell: { col: openTableMenuState.column.index + openTableMenuState.table.start.col, row: openTableMenuState.table.start.row },
28447
+ column: openTableMenuState.column,
28448
+ direction: sortState && sortState.tableName === openTableMenuState.table.name && sortState.columnIndex === openTableMenuState.column.index ? sortState.direction : null,
28449
+ sortAscending: () => {
28450
+ sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "ascending");
28451
+ setOpenTableMenu(null);
28452
+ },
28453
+ sortDescending: () => {
28454
+ sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "descending");
28455
+ setOpenTableMenu(null);
28456
+ },
28457
+ table: openTableMenuState.table,
28458
+ triggerIcon: "\u25BE",
28459
+ triggerProps: { type: "button" }
28460
+ }
28461
+ )
28462
+ }
28463
+ ) : null
28464
+ ]
28306
28465
  }
28307
28466
  )
28308
- },
28309
- activeTabIndex
28310
- ) });
28467
+ }
28468
+ );
28469
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { backgroundColor: palette.canvas, display: "flex", flex: 1, minHeight: 0, minWidth: 0 }, children: renderScroller ? renderScroller({ children: scrollerContent, viewportProps: scrollerViewportProps }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...scrollerViewportProps, children: scrollerContent }) });
28311
28470
  }
28312
28471
  function XlsxViewerInner({
28313
28472
  allowResizeInReadOnly = false,
@@ -28326,6 +28485,7 @@ function XlsxViewerInner({
28326
28485
  renderChartLoading,
28327
28486
  renderImage,
28328
28487
  renderImageSelection,
28488
+ renderScroller,
28329
28489
  renderTableHeaderMenu,
28330
28490
  rounded = true,
28331
28491
  selectionColor,
@@ -28387,6 +28547,7 @@ function XlsxViewerInner({
28387
28547
  renderChartLoading,
28388
28548
  renderImage,
28389
28549
  renderImageSelection,
28550
+ renderScroller,
28390
28551
  renderTableHeaderMenu,
28391
28552
  selectionColor,
28392
28553
  selectionFillColor,