@extend-ai/react-xlsx 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -21433,6 +21433,7 @@ function XlsxGrid({
21433
21433
  renderImage,
21434
21434
  renderImageSelection,
21435
21435
  renderTableHeaderMenu,
21436
+ renderScroller,
21436
21437
  enableGestureZoom = true,
21437
21438
  experimentalCanvas = true,
21438
21439
  selectionColor,
@@ -27582,700 +27583,698 @@ function XlsxGrid({
27582
27583
  }
27583
27584
  selectCell({ row: nextRow, col: nextCol }, extend ? { extend: true } : void 0);
27584
27585
  }
27585
- return /* @__PURE__ */ jsx3("div", { style: { backgroundColor: palette.canvas, display: "flex", flex: 1, minHeight: 0, minWidth: 0 }, children: /* @__PURE__ */ jsx3(
27586
- "div",
27587
- {
27588
- ref: scrollRef,
27589
- onScroll: handleScrollerScroll,
27590
- onCopy: (event) => {
27591
- if (editingCell) {
27592
- return;
27593
- }
27594
- const clipboard = event.clipboardData;
27595
- const clipboardData = getClipboardData();
27596
- if (!clipboardData) {
27597
- return;
27598
- }
27599
- event.preventDefault();
27600
- if (clipboard) {
27601
- clipboard.setData("text/plain", clipboardData.text);
27602
- clipboard.setData("text/html", clipboardData.html);
27603
- clipboard.setData(INTERNAL_CLIPBOARD_MIME2, clipboardData.structured);
27604
- return;
27605
- }
27606
- void copySelectionToClipboard();
27607
- },
27608
- onKeyDown: (event) => {
27609
- if (editingCell) {
27586
+ const scrollerViewportProps = {
27587
+ key: activeTabIndex,
27588
+ ref: scrollRef,
27589
+ onScroll: handleScrollerScroll,
27590
+ onCopy: (event) => {
27591
+ if (editingCell) {
27592
+ return;
27593
+ }
27594
+ const clipboard = event.clipboardData;
27595
+ const clipboardData = getClipboardData();
27596
+ if (!clipboardData) {
27597
+ return;
27598
+ }
27599
+ event.preventDefault();
27600
+ if (clipboard) {
27601
+ clipboard.setData("text/plain", clipboardData.text);
27602
+ clipboard.setData("text/html", clipboardData.html);
27603
+ clipboard.setData(INTERNAL_CLIPBOARD_MIME2, clipboardData.structured);
27604
+ return;
27605
+ }
27606
+ void copySelectionToClipboard();
27607
+ },
27608
+ onKeyDown: (event) => {
27609
+ if (editingCell) {
27610
+ return;
27611
+ }
27612
+ if (!readOnly && (event.metaKey || event.ctrlKey) && !event.altKey) {
27613
+ const normalizedKey = event.key.toLowerCase();
27614
+ if (normalizedKey === "z" && event.shiftKey) {
27615
+ event.preventDefault();
27616
+ redo();
27610
27617
  return;
27611
27618
  }
27612
- if (!readOnly && (event.metaKey || event.ctrlKey) && !event.altKey) {
27613
- const normalizedKey = event.key.toLowerCase();
27614
- if (normalizedKey === "z" && event.shiftKey) {
27615
- event.preventDefault();
27616
- redo();
27617
- return;
27618
- }
27619
- if (normalizedKey === "z") {
27620
- event.preventDefault();
27621
- undo();
27622
- return;
27623
- }
27624
- if (normalizedKey === "y") {
27625
- event.preventDefault();
27626
- redo();
27627
- return;
27628
- }
27629
- }
27630
- const currentCell = resolveCurrentCell();
27631
- if (!currentCell) {
27619
+ if (normalizedKey === "z") {
27620
+ event.preventDefault();
27621
+ undo();
27632
27622
  return;
27633
27623
  }
27634
- const currentRowIndex = rowIndexByActual.get(currentCell.row) ?? 0;
27635
- const currentColIndex = colIndexByActual.get(currentCell.col) ?? 0;
27636
- if (!readOnly && isPrintableKey(event)) {
27624
+ if (normalizedKey === "y") {
27637
27625
  event.preventDefault();
27638
- startEditing(currentCell, event.key);
27626
+ redo();
27639
27627
  return;
27640
27628
  }
27641
- switch (event.key) {
27642
- case "ArrowDown":
27643
- event.preventDefault();
27644
- moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, event.shiftKey);
27645
- break;
27646
- case "ArrowUp":
27647
- event.preventDefault();
27648
- moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, event.shiftKey);
27649
- break;
27650
- case "ArrowLeft":
27651
- event.preventDefault();
27652
- moveSelection(currentRowIndex, Math.max(currentColIndex - 1, 0), event.shiftKey);
27629
+ }
27630
+ const currentCell = resolveCurrentCell();
27631
+ if (!currentCell) {
27632
+ return;
27633
+ }
27634
+ const currentRowIndex = rowIndexByActual.get(currentCell.row) ?? 0;
27635
+ const currentColIndex = colIndexByActual.get(currentCell.col) ?? 0;
27636
+ if (!readOnly && isPrintableKey(event)) {
27637
+ event.preventDefault();
27638
+ startEditing(currentCell, event.key);
27639
+ return;
27640
+ }
27641
+ switch (event.key) {
27642
+ case "ArrowDown":
27643
+ event.preventDefault();
27644
+ moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, event.shiftKey);
27645
+ break;
27646
+ case "ArrowUp":
27647
+ event.preventDefault();
27648
+ moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, event.shiftKey);
27649
+ break;
27650
+ case "ArrowLeft":
27651
+ event.preventDefault();
27652
+ moveSelection(currentRowIndex, Math.max(currentColIndex - 1, 0), event.shiftKey);
27653
+ break;
27654
+ case "ArrowRight":
27655
+ event.preventDefault();
27656
+ moveSelection(currentRowIndex, Math.min(currentColIndex + 1, visibleCols.length - 1), event.shiftKey);
27657
+ break;
27658
+ case "Tab":
27659
+ event.preventDefault();
27660
+ moveSelection(
27661
+ currentRowIndex,
27662
+ event.shiftKey ? Math.max(currentColIndex - 1, 0) : Math.min(currentColIndex + 1, visibleCols.length - 1),
27663
+ false
27664
+ );
27665
+ break;
27666
+ case "Enter":
27667
+ event.preventDefault();
27668
+ if (event.metaKey || event.ctrlKey || event.altKey) {
27653
27669
  break;
27654
- case "ArrowRight":
27655
- event.preventDefault();
27656
- moveSelection(currentRowIndex, Math.min(currentColIndex + 1, visibleCols.length - 1), event.shiftKey);
27670
+ }
27671
+ if (event.shiftKey) {
27672
+ moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, false);
27657
27673
  break;
27658
- case "Tab":
27674
+ }
27675
+ moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, false);
27676
+ break;
27677
+ case "Backspace":
27678
+ case "Delete":
27679
+ if (!readOnly) {
27659
27680
  event.preventDefault();
27660
- moveSelection(
27661
- currentRowIndex,
27662
- event.shiftKey ? Math.max(currentColIndex - 1, 0) : Math.min(currentColIndex + 1, visibleCols.length - 1),
27663
- false
27664
- );
27665
- break;
27666
- case "Enter":
27681
+ clearSelectedCells();
27682
+ }
27683
+ break;
27684
+ case "F2":
27685
+ if (!readOnly) {
27667
27686
  event.preventDefault();
27668
- if (event.metaKey || event.ctrlKey || event.altKey) {
27669
- break;
27670
- }
27671
- if (event.shiftKey) {
27672
- moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, false);
27673
- break;
27674
- }
27675
- moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, false);
27676
- break;
27677
- case "Backspace":
27678
- case "Delete":
27679
- if (!readOnly) {
27680
- event.preventDefault();
27681
- clearSelectedCells();
27682
- }
27683
- break;
27684
- case "F2":
27685
- if (!readOnly) {
27686
- event.preventDefault();
27687
- startEditing(currentCell);
27688
- }
27689
- break;
27690
- default:
27691
- break;
27692
- }
27693
- },
27694
- onPaste: (event) => {
27695
- if (editingCell || readOnly) {
27696
- return;
27697
- }
27698
- const clipboard = event.clipboardData;
27699
- if (!clipboard) {
27700
- event.preventDefault();
27701
- void pasteFromClipboard();
27702
- return;
27703
- }
27704
- const structuredPayload = clipboard.getData(INTERNAL_CLIPBOARD_MIME2);
27705
- const textPayload = clipboard.getData("text/plain");
27706
- if (!structuredPayload && !textPayload) {
27707
- return;
27708
- }
27687
+ startEditing(currentCell);
27688
+ }
27689
+ break;
27690
+ default:
27691
+ break;
27692
+ }
27693
+ },
27694
+ onPaste: (event) => {
27695
+ if (editingCell || readOnly) {
27696
+ return;
27697
+ }
27698
+ const clipboard = event.clipboardData;
27699
+ if (!clipboard) {
27709
27700
  event.preventDefault();
27710
- if (structuredPayload) {
27711
- pasteStructuredClipboardData(structuredPayload);
27712
- return;
27713
- }
27714
- pasteText(textPayload);
27715
- },
27716
- tabIndex: 0,
27701
+ void pasteFromClipboard();
27702
+ return;
27703
+ }
27704
+ const structuredPayload = clipboard.getData(INTERNAL_CLIPBOARD_MIME2);
27705
+ const textPayload = clipboard.getData("text/plain");
27706
+ if (!structuredPayload && !textPayload) {
27707
+ return;
27708
+ }
27709
+ event.preventDefault();
27710
+ if (structuredPayload) {
27711
+ pasteStructuredClipboardData(structuredPayload);
27712
+ return;
27713
+ }
27714
+ pasteText(textPayload);
27715
+ },
27716
+ tabIndex: 0,
27717
+ style: {
27718
+ ["--xlsx-menu-active"]: selectionFill,
27719
+ ["--xlsx-menu-border"]: palette.strongBorder,
27720
+ ["--xlsx-menu-surface"]: palette.surface,
27721
+ ["--xlsx-selection-header"]: selectionHeaderSurface,
27722
+ backgroundColor: palette.canvas,
27723
+ color: palette.text,
27724
+ cursor: resizeGuide?.type === "column" ? "col-resize" : resizeGuide?.type === "row" ? "row-resize" : void 0,
27725
+ flex: 1,
27726
+ height: "100%",
27727
+ minHeight: 0,
27728
+ minWidth: 0,
27729
+ outline: "none",
27730
+ overflow: "auto",
27731
+ width: "100%"
27732
+ }
27733
+ };
27734
+ const scrollerContent = /* @__PURE__ */ jsx3(
27735
+ "div",
27736
+ {
27717
27737
  style: {
27718
- ["--xlsx-menu-active"]: selectionFill,
27719
- ["--xlsx-menu-border"]: palette.strongBorder,
27720
- ["--xlsx-menu-surface"]: palette.surface,
27721
- ["--xlsx-selection-header"]: selectionHeaderSurface,
27722
- backgroundColor: palette.canvas,
27723
- color: palette.text,
27724
- cursor: resizeGuide?.type === "column" ? "col-resize" : resizeGuide?.type === "row" ? "row-resize" : void 0,
27725
- flex: 1,
27726
- height: "100%",
27727
- minHeight: 0,
27728
- minWidth: 0,
27729
- outline: "none",
27730
- overflow: "auto",
27731
- width: "100%"
27738
+ backgroundColor: resolveSheetSurface(activeSheet, palette),
27739
+ minHeight: "100%",
27740
+ minWidth: "100%",
27741
+ position: "relative",
27742
+ width: totalWidth,
27743
+ height: sheetContentHeight
27732
27744
  },
27733
- children: /* @__PURE__ */ jsx3(
27745
+ children: /* @__PURE__ */ jsxs3(
27734
27746
  "div",
27735
27747
  {
27748
+ ref: wrapperRef,
27736
27749
  style: {
27737
- backgroundColor: resolveSheetSurface(activeSheet, palette),
27738
- minHeight: "100%",
27739
- minWidth: "100%",
27740
- position: "relative",
27741
- width: totalWidth,
27742
- height: sheetContentHeight
27750
+ height: sheetContentHeight,
27751
+ left: 0,
27752
+ position: "absolute",
27753
+ top: 0,
27754
+ transform: !experimentalCanvas && isLiveZooming ? `translate3d(${liveZoomTranslateX}px, ${liveZoomTranslateY}px, 0) scale(${liveZoomScale})` : void 0,
27755
+ transformOrigin: "0 0",
27756
+ transition: "none",
27757
+ willChange: !experimentalCanvas && isLiveZooming ? "transform" : void 0,
27758
+ width: totalWidth
27743
27759
  },
27744
- children: /* @__PURE__ */ jsxs3(
27745
- "div",
27746
- {
27747
- ref: wrapperRef,
27748
- style: {
27749
- height: sheetContentHeight,
27750
- left: 0,
27751
- position: "absolute",
27752
- top: 0,
27753
- transform: !experimentalCanvas && isLiveZooming ? `translate3d(${liveZoomTranslateX}px, ${liveZoomTranslateY}px, 0) scale(${liveZoomScale})` : void 0,
27754
- transformOrigin: "0 0",
27755
- transition: "none",
27756
- willChange: !experimentalCanvas && isLiveZooming ? "transform" : void 0,
27757
- width: totalWidth
27758
- },
27759
- children: [
27760
- showImages && !experimentalCanvas ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
27761
- /* @__PURE__ */ jsx3("div", { style: topOverlayStyle, children: paneDrawingNodes.top }),
27762
- /* @__PURE__ */ jsx3("div", { style: leftOverlayStyle, children: paneDrawingNodes.left }),
27763
- /* @__PURE__ */ jsx3("div", { style: cornerOverlayStyle, children: paneDrawingNodes.corner }),
27764
- /* @__PURE__ */ jsx3("div", { style: scrollOverlayStyle, children: paneDrawingNodes.scroll })
27765
- ] }) : null,
27766
- experimentalCanvas ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
27767
- /* @__PURE__ */ jsxs3("div", { style: canvasBodyViewportLayerStyle, children: [
27768
- /* @__PURE__ */ jsx3(
27769
- "canvas",
27770
- {
27771
- ref: scrollBodyCanvasRef,
27772
- onClick: handleCanvasBodyClick,
27773
- onDoubleClick: handleCanvasBodyDoubleClick,
27774
- onPointerDown: handleCanvasBodyPointerDown,
27775
- style: canvasScrollBodyStyle
27776
- }
27777
- ),
27778
- /* @__PURE__ */ jsx3(
27779
- "canvas",
27780
- {
27781
- ref: topBodyCanvasRef,
27782
- onClick: handleCanvasBodyClick,
27783
- onDoubleClick: handleCanvasBodyDoubleClick,
27784
- onPointerDown: handleCanvasBodyPointerDown,
27785
- style: canvasTopBodyStyle
27786
- }
27787
- ),
27788
- /* @__PURE__ */ jsx3(
27789
- "canvas",
27790
- {
27791
- ref: leftBodyCanvasRef,
27792
- onClick: handleCanvasBodyClick,
27793
- onDoubleClick: handleCanvasBodyDoubleClick,
27794
- onPointerDown: handleCanvasBodyPointerDown,
27795
- style: canvasLeftBodyStyle
27796
- }
27797
- ),
27798
- /* @__PURE__ */ jsx3(
27799
- "canvas",
27800
- {
27801
- ref: cornerBodyCanvasRef,
27802
- onClick: handleCanvasBodyClick,
27803
- onDoubleClick: handleCanvasBodyDoubleClick,
27804
- onPointerDown: handleCanvasBodyPointerDown,
27805
- style: canvasCornerBodyStyle
27806
- }
27807
- ),
27808
- hasCanvasDomDrawingOverlays ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
27809
- /* @__PURE__ */ jsx3("div", { style: canvasScrollOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27810
- "div",
27811
- {
27812
- ref: canvasScrollOverlayContentRef,
27813
- style: {
27814
- height: sheetContentHeight,
27815
- left: 0,
27816
- pointerEvents: "none",
27817
- position: "absolute",
27818
- top: 0,
27819
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27820
- transformOrigin: "0 0",
27821
- width: totalWidth
27822
- },
27823
- children: paneDrawingNodes.scroll
27824
- }
27825
- ) }),
27826
- /* @__PURE__ */ jsx3("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27827
- "div",
27828
- {
27829
- ref: canvasTopOverlayContentRef,
27830
- style: {
27831
- height: sheetContentHeight,
27832
- left: 0,
27833
- pointerEvents: "none",
27834
- position: "absolute",
27835
- top: 0,
27836
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
27837
- transformOrigin: "0 0",
27838
- width: totalWidth
27839
- },
27840
- children: paneDrawingNodes.top
27841
- }
27842
- ) }),
27843
- /* @__PURE__ */ jsx3("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27844
- "div",
27845
- {
27846
- ref: canvasLeftOverlayContentRef,
27847
- style: {
27848
- height: sheetContentHeight,
27849
- left: 0,
27850
- pointerEvents: "none",
27851
- position: "absolute",
27852
- top: 0,
27853
- transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27854
- transformOrigin: "0 0",
27855
- width: totalWidth
27856
- },
27857
- children: paneDrawingNodes.left
27858
- }
27859
- ) }),
27860
- /* @__PURE__ */ jsx3("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27861
- "div",
27862
- {
27863
- ref: canvasCornerOverlayContentRef,
27864
- style: {
27865
- height: sheetContentHeight,
27866
- left: 0,
27867
- pointerEvents: "none",
27868
- position: "absolute",
27869
- top: 0,
27870
- transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
27871
- transformOrigin: "0 0",
27872
- width: totalWidth
27873
- },
27874
- children: paneDrawingNodes.corner
27875
- }
27876
- ) })
27877
- ] }) : null
27878
- ] }),
27879
- /* @__PURE__ */ jsxs3("div", { style: canvasHeaderViewportLayerStyle, children: [
27880
- /* @__PURE__ */ jsx3(
27881
- "canvas",
27882
- {
27883
- ref: topFrozenHeaderCanvasRef,
27884
- onPointerLeave: handleCanvasHeaderPointerLeave,
27885
- onPointerMove: handleCanvasColumnHeaderPointerMove,
27886
- onPointerDown: handleCanvasColumnHeaderPointerDown,
27887
- style: canvasTopFrozenHeaderStyle
27888
- }
27889
- ),
27890
- /* @__PURE__ */ jsx3(
27891
- "canvas",
27892
- {
27893
- ref: topScrollHeaderCanvasRef,
27894
- onPointerLeave: handleCanvasHeaderPointerLeave,
27895
- onPointerMove: handleCanvasColumnHeaderPointerMove,
27896
- onPointerDown: handleCanvasColumnHeaderPointerDown,
27897
- style: canvasTopScrollHeaderStyle
27898
- }
27899
- ),
27900
- /* @__PURE__ */ jsx3(
27901
- "canvas",
27902
- {
27903
- ref: leftFrozenHeaderCanvasRef,
27904
- onPointerLeave: handleCanvasHeaderPointerLeave,
27905
- onPointerMove: handleCanvasRowHeaderPointerMove,
27906
- onPointerDown: handleCanvasRowHeaderPointerDown,
27907
- style: canvasLeftFrozenHeaderStyle
27908
- }
27909
- ),
27910
- /* @__PURE__ */ jsx3(
27911
- "canvas",
27912
- {
27913
- ref: leftScrollHeaderCanvasRef,
27914
- onPointerLeave: handleCanvasHeaderPointerLeave,
27915
- onPointerMove: handleCanvasRowHeaderPointerMove,
27916
- onPointerDown: handleCanvasRowHeaderPointerDown,
27917
- style: canvasLeftScrollHeaderStyle
27918
- }
27919
- ),
27920
- /* @__PURE__ */ jsx3("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
27921
- ] }),
27922
- editingCell && editingOverlayRect ? (() => {
27923
- const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
27924
- const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
27925
- const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
27926
- return /* @__PURE__ */ jsx3(
27927
- "div",
27928
- {
27929
- style: {
27930
- left: editingOverlayRect.left,
27931
- position: "absolute",
27932
- top: editingOverlayRect.top,
27933
- width: editingOverlayRect.width,
27934
- height: editingOverlayRect.height,
27935
- zIndex: 28
27936
- },
27937
- children: /* @__PURE__ */ jsx3(
27938
- "input",
27939
- {
27940
- ref: editingInputRef,
27941
- autoFocus: true,
27942
- onBlur: commitEditing,
27943
- onChange: (event) => setEditingValue(event.target.value),
27944
- onKeyDown: (event) => {
27945
- event.stopPropagation();
27946
- if (event.key === "Enter") {
27947
- event.preventDefault();
27948
- commitEditing();
27949
- return;
27950
- }
27951
- if (event.key === "Escape") {
27952
- event.preventDefault();
27953
- cancelEditing();
27954
- }
27955
- },
27956
- style: {
27957
- backgroundColor: editingBackground,
27958
- border: 0,
27959
- boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
27960
- boxSizing: "border-box",
27961
- color: editingColor,
27962
- display: "block",
27963
- font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
27964
- height: "100%",
27965
- margin: 0,
27966
- minHeight: 0,
27967
- outline: "none",
27968
- overflow: "hidden",
27969
- padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
27970
- width: "100%"
27971
- },
27972
- value: editingValue
27973
- }
27974
- )
27975
- }
27976
- );
27977
- })() : null,
27978
- activeCellAdornment && activeCellAdornmentRect ? /* @__PURE__ */ jsx3(
27760
+ children: [
27761
+ showImages && !experimentalCanvas ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
27762
+ /* @__PURE__ */ jsx3("div", { style: topOverlayStyle, children: paneDrawingNodes.top }),
27763
+ /* @__PURE__ */ jsx3("div", { style: leftOverlayStyle, children: paneDrawingNodes.left }),
27764
+ /* @__PURE__ */ jsx3("div", { style: cornerOverlayStyle, children: paneDrawingNodes.corner }),
27765
+ /* @__PURE__ */ jsx3("div", { style: scrollOverlayStyle, children: paneDrawingNodes.scroll })
27766
+ ] }) : null,
27767
+ experimentalCanvas ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
27768
+ /* @__PURE__ */ jsxs3("div", { style: canvasBodyViewportLayerStyle, children: [
27769
+ /* @__PURE__ */ jsx3(
27770
+ "canvas",
27771
+ {
27772
+ ref: scrollBodyCanvasRef,
27773
+ onClick: handleCanvasBodyClick,
27774
+ onDoubleClick: handleCanvasBodyDoubleClick,
27775
+ onPointerDown: handleCanvasBodyPointerDown,
27776
+ style: canvasScrollBodyStyle
27777
+ }
27778
+ ),
27779
+ /* @__PURE__ */ jsx3(
27780
+ "canvas",
27781
+ {
27782
+ ref: topBodyCanvasRef,
27783
+ onClick: handleCanvasBodyClick,
27784
+ onDoubleClick: handleCanvasBodyDoubleClick,
27785
+ onPointerDown: handleCanvasBodyPointerDown,
27786
+ style: canvasTopBodyStyle
27787
+ }
27788
+ ),
27789
+ /* @__PURE__ */ jsx3(
27790
+ "canvas",
27791
+ {
27792
+ ref: leftBodyCanvasRef,
27793
+ onClick: handleCanvasBodyClick,
27794
+ onDoubleClick: handleCanvasBodyDoubleClick,
27795
+ onPointerDown: handleCanvasBodyPointerDown,
27796
+ style: canvasLeftBodyStyle
27797
+ }
27798
+ ),
27799
+ /* @__PURE__ */ jsx3(
27800
+ "canvas",
27801
+ {
27802
+ ref: cornerBodyCanvasRef,
27803
+ onClick: handleCanvasBodyClick,
27804
+ onDoubleClick: handleCanvasBodyDoubleClick,
27805
+ onPointerDown: handleCanvasBodyPointerDown,
27806
+ style: canvasCornerBodyStyle
27807
+ }
27808
+ ),
27809
+ hasCanvasDomDrawingOverlays ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
27810
+ /* @__PURE__ */ jsx3("div", { style: canvasScrollOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27811
+ "div",
27812
+ {
27813
+ ref: canvasScrollOverlayContentRef,
27814
+ style: {
27815
+ height: sheetContentHeight,
27816
+ left: 0,
27817
+ pointerEvents: "none",
27818
+ position: "absolute",
27819
+ top: 0,
27820
+ transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27821
+ transformOrigin: "0 0",
27822
+ width: totalWidth
27823
+ },
27824
+ children: paneDrawingNodes.scroll
27825
+ }
27826
+ ) }),
27827
+ /* @__PURE__ */ jsx3("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27828
+ "div",
27829
+ {
27830
+ ref: canvasTopOverlayContentRef,
27831
+ style: {
27832
+ height: sheetContentHeight,
27833
+ left: 0,
27834
+ pointerEvents: "none",
27835
+ position: "absolute",
27836
+ top: 0,
27837
+ transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
27838
+ transformOrigin: "0 0",
27839
+ width: totalWidth
27840
+ },
27841
+ children: paneDrawingNodes.top
27842
+ }
27843
+ ) }),
27844
+ /* @__PURE__ */ jsx3("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27979
27845
  "div",
27980
27846
  {
27847
+ ref: canvasLeftOverlayContentRef,
27981
27848
  style: {
27982
- height: activeCellAdornmentRect.height,
27983
- left: activeCellAdornmentRect.left,
27849
+ height: sheetContentHeight,
27850
+ left: 0,
27984
27851
  pointerEvents: "none",
27985
27852
  position: "absolute",
27986
- top: activeCellAdornmentRect.top,
27987
- width: activeCellAdornmentRect.width,
27988
- zIndex: 27
27853
+ top: 0,
27854
+ transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27855
+ transformOrigin: "0 0",
27856
+ width: totalWidth
27989
27857
  },
27990
- children: /* @__PURE__ */ jsx3("div", { style: { height: "100%", pointerEvents: "auto", position: "relative", width: "100%" }, children: activeCellAdornment })
27858
+ children: paneDrawingNodes.left
27991
27859
  }
27992
- ) : null
27993
- ] }) : /* @__PURE__ */ jsxs3(
27994
- "table",
27860
+ ) }),
27861
+ /* @__PURE__ */ jsx3("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
27862
+ "div",
27863
+ {
27864
+ ref: canvasCornerOverlayContentRef,
27865
+ style: {
27866
+ height: sheetContentHeight,
27867
+ left: 0,
27868
+ pointerEvents: "none",
27869
+ position: "absolute",
27870
+ top: 0,
27871
+ transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
27872
+ transformOrigin: "0 0",
27873
+ width: totalWidth
27874
+ },
27875
+ children: paneDrawingNodes.corner
27876
+ }
27877
+ ) })
27878
+ ] }) : null
27879
+ ] }),
27880
+ /* @__PURE__ */ jsxs3("div", { style: canvasHeaderViewportLayerStyle, children: [
27881
+ /* @__PURE__ */ jsx3(
27882
+ "canvas",
27995
27883
  {
27996
- ref: tableRef,
27997
- style: {
27998
- borderCollapse: "collapse",
27999
- color: "#000000",
28000
- flex: "0 0 auto",
28001
- tableLayout: "fixed",
28002
- width: totalWidth
28003
- },
28004
- children: [
28005
- /* @__PURE__ */ jsxs3("colgroup", { children: [
28006
- /* @__PURE__ */ jsx3("col", { style: { width: displayRowHeaderWidth } }),
28007
- leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: leadingColumnSpacerWidth } }) : null,
28008
- renderedCols.map((column) => /* @__PURE__ */ jsx3(
28009
- "col",
28010
- {
28011
- ref: (element) => {
28012
- if (element) {
28013
- colElementRefs.current.set(column.actualCol, element);
28014
- } else {
28015
- colElementRefs.current.delete(column.actualCol);
28016
- }
28017
- },
28018
- style: { width: column.size }
28019
- },
28020
- column.key
28021
- )),
28022
- trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: trailingColumnSpacerWidth } }) : null
28023
- ] }),
28024
- /* @__PURE__ */ jsx3("thead", { style: { position: "sticky", top: 0, zIndex: canvasHeaderOverlayZIndex }, children: /* @__PURE__ */ jsxs3("tr", { children: [
28025
- /* @__PURE__ */ jsx3(
28026
- "th",
28027
- {
28028
- style: {
28029
- ...headerCellStyle,
28030
- backgroundColor: palette.headerSurface,
28031
- left: 0,
28032
- width: displayRowHeaderWidth,
28033
- zIndex: cornerHeaderOverlayZIndex
28034
- }
28035
- }
28036
- ),
28037
- leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: leadingColumnSpacerWidth } }) : null,
28038
- renderedCols.map((column) => /* @__PURE__ */ jsx3(
28039
- "th",
28040
- {
28041
- "data-xlsx-col-header": column.actualCol,
28042
- ref: (element) => setColHeaderRef(column.actualCol, element),
28043
- onPointerDown: (event) => handleColumnPointerDown(event, column.actualCol),
28044
- style: {
28045
- ...headerCellStyle,
28046
- left: stickyLeftByCol.get(column.actualCol),
28047
- zIndex: stickyLeftByCol.has(column.actualCol) ? stickyHeaderOverlayZIndex : headerCellStyle.zIndex
28048
- },
28049
- children: /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
28050
- /* @__PURE__ */ jsx3(
28051
- "span",
28052
- {
28053
- style: {
28054
- display: "inline-block",
28055
- transform: headerLabelLiveScale !== 1 ? `scale(${1 / headerLabelLiveScale})` : void 0,
28056
- transformOrigin: "center center"
28057
- },
28058
- children: columnLabel2(column.actualCol)
28059
- }
28060
- ),
28061
- /* @__PURE__ */ jsx3(
28062
- "div",
28063
- {
28064
- onPointerDown: (event) => {
28065
- if (!canResizeHeaders) {
28066
- return;
28067
- }
28068
- event.preventDefault();
28069
- event.stopPropagation();
28070
- startColumnResize(
28071
- event.pointerId,
28072
- column.actualCol,
28073
- column.size,
28074
- event.clientX
28075
- );
28076
- },
28077
- style: columnResizeHandleStyle
28078
- }
28079
- )
28080
- ] })
28081
- },
28082
- column.key
28083
- )),
28084
- trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: trailingColumnSpacerWidth } }) : null
28085
- ] }) }),
28086
- /* @__PURE__ */ jsxs3("tbody", { children: [
28087
- virtualRows.map((virtualRow, index) => {
28088
- const actualRow = visibleRows[virtualRow.index];
28089
- if (actualRow === void 0) {
28090
- return null;
28091
- }
28092
- const previousEnd = index === 0 ? 0 : virtualRows[index - 1]?.end ?? 0;
28093
- const gapHeight = Math.max(0, virtualRow.start - previousEnd);
28094
- return /* @__PURE__ */ jsxs3(React4.Fragment, { children: [
28095
- gapHeight > 0 ? /* @__PURE__ */ jsx3("tr", { "aria-hidden": "true", style: { height: gapHeight }, children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan }) }) : null,
28096
- /* @__PURE__ */ jsx3(
28097
- MemoGridRow,
28098
- {
28099
- actualRow,
28100
- editingCell,
28101
- editingValue,
28102
- frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
28103
- getCellData,
28104
- leadingSpacerWidth: leadingColumnSpacerWidth,
28105
- onCellClick: handleCellClick,
28106
- onCellDoubleClick: handleCellDoubleClick,
28107
- onCellPointerDown: handleCellPointerDown,
28108
- onEditingCancel: cancelEditing,
28109
- onEditingCommit: commitEditing,
28110
- onEditingValueChange: setEditingValue,
28111
- headerLabelLiveScale,
28112
- onRowHeaderRef: setRowHeaderRef,
28113
- onRowPointerDown: handleRowPointerDown,
28114
- onRowResizePointerDown: handleRowResizePointerDown,
28115
- palette,
28116
- readOnly,
28117
- renderCellAdornment,
28118
- rowHeight: virtualRow.size,
28119
- rowHeaderZIndex: rowHeaderOverlayZIndex,
28120
- rowHeaderWidth: displayRowHeaderWidth,
28121
- stickyLeftByCol,
28122
- stickyTop: stickyTopByRow.get(actualRow),
28123
- trailingSpacerWidth: trailingColumnSpacerWidth,
28124
- visibleCols: renderedCols,
28125
- zoomFactor
28126
- },
28127
- virtualRow.key
28128
- )
28129
- ] }, `row-fragment-${virtualRow.key}`);
28130
- }),
28131
- virtualRows.length > 0 && totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight) > 0 ? /* @__PURE__ */ jsx3(
28132
- "tr",
28133
- {
28134
- style: {
28135
- height: totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight)
28136
- },
28137
- children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan })
28138
- }
28139
- ) : null
28140
- ] })
28141
- ]
27884
+ ref: topFrozenHeaderCanvasRef,
27885
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27886
+ onPointerMove: handleCanvasColumnHeaderPointerMove,
27887
+ onPointerDown: handleCanvasColumnHeaderPointerDown,
27888
+ style: canvasTopFrozenHeaderStyle
28142
27889
  }
