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