@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/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/index.cjs +758 -663
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +758 -663
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -21433,6 +21433,7 @@ function XlsxGrid({
|
|
|
21433
21433
|
renderImage,
|
|
21434
21434
|
renderImageSelection,
|
|
21435
21435
|
renderTableHeaderMenu,
|
|
21436
|
+
renderScroller,
|
|
21436
21437
|
enableGestureZoom = true,
|
|
21437
21438
|
experimentalCanvas = true,
|
|
21438
21439
|
selectionColor,
|
|
@@ -21573,8 +21574,10 @@ function XlsxGrid({
|
|
|
21573
21574
|
const resizeFrameRef = React4.useRef(null);
|
|
21574
21575
|
const pendingResizePreviewRef = React4.useRef(null);
|
|
21575
21576
|
const selectionDragRef = React4.useRef(null);
|
|
21577
|
+
const pendingSelectionDragRef = React4.useRef(null);
|
|
21576
21578
|
const fillDragRef = React4.useRef(null);
|
|
21577
21579
|
const selectionDragCleanupRef = React4.useRef(null);
|
|
21580
|
+
const pendingSelectionDragCleanupRef = React4.useRef(null);
|
|
21578
21581
|
const fillDragCleanupRef = React4.useRef(null);
|
|
21579
21582
|
const cachedScrollerRectRef = React4.useRef(null);
|
|
21580
21583
|
const imageInteractionCleanupRef = React4.useRef(null);
|
|
@@ -22508,7 +22511,7 @@ function XlsxGrid({
|
|
|
22508
22511
|
}, [displayedSelection]);
|
|
22509
22512
|
React4.useEffect(() => {
|
|
22510
22513
|
const previewRange = selectionPreviewRangeRef.current;
|
|
22511
|
-
if (!previewRange || selectionDragRef.current || fillDragRef.current) {
|
|
22514
|
+
if (!previewRange || pendingSelectionDragRef.current || selectionDragRef.current || fillDragRef.current) {
|
|
22512
22515
|
return;
|
|
22513
22516
|
}
|
|
22514
22517
|
if (normalizedSelection && rangesEqual(previewRange, normalizedSelection)) {
|
|
@@ -23115,14 +23118,17 @@ function XlsxGrid({
|
|
|
23115
23118
|
}
|
|
23116
23119
|
}, []);
|
|
23117
23120
|
React4.useEffect(() => {
|
|
23121
|
+
pendingSelectionDragCleanupRef.current?.();
|
|
23118
23122
|
selectionDragCleanupRef.current?.();
|
|
23119
23123
|
fillDragCleanupRef.current?.();
|
|
23120
23124
|
chartInteractionCleanupRef.current?.();
|
|
23121
23125
|
imageInteractionCleanupRef.current?.();
|
|
23126
|
+
pendingSelectionDragCleanupRef.current = null;
|
|
23122
23127
|
selectionDragCleanupRef.current = null;
|
|
23123
23128
|
fillDragCleanupRef.current = null;
|
|
23124
23129
|
chartInteractionCleanupRef.current = null;
|
|
23125
23130
|
imageInteractionCleanupRef.current = null;
|
|
23131
|
+
pendingSelectionDragRef.current = null;
|
|
23126
23132
|
selectionDragRef.current = null;
|
|
23127
23133
|
fillDragRef.current = null;
|
|
23128
23134
|
chartInteractionRef.current = null;
|
|
@@ -24313,6 +24319,101 @@ function XlsxGrid({
|
|
|
24313
24319
|
}
|
|
24314
24320
|
return normalizeRange2({ start: dragState.anchor, end: cell });
|
|
24315
24321
|
}
|
|
24322
|
+
function updateSelectionDragPreview(clientX, clientY) {
|
|
24323
|
+
const dragState = selectionDragRef.current;
|
|
24324
|
+
if (!dragState) {
|
|
24325
|
+
return;
|
|
24326
|
+
}
|
|
24327
|
+
const nextCell = resolveDraggedSelectionCell(dragState, clientX, clientY);
|
|
24328
|
+
if (!nextCell) {
|
|
24329
|
+
return;
|
|
24330
|
+
}
|
|
24331
|
+
const nextRange = buildDraggedSelectionRange(dragState, nextCell);
|
|
24332
|
+
if (!nextRange || rangesEqual(nextRange, dragState.previewRange)) {
|
|
24333
|
+
return;
|
|
24334
|
+
}
|
|
24335
|
+
dragState.previewRange = nextRange;
|
|
24336
|
+
selectionPreviewRangeRef.current = nextRange;
|
|
24337
|
+
displayedSelectionRef.current = nextRange;
|
|
24338
|
+
applyPreviewOverlay(nextRange);
|
|
24339
|
+
}
|
|
24340
|
+
function clearPendingSelectionDrag() {
|
|
24341
|
+
const cleanup = pendingSelectionDragCleanupRef.current;
|
|
24342
|
+
pendingSelectionDragCleanupRef.current = null;
|
|
24343
|
+
pendingSelectionDragRef.current = null;
|
|
24344
|
+
cleanup?.();
|
|
24345
|
+
}
|
|
24346
|
+
function finishPendingSelectionDrag() {
|
|
24347
|
+
const pendingState = pendingSelectionDragRef.current;
|
|
24348
|
+
clearPendingSelectionDrag();
|
|
24349
|
+
if (pendingState && !pendingState.committedOnPointerDown) {
|
|
24350
|
+
commitSelectionRange(pendingState.previewRange);
|
|
24351
|
+
}
|
|
24352
|
+
}
|
|
24353
|
+
function promotePendingSelectionDrag(clientX, clientY) {
|
|
24354
|
+
const pendingState = pendingSelectionDragRef.current;
|
|
24355
|
+
if (!pendingState) {
|
|
24356
|
+
return;
|
|
24357
|
+
}
|
|
24358
|
+
clearPendingSelectionDrag();
|
|
24359
|
+
cachedScrollerRectRef.current = scrollRef.current?.getBoundingClientRect() ?? null;
|
|
24360
|
+
pendingState.didDrag = true;
|
|
24361
|
+
selectionDragRef.current = pendingState;
|
|
24362
|
+
selectionPreviewRangeRef.current = pendingState.previewRange;
|
|
24363
|
+
displayedSelectionRef.current = pendingState.previewRange;
|
|
24364
|
+
setInteractionMode("select");
|
|
24365
|
+
document.body.style.userSelect = "none";
|
|
24366
|
+
installSelectionDragListeners(pendingState.pointerId);
|
|
24367
|
+
updateSelectionDragPreview(clientX, clientY);
|
|
24368
|
+
}
|
|
24369
|
+
function installPendingSelectionDragListeners(pointerId, target) {
|
|
24370
|
+
const existingCleanup = pendingSelectionDragCleanupRef.current;
|
|
24371
|
+
pendingSelectionDragCleanupRef.current = null;
|
|
24372
|
+
existingCleanup?.();
|
|
24373
|
+
const pointerTarget = target;
|
|
24374
|
+
try {
|
|
24375
|
+
pointerTarget.setPointerCapture?.(pointerId);
|
|
24376
|
+
} catch {
|
|
24377
|
+
}
|
|
24378
|
+
const handlePointerMove = (event) => {
|
|
24379
|
+
const pointerEvent = event;
|
|
24380
|
+
if (pointerEvent.pointerId !== pointerId) {
|
|
24381
|
+
return;
|
|
24382
|
+
}
|
|
24383
|
+
const pendingState = pendingSelectionDragRef.current;
|
|
24384
|
+
if (!pendingState) {
|
|
24385
|
+
return;
|
|
24386
|
+
}
|
|
24387
|
+
const deltaX = Math.abs(pointerEvent.clientX - pendingState.startClientX);
|
|
24388
|
+
const deltaY = Math.abs(pointerEvent.clientY - pendingState.startClientY);
|
|
24389
|
+
if (deltaX < SELECTION_DRAG_THRESHOLD_PX && deltaY < SELECTION_DRAG_THRESHOLD_PX) {
|
|
24390
|
+
return;
|
|
24391
|
+
}
|
|
24392
|
+
event.preventDefault();
|
|
24393
|
+
promotePendingSelectionDrag(pointerEvent.clientX, pointerEvent.clientY);
|
|
24394
|
+
};
|
|
24395
|
+
const handlePointerEnd = (event) => {
|
|
24396
|
+
const pointerEvent = event;
|
|
24397
|
+
if (pointerEvent.pointerId !== pointerId) {
|
|
24398
|
+
return;
|
|
24399
|
+
}
|
|
24400
|
+
finishPendingSelectionDrag();
|
|
24401
|
+
};
|
|
24402
|
+
target.addEventListener("pointermove", handlePointerMove);
|
|
24403
|
+
target.addEventListener("pointerup", handlePointerEnd);
|
|
24404
|
+
target.addEventListener("pointercancel", handlePointerEnd);
|
|
24405
|
+
pendingSelectionDragCleanupRef.current = () => {
|
|
24406
|
+
target.removeEventListener("pointermove", handlePointerMove);
|
|
24407
|
+
target.removeEventListener("pointerup", handlePointerEnd);
|
|
24408
|
+
target.removeEventListener("pointercancel", handlePointerEnd);
|
|
24409
|
+
try {
|
|
24410
|
+
if (pointerTarget.hasPointerCapture?.(pointerId)) {
|
|
24411
|
+
pointerTarget.releasePointerCapture?.(pointerId);
|
|
24412
|
+
}
|
|
24413
|
+
} catch {
|
|
24414
|
+
}
|
|
24415
|
+
};
|
|
24416
|
+
}
|
|
24316
24417
|
function installSelectionDragListeners(pointerId) {
|
|
24317
24418
|
selectionDragCleanupRef.current?.();
|
|
24318
24419
|
let pendingClientPoint = null;
|
|
@@ -24336,18 +24437,7 @@ function XlsxGrid({
|
|
|
24336
24437
|
}
|
|
24337
24438
|
dragState.didDrag = true;
|
|
24338
24439
|
}
|
|
24339
|
-
|
|
24340
|
-
if (!nextCell) {
|
|
24341
|
-
return;
|
|
24342
|
-
}
|
|
24343
|
-
const nextRange = buildDraggedSelectionRange(dragState, nextCell);
|
|
24344
|
-
if (!nextRange || rangesEqual(nextRange, dragState.previewRange)) {
|
|
24345
|
-
return;
|
|
24346
|
-
}
|
|
24347
|
-
dragState.previewRange = nextRange;
|
|
24348
|
-
selectionPreviewRangeRef.current = nextRange;
|
|
24349
|
-
displayedSelectionRef.current = nextRange;
|
|
24350
|
-
applyPreviewOverlay(nextRange);
|
|
24440
|
+
updateSelectionDragPreview(pendingPoint.x, pendingPoint.y);
|
|
24351
24441
|
};
|
|
24352
24442
|
const handlePointerMove = (event) => {
|
|
24353
24443
|
if (event.pointerId !== pointerId) {
|
|
@@ -24512,6 +24602,7 @@ function XlsxGrid({
|
|
|
24512
24602
|
return;
|
|
24513
24603
|
}
|
|
24514
24604
|
startCellSelection(
|
|
24605
|
+
event.currentTarget,
|
|
24515
24606
|
event.pointerId,
|
|
24516
24607
|
anchor,
|
|
24517
24608
|
"cell",
|
|
@@ -24559,6 +24650,7 @@ function XlsxGrid({
|
|
|
24559
24650
|
return;
|
|
24560
24651
|
}
|
|
24561
24652
|
startCellSelection(
|
|
24653
|
+
event.currentTarget,
|
|
24562
24654
|
event.pointerId,
|
|
24563
24655
|
{ row: anchorRow, col: firstVisibleCol },
|
|
24564
24656
|
"row",
|
|
@@ -24589,6 +24681,7 @@ function XlsxGrid({
|
|
|
24589
24681
|
return;
|
|
24590
24682
|
}
|
|
24591
24683
|
startCellSelection(
|
|
24684
|
+
event.currentTarget,
|
|
24592
24685
|
event.pointerId,
|
|
24593
24686
|
{ row: firstVisibleRow, col: anchorCol },
|
|
24594
24687
|
"column",
|
|
@@ -24870,6 +24963,7 @@ function XlsxGrid({
|
|
|
24870
24963
|
return;
|
|
24871
24964
|
}
|
|
24872
24965
|
startCellSelection(
|
|
24966
|
+
event.currentTarget,
|
|
24873
24967
|
event.pointerId,
|
|
24874
24968
|
anchor,
|
|
24875
24969
|
"cell",
|
|
@@ -24947,6 +25041,7 @@ function XlsxGrid({
|
|
|
24947
25041
|
return;
|
|
24948
25042
|
}
|
|
24949
25043
|
startCellSelection(
|
|
25044
|
+
event.currentTarget,
|
|
24950
25045
|
event.pointerId,
|
|
24951
25046
|
{ row: firstVisibleRow, col: anchorCol },
|
|
24952
25047
|
"column",
|
|
@@ -25004,6 +25099,7 @@ function XlsxGrid({
|
|
|
25004
25099
|
return;
|
|
25005
25100
|
}
|
|
25006
25101
|
startCellSelection(
|
|
25102
|
+
event.currentTarget,
|
|
25007
25103
|
event.pointerId,
|
|
25008
25104
|
{ row: anchorRow, col: firstVisibleCol },
|
|
25009
25105
|
"row",
|
|
@@ -27246,9 +27342,10 @@ function XlsxGrid({
|
|
|
27246
27342
|
setGlobalCursor("row-resize");
|
|
27247
27343
|
document.body.style.userSelect = "none";
|
|
27248
27344
|
}
|
|
27249
|
-
function startCellSelection(pointerId, anchor, axis, originCell, pointerOrigin, originOverlayRect, committedOnPointerDown, initialRange, startClientX, startClientY) {
|
|
27250
|
-
|
|
27251
|
-
|
|
27345
|
+
function startCellSelection(target, pointerId, anchor, axis, originCell, pointerOrigin, originOverlayRect, committedOnPointerDown, initialRange, startClientX, startClientY) {
|
|
27346
|
+
clearPendingSelectionDrag();
|
|
27347
|
+
const previewRange = normalizeRange2(initialRange);
|
|
27348
|
+
pendingSelectionDragRef.current = {
|
|
27252
27349
|
anchor,
|
|
27253
27350
|
axis,
|
|
27254
27351
|
contentScaleX: pointerOrigin.contentScaleX,
|
|
@@ -27260,16 +27357,14 @@ function XlsxGrid({
|
|
|
27260
27357
|
originContentX: pointerOrigin.originContentX,
|
|
27261
27358
|
originContentY: pointerOrigin.originContentY,
|
|
27262
27359
|
pointerId,
|
|
27263
|
-
previewRange
|
|
27360
|
+
previewRange,
|
|
27264
27361
|
startClientX,
|
|
27265
27362
|
startClientY
|
|
27266
27363
|
};
|
|
27267
|
-
selectionPreviewRangeRef.current =
|
|
27268
|
-
displayedSelectionRef.current =
|
|
27269
|
-
applyPreviewOverlay(
|
|
27270
|
-
|
|
27271
|
-
document.body.style.userSelect = "none";
|
|
27272
|
-
installSelectionDragListeners(pointerId);
|
|
27364
|
+
selectionPreviewRangeRef.current = previewRange;
|
|
27365
|
+
displayedSelectionRef.current = previewRange;
|
|
27366
|
+
applyPreviewOverlay(previewRange);
|
|
27367
|
+
installPendingSelectionDragListeners(pointerId, target);
|
|
27273
27368
|
}
|
|
27274
27369
|
function resolveFillRange(sourceRange, cell) {
|
|
27275
27370
|
const normalizedSource = normalizeRange2(sourceRange);
|
|
@@ -27488,700 +27583,698 @@ function XlsxGrid({
|
|
|
27488
27583
|
}
|
|
27489
27584
|
selectCell({ row: nextRow, col: nextCol }, extend ? { extend: true } : void 0);
|
|
27490
27585
|
}
|
|
27491
|
-
|
|
27492
|
-
|
|
27493
|
-
|
|
27494
|
-
|
|
27495
|
-
|
|
27496
|
-
|
|
27497
|
-
|
|
27498
|
-
|
|
27499
|
-
|
|
27500
|
-
|
|
27501
|
-
|
|
27502
|
-
|
|
27503
|
-
|
|
27504
|
-
|
|
27505
|
-
|
|
27506
|
-
|
|
27507
|
-
|
|
27508
|
-
|
|
27509
|
-
|
|
27510
|
-
|
|
27511
|
-
|
|
27512
|
-
|
|
27513
|
-
|
|
27514
|
-
|
|
27515
|
-
|
|
27586
|
+
const scrollerViewportProps = {
|
|
27587
|
+
key: activeTabIndex,
|
|
27588
|
+
ref: scrollRef,
|
|
27589
|
+
onScroll: handleScrollerScroll,
|
|
27590
|
+
onCopy: (event) => {
|
|
27591
|
+
if (editingCell) {
|
|
27592
|
+
return;
|
|
27593
|
+
}
|
|
27594
|
+
const clipboard = event.clipboardData;
|
|
27595
|
+
const clipboardData = getClipboardData();
|
|
27596
|
+
if (!clipboardData) {
|
|
27597
|
+
return;
|
|
27598
|
+
}
|
|
27599
|
+
event.preventDefault();
|
|
27600
|
+
if (clipboard) {
|
|
27601
|
+
clipboard.setData("text/plain", clipboardData.text);
|
|
27602
|
+
clipboard.setData("text/html", clipboardData.html);
|
|
27603
|
+
clipboard.setData(INTERNAL_CLIPBOARD_MIME2, clipboardData.structured);
|
|
27604
|
+
return;
|
|
27605
|
+
}
|
|
27606
|
+
void copySelectionToClipboard();
|
|
27607
|
+
},
|
|
27608
|
+
onKeyDown: (event) => {
|
|
27609
|
+
if (editingCell) {
|
|
27610
|
+
return;
|
|
27611
|
+
}
|
|
27612
|
+
if (!readOnly && (event.metaKey || event.ctrlKey) && !event.altKey) {
|
|
27613
|
+
const normalizedKey = event.key.toLowerCase();
|
|
27614
|
+
if (normalizedKey === "z" && event.shiftKey) {
|
|
27615
|
+
event.preventDefault();
|
|
27616
|
+
redo();
|
|
27516
27617
|
return;
|
|
27517
27618
|
}
|
|
27518
|
-
if (
|
|
27519
|
-
|
|
27520
|
-
|
|
27521
|
-
event.preventDefault();
|
|
27522
|
-
redo();
|
|
27523
|
-
return;
|
|
27524
|
-
}
|
|
27525
|
-
if (normalizedKey === "z") {
|
|
27526
|
-
event.preventDefault();
|
|
27527
|
-
undo();
|
|
27528
|
-
return;
|
|
27529
|
-
}
|
|
27530
|
-
if (normalizedKey === "y") {
|
|
27531
|
-
event.preventDefault();
|
|
27532
|
-
redo();
|
|
27533
|
-
return;
|
|
27534
|
-
}
|
|
27535
|
-
}
|
|
27536
|
-
const currentCell = resolveCurrentCell();
|
|
27537
|
-
if (!currentCell) {
|
|
27619
|
+
if (normalizedKey === "z") {
|
|
27620
|
+
event.preventDefault();
|
|
27621
|
+
undo();
|
|
27538
27622
|
return;
|
|
27539
27623
|
}
|
|
27540
|
-
|
|
27541
|
-
const currentColIndex = colIndexByActual.get(currentCell.col) ?? 0;
|
|
27542
|
-
if (!readOnly && isPrintableKey(event)) {
|
|
27624
|
+
if (normalizedKey === "y") {
|
|
27543
27625
|
event.preventDefault();
|
|
27544
|
-
|
|
27626
|
+
redo();
|
|
27545
27627
|
return;
|
|
27546
27628
|
}
|
|
27547
|
-
|
|
27548
|
-
|
|
27549
|
-
|
|
27550
|
-
|
|
27551
|
-
|
|
27552
|
-
|
|
27553
|
-
|
|
27554
|
-
|
|
27555
|
-
|
|
27556
|
-
|
|
27557
|
-
|
|
27558
|
-
|
|
27629
|
+
}
|
|
27630
|
+
const currentCell = resolveCurrentCell();
|
|
27631
|
+
if (!currentCell) {
|
|
27632
|
+
return;
|
|
27633
|
+
}
|
|
27634
|
+
const currentRowIndex = rowIndexByActual.get(currentCell.row) ?? 0;
|
|
27635
|
+
const currentColIndex = colIndexByActual.get(currentCell.col) ?? 0;
|
|
27636
|
+
if (!readOnly && isPrintableKey(event)) {
|
|
27637
|
+
event.preventDefault();
|
|
27638
|
+
startEditing(currentCell, event.key);
|
|
27639
|
+
return;
|
|
27640
|
+
}
|
|
27641
|
+
switch (event.key) {
|
|
27642
|
+
case "ArrowDown":
|
|
27643
|
+
event.preventDefault();
|
|
27644
|
+
moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, event.shiftKey);
|
|
27645
|
+
break;
|
|
27646
|
+
case "ArrowUp":
|
|
27647
|
+
event.preventDefault();
|
|
27648
|
+
moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, event.shiftKey);
|
|
27649
|
+
break;
|
|
27650
|
+
case "ArrowLeft":
|
|
27651
|
+
event.preventDefault();
|
|
27652
|
+
moveSelection(currentRowIndex, Math.max(currentColIndex - 1, 0), event.shiftKey);
|
|
27653
|
+
break;
|
|
27654
|
+
case "ArrowRight":
|
|
27655
|
+
event.preventDefault();
|
|
27656
|
+
moveSelection(currentRowIndex, Math.min(currentColIndex + 1, visibleCols.length - 1), event.shiftKey);
|
|
27657
|
+
break;
|
|
27658
|
+
case "Tab":
|
|
27659
|
+
event.preventDefault();
|
|
27660
|
+
moveSelection(
|
|
27661
|
+
currentRowIndex,
|
|
27662
|
+
event.shiftKey ? Math.max(currentColIndex - 1, 0) : Math.min(currentColIndex + 1, visibleCols.length - 1),
|
|
27663
|
+
false
|
|
27664
|
+
);
|
|
27665
|
+
break;
|
|
27666
|
+
case "Enter":
|
|
27667
|
+
event.preventDefault();
|
|
27668
|
+
if (event.metaKey || event.ctrlKey || event.altKey) {
|
|
27559
27669
|
break;
|
|
27560
|
-
|
|
27561
|
-
|
|
27562
|
-
moveSelection(
|
|
27670
|
+
}
|
|
27671
|
+
if (event.shiftKey) {
|
|
27672
|
+
moveSelection(Math.max(currentRowIndex - 1, 0), currentColIndex, false);
|
|
27563
27673
|
break;
|
|
27564
|
-
|
|
27674
|
+
}
|
|
27675
|
+
moveSelection(Math.min(currentRowIndex + 1, visibleRows.length - 1), currentColIndex, false);
|
|
27676
|
+
break;
|
|
27677
|
+
case "Backspace":
|
|
27678
|
+
case "Delete":
|
|
27679
|
+
if (!readOnly) {
|
|
27565
27680
|
event.preventDefault();
|
|
27566
|
-
|
|
27567
|
-
|
|
27568
|
-
|
|
27569
|
-
|
|
27570
|
-
|
|
27571
|
-
break;
|
|
27572
|
-
case "Enter":
|
|
27681
|
+
clearSelectedCells();
|
|
27682
|
+
}
|
|
27683
|
+
break;
|
|
27684
|
+
case "F2":
|
|
27685
|
+
if (!readOnly) {
|
|
27573
27686
|
event.preventDefault();
|
|
27574
|
-
|
|
27575
|
-
|
|
27576
|
-
|
|
27577
|
-
|
|
27578
|
-
|
|
27579
|
-
|
|
27580
|
-
|
|
27581
|
-
|
|
27582
|
-
|
|
27583
|
-
|
|
27584
|
-
|
|
27585
|
-
|
|
27586
|
-
|
|
27587
|
-
clearSelectedCells();
|
|
27588
|
-
}
|
|
27589
|
-
break;
|
|
27590
|
-
case "F2":
|
|
27591
|
-
if (!readOnly) {
|
|
27592
|
-
event.preventDefault();
|
|
27593
|
-
startEditing(currentCell);
|
|
27594
|
-
}
|
|
27595
|
-
break;
|
|
27596
|
-
default:
|
|
27597
|
-
break;
|
|
27598
|
-
}
|
|
27599
|
-
},
|
|
27600
|
-
onPaste: (event) => {
|
|
27601
|
-
if (editingCell || readOnly) {
|
|
27602
|
-
return;
|
|
27603
|
-
}
|
|
27604
|
-
const clipboard = event.clipboardData;
|
|
27605
|
-
if (!clipboard) {
|
|
27606
|
-
event.preventDefault();
|
|
27607
|
-
void pasteFromClipboard();
|
|
27608
|
-
return;
|
|
27609
|
-
}
|
|
27610
|
-
const structuredPayload = clipboard.getData(INTERNAL_CLIPBOARD_MIME2);
|
|
27611
|
-
const textPayload = clipboard.getData("text/plain");
|
|
27612
|
-
if (!structuredPayload && !textPayload) {
|
|
27613
|
-
return;
|
|
27614
|
-
}
|
|
27687
|
+
startEditing(currentCell);
|
|
27688
|
+
}
|
|
27689
|
+
break;
|
|
27690
|
+
default:
|
|
27691
|
+
break;
|
|
27692
|
+
}
|
|
27693
|
+
},
|
|
27694
|
+
onPaste: (event) => {
|
|
27695
|
+
if (editingCell || readOnly) {
|
|
27696
|
+
return;
|
|
27697
|
+
}
|
|
27698
|
+
const clipboard = event.clipboardData;
|
|
27699
|
+
if (!clipboard) {
|
|
27615
27700
|
event.preventDefault();
|
|
27616
|
-
|
|
27617
|
-
|
|
27618
|
-
|
|
27619
|
-
|
|
27620
|
-
|
|
27621
|
-
|
|
27622
|
-
|
|
27701
|
+
void pasteFromClipboard();
|
|
27702
|
+
return;
|
|
27703
|
+
}
|
|
27704
|
+
const structuredPayload = clipboard.getData(INTERNAL_CLIPBOARD_MIME2);
|
|
27705
|
+
const textPayload = clipboard.getData("text/plain");
|
|
27706
|
+
if (!structuredPayload && !textPayload) {
|
|
27707
|
+
return;
|
|
27708
|
+
}
|
|
27709
|
+
event.preventDefault();
|
|
27710
|
+
if (structuredPayload) {
|
|
27711
|
+
pasteStructuredClipboardData(structuredPayload);
|
|
27712
|
+
return;
|
|
27713
|
+
}
|
|
27714
|
+
pasteText(textPayload);
|
|
27715
|
+
},
|
|
27716
|
+
tabIndex: 0,
|
|
27717
|
+
style: {
|
|
27718
|
+
["--xlsx-menu-active"]: selectionFill,
|
|
27719
|
+
["--xlsx-menu-border"]: palette.strongBorder,
|
|
27720
|
+
["--xlsx-menu-surface"]: palette.surface,
|
|
27721
|
+
["--xlsx-selection-header"]: selectionHeaderSurface,
|
|
27722
|
+
backgroundColor: palette.canvas,
|
|
27723
|
+
color: palette.text,
|
|
27724
|
+
cursor: resizeGuide?.type === "column" ? "col-resize" : resizeGuide?.type === "row" ? "row-resize" : void 0,
|
|
27725
|
+
flex: 1,
|
|
27726
|
+
height: "100%",
|
|
27727
|
+
minHeight: 0,
|
|
27728
|
+
minWidth: 0,
|
|
27729
|
+
outline: "none",
|
|
27730
|
+
overflow: "auto",
|
|
27731
|
+
width: "100%"
|
|
27732
|
+
}
|
|
27733
|
+
};
|
|
27734
|
+
const scrollerContent = /* @__PURE__ */ jsx3(
|
|
27735
|
+
"div",
|
|
27736
|
+
{
|
|
27623
27737
|
style: {
|
|
27624
|
-
|
|
27625
|
-
|
|
27626
|
-
|
|
27627
|
-
|
|
27628
|
-
|
|
27629
|
-
|
|
27630
|
-
cursor: resizeGuide?.type === "column" ? "col-resize" : resizeGuide?.type === "row" ? "row-resize" : void 0,
|
|
27631
|
-
flex: 1,
|
|
27632
|
-
height: "100%",
|
|
27633
|
-
minHeight: 0,
|
|
27634
|
-
minWidth: 0,
|
|
27635
|
-
outline: "none",
|
|
27636
|
-
overflow: "auto",
|
|
27637
|
-
width: "100%"
|
|
27738
|
+
backgroundColor: resolveSheetSurface(activeSheet, palette),
|
|
27739
|
+
minHeight: "100%",
|
|
27740
|
+
minWidth: "100%",
|
|
27741
|
+
position: "relative",
|
|
27742
|
+
width: totalWidth,
|
|
27743
|
+
height: sheetContentHeight
|
|
27638
27744
|
},
|
|
27639
|
-
children: /* @__PURE__ */
|
|
27745
|
+
children: /* @__PURE__ */ jsxs3(
|
|
27640
27746
|
"div",
|
|
27641
27747
|
{
|
|
27748
|
+
ref: wrapperRef,
|
|
27642
27749
|
style: {
|
|
27643
|
-
|
|
27644
|
-
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
|
|
27648
|
-
|
|
27750
|
+
height: sheetContentHeight,
|
|
27751
|
+
left: 0,
|
|
27752
|
+
position: "absolute",
|
|
27753
|
+
top: 0,
|
|
27754
|
+
transform: !experimentalCanvas && isLiveZooming ? `translate3d(${liveZoomTranslateX}px, ${liveZoomTranslateY}px, 0) scale(${liveZoomScale})` : void 0,
|
|
27755
|
+
transformOrigin: "0 0",
|
|
27756
|
+
transition: "none",
|
|
27757
|
+
willChange: !experimentalCanvas && isLiveZooming ? "transform" : void 0,
|
|
27758
|
+
width: totalWidth
|
|
27649
27759
|
},
|
|
27650
|
-
children:
|
|
27651
|
-
|
|
27652
|
-
|
|
27653
|
-
|
|
27654
|
-
style:
|
|
27655
|
-
|
|
27656
|
-
|
|
27657
|
-
|
|
27658
|
-
|
|
27659
|
-
|
|
27660
|
-
|
|
27661
|
-
|
|
27662
|
-
|
|
27663
|
-
|
|
27664
|
-
|
|
27665
|
-
|
|
27666
|
-
|
|
27667
|
-
|
|
27668
|
-
|
|
27669
|
-
|
|
27670
|
-
|
|
27671
|
-
|
|
27672
|
-
|
|
27673
|
-
|
|
27674
|
-
|
|
27675
|
-
|
|
27676
|
-
|
|
27677
|
-
|
|
27678
|
-
|
|
27679
|
-
|
|
27680
|
-
|
|
27681
|
-
|
|
27682
|
-
|
|
27683
|
-
|
|
27684
|
-
|
|
27685
|
-
|
|
27686
|
-
|
|
27687
|
-
|
|
27688
|
-
|
|
27689
|
-
|
|
27690
|
-
|
|
27691
|
-
|
|
27692
|
-
|
|
27693
|
-
|
|
27694
|
-
|
|
27695
|
-
|
|
27696
|
-
|
|
27697
|
-
|
|
27698
|
-
|
|
27699
|
-
|
|
27700
|
-
|
|
27701
|
-
|
|
27702
|
-
|
|
27703
|
-
|
|
27704
|
-
|
|
27705
|
-
|
|
27706
|
-
|
|
27707
|
-
|
|
27708
|
-
|
|
27709
|
-
|
|
27710
|
-
|
|
27711
|
-
|
|
27712
|
-
|
|
27713
|
-
|
|
27714
|
-
|
|
27715
|
-
|
|
27716
|
-
|
|
27717
|
-
|
|
27718
|
-
ref: canvasScrollOverlayContentRef,
|
|
27719
|
-
style: {
|
|
27720
|
-
height: sheetContentHeight,
|
|
27721
|
-
left: 0,
|
|
27722
|
-
pointerEvents: "none",
|
|
27723
|
-
position: "absolute",
|
|
27724
|
-
top: 0,
|
|
27725
|
-
transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
|
|
27726
|
-
transformOrigin: "0 0",
|
|
27727
|
-
width: totalWidth
|
|
27728
|
-
},
|
|
27729
|
-
children: paneDrawingNodes.scroll
|
|
27730
|
-
}
|
|
27731
|
-
) }),
|
|
27732
|
-
/* @__PURE__ */ jsx3("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
|
|
27733
|
-
"div",
|
|
27734
|
-
{
|
|
27735
|
-
ref: canvasTopOverlayContentRef,
|
|
27736
|
-
style: {
|
|
27737
|
-
height: sheetContentHeight,
|
|
27738
|
-
left: 0,
|
|
27739
|
-
pointerEvents: "none",
|
|
27740
|
-
position: "absolute",
|
|
27741
|
-
top: 0,
|
|
27742
|
-
transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
|
|
27743
|
-
transformOrigin: "0 0",
|
|
27744
|
-
width: totalWidth
|
|
27745
|
-
},
|
|
27746
|
-
children: paneDrawingNodes.top
|
|
27747
|
-
}
|
|
27748
|
-
) }),
|
|
27749
|
-
/* @__PURE__ */ jsx3("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
|
|
27750
|
-
"div",
|
|
27751
|
-
{
|
|
27752
|
-
ref: canvasLeftOverlayContentRef,
|
|
27753
|
-
style: {
|
|
27754
|
-
height: sheetContentHeight,
|
|
27755
|
-
left: 0,
|
|
27756
|
-
pointerEvents: "none",
|
|
27757
|
-
position: "absolute",
|
|
27758
|
-
top: 0,
|
|
27759
|
-
transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
|
|
27760
|
-
transformOrigin: "0 0",
|
|
27761
|
-
width: totalWidth
|
|
27762
|
-
},
|
|
27763
|
-
children: paneDrawingNodes.left
|
|
27764
|
-
}
|
|
27765
|
-
) }),
|
|
27766
|
-
/* @__PURE__ */ jsx3("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
|
|
27767
|
-
"div",
|
|
27768
|
-
{
|
|
27769
|
-
ref: canvasCornerOverlayContentRef,
|
|
27770
|
-
style: {
|
|
27771
|
-
height: sheetContentHeight,
|
|
27772
|
-
left: 0,
|
|
27773
|
-
pointerEvents: "none",
|
|
27774
|
-
position: "absolute",
|
|
27775
|
-
top: 0,
|
|
27776
|
-
transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
|
|
27777
|
-
transformOrigin: "0 0",
|
|
27778
|
-
width: totalWidth
|
|
27779
|
-
},
|
|
27780
|
-
children: paneDrawingNodes.corner
|
|
27781
|
-
}
|
|
27782
|
-
) })
|
|
27783
|
-
] }) : null
|
|
27784
|
-
] }),
|
|
27785
|
-
/* @__PURE__ */ jsxs3("div", { style: canvasHeaderViewportLayerStyle, children: [
|
|
27786
|
-
/* @__PURE__ */ jsx3(
|
|
27787
|
-
"canvas",
|
|
27788
|
-
{
|
|
27789
|
-
ref: topFrozenHeaderCanvasRef,
|
|
27790
|
-
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27791
|
-
onPointerMove: handleCanvasColumnHeaderPointerMove,
|
|
27792
|
-
onPointerDown: handleCanvasColumnHeaderPointerDown,
|
|
27793
|
-
style: canvasTopFrozenHeaderStyle
|
|
27794
|
-
}
|
|
27795
|
-
),
|
|
27796
|
-
/* @__PURE__ */ jsx3(
|
|
27797
|
-
"canvas",
|
|
27798
|
-
{
|
|
27799
|
-
ref: topScrollHeaderCanvasRef,
|
|
27800
|
-
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27801
|
-
onPointerMove: handleCanvasColumnHeaderPointerMove,
|
|
27802
|
-
onPointerDown: handleCanvasColumnHeaderPointerDown,
|
|
27803
|
-
style: canvasTopScrollHeaderStyle
|
|
27804
|
-
}
|
|
27805
|
-
),
|
|
27806
|
-
/* @__PURE__ */ jsx3(
|
|
27807
|
-
"canvas",
|
|
27808
|
-
{
|
|
27809
|
-
ref: leftFrozenHeaderCanvasRef,
|
|
27810
|
-
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27811
|
-
onPointerMove: handleCanvasRowHeaderPointerMove,
|
|
27812
|
-
onPointerDown: handleCanvasRowHeaderPointerDown,
|
|
27813
|
-
style: canvasLeftFrozenHeaderStyle
|
|
27814
|
-
}
|
|
27815
|
-
),
|
|
27816
|
-
/* @__PURE__ */ jsx3(
|
|
27817
|
-
"canvas",
|
|
27818
|
-
{
|
|
27819
|
-
ref: leftScrollHeaderCanvasRef,
|
|
27820
|
-
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27821
|
-
onPointerMove: handleCanvasRowHeaderPointerMove,
|
|
27822
|
-
onPointerDown: handleCanvasRowHeaderPointerDown,
|
|
27823
|
-
style: canvasLeftScrollHeaderStyle
|
|
27824
|
-
}
|
|
27825
|
-
),
|
|
27826
|
-
/* @__PURE__ */ jsx3("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
|
|
27827
|
-
] }),
|
|
27828
|
-
editingCell && editingOverlayRect ? (() => {
|
|
27829
|
-
const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
|
|
27830
|
-
const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
|
|
27831
|
-
const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
|
|
27832
|
-
return /* @__PURE__ */ jsx3(
|
|
27833
|
-
"div",
|
|
27834
|
-
{
|
|
27835
|
-
style: {
|
|
27836
|
-
left: editingOverlayRect.left,
|
|
27837
|
-
position: "absolute",
|
|
27838
|
-
top: editingOverlayRect.top,
|
|
27839
|
-
width: editingOverlayRect.width,
|
|
27840
|
-
height: editingOverlayRect.height,
|
|
27841
|
-
zIndex: 28
|
|
27842
|
-
},
|
|
27843
|
-
children: /* @__PURE__ */ jsx3(
|
|
27844
|
-
"input",
|
|
27845
|
-
{
|
|
27846
|
-
ref: editingInputRef,
|
|
27847
|
-
autoFocus: true,
|
|
27848
|
-
onBlur: commitEditing,
|
|
27849
|
-
onChange: (event) => setEditingValue(event.target.value),
|
|
27850
|
-
onKeyDown: (event) => {
|
|
27851
|
-
event.stopPropagation();
|
|
27852
|
-
if (event.key === "Enter") {
|
|
27853
|
-
event.preventDefault();
|
|
27854
|
-
commitEditing();
|
|
27855
|
-
return;
|
|
27856
|
-
}
|
|
27857
|
-
if (event.key === "Escape") {
|
|
27858
|
-
event.preventDefault();
|
|
27859
|
-
cancelEditing();
|
|
27860
|
-
}
|
|
27861
|
-
},
|
|
27862
|
-
style: {
|
|
27863
|
-
backgroundColor: editingBackground,
|
|
27864
|
-
border: 0,
|
|
27865
|
-
boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
|
|
27866
|
-
boxSizing: "border-box",
|
|
27867
|
-
color: editingColor,
|
|
27868
|
-
display: "block",
|
|
27869
|
-
font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
|
|
27870
|
-
height: "100%",
|
|
27871
|
-
margin: 0,
|
|
27872
|
-
minHeight: 0,
|
|
27873
|
-
outline: "none",
|
|
27874
|
-
overflow: "hidden",
|
|
27875
|
-
padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
|
|
27876
|
-
width: "100%"
|
|
27877
|
-
},
|
|
27878
|
-
value: editingValue
|
|
27879
|
-
}
|
|
27880
|
-
)
|
|
27881
|
-
}
|
|
27882
|
-
);
|
|
27883
|
-
})() : null,
|
|
27884
|
-
activeCellAdornment && activeCellAdornmentRect ? /* @__PURE__ */ jsx3(
|
|
27760
|
+
children: [
|
|
27761
|
+
showImages && !experimentalCanvas ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
27762
|
+
/* @__PURE__ */ jsx3("div", { style: topOverlayStyle, children: paneDrawingNodes.top }),
|
|
27763
|
+
/* @__PURE__ */ jsx3("div", { style: leftOverlayStyle, children: paneDrawingNodes.left }),
|
|
27764
|
+
/* @__PURE__ */ jsx3("div", { style: cornerOverlayStyle, children: paneDrawingNodes.corner }),
|
|
27765
|
+
/* @__PURE__ */ jsx3("div", { style: scrollOverlayStyle, children: paneDrawingNodes.scroll })
|
|
27766
|
+
] }) : null,
|
|
27767
|
+
experimentalCanvas ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
27768
|
+
/* @__PURE__ */ jsxs3("div", { style: canvasBodyViewportLayerStyle, children: [
|
|
27769
|
+
/* @__PURE__ */ jsx3(
|
|
27770
|
+
"canvas",
|
|
27771
|
+
{
|
|
27772
|
+
ref: scrollBodyCanvasRef,
|
|
27773
|
+
onClick: handleCanvasBodyClick,
|
|
27774
|
+
onDoubleClick: handleCanvasBodyDoubleClick,
|
|
27775
|
+
onPointerDown: handleCanvasBodyPointerDown,
|
|
27776
|
+
style: canvasScrollBodyStyle
|
|
27777
|
+
}
|
|
27778
|
+
),
|
|
27779
|
+
/* @__PURE__ */ jsx3(
|
|
27780
|
+
"canvas",
|
|
27781
|
+
{
|
|
27782
|
+
ref: topBodyCanvasRef,
|
|
27783
|
+
onClick: handleCanvasBodyClick,
|
|
27784
|
+
onDoubleClick: handleCanvasBodyDoubleClick,
|
|
27785
|
+
onPointerDown: handleCanvasBodyPointerDown,
|
|
27786
|
+
style: canvasTopBodyStyle
|
|
27787
|
+
}
|
|
27788
|
+
),
|
|
27789
|
+
/* @__PURE__ */ jsx3(
|
|
27790
|
+
"canvas",
|
|
27791
|
+
{
|
|
27792
|
+
ref: leftBodyCanvasRef,
|
|
27793
|
+
onClick: handleCanvasBodyClick,
|
|
27794
|
+
onDoubleClick: handleCanvasBodyDoubleClick,
|
|
27795
|
+
onPointerDown: handleCanvasBodyPointerDown,
|
|
27796
|
+
style: canvasLeftBodyStyle
|
|
27797
|
+
}
|
|
27798
|
+
),
|
|
27799
|
+
/* @__PURE__ */ jsx3(
|
|
27800
|
+
"canvas",
|
|
27801
|
+
{
|
|
27802
|
+
ref: cornerBodyCanvasRef,
|
|
27803
|
+
onClick: handleCanvasBodyClick,
|
|
27804
|
+
onDoubleClick: handleCanvasBodyDoubleClick,
|
|
27805
|
+
onPointerDown: handleCanvasBodyPointerDown,
|
|
27806
|
+
style: canvasCornerBodyStyle
|
|
27807
|
+
}
|
|
27808
|
+
),
|
|
27809
|
+
hasCanvasDomDrawingOverlays ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
|
|
27810
|
+
/* @__PURE__ */ jsx3("div", { style: canvasScrollOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
|
|
27811
|
+
"div",
|
|
27812
|
+
{
|
|
27813
|
+
ref: canvasScrollOverlayContentRef,
|
|
27814
|
+
style: {
|
|
27815
|
+
height: sheetContentHeight,
|
|
27816
|
+
left: 0,
|
|
27817
|
+
pointerEvents: "none",
|
|
27818
|
+
position: "absolute",
|
|
27819
|
+
top: 0,
|
|
27820
|
+
transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
|
|
27821
|
+
transformOrigin: "0 0",
|
|
27822
|
+
width: totalWidth
|
|
27823
|
+
},
|
|
27824
|
+
children: paneDrawingNodes.scroll
|
|
27825
|
+
}
|
|
27826
|
+
) }),
|
|
27827
|
+
/* @__PURE__ */ jsx3("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
|
|
27885
27828
|
"div",
|
|
27886
27829
|
{
|
|
27830
|
+
ref: canvasTopOverlayContentRef,
|
|
27887
27831
|
style: {
|
|
27888
|
-
height:
|
|
27889
|
-
left:
|
|
27832
|
+
height: sheetContentHeight,
|
|
27833
|
+
left: 0,
|
|
27890
27834
|
pointerEvents: "none",
|
|
27891
27835
|
position: "absolute",
|
|
27892
|
-
top:
|
|
27893
|
-
|
|
27894
|
-
|
|
27836
|
+
top: 0,
|
|
27837
|
+
transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
|
|
27838
|
+
transformOrigin: "0 0",
|
|
27839
|
+
width: totalWidth
|
|
27895
27840
|
},
|
|
27896
|
-
children:
|
|
27841
|
+
children: paneDrawingNodes.top
|
|
27897
27842
|
}
|
|
27898
|
-
)
|
|
27899
|
-
|
|
27900
|
-
|
|
27843
|
+
) }),
|
|
27844
|
+
/* @__PURE__ */ jsx3("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
|
|
27845
|
+
"div",
|
|
27846
|
+
{
|
|
27847
|
+
ref: canvasLeftOverlayContentRef,
|
|
27848
|
+
style: {
|
|
27849
|
+
height: sheetContentHeight,
|
|
27850
|
+
left: 0,
|
|
27851
|
+
pointerEvents: "none",
|
|
27852
|
+
position: "absolute",
|
|
27853
|
+
top: 0,
|
|
27854
|
+
transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
|
|
27855
|
+
transformOrigin: "0 0",
|
|
27856
|
+
width: totalWidth
|
|
27857
|
+
},
|
|
27858
|
+
children: paneDrawingNodes.left
|
|
27859
|
+
}
|
|
27860
|
+
) }),
|
|
27861
|
+
/* @__PURE__ */ jsx3("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
|
|
27862
|
+
"div",
|
|
27863
|
+
{
|
|
27864
|
+
ref: canvasCornerOverlayContentRef,
|
|
27865
|
+
style: {
|
|
27866
|
+
height: sheetContentHeight,
|
|
27867
|
+
left: 0,
|
|
27868
|
+
pointerEvents: "none",
|
|
27869
|
+
position: "absolute",
|
|
27870
|
+
top: 0,
|
|
27871
|
+
transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
|
|
27872
|
+
transformOrigin: "0 0",
|
|
27873
|
+
width: totalWidth
|
|
27874
|
+
},
|
|
27875
|
+
children: paneDrawingNodes.corner
|
|
27876
|
+
}
|
|
27877
|
+
) })
|
|
27878
|
+
] }) : null
|
|
27879
|
+
] }),
|
|
27880
|
+
/* @__PURE__ */ jsxs3("div", { style: canvasHeaderViewportLayerStyle, children: [
|
|
27881
|
+
/* @__PURE__ */ jsx3(
|
|
27882
|
+
"canvas",
|
|
27901
27883
|
{
|
|
27902
|
-
ref:
|
|
27903
|
-
|
|
27904
|
-
|
|
27905
|
-
|
|
27906
|
-
|
|
27907
|
-
tableLayout: "fixed",
|
|
27908
|
-
width: totalWidth
|
|
27909
|
-
},
|
|
27910
|
-
children: [
|
|
27911
|
-
/* @__PURE__ */ jsxs3("colgroup", { children: [
|
|
27912
|
-
/* @__PURE__ */ jsx3("col", { style: { width: displayRowHeaderWidth } }),
|
|
27913
|
-
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: leadingColumnSpacerWidth } }) : null,
|
|
27914
|
-
renderedCols.map((column) => /* @__PURE__ */ jsx3(
|
|
27915
|
-
"col",
|
|
27916
|
-
{
|
|
27917
|
-
ref: (element) => {
|
|
27918
|
-
if (element) {
|
|
27919
|
-
colElementRefs.current.set(column.actualCol, element);
|
|
27920
|
-
} else {
|
|
27921
|
-
colElementRefs.current.delete(column.actualCol);
|
|
27922
|
-
}
|
|
27923
|
-
},
|
|
27924
|
-
style: { width: column.size }
|
|
27925
|
-
},
|
|
27926
|
-
column.key
|
|
27927
|
-
)),
|
|
27928
|
-
trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: trailingColumnSpacerWidth } }) : null
|
|
27929
|
-
] }),
|
|
27930
|
-
/* @__PURE__ */ jsx3("thead", { style: { position: "sticky", top: 0, zIndex: canvasHeaderOverlayZIndex }, children: /* @__PURE__ */ jsxs3("tr", { children: [
|
|
27931
|
-
/* @__PURE__ */ jsx3(
|
|
27932
|
-
"th",
|
|
27933
|
-
{
|
|
27934
|
-
style: {
|
|
27935
|
-
...headerCellStyle,
|
|
27936
|
-
backgroundColor: palette.headerSurface,
|
|
27937
|
-
left: 0,
|
|
27938
|
-
width: displayRowHeaderWidth,
|
|
27939
|
-
zIndex: cornerHeaderOverlayZIndex
|
|
27940
|
-
}
|
|
27941
|
-
}
|
|
27942
|
-
),
|
|
27943
|
-
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: leadingColumnSpacerWidth } }) : null,
|
|
27944
|
-
renderedCols.map((column) => /* @__PURE__ */ jsx3(
|
|
27945
|
-
"th",
|
|
27946
|
-
{
|
|
27947
|
-
"data-xlsx-col-header": column.actualCol,
|
|
27948
|
-
ref: (element) => setColHeaderRef(column.actualCol, element),
|
|
27949
|
-
onPointerDown: (event) => handleColumnPointerDown(event, column.actualCol),
|
|
27950
|
-
style: {
|
|
27951
|
-
...headerCellStyle,
|
|
27952
|
-
left: stickyLeftByCol.get(column.actualCol),
|
|
27953
|
-
zIndex: stickyLeftByCol.has(column.actualCol) ? stickyHeaderOverlayZIndex : headerCellStyle.zIndex
|
|
27954
|
-
},
|
|
27955
|
-
children: /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
|
|
27956
|
-
/* @__PURE__ */ jsx3(
|
|
27957
|
-
"span",
|
|
27958
|
-
{
|
|
27959
|
-
style: {
|
|
27960
|
-
display: "inline-block",
|
|
27961
|
-
transform: headerLabelLiveScale !== 1 ? `scale(${1 / headerLabelLiveScale})` : void 0,
|
|
27962
|
-
transformOrigin: "center center"
|
|
27963
|
-
},
|
|
27964
|
-
children: columnLabel2(column.actualCol)
|
|
27965
|
-
}
|
|
27966
|
-
),
|
|
27967
|
-
/* @__PURE__ */ jsx3(
|
|
27968
|
-
"div",
|
|
27969
|
-
{
|
|
27970
|
-
onPointerDown: (event) => {
|
|
27971
|
-
if (!canResizeHeaders) {
|
|
27972
|
-
return;
|
|
27973
|
-
}
|
|
27974
|
-
event.preventDefault();
|
|
27975
|
-
event.stopPropagation();
|
|
27976
|
-
startColumnResize(
|
|
27977
|
-
event.pointerId,
|
|
27978
|
-
column.actualCol,
|
|
27979
|
-
column.size,
|
|
27980
|
-
event.clientX
|
|
27981
|
-
);
|
|
27982
|
-
},
|
|
27983
|
-
style: columnResizeHandleStyle
|
|
27984
|
-
}
|
|
27985
|
-
)
|
|
27986
|
-
] })
|
|
27987
|
-
},
|
|
27988
|
-
column.key
|
|
27989
|
-
)),
|
|
27990
|
-
trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: trailingColumnSpacerWidth } }) : null
|
|
27991
|
-
] }) }),
|
|
27992
|
-
/* @__PURE__ */ jsxs3("tbody", { children: [
|
|
27993
|
-
virtualRows.map((virtualRow, index) => {
|
|
27994
|
-
const actualRow = visibleRows[virtualRow.index];
|
|
27995
|
-
if (actualRow === void 0) {
|
|
27996
|
-
return null;
|
|
27997
|
-
}
|
|
27998
|
-
const previousEnd = index === 0 ? 0 : virtualRows[index - 1]?.end ?? 0;
|
|
27999
|
-
const gapHeight = Math.max(0, virtualRow.start - previousEnd);
|
|
28000
|
-
return /* @__PURE__ */ jsxs3(React4.Fragment, { children: [
|
|
28001
|
-
gapHeight > 0 ? /* @__PURE__ */ jsx3("tr", { "aria-hidden": "true", style: { height: gapHeight }, children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan }) }) : null,
|
|
28002
|
-
/* @__PURE__ */ jsx3(
|
|
28003
|
-
MemoGridRow,
|
|
28004
|
-
{
|
|
28005
|
-
actualRow,
|
|
28006
|
-
editingCell,
|
|
28007
|
-
editingValue,
|
|
28008
|
-
frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
|
|
28009
|
-
getCellData,
|
|
28010
|
-
leadingSpacerWidth: leadingColumnSpacerWidth,
|
|
28011
|
-
onCellClick: handleCellClick,
|
|
28012
|
-
onCellDoubleClick: handleCellDoubleClick,
|
|
28013
|
-
onCellPointerDown: handleCellPointerDown,
|
|
28014
|
-
onEditingCancel: cancelEditing,
|
|
28015
|
-
onEditingCommit: commitEditing,
|
|
28016
|
-
onEditingValueChange: setEditingValue,
|
|
28017
|
-
headerLabelLiveScale,
|
|
28018
|
-
onRowHeaderRef: setRowHeaderRef,
|
|
28019
|
-
onRowPointerDown: handleRowPointerDown,
|
|
28020
|
-
onRowResizePointerDown: handleRowResizePointerDown,
|
|
28021
|
-
palette,
|
|
28022
|
-
readOnly,
|
|
28023
|
-
renderCellAdornment,
|
|
28024
|
-
rowHeight: virtualRow.size,
|
|
28025
|
-
rowHeaderZIndex: rowHeaderOverlayZIndex,
|
|
28026
|
-
rowHeaderWidth: displayRowHeaderWidth,
|
|
28027
|
-
stickyLeftByCol,
|
|
28028
|
-
stickyTop: stickyTopByRow.get(actualRow),
|
|
28029
|
-
trailingSpacerWidth: trailingColumnSpacerWidth,
|
|
28030
|
-
visibleCols: renderedCols,
|
|
28031
|
-
zoomFactor
|
|
28032
|
-
},
|
|
28033
|
-
virtualRow.key
|
|
28034
|
-
)
|
|
28035
|
-
] }, `row-fragment-${virtualRow.key}`);
|
|
28036
|
-
}),
|
|
28037
|
-
virtualRows.length > 0 && totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight) > 0 ? /* @__PURE__ */ jsx3(
|
|
28038
|
-
"tr",
|
|
28039
|
-
{
|
|
28040
|
-
style: {
|
|
28041
|
-
height: totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight)
|
|
28042
|
-
},
|
|
28043
|
-
children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan })
|
|
28044
|
-
}
|
|
28045
|
-
) : null
|
|
28046
|
-
] })
|
|
28047
|
-
]
|
|
27884
|
+
ref: topFrozenHeaderCanvasRef,
|
|
27885
|
+
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27886
|
+
onPointerMove: handleCanvasColumnHeaderPointerMove,
|
|
27887
|
+
onPointerDown: handleCanvasColumnHeaderPointerDown,
|
|
27888
|
+
style: canvasTopFrozenHeaderStyle
|
|
28048
27889
|
}
|
|
28049
27890
|
),
|
|
28050
27891
|
/* @__PURE__ */ jsx3(
|
|
28051
|
-
"
|
|
27892
|
+
"canvas",
|
|
28052
27893
|
{
|
|
28053
|
-
ref:
|
|
28054
|
-
|
|
28055
|
-
|
|
28056
|
-
|
|
28057
|
-
|
|
28058
|
-
contain: "layout paint",
|
|
28059
|
-
height: resolvedSelectionOverlay?.height ?? 0,
|
|
28060
|
-
left: resolvedSelectionOverlay?.left ?? 0,
|
|
28061
|
-
opacity: resolvedSelectionOverlay ? 1 : 0,
|
|
28062
|
-
pointerEvents: "none",
|
|
28063
|
-
position: "absolute",
|
|
28064
|
-
top: resolvedSelectionOverlay?.top ?? 0,
|
|
28065
|
-
transition: canvasSelectionTransition,
|
|
28066
|
-
visibility: resolvedSelectionOverlay ? "visible" : "hidden",
|
|
28067
|
-
willChange: shouldAnimateCanvasSelection ? "left, top, width, height" : void 0,
|
|
28068
|
-
width: resolvedSelectionOverlay?.width ?? 0,
|
|
28069
|
-
zIndex: 24
|
|
28070
|
-
}
|
|
27894
|
+
ref: topScrollHeaderCanvasRef,
|
|
27895
|
+
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27896
|
+
onPointerMove: handleCanvasColumnHeaderPointerMove,
|
|
27897
|
+
onPointerDown: handleCanvasColumnHeaderPointerDown,
|
|
27898
|
+
style: canvasTopScrollHeaderStyle
|
|
28071
27899
|
}
|
|
28072
27900
|
),
|
|
28073
27901
|
/* @__PURE__ */ jsx3(
|
|
28074
|
-
"
|
|
27902
|
+
"canvas",
|
|
28075
27903
|
{
|
|
28076
|
-
ref:
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
display: "inline-flex",
|
|
28082
|
-
fontSize: 10 * zoomFactor,
|
|
28083
|
-
fontWeight: 700,
|
|
28084
|
-
height: 16 * zoomFactor,
|
|
28085
|
-
justifyContent: "center",
|
|
28086
|
-
opacity: 0,
|
|
28087
|
-
pointerEvents: "none",
|
|
28088
|
-
position: "absolute",
|
|
28089
|
-
transform: "translateY(-50%)",
|
|
28090
|
-
visibility: "hidden",
|
|
28091
|
-
width: 12 * zoomFactor,
|
|
28092
|
-
zIndex: 26
|
|
28093
|
-
},
|
|
28094
|
-
children: "\u25BE"
|
|
27904
|
+
ref: leftFrozenHeaderCanvasRef,
|
|
27905
|
+
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27906
|
+
onPointerMove: handleCanvasRowHeaderPointerMove,
|
|
27907
|
+
onPointerDown: handleCanvasRowHeaderPointerDown,
|
|
27908
|
+
style: canvasLeftFrozenHeaderStyle
|
|
28095
27909
|
}
|
|
28096
27910
|
),
|
|
28097
27911
|
/* @__PURE__ */ jsx3(
|
|
28098
|
-
"
|
|
27912
|
+
"canvas",
|
|
28099
27913
|
{
|
|
28100
|
-
ref:
|
|
28101
|
-
|
|
28102
|
-
|
|
28103
|
-
|
|
28104
|
-
|
|
28105
|
-
event.preventDefault();
|
|
28106
|
-
event.stopPropagation();
|
|
28107
|
-
startFillDrag(event.pointerId, normalizedSelection);
|
|
28108
|
-
},
|
|
28109
|
-
style: {
|
|
28110
|
-
backgroundColor: selectionStroke,
|
|
28111
|
-
border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
|
|
28112
|
-
contain: "layout paint",
|
|
28113
|
-
cursor: "crosshair",
|
|
28114
|
-
display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
|
|
28115
|
-
height: 8 * zoomFactor,
|
|
28116
|
-
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
|
|
28117
|
-
pointerEvents: "auto",
|
|
28118
|
-
position: "absolute",
|
|
28119
|
-
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
|
|
28120
|
-
transition: shouldAnimateCanvasSelection ? "left 120ms cubic-bezier(0.22, 1, 0.36, 1), top 120ms cubic-bezier(0.22, 1, 0.36, 1)" : "none",
|
|
28121
|
-
willChange: shouldAnimateCanvasSelection ? "left, top" : void 0,
|
|
28122
|
-
width: 8 * zoomFactor,
|
|
28123
|
-
zIndex: 25
|
|
28124
|
-
}
|
|
27914
|
+
ref: leftScrollHeaderCanvasRef,
|
|
27915
|
+
onPointerLeave: handleCanvasHeaderPointerLeave,
|
|
27916
|
+
onPointerMove: handleCanvasRowHeaderPointerMove,
|
|
27917
|
+
onPointerDown: handleCanvasRowHeaderPointerDown,
|
|
27918
|
+
style: canvasLeftScrollHeaderStyle
|
|
28125
27919
|
}
|
|
28126
27920
|
),
|
|
28127
|
-
|
|
27921
|
+
/* @__PURE__ */ jsx3("canvas", { ref: cornerHeaderCanvasRef, style: canvasCornerHeaderStyle })
|
|
27922
|
+
] }),
|
|
27923
|
+
editingCell && editingOverlayRect ? (() => {
|
|
27924
|
+
const editingCellStyle = getCellData(editingCell.row, editingCell.col).style;
|
|
27925
|
+
const editingBackground = typeof editingCellStyle.backgroundColor === "string" ? editingCellStyle.backgroundColor : resolveSheetSurface(activeSheet, palette);
|
|
27926
|
+
const editingColor = typeof editingCellStyle.color === "string" ? editingCellStyle.color : resolveReadableTextColor(null, editingBackground, palette);
|
|
27927
|
+
return /* @__PURE__ */ jsx3(
|
|
28128
27928
|
"div",
|
|
28129
27929
|
{
|
|
28130
|
-
"aria-hidden": "true",
|
|
28131
27930
|
style: {
|
|
28132
|
-
|
|
28133
|
-
borderRadius: Math.max(999, 3 * zoomFactor),
|
|
28134
|
-
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
28135
|
-
height: resizeGuide.type === "column" ? Math.max(12, 14 * zoomFactor) : Math.max(3, 2 * zoomFactor),
|
|
28136
|
-
left: resizeGuide.type === "column" ? resizeGuide.position - Math.max(2, 1.5 * zoomFactor) : Math.max(3, 4 * zoomFactor),
|
|
28137
|
-
pointerEvents: "none",
|
|
27931
|
+
left: editingOverlayRect.left,
|
|
28138
27932
|
position: "absolute",
|
|
28139
|
-
top:
|
|
28140
|
-
width:
|
|
28141
|
-
|
|
28142
|
-
|
|
28143
|
-
}
|
|
28144
|
-
) : null,
|
|
28145
|
-
!renderTableHeaderMenu && openTableMenuState ? /* @__PURE__ */ jsx3(
|
|
28146
|
-
"div",
|
|
28147
|
-
{
|
|
28148
|
-
ref: tableMenuRef,
|
|
28149
|
-
style: {
|
|
28150
|
-
color: palette.text,
|
|
28151
|
-
left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
|
|
28152
|
-
position: "absolute",
|
|
28153
|
-
top: openTableMenuState.top,
|
|
28154
|
-
zIndex: 50
|
|
27933
|
+
top: editingOverlayRect.top,
|
|
27934
|
+
width: editingOverlayRect.width,
|
|
27935
|
+
height: editingOverlayRect.height,
|
|
27936
|
+
zIndex: 28
|
|
28155
27937
|
},
|
|
28156
27938
|
children: /* @__PURE__ */ jsx3(
|
|
28157
|
-
|
|
27939
|
+
"input",
|
|
28158
27940
|
{
|
|
28159
|
-
|
|
28160
|
-
|
|
28161
|
-
|
|
28162
|
-
|
|
28163
|
-
|
|
28164
|
-
|
|
27941
|
+
ref: editingInputRef,
|
|
27942
|
+
autoFocus: true,
|
|
27943
|
+
onBlur: commitEditing,
|
|
27944
|
+
onChange: (event) => setEditingValue(event.target.value),
|
|
27945
|
+
onKeyDown: (event) => {
|
|
27946
|
+
event.stopPropagation();
|
|
27947
|
+
if (event.key === "Enter") {
|
|
27948
|
+
event.preventDefault();
|
|
27949
|
+
commitEditing();
|
|
27950
|
+
return;
|
|
27951
|
+
}
|
|
27952
|
+
if (event.key === "Escape") {
|
|
27953
|
+
event.preventDefault();
|
|
27954
|
+
cancelEditing();
|
|
27955
|
+
}
|
|
28165
27956
|
},
|
|
28166
|
-
|
|
28167
|
-
|
|
28168
|
-
|
|
27957
|
+
style: {
|
|
27958
|
+
backgroundColor: editingBackground,
|
|
27959
|
+
border: 0,
|
|
27960
|
+
boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
|
|
27961
|
+
boxSizing: "border-box",
|
|
27962
|
+
color: editingColor,
|
|
27963
|
+
display: "block",
|
|
27964
|
+
font: resolveCanvasFont(editingCellStyle, 12 * zoomFactor),
|
|
27965
|
+
height: "100%",
|
|
27966
|
+
margin: 0,
|
|
27967
|
+
minHeight: 0,
|
|
27968
|
+
outline: "none",
|
|
27969
|
+
overflow: "hidden",
|
|
27970
|
+
padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
|
|
27971
|
+
width: "100%"
|
|
28169
27972
|
},
|
|
28170
|
-
|
|
28171
|
-
triggerIcon: "\u25BE",
|
|
28172
|
-
triggerProps: { type: "button" }
|
|
27973
|
+
value: editingValue
|
|
28173
27974
|
}
|
|
28174
27975
|
)
|
|
28175
27976
|
}
|
|
28176
|
-
)
|
|
28177
|
-
|
|
28178
|
-
|
|
28179
|
-
|
|
27977
|
+
);
|
|
27978
|
+
})() : null,
|
|
27979
|
+
activeCellAdornment && activeCellAdornmentRect ? /* @__PURE__ */ jsx3(
|
|
27980
|
+
"div",
|
|
27981
|
+
{
|
|
27982
|
+
style: {
|
|
27983
|
+
height: activeCellAdornmentRect.height,
|
|
27984
|
+
left: activeCellAdornmentRect.left,
|
|
27985
|
+
pointerEvents: "none",
|
|
27986
|
+
position: "absolute",
|
|
27987
|
+
top: activeCellAdornmentRect.top,
|
|
27988
|
+
width: activeCellAdornmentRect.width,
|
|
27989
|
+
zIndex: 27
|
|
27990
|
+
},
|
|
27991
|
+
children: /* @__PURE__ */ jsx3("div", { style: { height: "100%", pointerEvents: "auto", position: "relative", width: "100%" }, children: activeCellAdornment })
|
|
27992
|
+
}
|
|
27993
|
+
) : null
|
|
27994
|
+
] }) : /* @__PURE__ */ jsxs3(
|
|
27995
|
+
"table",
|
|
27996
|
+
{
|
|
27997
|
+
ref: tableRef,
|
|
27998
|
+
style: {
|
|
27999
|
+
borderCollapse: "collapse",
|
|
28000
|
+
color: "#000000",
|
|
28001
|
+
flex: "0 0 auto",
|
|
28002
|
+
tableLayout: "fixed",
|
|
28003
|
+
width: totalWidth
|
|
28004
|
+
},
|
|
28005
|
+
children: [
|
|
28006
|
+
/* @__PURE__ */ jsxs3("colgroup", { children: [
|
|
28007
|
+
/* @__PURE__ */ jsx3("col", { style: { width: displayRowHeaderWidth } }),
|
|
28008
|
+
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: leadingColumnSpacerWidth } }) : null,
|
|
28009
|
+
renderedCols.map((column) => /* @__PURE__ */ jsx3(
|
|
28010
|
+
"col",
|
|
28011
|
+
{
|
|
28012
|
+
ref: (element) => {
|
|
28013
|
+
if (element) {
|
|
28014
|
+
colElementRefs.current.set(column.actualCol, element);
|
|
28015
|
+
} else {
|
|
28016
|
+
colElementRefs.current.delete(column.actualCol);
|
|
28017
|
+
}
|
|
28018
|
+
},
|
|
28019
|
+
style: { width: column.size }
|
|
28020
|
+
},
|
|
28021
|
+
column.key
|
|
28022
|
+
)),
|
|
28023
|
+
trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: trailingColumnSpacerWidth } }) : null
|
|
28024
|
+
] }),
|
|
28025
|
+
/* @__PURE__ */ jsx3("thead", { style: { position: "sticky", top: 0, zIndex: canvasHeaderOverlayZIndex }, children: /* @__PURE__ */ jsxs3("tr", { children: [
|
|
28026
|
+
/* @__PURE__ */ jsx3(
|
|
28027
|
+
"th",
|
|
28028
|
+
{
|
|
28029
|
+
style: {
|
|
28030
|
+
...headerCellStyle,
|
|
28031
|
+
backgroundColor: palette.headerSurface,
|
|
28032
|
+
left: 0,
|
|
28033
|
+
width: displayRowHeaderWidth,
|
|
28034
|
+
zIndex: cornerHeaderOverlayZIndex
|
|
28035
|
+
}
|
|
28036
|
+
}
|
|
28037
|
+
),
|
|
28038
|
+
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: leadingColumnSpacerWidth } }) : null,
|
|
28039
|
+
renderedCols.map((column) => /* @__PURE__ */ jsx3(
|
|
28040
|
+
"th",
|
|
28041
|
+
{
|
|
28042
|
+
"data-xlsx-col-header": column.actualCol,
|
|
28043
|
+
ref: (element) => setColHeaderRef(column.actualCol, element),
|
|
28044
|
+
onPointerDown: (event) => handleColumnPointerDown(event, column.actualCol),
|
|
28045
|
+
style: {
|
|
28046
|
+
...headerCellStyle,
|
|
28047
|
+
left: stickyLeftByCol.get(column.actualCol),
|
|
28048
|
+
zIndex: stickyLeftByCol.has(column.actualCol) ? stickyHeaderOverlayZIndex : headerCellStyle.zIndex
|
|
28049
|
+
},
|
|
28050
|
+
children: /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
|
|
28051
|
+
/* @__PURE__ */ jsx3(
|
|
28052
|
+
"span",
|
|
28053
|
+
{
|
|
28054
|
+
style: {
|
|
28055
|
+
display: "inline-block",
|
|
28056
|
+
transform: headerLabelLiveScale !== 1 ? `scale(${1 / headerLabelLiveScale})` : void 0,
|
|
28057
|
+
transformOrigin: "center center"
|
|
28058
|
+
},
|
|
28059
|
+
children: columnLabel2(column.actualCol)
|
|
28060
|
+
}
|
|
28061
|
+
),
|
|
28062
|
+
/* @__PURE__ */ jsx3(
|
|
28063
|
+
"div",
|
|
28064
|
+
{
|
|
28065
|
+
onPointerDown: (event) => {
|
|
28066
|
+
if (!canResizeHeaders) {
|
|
28067
|
+
return;
|
|
28068
|
+
}
|
|
28069
|
+
event.preventDefault();
|
|
28070
|
+
event.stopPropagation();
|
|
28071
|
+
startColumnResize(
|
|
28072
|
+
event.pointerId,
|
|
28073
|
+
column.actualCol,
|
|
28074
|
+
column.size,
|
|
28075
|
+
event.clientX
|
|
28076
|
+
);
|
|
28077
|
+
},
|
|
28078
|
+
style: columnResizeHandleStyle
|
|
28079
|
+
}
|
|
28080
|
+
)
|
|
28081
|
+
] })
|
|
28082
|
+
},
|
|
28083
|
+
column.key
|
|
28084
|
+
)),
|
|
28085
|
+
trailingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("th", { "aria-hidden": "true", style: { ...headerCellStyle, padding: 0, width: trailingColumnSpacerWidth } }) : null
|
|
28086
|
+
] }) }),
|
|
28087
|
+
/* @__PURE__ */ jsxs3("tbody", { children: [
|
|
28088
|
+
virtualRows.map((virtualRow, index) => {
|
|
28089
|
+
const actualRow = visibleRows[virtualRow.index];
|
|
28090
|
+
if (actualRow === void 0) {
|
|
28091
|
+
return null;
|
|
28092
|
+
}
|
|
28093
|
+
const previousEnd = index === 0 ? 0 : virtualRows[index - 1]?.end ?? 0;
|
|
28094
|
+
const gapHeight = Math.max(0, virtualRow.start - previousEnd);
|
|
28095
|
+
return /* @__PURE__ */ jsxs3(React4.Fragment, { children: [
|
|
28096
|
+
gapHeight > 0 ? /* @__PURE__ */ jsx3("tr", { "aria-hidden": "true", style: { height: gapHeight }, children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan }) }) : null,
|
|
28097
|
+
/* @__PURE__ */ jsx3(
|
|
28098
|
+
MemoGridRow,
|
|
28099
|
+
{
|
|
28100
|
+
actualRow,
|
|
28101
|
+
editingCell,
|
|
28102
|
+
editingValue,
|
|
28103
|
+
frozenRowHeaderZIndex: frozenRowHeaderOverlayZIndex,
|
|
28104
|
+
getCellData,
|
|
28105
|
+
leadingSpacerWidth: leadingColumnSpacerWidth,
|
|
28106
|
+
onCellClick: handleCellClick,
|
|
28107
|
+
onCellDoubleClick: handleCellDoubleClick,
|
|
28108
|
+
onCellPointerDown: handleCellPointerDown,
|
|
28109
|
+
onEditingCancel: cancelEditing,
|
|
28110
|
+
onEditingCommit: commitEditing,
|
|
28111
|
+
onEditingValueChange: setEditingValue,
|
|
28112
|
+
headerLabelLiveScale,
|
|
28113
|
+
onRowHeaderRef: setRowHeaderRef,
|
|
28114
|
+
onRowPointerDown: handleRowPointerDown,
|
|
28115
|
+
onRowResizePointerDown: handleRowResizePointerDown,
|
|
28116
|
+
palette,
|
|
28117
|
+
readOnly,
|
|
28118
|
+
renderCellAdornment,
|
|
28119
|
+
rowHeight: virtualRow.size,
|
|
28120
|
+
rowHeaderZIndex: rowHeaderOverlayZIndex,
|
|
28121
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
28122
|
+
stickyLeftByCol,
|
|
28123
|
+
stickyTop: stickyTopByRow.get(actualRow),
|
|
28124
|
+
trailingSpacerWidth: trailingColumnSpacerWidth,
|
|
28125
|
+
visibleCols: renderedCols,
|
|
28126
|
+
zoomFactor
|
|
28127
|
+
},
|
|
28128
|
+
virtualRow.key
|
|
28129
|
+
)
|
|
28130
|
+
] }, `row-fragment-${virtualRow.key}`);
|
|
28131
|
+
}),
|
|
28132
|
+
virtualRows.length > 0 && totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight) > 0 ? /* @__PURE__ */ jsx3(
|
|
28133
|
+
"tr",
|
|
28134
|
+
{
|
|
28135
|
+
style: {
|
|
28136
|
+
height: totalHeight - (virtualRows[virtualRows.length - 1]?.end ?? totalHeight)
|
|
28137
|
+
},
|
|
28138
|
+
children: /* @__PURE__ */ jsx3("td", { colSpan: rowColSpan })
|
|
28139
|
+
}
|
|
28140
|
+
) : null
|
|
28141
|
+
] })
|
|
28142
|
+
]
|
|
28143
|
+
}
|
|
28144
|
+
),
|
|
28145
|
+
/* @__PURE__ */ jsx3(
|
|
28146
|
+
"div",
|
|
28147
|
+
{
|
|
28148
|
+
ref: selectionOverlayRef,
|
|
28149
|
+
style: {
|
|
28150
|
+
backgroundColor: selectionFill,
|
|
28151
|
+
boxSizing: "border-box",
|
|
28152
|
+
boxShadow: `inset 0 0 0 ${selectionBorderWidth}px ${selectionStroke}`,
|
|
28153
|
+
contain: "layout paint",
|
|
28154
|
+
height: resolvedSelectionOverlay?.height ?? 0,
|
|
28155
|
+
left: resolvedSelectionOverlay?.left ?? 0,
|
|
28156
|
+
opacity: resolvedSelectionOverlay ? 1 : 0,
|
|
28157
|
+
pointerEvents: "none",
|
|
28158
|
+
position: "absolute",
|
|
28159
|
+
top: resolvedSelectionOverlay?.top ?? 0,
|
|
28160
|
+
transition: canvasSelectionTransition,
|
|
28161
|
+
visibility: resolvedSelectionOverlay ? "visible" : "hidden",
|
|
28162
|
+
willChange: shouldAnimateCanvasSelection ? "left, top, width, height" : void 0,
|
|
28163
|
+
width: resolvedSelectionOverlay?.width ?? 0,
|
|
28164
|
+
zIndex: 24
|
|
28165
|
+
}
|
|
28166
|
+
}
|
|
28167
|
+
),
|
|
28168
|
+
/* @__PURE__ */ jsx3(
|
|
28169
|
+
"div",
|
|
28170
|
+
{
|
|
28171
|
+
ref: activeValidationOverlayRef,
|
|
28172
|
+
"aria-hidden": "true",
|
|
28173
|
+
style: {
|
|
28174
|
+
alignItems: "center",
|
|
28175
|
+
color: palette.mutedText,
|
|
28176
|
+
display: "inline-flex",
|
|
28177
|
+
fontSize: 10 * zoomFactor,
|
|
28178
|
+
fontWeight: 700,
|
|
28179
|
+
height: 16 * zoomFactor,
|
|
28180
|
+
justifyContent: "center",
|
|
28181
|
+
opacity: 0,
|
|
28182
|
+
pointerEvents: "none",
|
|
28183
|
+
position: "absolute",
|
|
28184
|
+
transform: "translateY(-50%)",
|
|
28185
|
+
visibility: "hidden",
|
|
28186
|
+
width: 12 * zoomFactor,
|
|
28187
|
+
zIndex: 26
|
|
28188
|
+
},
|
|
28189
|
+
children: "\u25BE"
|
|
28190
|
+
}
|
|
28191
|
+
),
|
|
28192
|
+
/* @__PURE__ */ jsx3(
|
|
28193
|
+
"div",
|
|
28194
|
+
{
|
|
28195
|
+
ref: fillHandleRef,
|
|
28196
|
+
onPointerDown: (event) => {
|
|
28197
|
+
if (readOnly || event.button !== 0 || !normalizedSelection || !resolvedSelectionOverlay) {
|
|
28198
|
+
return;
|
|
28199
|
+
}
|
|
28200
|
+
event.preventDefault();
|
|
28201
|
+
event.stopPropagation();
|
|
28202
|
+
startFillDrag(event.pointerId, normalizedSelection);
|
|
28203
|
+
},
|
|
28204
|
+
style: {
|
|
28205
|
+
backgroundColor: selectionStroke,
|
|
28206
|
+
border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
|
|
28207
|
+
contain: "layout paint",
|
|
28208
|
+
cursor: "crosshair",
|
|
28209
|
+
display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
|
|
28210
|
+
height: 8 * zoomFactor,
|
|
28211
|
+
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
|
|
28212
|
+
pointerEvents: "auto",
|
|
28213
|
+
position: "absolute",
|
|
28214
|
+
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
|
|
28215
|
+
transition: shouldAnimateCanvasSelection ? "left 120ms cubic-bezier(0.22, 1, 0.36, 1), top 120ms cubic-bezier(0.22, 1, 0.36, 1)" : "none",
|
|
28216
|
+
willChange: shouldAnimateCanvasSelection ? "left, top" : void 0,
|
|
28217
|
+
width: 8 * zoomFactor,
|
|
28218
|
+
zIndex: 25
|
|
28219
|
+
}
|
|
28220
|
+
}
|
|
28221
|
+
),
|
|
28222
|
+
resizeGuide ? /* @__PURE__ */ jsx3(
|
|
28223
|
+
"div",
|
|
28224
|
+
{
|
|
28225
|
+
"aria-hidden": "true",
|
|
28226
|
+
style: {
|
|
28227
|
+
backgroundColor: selectionStroke,
|
|
28228
|
+
borderRadius: Math.max(999, 3 * zoomFactor),
|
|
28229
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
28230
|
+
height: resizeGuide.type === "column" ? Math.max(12, 14 * zoomFactor) : Math.max(3, 2 * zoomFactor),
|
|
28231
|
+
left: resizeGuide.type === "column" ? resizeGuide.position - Math.max(2, 1.5 * zoomFactor) : Math.max(3, 4 * zoomFactor),
|
|
28232
|
+
pointerEvents: "none",
|
|
28233
|
+
position: "absolute",
|
|
28234
|
+
top: resizeGuide.type === "column" ? Math.max(2 * zoomFactor, displayHeaderHeight - Math.max(14, 16 * zoomFactor)) : resizeGuide.position - Math.max(2, 1.5 * zoomFactor),
|
|
28235
|
+
width: resizeGuide.type === "column" ? Math.max(3, 2 * zoomFactor) : Math.max(12, 14 * zoomFactor),
|
|
28236
|
+
zIndex: 52
|
|
28237
|
+
}
|
|
28238
|
+
}
|
|
28239
|
+
) : null,
|
|
28240
|
+
!renderTableHeaderMenu && openTableMenuState ? /* @__PURE__ */ jsx3(
|
|
28241
|
+
"div",
|
|
28242
|
+
{
|
|
28243
|
+
ref: tableMenuRef,
|
|
28244
|
+
style: {
|
|
28245
|
+
color: palette.text,
|
|
28246
|
+
left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
|
|
28247
|
+
position: "absolute",
|
|
28248
|
+
top: openTableMenuState.top,
|
|
28249
|
+
zIndex: 50
|
|
28250
|
+
},
|
|
28251
|
+
children: /* @__PURE__ */ jsx3(
|
|
28252
|
+
DefaultTableHeaderMenu,
|
|
28253
|
+
{
|
|
28254
|
+
cell: { col: openTableMenuState.column.index + openTableMenuState.table.start.col, row: openTableMenuState.table.start.row },
|
|
28255
|
+
column: openTableMenuState.column,
|
|
28256
|
+
direction: sortState && sortState.tableName === openTableMenuState.table.name && sortState.columnIndex === openTableMenuState.column.index ? sortState.direction : null,
|
|
28257
|
+
sortAscending: () => {
|
|
28258
|
+
sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "ascending");
|
|
28259
|
+
setOpenTableMenu(null);
|
|
28260
|
+
},
|
|
28261
|
+
sortDescending: () => {
|
|
28262
|
+
sortTable(openTableMenuState.table.name, openTableMenuState.column.index, "descending");
|
|
28263
|
+
setOpenTableMenu(null);
|
|
28264
|
+
},
|
|
28265
|
+
table: openTableMenuState.table,
|
|
28266
|
+
triggerIcon: "\u25BE",
|
|
28267
|
+
triggerProps: { type: "button" }
|
|
28268
|
+
}
|
|
28269
|
+
)
|
|
28270
|
+
}
|
|
28271
|
+
) : null
|
|
28272
|
+
]
|
|
28180
28273
|
}
|
|
28181
28274
|
)
|
|
28182
|
-
}
|
|
28183
|
-
|
|
28184
|
-
) });
|
|
28275
|
+
}
|
|
28276
|
+
);
|
|
28277
|
+
return /* @__PURE__ */ jsx3("div", { style: { backgroundColor: palette.canvas, display: "flex", flex: 1, minHeight: 0, minWidth: 0 }, children: renderScroller ? renderScroller({ children: scrollerContent, viewportProps: scrollerViewportProps }) : /* @__PURE__ */ jsx3("div", { ...scrollerViewportProps, children: scrollerContent }) });
|
|
28185
28278
|
}
|
|
28186
28279
|
function XlsxViewerInner({
|
|
28187
28280
|
allowResizeInReadOnly = false,
|
|
@@ -28200,6 +28293,7 @@ function XlsxViewerInner({
|
|
|
28200
28293
|
renderChartLoading,
|
|
28201
28294
|
renderImage,
|
|
28202
28295
|
renderImageSelection,
|
|
28296
|
+
renderScroller,
|
|
28203
28297
|
renderTableHeaderMenu,
|
|
28204
28298
|
rounded = true,
|
|
28205
28299
|
selectionColor,
|
|
@@ -28261,6 +28355,7 @@ function XlsxViewerInner({
|
|
|
28261
28355
|
renderChartLoading,
|
|
28262
28356
|
renderImage,
|
|
28263
28357
|
renderImageSelection,
|
|
28358
|
+
renderScroller,
|
|
28264
28359
|
renderTableHeaderMenu,
|
|
28265
28360
|
selectionColor,
|
|
28266
28361
|
selectionFillColor,
|