28143
27890
  ),
28144
27891
  /* @__PURE__ */ jsx3(
28145
- "div",
27892
+ "canvas",
28146
27893
  {
28147
- ref: selectionOverlayRef,
28148
- style: {
28149
- backgroundColor: selectionFill,
28150
- boxSizing: "border-box",
28151
- boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
28152
- contain: "layout paint",
28153
- height: resolvedSelectionOverlay?.height ?? 0,
28154
- left: resolvedSelectionOverlay?.left ?? 0,
28155
- opacity: resolvedSelectionOverlay ? 1 : 0,
28156
- pointerEvents: "none",
28157
- position: "absolute",
28158
- top: resolvedSelectionOverlay?.top ?? 0,
28159
- transition: canvasSelectionTransition,
28160
- visibility: resolvedSelectionOverlay ? "visible" : "hidden",
28161
- willChange: shouldAnimateCanvasSelection ? "left, top, width, height" : void 0,
28162
- width: resolvedSelectionOverlay?.width ?? 0,
28163
- zIndex: 24
28164
- }
27894
+ ref: topScrollHeaderCanvasRef,
27895
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27896
+ onPointerMove: handleCanvasColumnHeaderPointerMove,
27897
+ onPointerDown: handleCanvasColumnHeaderPointerDown,
27898
+ style: canvasTopScrollHeaderStyle
28165
27899
  }
28166
27900
  ),
