@extend-ai/react-xlsx 0.2.0 → 0.3.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 +396 -260
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +396 -263
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5929,21 +5929,35 @@ function getSheetsWasmModule() {
|
|
|
5929
5929
|
}
|
|
5930
5930
|
|
|
5931
5931
|
// src/worker-client.ts
|
|
5932
|
+
function createAbortError() {
|
|
5933
|
+
if (typeof DOMException !== "undefined") {
|
|
5934
|
+
return new DOMException("Aborted", "AbortError");
|
|
5935
|
+
}
|
|
5936
|
+
const error = new Error("Aborted");
|
|
5937
|
+
error.name = "AbortError";
|
|
5938
|
+
return error;
|
|
5939
|
+
}
|
|
5932
5940
|
var XlsxWorkerClient = class {
|
|
5933
5941
|
worker;
|
|
5934
5942
|
nextRequestId = 1;
|
|
5935
5943
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
5944
|
+
disposed = false;
|
|
5936
5945
|
constructor() {
|
|
5937
5946
|
this.worker = new Worker(new URL("./xlsx-worker.js", import.meta.url), { type: "module" });
|
|
5938
5947
|
this.worker.addEventListener("message", this.handleMessage);
|
|
5939
5948
|
this.worker.addEventListener("error", this.handleError);
|
|
5940
5949
|
}
|
|
5941
5950
|
dispose() {
|
|
5951
|
+
if (this.disposed) {
|
|
5952
|
+
return;
|
|
5953
|
+
}
|
|
5954
|
+
this.disposed = true;
|
|
5942
5955
|
this.worker.removeEventListener("message", this.handleMessage);
|
|
5943
5956
|
this.worker.removeEventListener("error", this.handleError);
|
|
5944
5957
|
this.worker.terminate();
|
|
5958
|
+
const abortError = createAbortError();
|
|
5945
5959
|
for (const request of this.pendingRequests.values()) {
|
|
5946
|
-
request.reject(
|
|
5960
|
+
request.reject(abortError);
|
|
5947
5961
|
}
|
|
5948
5962
|
this.pendingRequests.clear();
|
|
5949
5963
|
}
|
|
@@ -5979,6 +5993,10 @@ var XlsxWorkerClient = class {
|
|
|
5979
5993
|
}
|
|
5980
5994
|
request(message, transfer = []) {
|
|
5981
5995
|
return new Promise((resolve, reject) => {
|
|
5996
|
+
if (this.disposed) {
|
|
5997
|
+
reject(createAbortError());
|
|
5998
|
+
return;
|
|
5999
|
+
}
|
|
5982
6000
|
const id = this.nextRequestId;
|
|
5983
6001
|
this.nextRequestId += 1;
|
|
5984
6002
|
this.pendingRequests.set(id, { reject, resolve });
|
|
@@ -6610,12 +6628,26 @@ function parseClipboardText(text) {
|
|
|
6610
6628
|
}
|
|
6611
6629
|
return rows.map((row) => row.split(" "));
|
|
6612
6630
|
}
|
|
6613
|
-
|
|
6631
|
+
function createAbortError2() {
|
|
6632
|
+
if (typeof DOMException !== "undefined") {
|
|
6633
|
+
return new DOMException("Aborted", "AbortError");
|
|
6634
|
+
}
|
|
6635
|
+
const error = new Error("Aborted");
|
|
6636
|
+
error.name = "AbortError";
|
|
6637
|
+
return error;
|
|
6638
|
+
}
|
|
6639
|
+
function isAbortError(error) {
|
|
6640
|
+
return error instanceof Error && error.name === "AbortError";
|
|
6641
|
+
}
|
|
6642
|
+
async function resolveWorkbookBuffer({ file, src }, signal) {
|
|
6614
6643
|
let buffer;
|
|
6644
|
+
if (signal?.aborted) {
|
|
6645
|
+
throw createAbortError2();
|
|
6646
|
+
}
|
|
6615
6647
|
if (file) {
|
|
6616
6648
|
buffer = file;
|
|
6617
6649
|
} else if (src) {
|
|
6618
|
-
const response = await fetch(src);
|
|
6650
|
+
const response = await fetch(src, { signal });
|
|
6619
6651
|
if (!response.ok) {
|
|
6620
6652
|
throw new Error(`Failed to fetch workbook (status ${response.status})`);
|
|
6621
6653
|
}
|
|
@@ -7380,10 +7412,13 @@ function useXlsxViewerController(options) {
|
|
|
7380
7412
|
} catch {
|
|
7381
7413
|
triggerFallback();
|
|
7382
7414
|
}
|
|
7383
|
-
}).catch(() => {
|
|
7415
|
+
}).catch((error2) => {
|
|
7384
7416
|
if (workerTimeoutHandle !== null) {
|
|
7385
7417
|
window.clearTimeout(workerTimeoutHandle);
|
|
7386
7418
|
}
|
|
7419
|
+
if (isAbortError(error2)) {
|
|
7420
|
+
return;
|
|
7421
|
+
}
|
|
7387
7422
|
triggerFallback();
|
|
7388
7423
|
});
|
|
7389
7424
|
}, [getWorkerClient, hasIncompleteWorkerChartSnapshot, setChartAssets, workerSupported]);
|
|
@@ -7453,6 +7488,7 @@ function useXlsxViewerController(options) {
|
|
|
7453
7488
|
return;
|
|
7454
7489
|
}
|
|
7455
7490
|
let isCurrent = true;
|
|
7491
|
+
const abortController = new AbortController();
|
|
7456
7492
|
setIsLoading(true);
|
|
7457
7493
|
setError(null);
|
|
7458
7494
|
clearImageAssets();
|
|
@@ -7477,11 +7513,9 @@ function useXlsxViewerController(options) {
|
|
|
7477
7513
|
setSortState(null);
|
|
7478
7514
|
setZoomScaleOverridesByTabId({});
|
|
7479
7515
|
setRevision(0);
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
void resolveWorkbookBuffer({ file, src }).then(async (buffer) => {
|
|
7484
|
-
if (!isCurrent) {
|
|
7516
|
+
disposeWorkerClient();
|
|
7517
|
+
void resolveWorkbookBuffer({ file, src }, abortController.signal).then(async (buffer) => {
|
|
7518
|
+
if (!isCurrent || abortController.signal.aborted) {
|
|
7485
7519
|
return;
|
|
7486
7520
|
}
|
|
7487
7521
|
if (maxFileSizeBytes > 0 && buffer.byteLength > maxFileSizeBytes) {
|
|
@@ -7507,7 +7541,7 @@ function useXlsxViewerController(options) {
|
|
|
7507
7541
|
if (shouldUseWorkerForLoad) {
|
|
7508
7542
|
try {
|
|
7509
7543
|
const snapshot = await getWorkerClient().loadWorkbook(buffer);
|
|
7510
|
-
if (!isCurrent) {
|
|
7544
|
+
if (!isCurrent || abortController.signal.aborted) {
|
|
7511
7545
|
return;
|
|
7512
7546
|
}
|
|
7513
7547
|
if (hasIncompleteWorkerChartSnapshot(snapshot)) {
|
|
@@ -7527,6 +7561,9 @@ function useXlsxViewerController(options) {
|
|
|
7527
7561
|
setIsLoading(false);
|
|
7528
7562
|
return;
|
|
7529
7563
|
} catch (workerError) {
|
|
7564
|
+
if (!isCurrent || isAbortError(workerError)) {
|
|
7565
|
+
return;
|
|
7566
|
+
}
|
|
7530
7567
|
if (!shouldFallbackFromWorkerError(workerError)) {
|
|
7531
7568
|
throw workerError;
|
|
7532
7569
|
}
|
|
@@ -7534,7 +7571,7 @@ function useXlsxViewerController(options) {
|
|
|
7534
7571
|
}
|
|
7535
7572
|
}
|
|
7536
7573
|
const { imageAssets: nextImageAssets, parsedWorkbook: nextParsedWorkbook } = await loadWorkbookOnMainThread(buffer);
|
|
7537
|
-
if (!isCurrent) {
|
|
7574
|
+
if (!isCurrent || abortController.signal.aborted) {
|
|
7538
7575
|
revokeWorkbookImageAssets(nextImageAssets);
|
|
7539
7576
|
return;
|
|
7540
7577
|
}
|
|
@@ -7556,7 +7593,7 @@ function useXlsxViewerController(options) {
|
|
|
7556
7593
|
setSortState(null);
|
|
7557
7594
|
setIsLoading(false);
|
|
7558
7595
|
}).catch((nextError) => {
|
|
7559
|
-
if (!isCurrent) {
|
|
7596
|
+
if (!isCurrent || isAbortError(nextError)) {
|
|
7560
7597
|
return;
|
|
7561
7598
|
}
|
|
7562
7599
|
setWorkbook(null);
|
|
@@ -7572,9 +7609,8 @@ function useXlsxViewerController(options) {
|
|
|
7572
7609
|
});
|
|
7573
7610
|
return () => {
|
|
7574
7611
|
isCurrent = false;
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
}
|
|
7612
|
+
abortController.abort();
|
|
7613
|
+
disposeWorkerClient();
|
|
7578
7614
|
};
|
|
7579
7615
|
}, [
|
|
7580
7616
|
clearChartAssets,
|
|
@@ -7740,6 +7776,9 @@ function useXlsxViewerController(options) {
|
|
|
7740
7776
|
setIsChartsLoading(false);
|
|
7741
7777
|
setIsLoading(false);
|
|
7742
7778
|
}).catch(async (workerError) => {
|
|
7779
|
+
if (isAbortError(workerError)) {
|
|
7780
|
+
return;
|
|
7781
|
+
}
|
|
7743
7782
|
if (!shouldFallbackFromWorkerError(workerError)) {
|
|
7744
7783
|
throw workerError;
|
|
7745
7784
|
}
|
|
@@ -9422,9 +9461,6 @@ function useXlsxViewerController(options) {
|
|
|
9422
9461
|
// src/XlsxViewer.tsx
|
|
9423
9462
|
import * as React4 from "react";
|
|
9424
9463
|
import {
|
|
9425
|
-
elementScroll,
|
|
9426
|
-
observeElementOffset,
|
|
9427
|
-
observeElementRect,
|
|
9428
9464
|
useVirtualizer
|
|
9429
9465
|
} from "@tanstack/react-virtual";
|
|
9430
9466
|
|
|
@@ -15888,21 +15924,68 @@ var IMAGE_HANDLE_CURSOR = {
|
|
|
15888
15924
|
sw: "nesw-resize",
|
|
15889
15925
|
w: "ew-resize"
|
|
15890
15926
|
};
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15927
|
+
var NUMERIC_LENGTH_STYLE_KEYS = /* @__PURE__ */ new Set([
|
|
15928
|
+
"borderRadius",
|
|
15929
|
+
"borderTopLeftRadius",
|
|
15930
|
+
"borderTopRightRadius",
|
|
15931
|
+
"borderBottomLeftRadius",
|
|
15932
|
+
"borderBottomRightRadius",
|
|
15933
|
+
"bottom",
|
|
15934
|
+
"fontSize",
|
|
15935
|
+
"gap",
|
|
15936
|
+
"height",
|
|
15937
|
+
"left",
|
|
15938
|
+
"letterSpacing",
|
|
15939
|
+
"margin",
|
|
15940
|
+
"marginBottom",
|
|
15941
|
+
"marginLeft",
|
|
15942
|
+
"marginRight",
|
|
15943
|
+
"marginTop",
|
|
15944
|
+
"maxHeight",
|
|
15945
|
+
"maxWidth",
|
|
15946
|
+
"minHeight",
|
|
15947
|
+
"minWidth",
|
|
15948
|
+
"outlineOffset",
|
|
15949
|
+
"outlineWidth",
|
|
15950
|
+
"padding",
|
|
15951
|
+
"paddingBottom",
|
|
15952
|
+
"paddingLeft",
|
|
15953
|
+
"paddingRight",
|
|
15954
|
+
"paddingTop",
|
|
15955
|
+
"right",
|
|
15956
|
+
"textIndent",
|
|
15957
|
+
"top",
|
|
15958
|
+
"width"
|
|
15959
|
+
]);
|
|
15960
|
+
function scaleCssLengthExpression(value, scale) {
|
|
15961
|
+
if (scale === 1) {
|
|
15962
|
+
return value;
|
|
15963
|
+
}
|
|
15964
|
+
return value.replace(/(-?\d*\.?\d+)(px|pt)\b/g, (_, rawNumber, unit) => {
|
|
15965
|
+
const nextValue = Number.parseFloat(rawNumber);
|
|
15966
|
+
if (!Number.isFinite(nextValue)) {
|
|
15967
|
+
return `${rawNumber}${unit}`;
|
|
15968
|
+
}
|
|
15969
|
+
return `${nextValue * scale}${unit}`;
|
|
15897
15970
|
});
|
|
15898
15971
|
}
|
|
15899
|
-
function
|
|
15900
|
-
|
|
15901
|
-
|
|
15972
|
+
function scaleCssProperties(style, scale) {
|
|
15973
|
+
if (scale === 1) {
|
|
15974
|
+
return style;
|
|
15975
|
+
}
|
|
15976
|
+
const nextStyle = {};
|
|
15977
|
+
Object.entries(style).forEach(([key, value]) => {
|
|
15978
|
+
if (typeof value === "string") {
|
|
15979
|
+
nextStyle[key] = scaleCssLengthExpression(value, scale);
|
|
15980
|
+
return;
|
|
15981
|
+
}
|
|
15982
|
+
if (typeof value === "number" && NUMERIC_LENGTH_STYLE_KEYS.has(key)) {
|
|
15983
|
+
nextStyle[key] = value * scale;
|
|
15984
|
+
return;
|
|
15985
|
+
}
|
|
15986
|
+
nextStyle[key] = value;
|
|
15902
15987
|
});
|
|
15903
|
-
|
|
15904
|
-
function scrollToZoomedOffset(offset, zoomFactor, options, instance) {
|
|
15905
|
-
elementScroll(offset * zoomFactor, options, instance);
|
|
15988
|
+
return nextStyle;
|
|
15906
15989
|
}
|
|
15907
15990
|
function formatZoomScale(zoomScale) {
|
|
15908
15991
|
return `${Math.round(zoomScale)}%`;
|
|
@@ -16139,7 +16222,9 @@ function resolveAxisStartOffset(actualIndex, actualIndices, sizes, indexByActual
|
|
|
16139
16222
|
return sumBeforeActualIndex(actualIndices, sizes, actualIndex);
|
|
16140
16223
|
}
|
|
16141
16224
|
function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWidths, options) {
|
|
16142
|
-
const
|
|
16225
|
+
const headerHeight = options?.headerHeight ?? HEADER_HEIGHT;
|
|
16226
|
+
const rowHeaderWidth = options?.rowHeaderWidth ?? ROW_HEADER_WIDTH;
|
|
16227
|
+
const resolveMarkerLeft = (col, colOffsetEmu) => rowHeaderWidth + resolveAxisStartOffset(
|
|
16143
16228
|
col,
|
|
16144
16229
|
visibleCols,
|
|
16145
16230
|
colWidths,
|
|
@@ -16147,7 +16232,7 @@ function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWi
|
|
|
16147
16232
|
options?.colPrefixSums,
|
|
16148
16233
|
options?.actualColPrefixSums
|
|
16149
16234
|
) + emuToPixels(colOffsetEmu);
|
|
16150
|
-
const resolveMarkerTop = (row, rowOffsetEmu) =>
|
|
16235
|
+
const resolveMarkerTop = (row, rowOffsetEmu) => headerHeight + resolveAxisStartOffset(
|
|
16151
16236
|
row,
|
|
16152
16237
|
visibleRows,
|
|
16153
16238
|
rowHeights,
|
|
@@ -16158,8 +16243,8 @@ function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWi
|
|
|
16158
16243
|
if (anchor.kind === "absolute") {
|
|
16159
16244
|
return {
|
|
16160
16245
|
height: Math.max(1, emuToPixels(anchor.sizeEmu.cy)),
|
|
16161
|
-
left:
|
|
16162
|
-
top:
|
|
16246
|
+
left: rowHeaderWidth + emuToPixels(anchor.positionEmu.x),
|
|
16247
|
+
top: headerHeight + emuToPixels(anchor.positionEmu.y),
|
|
16163
16248
|
width: Math.max(1, emuToPixels(anchor.sizeEmu.cx))
|
|
16164
16249
|
};
|
|
16165
16250
|
}
|
|
@@ -16239,14 +16324,18 @@ function rectIntersectsViewport(rect, viewport, overscan = 240) {
|
|
|
16239
16324
|
const rectBottom = rect.top + rect.height;
|
|
16240
16325
|
return rectRight >= viewportLeft && rect.left <= viewportRight && rectBottom >= viewportTop && rect.top <= viewportBottom;
|
|
16241
16326
|
}
|
|
16242
|
-
function resolveFrozenDrawingPane(rect, frozenRows, frozenCols, actualRowHeights, actualColWidths, freezePanes, stickyTopByRow, stickyLeftByCol) {
|
|
16327
|
+
function resolveFrozenDrawingPane(rect, frozenRows, frozenCols, actualRowHeights, actualColWidths, freezePanes, stickyTopByRow, stickyLeftByCol, options) {
|
|
16328
|
+
const headerHeight = options?.headerHeight ?? HEADER_HEIGHT;
|
|
16329
|
+
const rowHeaderWidth = options?.rowHeaderWidth ?? ROW_HEADER_WIDTH;
|
|
16330
|
+
const defaultRowHeight = options?.defaultRowHeight ?? DEFAULT_ROW_HEIGHT2;
|
|
16331
|
+
const defaultColWidth = options?.defaultColWidth ?? DEFAULT_COL_WIDTH2;
|
|
16243
16332
|
const frozenPaneBottom = freezePanes?.row && freezePanes.row > 0 && frozenRows.length > 0 ? frozenRows.reduce(
|
|
16244
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
16245
|
-
|
|
16333
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? headerHeight) + (actualRowHeights[row] ?? defaultRowHeight)),
|
|
16334
|
+
headerHeight
|
|
16246
16335
|
) : null;
|
|
16247
16336
|
const frozenPaneRight = freezePanes?.col && freezePanes.col > 0 && frozenCols.length > 0 ? frozenCols.reduce(
|
|
16248
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
16249
|
-
|
|
16337
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? rowHeaderWidth) + (actualColWidths[col] ?? defaultColWidth)),
|
|
16338
|
+
rowHeaderWidth
|
|
16250
16339
|
) : null;
|
|
16251
16340
|
const freezeTop = frozenPaneBottom !== null && rect.top + rect.height <= frozenPaneBottom + 0.5;
|
|
16252
16341
|
const freezeLeft = frozenPaneRight !== null && rect.left + rect.width <= frozenPaneRight + 0.5;
|
|
@@ -16261,8 +16350,8 @@ function resolveFrozenDrawingPane(rect, frozenRows, frozenCols, actualRowHeights
|
|
|
16261
16350
|
}
|
|
16262
16351
|
return "scroll";
|
|
16263
16352
|
}
|
|
16264
|
-
function buildShapeContainerStyle(shape, rect) {
|
|
16265
|
-
const borderWidth = shape.stroke?.none ? 0 : Math.max(0, shape.stroke?.widthPx ?? 0);
|
|
16353
|
+
function buildShapeContainerStyle(shape, rect, viewerScale = 1) {
|
|
16354
|
+
const borderWidth = shape.stroke?.none ? 0 : Math.max(0, shape.stroke?.widthPx ?? 0) * viewerScale;
|
|
16266
16355
|
const strokeColor = shape.stroke?.color ?? "transparent";
|
|
16267
16356
|
const fillColor = shape.fill?.none ? "transparent" : shape.fill?.color ?? "transparent";
|
|
16268
16357
|
const hasVisibleText = shape.paragraphs.some((paragraph) => paragraph.runs.some((run) => run.text.trim().length > 0));
|
|
@@ -16275,7 +16364,7 @@ function buildShapeContainerStyle(shape, rect) {
|
|
|
16275
16364
|
if (shape.geometry === "ellipse") {
|
|
16276
16365
|
borderRadius = "9999px";
|
|
16277
16366
|
} else if (shape.geometry === "roundRect") {
|
|
16278
|
-
borderRadius = 12;
|
|
16367
|
+
borderRadius = 12 * viewerScale;
|
|
16279
16368
|
}
|
|
16280
16369
|
return {
|
|
16281
16370
|
alignItems: shape.textBox?.verticalAlign === "middle" ? "center" : shape.textBox?.verticalAlign === "bottom" ? "flex-end" : "flex-start",
|
|
@@ -17203,25 +17292,29 @@ function renderShapeParagraph(paragraph, index, fallbackAlign = "left", textScal
|
|
|
17203
17292
|
index
|
|
17204
17293
|
);
|
|
17205
17294
|
}
|
|
17206
|
-
function clampImageRect(rect) {
|
|
17295
|
+
function clampImageRect(rect, options) {
|
|
17296
|
+
const contentOffsetLeft = options?.contentOffsetLeft ?? ROW_HEADER_WIDTH;
|
|
17297
|
+
const contentOffsetTop = options?.contentOffsetTop ?? HEADER_HEIGHT;
|
|
17298
|
+
const minSizePx = options?.minSizePx ?? IMAGE_MIN_SIZE_PX;
|
|
17207
17299
|
return {
|
|
17208
|
-
height: Math.max(
|
|
17209
|
-
left: Math.max(
|
|
17210
|
-
top: Math.max(
|
|
17211
|
-
width: Math.max(
|
|
17300
|
+
height: Math.max(minSizePx, rect.height),
|
|
17301
|
+
left: Math.max(contentOffsetLeft, rect.left),
|
|
17302
|
+
top: Math.max(contentOffsetTop, rect.top),
|
|
17303
|
+
width: Math.max(minSizePx, rect.width)
|
|
17212
17304
|
};
|
|
17213
17305
|
}
|
|
17214
|
-
function resolveImageHandleStyle(position, stroke, surface) {
|
|
17215
|
-
const
|
|
17306
|
+
function resolveImageHandleStyle(position, stroke, surface, scale = 1) {
|
|
17307
|
+
const handleSize = IMAGE_HANDLE_SIZE_PX * scale;
|
|
17308
|
+
const offset = handleSize / 2;
|
|
17216
17309
|
const style = {
|
|
17217
17310
|
backgroundColor: surface,
|
|
17218
|
-
border:
|
|
17219
|
-
borderRadius: 6,
|
|
17311
|
+
border: `${Math.max(1, scale)}px solid ${stroke}`,
|
|
17312
|
+
borderRadius: 6 * scale,
|
|
17220
17313
|
cursor: IMAGE_HANDLE_CURSOR[position],
|
|
17221
|
-
height:
|
|
17314
|
+
height: handleSize,
|
|
17222
17315
|
pointerEvents: "auto",
|
|
17223
17316
|
position: "absolute",
|
|
17224
|
-
width:
|
|
17317
|
+
width: handleSize
|
|
17225
17318
|
};
|
|
17226
17319
|
if (position.includes("n")) {
|
|
17227
17320
|
style.top = -offset;
|
|
@@ -18677,7 +18770,8 @@ function buildConditionalIcon(iconSet, iconId) {
|
|
|
18677
18770
|
};
|
|
18678
18771
|
}
|
|
18679
18772
|
}
|
|
18680
|
-
function renderConditionalIcon(icon) {
|
|
18773
|
+
function renderConditionalIcon(icon, scale = 1) {
|
|
18774
|
+
const iconSize = 14 * scale;
|
|
18681
18775
|
if (icon.shape === "arrow") {
|
|
18682
18776
|
const fill = icon.color ?? "#111827";
|
|
18683
18777
|
const stroke = icon.borderColor ?? darkenColor3(fill, 0.32);
|
|
@@ -18685,10 +18779,10 @@ function renderConditionalIcon(icon) {
|
|
|
18685
18779
|
"svg",
|
|
18686
18780
|
{
|
|
18687
18781
|
"aria-hidden": "true",
|
|
18688
|
-
height:
|
|
18782
|
+
height: iconSize,
|
|
18689
18783
|
style: { display: "block" },
|
|
18690
18784
|
viewBox: "0 0 16 16",
|
|
18691
|
-
width:
|
|
18785
|
+
width: iconSize,
|
|
18692
18786
|
children: /* @__PURE__ */ jsx3("g", { transform: `rotate(${icon.rotationDeg ?? 0} 8 8)`, children: /* @__PURE__ */ jsx3(
|
|
18693
18787
|
"path",
|
|
18694
18788
|
{
|
|
@@ -18710,12 +18804,12 @@ function renderConditionalIcon(icon) {
|
|
|
18710
18804
|
alignItems: "center",
|
|
18711
18805
|
color: icon.color ?? "#111827",
|
|
18712
18806
|
display: "inline-flex",
|
|
18713
|
-
fontSize: 13,
|
|
18807
|
+
fontSize: 13 * scale,
|
|
18714
18808
|
fontWeight: 700,
|
|
18715
|
-
height:
|
|
18809
|
+
height: iconSize,
|
|
18716
18810
|
justifyContent: "center",
|
|
18717
18811
|
lineHeight: 1,
|
|
18718
|
-
width:
|
|
18812
|
+
width: iconSize
|
|
18719
18813
|
},
|
|
18720
18814
|
children: icon.glyph
|
|
18721
18815
|
}
|
|
@@ -18729,17 +18823,17 @@ function renderConditionalIcon(icon) {
|
|
|
18729
18823
|
border: icon.borderColor ? `1px solid ${icon.borderColor}` : "none",
|
|
18730
18824
|
borderRadius: "999px",
|
|
18731
18825
|
display: "inline-block",
|
|
18732
|
-
height: 12,
|
|
18733
|
-
width: 12
|
|
18826
|
+
height: 12 * scale,
|
|
18827
|
+
width: 12 * scale
|
|
18734
18828
|
}
|
|
18735
18829
|
}
|
|
18736
18830
|
);
|
|
18737
18831
|
}
|
|
18738
|
-
function renderCheckboxControl(checked, palette) {
|
|
18832
|
+
function renderCheckboxControl(checked, palette, scale = 1) {
|
|
18739
18833
|
const stroke = paletteIsDark(palette) ? "#cbd5e1" : "#475569";
|
|
18740
18834
|
const fill = checked ? paletteIsDark(palette) ? "#60a5fa" : "#2563eb" : "transparent";
|
|
18741
18835
|
const check = paletteIsDark(palette) ? "#020617" : "#ffffff";
|
|
18742
|
-
return /* @__PURE__ */ jsxs3("svg", { "aria-hidden": "true", height: 14, style: { display: "block" }, viewBox: "0 0 16 16", width: 14, children: [
|
|
18836
|
+
return /* @__PURE__ */ jsxs3("svg", { "aria-hidden": "true", height: 14 * scale, style: { display: "block" }, viewBox: "0 0 16 16", width: 14 * scale, children: [
|
|
18743
18837
|
/* @__PURE__ */ jsx3("rect", { fill, height: 11, rx: 2, ry: 2, stroke, strokeWidth: 1.2, width: 11, x: 2.5, y: 2.5 }),
|
|
18744
18838
|
checked ? /* @__PURE__ */ jsx3(
|
|
18745
18839
|
"path",
|
|
@@ -18937,10 +19031,12 @@ function GridRow({
|
|
|
18937
19031
|
readOnly,
|
|
18938
19032
|
renderCellAdornment,
|
|
18939
19033
|
rowHeight,
|
|
19034
|
+
rowHeaderWidth,
|
|
18940
19035
|
stickyLeftByCol,
|
|
18941
19036
|
stickyTop,
|
|
18942
19037
|
trailingSpacerWidth,
|
|
18943
|
-
visibleCols
|
|
19038
|
+
visibleCols,
|
|
19039
|
+
zoomFactor
|
|
18944
19040
|
}) {
|
|
18945
19041
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
18946
19042
|
return /* @__PURE__ */ jsxs3("tr", { "data-xlsx-row": actualRow, style: { height: rowHeight }, children: [
|
|
@@ -18956,17 +19052,17 @@ function GridRow({
|
|
|
18956
19052
|
boxSizing: "border-box",
|
|
18957
19053
|
boxShadow: gutterSeparatorShadow,
|
|
18958
19054
|
color: palette.mutedText,
|
|
18959
|
-
fontSize: "11px",
|
|
19055
|
+
fontSize: scaleCssLengthExpression("11px", zoomFactor),
|
|
18960
19056
|
height: rowHeight,
|
|
18961
19057
|
left: 0,
|
|
18962
19058
|
maxHeight: rowHeight,
|
|
18963
|
-
minWidth:
|
|
18964
|
-
padding: "2px 4px",
|
|
19059
|
+
minWidth: rowHeaderWidth,
|
|
19060
|
+
padding: scaleCssLengthExpression("2px 4px", zoomFactor),
|
|
18965
19061
|
position: "sticky",
|
|
18966
19062
|
top: stickyTop,
|
|
18967
19063
|
textAlign: "center",
|
|
18968
19064
|
userSelect: "none",
|
|
18969
|
-
width:
|
|
19065
|
+
width: rowHeaderWidth,
|
|
18970
19066
|
zIndex: stickyTop !== void 0 ? 45 : 35
|
|
18971
19067
|
},
|
|
18972
19068
|
children: /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
|
|
@@ -18977,9 +19073,9 @@ function GridRow({
|
|
|
18977
19073
|
onPointerDown: (event) => onRowResizePointerDown(event, actualRow, rowHeight),
|
|
18978
19074
|
style: {
|
|
18979
19075
|
backgroundColor: "transparent",
|
|
18980
|
-
bottom: -8,
|
|
19076
|
+
bottom: -8 * zoomFactor,
|
|
18981
19077
|
cursor: "row-resize",
|
|
18982
|
-
height: 16,
|
|
19078
|
+
height: 16 * zoomFactor,
|
|
18983
19079
|
left: 0,
|
|
18984
19080
|
position: "absolute",
|
|
18985
19081
|
width: "100%",
|
|
@@ -19080,7 +19176,7 @@ function GridRow({
|
|
|
19080
19176
|
cellContentStyle.zIndex = 1;
|
|
19081
19177
|
}
|
|
19082
19178
|
if (trailingInset > 0) {
|
|
19083
|
-
cellContentStyle.paddingRight = trailingInset + 4;
|
|
19179
|
+
cellContentStyle.paddingRight = (trailingInset + 4) * zoomFactor;
|
|
19084
19180
|
}
|
|
19085
19181
|
if (cellData.conditionalIcon) {
|
|
19086
19182
|
cellContentStyle.position = "relative";
|
|
@@ -19114,13 +19210,13 @@ function GridRow({
|
|
|
19114
19210
|
"aria-hidden": "true",
|
|
19115
19211
|
style: {
|
|
19116
19212
|
alignItems: "center",
|
|
19117
|
-
bottom: 4,
|
|
19213
|
+
bottom: 4 * zoomFactor,
|
|
19118
19214
|
display: "flex",
|
|
19119
|
-
left: 4,
|
|
19215
|
+
left: 4 * zoomFactor,
|
|
19120
19216
|
pointerEvents: "none",
|
|
19121
19217
|
position: "absolute",
|
|
19122
|
-
right: 4,
|
|
19123
|
-
top: 4,
|
|
19218
|
+
right: 4 * zoomFactor,
|
|
19219
|
+
top: 4 * zoomFactor,
|
|
19124
19220
|
zIndex: 0
|
|
19125
19221
|
},
|
|
19126
19222
|
children: /* @__PURE__ */ jsx3(
|
|
@@ -19149,12 +19245,12 @@ function GridRow({
|
|
|
19149
19245
|
justifyContent: "center",
|
|
19150
19246
|
pointerEvents: "none",
|
|
19151
19247
|
position: "absolute",
|
|
19152
|
-
right: conditionalIconRight,
|
|
19248
|
+
right: conditionalIconRight * zoomFactor,
|
|
19153
19249
|
top: "50%",
|
|
19154
19250
|
transform: "translateY(-50%)",
|
|
19155
19251
|
zIndex: 2
|
|
19156
19252
|
},
|
|
19157
|
-
children: renderConditionalIcon(cellData.conditionalIcon)
|
|
19253
|
+
children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
|
|
19158
19254
|
}
|
|
19159
19255
|
) : null,
|
|
19160
19256
|
isEditing ? /* @__PURE__ */ jsx3(
|
|
@@ -19183,7 +19279,7 @@ function GridRow({
|
|
|
19183
19279
|
height: "100%",
|
|
19184
19280
|
margin: 0,
|
|
19185
19281
|
outline: "none",
|
|
19186
|
-
padding: DEFAULT_CELL_PADDING,
|
|
19282
|
+
padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
|
|
19187
19283
|
width: "100%"
|
|
19188
19284
|
},
|
|
19189
19285
|
value: editingValue
|
|
@@ -19225,7 +19321,7 @@ function GridRow({
|
|
|
19225
19321
|
pointerEvents: "none",
|
|
19226
19322
|
width: "100%"
|
|
19227
19323
|
},
|
|
19228
|
-
children: renderCheckboxControl(cellData.checkboxState, palette)
|
|
19324
|
+
children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
|
|
19229
19325
|
}
|
|
19230
19326
|
) : /* @__PURE__ */ jsx3("div", { style: cellContentStyle, children: cellData.value })
|
|
19231
19327
|
]
|
|
@@ -19248,7 +19344,7 @@ function GridRow({
|
|
|
19248
19344
|
] });
|
|
19249
19345
|
}
|
|
19250
19346
|
var MemoGridRow = React4.memo(GridRow, (prev, next) => {
|
|
19251
|
-
if (prev.actualRow !== next.actualRow || prev.rowHeight !== next.rowHeight || prev.palette !== next.palette || prev.readOnly !== next.readOnly || prev.visibleCols !== next.visibleCols || prev.leadingSpacerWidth !== next.leadingSpacerWidth || prev.stickyLeftByCol !== next.stickyLeftByCol || prev.stickyTop !== next.stickyTop || prev.trailingSpacerWidth !== next.trailingSpacerWidth || prev.getCellData !== next.getCellData || prev.onCellClick !== next.onCellClick || prev.onCellDoubleClick !== next.onCellDoubleClick || prev.onCellPointerDown !== next.onCellPointerDown || prev.onEditingCancel !== next.onEditingCancel || prev.onEditingCommit !== next.onEditingCommit || prev.onEditingValueChange !== next.onEditingValueChange || prev.onRowHeaderRef !== next.onRowHeaderRef || prev.onRowPointerDown !== next.onRowPointerDown || prev.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment) {
|
|
19347
|
+
if (prev.actualRow !== next.actualRow || prev.rowHeight !== next.rowHeight || prev.palette !== next.palette || prev.readOnly !== next.readOnly || prev.visibleCols !== next.visibleCols || prev.leadingSpacerWidth !== next.leadingSpacerWidth || prev.rowHeaderWidth !== next.rowHeaderWidth || prev.stickyLeftByCol !== next.stickyLeftByCol || prev.stickyTop !== next.stickyTop || prev.trailingSpacerWidth !== next.trailingSpacerWidth || prev.zoomFactor !== next.zoomFactor || prev.getCellData !== next.getCellData || prev.onCellClick !== next.onCellClick || prev.onCellDoubleClick !== next.onCellDoubleClick || prev.onCellPointerDown !== next.onCellPointerDown || prev.onEditingCancel !== next.onEditingCancel || prev.onEditingCommit !== next.onEditingCommit || prev.onEditingValueChange !== next.onEditingValueChange || prev.onRowHeaderRef !== next.onRowHeaderRef || prev.onRowPointerDown !== next.onRowPointerDown || prev.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment) {
|
|
19252
19348
|
return false;
|
|
19253
19349
|
}
|
|
19254
19350
|
const prevEditingCol = prev.editingCell?.row === prev.actualRow ? prev.editingCell.col : -1;
|
|
@@ -19425,20 +19521,25 @@ function XlsxGrid({
|
|
|
19425
19521
|
);
|
|
19426
19522
|
const hiddenRowSet = React4.useMemo(() => new Set(activeSheet?.hiddenRows ?? []), [activeSheet?.hiddenRows]);
|
|
19427
19523
|
const hiddenColSet = React4.useMemo(() => new Set(activeSheet?.hiddenCols ?? []), [activeSheet?.hiddenCols]);
|
|
19524
|
+
const displayDefaultRowHeight = DEFAULT_ROW_HEIGHT2 * zoomFactor;
|
|
19525
|
+
const displayDefaultColWidth = DEFAULT_COL_WIDTH2 * zoomFactor;
|
|
19526
|
+
const displayHeaderHeight = HEADER_HEIGHT * zoomFactor;
|
|
19527
|
+
const displayRowHeaderWidth = ROW_HEADER_WIDTH * zoomFactor;
|
|
19528
|
+
const displayImageMinSize = IMAGE_MIN_SIZE_PX * zoomFactor;
|
|
19428
19529
|
const syncDrawingViewport = React4.useCallback((scroller) => {
|
|
19429
19530
|
if (!scroller) {
|
|
19430
19531
|
return;
|
|
19431
19532
|
}
|
|
19432
19533
|
setDrawingViewport((current) => {
|
|
19433
19534
|
const next = {
|
|
19434
|
-
height: scroller.clientHeight
|
|
19435
|
-
left: scroller.scrollLeft
|
|
19436
|
-
top: scroller.scrollTop
|
|
19437
|
-
width: scroller.clientWidth
|
|
19535
|
+
height: scroller.clientHeight,
|
|
19536
|
+
left: scroller.scrollLeft,
|
|
19537
|
+
top: scroller.scrollTop,
|
|
19538
|
+
width: scroller.clientWidth
|
|
19438
19539
|
};
|
|
19439
19540
|
return current.left === next.left && current.top === next.top && current.width === next.width && current.height === next.height ? current : next;
|
|
19440
19541
|
});
|
|
19441
|
-
}, [
|
|
19542
|
+
}, []);
|
|
19442
19543
|
const visibleRows = React4.useMemo(() => {
|
|
19443
19544
|
return buildVisibleAxisIndices(
|
|
19444
19545
|
activeSheet?.visibleRows ?? [],
|
|
@@ -19592,47 +19693,54 @@ function XlsxGrid({
|
|
|
19592
19693
|
revision
|
|
19593
19694
|
]
|
|
19594
19695
|
);
|
|
19595
|
-
const
|
|
19596
|
-
() =>
|
|
19597
|
-
[actualColWidths,
|
|
19696
|
+
const displayActualColWidths = React4.useMemo(
|
|
19697
|
+
() => actualColWidths.map((width) => width * zoomFactor),
|
|
19698
|
+
[actualColWidths, zoomFactor]
|
|
19699
|
+
);
|
|
19700
|
+
const displayActualRowHeights = React4.useMemo(
|
|
19701
|
+
() => actualRowHeights.map((height) => height * zoomFactor),
|
|
19702
|
+
[actualRowHeights, zoomFactor]
|
|
19598
19703
|
);
|
|
19599
|
-
const
|
|
19600
|
-
() =>
|
|
19601
|
-
[
|
|
19704
|
+
const displayEffectiveColWidths = React4.useMemo(
|
|
19705
|
+
() => visibleCols.map((col) => displayActualColWidths[col] ?? displayDefaultColWidth),
|
|
19706
|
+
[displayActualColWidths, displayDefaultColWidth, visibleCols]
|
|
19707
|
+
);
|
|
19708
|
+
const displayEffectiveRowHeights = React4.useMemo(
|
|
19709
|
+
() => visibleRows.map((row) => displayActualRowHeights[row] ?? displayDefaultRowHeight),
|
|
19710
|
+
[displayActualRowHeights, displayDefaultRowHeight, visibleRows]
|
|
19602
19711
|
);
|
|
19603
19712
|
const rowIndexByActual = React4.useMemo(() => new Map(visibleRows.map((row, index) => [row, index])), [visibleRows]);
|
|
19604
19713
|
const colIndexByActual = React4.useMemo(() => new Map(visibleCols.map((col, index) => [col, index])), [visibleCols]);
|
|
19605
19714
|
const visibleRowsRef = React4.useRef(visibleRows);
|
|
19606
19715
|
const visibleColsRef = React4.useRef(visibleCols);
|
|
19607
|
-
const effectiveRowHeightsRef = React4.useRef(
|
|
19608
|
-
const effectiveColWidthsRef = React4.useRef(
|
|
19609
|
-
const rowPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19610
|
-
const colPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19611
|
-
const actualRowPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19612
|
-
const actualColPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19716
|
+
const effectiveRowHeightsRef = React4.useRef(displayEffectiveRowHeights);
|
|
19717
|
+
const effectiveColWidthsRef = React4.useRef(displayEffectiveColWidths);
|
|
19718
|
+
const rowPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveRowHeights), [displayEffectiveRowHeights]);
|
|
19719
|
+
const colPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveColWidths), [displayEffectiveColWidths]);
|
|
19720
|
+
const actualRowPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualRowHeights), [displayActualRowHeights]);
|
|
19721
|
+
const actualColPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualColWidths), [displayActualColWidths]);
|
|
19613
19722
|
const stickyTopByRow = React4.useMemo(
|
|
19614
|
-
() => buildStickyOffsets(frozenRows,
|
|
19615
|
-
[
|
|
19723
|
+
() => buildStickyOffsets(frozenRows, displayActualRowHeights, displayHeaderHeight),
|
|
19724
|
+
[displayActualRowHeights, displayHeaderHeight, frozenRows]
|
|
19616
19725
|
);
|
|
19617
19726
|
const stickyLeftByCol = React4.useMemo(
|
|
19618
|
-
() => buildStickyOffsets(frozenCols,
|
|
19619
|
-
[
|
|
19727
|
+
() => buildStickyOffsets(frozenCols, displayActualColWidths, displayRowHeaderWidth),
|
|
19728
|
+
[displayActualColWidths, displayRowHeaderWidth, frozenCols]
|
|
19620
19729
|
);
|
|
19621
19730
|
const frozenPaneBottom = React4.useMemo(
|
|
19622
19731
|
() => frozenRows.length > 0 ? frozenRows.reduce(
|
|
19623
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
19624
|
-
|
|
19625
|
-
) :
|
|
19626
|
-
[
|
|
19732
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? displayHeaderHeight) + (displayActualRowHeights[row] ?? displayDefaultRowHeight)),
|
|
19733
|
+
displayHeaderHeight
|
|
19734
|
+
) : displayHeaderHeight,
|
|
19735
|
+
[displayActualRowHeights, displayDefaultRowHeight, displayHeaderHeight, frozenRows, stickyTopByRow]
|
|
19627
19736
|
);
|
|
19628
19737
|
const frozenPaneRight = React4.useMemo(
|
|
19629
19738
|
() => frozenCols.length > 0 ? frozenCols.reduce(
|
|
19630
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
19631
|
-
|
|
19632
|
-
) :
|
|
19633
|
-
[
|
|
19739
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? displayRowHeaderWidth) + (displayActualColWidths[col] ?? displayDefaultColWidth)),
|
|
19740
|
+
displayRowHeaderWidth
|
|
19741
|
+
) : displayRowHeaderWidth,
|
|
19742
|
+
[displayActualColWidths, displayDefaultColWidth, displayRowHeaderWidth, frozenCols, stickyLeftByCol]
|
|
19634
19743
|
);
|
|
19635
|
-
const useNativeZoomForStickyLayout = zoomFactor !== 1;
|
|
19636
19744
|
const rowPrefixSumsRef = React4.useRef(rowPrefixSums);
|
|
19637
19745
|
const colPrefixSumsRef = React4.useRef(colPrefixSums);
|
|
19638
19746
|
const firstVisibleRow = visibleRows[0];
|
|
@@ -19640,6 +19748,12 @@ function XlsxGrid({
|
|
|
19640
19748
|
const firstVisibleCol = visibleCols[0];
|
|
19641
19749
|
const lastVisibleCol = visibleCols[visibleCols.length - 1];
|
|
19642
19750
|
const displayedSelection = fillPreviewRange ?? normalizedSelection;
|
|
19751
|
+
const toLogicalRect = React4.useCallback((rect) => ({
|
|
19752
|
+
height: rect.height / zoomFactor,
|
|
19753
|
+
left: rect.left / zoomFactor,
|
|
19754
|
+
top: rect.top / zoomFactor,
|
|
19755
|
+
width: rect.width / zoomFactor
|
|
19756
|
+
}), [zoomFactor]);
|
|
19643
19757
|
const drawingExtents = React4.useMemo(() => {
|
|
19644
19758
|
const imageExtents = images.reduce(
|
|
19645
19759
|
(current, image) => {
|
|
@@ -19681,24 +19795,18 @@ function XlsxGrid({
|
|
|
19681
19795
|
const shouldVirtualizeCols = !activeSheet?.hasHorizontalMerges && frozenCols.length === 0;
|
|
19682
19796
|
const rowVirtualizer = useVirtualizer({
|
|
19683
19797
|
count: visibleRows.length,
|
|
19684
|
-
estimateSize: (index) =>
|
|
19798
|
+
estimateSize: (index) => displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
19685
19799
|
getScrollElement: () => scrollRef.current,
|
|
19686
19800
|
getItemKey: (index) => visibleRows[index] ?? index,
|
|
19687
|
-
|
|
19688
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19689
|
-
overscan: 10,
|
|
19690
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19801
|
+
overscan: 10
|
|
19691
19802
|
});
|
|
19692
19803
|
const colVirtualizer = useVirtualizer({
|
|
19693
19804
|
count: visibleCols.length,
|
|
19694
|
-
estimateSize: (index) =>
|
|
19805
|
+
estimateSize: (index) => displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
19695
19806
|
getScrollElement: () => scrollRef.current,
|
|
19696
19807
|
getItemKey: (index) => visibleCols[index] ?? index,
|
|
19697
19808
|
horizontal: true,
|
|
19698
|
-
|
|
19699
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19700
|
-
overscan: 6,
|
|
19701
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19809
|
+
overscan: 6
|
|
19702
19810
|
});
|
|
19703
19811
|
const currentRowVirtualItems = rowVirtualizer.getVirtualItems();
|
|
19704
19812
|
const currentColVirtualItems = colVirtualizer.getVirtualItems();
|
|
@@ -19834,11 +19942,11 @@ function XlsxGrid({
|
|
|
19834
19942
|
React4.useEffect(() => {
|
|
19835
19943
|
visibleRowsRef.current = visibleRows;
|
|
19836
19944
|
visibleColsRef.current = visibleCols;
|
|
19837
|
-
effectiveRowHeightsRef.current =
|
|
19838
|
-
effectiveColWidthsRef.current =
|
|
19945
|
+
effectiveRowHeightsRef.current = displayEffectiveRowHeights;
|
|
19946
|
+
effectiveColWidthsRef.current = displayEffectiveColWidths;
|
|
19839
19947
|
rowPrefixSumsRef.current = rowPrefixSums;
|
|
19840
19948
|
colPrefixSumsRef.current = colPrefixSums;
|
|
19841
|
-
}, [colPrefixSums,
|
|
19949
|
+
}, [colPrefixSums, displayEffectiveColWidths, displayEffectiveRowHeights, rowPrefixSums, visibleCols, visibleRows]);
|
|
19842
19950
|
React4.useLayoutEffect(() => {
|
|
19843
19951
|
const scroller = scrollRef.current;
|
|
19844
19952
|
const previousZoomFactor = previousZoomFactorRef.current;
|
|
@@ -19963,13 +20071,13 @@ function XlsxGrid({
|
|
|
19963
20071
|
const currentScroller = event.currentTarget;
|
|
19964
20072
|
cachedScrollerRectRef.current = null;
|
|
19965
20073
|
syncDrawingViewport(currentScroller);
|
|
19966
|
-
if (
|
|
20074
|
+
if (currentScroller.scrollHeight - (currentScroller.scrollTop + currentScroller.clientHeight) < OPEN_GRID_VERTICAL_EDGE_PX) {
|
|
19967
20075
|
setDisplayRowLimit((current) => current + OPEN_GRID_ROW_GROWTH);
|
|
19968
20076
|
}
|
|
19969
|
-
if (
|
|
20077
|
+
if (currentScroller.scrollWidth - (currentScroller.scrollLeft + currentScroller.clientWidth) < OPEN_GRID_HORIZONTAL_EDGE_PX) {
|
|
19970
20078
|
setDisplayColLimit((current) => current + OPEN_GRID_COL_GROWTH);
|
|
19971
20079
|
}
|
|
19972
|
-
}, [syncDrawingViewport
|
|
20080
|
+
}, [syncDrawingViewport]);
|
|
19973
20081
|
React4.useEffect(() => {
|
|
19974
20082
|
if (!openTableMenu) {
|
|
19975
20083
|
return;
|
|
@@ -20008,24 +20116,24 @@ function XlsxGrid({
|
|
|
20008
20116
|
}
|
|
20009
20117
|
const pointerOffsetX = clientX - scrollerRect.left;
|
|
20010
20118
|
const pointerOffsetY = clientY - scrollerRect.top;
|
|
20011
|
-
const localX = pointerOffsetX
|
|
20012
|
-
const localY = pointerOffsetY
|
|
20013
|
-
const rowContentOffset = localY -
|
|
20014
|
-
const colContentOffset = localX -
|
|
20119
|
+
const localX = pointerOffsetX + (pointerOffsetX >= frozenPaneRight ? scroller.scrollLeft : 0);
|
|
20120
|
+
const localY = pointerOffsetY + (pointerOffsetY >= frozenPaneBottom ? scroller.scrollTop : 0);
|
|
20121
|
+
const rowContentOffset = localY - displayHeaderHeight;
|
|
20122
|
+
const colContentOffset = localX - displayRowHeaderWidth;
|
|
20015
20123
|
let geometryCell = null;
|
|
20016
|
-
if (localY >=
|
|
20124
|
+
if (localY >= displayHeaderHeight && localX < displayRowHeaderWidth) {
|
|
20017
20125
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20018
20126
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
20019
20127
|
if (actualRow !== void 0 && firstVisibleColRef.current !== void 0) {
|
|
20020
20128
|
geometryCell = { row: actualRow, col: firstVisibleColRef.current };
|
|
20021
20129
|
}
|
|
20022
|
-
} else if (localY <
|
|
20130
|
+
} else if (localY < displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20023
20131
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20024
20132
|
const actualCol = visibleColsCurrent[colIndex];
|
|
20025
20133
|
if (actualCol !== void 0 && firstVisibleRowRef.current !== void 0) {
|
|
20026
20134
|
geometryCell = { row: firstVisibleRowRef.current, col: actualCol };
|
|
20027
20135
|
}
|
|
20028
|
-
} else if (localY >=
|
|
20136
|
+
} else if (localY >= displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20029
20137
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20030
20138
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20031
20139
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
@@ -20035,7 +20143,7 @@ function XlsxGrid({
|
|
|
20035
20143
|
}
|
|
20036
20144
|
}
|
|
20037
20145
|
return geometryCell;
|
|
20038
|
-
}, [frozenPaneBottom, frozenPaneRight
|
|
20146
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, frozenPaneBottom, frozenPaneRight]);
|
|
20039
20147
|
const resolvePointerCellFromHitTest = React4.useCallback((clientX, clientY) => {
|
|
20040
20148
|
const elementsAtPoint = typeof document.elementsFromPoint === "function" ? document.elementsFromPoint(clientX, clientY) : [document.elementFromPoint(clientX, clientY)].filter((element) => Boolean(element));
|
|
20041
20149
|
for (const element of elementsAtPoint) {
|
|
@@ -20095,59 +20203,59 @@ function XlsxGrid({
|
|
|
20095
20203
|
if (rowIndex === void 0 || colIndex === void 0) {
|
|
20096
20204
|
return null;
|
|
20097
20205
|
}
|
|
20098
|
-
const
|
|
20099
|
-
const
|
|
20100
|
-
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width /
|
|
20101
|
-
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height /
|
|
20206
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20207
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20208
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20209
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20102
20210
|
return {
|
|
20103
20211
|
contentScaleX,
|
|
20104
20212
|
contentScaleY,
|
|
20105
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20106
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20213
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20214
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20107
20215
|
};
|
|
20108
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20216
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20109
20217
|
const resolveRowPointerOrigin = React4.useCallback((actualRow, rect, clientY) => {
|
|
20110
20218
|
const rowIndex = rowIndexByActual.get(actualRow);
|
|
20111
20219
|
if (rowIndex === void 0) {
|
|
20112
20220
|
return null;
|
|
20113
20221
|
}
|
|
20114
|
-
const
|
|
20115
|
-
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height /
|
|
20222
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20223
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20116
20224
|
return {
|
|
20117
|
-
contentScaleX:
|
|
20225
|
+
contentScaleX: 1,
|
|
20118
20226
|
contentScaleY,
|
|
20119
20227
|
originContentX: colPrefixSums[0] ?? 0,
|
|
20120
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20228
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20121
20229
|
};
|
|
20122
|
-
}, [colPrefixSums,
|
|
20230
|
+
}, [colPrefixSums, displayDefaultRowHeight, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20123
20231
|
const resolveColumnPointerOrigin = React4.useCallback((actualCol, rect, clientX) => {
|
|
20124
20232
|
const colIndex = colIndexByActual.get(actualCol);
|
|
20125
20233
|
if (colIndex === void 0) {
|
|
20126
20234
|
return null;
|
|
20127
20235
|
}
|
|
20128
|
-
const
|
|
20129
|
-
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width /
|
|
20236
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20237
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20130
20238
|
return {
|
|
20131
20239
|
contentScaleX,
|
|
20132
|
-
contentScaleY:
|
|
20133
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20240
|
+
contentScaleY: 1,
|
|
20241
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20134
20242
|
originContentY: rowPrefixSums[0] ?? 0
|
|
20135
20243
|
};
|
|
20136
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20244
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayEffectiveColWidths, rowPrefixSums]);
|
|
20137
20245
|
const applyColumnPreview = React4.useCallback((actualCol, widthPx) => {
|
|
20138
20246
|
const colElement = colElementRefs.current.get(actualCol);
|
|
20139
20247
|
if (colElement) {
|
|
20140
20248
|
colElement.style.width = widthPx === null ? "" : `${widthPx}px`;
|
|
20141
20249
|
}
|
|
20142
20250
|
const baseIndex = visibleCols.indexOf(actualCol);
|
|
20143
|
-
const baseWidth = baseIndex >= 0 ?
|
|
20251
|
+
const baseWidth = baseIndex >= 0 ? displayEffectiveColWidths[baseIndex] ?? displayDefaultColWidth : displayDefaultColWidth;
|
|
20144
20252
|
const previewWidth = widthPx ?? baseWidth;
|
|
20145
|
-
const baseTotalWidth =
|
|
20253
|
+
const baseTotalWidth = displayEffectiveColWidths.reduce((sum, width) => sum + width, 0) + displayRowHeaderWidth;
|
|
20146
20254
|
const widthDelta = previewWidth - baseWidth;
|
|
20147
20255
|
if (tableRef.current) {
|
|
20148
20256
|
tableRef.current.style.width = `${baseTotalWidth + widthDelta}px`;
|
|
20149
20257
|
}
|
|
20150
|
-
}, [
|
|
20258
|
+
}, [displayDefaultColWidth, displayEffectiveColWidths, displayRowHeaderWidth, visibleCols]);
|
|
20151
20259
|
const applyRowPreview = React4.useCallback((actualRow, heightPx) => {
|
|
20152
20260
|
const rowElement = rowElementRefs.current.get(actualRow) ?? wrapperRef.current?.querySelector(`tr[data-xlsx-row="${actualRow}"]`) ?? null;
|
|
20153
20261
|
if (rowElement) {
|
|
@@ -20324,7 +20432,7 @@ function XlsxGrid({
|
|
|
20324
20432
|
const viewportRowBatch = getRowsBatchAsync ? asyncViewportRowBatch : syncViewportRowBatch;
|
|
20325
20433
|
React4.useEffect(() => {
|
|
20326
20434
|
cellRenderCacheRef.current.clear();
|
|
20327
|
-
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet]);
|
|
20435
|
+
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet, zoomFactor]);
|
|
20328
20436
|
React4.useEffect(() => {
|
|
20329
20437
|
setAsyncViewportRowBatch(null);
|
|
20330
20438
|
}, [activeSheetIndex, revision]);
|
|
@@ -20346,7 +20454,7 @@ function XlsxGrid({
|
|
|
20346
20454
|
if (!worksheet && !batchedCell) {
|
|
20347
20455
|
const emptyData = {
|
|
20348
20456
|
isMergedSecondary: false,
|
|
20349
|
-
style: {
|
|
20457
|
+
style: scaleCssProperties({
|
|
20350
20458
|
backgroundColor: resolveSheetSurface(activeSheet, palette),
|
|
20351
20459
|
borderBottom: "none",
|
|
20352
20460
|
borderRight: "none",
|
|
@@ -20354,7 +20462,7 @@ function XlsxGrid({
|
|
|
20354
20462
|
padding: DEFAULT_CELL_PADDING,
|
|
20355
20463
|
verticalAlign: "bottom",
|
|
20356
20464
|
whiteSpace: "nowrap"
|
|
20357
|
-
},
|
|
20465
|
+
}, zoomFactor),
|
|
20358
20466
|
value: ""
|
|
20359
20467
|
};
|
|
20360
20468
|
cellRenderCacheRef.current.set(cacheKey, emptyData);
|
|
@@ -20433,9 +20541,9 @@ function XlsxGrid({
|
|
|
20433
20541
|
isTableHeader: Boolean(table && row >= table.start.row && row < table.start.row + headerRowCount),
|
|
20434
20542
|
rowSpan: merge?.rowSpan,
|
|
20435
20543
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
20436
|
-
style: buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20544
|
+
style: scaleCssProperties(buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20437
20545
|
showGridLines: activeSheet?.showGridLines
|
|
20438
|
-
}),
|
|
20546
|
+
}), zoomFactor),
|
|
20439
20547
|
validation: resolveCellDataValidation(row, col, activeSheet),
|
|
20440
20548
|
value: sparkline ? "" : checkboxState !== null ? "" : batchCoversRow || !worksheet ? batchedCell?.value ?? "" : getCellDisplayValue(worksheet, row, col, activeSheet)
|
|
20441
20549
|
};
|
|
@@ -20445,7 +20553,7 @@ function XlsxGrid({
|
|
|
20445
20553
|
const horizontalPadding = getHorizontalPadding(nextData.style.padding);
|
|
20446
20554
|
const textWidth = measureTextWidth(nextData.value, nextData.style);
|
|
20447
20555
|
const requiredWidth = textWidth + horizontalPadding + 2;
|
|
20448
|
-
let availableWidth =
|
|
20556
|
+
let availableWidth = displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth;
|
|
20449
20557
|
if (requiredWidth > availableWidth) {
|
|
20450
20558
|
for (let nextColIndex = startColIndex + 1; nextColIndex < visibleCols.length; nextColIndex += 1) {
|
|
20451
20559
|
const nextActualCol = visibleCols[nextColIndex];
|
|
@@ -20456,12 +20564,12 @@ function XlsxGrid({
|
|
|
20456
20564
|
if (!canReceiveOverflowText(neighborData)) {
|
|
20457
20565
|
break;
|
|
20458
20566
|
}
|
|
20459
|
-
availableWidth +=
|
|
20567
|
+
availableWidth += displayEffectiveColWidths[nextColIndex] ?? displayDefaultColWidth;
|
|
20460
20568
|
if (requiredWidth <= availableWidth) {
|
|
20461
20569
|
break;
|
|
20462
20570
|
}
|
|
20463
20571
|
}
|
|
20464
|
-
if (availableWidth > (
|
|
20572
|
+
if (availableWidth > (displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth)) {
|
|
20465
20573
|
nextData.spillWidth = Math.max(0, availableWidth - horizontalPadding);
|
|
20466
20574
|
}
|
|
20467
20575
|
}
|
|
@@ -20469,7 +20577,7 @@ function XlsxGrid({
|
|
|
20469
20577
|
}
|
|
20470
20578
|
cellRenderCacheRef.current.set(cacheKey, nextData);
|
|
20471
20579
|
return nextData;
|
|
20472
|
-
}, [activeSheet, colIndexByActual,
|
|
20580
|
+
}, [activeSheet, colIndexByActual, displayDefaultColWidth, displayEffectiveColWidths, effectiveTables, palette, sparklinesByCell, viewportRowBatch, visibleCols, worksheet, zoomFactor]);
|
|
20473
20581
|
React4.useEffect(() => {
|
|
20474
20582
|
conditionalFormatMetricsCacheRef.current.clear();
|
|
20475
20583
|
}, [activeSheet?.conditionalFormatRules, activeSheet?.workbookSheetIndex, revision]);
|
|
@@ -20487,11 +20595,11 @@ function XlsxGrid({
|
|
|
20487
20595
|
}
|
|
20488
20596
|
return {
|
|
20489
20597
|
height: sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex),
|
|
20490
|
-
left:
|
|
20491
|
-
top:
|
|
20598
|
+
left: displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1),
|
|
20599
|
+
top: displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1),
|
|
20492
20600
|
width: sumPrefixRange(colPrefixSums, startColIndex, endColIndex)
|
|
20493
20601
|
};
|
|
20494
|
-
}, [colIndexByActual, colPrefixSums, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20602
|
+
}, [colIndexByActual, colPrefixSums, displayHeaderHeight, displayRowHeaderWidth, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20495
20603
|
const resolvedSelectionOverlay = selectionOverlay;
|
|
20496
20604
|
const virtualCols = React4.useMemo(
|
|
20497
20605
|
() => shouldVirtualizeCols ? colVirtualizer.getVirtualItems().map((virtualCol) => ({
|
|
@@ -20504,10 +20612,10 @@ function XlsxGrid({
|
|
|
20504
20612
|
end: colPrefixSums[index + 1] ?? 0,
|
|
20505
20613
|
index,
|
|
20506
20614
|
key: visibleCols[index] ?? index,
|
|
20507
|
-
size:
|
|
20615
|
+
size: displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
20508
20616
|
start: colPrefixSums[index] ?? 0
|
|
20509
20617
|
})),
|
|
20510
|
-
[colPrefixSums, colVirtualizer,
|
|
20618
|
+
[colPrefixSums, colVirtualizer, displayDefaultColWidth, displayEffectiveColWidths, shouldVirtualizeCols, visibleCols]
|
|
20511
20619
|
);
|
|
20512
20620
|
const renderedCols = React4.useMemo(
|
|
20513
20621
|
() => {
|
|
@@ -20526,7 +20634,7 @@ function XlsxGrid({
|
|
|
20526
20634
|
});
|
|
20527
20635
|
return columns;
|
|
20528
20636
|
},
|
|
20529
|
-
[
|
|
20637
|
+
[virtualCols, visibleCols]
|
|
20530
20638
|
);
|
|
20531
20639
|
const totalContentWidth = colPrefixSums[colPrefixSums.length - 1] ?? 0;
|
|
20532
20640
|
const leadingColumnSpacerWidth = shouldVirtualizeCols ? virtualCols[0]?.start ?? 0 : 0;
|
|
@@ -20534,12 +20642,14 @@ function XlsxGrid({
|
|
|
20534
20642
|
const imageRects = React4.useMemo(
|
|
20535
20643
|
() => showImages ? images.map((image) => ({
|
|
20536
20644
|
image,
|
|
20537
|
-
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols,
|
|
20645
|
+
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20538
20646
|
actualColPrefixSums,
|
|
20539
20647
|
actualRowPrefixSums,
|
|
20540
20648
|
colIndexByActual,
|
|
20541
20649
|
colPrefixSums,
|
|
20650
|
+
headerHeight: displayHeaderHeight,
|
|
20542
20651
|
rowIndexByActual,
|
|
20652
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20543
20653
|
rowPrefixSums
|
|
20544
20654
|
})
|
|
20545
20655
|
})) : [],
|
|
@@ -20548,8 +20658,10 @@ function XlsxGrid({
|
|
|
20548
20658
|
colPrefixSums,
|
|
20549
20659
|
actualColPrefixSums,
|
|
20550
20660
|
actualRowPrefixSums,
|
|
20551
|
-
|
|
20552
|
-
|
|
20661
|
+
displayHeaderHeight,
|
|
20662
|
+
displayEffectiveColWidths,
|
|
20663
|
+
displayEffectiveRowHeights,
|
|
20664
|
+
displayRowHeaderWidth,
|
|
20553
20665
|
imagePreviewRect,
|
|
20554
20666
|
images,
|
|
20555
20667
|
rowIndexByActual,
|
|
@@ -20561,12 +20673,14 @@ function XlsxGrid({
|
|
|
20561
20673
|
);
|
|
20562
20674
|
const shapeRects = React4.useMemo(
|
|
20563
20675
|
() => showImages ? shapes.map((shape) => ({
|
|
20564
|
-
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols,
|
|
20676
|
+
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20565
20677
|
actualColPrefixSums,
|
|
20566
20678
|
actualRowPrefixSums,
|
|
20567
20679
|
colIndexByActual,
|
|
20568
20680
|
colPrefixSums,
|
|
20681
|
+
headerHeight: displayHeaderHeight,
|
|
20569
20682
|
rowIndexByActual,
|
|
20683
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20570
20684
|
rowPrefixSums
|
|
20571
20685
|
}),
|
|
20572
20686
|
shape
|
|
@@ -20576,8 +20690,10 @@ function XlsxGrid({
|
|
|
20576
20690
|
colPrefixSums,
|
|
20577
20691
|
actualColPrefixSums,
|
|
20578
20692
|
actualRowPrefixSums,
|
|
20579
|
-
|
|
20580
|
-
|
|
20693
|
+
displayHeaderHeight,
|
|
20694
|
+
displayEffectiveColWidths,
|
|
20695
|
+
displayEffectiveRowHeights,
|
|
20696
|
+
displayRowHeaderWidth,
|
|
20581
20697
|
rowIndexByActual,
|
|
20582
20698
|
rowPrefixSums,
|
|
20583
20699
|
shapes,
|
|
@@ -20589,12 +20705,14 @@ function XlsxGrid({
|
|
|
20589
20705
|
const chartRects = React4.useMemo(
|
|
20590
20706
|
() => showImages ? charts.map((chart) => ({
|
|
20591
20707
|
chart,
|
|
20592
|
-
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols,
|
|
20708
|
+
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20593
20709
|
actualColPrefixSums,
|
|
20594
20710
|
actualRowPrefixSums,
|
|
20595
20711
|
colIndexByActual,
|
|
20596
20712
|
colPrefixSums,
|
|
20713
|
+
headerHeight: displayHeaderHeight,
|
|
20597
20714
|
rowIndexByActual,
|
|
20715
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20598
20716
|
rowPrefixSums
|
|
20599
20717
|
})
|
|
20600
20718
|
})) : [],
|
|
@@ -20605,8 +20723,10 @@ function XlsxGrid({
|
|
|
20605
20723
|
charts,
|
|
20606
20724
|
colIndexByActual,
|
|
20607
20725
|
colPrefixSums,
|
|
20608
|
-
|
|
20609
|
-
|
|
20726
|
+
displayHeaderHeight,
|
|
20727
|
+
displayEffectiveColWidths,
|
|
20728
|
+
displayEffectiveRowHeights,
|
|
20729
|
+
displayRowHeaderWidth,
|
|
20610
20730
|
rowIndexByActual,
|
|
20611
20731
|
rowPrefixSums,
|
|
20612
20732
|
showImages,
|
|
@@ -20652,15 +20772,15 @@ function XlsxGrid({
|
|
|
20652
20772
|
if (startRowIndex === void 0 || endRowIndex === void 0 || startColIndex === void 0 || endColIndex === void 0) {
|
|
20653
20773
|
return null;
|
|
20654
20774
|
}
|
|
20655
|
-
let left =
|
|
20656
|
-
let top =
|
|
20775
|
+
let left = displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1);
|
|
20776
|
+
let top = displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1);
|
|
20657
20777
|
let width = sumPrefixRange(colPrefixSums, startColIndex, endColIndex);
|
|
20658
20778
|
let height = sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex);
|
|
20659
20779
|
const columnPreview = columnPreviewRef.current;
|
|
20660
20780
|
if (columnPreview) {
|
|
20661
20781
|
const previewIndex = colIndexByActual.get(columnPreview.actualIndex);
|
|
20662
20782
|
if (previewIndex !== void 0) {
|
|
20663
|
-
const baseWidth =
|
|
20783
|
+
const baseWidth = displayEffectiveColWidths[previewIndex] ?? displayDefaultColWidth;
|
|
20664
20784
|
const widthDelta = columnPreview.size - baseWidth;
|
|
20665
20785
|
if (previewIndex < startColIndex) {
|
|
20666
20786
|
left += widthDelta;
|
|
@@ -20674,7 +20794,7 @@ function XlsxGrid({
|
|
|
20674
20794
|
if (rowPreview) {
|
|
20675
20795
|
const previewIndex = rowIndexByActual.get(rowPreview.actualIndex);
|
|
20676
20796
|
if (previewIndex !== void 0) {
|
|
20677
|
-
const baseHeight =
|
|
20797
|
+
const baseHeight = displayEffectiveRowHeights[previewIndex] ?? displayDefaultRowHeight;
|
|
20678
20798
|
const heightDelta = rowPreview.size - baseHeight;
|
|
20679
20799
|
if (previewIndex < startRowIndex) {
|
|
20680
20800
|
top += heightDelta;
|
|
@@ -20686,11 +20806,11 @@ function XlsxGrid({
|
|
|
20686
20806
|
}
|
|
20687
20807
|
return {
|
|
20688
20808
|
height: Math.max(0, height),
|
|
20689
|
-
left: Math.max(
|
|
20690
|
-
top: Math.max(
|
|
20809
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20810
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20691
20811
|
width: Math.max(0, width)
|
|
20692
20812
|
};
|
|
20693
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20813
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, displayHeaderHeight, displayRowHeaderWidth, rowIndexByActual, rowPrefixSums]);
|
|
20694
20814
|
const resolveMountedRangeOverlayRect = React4.useCallback((range, geometryRect) => {
|
|
20695
20815
|
const normalized = normalizeRange2(range);
|
|
20696
20816
|
const startRect = resolveMountedCellOverlayRectForAddress(normalized.start);
|
|
@@ -20707,11 +20827,11 @@ function XlsxGrid({
|
|
|
20707
20827
|
const bottom = bottomRect ? bottomRect.top + bottomRect.height : geometryRect.top + geometryRect.height;
|
|
20708
20828
|
return {
|
|
20709
20829
|
height: Math.max(0, bottom - top),
|
|
20710
|
-
left: Math.max(
|
|
20711
|
-
top: Math.max(
|
|
20830
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20831
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20712
20832
|
width: Math.max(0, right - left)
|
|
20713
20833
|
};
|
|
20714
|
-
}, [resolveMountedCellOverlayRectForAddress]);
|
|
20834
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, resolveMountedCellOverlayRectForAddress]);
|
|
20715
20835
|
const resolveDragPreviewRect = React4.useCallback((range) => {
|
|
20716
20836
|
const dragState = selectionDragRef.current;
|
|
20717
20837
|
if (!dragState || !dragState.didDrag || dragState.axis !== "cell" || !dragState.originOverlayRect) {
|
|
@@ -20829,11 +20949,11 @@ function XlsxGrid({
|
|
|
20829
20949
|
overlay.style.visibility = "visible";
|
|
20830
20950
|
const fillHandle = fillHandleRef.current;
|
|
20831
20951
|
if (fillHandle) {
|
|
20832
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20833
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
20952
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
20953
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20834
20954
|
}
|
|
20835
20955
|
applyHeaderSelection(range);
|
|
20836
|
-
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect]);
|
|
20956
|
+
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20837
20957
|
const applyPreviewOverlayFromElement = React4.useCallback((element, range) => {
|
|
20838
20958
|
const overlay = selectionOverlayRef.current;
|
|
20839
20959
|
if (!overlay) {
|
|
@@ -20852,11 +20972,11 @@ function XlsxGrid({
|
|
|
20852
20972
|
overlay.style.visibility = "visible";
|
|
20853
20973
|
const fillHandle = fillHandleRef.current;
|
|
20854
20974
|
if (fillHandle) {
|
|
20855
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20856
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
20975
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
20976
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20857
20977
|
}
|
|
20858
20978
|
applyHeaderSelection(range);
|
|
20859
|
-
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect]);
|
|
20979
|
+
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20860
20980
|
const syncActiveValidationOverlay = React4.useCallback((cell) => {
|
|
20861
20981
|
const overlay = activeValidationOverlayRef.current;
|
|
20862
20982
|
if (!overlay || !cell || editingCellRef.current || selectionDragRef.current || fillDragRef.current) {
|
|
@@ -20874,11 +20994,11 @@ function XlsxGrid({
|
|
|
20874
20994
|
overlay.style.visibility = "hidden";
|
|
20875
20995
|
return;
|
|
20876
20996
|
}
|
|
20877
|
-
overlay.style.left = `${rect.left + rect.width - 16}px`;
|
|
20997
|
+
overlay.style.left = `${rect.left + rect.width - 16 * zoomFactor}px`;
|
|
20878
20998
|
overlay.style.top = `${rect.top + rect.height / 2}px`;
|
|
20879
20999
|
overlay.style.opacity = "1";
|
|
20880
21000
|
overlay.style.visibility = "visible";
|
|
20881
|
-
}, [getCellData, resolveOverlayRect]);
|
|
21001
|
+
}, [getCellData, resolveOverlayRect, zoomFactor]);
|
|
20882
21002
|
const commitSelectionRange = React4.useCallback((range) => {
|
|
20883
21003
|
const normalized = normalizeRange2(range);
|
|
20884
21004
|
if (selectionRef.current && rangesEqual(selectionRef.current, normalized) && isSameCell(activeCellRef.current, normalized.end) && selectedChartIdRef.current === null && selectedImageIdRef.current === null) {
|
|
@@ -20916,7 +21036,7 @@ function XlsxGrid({
|
|
|
20916
21036
|
}
|
|
20917
21037
|
pendingResizePreviewRef.current = {
|
|
20918
21038
|
actualIndex: state.actualIndex,
|
|
20919
|
-
size: state.type === "column" ? Math.max(
|
|
21039
|
+
size: state.type === "column" ? Math.max(displayDefaultColWidth / 2, state.initialPx + (event.clientX - state.startPosition)) : Math.max(displayDefaultRowHeight / 1.5, state.initialPx + (event.clientY - state.startPosition)),
|
|
20920
21040
|
type: state.type
|
|
20921
21041
|
};
|
|
20922
21042
|
if (resizeFrameRef.current !== null) {
|
|
@@ -20963,9 +21083,9 @@ function XlsxGrid({
|
|
|
20963
21083
|
}
|
|
20964
21084
|
if (preview && preview.actualIndex === resizeState.actualIndex && preview.type === resizeState.type) {
|
|
20965
21085
|
if (preview.type === "column") {
|
|
20966
|
-
controller.resizeColumn(preview.actualIndex, preview.size);
|
|
21086
|
+
controller.resizeColumn(preview.actualIndex, preview.size / zoomFactor);
|
|
20967
21087
|
} else {
|
|
20968
|
-
controller.resizeRow(preview.actualIndex, preview.size);
|
|
21088
|
+
controller.resizeRow(preview.actualIndex, preview.size / zoomFactor);
|
|
20969
21089
|
}
|
|
20970
21090
|
}
|
|
20971
21091
|
}
|
|
@@ -20982,7 +21102,7 @@ function XlsxGrid({
|
|
|
20982
21102
|
resizeFrameRef.current = null;
|
|
20983
21103
|
}
|
|
20984
21104
|
};
|
|
20985
|
-
}, [applyColumnPreview, applyRowPreview, controller, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21105
|
+
}, [applyColumnPreview, applyRowPreview, controller, displayDefaultColWidth, displayDefaultRowHeight, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
20986
21106
|
function buildDraggedSelectionRange(dragState, cell) {
|
|
20987
21107
|
if (dragState.axis === "row") {
|
|
20988
21108
|
if (firstVisibleCol === void 0 || lastVisibleCol === void 0) {
|
|
@@ -21311,21 +21431,21 @@ function XlsxGrid({
|
|
|
21311
21431
|
color: palette.mutedText,
|
|
21312
21432
|
cursor: "pointer",
|
|
21313
21433
|
display: "inline-flex",
|
|
21314
|
-
fontSize: 10,
|
|
21315
|
-
height: 16,
|
|
21434
|
+
fontSize: 10 * zoomFactor,
|
|
21435
|
+
height: 16 * zoomFactor,
|
|
21316
21436
|
justifyContent: "center",
|
|
21317
21437
|
padding: 0,
|
|
21318
21438
|
position: "absolute",
|
|
21319
|
-
right: 4,
|
|
21320
|
-
top: 3,
|
|
21321
|
-
width: 16,
|
|
21439
|
+
right: 4 * zoomFactor,
|
|
21440
|
+
top: 3 * zoomFactor,
|
|
21441
|
+
width: 16 * zoomFactor,
|
|
21322
21442
|
zIndex: 6
|
|
21323
21443
|
},
|
|
21324
21444
|
type: "button",
|
|
21325
21445
|
children: direction === "ascending" ? "\u25B2" : direction === "descending" ? "\u25BC" : "\u25BE"
|
|
21326
21446
|
}
|
|
21327
21447
|
);
|
|
21328
|
-
}, [effectiveTables, palette.mutedText, sortState]);
|
|
21448
|
+
}, [effectiveTables, palette.mutedText, sortState, zoomFactor]);
|
|
21329
21449
|
const startChartMove = React4.useCallback((event, chart, rect) => {
|
|
21330
21450
|
if (event.button !== 0) {
|
|
21331
21451
|
return;
|
|
@@ -21531,7 +21651,7 @@ function XlsxGrid({
|
|
|
21531
21651
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21532
21652
|
index,
|
|
21533
21653
|
key: actualRow,
|
|
21534
|
-
size:
|
|
21654
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21535
21655
|
start: rowPrefixSums[index] ?? 0
|
|
21536
21656
|
})) : (() => {
|
|
21537
21657
|
const renderedRowsByIndex = /* @__PURE__ */ new Map();
|
|
@@ -21552,27 +21672,25 @@ function XlsxGrid({
|
|
|
21552
21672
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21553
21673
|
index,
|
|
21554
21674
|
key: visibleRows[index] ?? index,
|
|
21555
|
-
size:
|
|
21675
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21556
21676
|
start: rowPrefixSums[index] ?? 0
|
|
21557
21677
|
});
|
|
21558
21678
|
});
|
|
21559
21679
|
return Array.from(renderedRowsByIndex.values()).sort((left, right) => left.index - right.index);
|
|
21560
21680
|
})();
|
|
21561
21681
|
const totalHeight = shouldVirtualizeRows ? rowVirtualizer.getTotalSize() : rowPrefixSums[rowPrefixSums.length - 1] ?? 0;
|
|
21562
|
-
const totalWidth = totalContentWidth +
|
|
21563
|
-
const sheetContentHeight =
|
|
21564
|
-
const zoomedSheetHeight = sheetContentHeight * zoomFactor;
|
|
21565
|
-
const zoomedSheetWidth = totalWidth * zoomFactor;
|
|
21682
|
+
const totalWidth = totalContentWidth + displayRowHeaderWidth;
|
|
21683
|
+
const sheetContentHeight = displayHeaderHeight + totalHeight;
|
|
21566
21684
|
const { fill: selectionFill, header: selectionHeaderSurface, stroke: selectionStroke } = resolveSelectionColors({
|
|
21567
21685
|
palette,
|
|
21568
21686
|
selectionColor,
|
|
21569
21687
|
selectionFillColor,
|
|
21570
21688
|
selectionHeaderColor
|
|
21571
21689
|
});
|
|
21572
|
-
const selectionBorderWidth = 1;
|
|
21690
|
+
const selectionBorderWidth = Math.max(1, zoomFactor);
|
|
21573
21691
|
const rowColSpan = renderedCols.length + 1 + (leadingColumnSpacerWidth > 0 ? 1 : 0) + (trailingColumnSpacerWidth > 0 ? 1 : 0);
|
|
21574
21692
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
21575
|
-
const headerCellStyle = {
|
|
21693
|
+
const headerCellStyle = scaleCssProperties({
|
|
21576
21694
|
backgroundColor: palette.headerSurface,
|
|
21577
21695
|
borderBottom: "none",
|
|
21578
21696
|
borderRight: "none",
|
|
@@ -21589,8 +21707,8 @@ function XlsxGrid({
|
|
|
21589
21707
|
userSelect: "none",
|
|
21590
21708
|
whiteSpace: "nowrap",
|
|
21591
21709
|
zIndex: 50
|
|
21592
|
-
};
|
|
21593
|
-
const columnResizeHandleStyle = {
|
|
21710
|
+
}, zoomFactor);
|
|
21711
|
+
const columnResizeHandleStyle = scaleCssProperties({
|
|
21594
21712
|
backgroundColor: "transparent",
|
|
21595
21713
|
cursor: "col-resize",
|
|
21596
21714
|
position: "absolute",
|
|
@@ -21599,17 +21717,23 @@ function XlsxGrid({
|
|
|
21599
21717
|
width: 16,
|
|
21600
21718
|
height: "100%",
|
|
21601
21719
|
zIndex: 5
|
|
21602
|
-
};
|
|
21720
|
+
}, zoomFactor);
|
|
21603
21721
|
function resolveDrawingPane(rect) {
|
|
21604
21722
|
return resolveFrozenDrawingPane(
|
|
21605
21723
|
rect,
|
|
21606
21724
|
frozenRows,
|
|
21607
21725
|
frozenCols,
|
|
21608
|
-
|
|
21609
|
-
|
|
21726
|
+
displayActualRowHeights,
|
|
21727
|
+
displayActualColWidths,
|
|
21610
21728
|
activeSheet?.freezePanes ?? null,
|
|
21611
21729
|
stickyTopByRow,
|
|
21612
|
-
stickyLeftByCol
|
|
21730
|
+
stickyLeftByCol,
|
|
21731
|
+
{
|
|
21732
|
+
defaultColWidth: displayDefaultColWidth,
|
|
21733
|
+
defaultRowHeight: displayDefaultRowHeight,
|
|
21734
|
+
headerHeight: displayHeaderHeight,
|
|
21735
|
+
rowHeaderWidth: displayRowHeaderWidth
|
|
21736
|
+
}
|
|
21613
21737
|
);
|
|
21614
21738
|
}
|
|
21615
21739
|
function renderShapeDrawing(shape, rect, pane) {
|
|
@@ -21626,12 +21750,12 @@ function XlsxGrid({
|
|
|
21626
21750
|
const groupScaleX = shape.scaleX ?? 1;
|
|
21627
21751
|
const groupScaleY = shape.scaleY ?? 1;
|
|
21628
21752
|
const strokeScale = Math.max(groupScaleX, groupScaleY);
|
|
21629
|
-
const textScale = strokeScale;
|
|
21753
|
+
const textScale = strokeScale * zoomFactor;
|
|
21630
21754
|
const textWidth = groupScaleX !== 0 ? rect.width / groupScaleX : rect.width;
|
|
21631
21755
|
const textHeight = groupScaleY !== 0 ? rect.height / groupScaleY : rect.height;
|
|
21632
21756
|
const vectorShape = resolveShapeVector(shape);
|
|
21633
21757
|
const strokeColor = shape.stroke?.none ? "transparent" : shape.stroke?.color ?? "transparent";
|
|
21634
|
-
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale;
|
|
21758
|
+
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale * zoomFactor;
|
|
21635
21759
|
const headMarkerId = `${shape.id}-${pane}-head-marker`;
|
|
21636
21760
|
const tailMarkerId = `${shape.id}-${pane}-tail-marker`;
|
|
21637
21761
|
const headMarker = vectorShape ? resolveShapeLineEndMarker(
|
|
@@ -21651,7 +21775,7 @@ function XlsxGrid({
|
|
|
21651
21775
|
vectorShape.viewBox
|
|
21652
21776
|
) : null;
|
|
21653
21777
|
const style = {
|
|
21654
|
-
...buildShapeContainerStyle(shape, rect),
|
|
21778
|
+
...buildShapeContainerStyle(shape, rect, zoomFactor),
|
|
21655
21779
|
...vectorShape ? {
|
|
21656
21780
|
backgroundColor: "transparent",
|
|
21657
21781
|
border: "none"
|
|
@@ -21714,13 +21838,13 @@ function XlsxGrid({
|
|
|
21714
21838
|
display: "flex",
|
|
21715
21839
|
flex: 1,
|
|
21716
21840
|
flexDirection: "column",
|
|
21717
|
-
gap: 2,
|
|
21841
|
+
gap: 2 * zoomFactor,
|
|
21718
21842
|
height: textHeight,
|
|
21719
21843
|
justifyContent: shape.textBox?.verticalAlign === "middle" ? "center" : shape.textBox?.verticalAlign === "bottom" ? "flex-end" : "flex-start",
|
|
21720
|
-
paddingBottom: inset?.bottom ?? 4,
|
|
21721
|
-
paddingLeft: inset?.left ?? 6,
|
|
21722
|
-
paddingRight: inset?.right ?? 6,
|
|
21723
|
-
paddingTop: inset?.top ?? 4,
|
|
21844
|
+
paddingBottom: (inset?.bottom ?? 4) * zoomFactor,
|
|
21845
|
+
paddingLeft: (inset?.left ?? 6) * zoomFactor,
|
|
21846
|
+
paddingRight: (inset?.right ?? 6) * zoomFactor,
|
|
21847
|
+
paddingTop: (inset?.top ?? 4) * zoomFactor,
|
|
21724
21848
|
pointerEvents: "none",
|
|
21725
21849
|
position: "relative",
|
|
21726
21850
|
transform: groupScaleX !== 1 || groupScaleY !== 1 ? `scale(${groupScaleX}, ${groupScaleY})` : void 0,
|
|
@@ -21792,8 +21916,8 @@ function XlsxGrid({
|
|
|
21792
21916
|
"div",
|
|
21793
21917
|
{
|
|
21794
21918
|
style: {
|
|
21795
|
-
border:
|
|
21796
|
-
boxShadow: `0 0 0
|
|
21919
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
21920
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21797
21921
|
boxSizing: "border-box",
|
|
21798
21922
|
inset: 0,
|
|
21799
21923
|
pointerEvents: "none",
|
|
@@ -21803,7 +21927,7 @@ function XlsxGrid({
|
|
|
21803
21927
|
"div",
|
|
21804
21928
|
{
|
|
21805
21929
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21806
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21930
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21807
21931
|
},
|
|
21808
21932
|
position
|
|
21809
21933
|
)) : null
|
|
@@ -21815,7 +21939,7 @@ function XlsxGrid({
|
|
|
21815
21939
|
startImageResize(event, image, rect, position);
|
|
21816
21940
|
}
|
|
21817
21941
|
},
|
|
21818
|
-
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface), display: "none" }
|
|
21942
|
+
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor), display: "none" }
|
|
21819
21943
|
}),
|
|
21820
21944
|
image,
|
|
21821
21945
|
rect
|
|
@@ -21823,8 +21947,8 @@ function XlsxGrid({
|
|
|
21823
21947
|
"div",
|
|
21824
21948
|
{
|
|
21825
21949
|
style: {
|
|
21826
|
-
border:
|
|
21827
|
-
boxShadow: `0 0 0
|
|
21950
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
21951
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21828
21952
|
boxSizing: "border-box",
|
|
21829
21953
|
inset: 0,
|
|
21830
21954
|
pointerEvents: "none",
|
|
@@ -21834,7 +21958,7 @@ function XlsxGrid({
|
|
|
21834
21958
|
"div",
|
|
21835
21959
|
{
|
|
21836
21960
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21837
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21961
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21838
21962
|
},
|
|
21839
21963
|
position
|
|
21840
21964
|
)) : null
|
|
@@ -21896,8 +22020,8 @@ function XlsxGrid({
|
|
|
21896
22020
|
"div",
|
|
21897
22021
|
{
|
|
21898
22022
|
style: {
|
|
21899
|
-
border:
|
|
21900
|
-
boxShadow: `0 0 0
|
|
22023
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
22024
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21901
22025
|
boxSizing: "border-box",
|
|
21902
22026
|
inset: 0,
|
|
21903
22027
|
pointerEvents: "none",
|
|
@@ -21907,7 +22031,7 @@ function XlsxGrid({
|
|
|
21907
22031
|
"div",
|
|
21908
22032
|
{
|
|
21909
22033
|
onPointerDown: (event) => startChartResize(event, chart, rect, position),
|
|
21910
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
22034
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21911
22035
|
},
|
|
21912
22036
|
position
|
|
21913
22037
|
)) : null
|
|
@@ -22143,8 +22267,8 @@ function XlsxGrid({
|
|
|
22143
22267
|
if (!interaction) {
|
|
22144
22268
|
return;
|
|
22145
22269
|
}
|
|
22146
|
-
const deltaX =
|
|
22147
|
-
const deltaY =
|
|
22270
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22271
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22148
22272
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22149
22273
|
interaction.didMove = true;
|
|
22150
22274
|
}
|
|
@@ -22153,7 +22277,12 @@ function XlsxGrid({
|
|
|
22153
22277
|
...interaction.baseRect,
|
|
22154
22278
|
left: interaction.baseRect.left + deltaX,
|
|
22155
22279
|
top: interaction.baseRect.top + deltaY
|
|
22156
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY,
|
|
22280
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, displayImageMinSize),
|
|
22281
|
+
{
|
|
22282
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22283
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22284
|
+
minSizePx: displayImageMinSize
|
|
22285
|
+
}
|
|
22157
22286
|
);
|
|
22158
22287
|
scheduleImagePreviewRect({ id: interaction.imageId, rect: nextRect });
|
|
22159
22288
|
};
|
|
@@ -22188,7 +22317,7 @@ function XlsxGrid({
|
|
|
22188
22317
|
if (interaction.didMove) {
|
|
22189
22318
|
skipNextImageClickRef.current = interaction.imageId;
|
|
22190
22319
|
}
|
|
22191
|
-
setImageRect(interaction.imageId, preview.rect);
|
|
22320
|
+
setImageRect(interaction.imageId, toLogicalRect(preview.rect));
|
|
22192
22321
|
}
|
|
22193
22322
|
imagePreviewRectRef.current = null;
|
|
22194
22323
|
setImagePreviewRect(null);
|
|
@@ -22208,8 +22337,8 @@ function XlsxGrid({
|
|
|
22208
22337
|
if (!interaction) {
|
|
22209
22338
|
return;
|
|
22210
22339
|
}
|
|
22211
|
-
const deltaX =
|
|
22212
|
-
const deltaY =
|
|
22340
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22341
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22213
22342
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22214
22343
|
interaction.didMove = true;
|
|
22215
22344
|
}
|
|
@@ -22218,7 +22347,12 @@ function XlsxGrid({
|
|
|
22218
22347
|
...interaction.baseRect,
|
|
22219
22348
|
left: interaction.baseRect.left + deltaX,
|
|
22220
22349
|
top: interaction.baseRect.top + deltaY
|
|
22221
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48)
|
|
22350
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48 * zoomFactor),
|
|
22351
|
+
{
|
|
22352
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22353
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22354
|
+
minSizePx: 48 * zoomFactor
|
|
22355
|
+
}
|
|
22222
22356
|
);
|
|
22223
22357
|
scheduleChartPreviewRect({ id: interaction.chartId, rect: nextRect });
|
|
22224
22358
|
};
|
|
@@ -22253,7 +22387,7 @@ function XlsxGrid({
|
|
|
22253
22387
|
if (interaction.didMove) {
|
|
22254
22388
|
skipNextChartClickRef.current = interaction.chartId;
|
|
22255
22389
|
}
|
|
22256
|
-
setChartRect(interaction.chartId, preview.rect);
|
|
22390
|
+
setChartRect(interaction.chartId, toLogicalRect(preview.rect));
|
|
22257
22391
|
}
|
|
22258
22392
|
chartPreviewRectRef.current = null;
|
|
22259
22393
|
setChartPreviewRect(null);
|
|
@@ -22435,8 +22569,8 @@ function XlsxGrid({
|
|
|
22435
22569
|
minHeight: "100%",
|
|
22436
22570
|
minWidth: "100%",
|
|
22437
22571
|
position: "relative",
|
|
22438
|
-
width:
|
|
22439
|
-
height:
|
|
22572
|
+
width: totalWidth,
|
|
22573
|
+
height: sheetContentHeight
|
|
22440
22574
|
},
|
|
22441
22575
|
children: /* @__PURE__ */ jsxs3(
|
|
22442
22576
|
"div",
|
|
@@ -22447,9 +22581,6 @@ function XlsxGrid({
|
|
|
22447
22581
|
left: 0,
|
|
22448
22582
|
position: "absolute",
|
|
22449
22583
|
top: 0,
|
|
22450
|
-
transform: void 0,
|
|
22451
|
-
transformOrigin: "top left",
|
|
22452
|
-
zoom: useNativeZoomForStickyLayout ? zoomFactor : void 0,
|
|
22453
22584
|
width: totalWidth
|
|
22454
22585
|
},
|
|
22455
22586
|
children: [
|
|
@@ -22472,7 +22603,7 @@ function XlsxGrid({
|
|
|
22472
22603
|
},
|
|
22473
22604
|
children: [
|
|
22474
22605
|
/* @__PURE__ */ jsxs3("colgroup", { children: [
|
|
22475
|
-
/* @__PURE__ */ jsx3("col", { style: { width:
|
|
22606
|
+
/* @__PURE__ */ jsx3("col", { style: { width: displayRowHeaderWidth } }),
|
|
22476
22607
|
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: leadingColumnSpacerWidth } }) : null,
|
|
22477
22608
|
renderedCols.map((column) => /* @__PURE__ */ jsx3(
|
|
22478
22609
|
"col",
|
|
@@ -22498,7 +22629,7 @@ function XlsxGrid({
|
|
|
22498
22629
|
...headerCellStyle,
|
|
22499
22630
|
backgroundColor: palette.headerSurface,
|
|
22500
22631
|
left: 0,
|
|
22501
|
-
width:
|
|
22632
|
+
width: displayRowHeaderWidth,
|
|
22502
22633
|
zIndex: 60
|
|
22503
22634
|
}
|
|
22504
22635
|
}
|
|
@@ -22573,10 +22704,12 @@ function XlsxGrid({
|
|
|
22573
22704
|
readOnly,
|
|
22574
22705
|
renderCellAdornment,
|
|
22575
22706
|
rowHeight: virtualRow.size,
|
|
22707
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
22576
22708
|
stickyLeftByCol,
|
|
22577
22709
|
stickyTop: stickyTopByRow.get(actualRow),
|
|
22578
22710
|
trailingSpacerWidth: trailingColumnSpacerWidth,
|
|
22579
|
-
visibleCols: renderedCols
|
|
22711
|
+
visibleCols: renderedCols,
|
|
22712
|
+
zoomFactor
|
|
22580
22713
|
},
|
|
22581
22714
|
virtualRow.key
|
|
22582
22715
|
)
|
|
@@ -22625,16 +22758,16 @@ function XlsxGrid({
|
|
|
22625
22758
|
alignItems: "center",
|
|
22626
22759
|
color: palette.mutedText,
|
|
22627
22760
|
display: "inline-flex",
|
|
22628
|
-
fontSize: 10,
|
|
22761
|
+
fontSize: 10 * zoomFactor,
|
|
22629
22762
|
fontWeight: 700,
|
|
22630
|
-
height: 16,
|
|
22763
|
+
height: 16 * zoomFactor,
|
|
22631
22764
|
justifyContent: "center",
|
|
22632
22765
|
opacity: 0,
|
|
22633
22766
|
pointerEvents: "none",
|
|
22634
22767
|
position: "absolute",
|
|
22635
22768
|
transform: "translateY(-50%)",
|
|
22636
22769
|
visibility: "hidden",
|
|
22637
|
-
width: 12,
|
|
22770
|
+
width: 12 * zoomFactor,
|
|
22638
22771
|
zIndex: 26
|
|
22639
22772
|
},
|
|
22640
22773
|
children: "\u25BE"
|
|
@@ -22654,16 +22787,16 @@ function XlsxGrid({
|
|
|
22654
22787
|
},
|
|
22655
22788
|
style: {
|
|
22656
22789
|
backgroundColor: selectionStroke,
|
|
22657
|
-
border:
|
|
22790
|
+
border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
|
|
22658
22791
|
contain: "layout paint",
|
|
22659
22792
|
cursor: "crosshair",
|
|
22660
22793
|
display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
|
|
22661
|
-
height: 8,
|
|
22662
|
-
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 : 0,
|
|
22794
|
+
height: 8 * zoomFactor,
|
|
22795
|
+
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
|
|
22663
22796
|
pointerEvents: "auto",
|
|
22664
22797
|
position: "absolute",
|
|
22665
|
-
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 : 0,
|
|
22666
|
-
width: 8,
|
|
22798
|
+
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
|
|
22799
|
+
width: 8 * zoomFactor,
|
|
22667
22800
|
zIndex: 25
|
|
22668
22801
|
}
|
|
22669
22802
|
}
|
|
@@ -22674,7 +22807,7 @@ function XlsxGrid({
|
|
|
22674
22807
|
ref: tableMenuRef,
|
|
22675
22808
|
style: {
|
|
22676
22809
|
color: palette.text,
|
|
22677
|
-
left: Math.max(
|
|
22810
|
+
left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
|
|
22678
22811
|
position: "absolute",
|
|
22679
22812
|
top: openTableMenuState.top,
|
|
22680
22813
|
zIndex: 50
|