@extend-ai/react-xlsx 0.9.1 → 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,
@@ -21605,8 +21606,10 @@ function XlsxGrid({
21605
21606
  const resizeFrameRef = React4.useRef(null);
21606
21607
  const pendingResizePreviewRef = React4.useRef(null);
21607
21608
  const selectionDragRef = React4.useRef(null);
21609
+ const pendingSelectionDragRef = React4.useRef(null);
21608
21610
  const fillDragRef = React4.useRef(null);
21609
21611
  const selectionDragCleanupRef = React4.useRef(null);
21612
+ const pendingSelectionDragCleanupRef = React4.useRef(null);
21610
21613
  const fillDragCleanupRef = React4.useRef(null);
21611
21614
  const cachedScrollerRectRef = React4.useRef(null);
21612
21615
  const imageInteractionCleanupRef = React4.useRef(null);
@@ -22540,7 +22543,7 @@ function XlsxGrid({
22540
22543
  }, [displayedSelection]);
22541
22544
  React4.useEffect(() => {
22542
22545
  const previewRange = selectionPreviewRangeRef.current;
22543
- if (!previewRange || selectionDragRef.current || fillDragRef.current) {
22546
+ if (!previewRange || pendingSelectionDragRef.current || selectionDragRef.current || fillDragRef.current) {
22544
22547
  return;
22545
22548
  }
22546
22549
  if (normalizedSelection && rangesEqual(previewRange, normalizedSelection)) {
@@ -23147,14 +23150,17 @@ function XlsxGrid({
23147
23150
  }
23148
23151
  }, []);
23149
23152
  React4.useEffect(() => {
23153
+ pendingSelectionDragCleanupRef.current?.();
23150
23154
  selectionDragCleanupRef.current?.();
23151
23155
  fillDragCleanupRef.current?.();
23152
23156
  chartInteractionCleanupRef.current?.();
23153
23157
  imageInteractionCleanupRef.current?.();
23158
+ pendingSelectionDragCleanupRef.current = null;
23154
23159
  selectionDragCleanupRef.current = null;
23155
23160
  fillDragCleanupRef.current = null;
23156
23161
  chartInteractionCleanupRef.current = null;
23157
23162
  imageInteractionCleanupRef.current = null;
23163
+ pendingSelectionDragRef.current = null;
23158
23164
  selectionDragRef.current = null;
23159
23165
  fillDragRef.current = null;
23160
23166
  chartInteractionRef.current = null;
@@ -24345,6 +24351,101 @@ function XlsxGrid({
24345
24351
  }
24346
24352
  return normalizeRange2({ start: dragState.anchor, end: cell });
24347
24353
  }
24354
+ function updateSelectionDragPreview(clientX, clientY) {
24355
+ const dragState = selectionDragRef.current;
24356
+ if (!dragState) {
24357
+ return;
24358
+ }
24359
+ const nextCell = resolveDraggedSelectionCell(dragState, clientX, clientY);
24360
+ if (!nextCell) {
24361
+ return;
24362
+ }
24363
+ const nextRange = buildDraggedSelectionRange(dragState, nextCell);
24364
+ if (!nextRange || rangesEqual(nextRange, dragState.previewRange)) {
24365
+ return;
24366
+ }
24367
+ dragState.previewRange = nextRange;
24368
+ selectionPreviewRangeRef.current = nextRange;
24369
+ displayedSelectionRef.current = nextRange;
24370
+ applyPreviewOverlay(nextRange);
24371
+ }
24372
+ function clearPendingSelectionDrag() {
24373
+ const cleanup = pendingSelectionDragCleanupRef.current;
24374
+ pendingSelectionDragCleanupRef.current = null;
24375
+ pendingSelectionDragRef.current = null;
24376
+ cleanup?.();
24377
+ }
24378
+ function finishPendingSelectionDrag() {
24379
+ const pendingState = pendingSelectionDragRef.current;
24380
+ clearPendingSelectionDrag();
24381
+ if (pendingState && !pendingState.committedOnPointerDown) {
24382
+ commitSelectionRange(pendingState.previewRange);
24383
+ }
24384
+ }
24385
+ function promotePendingSelectionDrag(clientX, clientY) {
24386
+ const pendingState = pendingSelectionDragRef.current;
24387
+ if (!pendingState) {
24388
+ return;
24389
+ }
24390
+ clearPendingSelectionDrag();
24391
+ cachedScrollerRectRef.current = scrollRef.current?.getBoundingClientRect() ?? null;
24392
+ pendingState.didDrag = true;
24393
+ selectionDragRef.current = pendingState;
24394
+ selectionPreviewRangeRef.current = pendingState.previewRange;
24395
+ displayedSelectionRef.current = pendingState.previewRange;
24396
+ setInteractionMode("select");
24397
+ document.body.style.userSelect = "none";
24398
+ installSelectionDragListeners(pendingState.pointerId);
24399
+ updateSelectionDragPreview(clientX, clientY);
24400
+ }
24401
+ function installPendingSelectionDragListeners(pointerId, target) {
24402
+ const existingCleanup = pendingSelectionDragCleanupRef.current;
24403
+ pendingSelectionDragCleanupRef.current = null;
24404
+ existingCleanup?.();
24405
+ const pointerTarget = target;
24406
+ try {
24407
+ pointerTarget.setPointerCapture?.(pointerId);
24408
+ } catch {
24409
+ }
24410
+ const handlePointerMove = (event) => {
24411
+ const pointerEvent = event;
24412
+ if (pointerEvent.pointerId !== pointerId) {
24413
+ return;
24414
+ }
24415
+ const pendingState = pendingSelectionDragRef.current;
24416
+ if (!pendingState) {
24417
+ return;
24418
+ }
24419
+ const deltaX = Math.abs(pointerEvent.clientX - pendingState.startClientX);
24420
+ const deltaY = Math.abs(pointerEvent.clientY - pendingState.startClientY);
24421
+ if (deltaX < SELECTION_DRAG_THRESHOLD_PX && deltaY < SELECTION_DRAG_THRESHOLD_PX) {
24422
+ return;
24423
+ }
24424
+ event.preventDefault();
24425
+ promotePendingSelectionDrag(pointerEvent.clientX, pointerEvent.clientY);
24426
+ };
24427
+ const handlePointerEnd = (event) => {
24428
+ const pointerEvent = event;
24429
+ if (pointerEvent.pointerId !== pointerId) {
24430
+ return;
24431
+ }
24432
+ finishPendingSelectionDrag();
24433
+ };
24434
+ target.addEventListener("pointermove", handlePointerMove);
24435
+ target.addEventListener("pointerup", handlePointerEnd);
24436
+ target.addEventListener("pointercancel", handlePointerEnd);
24437
+ pendingSelectionDragCleanupRef.current = () => {
24438
+ target.removeEventListener("pointermove", handlePointerMove);
24439
+ target.removeEventListener("pointerup", handlePointerEnd);
24440
+ target.removeEventListener("pointercancel", handlePointerEnd);
24441
+ try {
24442
+ if (pointerTarget.hasPointerCapture?.(pointerId)) {
24443
+ pointerTarget.releasePointerCapture?.(pointerId);
24444
+ }
24445
+ } catch {
24446
+ }
24447
+ };
24448
+ }
24348
24449
  function installSelectionDragListeners(pointerId) {
24349
24450
  selectionDragCleanupRef.current?.();
24350
24451
  let pendingClientPoint = null;
@@ -24368,18 +24469,7 @@ function XlsxGrid({
24368
24469
  }
24369
24470
  dragState.didDrag = true;
24370
24471
  }
24371
- const nextCell = resolveDraggedSelectionCell(dragState, pendingPoint.x, pendingPoint.y);
24372
- if (!nextCell) {
24373
- return;
24374
- }
24375
- const nextRange = buildDraggedSelectionRange(dragState, nextCell);
24376
- if (!nextRange || rangesEqual(nextRange, dragState.previewRange)) {
24377
- return;
24378
- }
24379
- dragState.previewRange = nextRange;
24380
- selectionPreviewRangeRef.current = nextRange;
24381
- displayedSelectionRef.current = nextRange;
24382
- applyPreviewOverlay(nextRange);
24472
+ updateSelectionDragPreview(pendingPoint.x, pendingPoint.y);
24383
24473
  };
24384
24474
  const handlePointerMove = (event) => {
24385
24475
  if (event.pointerId !== pointerId) {
@@ -24544,6 +24634,7 @@ function XlsxGrid({
24544
24634
  return;
24545
24635
  }
24546
24636
  startCellSelection(
24637
+ event.currentTarget,
24547
24638
  event.pointerId,
24548
24639
  anchor,
24549
24640
  "cell",
@@ -24591,6 +24682,7 @@ function XlsxGrid({
24591
24682
  return;
24592
24683
  }
24593
24684
  startCellSelection(
24685
+ event.currentTarget,
24594
24686
  event.pointerId,
24595
24687
  { row: anchorRow, col: firstVisibleCol },
24596
24688
  "row",
@@ -24621,6 +24713,7 @@ function XlsxGrid({
24621
24713
  return;
24622
24714
  }
24623
24715
  startCellSelection(
24716
+ event.currentTarget,
24624
24717
  event.pointerId,
24625
24718
  { row: firstVisibleRow, col: anchorCol },
24626
24719
  "column",
@@ -24902,6 +24995,7 @@ function XlsxGrid({
24902
24995
  return;
24903
24996
  }
24904
24997
  startCellSelection(
24998
+ event.currentTarget,
24905
24999
  event.pointerId,
24906
25000
  anchor,
24907
25001
  "cell",
@@ -24979,6 +25073,7 @@ function XlsxGrid({
24979
25073
  return;
24980
25074
  }
24981
25075
  startCellSelection(
25076
+ event.currentTarget,
24982
25077
  event.pointerId,
24983
25078
  { row: firstVisibleRow, col: anchorCol },
24984
25079
  "column",
@@ -25036,6 +25131,7 @@ function XlsxGrid({
25036
25131
  return;
25037
25132
  }
25038
25133
  startCellSelection(
25134
+ event.currentTarget,
25039
25135
  event.pointerId,
25040
25136
  { row: anchorRow, col: firstVisibleCol },
25041
25137
  "row",
@@ -27278,9 +27374,10 @@ function XlsxGrid({
27278
27374
  setGlobalCursor("row-resize");
27279
27375
  document.body.style.userSelect = "none";
27280
27376
  }
27281
- function startCellSelection(pointerId, anchor, axis, originCell, pointerOrigin, originOverlayRect, committedOnPointerDown, initialRange, startClientX, startClientY) {
27282
- cachedScrollerRectRef.current = scrollRef.current?.getBoundingClientRect() ?? null;
27283
- selectionDragRef.current = {
27377
+ function startCellSelection(target, pointerId, anchor, axis, originCell, pointerOrigin, originOverlayRect, committedOnPointerDown, initialRange, startClientX, startClientY) {
27378
+ clearPendingSelectionDrag();
27379
+ const previewRange = normalizeRange2(initialRange);
27380
+ pendingSelectionDragRef.current = {
27284
27381
  anchor,
27285
27382
  axis,
27286
27383
  contentScaleX: pointerOrigin.contentScaleX,
@@ -27292,16 +27389,14 @@ function XlsxGrid({
27292
27389
  originContentX: pointerOrigin.originContentX,
27293
27390
  originContentY: pointerOrigin.originContentY,
27294
27391
  pointerId,
27295
- previewRange: normalizeRange2(initialRange),
27392
+ previewRange,
27296
27393
  startClientX,
27297
27394
  startClientY
27298
27395
  };
27299
- selectionPreviewRangeRef.current = normalizeRange2(initialRange);
27300
- displayedSelectionRef.current = selectionPreviewRangeRef.current;
27301
- applyPreviewOverlay(selectionPreviewRangeRef.current);
27302
- setInteractionMode("select");
27303
- document.body.style.userSelect = "none";
27304
- installSelectionDragListeners(pointerId);
27396
+ selectionPreviewRangeRef.current = previewRange;
27397
+ displayedSelectionRef.current = previewRange;
27398
+ applyPreviewOverlay(previewRange);
27399
+ installPendingSelectionDragListeners(pointerId, target);
27305
27400
  }
27306
27401
  function resolveFillRange(sourceRange, cell) {
27307
27402
  const normalizedSource = normalizeRange2(sourceRange);
@@ -27520,700 +27615,698 @@ function XlsxGrid({
27520
27615
  }
27521
27616
  selectCell({ row: nextRow, col: nextCol }, extend ? { extend: true } : void 0);
27522
27617
  }
27523
- 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)(
27524
- "div",
27525
- {
27526
- ref: scrollRef,
27527
- onScroll: handleScrollerScroll,
27528
- onCopy: (event) => {
27529
- if (editingCell) {
27530
- return;
27531
- }
27532
- const clipboard = event.clipboardData;
27533
- const clipboardData = getClipboardData();
27534
- if (!clipboardData) {
27535
- return;
27536
- }
27537
- event.preventDefault();
27538
- if (clipboard) {
27539
- clipboard.setData("text/plain", clipboardData.text);
27540
- clipboard.setData("text/html", clipboardData.html);
27541
- clipboard.setData(INTERNAL_CLIPBOARD_MIME2, clipboardData.structured);
27542
- return;
27543
- }
27544
- void copySelectionToClipboard();
27545
- },
27546
- onKeyDown: (event) => {
27547
- 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();
27548
27649
  return;
27549
27650
  }
27550
- if (!readOnly && (event.metaKey || event.ctrlKey) && !event.altKey) {
27551
- const normalizedKey = event.key.toLowerCase();
27552
- if (normalizedKey === "z" && event.shiftKey) {
27553
- event.preventDefault();
27554
- redo();
27555
- return;
27556
- }
27557
- if (normalizedKey === "z") {
27558
- event.preventDefault();
27559
- undo();
27560
- return;
27561
- }
27562
- if (normalizedKey === "y") {
27563
- event.preventDefault();
27564
- redo();
27565
- return;
27566
- }
27567
- }
27568
- const currentCell = resolveCurrentCell();
27569
- if (!currentCell) {
27651
+ if (normalizedKey === "z") {
27652
+ event.preventDefault();
27653
+ undo();
27570
27654
  return;
27571
27655
  }
27572
- const currentRowIndex = rowIndexByActual.get(currentCell.row) ?? 0;
27573
- const currentColIndex = colIndexByActual.get(currentCell.col) ?? 0;
27574
- if (!readOnly && isPrintableKey(event)) {
27656
+ if (normalizedKey === "y") {
27575
27657
  event.preventDefault();
27576
- startEditing(currentCell, event.key);
27658
+ redo();
27577
27659
  return;
27578
27660
  }
27579
- switch (event.key) {
27580
- case "ArrowDown":
27581
- event.preventDefault();
27582
- moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, event.shiftKey);
27583
- break;
27584
- case "ArrowUp":
27585
- event.preventDefault();
27586
- moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, event.shiftKey);
27587
- break;
27588
- case "ArrowLeft":
27589
- event.preventDefault();
27590
- 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) {
27591
27701
  break;
27592
- case "ArrowRight":
27593
- event.preventDefault();
27594
- 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);
27595
27705
  break;
27596
- 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) {
27597
27712
  event.preventDefault();
27598
- moveSelection(
27599
- currentRowIndex,
27600
- event.shiftKey ? Math.max(currentColIndex - 1, 0) : Math.min(currentColIndex + 1, visibleCols.length - 1),
27601
- false
27602
- );
27603
- break;
27604
- case "Enter":
27713
+ clearSelectedCells();
27714
+ }
27715
+ break;
27716
+ case "F2":
27717
+ if (!readOnly) {
27605
27718
  event.preventDefault();
27606
- if (event.metaKey || event.ctrlKey || event.altKey) {
27607
- break;
27608
- }
27609
- if (event.shiftKey) {
27610
- moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, false);
27611
- break;
27612
- }
27613
- moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, false);
27614
- break;
27615
- case "Backspace":
27616
- case "Delete":
27617
- if (!readOnly) {
27618
- event.preventDefault();
27619
- clearSelectedCells();
27620
- }
27621
- break;
27622
- case "F2":
27623
- if (!readOnly) {
27624
- event.preventDefault();
27625
- startEditing(currentCell);
27626
- }
27627
- break;
27628
- default:
27629
- break;
27630
- }
27631
- },
27632
- onPaste: (event) => {
27633
- if (editingCell || readOnly) {
27634
- return;
27635
- }
27636
- const clipboard = event.clipboardData;
27637
- if (!clipboard) {
27638
- event.preventDefault();
27639
- void pasteFromClipboard();
27640
- return;
27641
- }
27642
- const structuredPayload = clipboard.getData(INTERNAL_CLIPBOARD_MIME2);
27643
- const textPayload = clipboard.getData("text/plain");
27644
- if (!structuredPayload && !textPayload) {
27645
- return;
27646
- }
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) {
27647
27732
  event.preventDefault();
27648
- if (structuredPayload) {
27649
- pasteStructuredClipboardData(structuredPayload);
27650
- return;
27651
- }
27652
- pasteText(textPayload);
27653
- },
27654
- 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
+ {
27655
27769
  style: {
27656
- ["--xlsx-menu-active"]: selectionFill,
27657
- ["--xlsx-menu-border"]: palette.strongBorder,
27658
- ["--xlsx-menu-surface"]: palette.surface,
27659
- ["--xlsx-selection-header"]: selectionHeaderSurface,
27660
- backgroundColor: palette.canvas,
27661
- color: palette.text,
27662
- cursor: resizeGuide?.type === "column" ? "col-resize" : resizeGuide?.type === "row" ? "row-resize" : void 0,
27663
- flex: 1,
27664
- height: "100%",
27665
- minHeight: 0,
27666
- minWidth: 0,
27667
- outline: "none",
27668
- overflow: "auto",
27669
- width: "100%"
27770
+ backgroundColor: resolveSheetSurface(activeSheet, palette),
27771
+ minHeight: "100%",
27772
+ minWidth: "100%",
27773
+ position: "relative",
27774
+ width: totalWidth,
27775
+ height: sheetContentHeight
27670
27776
  },
27671
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27777
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
27672
27778
  "div",
27673
27779
  {
27780
+ ref: wrapperRef,
27674
27781
  style: {
27675
- backgroundColor: resolveSheetSurface(activeSheet, palette),
27676
- minHeight: "100%",
27677
- minWidth: "100%",
27678
- position: "relative",
27679
- width: totalWidth,
27680
- 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
27681
27791
  },
27682
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
27683
- "div",
27684
- {
27685
- ref: wrapperRef,
27686
- style: {
27687
- height: sheetContentHeight,
27688
- left: 0,
27689
- position: "absolute",
27690
- top: 0,
27691
- transform: !experimentalCanvas && isLiveZooming ? `translate3d(${liveZoomTranslateX}px, ${liveZoomTranslateY}px, 0) scale(${liveZoomScale})` : void 0,
27692
- transformOrigin: "0 0",
27693
- transition: "none",
27694
- willChange: !experimentalCanvas && isLiveZooming ? "transform" : void 0,
27695
- width: totalWidth
27696
- },
27697
- children: [
27698
- showImages && !experimentalCanvas ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27699
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: topOverlayStyle, children: paneDrawingNodes.top }),
27700
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: leftOverlayStyle, children: paneDrawingNodes.left }),
27701
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cornerOverlayStyle, children: paneDrawingNodes.corner }),
27702
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: scrollOverlayStyle, children: paneDrawingNodes.scroll })
27703
- ] }) : null,
27704
- experimentalCanvas ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27705
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: canvasBodyViewportLayerStyle, children: [
27706
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27707
- "canvas",
27708
- {
27709
- ref: scrollBodyCanvasRef,
27710
- onClick: handleCanvasBodyClick,
27711
- onDoubleClick: handleCanvasBodyDoubleClick,
27712
- onPointerDown: handleCanvasBodyPointerDown,
27713
- style: canvasScrollBodyStyle
27714
- }
27715
- ),
27716
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27717
- "canvas",
27718
- {
27719
- ref: topBodyCanvasRef,
27720
- onClick: handleCanvasBodyClick,
27721
- onDoubleClick: handleCanvasBodyDoubleClick,
27722
- onPointerDown: handleCanvasBodyPointerDown,
27723
- style: canvasTopBodyStyle
27724
- }
27725
- ),
27726
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27727
- "canvas",
27728
- {
27729
- ref: leftBodyCanvasRef,
27730
- onClick: handleCanvasBodyClick,
27731
- onDoubleClick: handleCanvasBodyDoubleClick,
27732
- onPointerDown: handleCanvasBodyPointerDown,
27733
- style: canvasLeftBodyStyle
27734
- }
27735
- ),
27736
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27737
- "canvas",
27738
- {
27739
- ref: cornerBodyCanvasRef,
27740
- onClick: handleCanvasBodyClick,
27741
- onDoubleClick: handleCanvasBodyDoubleClick,
27742
- onPointerDown: handleCanvasBodyPointerDown,
27743
- style: canvasCornerBodyStyle
27744
- }
27745
- ),
27746
- hasCanvasDomDrawingOverlays ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
27747
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasScrollOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27748
- "div",
27749
- {
27750
- ref: canvasScrollOverlayContentRef,
27751
- style: {
27752
- height: sheetContentHeight,
27753
- left: 0,
27754
- pointerEvents: "none",
27755
- position: "absolute",
27756
- top: 0,
27757
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27758
- transformOrigin: "0 0",
27759
- width: totalWidth
27760
- },
27761
- children: paneDrawingNodes.scroll
27762
- }
27763
- ) }),
27764
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27765
- "div",
27766
- {
27767
- ref: canvasTopOverlayContentRef,
27768
- style: {
27769
- height: sheetContentHeight,
27770
- left: 0,
27771
- pointerEvents: "none",
27772
- position: "absolute",
27773
- top: 0,
27774
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
27775
- transformOrigin: "0 0",
27776
- width: totalWidth
27777
- },
27778
- children: paneDrawingNodes.top
27779
- }
27780
- ) }),
27781
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27782
- "div",
27783
- {
27784
- ref: canvasLeftOverlayContentRef,
27785
- style: {
27786
- height: sheetContentHeight,
27787
- left: 0,
27788
- pointerEvents: "none",
27789
- position: "absolute",
27790
- top: 0,
27791
- transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27792
- transformOrigin: "0 0",
27793
- width: totalWidth
27794
- },
27795
- children: paneDrawingNodes.left
27796
- }
27797
- ) }),
27798
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27799
- "div",
27800
- {
27801
- ref: canvasCornerOverlayContentRef,
27802
- style: {
27803
- height: sheetContentHeight,
27804
- left: 0,
27805
- pointerEvents: "none",
27806
- position: "absolute",
27807
- top: 0,
27808
- transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
27809
- transformOrigin: "0 0",
27810
- width: totalWidth
27811
- },
27812
- children: paneDrawingNodes.corner
27813
- }
27814
- ) })
27815
- ] }) : null
27816
- ] }),
27817
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: canvasHeaderViewportLayerStyle, children: [
27818
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27819
- "canvas",
27820
- {
27821
- ref: topFrozenHeaderCanvasRef,
27822
- onPointerLeave: handleCanvasHeaderPointerLeave,
27823
- onPointerMove: handleCanvasColumnHeaderPointerMove,
27824
- onPointerDown: handleCanvasColumnHeaderPointerDown,
27825
- style: canvasTopFrozenHeaderStyle
27826
- }
27827
- ),
27828
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27829
- "canvas",
27830
- {
27831
- ref: topScrollHeaderCanvasRef,
27832
- onPointerLeave: handleCanvasHeaderPointerLeave,
27833
- onPointerMove: handleCanvasColumnHeaderPointerMove,
27834
- onPointerDown: handleCanvasColumnHeaderPointerDown,
27835
- style: canvasTopScrollHeaderStyle
27836
- }
27837
- ),
27838
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27839
- "canvas",
27840
- {
27841
- ref: leftFrozenHeaderCanvasRef,
27842
- onPointerLeave: handleCanvasHeaderPointerLeave,
27843
- onPointerMove: handleCanvasRowHeaderPointerMove,
27844
- onPointerDown: handleCanvasRowHeaderPointerDown,
27845
- style: canvasLeftFrozenHeaderStyle
27846
- }
27847
- ),
27848
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27849
- "canvas",
27850
- {
27851
- ref: leftScrollHeaderCanvasRef,
27852
- onPointerLeave: handleCanvasHeaderPointerLeave,
27853
- onPointerMove: handleCanvasRowHeaderPointerMove,
27854
- onPointerDown: handleCanvasRowHeaderPointerDown,
27855
- style: canvasLeftScrollHeaderStyle
27856
- }
27857
- ),
27858
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
27859
- ] }),
27860
- editingCell && editingOverlayRect ? (() => {
27861
- const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
27862
- const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
27863
- const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
27864
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27865
- "div",
27866
- {
27867
- style: {
27868
- left: editingOverlayRect.left,
27869
- position: "absolute",
27870
- top: editingOverlayRect.top,
27871
- width: editingOverlayRect.width,
27872
- height: editingOverlayRect.height,
27873
- zIndex: 28
27874
- },
27875
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27876
- "input",
27877
- {
27878
- ref: editingInputRef,
27879
- autoFocus: true,
27880
- onBlur: commitEditing,
27881
- onChange: (event) => setEditingValue(event.target.value),
27882
- onKeyDown: (event) => {
27883
- event.stopPropagation();
27884
- if (event.key === "Enter") {
27885
- event.preventDefault();
27886
- commitEditing();
27887
- return;
27888
- }
27889
- if (event.key === "Escape") {
27890
- event.preventDefault();
27891
- cancelEditing();
27892
- }
27893
- },
27894
- style: {
27895
- backgroundColor: editingBackground,
27896
- border: 0,
27897
- boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
27898
- boxSizing: "border-box",
27899
- color: editingColor,
27900
- display: "block",
27901
- font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
27902
- height: "100%",
27903
- margin: 0,
27904
- minHeight: 0,
27905
- outline: "none",
27906
- overflow: "hidden",
27907
- padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
27908
- width: "100%"
27909
- },
27910
- value: editingValue
27911
- }
27912
- )
27913
- }
27914
- );
27915
- })() : null,
27916
- 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)(
27917
27860
  "div",
27918
27861
  {
27862
+ ref: canvasTopOverlayContentRef,
27919
27863
  style: {
27920
- height: activeCellAdornmentRect.height,
27921
- left: activeCellAdornmentRect.left,
27864
+ height: sheetContentHeight,
27865
+ left: 0,
27922
27866
  pointerEvents: "none",
27923
27867
  position: "absolute",
27924
- top: activeCellAdornmentRect.top,
27925
- width: activeCellAdornmentRect.width,
27926
- zIndex: 27
27868
+ top: 0,
27869
+ transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
27870
+ transformOrigin: "0 0",
27871
+ width: totalWidth
27927
27872
  },
27928
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { height: "100%", pointerEvents: "auto", position: "relative", width: "100%" }, children: activeCellAdornment })
27873
+ children: paneDrawingNodes.top
27929
27874
  }