28167
27901
  /* @__PURE__ */ jsx3(
28168
- "div",
27902
+ "canvas",
28169
27903
  {
28170
- ref: activeValidationOverlayRef,
28171
- "aria-hidden": "true",
28172
- style: {
28173
- alignItems: "center",
28174
- color: palette.mutedText,
28175
- display: "inline-flex",
28176
- fontSize: 10 * zoomFactor,
28177
- fontWeight: 700,
28178
- height: 16 * zoomFactor,
28179
- justifyContent: "center",
28180
- opacity: 0,
28181
- pointerEvents: "none",
28182
- position: "absolute",
28183
- transform: "translateY(-50%)",
28184
- visibility: "hidden",
28185
- width: 12 * zoomFactor,
28186
- zIndex: 26
28187
- },
28188
- children: "\u25BE"
27904
+ ref: leftFrozenHeaderCanvasRef,
27905
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27906
+ onPointerMove: handleCanvasRowHeaderPointerMove,
27907
+ onPointerDown: handleCanvasRowHeaderPointerDown,
27908
+ style: canvasLeftFrozenHeaderStyle
28189
27909
  }
28190
27910
  ),
28191
27911
  /* @__PURE__ */ jsx3(
28192
- "div",
27912
+ "canvas",
28193
27913
  {
28194
- ref: fillHandleRef,
28195
- onPointerDown: (event) => {
28196
- if (readOnly || event.button !== 0 || !normalizedSelection || !resolvedSelectionOverlay) {
28197
- return;
28198
- }
28199
- event.preventDefault();
28200
- event.stopPropagation();
28201
- startFillDrag(event.pointerId, normalizedSelection);
28202
- },
28203
- style: {
28204
- backgroundColor: selectionStroke,
28205
- border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
28206
- contain: "layout paint",
28207
- cursor: "crosshair",
28208
- display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
28209
- height: 8 * zoomFactor,
28210
- left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
28211
- pointerEvents: "auto",
28212
- position: "absolute",
28213
- top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
28214
- transition: shouldAnimateCanvasSelection ? "left 120ms cubic-bezier(0.22, 1, 0.36, 1), top 120ms cubic-bezier(0.22, 1, 0.36, 1)" : "none",
28215
- willChange: shouldAnimateCanvasSelection ? "left, top" : void 0,
28216
- width: 8 * zoomFactor,
28217
- zIndex: 25
28218
- }
27914
+ ref: leftScrollHeaderCanvasRef,
27915
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27916
+ onPointerMove: handleCanvasRowHeaderPointerMove,
27917
+ onPointerDown: handleCanvasRowHeaderPointerDown,
27918
+ style: canvasLeftScrollHeaderStyle
28219
27919
  }
28220
27920
  ),
