@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.cjs
CHANGED
|
@@ -5977,21 +5977,35 @@ function getSheetsWasmModule() {
|
|
|
5977
5977
|
|
|
5978
5978
|
// src/worker-client.ts
|
|
5979
5979
|
var import_meta = {};
|
|
5980
|
+
function createAbortError() {
|
|
5981
|
+
if (typeof DOMException !== "undefined") {
|
|
5982
|
+
return new DOMException("Aborted", "AbortError");
|
|
5983
|
+
}
|
|
5984
|
+
const error = new Error("Aborted");
|
|
5985
|
+
error.name = "AbortError";
|
|
5986
|
+
return error;
|
|
5987
|
+
}
|
|
5980
5988
|
var XlsxWorkerClient = class {
|
|
5981
5989
|
worker;
|
|
5982
5990
|
nextRequestId = 1;
|
|
5983
5991
|
pendingRequests = /* @__PURE__ */ new Map();
|
|
5992
|
+
disposed = false;
|
|
5984
5993
|
constructor() {
|
|
5985
5994
|
this.worker = new Worker(new URL("./xlsx-worker.js", import_meta.url), { type: "module" });
|
|
5986
5995
|
this.worker.addEventListener("message", this.handleMessage);
|
|
5987
5996
|
this.worker.addEventListener("error", this.handleError);
|
|
5988
5997
|
}
|
|
5989
5998
|
dispose() {
|
|
5999
|
+
if (this.disposed) {
|
|
6000
|
+
return;
|
|
6001
|
+
}
|
|
6002
|
+
this.disposed = true;
|
|
5990
6003
|
this.worker.removeEventListener("message", this.handleMessage);
|
|
5991
6004
|
this.worker.removeEventListener("error", this.handleError);
|
|
5992
6005
|
this.worker.terminate();
|
|
6006
|
+
const abortError = createAbortError();
|
|
5993
6007
|
for (const request of this.pendingRequests.values()) {
|
|
5994
|
-
request.reject(
|
|
6008
|
+
request.reject(abortError);
|
|
5995
6009
|
}
|
|
5996
6010
|
this.pendingRequests.clear();
|
|
5997
6011
|
}
|
|
@@ -6027,6 +6041,10 @@ var XlsxWorkerClient = class {
|
|
|
6027
6041
|
}
|
|
6028
6042
|
request(message, transfer = []) {
|
|
6029
6043
|
return new Promise((resolve, reject) => {
|
|
6044
|
+
if (this.disposed) {
|
|
6045
|
+
reject(createAbortError());
|
|
6046
|
+
return;
|
|
6047
|
+
}
|
|
6030
6048
|
const id = this.nextRequestId;
|
|
6031
6049
|
this.nextRequestId += 1;
|
|
6032
6050
|
this.pendingRequests.set(id, { reject, resolve });
|
|
@@ -6658,12 +6676,26 @@ function parseClipboardText(text) {
|
|
|
6658
6676
|
}
|
|
6659
6677
|
return rows.map((row) => row.split(" "));
|
|
6660
6678
|
}
|
|
6661
|
-
|
|
6679
|
+
function createAbortError2() {
|
|
6680
|
+
if (typeof DOMException !== "undefined") {
|
|
6681
|
+
return new DOMException("Aborted", "AbortError");
|
|
6682
|
+
}
|
|
6683
|
+
const error = new Error("Aborted");
|
|
6684
|
+
error.name = "AbortError";
|
|
6685
|
+
return error;
|
|
6686
|
+
}
|
|
6687
|
+
function isAbortError(error) {
|
|
6688
|
+
return error instanceof Error && error.name === "AbortError";
|
|
6689
|
+
}
|
|
6690
|
+
async function resolveWorkbookBuffer({ file, src }, signal) {
|
|
6662
6691
|
let buffer;
|
|
6692
|
+
if (signal?.aborted) {
|
|
6693
|
+
throw createAbortError2();
|
|
6694
|
+
}
|
|
6663
6695
|
if (file) {
|
|
6664
6696
|
buffer = file;
|
|
6665
6697
|
} else if (src) {
|
|
6666
|
-
const response = await fetch(src);
|
|
6698
|
+
const response = await fetch(src, { signal });
|
|
6667
6699
|
if (!response.ok) {
|
|
6668
6700
|
throw new Error(`Failed to fetch workbook (status ${response.status})`);
|
|
6669
6701
|
}
|
|
@@ -7428,10 +7460,13 @@ function useXlsxViewerController(options) {
|
|
|
7428
7460
|
} catch {
|
|
7429
7461
|
triggerFallback();
|
|
7430
7462
|
}
|
|
7431
|
-
}).catch(() => {
|
|
7463
|
+
}).catch((error2) => {
|
|
7432
7464
|
if (workerTimeoutHandle !== null) {
|
|
7433
7465
|
window.clearTimeout(workerTimeoutHandle);
|
|
7434
7466
|
}
|
|
7467
|
+
if (isAbortError(error2)) {
|
|
7468
|
+
return;
|
|
7469
|
+
}
|
|
7435
7470
|
triggerFallback();
|
|
7436
7471
|
});
|
|
7437
7472
|
}, [getWorkerClient, hasIncompleteWorkerChartSnapshot, setChartAssets, workerSupported]);
|
|
@@ -7501,6 +7536,7 @@ function useXlsxViewerController(options) {
|
|
|
7501
7536
|
return;
|
|
7502
7537
|
}
|
|
7503
7538
|
let isCurrent = true;
|
|
7539
|
+
const abortController = new AbortController();
|
|
7504
7540
|
setIsLoading(true);
|
|
7505
7541
|
setError(null);
|
|
7506
7542
|
clearImageAssets();
|
|
@@ -7525,11 +7561,9 @@ function useXlsxViewerController(options) {
|
|
|
7525
7561
|
setSortState(null);
|
|
7526
7562
|
setZoomScaleOverridesByTabId({});
|
|
7527
7563
|
setRevision(0);
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
void resolveWorkbookBuffer({ file, src }).then(async (buffer) => {
|
|
7532
|
-
if (!isCurrent) {
|
|
7564
|
+
disposeWorkerClient();
|
|
7565
|
+
void resolveWorkbookBuffer({ file, src }, abortController.signal).then(async (buffer) => {
|
|
7566
|
+
if (!isCurrent || abortController.signal.aborted) {
|
|
7533
7567
|
return;
|
|
7534
7568
|
}
|
|
7535
7569
|
if (maxFileSizeBytes > 0 && buffer.byteLength > maxFileSizeBytes) {
|
|
@@ -7555,7 +7589,7 @@ function useXlsxViewerController(options) {
|
|
|
7555
7589
|
if (shouldUseWorkerForLoad) {
|
|
7556
7590
|
try {
|
|
7557
7591
|
const snapshot = await getWorkerClient().loadWorkbook(buffer);
|
|
7558
|
-
if (!isCurrent) {
|
|
7592
|
+
if (!isCurrent || abortController.signal.aborted) {
|
|
7559
7593
|
return;
|
|
7560
7594
|
}
|
|
7561
7595
|
if (hasIncompleteWorkerChartSnapshot(snapshot)) {
|
|
@@ -7575,6 +7609,9 @@ function useXlsxViewerController(options) {
|
|
|
7575
7609
|
setIsLoading(false);
|
|
7576
7610
|
return;
|
|
7577
7611
|
} catch (workerError) {
|
|
7612
|
+
if (!isCurrent || isAbortError(workerError)) {
|
|
7613
|
+
return;
|
|
7614
|
+
}
|
|
7578
7615
|
if (!shouldFallbackFromWorkerError(workerError)) {
|
|
7579
7616
|
throw workerError;
|
|
7580
7617
|
}
|
|
@@ -7582,7 +7619,7 @@ function useXlsxViewerController(options) {
|
|
|
7582
7619
|
}
|
|
7583
7620
|
}
|
|
7584
7621
|
const { imageAssets: nextImageAssets, parsedWorkbook: nextParsedWorkbook } = await loadWorkbookOnMainThread(buffer);
|
|
7585
|
-
if (!isCurrent) {
|
|
7622
|
+
if (!isCurrent || abortController.signal.aborted) {
|
|
7586
7623
|
revokeWorkbookImageAssets(nextImageAssets);
|
|
7587
7624
|
return;
|
|
7588
7625
|
}
|
|
@@ -7604,7 +7641,7 @@ function useXlsxViewerController(options) {
|
|
|
7604
7641
|
setSortState(null);
|
|
7605
7642
|
setIsLoading(false);
|
|
7606
7643
|
}).catch((nextError) => {
|
|
7607
|
-
if (!isCurrent) {
|
|
7644
|
+
if (!isCurrent || isAbortError(nextError)) {
|
|
7608
7645
|
return;
|
|
7609
7646
|
}
|
|
7610
7647
|
setWorkbook(null);
|
|
@@ -7620,9 +7657,8 @@ function useXlsxViewerController(options) {
|
|
|
7620
7657
|
});
|
|
7621
7658
|
return () => {
|
|
7622
7659
|
isCurrent = false;
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
}
|
|
7660
|
+
abortController.abort();
|
|
7661
|
+
disposeWorkerClient();
|
|
7626
7662
|
};
|
|
7627
7663
|
}, [
|
|
7628
7664
|
clearChartAssets,
|
|
@@ -7788,6 +7824,9 @@ function useXlsxViewerController(options) {
|
|
|
7788
7824
|
setIsChartsLoading(false);
|
|
7789
7825
|
setIsLoading(false);
|
|
7790
7826
|
}).catch(async (workerError) => {
|
|
7827
|
+
if (isAbortError(workerError)) {
|
|
7828
|
+
return;
|
|
7829
|
+
}
|
|
7791
7830
|
if (!shouldFallbackFromWorkerError(workerError)) {
|
|
7792
7831
|
throw workerError;
|
|
7793
7832
|
}
|
|
@@ -15916,21 +15955,68 @@ var IMAGE_HANDLE_CURSOR = {
|
|
|
15916
15955
|
sw: "nesw-resize",
|
|
15917
15956
|
w: "ew-resize"
|
|
15918
15957
|
};
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15958
|
+
var NUMERIC_LENGTH_STYLE_KEYS = /* @__PURE__ */ new Set([
|
|
15959
|
+
"borderRadius",
|
|
15960
|
+
"borderTopLeftRadius",
|
|
15961
|
+
"borderTopRightRadius",
|
|
15962
|
+
"borderBottomLeftRadius",
|
|
15963
|
+
"borderBottomRightRadius",
|
|
15964
|
+
"bottom",
|
|
15965
|
+
"fontSize",
|
|
15966
|
+
"gap",
|
|
15967
|
+
"height",
|
|
15968
|
+
"left",
|
|
15969
|
+
"letterSpacing",
|
|
15970
|
+
"margin",
|
|
15971
|
+
"marginBottom",
|
|
15972
|
+
"marginLeft",
|
|
15973
|
+
"marginRight",
|
|
15974
|
+
"marginTop",
|
|
15975
|
+
"maxHeight",
|
|
15976
|
+
"maxWidth",
|
|
15977
|
+
"minHeight",
|
|
15978
|
+
"minWidth",
|
|
15979
|
+
"outlineOffset",
|
|
15980
|
+
"outlineWidth",
|
|
15981
|
+
"padding",
|
|
15982
|
+
"paddingBottom",
|
|
15983
|
+
"paddingLeft",
|
|
15984
|
+
"paddingRight",
|
|
15985
|
+
"paddingTop",
|
|
15986
|
+
"right",
|
|
15987
|
+
"textIndent",
|
|
15988
|
+
"top",
|
|
15989
|
+
"width"
|
|
15990
|
+
]);
|
|
15991
|
+
function scaleCssLengthExpression(value, scale) {
|
|
15992
|
+
if (scale === 1) {
|
|
15993
|
+
return value;
|
|
15994
|
+
}
|
|
15995
|
+
return value.replace(/(-?\d*\.?\d+)(px|pt)\b/g, (_, rawNumber, unit) => {
|
|
15996
|
+
const nextValue = Number.parseFloat(rawNumber);
|
|
15997
|
+
if (!Number.isFinite(nextValue)) {
|
|
15998
|
+
return `${rawNumber}${unit}`;
|
|
15999
|
+
}
|
|
16000
|
+
return `${nextValue * scale}${unit}`;
|
|
15925
16001
|
});
|
|
15926
16002
|
}
|
|
15927
|
-
function
|
|
15928
|
-
|
|
15929
|
-
|
|
16003
|
+
function scaleCssProperties(style, scale) {
|
|
16004
|
+
if (scale === 1) {
|
|
16005
|
+
return style;
|
|
16006
|
+
}
|
|
16007
|
+
const nextStyle = {};
|
|
16008
|
+
Object.entries(style).forEach(([key, value]) => {
|
|
16009
|
+
if (typeof value === "string") {
|
|
16010
|
+
nextStyle[key] = scaleCssLengthExpression(value, scale);
|
|
16011
|
+
return;
|
|
16012
|
+
}
|
|
16013
|
+
if (typeof value === "number" && NUMERIC_LENGTH_STYLE_KEYS.has(key)) {
|
|
16014
|
+
nextStyle[key] = value * scale;
|
|
16015
|
+
return;
|
|
16016
|
+
}
|
|
16017
|
+
nextStyle[key] = value;
|
|
15930
16018
|
});
|
|
15931
|
-
|
|
15932
|
-
function scrollToZoomedOffset(offset, zoomFactor, options, instance) {
|
|
15933
|
-
(0, import_react_virtual.elementScroll)(offset * zoomFactor, options, instance);
|
|
16019
|
+
return nextStyle;
|
|
15934
16020
|
}
|
|
15935
16021
|
function formatZoomScale(zoomScale) {
|
|
15936
16022
|
return `${Math.round(zoomScale)}%`;
|
|
@@ -16167,7 +16253,9 @@ function resolveAxisStartOffset(actualIndex, actualIndices, sizes, indexByActual
|
|
|
16167
16253
|
return sumBeforeActualIndex(actualIndices, sizes, actualIndex);
|
|
16168
16254
|
}
|
|
16169
16255
|
function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWidths, options) {
|
|
16170
|
-
const
|
|
16256
|
+
const headerHeight = options?.headerHeight ?? HEADER_HEIGHT;
|
|
16257
|
+
const rowHeaderWidth = options?.rowHeaderWidth ?? ROW_HEADER_WIDTH;
|
|
16258
|
+
const resolveMarkerLeft = (col, colOffsetEmu) => rowHeaderWidth + resolveAxisStartOffset(
|
|
16171
16259
|
col,
|
|
16172
16260
|
visibleCols,
|
|
16173
16261
|
colWidths,
|
|
@@ -16175,7 +16263,7 @@ function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWi
|
|
|
16175
16263
|
options?.colPrefixSums,
|
|
16176
16264
|
options?.actualColPrefixSums
|
|
16177
16265
|
) + emuToPixels(colOffsetEmu);
|
|
16178
|
-
const resolveMarkerTop = (row, rowOffsetEmu) =>
|
|
16266
|
+
const resolveMarkerTop = (row, rowOffsetEmu) => headerHeight + resolveAxisStartOffset(
|
|
16179
16267
|
row,
|
|
16180
16268
|
visibleRows,
|
|
16181
16269
|
rowHeights,
|
|
@@ -16186,8 +16274,8 @@ function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWi
|
|
|
16186
16274
|
if (anchor.kind === "absolute") {
|
|
16187
16275
|
return {
|
|
16188
16276
|
height: Math.max(1, emuToPixels(anchor.sizeEmu.cy)),
|
|
16189
|
-
left:
|
|
16190
|
-
top:
|
|
16277
|
+
left: rowHeaderWidth + emuToPixels(anchor.positionEmu.x),
|
|
16278
|
+
top: headerHeight + emuToPixels(anchor.positionEmu.y),
|
|
16191
16279
|
width: Math.max(1, emuToPixels(anchor.sizeEmu.cx))
|
|
16192
16280
|
};
|
|
16193
16281
|
}
|
|
@@ -16267,14 +16355,18 @@ function rectIntersectsViewport(rect, viewport, overscan = 240) {
|
|
|
16267
16355
|
const rectBottom = rect.top + rect.height;
|
|
16268
16356
|
return rectRight >= viewportLeft && rect.left <= viewportRight && rectBottom >= viewportTop && rect.top <= viewportBottom;
|
|
16269
16357
|
}
|
|
16270
|
-
function resolveFrozenDrawingPane(rect, frozenRows, frozenCols, actualRowHeights, actualColWidths, freezePanes, stickyTopByRow, stickyLeftByCol) {
|
|
16358
|
+
function resolveFrozenDrawingPane(rect, frozenRows, frozenCols, actualRowHeights, actualColWidths, freezePanes, stickyTopByRow, stickyLeftByCol, options) {
|
|
16359
|
+
const headerHeight = options?.headerHeight ?? HEADER_HEIGHT;
|
|
16360
|
+
const rowHeaderWidth = options?.rowHeaderWidth ?? ROW_HEADER_WIDTH;
|
|
16361
|
+
const defaultRowHeight = options?.defaultRowHeight ?? DEFAULT_ROW_HEIGHT2;
|
|
16362
|
+
const defaultColWidth = options?.defaultColWidth ?? DEFAULT_COL_WIDTH2;
|
|
16271
16363
|
const frozenPaneBottom = freezePanes?.row && freezePanes.row > 0 && frozenRows.length > 0 ? frozenRows.reduce(
|
|
16272
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
16273
|
-
|
|
16364
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? headerHeight) + (actualRowHeights[row] ?? defaultRowHeight)),
|
|
16365
|
+
headerHeight
|
|
16274
16366
|
) : null;
|
|
16275
16367
|
const frozenPaneRight = freezePanes?.col && freezePanes.col > 0 && frozenCols.length > 0 ? frozenCols.reduce(
|
|
16276
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
16277
|
-
|
|
16368
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? rowHeaderWidth) + (actualColWidths[col] ?? defaultColWidth)),
|
|
16369
|
+
rowHeaderWidth
|
|
16278
16370
|
) : null;
|
|
16279
16371
|
const freezeTop = frozenPaneBottom !== null && rect.top + rect.height <= frozenPaneBottom + 0.5;
|
|
16280
16372
|
const freezeLeft = frozenPaneRight !== null && rect.left + rect.width <= frozenPaneRight + 0.5;
|
|
@@ -16289,8 +16381,8 @@ function resolveFrozenDrawingPane(rect, frozenRows, frozenCols, actualRowHeights
|
|
|
16289
16381
|
}
|
|
16290
16382
|
return "scroll";
|
|
16291
16383
|
}
|
|
16292
|
-
function buildShapeContainerStyle(shape, rect) {
|
|
16293
|
-
const borderWidth = shape.stroke?.none ? 0 : Math.max(0, shape.stroke?.widthPx ?? 0);
|
|
16384
|
+
function buildShapeContainerStyle(shape, rect, viewerScale = 1) {
|
|
16385
|
+
const borderWidth = shape.stroke?.none ? 0 : Math.max(0, shape.stroke?.widthPx ?? 0) * viewerScale;
|
|
16294
16386
|
const strokeColor = shape.stroke?.color ?? "transparent";
|
|
16295
16387
|
const fillColor = shape.fill?.none ? "transparent" : shape.fill?.color ?? "transparent";
|
|
16296
16388
|
const hasVisibleText = shape.paragraphs.some((paragraph) => paragraph.runs.some((run) => run.text.trim().length > 0));
|
|
@@ -16303,7 +16395,7 @@ function buildShapeContainerStyle(shape, rect) {
|
|
|
16303
16395
|
if (shape.geometry === "ellipse") {
|
|
16304
16396
|
borderRadius = "9999px";
|
|
16305
16397
|
} else if (shape.geometry === "roundRect") {
|
|
16306
|
-
borderRadius = 12;
|
|
16398
|
+
borderRadius = 12 * viewerScale;
|
|
16307
16399
|
}
|
|
16308
16400
|
return {
|
|
16309
16401
|
alignItems: shape.textBox?.verticalAlign === "middle" ? "center" : shape.textBox?.verticalAlign === "bottom" ? "flex-end" : "flex-start",
|
|
@@ -17231,25 +17323,29 @@ function renderShapeParagraph(paragraph, index, fallbackAlign = "left", textScal
|
|
|
17231
17323
|
index
|
|
17232
17324
|
);
|
|
17233
17325
|
}
|
|
17234
|
-
function clampImageRect(rect) {
|
|
17326
|
+
function clampImageRect(rect, options) {
|
|
17327
|
+
const contentOffsetLeft = options?.contentOffsetLeft ?? ROW_HEADER_WIDTH;
|
|
17328
|
+
const contentOffsetTop = options?.contentOffsetTop ?? HEADER_HEIGHT;
|
|
17329
|
+
const minSizePx = options?.minSizePx ?? IMAGE_MIN_SIZE_PX;
|
|
17235
17330
|
return {
|
|
17236
|
-
height: Math.max(
|
|
17237
|
-
left: Math.max(
|
|
17238
|
-
top: Math.max(
|
|
17239
|
-
width: Math.max(
|
|
17331
|
+
height: Math.max(minSizePx, rect.height),
|
|
17332
|
+
left: Math.max(contentOffsetLeft, rect.left),
|
|
17333
|
+
top: Math.max(contentOffsetTop, rect.top),
|
|
17334
|
+
width: Math.max(minSizePx, rect.width)
|
|
17240
17335
|
};
|
|
17241
17336
|
}
|
|
17242
|
-
function resolveImageHandleStyle(position, stroke, surface) {
|
|
17243
|
-
const
|
|
17337
|
+
function resolveImageHandleStyle(position, stroke, surface, scale = 1) {
|
|
17338
|
+
const handleSize = IMAGE_HANDLE_SIZE_PX * scale;
|
|
17339
|
+
const offset = handleSize / 2;
|
|
17244
17340
|
const style = {
|
|
17245
17341
|
backgroundColor: surface,
|
|
17246
|
-
border:
|
|
17247
|
-
borderRadius: 6,
|
|
17342
|
+
border: `${Math.max(1, scale)}px solid ${stroke}`,
|
|
17343
|
+
borderRadius: 6 * scale,
|
|
17248
17344
|
cursor: IMAGE_HANDLE_CURSOR[position],
|
|
17249
|
-
height:
|
|
17345
|
+
height: handleSize,
|
|
17250
17346
|
pointerEvents: "auto",
|
|
17251
17347
|
position: "absolute",
|
|
17252
|
-
width:
|
|
17348
|
+
width: handleSize
|
|
17253
17349
|
};
|
|
17254
17350
|
if (position.includes("n")) {
|
|
17255
17351
|
style.top = -offset;
|
|
@@ -18471,6 +18567,12 @@ function renderFileTooLarge(fileTooLargeState, renderProps, palette) {
|
|
|
18471
18567
|
}
|
|
18472
18568
|
return defaultNode;
|
|
18473
18569
|
}
|
|
18570
|
+
function renderCustomFileTooLarge(fileTooLargeState, renderProps, palette) {
|
|
18571
|
+
if (fileTooLargeState === void 0) {
|
|
18572
|
+
return void 0;
|
|
18573
|
+
}
|
|
18574
|
+
return renderFileTooLarge(fileTooLargeState, renderProps, palette);
|
|
18575
|
+
}
|
|
18474
18576
|
function renderDefaultChartLoadingCard(rect) {
|
|
18475
18577
|
const bars = [18, 32, 24];
|
|
18476
18578
|
const barWidth = Math.max(8, Math.min(12, Math.round(rect.width * 0.018)));
|
|
@@ -18705,7 +18807,8 @@ function buildConditionalIcon(iconSet, iconId) {
|
|
|
18705
18807
|
};
|
|
18706
18808
|
}
|
|
18707
18809
|
}
|
|
18708
|
-
function renderConditionalIcon(icon) {
|
|
18810
|
+
function renderConditionalIcon(icon, scale = 1) {
|
|
18811
|
+
const iconSize = 14 * scale;
|
|
18709
18812
|
if (icon.shape === "arrow") {
|
|
18710
18813
|
const fill = icon.color ?? "#111827";
|
|
18711
18814
|
const stroke = icon.borderColor ?? darkenColor3(fill, 0.32);
|
|
@@ -18713,10 +18816,10 @@ function renderConditionalIcon(icon) {
|
|
|
18713
18816
|
"svg",
|
|
18714
18817
|
{
|
|
18715
18818
|
"aria-hidden": "true",
|
|
18716
|
-
height:
|
|
18819
|
+
height: iconSize,
|
|
18717
18820
|
style: { display: "block" },
|
|
18718
18821
|
viewBox: "0 0 16 16",
|
|
18719
|
-
width:
|
|
18822
|
+
width: iconSize,
|
|
18720
18823
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { transform: `rotate(${icon.rotationDeg ?? 0} 8 8)`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18721
18824
|
"path",
|
|
18722
18825
|
{
|
|
@@ -18738,12 +18841,12 @@ function renderConditionalIcon(icon) {
|
|
|
18738
18841
|
alignItems: "center",
|
|
18739
18842
|
color: icon.color ?? "#111827",
|
|
18740
18843
|
display: "inline-flex",
|
|
18741
|
-
fontSize: 13,
|
|
18844
|
+
fontSize: 13 * scale,
|
|
18742
18845
|
fontWeight: 700,
|
|
18743
|
-
height:
|
|
18846
|
+
height: iconSize,
|
|
18744
18847
|
justifyContent: "center",
|
|
18745
18848
|
lineHeight: 1,
|
|
18746
|
-
width:
|
|
18849
|
+
width: iconSize
|
|
18747
18850
|
},
|
|
18748
18851
|
children: icon.glyph
|
|
18749
18852
|
}
|
|
@@ -18757,17 +18860,17 @@ function renderConditionalIcon(icon) {
|
|
|
18757
18860
|
border: icon.borderColor ? `1px solid ${icon.borderColor}` : "none",
|
|
18758
18861
|
borderRadius: "999px",
|
|
18759
18862
|
display: "inline-block",
|
|
18760
|
-
height: 12,
|
|
18761
|
-
width: 12
|
|
18863
|
+
height: 12 * scale,
|
|
18864
|
+
width: 12 * scale
|
|
18762
18865
|
}
|
|
18763
18866
|
}
|
|
18764
18867
|
);
|
|
18765
18868
|
}
|
|
18766
|
-
function renderCheckboxControl(checked, palette) {
|
|
18869
|
+
function renderCheckboxControl(checked, palette, scale = 1) {
|
|
18767
18870
|
const stroke = paletteIsDark(palette) ? "#cbd5e1" : "#475569";
|
|
18768
18871
|
const fill = checked ? paletteIsDark(palette) ? "#60a5fa" : "#2563eb" : "transparent";
|
|
18769
18872
|
const check = paletteIsDark(palette) ? "#020617" : "#ffffff";
|
|
18770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { "aria-hidden": "true", height: 14, style: { display: "block" }, viewBox: "0 0 16 16", width: 14, children: [
|
|
18873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { "aria-hidden": "true", height: 14 * scale, style: { display: "block" }, viewBox: "0 0 16 16", width: 14 * scale, children: [
|
|
18771
18874
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { fill, height: 11, rx: 2, ry: 2, stroke, strokeWidth: 1.2, width: 11, x: 2.5, y: 2.5 }),
|
|
18772
18875
|
checked ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18773
18876
|
"path",
|
|
@@ -18965,10 +19068,12 @@ function GridRow({
|
|
|
18965
19068
|
readOnly,
|
|
18966
19069
|
renderCellAdornment,
|
|
18967
19070
|
rowHeight,
|
|
19071
|
+
rowHeaderWidth,
|
|
18968
19072
|
stickyLeftByCol,
|
|
18969
19073
|
stickyTop,
|
|
18970
19074
|
trailingSpacerWidth,
|
|
18971
|
-
visibleCols
|
|
19075
|
+
visibleCols,
|
|
19076
|
+
zoomFactor
|
|
18972
19077
|
}) {
|
|
18973
19078
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
18974
19079
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { "data-xlsx-row": actualRow, style: { height: rowHeight }, children: [
|
|
@@ -18984,17 +19089,17 @@ function GridRow({
|
|
|
18984
19089
|
boxSizing: "border-box",
|
|
18985
19090
|
boxShadow: gutterSeparatorShadow,
|
|
18986
19091
|
color: palette.mutedText,
|
|
18987
|
-
fontSize: "11px",
|
|
19092
|
+
fontSize: scaleCssLengthExpression("11px", zoomFactor),
|
|
18988
19093
|
height: rowHeight,
|
|
18989
19094
|
left: 0,
|
|
18990
19095
|
maxHeight: rowHeight,
|
|
18991
|
-
minWidth:
|
|
18992
|
-
padding: "2px 4px",
|
|
19096
|
+
minWidth: rowHeaderWidth,
|
|
19097
|
+
padding: scaleCssLengthExpression("2px 4px", zoomFactor),
|
|
18993
19098
|
position: "sticky",
|
|
18994
19099
|
top: stickyTop,
|
|
18995
19100
|
textAlign: "center",
|
|
18996
19101
|
userSelect: "none",
|
|
18997
|
-
width:
|
|
19102
|
+
width: rowHeaderWidth,
|
|
18998
19103
|
zIndex: stickyTop !== void 0 ? 45 : 35
|
|
18999
19104
|
},
|
|
19000
19105
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { position: "relative" }, children: [
|
|
@@ -19005,9 +19110,9 @@ function GridRow({
|
|
|
19005
19110
|
onPointerDown: (event) => onRowResizePointerDown(event, actualRow, rowHeight),
|
|
19006
19111
|
style: {
|
|
19007
19112
|
backgroundColor: "transparent",
|
|
19008
|
-
bottom: -8,
|
|
19113
|
+
bottom: -8 * zoomFactor,
|
|
19009
19114
|
cursor: "row-resize",
|
|
19010
|
-
height: 16,
|
|
19115
|
+
height: 16 * zoomFactor,
|
|
19011
19116
|
left: 0,
|
|
19012
19117
|
position: "absolute",
|
|
19013
19118
|
width: "100%",
|
|
@@ -19108,7 +19213,7 @@ function GridRow({
|
|
|
19108
19213
|
cellContentStyle.zIndex = 1;
|
|
19109
19214
|
}
|
|
19110
19215
|
if (trailingInset > 0) {
|
|
19111
|
-
cellContentStyle.paddingRight = trailingInset + 4;
|
|
19216
|
+
cellContentStyle.paddingRight = (trailingInset + 4) * zoomFactor;
|
|
19112
19217
|
}
|
|
19113
19218
|
if (cellData.conditionalIcon) {
|
|
19114
19219
|
cellContentStyle.position = "relative";
|
|
@@ -19142,13 +19247,13 @@ function GridRow({
|
|
|
19142
19247
|
"aria-hidden": "true",
|
|
19143
19248
|
style: {
|
|
19144
19249
|
alignItems: "center",
|
|
19145
|
-
bottom: 4,
|
|
19250
|
+
bottom: 4 * zoomFactor,
|
|
19146
19251
|
display: "flex",
|
|
19147
|
-
left: 4,
|
|
19252
|
+
left: 4 * zoomFactor,
|
|
19148
19253
|
pointerEvents: "none",
|
|
19149
19254
|
position: "absolute",
|
|
19150
|
-
right: 4,
|
|
19151
|
-
top: 4,
|
|
19255
|
+
right: 4 * zoomFactor,
|
|
19256
|
+
top: 4 * zoomFactor,
|
|
19152
19257
|
zIndex: 0
|
|
19153
19258
|
},
|
|
19154
19259
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -19177,12 +19282,12 @@ function GridRow({
|
|
|
19177
19282
|
justifyContent: "center",
|
|
19178
19283
|
pointerEvents: "none",
|
|
19179
19284
|
position: "absolute",
|
|
19180
|
-
right: conditionalIconRight,
|
|
19285
|
+
right: conditionalIconRight * zoomFactor,
|
|
19181
19286
|
top: "50%",
|
|
19182
19287
|
transform: "translateY(-50%)",
|
|
19183
19288
|
zIndex: 2
|
|
19184
19289
|
},
|
|
19185
|
-
children: renderConditionalIcon(cellData.conditionalIcon)
|
|
19290
|
+
children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
|
|
19186
19291
|
}
|
|
19187
19292
|
) : null,
|
|
19188
19293
|
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -19211,7 +19316,7 @@ function GridRow({
|
|
|
19211
19316
|
height: "100%",
|
|
19212
19317
|
margin: 0,
|
|
19213
19318
|
outline: "none",
|
|
19214
|
-
padding: DEFAULT_CELL_PADDING,
|
|
19319
|
+
padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
|
|
19215
19320
|
width: "100%"
|
|
19216
19321
|
},
|
|
19217
19322
|
value: editingValue
|
|
@@ -19253,7 +19358,7 @@ function GridRow({
|
|
|
19253
19358
|
pointerEvents: "none",
|
|
19254
19359
|
width: "100%"
|
|
19255
19360
|
},
|
|
19256
|
-
children: renderCheckboxControl(cellData.checkboxState, palette)
|
|
19361
|
+
children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
|
|
19257
19362
|
}
|
|
19258
19363
|
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cellContentStyle, children: cellData.value })
|
|
19259
19364
|
]
|
|
@@ -19276,7 +19381,7 @@ function GridRow({
|
|
|
19276
19381
|
] });
|
|
19277
19382
|
}
|
|
19278
19383
|
var MemoGridRow = React4.memo(GridRow, (prev, next) => {
|
|
19279
|
-
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) {
|
|
19384
|
+
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) {
|
|
19280
19385
|
return false;
|
|
19281
19386
|
}
|
|
19282
19387
|
const prevEditingCol = prev.editingCell?.row === prev.actualRow ? prev.editingCell.col : -1;
|
|
@@ -19453,20 +19558,25 @@ function XlsxGrid({
|
|
|
19453
19558
|
);
|
|
19454
19559
|
const hiddenRowSet = React4.useMemo(() => new Set(activeSheet?.hiddenRows ?? []), [activeSheet?.hiddenRows]);
|
|
19455
19560
|
const hiddenColSet = React4.useMemo(() => new Set(activeSheet?.hiddenCols ?? []), [activeSheet?.hiddenCols]);
|
|
19561
|
+
const displayDefaultRowHeight = DEFAULT_ROW_HEIGHT2 * zoomFactor;
|
|
19562
|
+
const displayDefaultColWidth = DEFAULT_COL_WIDTH2 * zoomFactor;
|
|
19563
|
+
const displayHeaderHeight = HEADER_HEIGHT * zoomFactor;
|
|
19564
|
+
const displayRowHeaderWidth = ROW_HEADER_WIDTH * zoomFactor;
|
|
19565
|
+
const displayImageMinSize = IMAGE_MIN_SIZE_PX * zoomFactor;
|
|
19456
19566
|
const syncDrawingViewport = React4.useCallback((scroller) => {
|
|
19457
19567
|
if (!scroller) {
|
|
19458
19568
|
return;
|
|
19459
19569
|
}
|
|
19460
19570
|
setDrawingViewport((current) => {
|
|
19461
19571
|
const next = {
|
|
19462
|
-
height: scroller.clientHeight
|
|
19463
|
-
left: scroller.scrollLeft
|
|
19464
|
-
top: scroller.scrollTop
|
|
19465
|
-
width: scroller.clientWidth
|
|
19572
|
+
height: scroller.clientHeight,
|
|
19573
|
+
left: scroller.scrollLeft,
|
|
19574
|
+
top: scroller.scrollTop,
|
|
19575
|
+
width: scroller.clientWidth
|
|
19466
19576
|
};
|
|
19467
19577
|
return current.left === next.left && current.top === next.top && current.width === next.width && current.height === next.height ? current : next;
|
|
19468
19578
|
});
|
|
19469
|
-
}, [
|
|
19579
|
+
}, []);
|
|
19470
19580
|
const visibleRows = React4.useMemo(() => {
|
|
19471
19581
|
return buildVisibleAxisIndices(
|
|
19472
19582
|
activeSheet?.visibleRows ?? [],
|
|
@@ -19620,47 +19730,54 @@ function XlsxGrid({
|
|
|
19620
19730
|
revision
|
|
19621
19731
|
]
|
|
19622
19732
|
);
|
|
19623
|
-
const
|
|
19624
|
-
() =>
|
|
19625
|
-
[actualColWidths,
|
|
19733
|
+
const displayActualColWidths = React4.useMemo(
|
|
19734
|
+
() => actualColWidths.map((width) => width * zoomFactor),
|
|
19735
|
+
[actualColWidths, zoomFactor]
|
|
19736
|
+
);
|
|
19737
|
+
const displayActualRowHeights = React4.useMemo(
|
|
19738
|
+
() => actualRowHeights.map((height) => height * zoomFactor),
|
|
19739
|
+
[actualRowHeights, zoomFactor]
|
|
19626
19740
|
);
|
|
19627
|
-
const
|
|
19628
|
-
() =>
|
|
19629
|
-
[
|
|
19741
|
+
const displayEffectiveColWidths = React4.useMemo(
|
|
19742
|
+
() => visibleCols.map((col) => displayActualColWidths[col] ?? displayDefaultColWidth),
|
|
19743
|
+
[displayActualColWidths, displayDefaultColWidth, visibleCols]
|
|
19744
|
+
);
|
|
19745
|
+
const displayEffectiveRowHeights = React4.useMemo(
|
|
19746
|
+
() => visibleRows.map((row) => displayActualRowHeights[row] ?? displayDefaultRowHeight),
|
|
19747
|
+
[displayActualRowHeights, displayDefaultRowHeight, visibleRows]
|
|
19630
19748
|
);
|
|
19631
19749
|
const rowIndexByActual = React4.useMemo(() => new Map(visibleRows.map((row, index) => [row, index])), [visibleRows]);
|
|
19632
19750
|
const colIndexByActual = React4.useMemo(() => new Map(visibleCols.map((col, index) => [col, index])), [visibleCols]);
|
|
19633
19751
|
const visibleRowsRef = React4.useRef(visibleRows);
|
|
19634
19752
|
const visibleColsRef = React4.useRef(visibleCols);
|
|
19635
|
-
const effectiveRowHeightsRef = React4.useRef(
|
|
19636
|
-
const effectiveColWidthsRef = React4.useRef(
|
|
19637
|
-
const rowPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19638
|
-
const colPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19639
|
-
const actualRowPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19640
|
-
const actualColPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19753
|
+
const effectiveRowHeightsRef = React4.useRef(displayEffectiveRowHeights);
|
|
19754
|
+
const effectiveColWidthsRef = React4.useRef(displayEffectiveColWidths);
|
|
19755
|
+
const rowPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveRowHeights), [displayEffectiveRowHeights]);
|
|
19756
|
+
const colPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveColWidths), [displayEffectiveColWidths]);
|
|
19757
|
+
const actualRowPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualRowHeights), [displayActualRowHeights]);
|
|
19758
|
+
const actualColPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualColWidths), [displayActualColWidths]);
|
|
19641
19759
|
const stickyTopByRow = React4.useMemo(
|
|
19642
|
-
() => buildStickyOffsets(frozenRows,
|
|
19643
|
-
[
|
|
19760
|
+
() => buildStickyOffsets(frozenRows, displayActualRowHeights, displayHeaderHeight),
|
|
19761
|
+
[displayActualRowHeights, displayHeaderHeight, frozenRows]
|
|
19644
19762
|
);
|
|
19645
19763
|
const stickyLeftByCol = React4.useMemo(
|
|
19646
|
-
() => buildStickyOffsets(frozenCols,
|
|
19647
|
-
[
|
|
19764
|
+
() => buildStickyOffsets(frozenCols, displayActualColWidths, displayRowHeaderWidth),
|
|
19765
|
+
[displayActualColWidths, displayRowHeaderWidth, frozenCols]
|
|
19648
19766
|
);
|
|
19649
19767
|
const frozenPaneBottom = React4.useMemo(
|
|
19650
19768
|
() => frozenRows.length > 0 ? frozenRows.reduce(
|
|
19651
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
19652
|
-
|
|
19653
|
-
) :
|
|
19654
|
-
[
|
|
19769
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? displayHeaderHeight) + (displayActualRowHeights[row] ?? displayDefaultRowHeight)),
|
|
19770
|
+
displayHeaderHeight
|
|
19771
|
+
) : displayHeaderHeight,
|
|
19772
|
+
[displayActualRowHeights, displayDefaultRowHeight, displayHeaderHeight, frozenRows, stickyTopByRow]
|
|
19655
19773
|
);
|
|
19656
19774
|
const frozenPaneRight = React4.useMemo(
|
|
19657
19775
|
() => frozenCols.length > 0 ? frozenCols.reduce(
|
|
19658
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
19659
|
-
|
|
19660
|
-
) :
|
|
19661
|
-
[
|
|
19776
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? displayRowHeaderWidth) + (displayActualColWidths[col] ?? displayDefaultColWidth)),
|
|
19777
|
+
displayRowHeaderWidth
|
|
19778
|
+
) : displayRowHeaderWidth,
|
|
19779
|
+
[displayActualColWidths, displayDefaultColWidth, displayRowHeaderWidth, frozenCols, stickyLeftByCol]
|
|
19662
19780
|
);
|
|
19663
|
-
const useNativeZoomForStickyLayout = zoomFactor !== 1;
|
|
19664
19781
|
const rowPrefixSumsRef = React4.useRef(rowPrefixSums);
|
|
19665
19782
|
const colPrefixSumsRef = React4.useRef(colPrefixSums);
|
|
19666
19783
|
const firstVisibleRow = visibleRows[0];
|
|
@@ -19668,6 +19785,12 @@ function XlsxGrid({
|
|
|
19668
19785
|
const firstVisibleCol = visibleCols[0];
|
|
19669
19786
|
const lastVisibleCol = visibleCols[visibleCols.length - 1];
|
|
19670
19787
|
const displayedSelection = fillPreviewRange ?? normalizedSelection;
|
|
19788
|
+
const toLogicalRect = React4.useCallback((rect) => ({
|
|
19789
|
+
height: rect.height / zoomFactor,
|
|
19790
|
+
left: rect.left / zoomFactor,
|
|
19791
|
+
top: rect.top / zoomFactor,
|
|
19792
|
+
width: rect.width / zoomFactor
|
|
19793
|
+
}), [zoomFactor]);
|
|
19671
19794
|
const drawingExtents = React4.useMemo(() => {
|
|
19672
19795
|
const imageExtents = images.reduce(
|
|
19673
19796
|
(current, image) => {
|
|
@@ -19709,24 +19832,18 @@ function XlsxGrid({
|
|
|
19709
19832
|
const shouldVirtualizeCols = !activeSheet?.hasHorizontalMerges && frozenCols.length === 0;
|
|
19710
19833
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
19711
19834
|
count: visibleRows.length,
|
|
19712
|
-
estimateSize: (index) =>
|
|
19835
|
+
estimateSize: (index) => displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
19713
19836
|
getScrollElement: () => scrollRef.current,
|
|
19714
19837
|
getItemKey: (index) => visibleRows[index] ?? index,
|
|
19715
|
-
|
|
19716
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19717
|
-
overscan: 10,
|
|
19718
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19838
|
+
overscan: 10
|
|
19719
19839
|
});
|
|
19720
19840
|
const colVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
19721
19841
|
count: visibleCols.length,
|
|
19722
|
-
estimateSize: (index) =>
|
|
19842
|
+
estimateSize: (index) => displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
19723
19843
|
getScrollElement: () => scrollRef.current,
|
|
19724
19844
|
getItemKey: (index) => visibleCols[index] ?? index,
|
|
19725
19845
|
horizontal: true,
|
|
19726
|
-
|
|
19727
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19728
|
-
overscan: 6,
|
|
19729
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19846
|
+
overscan: 6
|
|
19730
19847
|
});
|
|
19731
19848
|
const currentRowVirtualItems = rowVirtualizer.getVirtualItems();
|
|
19732
19849
|
const currentColVirtualItems = colVirtualizer.getVirtualItems();
|
|
@@ -19862,11 +19979,11 @@ function XlsxGrid({
|
|
|
19862
19979
|
React4.useEffect(() => {
|
|
19863
19980
|
visibleRowsRef.current = visibleRows;
|
|
19864
19981
|
visibleColsRef.current = visibleCols;
|
|
19865
|
-
effectiveRowHeightsRef.current =
|
|
19866
|
-
effectiveColWidthsRef.current =
|
|
19982
|
+
effectiveRowHeightsRef.current = displayEffectiveRowHeights;
|
|
19983
|
+
effectiveColWidthsRef.current = displayEffectiveColWidths;
|
|
19867
19984
|
rowPrefixSumsRef.current = rowPrefixSums;
|
|
19868
19985
|
colPrefixSumsRef.current = colPrefixSums;
|
|
19869
|
-
}, [colPrefixSums,
|
|
19986
|
+
}, [colPrefixSums, displayEffectiveColWidths, displayEffectiveRowHeights, rowPrefixSums, visibleCols, visibleRows]);
|
|
19870
19987
|
React4.useLayoutEffect(() => {
|
|
19871
19988
|
const scroller = scrollRef.current;
|
|
19872
19989
|
const previousZoomFactor = previousZoomFactorRef.current;
|
|
@@ -19991,13 +20108,13 @@ function XlsxGrid({
|
|
|
19991
20108
|
const currentScroller = event.currentTarget;
|
|
19992
20109
|
cachedScrollerRectRef.current = null;
|
|
19993
20110
|
syncDrawingViewport(currentScroller);
|
|
19994
|
-
if (
|
|
20111
|
+
if (currentScroller.scrollHeight - (currentScroller.scrollTop + currentScroller.clientHeight) < OPEN_GRID_VERTICAL_EDGE_PX) {
|
|
19995
20112
|
setDisplayRowLimit((current) => current + OPEN_GRID_ROW_GROWTH);
|
|
19996
20113
|
}
|
|
19997
|
-
if (
|
|
20114
|
+
if (currentScroller.scrollWidth - (currentScroller.scrollLeft + currentScroller.clientWidth) < OPEN_GRID_HORIZONTAL_EDGE_PX) {
|
|
19998
20115
|
setDisplayColLimit((current) => current + OPEN_GRID_COL_GROWTH);
|
|
19999
20116
|
}
|
|
20000
|
-
}, [syncDrawingViewport
|
|
20117
|
+
}, [syncDrawingViewport]);
|
|
20001
20118
|
React4.useEffect(() => {
|
|
20002
20119
|
if (!openTableMenu) {
|
|
20003
20120
|
return;
|
|
@@ -20036,24 +20153,24 @@ function XlsxGrid({
|
|
|
20036
20153
|
}
|
|
20037
20154
|
const pointerOffsetX = clientX - scrollerRect.left;
|
|
20038
20155
|
const pointerOffsetY = clientY - scrollerRect.top;
|
|
20039
|
-
const localX = pointerOffsetX
|
|
20040
|
-
const localY = pointerOffsetY
|
|
20041
|
-
const rowContentOffset = localY -
|
|
20042
|
-
const colContentOffset = localX -
|
|
20156
|
+
const localX = pointerOffsetX + (pointerOffsetX >= frozenPaneRight ? scroller.scrollLeft : 0);
|
|
20157
|
+
const localY = pointerOffsetY + (pointerOffsetY >= frozenPaneBottom ? scroller.scrollTop : 0);
|
|
20158
|
+
const rowContentOffset = localY - displayHeaderHeight;
|
|
20159
|
+
const colContentOffset = localX - displayRowHeaderWidth;
|
|
20043
20160
|
let geometryCell = null;
|
|
20044
|
-
if (localY >=
|
|
20161
|
+
if (localY >= displayHeaderHeight && localX < displayRowHeaderWidth) {
|
|
20045
20162
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20046
20163
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
20047
20164
|
if (actualRow !== void 0 && firstVisibleColRef.current !== void 0) {
|
|
20048
20165
|
geometryCell = { row: actualRow, col: firstVisibleColRef.current };
|
|
20049
20166
|
}
|
|
20050
|
-
} else if (localY <
|
|
20167
|
+
} else if (localY < displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20051
20168
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20052
20169
|
const actualCol = visibleColsCurrent[colIndex];
|
|
20053
20170
|
if (actualCol !== void 0 && firstVisibleRowRef.current !== void 0) {
|
|
20054
20171
|
geometryCell = { row: firstVisibleRowRef.current, col: actualCol };
|
|
20055
20172
|
}
|
|
20056
|
-
} else if (localY >=
|
|
20173
|
+
} else if (localY >= displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20057
20174
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20058
20175
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20059
20176
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
@@ -20063,7 +20180,7 @@ function XlsxGrid({
|
|
|
20063
20180
|
}
|
|
20064
20181
|
}
|
|
20065
20182
|
return geometryCell;
|
|
20066
|
-
}, [frozenPaneBottom, frozenPaneRight
|
|
20183
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, frozenPaneBottom, frozenPaneRight]);
|
|
20067
20184
|
const resolvePointerCellFromHitTest = React4.useCallback((clientX, clientY) => {
|
|
20068
20185
|
const elementsAtPoint = typeof document.elementsFromPoint === "function" ? document.elementsFromPoint(clientX, clientY) : [document.elementFromPoint(clientX, clientY)].filter((element) => Boolean(element));
|
|
20069
20186
|
for (const element of elementsAtPoint) {
|
|
@@ -20123,59 +20240,59 @@ function XlsxGrid({
|
|
|
20123
20240
|
if (rowIndex === void 0 || colIndex === void 0) {
|
|
20124
20241
|
return null;
|
|
20125
20242
|
}
|
|
20126
|
-
const
|
|
20127
|
-
const
|
|
20128
|
-
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width /
|
|
20129
|
-
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height /
|
|
20243
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20244
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20245
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20246
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20130
20247
|
return {
|
|
20131
20248
|
contentScaleX,
|
|
20132
20249
|
contentScaleY,
|
|
20133
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20134
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20250
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20251
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20135
20252
|
};
|
|
20136
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20253
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20137
20254
|
const resolveRowPointerOrigin = React4.useCallback((actualRow, rect, clientY) => {
|
|
20138
20255
|
const rowIndex = rowIndexByActual.get(actualRow);
|
|
20139
20256
|
if (rowIndex === void 0) {
|
|
20140
20257
|
return null;
|
|
20141
20258
|
}
|
|
20142
|
-
const
|
|
20143
|
-
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height /
|
|
20259
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20260
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20144
20261
|
return {
|
|
20145
|
-
contentScaleX:
|
|
20262
|
+
contentScaleX: 1,
|
|
20146
20263
|
contentScaleY,
|
|
20147
20264
|
originContentX: colPrefixSums[0] ?? 0,
|
|
20148
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20265
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20149
20266
|
};
|
|
20150
|
-
}, [colPrefixSums,
|
|
20267
|
+
}, [colPrefixSums, displayDefaultRowHeight, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20151
20268
|
const resolveColumnPointerOrigin = React4.useCallback((actualCol, rect, clientX) => {
|
|
20152
20269
|
const colIndex = colIndexByActual.get(actualCol);
|
|
20153
20270
|
if (colIndex === void 0) {
|
|
20154
20271
|
return null;
|
|
20155
20272
|
}
|
|
20156
|
-
const
|
|
20157
|
-
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width /
|
|
20273
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20274
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20158
20275
|
return {
|
|
20159
20276
|
contentScaleX,
|
|
20160
|
-
contentScaleY:
|
|
20161
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20277
|
+
contentScaleY: 1,
|
|
20278
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20162
20279
|
originContentY: rowPrefixSums[0] ?? 0
|
|
20163
20280
|
};
|
|
20164
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20281
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayEffectiveColWidths, rowPrefixSums]);
|
|
20165
20282
|
const applyColumnPreview = React4.useCallback((actualCol, widthPx) => {
|
|
20166
20283
|
const colElement = colElementRefs.current.get(actualCol);
|
|
20167
20284
|
if (colElement) {
|
|
20168
20285
|
colElement.style.width = widthPx === null ? "" : `${widthPx}px`;
|
|
20169
20286
|
}
|
|
20170
20287
|
const baseIndex = visibleCols.indexOf(actualCol);
|
|
20171
|
-
const baseWidth = baseIndex >= 0 ?
|
|
20288
|
+
const baseWidth = baseIndex >= 0 ? displayEffectiveColWidths[baseIndex] ?? displayDefaultColWidth : displayDefaultColWidth;
|
|
20172
20289
|
const previewWidth = widthPx ?? baseWidth;
|
|
20173
|
-
const baseTotalWidth =
|
|
20290
|
+
const baseTotalWidth = displayEffectiveColWidths.reduce((sum, width) => sum + width, 0) + displayRowHeaderWidth;
|
|
20174
20291
|
const widthDelta = previewWidth - baseWidth;
|
|
20175
20292
|
if (tableRef.current) {
|
|
20176
20293
|
tableRef.current.style.width = `${baseTotalWidth + widthDelta}px`;
|
|
20177
20294
|
}
|
|
20178
|
-
}, [
|
|
20295
|
+
}, [displayDefaultColWidth, displayEffectiveColWidths, displayRowHeaderWidth, visibleCols]);
|
|
20179
20296
|
const applyRowPreview = React4.useCallback((actualRow, heightPx) => {
|
|
20180
20297
|
const rowElement = rowElementRefs.current.get(actualRow) ?? wrapperRef.current?.querySelector(`tr[data-xlsx-row="${actualRow}"]`) ?? null;
|
|
20181
20298
|
if (rowElement) {
|
|
@@ -20352,7 +20469,7 @@ function XlsxGrid({
|
|
|
20352
20469
|
const viewportRowBatch = getRowsBatchAsync ? asyncViewportRowBatch : syncViewportRowBatch;
|
|
20353
20470
|
React4.useEffect(() => {
|
|
20354
20471
|
cellRenderCacheRef.current.clear();
|
|
20355
|
-
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet]);
|
|
20472
|
+
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet, zoomFactor]);
|
|
20356
20473
|
React4.useEffect(() => {
|
|
20357
20474
|
setAsyncViewportRowBatch(null);
|
|
20358
20475
|
}, [activeSheetIndex, revision]);
|
|
@@ -20374,7 +20491,7 @@ function XlsxGrid({
|
|
|
20374
20491
|
if (!worksheet && !batchedCell) {
|
|
20375
20492
|
const emptyData = {
|
|
20376
20493
|
isMergedSecondary: false,
|
|
20377
|
-
style: {
|
|
20494
|
+
style: scaleCssProperties({
|
|
20378
20495
|
backgroundColor: resolveSheetSurface(activeSheet, palette),
|
|
20379
20496
|
borderBottom: "none",
|
|
20380
20497
|
borderRight: "none",
|
|
@@ -20382,7 +20499,7 @@ function XlsxGrid({
|
|
|
20382
20499
|
padding: DEFAULT_CELL_PADDING,
|
|
20383
20500
|
verticalAlign: "bottom",
|
|
20384
20501
|
whiteSpace: "nowrap"
|
|
20385
|
-
},
|
|
20502
|
+
}, zoomFactor),
|
|
20386
20503
|
value: ""
|
|
20387
20504
|
};
|
|
20388
20505
|
cellRenderCacheRef.current.set(cacheKey, emptyData);
|
|
@@ -20461,9 +20578,9 @@ function XlsxGrid({
|
|
|
20461
20578
|
isTableHeader: Boolean(table && row >= table.start.row && row < table.start.row + headerRowCount),
|
|
20462
20579
|
rowSpan: merge?.rowSpan,
|
|
20463
20580
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
20464
|
-
style: buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20581
|
+
style: scaleCssProperties(buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20465
20582
|
showGridLines: activeSheet?.showGridLines
|
|
20466
|
-
}),
|
|
20583
|
+
}), zoomFactor),
|
|
20467
20584
|
validation: resolveCellDataValidation(row, col, activeSheet),
|
|
20468
20585
|
value: sparkline ? "" : checkboxState !== null ? "" : batchCoversRow || !worksheet ? batchedCell?.value ?? "" : getCellDisplayValue(worksheet, row, col, activeSheet)
|
|
20469
20586
|
};
|
|
@@ -20473,7 +20590,7 @@ function XlsxGrid({
|
|
|
20473
20590
|
const horizontalPadding = getHorizontalPadding(nextData.style.padding);
|
|
20474
20591
|
const textWidth = measureTextWidth(nextData.value, nextData.style);
|
|
20475
20592
|
const requiredWidth = textWidth + horizontalPadding + 2;
|
|
20476
|
-
let availableWidth =
|
|
20593
|
+
let availableWidth = displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth;
|
|
20477
20594
|
if (requiredWidth > availableWidth) {
|
|
20478
20595
|
for (let nextColIndex = startColIndex + 1; nextColIndex < visibleCols.length; nextColIndex += 1) {
|
|
20479
20596
|
const nextActualCol = visibleCols[nextColIndex];
|
|
@@ -20484,12 +20601,12 @@ function XlsxGrid({
|
|
|
20484
20601
|
if (!canReceiveOverflowText(neighborData)) {
|
|
20485
20602
|
break;
|
|
20486
20603
|
}
|
|
20487
|
-
availableWidth +=
|
|
20604
|
+
availableWidth += displayEffectiveColWidths[nextColIndex] ?? displayDefaultColWidth;
|
|
20488
20605
|
if (requiredWidth <= availableWidth) {
|
|
20489
20606
|
break;
|
|
20490
20607
|
}
|
|
20491
20608
|
}
|
|
20492
|
-
if (availableWidth > (
|
|
20609
|
+
if (availableWidth > (displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth)) {
|
|
20493
20610
|
nextData.spillWidth = Math.max(0, availableWidth - horizontalPadding);
|
|
20494
20611
|
}
|
|
20495
20612
|
}
|
|
@@ -20497,7 +20614,7 @@ function XlsxGrid({
|
|
|
20497
20614
|
}
|
|
20498
20615
|
cellRenderCacheRef.current.set(cacheKey, nextData);
|
|
20499
20616
|
return nextData;
|
|
20500
|
-
}, [activeSheet, colIndexByActual,
|
|
20617
|
+
}, [activeSheet, colIndexByActual, displayDefaultColWidth, displayEffectiveColWidths, effectiveTables, palette, sparklinesByCell, viewportRowBatch, visibleCols, worksheet, zoomFactor]);
|
|
20501
20618
|
React4.useEffect(() => {
|
|
20502
20619
|
conditionalFormatMetricsCacheRef.current.clear();
|
|
20503
20620
|
}, [activeSheet?.conditionalFormatRules, activeSheet?.workbookSheetIndex, revision]);
|
|
@@ -20515,11 +20632,11 @@ function XlsxGrid({
|
|
|
20515
20632
|
}
|
|
20516
20633
|
return {
|
|
20517
20634
|
height: sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex),
|
|
20518
|
-
left:
|
|
20519
|
-
top:
|
|
20635
|
+
left: displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1),
|
|
20636
|
+
top: displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1),
|
|
20520
20637
|
width: sumPrefixRange(colPrefixSums, startColIndex, endColIndex)
|
|
20521
20638
|
};
|
|
20522
|
-
}, [colIndexByActual, colPrefixSums, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20639
|
+
}, [colIndexByActual, colPrefixSums, displayHeaderHeight, displayRowHeaderWidth, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20523
20640
|
const resolvedSelectionOverlay = selectionOverlay;
|
|
20524
20641
|
const virtualCols = React4.useMemo(
|
|
20525
20642
|
() => shouldVirtualizeCols ? colVirtualizer.getVirtualItems().map((virtualCol) => ({
|
|
@@ -20532,10 +20649,10 @@ function XlsxGrid({
|
|
|
20532
20649
|
end: colPrefixSums[index + 1] ?? 0,
|
|
20533
20650
|
index,
|
|
20534
20651
|
key: visibleCols[index] ?? index,
|
|
20535
|
-
size:
|
|
20652
|
+
size: displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
20536
20653
|
start: colPrefixSums[index] ?? 0
|
|
20537
20654
|
})),
|
|
20538
|
-
[colPrefixSums, colVirtualizer,
|
|
20655
|
+
[colPrefixSums, colVirtualizer, displayDefaultColWidth, displayEffectiveColWidths, shouldVirtualizeCols, visibleCols]
|
|
20539
20656
|
);
|
|
20540
20657
|
const renderedCols = React4.useMemo(
|
|
20541
20658
|
() => {
|
|
@@ -20554,7 +20671,7 @@ function XlsxGrid({
|
|
|
20554
20671
|
});
|
|
20555
20672
|
return columns;
|
|
20556
20673
|
},
|
|
20557
|
-
[
|
|
20674
|
+
[virtualCols, visibleCols]
|
|
20558
20675
|
);
|
|
20559
20676
|
const totalContentWidth = colPrefixSums[colPrefixSums.length - 1] ?? 0;
|
|
20560
20677
|
const leadingColumnSpacerWidth = shouldVirtualizeCols ? virtualCols[0]?.start ?? 0 : 0;
|
|
@@ -20562,12 +20679,14 @@ function XlsxGrid({
|
|
|
20562
20679
|
const imageRects = React4.useMemo(
|
|
20563
20680
|
() => showImages ? images.map((image) => ({
|
|
20564
20681
|
image,
|
|
20565
|
-
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols,
|
|
20682
|
+
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20566
20683
|
actualColPrefixSums,
|
|
20567
20684
|
actualRowPrefixSums,
|
|
20568
20685
|
colIndexByActual,
|
|
20569
20686
|
colPrefixSums,
|
|
20687
|
+
headerHeight: displayHeaderHeight,
|
|
20570
20688
|
rowIndexByActual,
|
|
20689
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20571
20690
|
rowPrefixSums
|
|
20572
20691
|
})
|
|
20573
20692
|
})) : [],
|
|
@@ -20576,8 +20695,10 @@ function XlsxGrid({
|
|
|
20576
20695
|
colPrefixSums,
|
|
20577
20696
|
actualColPrefixSums,
|
|
20578
20697
|
actualRowPrefixSums,
|
|
20579
|
-
|
|
20580
|
-
|
|
20698
|
+
displayHeaderHeight,
|
|
20699
|
+
displayEffectiveColWidths,
|
|
20700
|
+
displayEffectiveRowHeights,
|
|
20701
|
+
displayRowHeaderWidth,
|
|
20581
20702
|
imagePreviewRect,
|
|
20582
20703
|
images,
|
|
20583
20704
|
rowIndexByActual,
|
|
@@ -20589,12 +20710,14 @@ function XlsxGrid({
|
|
|
20589
20710
|
);
|
|
20590
20711
|
const shapeRects = React4.useMemo(
|
|
20591
20712
|
() => showImages ? shapes.map((shape) => ({
|
|
20592
|
-
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols,
|
|
20713
|
+
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20593
20714
|
actualColPrefixSums,
|
|
20594
20715
|
actualRowPrefixSums,
|
|
20595
20716
|
colIndexByActual,
|
|
20596
20717
|
colPrefixSums,
|
|
20718
|
+
headerHeight: displayHeaderHeight,
|
|
20597
20719
|
rowIndexByActual,
|
|
20720
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20598
20721
|
rowPrefixSums
|
|
20599
20722
|
}),
|
|
20600
20723
|
shape
|
|
@@ -20604,8 +20727,10 @@ function XlsxGrid({
|
|
|
20604
20727
|
colPrefixSums,
|
|
20605
20728
|
actualColPrefixSums,
|
|
20606
20729
|
actualRowPrefixSums,
|
|
20607
|
-
|
|
20608
|
-
|
|
20730
|
+
displayHeaderHeight,
|
|
20731
|
+
displayEffectiveColWidths,
|
|
20732
|
+
displayEffectiveRowHeights,
|
|
20733
|
+
displayRowHeaderWidth,
|
|
20609
20734
|
rowIndexByActual,
|
|
20610
20735
|
rowPrefixSums,
|
|
20611
20736
|
shapes,
|
|
@@ -20617,12 +20742,14 @@ function XlsxGrid({
|
|
|
20617
20742
|
const chartRects = React4.useMemo(
|
|
20618
20743
|
() => showImages ? charts.map((chart) => ({
|
|
20619
20744
|
chart,
|
|
20620
|
-
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols,
|
|
20745
|
+
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20621
20746
|
actualColPrefixSums,
|
|
20622
20747
|
actualRowPrefixSums,
|
|
20623
20748
|
colIndexByActual,
|
|
20624
20749
|
colPrefixSums,
|
|
20750
|
+
headerHeight: displayHeaderHeight,
|
|
20625
20751
|
rowIndexByActual,
|
|
20752
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20626
20753
|
rowPrefixSums
|
|
20627
20754
|
})
|
|
20628
20755
|
})) : [],
|
|
@@ -20633,8 +20760,10 @@ function XlsxGrid({
|
|
|
20633
20760
|
charts,
|
|
20634
20761
|
colIndexByActual,
|
|
20635
20762
|
colPrefixSums,
|
|
20636
|
-
|
|
20637
|
-
|
|
20763
|
+
displayHeaderHeight,
|
|
20764
|
+
displayEffectiveColWidths,
|
|
20765
|
+
displayEffectiveRowHeights,
|
|
20766
|
+
displayRowHeaderWidth,
|
|
20638
20767
|
rowIndexByActual,
|
|
20639
20768
|
rowPrefixSums,
|
|
20640
20769
|
showImages,
|
|
@@ -20680,15 +20809,15 @@ function XlsxGrid({
|
|
|
20680
20809
|
if (startRowIndex === void 0 || endRowIndex === void 0 || startColIndex === void 0 || endColIndex === void 0) {
|
|
20681
20810
|
return null;
|
|
20682
20811
|
}
|
|
20683
|
-
let left =
|
|
20684
|
-
let top =
|
|
20812
|
+
let left = displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1);
|
|
20813
|
+
let top = displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1);
|
|
20685
20814
|
let width = sumPrefixRange(colPrefixSums, startColIndex, endColIndex);
|
|
20686
20815
|
let height = sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex);
|
|
20687
20816
|
const columnPreview = columnPreviewRef.current;
|
|
20688
20817
|
if (columnPreview) {
|
|
20689
20818
|
const previewIndex = colIndexByActual.get(columnPreview.actualIndex);
|
|
20690
20819
|
if (previewIndex !== void 0) {
|
|
20691
|
-
const baseWidth =
|
|
20820
|
+
const baseWidth = displayEffectiveColWidths[previewIndex] ?? displayDefaultColWidth;
|
|
20692
20821
|
const widthDelta = columnPreview.size - baseWidth;
|
|
20693
20822
|
if (previewIndex < startColIndex) {
|
|
20694
20823
|
left += widthDelta;
|
|
@@ -20702,7 +20831,7 @@ function XlsxGrid({
|
|
|
20702
20831
|
if (rowPreview) {
|
|
20703
20832
|
const previewIndex = rowIndexByActual.get(rowPreview.actualIndex);
|
|
20704
20833
|
if (previewIndex !== void 0) {
|
|
20705
|
-
const baseHeight =
|
|
20834
|
+
const baseHeight = displayEffectiveRowHeights[previewIndex] ?? displayDefaultRowHeight;
|
|
20706
20835
|
const heightDelta = rowPreview.size - baseHeight;
|
|
20707
20836
|
if (previewIndex < startRowIndex) {
|
|
20708
20837
|
top += heightDelta;
|
|
@@ -20714,11 +20843,11 @@ function XlsxGrid({
|
|
|
20714
20843
|
}
|
|
20715
20844
|
return {
|
|
20716
20845
|
height: Math.max(0, height),
|
|
20717
|
-
left: Math.max(
|
|
20718
|
-
top: Math.max(
|
|
20846
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20847
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20719
20848
|
width: Math.max(0, width)
|
|
20720
20849
|
};
|
|
20721
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20850
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, displayHeaderHeight, displayRowHeaderWidth, rowIndexByActual, rowPrefixSums]);
|
|
20722
20851
|
const resolveMountedRangeOverlayRect = React4.useCallback((range, geometryRect) => {
|
|
20723
20852
|
const normalized = normalizeRange2(range);
|
|
20724
20853
|
const startRect = resolveMountedCellOverlayRectForAddress(normalized.start);
|
|
@@ -20735,11 +20864,11 @@ function XlsxGrid({
|
|
|
20735
20864
|
const bottom = bottomRect ? bottomRect.top + bottomRect.height : geometryRect.top + geometryRect.height;
|
|
20736
20865
|
return {
|
|
20737
20866
|
height: Math.max(0, bottom - top),
|
|
20738
|
-
left: Math.max(
|
|
20739
|
-
top: Math.max(
|
|
20867
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20868
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20740
20869
|
width: Math.max(0, right - left)
|
|
20741
20870
|
};
|
|
20742
|
-
}, [resolveMountedCellOverlayRectForAddress]);
|
|
20871
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, resolveMountedCellOverlayRectForAddress]);
|
|
20743
20872
|
const resolveDragPreviewRect = React4.useCallback((range) => {
|
|
20744
20873
|
const dragState = selectionDragRef.current;
|
|
20745
20874
|
if (!dragState || !dragState.didDrag || dragState.axis !== "cell" || !dragState.originOverlayRect) {
|
|
@@ -20857,11 +20986,11 @@ function XlsxGrid({
|
|
|
20857
20986
|
overlay.style.visibility = "visible";
|
|
20858
20987
|
const fillHandle = fillHandleRef.current;
|
|
20859
20988
|
if (fillHandle) {
|
|
20860
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20861
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
20989
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
20990
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20862
20991
|
}
|
|
20863
20992
|
applyHeaderSelection(range);
|
|
20864
|
-
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect]);
|
|
20993
|
+
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20865
20994
|
const applyPreviewOverlayFromElement = React4.useCallback((element, range) => {
|
|
20866
20995
|
const overlay = selectionOverlayRef.current;
|
|
20867
20996
|
if (!overlay) {
|
|
@@ -20880,11 +21009,11 @@ function XlsxGrid({
|
|
|
20880
21009
|
overlay.style.visibility = "visible";
|
|
20881
21010
|
const fillHandle = fillHandleRef.current;
|
|
20882
21011
|
if (fillHandle) {
|
|
20883
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20884
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
21012
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
21013
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20885
21014
|
}
|
|
20886
21015
|
applyHeaderSelection(range);
|
|
20887
|
-
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect]);
|
|
21016
|
+
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20888
21017
|
const syncActiveValidationOverlay = React4.useCallback((cell) => {
|
|
20889
21018
|
const overlay = activeValidationOverlayRef.current;
|
|
20890
21019
|
if (!overlay || !cell || editingCellRef.current || selectionDragRef.current || fillDragRef.current) {
|
|
@@ -20902,11 +21031,11 @@ function XlsxGrid({
|
|
|
20902
21031
|
overlay.style.visibility = "hidden";
|
|
20903
21032
|
return;
|
|
20904
21033
|
}
|
|
20905
|
-
overlay.style.left = `${rect.left + rect.width - 16}px`;
|
|
21034
|
+
overlay.style.left = `${rect.left + rect.width - 16 * zoomFactor}px`;
|
|
20906
21035
|
overlay.style.top = `${rect.top + rect.height / 2}px`;
|
|
20907
21036
|
overlay.style.opacity = "1";
|
|
20908
21037
|
overlay.style.visibility = "visible";
|
|
20909
|
-
}, [getCellData, resolveOverlayRect]);
|
|
21038
|
+
}, [getCellData, resolveOverlayRect, zoomFactor]);
|
|
20910
21039
|
const commitSelectionRange = React4.useCallback((range) => {
|
|
20911
21040
|
const normalized = normalizeRange2(range);
|
|
20912
21041
|
if (selectionRef.current && rangesEqual(selectionRef.current, normalized) && isSameCell(activeCellRef.current, normalized.end) && selectedChartIdRef.current === null && selectedImageIdRef.current === null) {
|
|
@@ -20944,7 +21073,7 @@ function XlsxGrid({
|
|
|
20944
21073
|
}
|
|
20945
21074
|
pendingResizePreviewRef.current = {
|
|
20946
21075
|
actualIndex: state.actualIndex,
|
|
20947
|
-
size: state.type === "column" ? Math.max(
|
|
21076
|
+
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)),
|
|
20948
21077
|
type: state.type
|
|
20949
21078
|
};
|
|
20950
21079
|
if (resizeFrameRef.current !== null) {
|
|
@@ -20991,9 +21120,9 @@ function XlsxGrid({
|
|
|
20991
21120
|
}
|
|
20992
21121
|
if (preview && preview.actualIndex === resizeState.actualIndex && preview.type === resizeState.type) {
|
|
20993
21122
|
if (preview.type === "column") {
|
|
20994
|
-
controller.resizeColumn(preview.actualIndex, preview.size);
|
|
21123
|
+
controller.resizeColumn(preview.actualIndex, preview.size / zoomFactor);
|
|
20995
21124
|
} else {
|
|
20996
|
-
controller.resizeRow(preview.actualIndex, preview.size);
|
|
21125
|
+
controller.resizeRow(preview.actualIndex, preview.size / zoomFactor);
|
|
20997
21126
|
}
|
|
20998
21127
|
}
|
|
20999
21128
|
}
|
|
@@ -21010,7 +21139,7 @@ function XlsxGrid({
|
|
|
21010
21139
|
resizeFrameRef.current = null;
|
|
21011
21140
|
}
|
|
21012
21141
|
};
|
|
21013
|
-
}, [applyColumnPreview, applyRowPreview, controller, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21142
|
+
}, [applyColumnPreview, applyRowPreview, controller, displayDefaultColWidth, displayDefaultRowHeight, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21014
21143
|
function buildDraggedSelectionRange(dragState, cell) {
|
|
21015
21144
|
if (dragState.axis === "row") {
|
|
21016
21145
|
if (firstVisibleCol === void 0 || lastVisibleCol === void 0) {
|
|
@@ -21339,21 +21468,21 @@ function XlsxGrid({
|
|
|
21339
21468
|
color: palette.mutedText,
|
|
21340
21469
|
cursor: "pointer",
|
|
21341
21470
|
display: "inline-flex",
|
|
21342
|
-
fontSize: 10,
|
|
21343
|
-
height: 16,
|
|
21471
|
+
fontSize: 10 * zoomFactor,
|
|
21472
|
+
height: 16 * zoomFactor,
|
|
21344
21473
|
justifyContent: "center",
|
|
21345
21474
|
padding: 0,
|
|
21346
21475
|
position: "absolute",
|
|
21347
|
-
right: 4,
|
|
21348
|
-
top: 3,
|
|
21349
|
-
width: 16,
|
|
21476
|
+
right: 4 * zoomFactor,
|
|
21477
|
+
top: 3 * zoomFactor,
|
|
21478
|
+
width: 16 * zoomFactor,
|
|
21350
21479
|
zIndex: 6
|
|
21351
21480
|
},
|
|
21352
21481
|
type: "button",
|
|
21353
21482
|
children: direction === "ascending" ? "\u25B2" : direction === "descending" ? "\u25BC" : "\u25BE"
|
|
21354
21483
|
}
|
|
21355
21484
|
);
|
|
21356
|
-
}, [effectiveTables, palette.mutedText, sortState]);
|
|
21485
|
+
}, [effectiveTables, palette.mutedText, sortState, zoomFactor]);
|
|
21357
21486
|
const startChartMove = React4.useCallback((event, chart, rect) => {
|
|
21358
21487
|
if (event.button !== 0) {
|
|
21359
21488
|
return;
|
|
@@ -21559,7 +21688,7 @@ function XlsxGrid({
|
|
|
21559
21688
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21560
21689
|
index,
|
|
21561
21690
|
key: actualRow,
|
|
21562
|
-
size:
|
|
21691
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21563
21692
|
start: rowPrefixSums[index] ?? 0
|
|
21564
21693
|
})) : (() => {
|
|
21565
21694
|
const renderedRowsByIndex = /* @__PURE__ */ new Map();
|
|
@@ -21580,27 +21709,25 @@ function XlsxGrid({
|
|
|
21580
21709
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21581
21710
|
index,
|
|
21582
21711
|
key: visibleRows[index] ?? index,
|
|
21583
|
-
size:
|
|
21712
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21584
21713
|
start: rowPrefixSums[index] ?? 0
|
|
21585
21714
|
});
|
|
21586
21715
|
});
|
|
21587
21716
|
return Array.from(renderedRowsByIndex.values()).sort((left, right) => left.index - right.index);
|
|
21588
21717
|
})();
|
|
21589
21718
|
const totalHeight = shouldVirtualizeRows ? rowVirtualizer.getTotalSize() : rowPrefixSums[rowPrefixSums.length - 1] ?? 0;
|
|
21590
|
-
const totalWidth = totalContentWidth +
|
|
21591
|
-
const sheetContentHeight =
|
|
21592
|
-
const zoomedSheetHeight = sheetContentHeight * zoomFactor;
|
|
21593
|
-
const zoomedSheetWidth = totalWidth * zoomFactor;
|
|
21719
|
+
const totalWidth = totalContentWidth + displayRowHeaderWidth;
|
|
21720
|
+
const sheetContentHeight = displayHeaderHeight + totalHeight;
|
|
21594
21721
|
const { fill: selectionFill, header: selectionHeaderSurface, stroke: selectionStroke } = resolveSelectionColors({
|
|
21595
21722
|
palette,
|
|
21596
21723
|
selectionColor,
|
|
21597
21724
|
selectionFillColor,
|
|
21598
21725
|
selectionHeaderColor
|
|
21599
21726
|
});
|
|
21600
|
-
const selectionBorderWidth = 1;
|
|
21727
|
+
const selectionBorderWidth = Math.max(1, zoomFactor);
|
|
21601
21728
|
const rowColSpan = renderedCols.length + 1 + (leadingColumnSpacerWidth > 0 ? 1 : 0) + (trailingColumnSpacerWidth > 0 ? 1 : 0);
|
|
21602
21729
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
21603
|
-
const headerCellStyle = {
|
|
21730
|
+
const headerCellStyle = scaleCssProperties({
|
|
21604
21731
|
backgroundColor: palette.headerSurface,
|
|
21605
21732
|
borderBottom: "none",
|
|
21606
21733
|
borderRight: "none",
|
|
@@ -21617,8 +21744,8 @@ function XlsxGrid({
|
|
|
21617
21744
|
userSelect: "none",
|
|
21618
21745
|
whiteSpace: "nowrap",
|
|
21619
21746
|
zIndex: 50
|
|
21620
|
-
};
|
|
21621
|
-
const columnResizeHandleStyle = {
|
|
21747
|
+
}, zoomFactor);
|
|
21748
|
+
const columnResizeHandleStyle = scaleCssProperties({
|
|
21622
21749
|
backgroundColor: "transparent",
|
|
21623
21750
|
cursor: "col-resize",
|
|
21624
21751
|
position: "absolute",
|
|
@@ -21627,17 +21754,23 @@ function XlsxGrid({
|
|
|
21627
21754
|
width: 16,
|
|
21628
21755
|
height: "100%",
|
|
21629
21756
|
zIndex: 5
|
|
21630
|
-
};
|
|
21757
|
+
}, zoomFactor);
|
|
21631
21758
|
function resolveDrawingPane(rect) {
|
|
21632
21759
|
return resolveFrozenDrawingPane(
|
|
21633
21760
|
rect,
|
|
21634
21761
|
frozenRows,
|
|
21635
21762
|
frozenCols,
|
|
21636
|
-
|
|
21637
|
-
|
|
21763
|
+
displayActualRowHeights,
|
|
21764
|
+
displayActualColWidths,
|
|
21638
21765
|
activeSheet?.freezePanes ?? null,
|
|
21639
21766
|
stickyTopByRow,
|
|
21640
|
-
stickyLeftByCol
|
|
21767
|
+
stickyLeftByCol,
|
|
21768
|
+
{
|
|
21769
|
+
defaultColWidth: displayDefaultColWidth,
|
|
21770
|
+
defaultRowHeight: displayDefaultRowHeight,
|
|
21771
|
+
headerHeight: displayHeaderHeight,
|
|
21772
|
+
rowHeaderWidth: displayRowHeaderWidth
|
|
21773
|
+
}
|
|
21641
21774
|
);
|
|
21642
21775
|
}
|
|
21643
21776
|
function renderShapeDrawing(shape, rect, pane) {
|
|
@@ -21654,12 +21787,12 @@ function XlsxGrid({
|
|
|
21654
21787
|
const groupScaleX = shape.scaleX ?? 1;
|
|
21655
21788
|
const groupScaleY = shape.scaleY ?? 1;
|
|
21656
21789
|
const strokeScale = Math.max(groupScaleX, groupScaleY);
|
|
21657
|
-
const textScale = strokeScale;
|
|
21790
|
+
const textScale = strokeScale * zoomFactor;
|
|
21658
21791
|
const textWidth = groupScaleX !== 0 ? rect.width / groupScaleX : rect.width;
|
|
21659
21792
|
const textHeight = groupScaleY !== 0 ? rect.height / groupScaleY : rect.height;
|
|
21660
21793
|
const vectorShape = resolveShapeVector(shape);
|
|
21661
21794
|
const strokeColor = shape.stroke?.none ? "transparent" : shape.stroke?.color ?? "transparent";
|
|
21662
|
-
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale;
|
|
21795
|
+
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale * zoomFactor;
|
|
21663
21796
|
const headMarkerId = `${shape.id}-${pane}-head-marker`;
|
|
21664
21797
|
const tailMarkerId = `${shape.id}-${pane}-tail-marker`;
|
|
21665
21798
|
const headMarker = vectorShape ? resolveShapeLineEndMarker(
|
|
@@ -21679,7 +21812,7 @@ function XlsxGrid({
|
|
|
21679
21812
|
vectorShape.viewBox
|
|
21680
21813
|
) : null;
|
|
21681
21814
|
const style = {
|
|
21682
|
-
...buildShapeContainerStyle(shape, rect),
|
|
21815
|
+
...buildShapeContainerStyle(shape, rect, zoomFactor),
|
|
21683
21816
|
...vectorShape ? {
|
|
21684
21817
|
backgroundColor: "transparent",
|
|
21685
21818
|
border: "none"
|
|
@@ -21742,13 +21875,13 @@ function XlsxGrid({
|
|
|
21742
21875
|
display: "flex",
|
|
21743
21876
|
flex: 1,
|
|
21744
21877
|
flexDirection: "column",
|
|
21745
|
-
gap: 2,
|
|
21878
|
+
gap: 2 * zoomFactor,
|
|
21746
21879
|
height: textHeight,
|
|
21747
21880
|
justifyContent: shape.textBox?.verticalAlign === "middle" ? "center" : shape.textBox?.verticalAlign === "bottom" ? "flex-end" : "flex-start",
|
|
21748
|
-
paddingBottom: inset?.bottom ?? 4,
|
|
21749
|
-
paddingLeft: inset?.left ?? 6,
|
|
21750
|
-
paddingRight: inset?.right ?? 6,
|
|
21751
|
-
paddingTop: inset?.top ?? 4,
|
|
21881
|
+
paddingBottom: (inset?.bottom ?? 4) * zoomFactor,
|
|
21882
|
+
paddingLeft: (inset?.left ?? 6) * zoomFactor,
|
|
21883
|
+
paddingRight: (inset?.right ?? 6) * zoomFactor,
|
|
21884
|
+
paddingTop: (inset?.top ?? 4) * zoomFactor,
|
|
21752
21885
|
pointerEvents: "none",
|
|
21753
21886
|
position: "relative",
|
|
21754
21887
|
transform: groupScaleX !== 1 || groupScaleY !== 1 ? `scale(${groupScaleX}, ${groupScaleY})` : void 0,
|
|
@@ -21820,8 +21953,8 @@ function XlsxGrid({
|
|
|
21820
21953
|
"div",
|
|
21821
21954
|
{
|
|
21822
21955
|
style: {
|
|
21823
|
-
border:
|
|
21824
|
-
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}`,
|
|
21825
21958
|
boxSizing: "border-box",
|
|
21826
21959
|
inset: 0,
|
|
21827
21960
|
pointerEvents: "none",
|
|
@@ -21831,7 +21964,7 @@ function XlsxGrid({
|
|
|
21831
21964
|
"div",
|
|
21832
21965
|
{
|
|
21833
21966
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21834
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21967
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21835
21968
|
},
|
|
21836
21969
|
position
|
|
21837
21970
|
)) : null
|
|
@@ -21843,7 +21976,7 @@ function XlsxGrid({
|
|
|
21843
21976
|
startImageResize(event, image, rect, position);
|
|
21844
21977
|
}
|
|
21845
21978
|
},
|
|
21846
|
-
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface), display: "none" }
|
|
21979
|
+
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor), display: "none" }
|
|
21847
21980
|
}),
|
|
21848
21981
|
image,
|
|
21849
21982
|
rect
|
|
@@ -21851,8 +21984,8 @@ function XlsxGrid({
|
|
|
21851
21984
|
"div",
|
|
21852
21985
|
{
|
|
21853
21986
|
style: {
|
|
21854
|
-
border:
|
|
21855
|
-
boxShadow: `0 0 0
|
|
21987
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
21988
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21856
21989
|
boxSizing: "border-box",
|
|
21857
21990
|
inset: 0,
|
|
21858
21991
|
pointerEvents: "none",
|
|
@@ -21862,7 +21995,7 @@ function XlsxGrid({
|
|
|
21862
21995
|
"div",
|
|
21863
21996
|
{
|
|
21864
21997
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21865
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21998
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21866
21999
|
},
|
|
21867
22000
|
position
|
|
21868
22001
|
)) : null
|
|
@@ -21924,8 +22057,8 @@ function XlsxGrid({
|
|
|
21924
22057
|
"div",
|
|
21925
22058
|
{
|
|
21926
22059
|
style: {
|
|
21927
|
-
border:
|
|
21928
|
-
boxShadow: `0 0 0
|
|
22060
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
22061
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21929
22062
|
boxSizing: "border-box",
|
|
21930
22063
|
inset: 0,
|
|
21931
22064
|
pointerEvents: "none",
|
|
@@ -21935,7 +22068,7 @@ function XlsxGrid({
|
|
|
21935
22068
|
"div",
|
|
21936
22069
|
{
|
|
21937
22070
|
onPointerDown: (event) => startChartResize(event, chart, rect, position),
|
|
21938
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
22071
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21939
22072
|
},
|
|
21940
22073
|
position
|
|
21941
22074
|
)) : null
|
|
@@ -22171,8 +22304,8 @@ function XlsxGrid({
|
|
|
22171
22304
|
if (!interaction) {
|
|
22172
22305
|
return;
|
|
22173
22306
|
}
|
|
22174
|
-
const deltaX =
|
|
22175
|
-
const deltaY =
|
|
22307
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22308
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22176
22309
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22177
22310
|
interaction.didMove = true;
|
|
22178
22311
|
}
|
|
@@ -22181,7 +22314,12 @@ function XlsxGrid({
|
|
|
22181
22314
|
...interaction.baseRect,
|
|
22182
22315
|
left: interaction.baseRect.left + deltaX,
|
|
22183
22316
|
top: interaction.baseRect.top + deltaY
|
|
22184
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY,
|
|
22317
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, displayImageMinSize),
|
|
22318
|
+
{
|
|
22319
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22320
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22321
|
+
minSizePx: displayImageMinSize
|
|
22322
|
+
}
|
|
22185
22323
|
);
|
|
22186
22324
|
scheduleImagePreviewRect({ id: interaction.imageId, rect: nextRect });
|
|
22187
22325
|
};
|
|
@@ -22216,7 +22354,7 @@ function XlsxGrid({
|
|
|
22216
22354
|
if (interaction.didMove) {
|
|
22217
22355
|
skipNextImageClickRef.current = interaction.imageId;
|
|
22218
22356
|
}
|
|
22219
|
-
setImageRect(interaction.imageId, preview.rect);
|
|
22357
|
+
setImageRect(interaction.imageId, toLogicalRect(preview.rect));
|
|
22220
22358
|
}
|
|
22221
22359
|
imagePreviewRectRef.current = null;
|
|
22222
22360
|
setImagePreviewRect(null);
|
|
@@ -22236,8 +22374,8 @@ function XlsxGrid({
|
|
|
22236
22374
|
if (!interaction) {
|
|
22237
22375
|
return;
|
|
22238
22376
|
}
|
|
22239
|
-
const deltaX =
|
|
22240
|
-
const deltaY =
|
|
22377
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22378
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22241
22379
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22242
22380
|
interaction.didMove = true;
|
|
22243
22381
|
}
|
|
@@ -22246,7 +22384,12 @@ function XlsxGrid({
|
|
|
22246
22384
|
...interaction.baseRect,
|
|
22247
22385
|
left: interaction.baseRect.left + deltaX,
|
|
22248
22386
|
top: interaction.baseRect.top + deltaY
|
|
22249
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48)
|
|
22387
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48 * zoomFactor),
|
|
22388
|
+
{
|
|
22389
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22390
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22391
|
+
minSizePx: 48 * zoomFactor
|
|
22392
|
+
}
|
|
22250
22393
|
);
|
|
22251
22394
|
scheduleChartPreviewRect({ id: interaction.chartId, rect: nextRect });
|
|
22252
22395
|
};
|
|
@@ -22281,7 +22424,7 @@ function XlsxGrid({
|
|
|
22281
22424
|
if (interaction.didMove) {
|
|
22282
22425
|
skipNextChartClickRef.current = interaction.chartId;
|
|
22283
22426
|
}
|
|
22284
|
-
setChartRect(interaction.chartId, preview.rect);
|
|
22427
|
+
setChartRect(interaction.chartId, toLogicalRect(preview.rect));
|
|
22285
22428
|
}
|
|
22286
22429
|
chartPreviewRectRef.current = null;
|
|
22287
22430
|
setChartPreviewRect(null);
|
|
@@ -22463,8 +22606,8 @@ function XlsxGrid({
|
|
|
22463
22606
|
minHeight: "100%",
|
|
22464
22607
|
minWidth: "100%",
|
|
22465
22608
|
position: "relative",
|
|
22466
|
-
width:
|
|
22467
|
-
height:
|
|
22609
|
+
width: totalWidth,
|
|
22610
|
+
height: sheetContentHeight
|
|
22468
22611
|
},
|
|
22469
22612
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
22470
22613
|
"div",
|
|
@@ -22475,9 +22618,6 @@ function XlsxGrid({
|
|
|
22475
22618
|
left: 0,
|
|
22476
22619
|
position: "absolute",
|
|
22477
22620
|
top: 0,
|
|
22478
|
-
transform: void 0,
|
|
22479
|
-
transformOrigin: "top left",
|
|
22480
|
-
zoom: useNativeZoomForStickyLayout ? zoomFactor : void 0,
|
|
22481
22621
|
width: totalWidth
|
|
22482
22622
|
},
|
|
22483
22623
|
children: [
|
|
@@ -22500,7 +22640,7 @@ function XlsxGrid({
|
|
|
22500
22640
|
},
|
|
22501
22641
|
children: [
|
|
22502
22642
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("colgroup", { children: [
|
|
22503
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width:
|
|
22643
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: displayRowHeaderWidth } }),
|
|
22504
22644
|
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: leadingColumnSpacerWidth } }) : null,
|
|
22505
22645
|
renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
22506
22646
|
"col",
|
|
@@ -22526,7 +22666,7 @@ function XlsxGrid({
|
|
|
22526
22666
|
...headerCellStyle,
|
|
22527
22667
|
backgroundColor: palette.headerSurface,
|
|
22528
22668
|
left: 0,
|
|
22529
|
-
width:
|
|
22669
|
+
width: displayRowHeaderWidth,
|
|
22530
22670
|
zIndex: 60
|
|
22531
22671
|
}
|
|
22532
22672
|
}
|
|
@@ -22601,10 +22741,12 @@ function XlsxGrid({
|
|
|
22601
22741
|
readOnly,
|
|
22602
22742
|
renderCellAdornment,
|
|
22603
22743
|
rowHeight: virtualRow.size,
|
|
22744
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
22604
22745
|
stickyLeftByCol,
|
|
22605
22746
|
stickyTop: stickyTopByRow.get(actualRow),
|
|
22606
22747
|
trailingSpacerWidth: trailingColumnSpacerWidth,
|
|
22607
|
-
visibleCols: renderedCols
|
|
22748
|
+
visibleCols: renderedCols,
|
|
22749
|
+
zoomFactor
|
|
22608
22750
|
},
|
|
22609
22751
|
virtualRow.key
|
|
22610
22752
|
)
|
|
@@ -22653,16 +22795,16 @@ function XlsxGrid({
|
|
|
22653
22795
|
alignItems: "center",
|
|
22654
22796
|
color: palette.mutedText,
|
|
22655
22797
|
display: "inline-flex",
|
|
22656
|
-
fontSize: 10,
|
|
22798
|
+
fontSize: 10 * zoomFactor,
|
|
22657
22799
|
fontWeight: 700,
|
|
22658
|
-
height: 16,
|
|
22800
|
+
height: 16 * zoomFactor,
|
|
22659
22801
|
justifyContent: "center",
|
|
22660
22802
|
opacity: 0,
|
|
22661
22803
|
pointerEvents: "none",
|
|
22662
22804
|
position: "absolute",
|
|
22663
22805
|
transform: "translateY(-50%)",
|
|
22664
22806
|
visibility: "hidden",
|
|
22665
|
-
width: 12,
|
|
22807
|
+
width: 12 * zoomFactor,
|
|
22666
22808
|
zIndex: 26
|
|
22667
22809
|
},
|
|
22668
22810
|
children: "\u25BE"
|
|
@@ -22682,16 +22824,16 @@ function XlsxGrid({
|
|
|
22682
22824
|
},
|
|
22683
22825
|
style: {
|
|
22684
22826
|
backgroundColor: selectionStroke,
|
|
22685
|
-
border:
|
|
22827
|
+
border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
|
|
22686
22828
|
contain: "layout paint",
|
|
22687
22829
|
cursor: "crosshair",
|
|
22688
22830
|
display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
|
|
22689
|
-
height: 8,
|
|
22690
|
-
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 : 0,
|
|
22831
|
+
height: 8 * zoomFactor,
|
|
22832
|
+
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
|
|
22691
22833
|
pointerEvents: "auto",
|
|
22692
22834
|
position: "absolute",
|
|
22693
|
-
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 : 0,
|
|
22694
|
-
width: 8,
|
|
22835
|
+
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
|
|
22836
|
+
width: 8 * zoomFactor,
|
|
22695
22837
|
zIndex: 25
|
|
22696
22838
|
}
|
|
22697
22839
|
}
|
|
@@ -22702,7 +22844,7 @@ function XlsxGrid({
|
|
|
22702
22844
|
ref: tableMenuRef,
|
|
22703
22845
|
style: {
|
|
22704
22846
|
color: palette.text,
|
|
22705
|
-
left: Math.max(
|
|
22847
|
+
left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
|
|
22706
22848
|
position: "absolute",
|
|
22707
22849
|
top: openTableMenuState.top,
|
|
22708
22850
|
zIndex: 50
|
|
@@ -22759,7 +22901,17 @@ function XlsxViewerInner({
|
|
|
22759
22901
|
toolbar
|
|
22760
22902
|
}) {
|
|
22761
22903
|
const palette = useViewerPalette(isDark);
|
|
22762
|
-
|
|
22904
|
+
const { displayFileName, error } = controller;
|
|
22905
|
+
const customFileTooLarge = error instanceof XlsxFileSizeLimitExceededError ? renderCustomFileTooLarge(
|
|
22906
|
+
fileTooLargeState,
|
|
22907
|
+
{
|
|
22908
|
+
displayFileName,
|
|
22909
|
+
fileSizeBytes: error.fileSizeBytes,
|
|
22910
|
+
maxFileSizeBytes: error.maxFileSizeBytes
|
|
22911
|
+
},
|
|
22912
|
+
palette
|
|
22913
|
+
) : void 0;
|
|
22914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerContext.Provider, { value: controller, children: customFileTooLarge !== void 0 ? customFileTooLarge : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
22763
22915
|
"div",
|
|
22764
22916
|
{
|
|
22765
22917
|
className: classNames("react-xlsx-viewer", className),
|