27930
- ) : null
27931
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
27932
- "table",
27875
+ ) }),
27876
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27877
+ "div",
27878
+ {
27879
+ ref: canvasLeftOverlayContentRef,
27880
+ style: {
27881
+ height: sheetContentHeight,
27882
+ left: 0,
27883
+ pointerEvents: "none",
27884
+ position: "absolute",
27885
+ top: 0,
27886
+ transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
27887
+ transformOrigin: "0 0",
27888
+ width: totalWidth
27889
+ },
27890
+ children: paneDrawingNodes.left
27891
+ }
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",
27933
27915
  {
27934
- ref: tableRef,
27935
- style: {
27936
- borderCollapse: "collapse",
27937
- color: "#000000",
27938
- flex: "0 0 auto",
27939
- tableLayout: "fixed",
27940
- width: totalWidth
27941
- },
27942
- children: [
27943
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("colgroup", { children: [
27944
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: displayRowHeaderWidth } }),
27945
- leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: leadingColumnSpacerWidth } }) : null,
27946
- renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27947
- "col",
27948
- {
27949
- ref: (element) => {
27950
- if (element) {
27951
- colElementRefs.current.set(column.actualCol, element);
27952
- } else {
27953
- colElementRefs.current.delete(column.actualCol);
27954
- }
27955
- },
27956
- style: { width: column.size }
27957
- },
27958
- column.key
27959
- )),
27960
- trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: trailingColumnSpacerWidth } }) : null
27961
- ] }),
27962
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { style: { position: "sticky", top: 0, zIndex: canvasHeaderOverlayZIndex }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { children: [
27963
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27964
- "th",
27965
- {
27966
- style: {
27967
- ...headerCellStyle,
27968
- backgroundColor: palette.headerSurface,
27969
- left: 0,
27970
- width: displayRowHeaderWidth,
27971
- zIndex: cornerHeaderOverlayZIndex
27972
- }
27973
- }
27974
- ),
27975
- leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: leadingColumnSpacerWidth } }) : null,
27976
- renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27977
- "th",
27978
- {
27979
- "data-xlsx-col-header": column.actualCol,
27980
- ref: (element) => setColHeaderRef(column.actualCol, element),
27981
- onPointerDown: (event) => handleColumnPointerDown(event, column.actualCol),
27982
- style: {
27983
- ...headerCellStyle,
27984
- left: stickyLeftByCol.get(column.actualCol),
27985
- zIndex: stickyLeftByCol.has(column.actualCol) ? stickyHeaderOverlayZIndex : headerCellStyle.zIndex
27986
- },
27987
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { position: "relative" }, children: [
27988
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
27989
- "span",
27990
- {
27991
- style: {
27992
- display: "inline-block",
27993
- transform: headerLabelLiveScale !== 1 ? `scale(${1 / headerLabelLiveScale})` : void 0,
27994
- transformOrigin: "center center"
27995
- },
27996
- children: columnLabel2(column.actualCol)
27997
- }
27998
- ),
27999
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28000
- "div",
28001
- {
28002
- onPointerDown: (event) => {
28003
- if (!canResizeHeaders) {
28004
- return;
28005
- }
28006
- event.preventDefault();
28007
- event.stopPropagation();
28008
- startColumnResize(
28009
- event.pointerId,
28010
- column.actualCol,
28011
- column.size,
28012
- event.clientX
28013
- );
28014
- },
28015
- style: columnResizeHandleStyle
28016
- }
28017
- )
28018
- ] })
28019
- },
28020
- column.key
28021
- )),
28022
- trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: trailingColumnSpacerWidth } }) : null
28023
- ] }) }),
28024
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tbody", { children: [
28025
- virtualRows.map((virtualRow, index) => {
28026
- const actualRow = visibleRows[virtualRow.index];
28027
- if (actualRow === void 0) {
28028
- return null;
28029
- }
28030
- const previousEnd = index === 0 ? 0 : virtualRows[index - 1]?.end ?? 0;
28031
- const gapHeight = Math.max(0, virtualRow.start - previousEnd);
28032
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React4.Fragment, { children: [
28033
- 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,
28034
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28035
- MemoGridRow,
28036
- {
28037
- actualRow,
28038
- editingCell,
28039
- editingValue,
28040
- frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
28041
- getCellData,
28042
- leadingSpacerWidth: leadingColumnSpacerWidth,
28043
- onCellClick: handleCellClick,
28044
- onCellDoubleClick: handleCellDoubleClick,
28045
- onCellPointerDown: handleCellPointerDown,
28046
- onEditingCancel: cancelEditing,
28047
- onEditingCommit: commitEditing,
28048
- onEditingValueChange: setEditingValue,
28049
- headerLabelLiveScale,
28050
- onRowHeaderRef: setRowHeaderRef,
28051
- onRowPointerDown: handleRowPointerDown,
28052
- onRowResizePointerDown: handleRowResizePointerDown,
28053
- palette,
28054
- readOnly,
28055
- renderCellAdornment,
28056
- rowHeight: virtualRow.size,
28057
- rowHeaderZIndex: rowHeaderOverlayZIndex,
28058
- rowHeaderWidth: displayRowHeaderWidth,
28059
- stickyLeftByCol,
28060
- stickyTop: stickyTopByRow.get(actualRow),
28061
- trailingSpacerWidth: trailingColumnSpacerWidth,
28062
- visibleCols: renderedCols,
28063
- zoomFactor
28064
- },
28065
- virtualRow.key
28066
- )
28067
- ] }, `row-fragment-${virtualRow.key}`);
28068
- }),
28069
- virtualRows.length > 0 && totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28070
- "tr",
28071
- {
28072
- style: {
28073
- height: totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight)
28074
- },
28075
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { colSpan: rowColSpan })
28076
- }
28077
- ) : null
28078
- ] })
28079
- ]
27916
+ ref: topFrozenHeaderCanvasRef,
27917
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27918
+ onPointerMove: handleCanvasColumnHeaderPointerMove,
27919
+ onPointerDown: handleCanvasColumnHeaderPointerDown,
27920
+ style: canvasTopFrozenHeaderStyle
28080
27921
  }