28221
- resizeGuide ? /* @__PURE__ */ jsx3(
28222
- "div",
28223
- {
28224
- "aria-hidden": "true",
28225
- style: {
28226
- backgroundColor: selectionStroke,
28227
- borderRadius: Math.max(999, 3 * zoomFactor),
28228
- boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
28229
- height: resizeGuide.type === "column" ? Math.max(12, 14 * zoomFactor) : Math.max(3, 2 * zoomFactor),
28230
- left: resizeGuide.type === "column" ? resizeGuide.position - Math.max(2, 1.5 * zoomFactor) : Math.max(3, 4 * zoomFactor),
28231
- pointerEvents: "none",
28232
- position: "absolute",
28233
- top: resizeGuide.type === "column" ? Math.max(2 * zoomFactor, displayHeaderHeight - Math.max(14, 16 * zoomFactor)) : resizeGuide.position - Math.max(2, 1.5 * zoomFactor),
28234
- width: resizeGuide.type === "column" ? Math.max(3, 2 * zoomFactor) : Math.max(12, 14 * zoomFactor),
28235
- zIndex: 52
28236
- }
28237
- }
28238
- ) : null,
28239
- !renderTableHeaderMenu && openTableMenuState ? /* @__PURE__ */ jsx3(
27921
+ /* @__PURE__ */ jsx3("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
27922
+ ] }),
27923
+ editingCell && editingOverlayRect ? (() => {
27924
+ const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
27925
+ const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
27926
+ const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
27927
+ return /* @__PURE__ */ jsx3(
28240
27928
  "div",
28241
27929
  {
28242
- ref: tableMenuRef,
28243
27930
  style: {
28244
- color: palette.text,
28245
- left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
27931
+ left: editingOverlayRect.left,
28246
27932
  position: "absolute",
28247
- top: openTableMenuState.top,
28248
- zIndex: 50
27933
+ top: editingOverlayRect.top,
27934
+ width: editingOverlayRect.width,
27935
+ height: editingOverlayRect.height,
27936
+ zIndex: 28
28249
27937
  },
28250
27938
  children: /* @__PURE__ */ jsx3(
28251
- DefaultTableHeaderMenu,
27939
+ "input",
28252
27940
  {
28253
- cell: { col: openTableMenuState.column.index + openTableMenuState.table.start.col, row: openTableMenuState.table.start.row },
28254
- column: openTableMenuState.column,
28255
- direction: sortState && sortState.tableName === openTableMenuState.table.name && sortState.columnIndex === openTableMenuState.column.index ? sortState.direction : null,
28256
- sortAscending: () => {
28257
- sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "ascending");
28258
- setOpenTableMenu(null);
27941
+ ref: editingInputRef,
27942
+ autoFocus: true,
27943
+ onBlur: commitEditing,
27944
+ onChange: (event) => setEditingValue(event.target.value),
27945
+ onKeyDown: (event) => {
27946
+ event.stopPropagation();
27947
+ if (event.key === "Enter") {
27948
+ event.preventDefault();
27949
+ commitEditing();
27950
+ return;
27951
+ }
27952
+ if (event.key === "Escape") {
27953
+ event.preventDefault();
27954
+ cancelEditing();
27955
+ }
28259
27956
  },
28260
- sortDescending: () => {
28261
- sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "descending");
28262
- setOpenTableMenu(null);
27957
+ style: {
27958
+ backgroundColor: editingBackground,
27959
+ border: 0,
27960
+ boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
27961
+ boxSizing: "border-box",
27962
+ color: editingColor,
27963
+ display: "block",
27964
+ font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
27965
+ height: "100%",
27966
+ margin: 0,
27967
+ minHeight: 0,
27968
+ outline: "none",
27969
+ overflow: "hidden",
27970
+ padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
27971
+ width: "100%"
28263
27972
  },
28264
- table: openTableMenuState.table,
28265
- triggerIcon: "\u25BE",
28266
- triggerProps: { type: "button" }
27973
+ value: editingValue
28267
27974
  }
28268
27975
  )
28269
27976
  }
28270
- ) : null
28271
- ]
28272
- }
28273
- )
27977
+ );
27978
+ })() : null,
27979
+ activeCellAdornment && activeCellAdornmentRect ? /* @__PURE__ */ jsx3(
27980
+ "div",
27981
+ {
27982
+ style: {
27983
+ height: activeCellAdornmentRect.height,
27984
+ left: activeCellAdornmentRect.left,
27985
+ pointerEvents: "none",
27986
+ position: "absolute",
27987
+ top: activeCellAdornmentRect.top,
27988
+ width: activeCellAdornmentRect.width,
27989
+ zIndex: 27
27990
+ },
27991
+ children: /* @__PURE__ */ jsx3("div", { style: { height: "100%", pointerEvents: "auto", position: "relative", width: "100%" }, children: activeCellAdornment })
27992
+ }
27993
+ ) : null
27994
+ ] }) : /* @__PURE__ */ jsxs3(
27995
+ "table",
27996
+ {
27997
+ ref: tableRef,
27998
+ style: {
27999
+ borderCollapse: "collapse",
28000
+ color: "#000000",
28001
+ flex: "0 0 auto",
28002
+ tableLayout: "fixed",
28003
+ width: totalWidth
28004
+ },
28005
+ children: [
28006
+ /* @__PURE__ */ jsxs3("colgroup", { children: [
28007
+ /* @__PURE__ */ jsx3("col", { style: { width: displayRowHeaderWidth } }),
28008
+ leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: leadingColumnSpacerWidth } }) : null,
28009
+ renderedCols.map((column) => /* @__PURE__ */ jsx3(
28010
+ "col",
28011
+ {
28012
+ ref: (element) => {
28013
+ if (element) {
28014
+ colElementRefs.current.set(column.actualCol, element);
28015
+ } else {
28016
+ colElementRefs.current.delete(column.actualCol);
28017
+ }
28018
+ },
28019
+ style: { width: column.size }
28020
+ },
28021
+ column.key
28022
+ )),
28023
+ trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: trailingColumnSpacerWidth } }) : null
28024
+ ] }),
28025
+ /* @__PURE__ */ jsx3("thead", { style: { position: "sticky", top: 0, zIndex: canvasHeaderOverlayZIndex }, children: /* @__PURE__ */ jsxs3("tr", { children: [
28026
+ /* @__PURE__ */ jsx3(
28027
+ "th",
28028
+ {
28029
+ style: {
28030
+ ...headerCellStyle,
28031
+ backgroundColor: palette.headerSurface,
28032
+ left: 0,
28033
+ width: displayRowHeaderWidth,
28034
+ zIndex: cornerHeaderOverlayZIndex
28035
+ }
28036
+ }
28037
+ ),
28038
+ leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: leadingColumnSpacerWidth } }) : null,
28039
+ renderedCols.map((column) => /* @__PURE__ */ jsx3(
28040
+ "th",
28041
+ {
28042
+ "data-xlsx-col-header": column.actualCol,
28043
+ ref: (element) => setColHeaderRef(column.actualCol, element),
28044
+ onPointerDown: (event) => handleColumnPointerDown(event, column.actualCol),
28045
+ style: {
28046
+ ...headerCellStyle,
28047
+ left: stickyLeftByCol.get(column.actualCol),
28048
+ zIndex: stickyLeftByCol.has(column.actualCol) ? stickyHeaderOverlayZIndex : headerCellStyle.zIndex
28049
+ },
28050
+ children: /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
28051
+ /* @__PURE__ */ jsx3(
28052
+ "span",
28053
+ {
28054
+ style: {
28055
+ display: "inline-block",
28056
+ transform: headerLabelLiveScale !== 1 ? `scale(${1 / headerLabelLiveScale})` : void 0,
28057
+ transformOrigin: "center center"
28058
+ },
28059
+ children: columnLabel2(column.actualCol)
28060
+ }
28061
+ ),
28062
+ /* @__PURE__ */ jsx3(
28063
+ "div",
28064
+ {
28065
+ onPointerDown: (event) => {
28066
+ if (!canResizeHeaders) {
28067
+ return;
28068
+ }
28069
+ event.preventDefault();
28070
+ event.stopPropagation();
28071
+ startColumnResize(
28072
+ event.pointerId,
28073
+ column.actualCol,
28074
+ column.size,
28075
+ event.clientX
28076
+ );
28077
+ },
28078
+ style: columnResizeHandleStyle
28079
+ }
28080
+ )
28081
+ ] })
28082
+ },
28083
+ column.key
28084
+ )),
28085
+ trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: trailingColumnSpacerWidth } }) : null
28086
+ ] }) }),
28087
+ /* @__PURE__ */ jsxs3("tbody", { children: [
28088
+ virtualRows.map((virtualRow, index) => {
28089
+ const actualRow = visibleRows[virtualRow.index];
28090
+ if (actualRow === void 0) {
28091
+ return null;
28092
+ }
28093
+ const previousEnd = index === 0 ? 0 : virtualRows[index - 1]?.end ?? 0;
28094
+ const gapHeight = Math.max(0, virtualRow.start - previousEnd);
28095
+ return /* @__PURE__ */ jsxs3(React4.Fragment, { children: [
28096
+ gapHeight > 0 ? /* @__PURE__ */ jsx3("tr", { "aria-hidden": "true", style: { height: gapHeight }, children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan }) }) : null,
28097
+ /* @__PURE__ */ jsx3(
28098
+ MemoGridRow,
28099
+ {
28100
+ actualRow,
28101
+ editingCell,
28102
+ editingValue,
28103
+ frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
28104
+ getCellData,
28105
+ leadingSpacerWidth: leadingColumnSpacerWidth,
28106
+ onCellClick: handleCellClick,
28107
+ onCellDoubleClick: handleCellDoubleClick,
28108
+ onCellPointerDown: handleCellPointerDown,
28109
+ onEditingCancel: cancelEditing,
28110
+ onEditingCommit: commitEditing,
28111
+ onEditingValueChange: setEditingValue,
28112
+ headerLabelLiveScale,
28113
+ onRowHeaderRef: setRowHeaderRef,
28114
+ onRowPointerDown: handleRowPointerDown,
28115
+ onRowResizePointerDown: handleRowResizePointerDown,
28116
+ palette,
28117
+ readOnly,
28118
+ renderCellAdornment,
28119
+ rowHeight: virtualRow.size,
28120
+ rowHeaderZIndex: rowHeaderOverlayZIndex,
28121
+ rowHeaderWidth: displayRowHeaderWidth,
28122
+ stickyLeftByCol,
28123
+ stickyTop: stickyTopByRow.get(actualRow),
28124
+ trailingSpacerWidth: trailingColumnSpacerWidth,
28125
+ visibleCols: renderedCols,
28126
+ zoomFactor
28127
+ },
28128
+ virtualRow.key
28129
+ )
28130
+ ] }, `row-fragment-${virtualRow.key}`);
28131
+ }),
28132
+ virtualRows.length > 0 && totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight) > 0 ? /* @__PURE__ */ jsx3(
28133
+ "tr",
28134
+ {
28135
+ style: {
28136
+ height: totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight)
28137
+ },
28138
+ children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan })
28139
+ }
28140
+ ) : null
28141
+ ] })
28142
+ ]
28143
+ }
28144
+ ),
28145
+ /* @__PURE__ */ jsx3(
28146
+ "div",
28147
+ {
28148
+ ref: selectionOverlayRef,
28149
+ style: {
28150
+ backgroundColor: selectionFill,
28151
+ boxSizing: "border-box",
28152
+ boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
28153
+ contain: "layout paint",
28154
+ height: resolvedSelectionOverlay?.height ?? 0,
28155
+ left: resolvedSelectionOverlay?.left ?? 0,
28156
+ opacity: resolvedSelectionOverlay ? 1 : 0,
28157
+ pointerEvents: "none",
28158
+ position: "absolute",
28159
+ top: resolvedSelectionOverlay?.top ?? 0,
28160
+ transition: canvasSelectionTransition,
28161
+ visibility: resolvedSelectionOverlay ? "visible" : "hidden",
28162
+ willChange: shouldAnimateCanvasSelection ? "left, top, width, height" : void 0,
28163
+ width: resolvedSelectionOverlay?.width ?? 0,
28164
+ zIndex: 24
28165
+ }
28166
+ }
28167
+ ),
28168
+ /* @__PURE__ */ jsx3(
28169
+ "div",
28170
+ {
28171
+ ref: activeValidationOverlayRef,
28172
+ "aria-hidden": "true",
28173
+ style: {
28174
+ alignItems: "center",
28175
+ color: palette.mutedText,
28176
+ display: "inline-flex",
28177
+ fontSize: 10 * zoomFactor,
28178
+ fontWeight: 700,
28179
+ height: 16 * zoomFactor,
28180
+ justifyContent: "center",
28181
+ opacity: 0,
28182
+ pointerEvents: "none",
28183
+ position: "absolute",
28184
+ transform: "translateY(-50%)",
28185
+ visibility: "hidden",
28186
+ width: 12 * zoomFactor,
28187
+ zIndex: 26
28188
+ },
28189
+ children: "\u25BE"
28190
+ }
28191
+ ),
28192
+ /* @__PURE__ */ jsx3(
28193
+ "div",
28194
+ {
28195
+ ref: fillHandleRef,
28196
+ onPointerDown: (event) => {
28197
+ if (readOnly || event.button !== 0 || !normalizedSelection || !resolvedSelectionOverlay) {
28198
+ return;
28199
+ }
28200
+ event.preventDefault();
28201
+ event.stopPropagation();
28202
+ startFillDrag(event.pointerId, normalizedSelection);
28203
+ },
28204
+ style: {
28205
+ backgroundColor: selectionStroke,
28206
+ border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
28207
+ contain: "layout paint",
28208
+ cursor: "crosshair",
28209
+ display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
28210
+ height: 8 * zoomFactor,
28211
+ left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
28212
+ pointerEvents: "auto",
28213
+ position: "absolute",
28214
+ top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
28215
+ transition: shouldAnimateCanvasSelection ? "left 120ms cubic-bezier(0.22, 1, 0.36, 1), top 120ms cubic-bezier(0.22, 1, 0.36, 1)" : "none",
28216
+ willChange: shouldAnimateCanvasSelection ? "left, top" : void 0,
28217
+ width: 8 * zoomFactor,
28218
+ zIndex: 25
28219
+ }
28220
+ }
28221
+ ),
28222
+ resizeGuide ? /* @__PURE__ */ jsx3(
28223
+ "div",
28224
+ {
28225
+ "aria-hidden": "true",
28226
+ style: {
28227
+ backgroundColor: selectionStroke,
28228
+ borderRadius: Math.max(999, 3 * zoomFactor),
28229
+ boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
28230
+ height: resizeGuide.type === "column" ? Math.max(12, 14 * zoomFactor) : Math.max(3, 2 * zoomFactor),
28231
+ left: resizeGuide.type === "column" ? resizeGuide.position - Math.max(2, 1.5 * zoomFactor) : Math.max(3, 4 * zoomFactor),
28232
+ pointerEvents: "none",
28233
+ position: "absolute",
28234
+ top: resizeGuide.type === "column" ? Math.max(2 * zoomFactor, displayHeaderHeight - Math.max(14, 16 * zoomFactor)) : resizeGuide.position - Math.max(2, 1.5 * zoomFactor),
28235
+ width: resizeGuide.type === "column" ? Math.max(3, 2 * zoomFactor) : Math.max(12, 14 * zoomFactor),
28236
+ zIndex: 52
28237
+ }
28238
+ }
28239
+ ) : null,
28240
+ !renderTableHeaderMenu && openTableMenuState ? /* @__PURE__ */ jsx3(
28241
+ "div",
28242
+ {
28243
+ ref: tableMenuRef,
28244
+ style: {
28245
+ color: palette.text,
28246
+ left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
28247
+ position: "absolute",
28248
+ top: openTableMenuState.top,
28249
+ zIndex: 50
28250
+ },
28251
+ children: /* @__PURE__ */ jsx3(
28252
+ DefaultTableHeaderMenu,
28253
+ {
28254
+ cell: { col: openTableMenuState.column.index + openTableMenuState.table.start.col, row: openTableMenuState.table.start.row },
28255
+ column: openTableMenuState.column,
28256
+ direction: sortState && sortState.tableName === openTableMenuState.table.name && sortState.columnIndex === openTableMenuState.column.index ? sortState.direction : null,
28257
+ sortAscending: () => {
28258
+ sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "ascending");
28259
+ setOpenTableMenu(null);
28260
+ },
28261
+ sortDescending: () => {
28262
+ sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "descending");
28263
+ setOpenTableMenu(null);
28264
+ },
28265
+ table: openTableMenuState.table,
28266
+ triggerIcon: "\u25BE",
28267
+ triggerProps: { type: "button" }
28268
+ }
28269
+ )
28270
+ }
28271
+ ) : null
28272
+ ]
28274
28273
  }
