@extend-ai/react-xlsx 0.2.0 → 0.4.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 +413 -261
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +413 -264
- 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;
|
|
@@ -18443,6 +18536,12 @@ function renderFileTooLarge(fileTooLargeState, renderProps, palette) {
|
|
|
18443
18536
|
}
|
|
18444
18537
|
return defaultNode;
|
|
18445
18538
|
}
|
|
18539
|
+
function renderCustomFileTooLarge(fileTooLargeState, renderProps, palette) {
|
|
18540
|
+
if (fileTooLargeState === void 0) {
|
|
18541
|
+
return void 0;
|
|
18542
|
+
}
|
|
18543
|
+
return renderFileTooLarge(fileTooLargeState, renderProps, palette);
|
|
18544
|
+
}
|
|
18446
18545
|
function renderDefaultChartLoadingCard(rect) {
|
|
18447
18546
|
const bars = [18, 32, 24];
|
|
18448
18547
|
const barWidth = Math.max(8, Math.min(12, Math.round(rect.width * 0.018)));
|
|
@@ -18677,7 +18776,8 @@ function buildConditionalIcon(iconSet, iconId) {
|
|
|
18677
18776
|
};
|
|
18678
18777
|
}
|
|
18679
18778
|
}
|
|
18680
|
-
function renderConditionalIcon(icon) {
|
|
18779
|
+
function renderConditionalIcon(icon, scale = 1) {
|
|
18780
|
+
const iconSize = 14 * scale;
|
|
18681
18781
|
if (icon.shape === "arrow") {
|
|
18682
18782
|
const fill = icon.color ?? "#111827";
|
|
18683
18783
|
const stroke = icon.borderColor ?? darkenColor3(fill, 0.32);
|
|
@@ -18685,10 +18785,10 @@ function renderConditionalIcon(icon) {
|
|
|
18685
18785
|
"svg",
|
|
18686
18786
|
{
|
|
18687
18787
|
"aria-hidden": "true",
|
|
18688
|
-
height:
|
|
18788
|
+
height: iconSize,
|
|
18689
18789
|
style: { display: "block" },
|
|
18690
18790
|
viewBox: "0 0 16 16",
|
|
18691
|
-
width:
|
|
18791
|
+
width: iconSize,
|
|
18692
18792
|
children: /* @__PURE__ */ jsx3("g", { transform: `rotate(${icon.rotationDeg ?? 0} 8 8)`, children: /* @__PURE__ */ jsx3(
|
|
18693
18793
|
"path",
|
|
18694
18794
|
{
|
|
@@ -18710,12 +18810,12 @@ function renderConditionalIcon(icon) {
|
|
|
18710
18810
|
alignItems: "center",
|
|
18711
18811
|
color: icon.color ?? "#111827",
|
|
18712
18812
|
display: "inline-flex",
|
|
18713
|
-
fontSize: 13,
|
|
18813
|
+
fontSize: 13 * scale,
|
|
18714
18814
|
fontWeight: 700,
|
|
18715
|
-
height:
|
|
18815
|
+
height: iconSize,
|
|
18716
18816
|
justifyContent: "center",
|
|
18717
18817
|
lineHeight: 1,
|
|
18718
|
-
width:
|
|
18818
|
+
width: iconSize
|
|
18719
18819
|
},
|
|
18720
18820
|
children: icon.glyph
|
|
18721
18821
|
}
|
|
@@ -18729,17 +18829,17 @@ function renderConditionalIcon(icon) {
|
|
|
18729
18829
|
border: icon.borderColor ? `1px solid ${icon.borderColor}` : "none",
|
|
18730
18830
|
borderRadius: "999px",
|
|
18731
18831
|
display: "inline-block",
|
|
18732
|
-
height: 12,
|
|
18733
|
-
width: 12
|
|
18832
|
+
height: 12 * scale,
|
|
18833
|
+
width: 12 * scale
|
|
18734
18834
|
}
|
|
18735
18835
|
}
|
|
18736
18836
|
);
|
|
18737
18837
|
}
|
|
18738
|
-
function renderCheckboxControl(checked, palette) {
|
|
18838
|
+
function renderCheckboxControl(checked, palette, scale = 1) {
|
|
18739
18839
|
const stroke = paletteIsDark(palette) ? "#cbd5e1" : "#475569";
|
|
18740
18840
|
const fill = checked ? paletteIsDark(palette) ? "#60a5fa" : "#2563eb" : "transparent";
|
|
18741
18841
|
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: [
|
|
18842
|
+
return /* @__PURE__ */ jsxs3("svg", { "aria-hidden": "true", height: 14 * scale, style: { display: "block" }, viewBox: "0 0 16 16", width: 14 * scale, children: [
|
|
18743
18843
|
/* @__PURE__ */ jsx3("rect", { fill, height: 11, rx: 2, ry: 2, stroke, strokeWidth: 1.2, width: 11, x: 2.5, y: 2.5 }),
|
|
18744
18844
|
checked ? /* @__PURE__ */ jsx3(
|
|
18745
18845
|
"path",
|
|
@@ -18937,10 +19037,12 @@ function GridRow({
|
|
|
18937
19037
|
readOnly,
|
|
18938
19038
|
renderCellAdornment,
|
|
18939
19039
|
rowHeight,
|
|
19040
|
+
rowHeaderWidth,
|
|
18940
19041
|
stickyLeftByCol,
|
|
18941
19042
|
stickyTop,
|
|
18942
19043
|
trailingSpacerWidth,
|
|
18943
|
-
visibleCols
|
|
19044
|
+
visibleCols,
|
|
19045
|
+
zoomFactor
|
|
18944
19046
|
}) {
|
|
18945
19047
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
18946
19048
|
return /* @__PURE__ */ jsxs3("tr", { "data-xlsx-row": actualRow, style: { height: rowHeight }, children: [
|
|
@@ -18956,17 +19058,17 @@ function GridRow({
|
|
|
18956
19058
|
boxSizing: "border-box",
|
|
18957
19059
|
boxShadow: gutterSeparatorShadow,
|
|
18958
19060
|
color: palette.mutedText,
|
|
18959
|
-
fontSize: "11px",
|
|
19061
|
+
fontSize: scaleCssLengthExpression("11px", zoomFactor),
|
|
18960
19062
|
height: rowHeight,
|
|
18961
19063
|
left: 0,
|
|
18962
19064
|
maxHeight: rowHeight,
|
|
18963
|
-
minWidth:
|
|
18964
|
-
padding: "2px 4px",
|
|
19065
|
+
minWidth: rowHeaderWidth,
|
|
19066
|
+
padding: scaleCssLengthExpression("2px 4px", zoomFactor),
|
|
18965
19067
|
position: "sticky",
|
|
18966
19068
|
top: stickyTop,
|
|
18967
19069
|
textAlign: "center",
|
|
18968
19070
|
userSelect: "none",
|
|
18969
|
-
width:
|
|
19071
|
+
width: rowHeaderWidth,
|
|
18970
19072
|
zIndex: stickyTop !== void 0 ? 45 : 35
|
|
18971
19073
|
},
|
|
18972
19074
|
children: /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
|
|
@@ -18977,9 +19079,9 @@ function GridRow({
|
|
|
18977
19079
|
onPointerDown: (event) => onRowResizePointerDown(event, actualRow, rowHeight),
|
|
18978
19080
|
style: {
|
|
18979
19081
|
backgroundColor: "transparent",
|
|
18980
|
-
bottom: -8,
|
|
19082
|
+
bottom: -8 * zoomFactor,
|
|
18981
19083
|
cursor: "row-resize",
|
|
18982
|
-
height: 16,
|
|
19084
|
+
height: 16 * zoomFactor,
|
|
18983
19085
|
left: 0,
|
|
18984
19086
|
position: "absolute",
|
|
18985
19087
|
width: "100%",
|
|
@@ -19080,7 +19182,7 @@ function GridRow({
|
|
|
19080
19182
|
cellContentStyle.zIndex = 1;
|
|
19081
19183
|
}
|
|
19082
19184
|
if (trailingInset > 0) {
|
|
19083
|
-
cellContentStyle.paddingRight = trailingInset + 4;
|
|
19185
|
+
cellContentStyle.paddingRight = (trailingInset + 4) * zoomFactor;
|
|
19084
19186
|
}
|
|
19085
19187
|
if (cellData.conditionalIcon) {
|
|
19086
19188
|
cellContentStyle.position = "relative";
|
|
@@ -19114,13 +19216,13 @@ function GridRow({
|
|
|
19114
19216
|
"aria-hidden": "true",
|
|
19115
19217
|
style: {
|
|
19116
19218
|
alignItems: "center",
|
|
19117
|
-
bottom: 4,
|
|
19219
|
+
bottom: 4 * zoomFactor,
|
|
19118
19220
|
display: "flex",
|
|
19119
|
-
left: 4,
|
|
19221
|
+
left: 4 * zoomFactor,
|
|
19120
19222
|
pointerEvents: "none",
|
|
19121
19223
|
position: "absolute",
|
|
19122
|
-
right: 4,
|
|
19123
|
-
top: 4,
|
|
19224
|
+
right: 4 * zoomFactor,
|
|
19225
|
+
top: 4 * zoomFactor,
|
|
19124
19226
|
zIndex: 0
|
|
19125
19227
|
},
|
|
19126
19228
|
children: /* @__PURE__ */ jsx3(
|
|
@@ -19149,12 +19251,12 @@ function GridRow({
|
|
|
19149
19251
|
justifyContent: "center",
|
|
19150
19252
|
pointerEvents: "none",
|
|
19151
19253
|
position: "absolute",
|
|
19152
|
-
right: conditionalIconRight,
|
|
19254
|
+
right: conditionalIconRight * zoomFactor,
|
|
19153
19255
|
top: "50%",
|
|
19154
19256
|
transform: "translateY(-50%)",
|
|
19155
19257
|
zIndex: 2
|
|
19156
19258
|
},
|
|
19157
|
-
children: renderConditionalIcon(cellData.conditionalIcon)
|
|
19259
|
+
children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
|
|
19158
19260
|
}
|
|
19159
19261
|
) : null,
|
|
19160
19262
|
isEditing ? /* @__PURE__ */ jsx3(
|
|
@@ -19183,7 +19285,7 @@ function GridRow({
|
|
|
19183
19285
|
height: "100%",
|
|
19184
19286
|
margin: 0,
|
|
19185
19287
|
outline: "none",
|
|
19186
|
-
padding: DEFAULT_CELL_PADDING,
|
|
19288
|
+
padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
|
|
19187
19289
|
width: "100%"
|
|
19188
19290
|
},
|
|
19189
19291
|
value: editingValue
|
|
@@ -19225,7 +19327,7 @@ function GridRow({
|
|
|
19225
19327
|
pointerEvents: "none",
|
|
19226
19328
|
width: "100%"
|
|
19227
19329
|
},
|
|
19228
|
-
children: renderCheckboxControl(cellData.checkboxState, palette)
|
|
19330
|
+
children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
|
|
19229
19331
|
}
|
|
19230
19332
|
) : /* @__PURE__ */ jsx3("div", { style: cellContentStyle, children: cellData.value })
|
|
19231
19333
|
]
|
|
@@ -19248,7 +19350,7 @@ function GridRow({
|
|
|
19248
19350
|
] });
|
|
19249
19351
|
}
|
|
19250
19352
|
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) {
|
|
19353
|
+
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
19354
|
return false;
|
|
19253
19355
|
}
|
|
19254
19356
|
const prevEditingCol = prev.editingCell?.row === prev.actualRow ? prev.editingCell.col : -1;
|
|
@@ -19425,20 +19527,25 @@ function XlsxGrid({
|
|
|
19425
19527
|
);
|
|
19426
19528
|
const hiddenRowSet = React4.useMemo(() => new Set(activeSheet?.hiddenRows ?? []), [activeSheet?.hiddenRows]);
|
|
19427
19529
|
const hiddenColSet = React4.useMemo(() => new Set(activeSheet?.hiddenCols ?? []), [activeSheet?.hiddenCols]);
|
|
19530
|
+
const displayDefaultRowHeight = DEFAULT_ROW_HEIGHT2 * zoomFactor;
|
|
19531
|
+
const displayDefaultColWidth = DEFAULT_COL_WIDTH2 * zoomFactor;
|
|
19532
|
+
const displayHeaderHeight = HEADER_HEIGHT * zoomFactor;
|
|
19533
|
+
const displayRowHeaderWidth = ROW_HEADER_WIDTH * zoomFactor;
|
|
19534
|
+
const displayImageMinSize = IMAGE_MIN_SIZE_PX * zoomFactor;
|
|
19428
19535
|
const syncDrawingViewport = React4.useCallback((scroller) => {
|
|
19429
19536
|
if (!scroller) {
|
|
19430
19537
|
return;
|
|
19431
19538
|
}
|
|
19432
19539
|
setDrawingViewport((current) => {
|
|
19433
19540
|
const next = {
|
|
19434
|
-
height: scroller.clientHeight
|
|
19435
|
-
left: scroller.scrollLeft
|
|
19436
|
-
top: scroller.scrollTop
|
|
19437
|
-
width: scroller.clientWidth
|
|
19541
|
+
height: scroller.clientHeight,
|
|
19542
|
+
left: scroller.scrollLeft,
|
|
19543
|
+
top: scroller.scrollTop,
|
|
19544
|
+
width: scroller.clientWidth
|
|
19438
19545
|
};
|
|
19439
19546
|
return current.left === next.left && current.top === next.top && current.width === next.width && current.height === next.height ? current : next;
|
|
19440
19547
|
});
|
|
19441
|
-
}, [
|
|
19548
|
+
}, []);
|
|
19442
19549
|
const visibleRows = React4.useMemo(() => {
|
|
19443
19550
|
return buildVisibleAxisIndices(
|
|
19444
19551
|
activeSheet?.visibleRows ?? [],
|
|
@@ -19592,47 +19699,54 @@ function XlsxGrid({
|
|
|
19592
19699
|
revision
|
|
19593
19700
|
]
|
|
19594
19701
|
);
|
|
19595
|
-
const
|
|
19596
|
-
() =>
|
|
19597
|
-
[actualColWidths,
|
|
19702
|
+
const displayActualColWidths = React4.useMemo(
|
|
19703
|
+
() => actualColWidths.map((width) => width * zoomFactor),
|
|
19704
|
+
[actualColWidths, zoomFactor]
|
|
19705
|
+
);
|
|
19706
|
+
const displayActualRowHeights = React4.useMemo(
|
|
19707
|
+
() => actualRowHeights.map((height) => height * zoomFactor),
|
|
19708
|
+
[actualRowHeights, zoomFactor]
|
|
19598
19709
|
);
|
|
19599
|
-
const
|
|
19600
|
-
() =>
|
|
19601
|
-
[
|
|
19710
|
+
const displayEffectiveColWidths = React4.useMemo(
|
|
19711
|
+
() => visibleCols.map((col) => displayActualColWidths[col] ?? displayDefaultColWidth),
|
|
19712
|
+
[displayActualColWidths, displayDefaultColWidth, visibleCols]
|
|
19713
|
+
);
|
|
19714
|
+
const displayEffectiveRowHeights = React4.useMemo(
|
|
19715
|
+
() => visibleRows.map((row) => displayActualRowHeights[row] ?? displayDefaultRowHeight),
|
|
19716
|
+
[displayActualRowHeights, displayDefaultRowHeight, visibleRows]
|
|
19602
19717
|
);
|
|
19603
19718
|
const rowIndexByActual = React4.useMemo(() => new Map(visibleRows.map((row, index) => [row, index])), [visibleRows]);
|
|
19604
19719
|
const colIndexByActual = React4.useMemo(() => new Map(visibleCols.map((col, index) => [col, index])), [visibleCols]);
|
|
19605
19720
|
const visibleRowsRef = React4.useRef(visibleRows);
|
|
19606
19721
|
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(
|
|
19722
|
+
const effectiveRowHeightsRef = React4.useRef(displayEffectiveRowHeights);
|
|
19723
|
+
const effectiveColWidthsRef = React4.useRef(displayEffectiveColWidths);
|
|
19724
|
+
const rowPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveRowHeights), [displayEffectiveRowHeights]);
|
|
19725
|
+
const colPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveColWidths), [displayEffectiveColWidths]);
|
|
19726
|
+
const actualRowPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualRowHeights), [displayActualRowHeights]);
|
|
19727
|
+
const actualColPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualColWidths), [displayActualColWidths]);
|
|
19613
19728
|
const stickyTopByRow = React4.useMemo(
|
|
19614
|
-
() => buildStickyOffsets(frozenRows,
|
|
19615
|
-
[
|
|
19729
|
+
() => buildStickyOffsets(frozenRows, displayActualRowHeights, displayHeaderHeight),
|
|
19730
|
+
[displayActualRowHeights, displayHeaderHeight, frozenRows]
|
|
19616
19731
|
);
|
|
19617
19732
|
const stickyLeftByCol = React4.useMemo(
|
|
19618
|
-
() => buildStickyOffsets(frozenCols,
|
|
19619
|
-
[
|
|
19733
|
+
() => buildStickyOffsets(frozenCols, displayActualColWidths, displayRowHeaderWidth),
|
|
19734
|
+
[displayActualColWidths, displayRowHeaderWidth, frozenCols]
|
|
19620
19735
|
);
|
|
19621
19736
|
const frozenPaneBottom = React4.useMemo(
|
|
19622
19737
|
() => frozenRows.length > 0 ? frozenRows.reduce(
|
|
19623
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
19624
|
-
|
|
19625
|
-
) :
|
|
19626
|
-
[
|
|
19738
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? displayHeaderHeight) + (displayActualRowHeights[row] ?? displayDefaultRowHeight)),
|
|
19739
|
+
displayHeaderHeight
|
|
19740
|
+
) : displayHeaderHeight,
|
|
19741
|
+
[displayActualRowHeights, displayDefaultRowHeight, displayHeaderHeight, frozenRows, stickyTopByRow]
|
|
19627
19742
|
);
|
|
19628
19743
|
const frozenPaneRight = React4.useMemo(
|
|
19629
19744
|
() => frozenCols.length > 0 ? frozenCols.reduce(
|
|
19630
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
19631
|
-
|
|
19632
|
-
) :
|
|
19633
|
-
[
|
|
19745
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? displayRowHeaderWidth) + (displayActualColWidths[col] ?? displayDefaultColWidth)),
|
|
19746
|
+
displayRowHeaderWidth
|
|
19747
|
+
) : displayRowHeaderWidth,
|
|
19748
|
+
[displayActualColWidths, displayDefaultColWidth, displayRowHeaderWidth, frozenCols, stickyLeftByCol]
|
|
19634
19749
|
);
|
|
19635
|
-
const useNativeZoomForStickyLayout = zoomFactor !== 1;
|
|
19636
19750
|
const rowPrefixSumsRef = React4.useRef(rowPrefixSums);
|
|
19637
19751
|
const colPrefixSumsRef = React4.useRef(colPrefixSums);
|
|
19638
19752
|
const firstVisibleRow = visibleRows[0];
|
|
@@ -19640,6 +19754,12 @@ function XlsxGrid({
|
|
|
19640
19754
|
const firstVisibleCol = visibleCols[0];
|
|
19641
19755
|
const lastVisibleCol = visibleCols[visibleCols.length - 1];
|
|
19642
19756
|
const displayedSelection = fillPreviewRange ?? normalizedSelection;
|
|
19757
|
+
const toLogicalRect = React4.useCallback((rect) => ({
|
|
19758
|
+
height: rect.height / zoomFactor,
|
|
19759
|
+
left: rect.left / zoomFactor,
|
|
19760
|
+
top: rect.top / zoomFactor,
|
|
19761
|
+
width: rect.width / zoomFactor
|
|
19762
|
+
}), [zoomFactor]);
|
|
19643
19763
|
const drawingExtents = React4.useMemo(() => {
|
|
19644
19764
|
const imageExtents = images.reduce(
|
|
19645
19765
|
(current, image) => {
|
|
@@ -19681,24 +19801,18 @@ function XlsxGrid({
|
|
|
19681
19801
|
const shouldVirtualizeCols = !activeSheet?.hasHorizontalMerges && frozenCols.length === 0;
|
|
19682
19802
|
const rowVirtualizer = useVirtualizer({
|
|
19683
19803
|
count: visibleRows.length,
|
|
19684
|
-
estimateSize: (index) =>
|
|
19804
|
+
estimateSize: (index) => displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
19685
19805
|
getScrollElement: () => scrollRef.current,
|
|
19686
19806
|
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)
|
|
19807
|
+
overscan: 10
|
|
19691
19808
|
});
|
|
19692
19809
|
const colVirtualizer = useVirtualizer({
|
|
19693
19810
|
count: visibleCols.length,
|
|
19694
|
-
estimateSize: (index) =>
|
|
19811
|
+
estimateSize: (index) => displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
19695
19812
|
getScrollElement: () => scrollRef.current,
|
|
19696
19813
|
getItemKey: (index) => visibleCols[index] ?? index,
|
|
19697
19814
|
horizontal: true,
|
|
19698
|
-
|
|
19699
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19700
|
-
overscan: 6,
|
|
19701
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19815
|
+
overscan: 6
|
|
19702
19816
|
});
|
|
19703
19817
|
const currentRowVirtualItems = rowVirtualizer.getVirtualItems();
|
|
19704
19818
|
const currentColVirtualItems = colVirtualizer.getVirtualItems();
|
|
@@ -19834,11 +19948,11 @@ function XlsxGrid({
|
|
|
19834
19948
|
React4.useEffect(() => {
|
|
19835
19949
|
visibleRowsRef.current = visibleRows;
|
|
19836
19950
|
visibleColsRef.current = visibleCols;
|
|
19837
|
-
effectiveRowHeightsRef.current =
|
|
19838
|
-
effectiveColWidthsRef.current =
|
|
19951
|
+
effectiveRowHeightsRef.current = displayEffectiveRowHeights;
|
|
19952
|
+
effectiveColWidthsRef.current = displayEffectiveColWidths;
|
|
19839
19953
|
rowPrefixSumsRef.current = rowPrefixSums;
|
|
19840
19954
|
colPrefixSumsRef.current = colPrefixSums;
|
|
19841
|
-
}, [colPrefixSums,
|
|
19955
|
+
}, [colPrefixSums, displayEffectiveColWidths, displayEffectiveRowHeights, rowPrefixSums, visibleCols, visibleRows]);
|
|
19842
19956
|
React4.useLayoutEffect(() => {
|
|
19843
19957
|
const scroller = scrollRef.current;
|
|
19844
19958
|
const previousZoomFactor = previousZoomFactorRef.current;
|
|
@@ -19963,13 +20077,13 @@ function XlsxGrid({
|
|
|
19963
20077
|
const currentScroller = event.currentTarget;
|
|
19964
20078
|
cachedScrollerRectRef.current = null;
|
|
19965
20079
|
syncDrawingViewport(currentScroller);
|
|
19966
|
-
if (
|
|
20080
|
+
if (currentScroller.scrollHeight - (currentScroller.scrollTop + currentScroller.clientHeight) < OPEN_GRID_VERTICAL_EDGE_PX) {
|
|
19967
20081
|
setDisplayRowLimit((current) => current + OPEN_GRID_ROW_GROWTH);
|
|
19968
20082
|
}
|
|
19969
|
-
if (
|
|
20083
|
+
if (currentScroller.scrollWidth - (currentScroller.scrollLeft + currentScroller.clientWidth) < OPEN_GRID_HORIZONTAL_EDGE_PX) {
|
|
19970
20084
|
setDisplayColLimit((current) => current + OPEN_GRID_COL_GROWTH);
|
|
19971
20085
|
}
|
|
19972
|
-
}, [syncDrawingViewport
|
|
20086
|
+
}, [syncDrawingViewport]);
|
|
19973
20087
|
React4.useEffect(() => {
|
|
19974
20088
|
if (!openTableMenu) {
|
|
19975
20089
|
return;
|
|
@@ -20008,24 +20122,24 @@ function XlsxGrid({
|
|
|
20008
20122
|
}
|
|
20009
20123
|
const pointerOffsetX = clientX - scrollerRect.left;
|
|
20010
20124
|
const pointerOffsetY = clientY - scrollerRect.top;
|
|
20011
|
-
const localX = pointerOffsetX
|
|
20012
|
-
const localY = pointerOffsetY
|
|
20013
|
-
const rowContentOffset = localY -
|
|
20014
|
-
const colContentOffset = localX -
|
|
20125
|
+
const localX = pointerOffsetX + (pointerOffsetX >= frozenPaneRight ? scroller.scrollLeft : 0);
|
|
20126
|
+
const localY = pointerOffsetY + (pointerOffsetY >= frozenPaneBottom ? scroller.scrollTop : 0);
|
|
20127
|
+
const rowContentOffset = localY - displayHeaderHeight;
|
|
20128
|
+
const colContentOffset = localX - displayRowHeaderWidth;
|
|
20015
20129
|
let geometryCell = null;
|
|
20016
|
-
if (localY >=
|
|
20130
|
+
if (localY >= displayHeaderHeight && localX < displayRowHeaderWidth) {
|
|
20017
20131
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20018
20132
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
20019
20133
|
if (actualRow !== void 0 && firstVisibleColRef.current !== void 0) {
|
|
20020
20134
|
geometryCell = { row: actualRow, col: firstVisibleColRef.current };
|
|
20021
20135
|
}
|
|
20022
|
-
} else if (localY <
|
|
20136
|
+
} else if (localY < displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20023
20137
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20024
20138
|
const actualCol = visibleColsCurrent[colIndex];
|
|
20025
20139
|
if (actualCol !== void 0 && firstVisibleRowRef.current !== void 0) {
|
|
20026
20140
|
geometryCell = { row: firstVisibleRowRef.current, col: actualCol };
|
|
20027
20141
|
}
|
|
20028
|
-
} else if (localY >=
|
|
20142
|
+
} else if (localY >= displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20029
20143
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20030
20144
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20031
20145
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
@@ -20035,7 +20149,7 @@ function XlsxGrid({
|
|
|
20035
20149
|
}
|
|
20036
20150
|
}
|
|
20037
20151
|
return geometryCell;
|
|
20038
|
-
}, [frozenPaneBottom, frozenPaneRight
|
|
20152
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, frozenPaneBottom, frozenPaneRight]);
|
|
20039
20153
|
const resolvePointerCellFromHitTest = React4.useCallback((clientX, clientY) => {
|
|
20040
20154
|
const elementsAtPoint = typeof document.elementsFromPoint === "function" ? document.elementsFromPoint(clientX, clientY) : [document.elementFromPoint(clientX, clientY)].filter((element) => Boolean(element));
|
|
20041
20155
|
for (const element of elementsAtPoint) {
|
|
@@ -20095,59 +20209,59 @@ function XlsxGrid({
|
|
|
20095
20209
|
if (rowIndex === void 0 || colIndex === void 0) {
|
|
20096
20210
|
return null;
|
|
20097
20211
|
}
|
|
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 /
|
|
20212
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20213
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20214
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20215
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20102
20216
|
return {
|
|
20103
20217
|
contentScaleX,
|
|
20104
20218
|
contentScaleY,
|
|
20105
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20106
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20219
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20220
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20107
20221
|
};
|
|
20108
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20222
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20109
20223
|
const resolveRowPointerOrigin = React4.useCallback((actualRow, rect, clientY) => {
|
|
20110
20224
|
const rowIndex = rowIndexByActual.get(actualRow);
|
|
20111
20225
|
if (rowIndex === void 0) {
|
|
20112
20226
|
return null;
|
|
20113
20227
|
}
|
|
20114
|
-
const
|
|
20115
|
-
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height /
|
|
20228
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20229
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20116
20230
|
return {
|
|
20117
|
-
contentScaleX:
|
|
20231
|
+
contentScaleX: 1,
|
|
20118
20232
|
contentScaleY,
|
|
20119
20233
|
originContentX: colPrefixSums[0] ?? 0,
|
|
20120
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20234
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20121
20235
|
};
|
|
20122
|
-
}, [colPrefixSums,
|
|
20236
|
+
}, [colPrefixSums, displayDefaultRowHeight, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20123
20237
|
const resolveColumnPointerOrigin = React4.useCallback((actualCol, rect, clientX) => {
|
|
20124
20238
|
const colIndex = colIndexByActual.get(actualCol);
|
|
20125
20239
|
if (colIndex === void 0) {
|
|
20126
20240
|
return null;
|
|
20127
20241
|
}
|
|
20128
|
-
const
|
|
20129
|
-
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width /
|
|
20242
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20243
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20130
20244
|
return {
|
|
20131
20245
|
contentScaleX,
|
|
20132
|
-
contentScaleY:
|
|
20133
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20246
|
+
contentScaleY: 1,
|
|
20247
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20134
20248
|
originContentY: rowPrefixSums[0] ?? 0
|
|
20135
20249
|
};
|
|
20136
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20250
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayEffectiveColWidths, rowPrefixSums]);
|
|
20137
20251
|
const applyColumnPreview = React4.useCallback((actualCol, widthPx) => {
|
|
20138
20252
|
const colElement = colElementRefs.current.get(actualCol);
|
|
20139
20253
|
if (colElement) {
|
|
20140
20254
|
colElement.style.width = widthPx === null ? "" : `${widthPx}px`;
|
|
20141
20255
|
}
|
|
20142
20256
|
const baseIndex = visibleCols.indexOf(actualCol);
|
|
20143
|
-
const baseWidth = baseIndex >= 0 ?
|
|
20257
|
+
const baseWidth = baseIndex >= 0 ? displayEffectiveColWidths[baseIndex] ?? displayDefaultColWidth : displayDefaultColWidth;
|
|
20144
20258
|
const previewWidth = widthPx ?? baseWidth;
|
|
20145
|
-
const baseTotalWidth =
|
|
20259
|
+
const baseTotalWidth = displayEffectiveColWidths.reduce((sum, width) => sum + width, 0) + displayRowHeaderWidth;
|
|
20146
20260
|
const widthDelta = previewWidth - baseWidth;
|
|
20147
20261
|
if (tableRef.current) {
|
|
20148
20262
|
tableRef.current.style.width = `${baseTotalWidth + widthDelta}px`;
|
|
20149
20263
|
}
|
|
20150
|
-
}, [
|
|
20264
|
+
}, [displayDefaultColWidth, displayEffectiveColWidths, displayRowHeaderWidth, visibleCols]);
|
|
20151
20265
|
const applyRowPreview = React4.useCallback((actualRow, heightPx) => {
|
|
20152
20266
|
const rowElement = rowElementRefs.current.get(actualRow) ?? wrapperRef.current?.querySelector(`tr[data-xlsx-row="${actualRow}"]`) ?? null;
|
|
20153
20267
|
if (rowElement) {
|
|
@@ -20324,7 +20438,7 @@ function XlsxGrid({
|
|
|
20324
20438
|
const viewportRowBatch = getRowsBatchAsync ? asyncViewportRowBatch : syncViewportRowBatch;
|
|
20325
20439
|
React4.useEffect(() => {
|
|
20326
20440
|
cellRenderCacheRef.current.clear();
|
|
20327
|
-
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet]);
|
|
20441
|
+
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet, zoomFactor]);
|
|
20328
20442
|
React4.useEffect(() => {
|
|
20329
20443
|
setAsyncViewportRowBatch(null);
|
|
20330
20444
|
}, [activeSheetIndex, revision]);
|
|
@@ -20346,7 +20460,7 @@ function XlsxGrid({
|
|
|
20346
20460
|
if (!worksheet && !batchedCell) {
|
|
20347
20461
|
const emptyData = {
|
|
20348
20462
|
isMergedSecondary: false,
|
|
20349
|
-
style: {
|
|
20463
|
+
style: scaleCssProperties({
|
|
20350
20464
|
backgroundColor: resolveSheetSurface(activeSheet, palette),
|
|
20351
20465
|
borderBottom: "none",
|
|
20352
20466
|
borderRight: "none",
|
|
@@ -20354,7 +20468,7 @@ function XlsxGrid({
|
|
|
20354
20468
|
padding: DEFAULT_CELL_PADDING,
|
|
20355
20469
|
verticalAlign: "bottom",
|
|
20356
20470
|
whiteSpace: "nowrap"
|
|
20357
|
-
},
|
|
20471
|
+
}, zoomFactor),
|
|
20358
20472
|
value: ""
|
|
20359
20473
|
};
|
|
20360
20474
|
cellRenderCacheRef.current.set(cacheKey, emptyData);
|
|
@@ -20433,9 +20547,9 @@ function XlsxGrid({
|
|
|
20433
20547
|
isTableHeader: Boolean(table && row >= table.start.row && row < table.start.row + headerRowCount),
|
|
20434
20548
|
rowSpan: merge?.rowSpan,
|
|
20435
20549
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
20436
|
-
style: buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20550
|
+
style: scaleCssProperties(buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20437
20551
|
showGridLines: activeSheet?.showGridLines
|
|
20438
|
-
}),
|
|
20552
|
+
}), zoomFactor),
|
|
20439
20553
|
validation: resolveCellDataValidation(row, col, activeSheet),
|
|
20440
20554
|
value: sparkline ? "" : checkboxState !== null ? "" : batchCoversRow || !worksheet ? batchedCell?.value ?? "" : getCellDisplayValue(worksheet, row, col, activeSheet)
|
|
20441
20555
|
};
|
|
@@ -20445,7 +20559,7 @@ function XlsxGrid({
|
|
|
20445
20559
|
const horizontalPadding = getHorizontalPadding(nextData.style.padding);
|
|
20446
20560
|
const textWidth = measureTextWidth(nextData.value, nextData.style);
|
|
20447
20561
|
const requiredWidth = textWidth + horizontalPadding + 2;
|
|
20448
|
-
let availableWidth =
|
|
20562
|
+
let availableWidth = displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth;
|
|
20449
20563
|
if (requiredWidth > availableWidth) {
|
|
20450
20564
|
for (let nextColIndex = startColIndex + 1; nextColIndex < visibleCols.length; nextColIndex += 1) {
|
|
20451
20565
|
const nextActualCol = visibleCols[nextColIndex];
|
|
@@ -20456,12 +20570,12 @@ function XlsxGrid({
|
|
|
20456
20570
|
if (!canReceiveOverflowText(neighborData)) {
|
|
20457
20571
|
break;
|
|
20458
20572
|
}
|
|
20459
|
-
availableWidth +=
|
|
20573
|
+
availableWidth += displayEffectiveColWidths[nextColIndex] ?? displayDefaultColWidth;
|
|
20460
20574
|
if (requiredWidth <= availableWidth) {
|
|
20461
20575
|
break;
|
|
20462
20576
|
}
|
|
20463
20577
|
}
|
|
20464
|
-
if (availableWidth > (
|
|
20578
|
+
if (availableWidth > (displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth)) {
|
|
20465
20579
|
nextData.spillWidth = Math.max(0, availableWidth - horizontalPadding);
|
|
20466
20580
|
}
|
|
20467
20581
|
}
|
|
@@ -20469,7 +20583,7 @@ function XlsxGrid({
|
|
|
20469
20583
|
}
|
|
20470
20584
|
cellRenderCacheRef.current.set(cacheKey, nextData);
|
|
20471
20585
|
return nextData;
|
|
20472
|
-
}, [activeSheet, colIndexByActual,
|
|
20586
|
+
}, [activeSheet, colIndexByActual, displayDefaultColWidth, displayEffectiveColWidths, effectiveTables, palette, sparklinesByCell, viewportRowBatch, visibleCols, worksheet, zoomFactor]);
|
|
20473
20587
|
React4.useEffect(() => {
|
|
20474
20588
|
conditionalFormatMetricsCacheRef.current.clear();
|
|
20475
20589
|
}, [activeSheet?.conditionalFormatRules, activeSheet?.workbookSheetIndex, revision]);
|
|
@@ -20487,11 +20601,11 @@ function XlsxGrid({
|
|
|
20487
20601
|
}
|
|
20488
20602
|
return {
|
|
20489
20603
|
height: sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex),
|
|
20490
|
-
left:
|
|
20491
|
-
top:
|
|
20604
|
+
left: displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1),
|
|
20605
|
+
top: displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1),
|
|
20492
20606
|
width: sumPrefixRange(colPrefixSums, startColIndex, endColIndex)
|
|
20493
20607
|
};
|
|
20494
|
-
}, [colIndexByActual, colPrefixSums, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20608
|
+
}, [colIndexByActual, colPrefixSums, displayHeaderHeight, displayRowHeaderWidth, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20495
20609
|
const resolvedSelectionOverlay = selectionOverlay;
|
|
20496
20610
|
const virtualCols = React4.useMemo(
|
|
20497
20611
|
() => shouldVirtualizeCols ? colVirtualizer.getVirtualItems().map((virtualCol) => ({
|
|
@@ -20504,10 +20618,10 @@ function XlsxGrid({
|
|
|
20504
20618
|
end: colPrefixSums[index + 1] ?? 0,
|
|
20505
20619
|
index,
|
|
20506
20620
|
key: visibleCols[index] ?? index,
|
|
20507
|
-
size:
|
|
20621
|
+
size: displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
20508
20622
|
start: colPrefixSums[index] ?? 0
|
|
20509
20623
|
})),
|
|
20510
|
-
[colPrefixSums, colVirtualizer,
|
|
20624
|
+
[colPrefixSums, colVirtualizer, displayDefaultColWidth, displayEffectiveColWidths, shouldVirtualizeCols, visibleCols]
|
|
20511
20625
|
);
|
|
20512
20626
|
const renderedCols = React4.useMemo(
|
|
20513
20627
|
() => {
|
|
@@ -20526,7 +20640,7 @@ function XlsxGrid({
|
|
|
20526
20640
|
});
|
|
20527
20641
|
return columns;
|
|
20528
20642
|
},
|
|
20529
|
-
[
|
|
20643
|
+
[virtualCols, visibleCols]
|
|
20530
20644
|
);
|
|
20531
20645
|
const totalContentWidth = colPrefixSums[colPrefixSums.length - 1] ?? 0;
|
|
20532
20646
|
const leadingColumnSpacerWidth = shouldVirtualizeCols ? virtualCols[0]?.start ?? 0 : 0;
|
|
@@ -20534,12 +20648,14 @@ function XlsxGrid({
|
|
|
20534
20648
|
const imageRects = React4.useMemo(
|
|
20535
20649
|
() => showImages ? images.map((image) => ({
|
|
20536
20650
|
image,
|
|
20537
|
-
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols,
|
|
20651
|
+
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20538
20652
|
actualColPrefixSums,
|
|
20539
20653
|
actualRowPrefixSums,
|
|
20540
20654
|
colIndexByActual,
|
|
20541
20655
|
colPrefixSums,
|
|
20656
|
+
headerHeight: displayHeaderHeight,
|
|
20542
20657
|
rowIndexByActual,
|
|
20658
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20543
20659
|
rowPrefixSums
|
|
20544
20660
|
})
|
|
20545
20661
|
})) : [],
|
|
@@ -20548,8 +20664,10 @@ function XlsxGrid({
|
|
|
20548
20664
|
colPrefixSums,
|
|
20549
20665
|
actualColPrefixSums,
|
|
20550
20666
|
actualRowPrefixSums,
|
|
20551
|
-
|
|
20552
|
-
|
|
20667
|
+
displayHeaderHeight,
|
|
20668
|
+
displayEffectiveColWidths,
|
|
20669
|
+
displayEffectiveRowHeights,
|
|
20670
|
+
displayRowHeaderWidth,
|
|
20553
20671
|
imagePreviewRect,
|
|
20554
20672
|
images,
|
|
20555
20673
|
rowIndexByActual,
|
|
@@ -20561,12 +20679,14 @@ function XlsxGrid({
|
|
|
20561
20679
|
);
|
|
20562
20680
|
const shapeRects = React4.useMemo(
|
|
20563
20681
|
() => showImages ? shapes.map((shape) => ({
|
|
20564
|
-
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols,
|
|
20682
|
+
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20565
20683
|
actualColPrefixSums,
|
|
20566
20684
|
actualRowPrefixSums,
|
|
20567
20685
|
colIndexByActual,
|
|
20568
20686
|
colPrefixSums,
|
|
20687
|
+
headerHeight: displayHeaderHeight,
|
|
20569
20688
|
rowIndexByActual,
|
|
20689
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20570
20690
|
rowPrefixSums
|
|
20571
20691
|
}),
|
|
20572
20692
|
shape
|
|
@@ -20576,8 +20696,10 @@ function XlsxGrid({
|
|
|
20576
20696
|
colPrefixSums,
|
|
20577
20697
|
actualColPrefixSums,
|
|
20578
20698
|
actualRowPrefixSums,
|
|
20579
|
-
|
|
20580
|
-
|
|
20699
|
+
displayHeaderHeight,
|
|
20700
|
+
displayEffectiveColWidths,
|
|
20701
|
+
displayEffectiveRowHeights,
|
|
20702
|
+
displayRowHeaderWidth,
|
|
20581
20703
|
rowIndexByActual,
|
|
20582
20704
|
rowPrefixSums,
|
|
20583
20705
|
shapes,
|
|
@@ -20589,12 +20711,14 @@ function XlsxGrid({
|
|
|
20589
20711
|
const chartRects = React4.useMemo(
|
|
20590
20712
|
() => showImages ? charts.map((chart) => ({
|
|
20591
20713
|
chart,
|
|
20592
|
-
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols,
|
|
20714
|
+
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20593
20715
|
actualColPrefixSums,
|
|
20594
20716
|
actualRowPrefixSums,
|
|
20595
20717
|
colIndexByActual,
|
|
20596
20718
|
colPrefixSums,
|
|
20719
|
+
headerHeight: displayHeaderHeight,
|
|
20597
20720
|
rowIndexByActual,
|
|
20721
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20598
20722
|
rowPrefixSums
|
|
20599
20723
|
})
|
|
20600
20724
|
})) : [],
|
|
@@ -20605,8 +20729,10 @@ function XlsxGrid({
|
|
|
20605
20729
|
charts,
|
|
20606
20730
|
colIndexByActual,
|
|
20607
20731
|
colPrefixSums,
|
|
20608
|
-
|
|
20609
|
-
|
|
20732
|
+
displayHeaderHeight,
|
|
20733
|
+
displayEffectiveColWidths,
|
|
20734
|
+
displayEffectiveRowHeights,
|
|
20735
|
+
displayRowHeaderWidth,
|
|
20610
20736
|
rowIndexByActual,
|
|
20611
20737
|
rowPrefixSums,
|
|
20612
20738
|
showImages,
|
|
@@ -20652,15 +20778,15 @@ function XlsxGrid({
|
|
|
20652
20778
|
if (startRowIndex === void 0 || endRowIndex === void 0 || startColIndex === void 0 || endColIndex === void 0) {
|
|
20653
20779
|
return null;
|
|
20654
20780
|
}
|
|
20655
|
-
let left =
|
|
20656
|
-
let top =
|
|
20781
|
+
let left = displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1);
|
|
20782
|
+
let top = displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1);
|
|
20657
20783
|
let width = sumPrefixRange(colPrefixSums, startColIndex, endColIndex);
|
|
20658
20784
|
let height = sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex);
|
|
20659
20785
|
const columnPreview = columnPreviewRef.current;
|
|
20660
20786
|
if (columnPreview) {
|
|
20661
20787
|
const previewIndex = colIndexByActual.get(columnPreview.actualIndex);
|
|
20662
20788
|
if (previewIndex !== void 0) {
|
|
20663
|
-
const baseWidth =
|
|
20789
|
+
const baseWidth = displayEffectiveColWidths[previewIndex] ?? displayDefaultColWidth;
|
|
20664
20790
|
const widthDelta = columnPreview.size - baseWidth;
|
|
20665
20791
|
if (previewIndex < startColIndex) {
|
|
20666
20792
|
left += widthDelta;
|
|
@@ -20674,7 +20800,7 @@ function XlsxGrid({
|
|
|
20674
20800
|
if (rowPreview) {
|
|
20675
20801
|
const previewIndex = rowIndexByActual.get(rowPreview.actualIndex);
|
|
20676
20802
|
if (previewIndex !== void 0) {
|
|
20677
|
-
const baseHeight =
|
|
20803
|
+
const baseHeight = displayEffectiveRowHeights[previewIndex] ?? displayDefaultRowHeight;
|
|
20678
20804
|
const heightDelta = rowPreview.size - baseHeight;
|
|
20679
20805
|
if (previewIndex < startRowIndex) {
|
|
20680
20806
|
top += heightDelta;
|
|
@@ -20686,11 +20812,11 @@ function XlsxGrid({
|
|
|
20686
20812
|
}
|
|
20687
20813
|
return {
|
|
20688
20814
|
height: Math.max(0, height),
|
|
20689
|
-
left: Math.max(
|
|
20690
|
-
top: Math.max(
|
|
20815
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20816
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20691
20817
|
width: Math.max(0, width)
|
|
20692
20818
|
};
|
|
20693
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20819
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, displayHeaderHeight, displayRowHeaderWidth, rowIndexByActual, rowPrefixSums]);
|
|
20694
20820
|
const resolveMountedRangeOverlayRect = React4.useCallback((range, geometryRect) => {
|
|
20695
20821
|
const normalized = normalizeRange2(range);
|
|
20696
20822
|
const startRect = resolveMountedCellOverlayRectForAddress(normalized.start);
|
|
@@ -20707,11 +20833,11 @@ function XlsxGrid({
|
|
|
20707
20833
|
const bottom = bottomRect ? bottomRect.top + bottomRect.height : geometryRect.top + geometryRect.height;
|
|
20708
20834
|
return {
|
|
20709
20835
|
height: Math.max(0, bottom - top),
|
|
20710
|
-
left: Math.max(
|
|
20711
|
-
top: Math.max(
|
|
20836
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20837
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20712
20838
|
width: Math.max(0, right - left)
|
|
20713
20839
|
};
|
|
20714
|
-
}, [resolveMountedCellOverlayRectForAddress]);
|
|
20840
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, resolveMountedCellOverlayRectForAddress]);
|
|
20715
20841
|
const resolveDragPreviewRect = React4.useCallback((range) => {
|
|
20716
20842
|
const dragState = selectionDragRef.current;
|
|
20717
20843
|
if (!dragState || !dragState.didDrag || dragState.axis !== "cell" || !dragState.originOverlayRect) {
|
|
@@ -20829,11 +20955,11 @@ function XlsxGrid({
|
|
|
20829
20955
|
overlay.style.visibility = "visible";
|
|
20830
20956
|
const fillHandle = fillHandleRef.current;
|
|
20831
20957
|
if (fillHandle) {
|
|
20832
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20833
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
20958
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
20959
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20834
20960
|
}
|
|
20835
20961
|
applyHeaderSelection(range);
|
|
20836
|
-
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect]);
|
|
20962
|
+
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20837
20963
|
const applyPreviewOverlayFromElement = React4.useCallback((element, range) => {
|
|
20838
20964
|
const overlay = selectionOverlayRef.current;
|
|
20839
20965
|
if (!overlay) {
|
|
@@ -20852,11 +20978,11 @@ function XlsxGrid({
|
|
|
20852
20978
|
overlay.style.visibility = "visible";
|
|
20853
20979
|
const fillHandle = fillHandleRef.current;
|
|
20854
20980
|
if (fillHandle) {
|
|
20855
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20856
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
20981
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
20982
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20857
20983
|
}
|
|
20858
20984
|
applyHeaderSelection(range);
|
|
20859
|
-
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect]);
|
|
20985
|
+
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20860
20986
|
const syncActiveValidationOverlay = React4.useCallback((cell) => {
|
|
20861
20987
|
const overlay = activeValidationOverlayRef.current;
|
|
20862
20988
|
if (!overlay || !cell || editingCellRef.current || selectionDragRef.current || fillDragRef.current) {
|
|
@@ -20874,11 +21000,11 @@ function XlsxGrid({
|
|
|
20874
21000
|
overlay.style.visibility = "hidden";
|
|
20875
21001
|
return;
|
|
20876
21002
|
}
|
|
20877
|
-
overlay.style.left = `${rect.left + rect.width - 16}px`;
|
|
21003
|
+
overlay.style.left = `${rect.left + rect.width - 16 * zoomFactor}px`;
|
|
20878
21004
|
overlay.style.top = `${rect.top + rect.height / 2}px`;
|
|
20879
21005
|
overlay.style.opacity = "1";
|
|
20880
21006
|
overlay.style.visibility = "visible";
|
|
20881
|
-
}, [getCellData, resolveOverlayRect]);
|
|
21007
|
+
}, [getCellData, resolveOverlayRect, zoomFactor]);
|
|
20882
21008
|
const commitSelectionRange = React4.useCallback((range) => {
|
|
20883
21009
|
const normalized = normalizeRange2(range);
|
|
20884
21010
|
if (selectionRef.current && rangesEqual(selectionRef.current, normalized) && isSameCell(activeCellRef.current, normalized.end) && selectedChartIdRef.current === null && selectedImageIdRef.current === null) {
|
|
@@ -20916,7 +21042,7 @@ function XlsxGrid({
|
|
|
20916
21042
|
}
|
|
20917
21043
|
pendingResizePreviewRef.current = {
|
|
20918
21044
|
actualIndex: state.actualIndex,
|
|
20919
|
-
size: state.type === "column" ? Math.max(
|
|
21045
|
+
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
21046
|
type: state.type
|
|
20921
21047
|
};
|
|
20922
21048
|
if (resizeFrameRef.current !== null) {
|
|
@@ -20963,9 +21089,9 @@ function XlsxGrid({
|
|
|
20963
21089
|
}
|
|
20964
21090
|
if (preview && preview.actualIndex === resizeState.actualIndex && preview.type === resizeState.type) {
|
|
20965
21091
|
if (preview.type === "column") {
|
|
20966
|
-
controller.resizeColumn(preview.actualIndex, preview.size);
|
|
21092
|
+
controller.resizeColumn(preview.actualIndex, preview.size / zoomFactor);
|
|
20967
21093
|
} else {
|
|
20968
|
-
controller.resizeRow(preview.actualIndex, preview.size);
|
|
21094
|
+
controller.resizeRow(preview.actualIndex, preview.size / zoomFactor);
|
|
20969
21095
|
}
|
|
20970
21096
|
}
|
|
20971
21097
|
}
|
|
@@ -20982,7 +21108,7 @@ function XlsxGrid({
|
|
|
20982
21108
|
resizeFrameRef.current = null;
|
|
20983
21109
|
}
|
|
20984
21110
|
};
|
|
20985
|
-
}, [applyColumnPreview, applyRowPreview, controller, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21111
|
+
}, [applyColumnPreview, applyRowPreview, controller, displayDefaultColWidth, displayDefaultRowHeight, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
20986
21112
|
function buildDraggedSelectionRange(dragState, cell) {
|
|
20987
21113
|
if (dragState.axis === "row") {
|
|
20988
21114
|
if (firstVisibleCol === void 0 || lastVisibleCol === void 0) {
|
|
@@ -21311,21 +21437,21 @@ function XlsxGrid({
|
|
|
21311
21437
|
color: palette.mutedText,
|
|
21312
21438
|
cursor: "pointer",
|
|
21313
21439
|
display: "inline-flex",
|
|
21314
|
-
fontSize: 10,
|
|
21315
|
-
height: 16,
|
|
21440
|
+
fontSize: 10 * zoomFactor,
|
|
21441
|
+
height: 16 * zoomFactor,
|
|
21316
21442
|
justifyContent: "center",
|
|
21317
21443
|
padding: 0,
|
|
21318
21444
|
position: "absolute",
|
|
21319
|
-
right: 4,
|
|
21320
|
-
top: 3,
|
|
21321
|
-
width: 16,
|
|
21445
|
+
right: 4 * zoomFactor,
|
|
21446
|
+
top: 3 * zoomFactor,
|
|
21447
|
+
width: 16 * zoomFactor,
|
|
21322
21448
|
zIndex: 6
|
|
21323
21449
|
},
|
|
21324
21450
|
type: "button",
|
|
21325
21451
|
children: direction === "ascending" ? "\u25B2" : direction === "descending" ? "\u25BC" : "\u25BE"
|
|
21326
21452
|
}
|
|
21327
21453
|
);
|
|
21328
|
-
}, [effectiveTables, palette.mutedText, sortState]);
|
|
21454
|
+
}, [effectiveTables, palette.mutedText, sortState, zoomFactor]);
|
|
21329
21455
|
const startChartMove = React4.useCallback((event, chart, rect) => {
|
|
21330
21456
|
if (event.button !== 0) {
|
|
21331
21457
|
return;
|
|
@@ -21531,7 +21657,7 @@ function XlsxGrid({
|
|
|
21531
21657
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21532
21658
|
index,
|
|
21533
21659
|
key: actualRow,
|
|
21534
|
-
size:
|
|
21660
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21535
21661
|
start: rowPrefixSums[index] ?? 0
|
|
21536
21662
|
})) : (() => {
|
|
21537
21663
|
const renderedRowsByIndex = /* @__PURE__ */ new Map();
|
|
@@ -21552,27 +21678,25 @@ function XlsxGrid({
|
|
|
21552
21678
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21553
21679
|
index,
|
|
21554
21680
|
key: visibleRows[index] ?? index,
|
|
21555
|
-
size:
|
|
21681
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21556
21682
|
start: rowPrefixSums[index] ?? 0
|
|
21557
21683
|
});
|
|
21558
21684
|
});
|
|
21559
21685
|
return Array.from(renderedRowsByIndex.values()).sort((left, right) => left.index - right.index);
|
|
21560
21686
|
})();
|
|
21561
21687
|
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;
|
|
21688
|
+
const totalWidth = totalContentWidth + displayRowHeaderWidth;
|
|
21689
|
+
const sheetContentHeight = displayHeaderHeight + totalHeight;
|
|
21566
21690
|
const { fill: selectionFill, header: selectionHeaderSurface, stroke: selectionStroke } = resolveSelectionColors({
|
|
21567
21691
|
palette,
|
|
21568
21692
|
selectionColor,
|
|
21569
21693
|
selectionFillColor,
|
|
21570
21694
|
selectionHeaderColor
|
|
21571
21695
|
});
|
|
21572
|
-
const selectionBorderWidth = 1;
|
|
21696
|
+
const selectionBorderWidth = Math.max(1, zoomFactor);
|
|
21573
21697
|
const rowColSpan = renderedCols.length + 1 + (leadingColumnSpacerWidth > 0 ? 1 : 0) + (trailingColumnSpacerWidth > 0 ? 1 : 0);
|
|
21574
21698
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
21575
|
-
const headerCellStyle = {
|
|
21699
|
+
const headerCellStyle = scaleCssProperties({
|
|
21576
21700
|
backgroundColor: palette.headerSurface,
|
|
21577
21701
|
borderBottom: "none",
|
|
21578
21702
|
borderRight: "none",
|
|
@@ -21589,8 +21713,8 @@ function XlsxGrid({
|
|
|
21589
21713
|
userSelect: "none",
|
|
21590
21714
|
whiteSpace: "nowrap",
|
|
21591
21715
|
zIndex: 50
|
|
21592
|
-
};
|
|
21593
|
-
const columnResizeHandleStyle = {
|
|
21716
|
+
}, zoomFactor);
|
|
21717
|
+
const columnResizeHandleStyle = scaleCssProperties({
|
|
21594
21718
|
backgroundColor: "transparent",
|
|
21595
21719
|
cursor: "col-resize",
|
|
21596
21720
|
position: "absolute",
|
|
@@ -21599,17 +21723,23 @@ function XlsxGrid({
|
|
|
21599
21723
|
width: 16,
|
|
21600
21724
|
height: "100%",
|
|
21601
21725
|
zIndex: 5
|
|
21602
|
-
};
|
|
21726
|
+
}, zoomFactor);
|
|
21603
21727
|
function resolveDrawingPane(rect) {
|
|
21604
21728
|
return resolveFrozenDrawingPane(
|
|
21605
21729
|
rect,
|
|
21606
21730
|
frozenRows,
|
|
21607
21731
|
frozenCols,
|
|
21608
|
-
|
|
21609
|
-
|
|
21732
|
+
displayActualRowHeights,
|
|
21733
|
+
displayActualColWidths,
|
|
21610
21734
|
activeSheet?.freezePanes ?? null,
|
|
21611
21735
|
stickyTopByRow,
|
|
21612
|
-
stickyLeftByCol
|
|
21736
|
+
stickyLeftByCol,
|
|
21737
|
+
{
|
|
21738
|
+
defaultColWidth: displayDefaultColWidth,
|
|
21739
|
+
defaultRowHeight: displayDefaultRowHeight,
|
|
21740
|
+
headerHeight: displayHeaderHeight,
|
|
21741
|
+
rowHeaderWidth: displayRowHeaderWidth
|
|
21742
|
+
}
|
|
21613
21743
|
);
|
|
21614
21744
|
}
|
|
21615
21745
|
function renderShapeDrawing(shape, rect, pane) {
|
|
@@ -21626,12 +21756,12 @@ function XlsxGrid({
|
|
|
21626
21756
|
const groupScaleX = shape.scaleX ?? 1;
|
|
21627
21757
|
const groupScaleY = shape.scaleY ?? 1;
|
|
21628
21758
|
const strokeScale = Math.max(groupScaleX, groupScaleY);
|
|
21629
|
-
const textScale = strokeScale;
|
|
21759
|
+
const textScale = strokeScale * zoomFactor;
|
|
21630
21760
|
const textWidth = groupScaleX !== 0 ? rect.width / groupScaleX : rect.width;
|
|
21631
21761
|
const textHeight = groupScaleY !== 0 ? rect.height / groupScaleY : rect.height;
|
|
21632
21762
|
const vectorShape = resolveShapeVector(shape);
|
|
21633
21763
|
const strokeColor = shape.stroke?.none ? "transparent" : shape.stroke?.color ?? "transparent";
|
|
21634
|
-
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale;
|
|
21764
|
+
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale * zoomFactor;
|
|
21635
21765
|
const headMarkerId = `${shape.id}-${pane}-head-marker`;
|
|
21636
21766
|
const tailMarkerId = `${shape.id}-${pane}-tail-marker`;
|
|
21637
21767
|
const headMarker = vectorShape ? resolveShapeLineEndMarker(
|
|
@@ -21651,7 +21781,7 @@ function XlsxGrid({
|
|
|
21651
21781
|
vectorShape.viewBox
|
|
21652
21782
|
) : null;
|
|
21653
21783
|
const style = {
|
|
21654
|
-
...buildShapeContainerStyle(shape, rect),
|
|
21784
|
+
...buildShapeContainerStyle(shape, rect, zoomFactor),
|
|
21655
21785
|
...vectorShape ? {
|
|
21656
21786
|
backgroundColor: "transparent",
|
|
21657
21787
|
border: "none"
|
|
@@ -21714,13 +21844,13 @@ function XlsxGrid({
|
|
|
21714
21844
|
display: "flex",
|
|
21715
21845
|
flex: 1,
|
|
21716
21846
|
flexDirection: "column",
|
|
21717
|
-
gap: 2,
|
|
21847
|
+
gap: 2 * zoomFactor,
|
|
21718
21848
|
height: textHeight,
|
|
21719
21849
|
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,
|
|
21850
|
+
paddingBottom: (inset?.bottom ?? 4) * zoomFactor,
|
|
21851
|
+
paddingLeft: (inset?.left ?? 6) * zoomFactor,
|
|
21852
|
+
paddingRight: (inset?.right ?? 6) * zoomFactor,
|
|
21853
|
+
paddingTop: (inset?.top ?? 4) * zoomFactor,
|
|
21724
21854
|
pointerEvents: "none",
|
|
21725
21855
|
position: "relative",
|
|
21726
21856
|
transform: groupScaleX !== 1 || groupScaleY !== 1 ? `scale(${groupScaleX}, ${groupScaleY})` : void 0,
|
|
@@ -21792,8 +21922,8 @@ function XlsxGrid({
|
|
|
21792
21922
|
"div",
|
|
21793
21923
|
{
|
|
21794
21924
|
style: {
|
|
21795
|
-
border:
|
|
21796
|
-
boxShadow: `0 0 0
|
|
21925
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
21926
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21797
21927
|
boxSizing: "border-box",
|
|
21798
21928
|
inset: 0,
|
|
21799
21929
|
pointerEvents: "none",
|
|
@@ -21803,7 +21933,7 @@ function XlsxGrid({
|
|
|
21803
21933
|
"div",
|
|
21804
21934
|
{
|
|
21805
21935
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21806
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21936
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21807
21937
|
},
|
|
21808
21938
|
position
|
|
21809
21939
|
)) : null
|
|
@@ -21815,7 +21945,7 @@ function XlsxGrid({
|
|
|
21815
21945
|
startImageResize(event, image, rect, position);
|
|
21816
21946
|
}
|
|
21817
21947
|
},
|
|
21818
|
-
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface), display: "none" }
|
|
21948
|
+
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor), display: "none" }
|
|
21819
21949
|
}),
|
|
21820
21950
|
image,
|
|
21821
21951
|
rect
|
|
@@ -21823,8 +21953,8 @@ function XlsxGrid({
|
|
|
21823
21953
|
"div",
|
|
21824
21954
|
{
|
|
21825
21955
|
style: {
|
|
21826
|
-
border:
|
|
21827
|
-
boxShadow: `0 0 0
|
|
21956
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
21957
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21828
21958
|
boxSizing: "border-box",
|
|
21829
21959
|
inset: 0,
|
|
21830
21960
|
pointerEvents: "none",
|
|
@@ -21834,7 +21964,7 @@ function XlsxGrid({
|
|
|
21834
21964
|
"div",
|
|
21835
21965
|
{
|
|
21836
21966
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21837
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21967
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21838
21968
|
},
|
|
21839
21969
|
position
|
|
21840
21970
|
)) : null
|
|
@@ -21896,8 +22026,8 @@ function XlsxGrid({
|
|
|
21896
22026
|
"div",
|
|
21897
22027
|
{
|
|
21898
22028
|
style: {
|
|
21899
|
-
border:
|
|
21900
|
-
boxShadow: `0 0 0
|
|
22029
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
22030
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21901
22031
|
boxSizing: "border-box",
|
|
21902
22032
|
inset: 0,
|
|
21903
22033
|
pointerEvents: "none",
|
|
@@ -21907,7 +22037,7 @@ function XlsxGrid({
|
|
|
21907
22037
|
"div",
|
|
21908
22038
|
{
|
|
21909
22039
|
onPointerDown: (event) => startChartResize(event, chart, rect, position),
|
|
21910
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
22040
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21911
22041
|
},
|
|
21912
22042
|
position
|
|
21913
22043
|
)) : null
|
|
@@ -22143,8 +22273,8 @@ function XlsxGrid({
|
|
|
22143
22273
|
if (!interaction) {
|
|
22144
22274
|
return;
|
|
22145
22275
|
}
|
|
22146
|
-
const deltaX =
|
|
22147
|
-
const deltaY =
|
|
22276
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22277
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22148
22278
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22149
22279
|
interaction.didMove = true;
|
|
22150
22280
|
}
|
|
@@ -22153,7 +22283,12 @@ function XlsxGrid({
|
|
|
22153
22283
|
...interaction.baseRect,
|
|
22154
22284
|
left: interaction.baseRect.left + deltaX,
|
|
22155
22285
|
top: interaction.baseRect.top + deltaY
|
|
22156
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY,
|
|
22286
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, displayImageMinSize),
|
|
22287
|
+
{
|
|
22288
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22289
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22290
|
+
minSizePx: displayImageMinSize
|
|
22291
|
+
}
|
|
22157
22292
|
);
|
|
22158
22293
|
scheduleImagePreviewRect({ id: interaction.imageId, rect: nextRect });
|
|
22159
22294
|
};
|
|
@@ -22188,7 +22323,7 @@ function XlsxGrid({
|
|
|
22188
22323
|
if (interaction.didMove) {
|
|
22189
22324
|
skipNextImageClickRef.current = interaction.imageId;
|
|
22190
22325
|
}
|
|
22191
|
-
setImageRect(interaction.imageId, preview.rect);
|
|
22326
|
+
setImageRect(interaction.imageId, toLogicalRect(preview.rect));
|
|
22192
22327
|
}
|
|
22193
22328
|
imagePreviewRectRef.current = null;
|
|
22194
22329
|
setImagePreviewRect(null);
|
|
@@ -22208,8 +22343,8 @@ function XlsxGrid({
|
|
|
22208
22343
|
if (!interaction) {
|
|
22209
22344
|
return;
|
|
22210
22345
|
}
|
|
22211
|
-
const deltaX =
|
|
22212
|
-
const deltaY =
|
|
22346
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22347
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22213
22348
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22214
22349
|
interaction.didMove = true;
|
|
22215
22350
|
}
|
|
@@ -22218,7 +22353,12 @@ function XlsxGrid({
|
|
|
22218
22353
|
...interaction.baseRect,
|
|
22219
22354
|
left: interaction.baseRect.left + deltaX,
|
|
22220
22355
|
top: interaction.baseRect.top + deltaY
|
|
22221
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48)
|
|
22356
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48 * zoomFactor),
|
|
22357
|
+
{
|
|
22358
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22359
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22360
|
+
minSizePx: 48 * zoomFactor
|
|
22361
|
+
}
|
|
22222
22362
|
);
|
|
22223
22363
|
scheduleChartPreviewRect({ id: interaction.chartId, rect: nextRect });
|
|
22224
22364
|
};
|
|
@@ -22253,7 +22393,7 @@ function XlsxGrid({
|
|
|
22253
22393
|
if (interaction.didMove) {
|
|
22254
22394
|
skipNextChartClickRef.current = interaction.chartId;
|
|
22255
22395
|
}
|
|
22256
|
-
setChartRect(interaction.chartId, preview.rect);
|
|
22396
|
+
setChartRect(interaction.chartId, toLogicalRect(preview.rect));
|
|
22257
22397
|
}
|
|
22258
22398
|
chartPreviewRectRef.current = null;
|
|
22259
22399
|
setChartPreviewRect(null);
|
|
@@ -22435,8 +22575,8 @@ function XlsxGrid({
|
|
|
22435
22575
|
minHeight: "100%",
|
|
22436
22576
|
minWidth: "100%",
|
|
22437
22577
|
position: "relative",
|
|
22438
|
-
width:
|
|
22439
|
-
height:
|
|
22578
|
+
width: totalWidth,
|
|
22579
|
+
height: sheetContentHeight
|
|
22440
22580
|
},
|
|
22441
22581
|
children: /* @__PURE__ */ jsxs3(
|
|
22442
22582
|
"div",
|
|
@@ -22447,9 +22587,6 @@ function XlsxGrid({
|
|
|
22447
22587
|
left: 0,
|
|
22448
22588
|
position: "absolute",
|
|
22449
22589
|
top: 0,
|
|
22450
|
-
transform: void 0,
|
|
22451
|
-
transformOrigin: "top left",
|
|
22452
|
-
zoom: useNativeZoomForStickyLayout ? zoomFactor : void 0,
|
|
22453
22590
|
width: totalWidth
|
|
22454
22591
|
},
|
|
22455
22592
|
children: [
|
|
@@ -22472,7 +22609,7 @@ function XlsxGrid({
|
|
|
22472
22609
|
},
|
|
22473
22610
|
children: [
|
|
22474
22611
|
/* @__PURE__ */ jsxs3("colgroup", { children: [
|
|
22475
|
-
/* @__PURE__ */ jsx3("col", { style: { width:
|
|
22612
|
+
/* @__PURE__ */ jsx3("col", { style: { width: displayRowHeaderWidth } }),
|
|
22476
22613
|
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ jsx3("col", { style: { width: leadingColumnSpacerWidth } }) : null,
|
|
22477
22614
|
renderedCols.map((column) => /* @__PURE__ */ jsx3(
|
|
22478
22615
|
"col",
|
|
@@ -22498,7 +22635,7 @@ function XlsxGrid({
|
|
|
22498
22635
|
...headerCellStyle,
|
|
22499
22636
|
backgroundColor: palette.headerSurface,
|
|
22500
22637
|
left: 0,
|
|
22501
|
-
width:
|
|
22638
|
+
width: displayRowHeaderWidth,
|
|
22502
22639
|
zIndex: 60
|
|
22503
22640
|
}
|
|
22504
22641
|
}
|
|
@@ -22573,10 +22710,12 @@ function XlsxGrid({
|
|
|
22573
22710
|
readOnly,
|
|
22574
22711
|
renderCellAdornment,
|
|
22575
22712
|
rowHeight: virtualRow.size,
|
|
22713
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
22576
22714
|
stickyLeftByCol,
|
|
22577
22715
|
stickyTop: stickyTopByRow.get(actualRow),
|
|
22578
22716
|
trailingSpacerWidth: trailingColumnSpacerWidth,
|
|
22579
|
-
visibleCols: renderedCols
|
|
22717
|
+
visibleCols: renderedCols,
|
|
22718
|
+
zoomFactor
|
|
22580
22719
|
},
|
|
22581
22720
|
virtualRow.key
|
|
22582
22721
|
)
|
|
@@ -22625,16 +22764,16 @@ function XlsxGrid({
|
|
|
22625
22764
|
alignItems: "center",
|
|
22626
22765
|
color: palette.mutedText,
|
|
22627
22766
|
display: "inline-flex",
|
|
22628
|
-
fontSize: 10,
|
|
22767
|
+
fontSize: 10 * zoomFactor,
|
|
22629
22768
|
fontWeight: 700,
|
|
22630
|
-
height: 16,
|
|
22769
|
+
height: 16 * zoomFactor,
|
|
22631
22770
|
justifyContent: "center",
|
|
22632
22771
|
opacity: 0,
|
|
22633
22772
|
pointerEvents: "none",
|
|
22634
22773
|
position: "absolute",
|
|
22635
22774
|
transform: "translateY(-50%)",
|
|
22636
22775
|
visibility: "hidden",
|
|
22637
|
-
width: 12,
|
|
22776
|
+
width: 12 * zoomFactor,
|
|
22638
22777
|
zIndex: 26
|
|
22639
22778
|
},
|
|
22640
22779
|
children: "\u25BE"
|
|
@@ -22654,16 +22793,16 @@ function XlsxGrid({
|
|
|
22654
22793
|
},
|
|
22655
22794
|
style: {
|
|
22656
22795
|
backgroundColor: selectionStroke,
|
|
22657
|
-
border:
|
|
22796
|
+
border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
|
|
22658
22797
|
contain: "layout paint",
|
|
22659
22798
|
cursor: "crosshair",
|
|
22660
22799
|
display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
|
|
22661
|
-
height: 8,
|
|
22662
|
-
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 : 0,
|
|
22800
|
+
height: 8 * zoomFactor,
|
|
22801
|
+
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
|
|
22663
22802
|
pointerEvents: "auto",
|
|
22664
22803
|
position: "absolute",
|
|
22665
|
-
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 : 0,
|
|
22666
|
-
width: 8,
|
|
22804
|
+
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
|
|
22805
|
+
width: 8 * zoomFactor,
|
|
22667
22806
|
zIndex: 25
|
|
22668
22807
|
}
|
|
22669
22808
|
}
|
|
@@ -22674,7 +22813,7 @@ function XlsxGrid({
|
|
|
22674
22813
|
ref: tableMenuRef,
|
|
22675
22814
|
style: {
|
|
22676
22815
|
color: palette.text,
|
|
22677
|
-
left: Math.max(
|
|
22816
|
+
left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
|
|
22678
22817
|
position: "absolute",
|
|
22679
22818
|
top: openTableMenuState.top,
|
|
22680
22819
|
zIndex: 50
|
|
@@ -22731,7 +22870,17 @@ function XlsxViewerInner({
|
|
|
22731
22870
|
toolbar
|
|
22732
22871
|
}) {
|
|
22733
22872
|
const palette = useViewerPalette(isDark);
|
|
22734
|
-
|
|
22873
|
+
const { displayFileName, error } = controller;
|
|
22874
|
+
const customFileTooLarge = error instanceof XlsxFileSizeLimitExceededError ? renderCustomFileTooLarge(
|
|
22875
|
+
fileTooLargeState,
|
|
22876
|
+
{
|
|
22877
|
+
displayFileName,
|
|
22878
|
+
fileSizeBytes: error.fileSizeBytes,
|
|
22879
|
+
maxFileSizeBytes: error.maxFileSizeBytes
|
|
22880
|
+
},
|
|
22881
|
+
palette
|
|
22882
|
+
) : void 0;
|
|
22883
|
+
return /* @__PURE__ */ jsx3(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ jsx3(ViewerContext.Provider, { value: controller, children: customFileTooLarge !== void 0 ? customFileTooLarge : /* @__PURE__ */ jsxs3(
|
|
22735
22884
|
"div",
|
|
22736
22885
|
{
|
|
22737
22886
|
className: classNames("react-xlsx-viewer", className),
|