28081
27922
  ),
28082
27923
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28083
- "div",
27924
+ "canvas",
28084
27925
  {
28085
- ref: selectionOverlayRef,
28086
- style: {
28087
- backgroundColor: selectionFill,
28088
- boxSizing: "border-box",
28089
- boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
28090
- contain: "layout paint",
28091
- height: resolvedSelectionOverlay?.height ?? 0,
28092
- left: resolvedSelectionOverlay?.left ?? 0,
28093
- opacity: resolvedSelectionOverlay ? 1 : 0,
28094
- pointerEvents: "none",
28095
- position: "absolute",
28096
- top: resolvedSelectionOverlay?.top ?? 0,
28097
- transition: canvasSelectionTransition,
28098
- visibility: resolvedSelectionOverlay ? "visible" : "hidden",
28099
- willChange: shouldAnimateCanvasSelection ? "left, top, width, height" : void 0,
28100
- width: resolvedSelectionOverlay?.width ?? 0,
28101
- zIndex: 24
28102
- }
27926
+ ref: topScrollHeaderCanvasRef,
27927
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27928
+ onPointerMove: handleCanvasColumnHeaderPointerMove,
27929
+ onPointerDown: handleCanvasColumnHeaderPointerDown,
27930
+ style: canvasTopScrollHeaderStyle
28103
27931
  }