28275
28274
  )
28276
- },
28277
- activeTabIndex
28278
- ) });
28275
+ }
28276
+ );
28277
+ return /* @__PURE__ */ jsx3("div", { style: { backgroundColor: palette.canvas, display: "flex", flex: 1, minHeight: 0, minWidth: 0 }, children: renderScroller ? renderScroller({ children: scrollerContent, viewportProps: scrollerViewportProps }) : /* @__PURE__ */ jsx3("div", { ...scrollerViewportProps, children: scrollerContent }) });
28279
28278
  }
28280
28279
  function XlsxViewerInner({
28281
28280
  allowResizeInReadOnly = false,
@@ -28294,6 +28293,7 @@ function XlsxViewerInner({
28294
28293
  renderChartLoading,
28295
28294
  renderImage,
28296
28295
  renderImageSelection,
28296
+ renderScroller,
28297
28297
  renderTableHeaderMenu,
28298
28298
  rounded = true,
28299
28299
  selectionColor,
@@ -28355,6 +28355,7 @@ function XlsxViewerInner({
28355
28355
  renderChartLoading,
28356
28356
  renderImage,
28357
28357
  renderImageSelection,
28358
+ renderScroller,
28358
28359
  renderTableHeaderMenu,
28359
28360
  selectionColor,
28360
28361
  selectionFillColor,