28104
27932
  ),
28105
27933
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28106
- "div",
27934
+ "canvas",
28107
27935
  {
28108
- ref: activeValidationOverlayRef,
28109
- "aria-hidden": "true",
28110
- style: {
28111
- alignItems: "center",
28112
- color: palette.mutedText,
28113
- display: "inline-flex",
28114
- fontSize: 10 * zoomFactor,
28115
- fontWeight: 700,
28116
- height: 16 * zoomFactor,
28117
- justifyContent: "center",
28118
- opacity: 0,
28119
- pointerEvents: "none",
28120
- position: "absolute",
28121
- transform: "translateY(-50%)",
28122
- visibility: "hidden",
28123
- width: 12 * zoomFactor,
28124
- zIndex: 26
28125
- },
28126
- children: "\u25BE"
27936
+ ref: leftFrozenHeaderCanvasRef,
27937
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27938
+ onPointerMove: handleCanvasRowHeaderPointerMove,
27939
+ onPointerDown: handleCanvasRowHeaderPointerDown,
27940
+ style: canvasLeftFrozenHeaderStyle
28127
27941
  }
28128
27942
  ),
28129
27943
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28130
- "div",
27944
+ "canvas",
28131
27945
  {
28132
- ref: fillHandleRef,
28133
- onPointerDown: (event) => {
28134
- if (readOnly || event.button !== 0 || !normalizedSelection || !resolvedSelectionOverlay) {
28135
- return;
28136
- }
28137
- event.preventDefault();
28138
- event.stopPropagation();
28139
- startFillDrag(event.pointerId, normalizedSelection);
28140
- },
28141
- style: {
28142
- backgroundColor: selectionStroke,
28143
- border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
28144
- contain: "layout paint",
28145
- cursor: "crosshair",
28146
- display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
28147
- height: 8 * zoomFactor,
28148
- left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
28149
- pointerEvents: "auto",
28150
- position: "absolute",
28151
- top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
28152
- transition: shouldAnimateCanvasSelection ? "left 120ms cubic-bezier(0.22, 1, 0.36, 1), top 120ms cubic-bezier(0.22, 1, 0.36, 1)" : "none",
28153
- willChange: shouldAnimateCanvasSelection ? "left, top" : void 0,
28154
- width: 8 * zoomFactor,
28155
- zIndex: 25
28156
- }
27946
+ ref: leftScrollHeaderCanvasRef,
27947
+ onPointerLeave: handleCanvasHeaderPointerLeave,
27948
+ onPointerMove: handleCanvasRowHeaderPointerMove,
27949
+ onPointerDown: handleCanvasRowHeaderPointerDown,
27950
+ style: canvasLeftScrollHeaderStyle
28157
27951
  }
28158
27952
  ),
28159
- resizeGuide ? /* @__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)(
28160
27960
  "div",
28161
27961
  {
28162
- "aria-hidden": "true",
28163
27962
  style: {
28164
- backgroundColor: selectionStroke,
28165
- borderRadius: Math.max(999, 3 * zoomFactor),
28166
- boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
28167
- height: resizeGuide.type === "column" ? Math.max(12, 14 * zoomFactor) : Math.max(3, 2 * zoomFactor),
28168
- left: resizeGuide.type === "column" ? resizeGuide.position - Math.max(2, 1.5 * zoomFactor) : Math.max(3, 4 * zoomFactor),
28169
- pointerEvents: "none",
27963
+ left: editingOverlayRect.left,
28170
27964
  position: "absolute",
28171
- top: resizeGuide.type === "column" ? Math.max(2 * zoomFactor, displayHeaderHeight - Math.max(14, 16 * zoomFactor)) : resizeGuide.position - Math.max(2, 1.5 * zoomFactor),
28172
- width: resizeGuide.type === "column" ? Math.max(3, 2 * zoomFactor) : Math.max(12, 14 * zoomFactor),
28173
- zIndex: 52
28174
- }
28175
- }
28176
- ) : null,
28177
- !renderTableHeaderMenu && openTableMenuState ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28178
- "div",
28179
- {
28180
- ref: tableMenuRef,
28181
- style: {
28182
- color: palette.text,
28183
- left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
28184
- position: "absolute",
28185
- top: openTableMenuState.top,
28186
- zIndex: 50
27965
+ top: editingOverlayRect.top,
27966
+ width: editingOverlayRect.width,
27967
+ height: editingOverlayRect.height,
27968
+ zIndex: 28
28187
27969
  },
28188
27970
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
28189
- DefaultTableHeaderMenu,
27971
+ "input",
28190
27972
  {
28191
- cell: { col: openTableMenuState.column.index + openTableMenuState.table.start.col, row: openTableMenuState.table.start.row },
28192
- column: openTableMenuState.column,
28193
- direction: sortState && sortState.tableName === openTableMenuState.table.name && sortState.columnIndex === openTableMenuState.column.index ? sortState.direction : null,
28194
- sortAscending: () => {
28195
- sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "ascending");
28196
- 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
+ }
28197
27988
  },
28198
- sortDescending: () => {
28199
- sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "descending");
28200
- 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%"
28201
28004
  },
28202
- table: openTableMenuState.table,
28203
- triggerIcon: "\u25BE",
28204
- triggerProps: { type: "button" }
28005
+ value: editingValue
28205
28006
  }
28206
28007
  )
28207
28008
  }
28208
- ) : null
28209
- ]
28210
- }
28211
- )
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
+ ]
28212
28305
  }
28213
28306
  )
28214
- },
28215
- activeTabIndex
28216
- ) });
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 }) });
28217
28310
  }
28218
28311
  function XlsxViewerInner({
28219
28312
  allowResizeInReadOnly = false,
@@ -28232,6 +28325,7 @@ function XlsxViewerInner({
28232
28325
  renderChartLoading,
28233
28326
  renderImage,
28234
28327
  renderImageSelection,
28328
+ renderScroller,
28235
28329
  renderTableHeaderMenu,
28236
28330
  rounded = true,
28237
28331
  selectionColor,
@@ -28293,6 +28387,7 @@ function XlsxViewerInner({
28293
28387
  renderChartLoading,
28294
28388
  renderImage,
28295
28389
  renderImageSelection,
28390
+ renderScroller,
28296
28391
  renderTableHeaderMenu,
28297
28392
  selectionColor,
28298
28393
  selectionFillColor,