@extend-ai/react-xlsx 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +396 -260
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +396 -263
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.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;
|
|
@@ -18705,7 +18801,8 @@ function buildConditionalIcon(iconSet, iconId) {
|
|
|
18705
18801
|
};
|
|
18706
18802
|
}
|
|
18707
18803
|
}
|
|
18708
|
-
function renderConditionalIcon(icon) {
|
|
18804
|
+
function renderConditionalIcon(icon, scale = 1) {
|
|
18805
|
+
const iconSize = 14 * scale;
|
|
18709
18806
|
if (icon.shape === "arrow") {
|
|
18710
18807
|
const fill = icon.color ?? "#111827";
|
|
18711
18808
|
const stroke = icon.borderColor ?? darkenColor3(fill, 0.32);
|
|
@@ -18713,10 +18810,10 @@ function renderConditionalIcon(icon) {
|
|
|
18713
18810
|
"svg",
|
|
18714
18811
|
{
|
|
18715
18812
|
"aria-hidden": "true",
|
|
18716
|
-
height:
|
|
18813
|
+
height: iconSize,
|
|
18717
18814
|
style: { display: "block" },
|
|
18718
18815
|
viewBox: "0 0 16 16",
|
|
18719
|
-
width:
|
|
18816
|
+
width: iconSize,
|
|
18720
18817
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { transform: `rotate(${icon.rotationDeg ?? 0} 8 8)`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18721
18818
|
"path",
|
|
18722
18819
|
{
|
|
@@ -18738,12 +18835,12 @@ function renderConditionalIcon(icon) {
|
|
|
18738
18835
|
alignItems: "center",
|
|
18739
18836
|
color: icon.color ?? "#111827",
|
|
18740
18837
|
display: "inline-flex",
|
|
18741
|
-
fontSize: 13,
|
|
18838
|
+
fontSize: 13 * scale,
|
|
18742
18839
|
fontWeight: 700,
|
|
18743
|
-
height:
|
|
18840
|
+
height: iconSize,
|
|
18744
18841
|
justifyContent: "center",
|
|
18745
18842
|
lineHeight: 1,
|
|
18746
|
-
width:
|
|
18843
|
+
width: iconSize
|
|
18747
18844
|
},
|
|
18748
18845
|
children: icon.glyph
|
|
18749
18846
|
}
|
|
@@ -18757,17 +18854,17 @@ function renderConditionalIcon(icon) {
|
|
|
18757
18854
|
border: icon.borderColor ? `1px solid ${icon.borderColor}` : "none",
|
|
18758
18855
|
borderRadius: "999px",
|
|
18759
18856
|
display: "inline-block",
|
|
18760
|
-
height: 12,
|
|
18761
|
-
width: 12
|
|
18857
|
+
height: 12 * scale,
|
|
18858
|
+
width: 12 * scale
|
|
18762
18859
|
}
|
|
18763
18860
|
}
|
|
18764
18861
|
);
|
|
18765
18862
|
}
|
|
18766
|
-
function renderCheckboxControl(checked, palette) {
|
|
18863
|
+
function renderCheckboxControl(checked, palette, scale = 1) {
|
|
18767
18864
|
const stroke = paletteIsDark(palette) ? "#cbd5e1" : "#475569";
|
|
18768
18865
|
const fill = checked ? paletteIsDark(palette) ? "#60a5fa" : "#2563eb" : "transparent";
|
|
18769
18866
|
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: [
|
|
18867
|
+
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
18868
|
/* @__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
18869
|
checked ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18773
18870
|
"path",
|
|
@@ -18965,10 +19062,12 @@ function GridRow({
|
|
|
18965
19062
|
readOnly,
|
|
18966
19063
|
renderCellAdornment,
|
|
18967
19064
|
rowHeight,
|
|
19065
|
+
rowHeaderWidth,
|
|
18968
19066
|
stickyLeftByCol,
|
|
18969
19067
|
stickyTop,
|
|
18970
19068
|
trailingSpacerWidth,
|
|
18971
|
-
visibleCols
|
|
19069
|
+
visibleCols,
|
|
19070
|
+
zoomFactor
|
|
18972
19071
|
}) {
|
|
18973
19072
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
18974
19073
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { "data-xlsx-row": actualRow, style: { height: rowHeight }, children: [
|
|
@@ -18984,17 +19083,17 @@ function GridRow({
|
|
|
18984
19083
|
boxSizing: "border-box",
|
|
18985
19084
|
boxShadow: gutterSeparatorShadow,
|
|
18986
19085
|
color: palette.mutedText,
|
|
18987
|
-
fontSize: "11px",
|
|
19086
|
+
fontSize: scaleCssLengthExpression("11px", zoomFactor),
|
|
18988
19087
|
height: rowHeight,
|
|
18989
19088
|
left: 0,
|
|
18990
19089
|
maxHeight: rowHeight,
|
|
18991
|
-
minWidth:
|
|
18992
|
-
padding: "2px 4px",
|
|
19090
|
+
minWidth: rowHeaderWidth,
|
|
19091
|
+
padding: scaleCssLengthExpression("2px 4px", zoomFactor),
|
|
18993
19092
|
position: "sticky",
|
|
18994
19093
|
top: stickyTop,
|
|
18995
19094
|
textAlign: "center",
|
|
18996
19095
|
userSelect: "none",
|
|
18997
|
-
width:
|
|
19096
|
+
width: rowHeaderWidth,
|
|
18998
19097
|
zIndex: stickyTop !== void 0 ? 45 : 35
|
|
18999
19098
|
},
|
|
19000
19099
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { position: "relative" }, children: [
|
|
@@ -19005,9 +19104,9 @@ function GridRow({
|
|
|
19005
19104
|
onPointerDown: (event) => onRowResizePointerDown(event, actualRow, rowHeight),
|
|
19006
19105
|
style: {
|
|
19007
19106
|
backgroundColor: "transparent",
|
|
19008
|
-
bottom: -8,
|
|
19107
|
+
bottom: -8 * zoomFactor,
|
|
19009
19108
|
cursor: "row-resize",
|
|
19010
|
-
height: 16,
|
|
19109
|
+
height: 16 * zoomFactor,
|
|
19011
19110
|
left: 0,
|
|
19012
19111
|
position: "absolute",
|
|
19013
19112
|
width: "100%",
|
|
@@ -19108,7 +19207,7 @@ function GridRow({
|
|
|
19108
19207
|
cellContentStyle.zIndex = 1;
|
|
19109
19208
|
}
|
|
19110
19209
|
if (trailingInset > 0) {
|
|
19111
|
-
cellContentStyle.paddingRight = trailingInset + 4;
|
|
19210
|
+
cellContentStyle.paddingRight = (trailingInset + 4) * zoomFactor;
|
|
19112
19211
|
}
|
|
19113
19212
|
if (cellData.conditionalIcon) {
|
|
19114
19213
|
cellContentStyle.position = "relative";
|
|
@@ -19142,13 +19241,13 @@ function GridRow({
|
|
|
19142
19241
|
"aria-hidden": "true",
|
|
19143
19242
|
style: {
|
|
19144
19243
|
alignItems: "center",
|
|
19145
|
-
bottom: 4,
|
|
19244
|
+
bottom: 4 * zoomFactor,
|
|
19146
19245
|
display: "flex",
|
|
19147
|
-
left: 4,
|
|
19246
|
+
left: 4 * zoomFactor,
|
|
19148
19247
|
pointerEvents: "none",
|
|
19149
19248
|
position: "absolute",
|
|
19150
|
-
right: 4,
|
|
19151
|
-
top: 4,
|
|
19249
|
+
right: 4 * zoomFactor,
|
|
19250
|
+
top: 4 * zoomFactor,
|
|
19152
19251
|
zIndex: 0
|
|
19153
19252
|
},
|
|
19154
19253
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -19177,12 +19276,12 @@ function GridRow({
|
|
|
19177
19276
|
justifyContent: "center",
|
|
19178
19277
|
pointerEvents: "none",
|
|
19179
19278
|
position: "absolute",
|
|
19180
|
-
right: conditionalIconRight,
|
|
19279
|
+
right: conditionalIconRight * zoomFactor,
|
|
19181
19280
|
top: "50%",
|
|
19182
19281
|
transform: "translateY(-50%)",
|
|
19183
19282
|
zIndex: 2
|
|
19184
19283
|
},
|
|
19185
|
-
children: renderConditionalIcon(cellData.conditionalIcon)
|
|
19284
|
+
children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
|
|
19186
19285
|
}
|
|
19187
19286
|
) : null,
|
|
19188
19287
|
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -19211,7 +19310,7 @@ function GridRow({
|
|
|
19211
19310
|
height: "100%",
|
|
19212
19311
|
margin: 0,
|
|
19213
19312
|
outline: "none",
|
|
19214
|
-
padding: DEFAULT_CELL_PADDING,
|
|
19313
|
+
padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
|
|
19215
19314
|
width: "100%"
|
|
19216
19315
|
},
|
|
19217
19316
|
value: editingValue
|
|
@@ -19253,7 +19352,7 @@ function GridRow({
|
|
|
19253
19352
|
pointerEvents: "none",
|
|
19254
19353
|
width: "100%"
|
|
19255
19354
|
},
|
|
19256
|
-
children: renderCheckboxControl(cellData.checkboxState, palette)
|
|
19355
|
+
children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
|
|
19257
19356
|
}
|
|
19258
19357
|
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cellContentStyle, children: cellData.value })
|
|
19259
19358
|
]
|
|
@@ -19276,7 +19375,7 @@ function GridRow({
|
|
|
19276
19375
|
] });
|
|
19277
19376
|
}
|
|
19278
19377
|
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) {
|
|
19378
|
+
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
19379
|
return false;
|
|
19281
19380
|
}
|
|
19282
19381
|
const prevEditingCol = prev.editingCell?.row === prev.actualRow ? prev.editingCell.col : -1;
|
|
@@ -19453,20 +19552,25 @@ function XlsxGrid({
|
|
|
19453
19552
|
);
|
|
19454
19553
|
const hiddenRowSet = React4.useMemo(() => new Set(activeSheet?.hiddenRows ?? []), [activeSheet?.hiddenRows]);
|
|
19455
19554
|
const hiddenColSet = React4.useMemo(() => new Set(activeSheet?.hiddenCols ?? []), [activeSheet?.hiddenCols]);
|
|
19555
|
+
const displayDefaultRowHeight = DEFAULT_ROW_HEIGHT2 * zoomFactor;
|
|
19556
|
+
const displayDefaultColWidth = DEFAULT_COL_WIDTH2 * zoomFactor;
|
|
19557
|
+
const displayHeaderHeight = HEADER_HEIGHT * zoomFactor;
|
|
19558
|
+
const displayRowHeaderWidth = ROW_HEADER_WIDTH * zoomFactor;
|
|
19559
|
+
const displayImageMinSize = IMAGE_MIN_SIZE_PX * zoomFactor;
|
|
19456
19560
|
const syncDrawingViewport = React4.useCallback((scroller) => {
|
|
19457
19561
|
if (!scroller) {
|
|
19458
19562
|
return;
|
|
19459
19563
|
}
|
|
19460
19564
|
setDrawingViewport((current) => {
|
|
19461
19565
|
const next = {
|
|
19462
|
-
height: scroller.clientHeight
|
|
19463
|
-
left: scroller.scrollLeft
|
|
19464
|
-
top: scroller.scrollTop
|
|
19465
|
-
width: scroller.clientWidth
|
|
19566
|
+
height: scroller.clientHeight,
|
|
19567
|
+
left: scroller.scrollLeft,
|
|
19568
|
+
top: scroller.scrollTop,
|
|
19569
|
+
width: scroller.clientWidth
|
|
19466
19570
|
};
|
|
19467
19571
|
return current.left === next.left && current.top === next.top && current.width === next.width && current.height === next.height ? current : next;
|
|
19468
19572
|
});
|
|
19469
|
-
}, [
|
|
19573
|
+
}, []);
|
|
19470
19574
|
const visibleRows = React4.useMemo(() => {
|
|
19471
19575
|
return buildVisibleAxisIndices(
|
|
19472
19576
|
activeSheet?.visibleRows ?? [],
|
|
@@ -19620,47 +19724,54 @@ function XlsxGrid({
|
|
|
19620
19724
|
revision
|
|
19621
19725
|
]
|
|
19622
19726
|
);
|
|
19623
|
-
const
|
|
19624
|
-
() =>
|
|
19625
|
-
[actualColWidths,
|
|
19727
|
+
const displayActualColWidths = React4.useMemo(
|
|
19728
|
+
() => actualColWidths.map((width) => width * zoomFactor),
|
|
19729
|
+
[actualColWidths, zoomFactor]
|
|
19730
|
+
);
|
|
19731
|
+
const displayActualRowHeights = React4.useMemo(
|
|
19732
|
+
() => actualRowHeights.map((height) => height * zoomFactor),
|
|
19733
|
+
[actualRowHeights, zoomFactor]
|
|
19626
19734
|
);
|
|
19627
|
-
const
|
|
19628
|
-
() =>
|
|
19629
|
-
[
|
|
19735
|
+
const displayEffectiveColWidths = React4.useMemo(
|
|
19736
|
+
() => visibleCols.map((col) => displayActualColWidths[col] ?? displayDefaultColWidth),
|
|
19737
|
+
[displayActualColWidths, displayDefaultColWidth, visibleCols]
|
|
19738
|
+
);
|
|
19739
|
+
const displayEffectiveRowHeights = React4.useMemo(
|
|
19740
|
+
() => visibleRows.map((row) => displayActualRowHeights[row] ?? displayDefaultRowHeight),
|
|
19741
|
+
[displayActualRowHeights, displayDefaultRowHeight, visibleRows]
|
|
19630
19742
|
);
|
|
19631
19743
|
const rowIndexByActual = React4.useMemo(() => new Map(visibleRows.map((row, index) => [row, index])), [visibleRows]);
|
|
19632
19744
|
const colIndexByActual = React4.useMemo(() => new Map(visibleCols.map((col, index) => [col, index])), [visibleCols]);
|
|
19633
19745
|
const visibleRowsRef = React4.useRef(visibleRows);
|
|
19634
19746
|
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(
|
|
19747
|
+
const effectiveRowHeightsRef = React4.useRef(displayEffectiveRowHeights);
|
|
19748
|
+
const effectiveColWidthsRef = React4.useRef(displayEffectiveColWidths);
|
|
19749
|
+
const rowPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveRowHeights), [displayEffectiveRowHeights]);
|
|
19750
|
+
const colPrefixSums = React4.useMemo(() => buildPrefixSums(displayEffectiveColWidths), [displayEffectiveColWidths]);
|
|
19751
|
+
const actualRowPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualRowHeights), [displayActualRowHeights]);
|
|
19752
|
+
const actualColPrefixSums = React4.useMemo(() => buildPrefixSums(displayActualColWidths), [displayActualColWidths]);
|
|
19641
19753
|
const stickyTopByRow = React4.useMemo(
|
|
19642
|
-
() => buildStickyOffsets(frozenRows,
|
|
19643
|
-
[
|
|
19754
|
+
() => buildStickyOffsets(frozenRows, displayActualRowHeights, displayHeaderHeight),
|
|
19755
|
+
[displayActualRowHeights, displayHeaderHeight, frozenRows]
|
|
19644
19756
|
);
|
|
19645
19757
|
const stickyLeftByCol = React4.useMemo(
|
|
19646
|
-
() => buildStickyOffsets(frozenCols,
|
|
19647
|
-
[
|
|
19758
|
+
() => buildStickyOffsets(frozenCols, displayActualColWidths, displayRowHeaderWidth),
|
|
19759
|
+
[displayActualColWidths, displayRowHeaderWidth, frozenCols]
|
|
19648
19760
|
);
|
|
19649
19761
|
const frozenPaneBottom = React4.useMemo(
|
|
19650
19762
|
() => frozenRows.length > 0 ? frozenRows.reduce(
|
|
19651
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
19652
|
-
|
|
19653
|
-
) :
|
|
19654
|
-
[
|
|
19763
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? displayHeaderHeight) + (displayActualRowHeights[row] ?? displayDefaultRowHeight)),
|
|
19764
|
+
displayHeaderHeight
|
|
19765
|
+
) : displayHeaderHeight,
|
|
19766
|
+
[displayActualRowHeights, displayDefaultRowHeight, displayHeaderHeight, frozenRows, stickyTopByRow]
|
|
19655
19767
|
);
|
|
19656
19768
|
const frozenPaneRight = React4.useMemo(
|
|
19657
19769
|
() => frozenCols.length > 0 ? frozenCols.reduce(
|
|
19658
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
19659
|
-
|
|
19660
|
-
) :
|
|
19661
|
-
[
|
|
19770
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? displayRowHeaderWidth) + (displayActualColWidths[col] ?? displayDefaultColWidth)),
|
|
19771
|
+
displayRowHeaderWidth
|
|
19772
|
+
) : displayRowHeaderWidth,
|
|
19773
|
+
[displayActualColWidths, displayDefaultColWidth, displayRowHeaderWidth, frozenCols, stickyLeftByCol]
|
|
19662
19774
|
);
|
|
19663
|
-
const useNativeZoomForStickyLayout = zoomFactor !== 1;
|
|
19664
19775
|
const rowPrefixSumsRef = React4.useRef(rowPrefixSums);
|
|
19665
19776
|
const colPrefixSumsRef = React4.useRef(colPrefixSums);
|
|
19666
19777
|
const firstVisibleRow = visibleRows[0];
|
|
@@ -19668,6 +19779,12 @@ function XlsxGrid({
|
|
|
19668
19779
|
const firstVisibleCol = visibleCols[0];
|
|
19669
19780
|
const lastVisibleCol = visibleCols[visibleCols.length - 1];
|
|
19670
19781
|
const displayedSelection = fillPreviewRange ?? normalizedSelection;
|
|
19782
|
+
const toLogicalRect = React4.useCallback((rect) => ({
|
|
19783
|
+
height: rect.height / zoomFactor,
|
|
19784
|
+
left: rect.left / zoomFactor,
|
|
19785
|
+
top: rect.top / zoomFactor,
|
|
19786
|
+
width: rect.width / zoomFactor
|
|
19787
|
+
}), [zoomFactor]);
|
|
19671
19788
|
const drawingExtents = React4.useMemo(() => {
|
|
19672
19789
|
const imageExtents = images.reduce(
|
|
19673
19790
|
(current, image) => {
|
|
@@ -19709,24 +19826,18 @@ function XlsxGrid({
|
|
|
19709
19826
|
const shouldVirtualizeCols = !activeSheet?.hasHorizontalMerges && frozenCols.length === 0;
|
|
19710
19827
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
19711
19828
|
count: visibleRows.length,
|
|
19712
|
-
estimateSize: (index) =>
|
|
19829
|
+
estimateSize: (index) => displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
19713
19830
|
getScrollElement: () => scrollRef.current,
|
|
19714
19831
|
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)
|
|
19832
|
+
overscan: 10
|
|
19719
19833
|
});
|
|
19720
19834
|
const colVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
19721
19835
|
count: visibleCols.length,
|
|
19722
|
-
estimateSize: (index) =>
|
|
19836
|
+
estimateSize: (index) => displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
19723
19837
|
getScrollElement: () => scrollRef.current,
|
|
19724
19838
|
getItemKey: (index) => visibleCols[index] ?? index,
|
|
19725
19839
|
horizontal: true,
|
|
19726
|
-
|
|
19727
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19728
|
-
overscan: 6,
|
|
19729
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19840
|
+
overscan: 6
|
|
19730
19841
|
});
|
|
19731
19842
|
const currentRowVirtualItems = rowVirtualizer.getVirtualItems();
|
|
19732
19843
|
const currentColVirtualItems = colVirtualizer.getVirtualItems();
|
|
@@ -19862,11 +19973,11 @@ function XlsxGrid({
|
|
|
19862
19973
|
React4.useEffect(() => {
|
|
19863
19974
|
visibleRowsRef.current = visibleRows;
|
|
19864
19975
|
visibleColsRef.current = visibleCols;
|
|
19865
|
-
effectiveRowHeightsRef.current =
|
|
19866
|
-
effectiveColWidthsRef.current =
|
|
19976
|
+
effectiveRowHeightsRef.current = displayEffectiveRowHeights;
|
|
19977
|
+
effectiveColWidthsRef.current = displayEffectiveColWidths;
|
|
19867
19978
|
rowPrefixSumsRef.current = rowPrefixSums;
|
|
19868
19979
|
colPrefixSumsRef.current = colPrefixSums;
|
|
19869
|
-
}, [colPrefixSums,
|
|
19980
|
+
}, [colPrefixSums, displayEffectiveColWidths, displayEffectiveRowHeights, rowPrefixSums, visibleCols, visibleRows]);
|
|
19870
19981
|
React4.useLayoutEffect(() => {
|
|
19871
19982
|
const scroller = scrollRef.current;
|
|
19872
19983
|
const previousZoomFactor = previousZoomFactorRef.current;
|
|
@@ -19991,13 +20102,13 @@ function XlsxGrid({
|
|
|
19991
20102
|
const currentScroller = event.currentTarget;
|
|
19992
20103
|
cachedScrollerRectRef.current = null;
|
|
19993
20104
|
syncDrawingViewport(currentScroller);
|
|
19994
|
-
if (
|
|
20105
|
+
if (currentScroller.scrollHeight - (currentScroller.scrollTop + currentScroller.clientHeight) < OPEN_GRID_VERTICAL_EDGE_PX) {
|
|
19995
20106
|
setDisplayRowLimit((current) => current + OPEN_GRID_ROW_GROWTH);
|
|
19996
20107
|
}
|
|
19997
|
-
if (
|
|
20108
|
+
if (currentScroller.scrollWidth - (currentScroller.scrollLeft + currentScroller.clientWidth) < OPEN_GRID_HORIZONTAL_EDGE_PX) {
|
|
19998
20109
|
setDisplayColLimit((current) => current + OPEN_GRID_COL_GROWTH);
|
|
19999
20110
|
}
|
|
20000
|
-
}, [syncDrawingViewport
|
|
20111
|
+
}, [syncDrawingViewport]);
|
|
20001
20112
|
React4.useEffect(() => {
|
|
20002
20113
|
if (!openTableMenu) {
|
|
20003
20114
|
return;
|
|
@@ -20036,24 +20147,24 @@ function XlsxGrid({
|
|
|
20036
20147
|
}
|
|
20037
20148
|
const pointerOffsetX = clientX - scrollerRect.left;
|
|
20038
20149
|
const pointerOffsetY = clientY - scrollerRect.top;
|
|
20039
|
-
const localX = pointerOffsetX
|
|
20040
|
-
const localY = pointerOffsetY
|
|
20041
|
-
const rowContentOffset = localY -
|
|
20042
|
-
const colContentOffset = localX -
|
|
20150
|
+
const localX = pointerOffsetX + (pointerOffsetX >= frozenPaneRight ? scroller.scrollLeft : 0);
|
|
20151
|
+
const localY = pointerOffsetY + (pointerOffsetY >= frozenPaneBottom ? scroller.scrollTop : 0);
|
|
20152
|
+
const rowContentOffset = localY - displayHeaderHeight;
|
|
20153
|
+
const colContentOffset = localX - displayRowHeaderWidth;
|
|
20043
20154
|
let geometryCell = null;
|
|
20044
|
-
if (localY >=
|
|
20155
|
+
if (localY >= displayHeaderHeight && localX < displayRowHeaderWidth) {
|
|
20045
20156
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20046
20157
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
20047
20158
|
if (actualRow !== void 0 && firstVisibleColRef.current !== void 0) {
|
|
20048
20159
|
geometryCell = { row: actualRow, col: firstVisibleColRef.current };
|
|
20049
20160
|
}
|
|
20050
|
-
} else if (localY <
|
|
20161
|
+
} else if (localY < displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20051
20162
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20052
20163
|
const actualCol = visibleColsCurrent[colIndex];
|
|
20053
20164
|
if (actualCol !== void 0 && firstVisibleRowRef.current !== void 0) {
|
|
20054
20165
|
geometryCell = { row: firstVisibleRowRef.current, col: actualCol };
|
|
20055
20166
|
}
|
|
20056
|
-
} else if (localY >=
|
|
20167
|
+
} else if (localY >= displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20057
20168
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20058
20169
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20059
20170
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
@@ -20063,7 +20174,7 @@ function XlsxGrid({
|
|
|
20063
20174
|
}
|
|
20064
20175
|
}
|
|
20065
20176
|
return geometryCell;
|
|
20066
|
-
}, [frozenPaneBottom, frozenPaneRight
|
|
20177
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, frozenPaneBottom, frozenPaneRight]);
|
|
20067
20178
|
const resolvePointerCellFromHitTest = React4.useCallback((clientX, clientY) => {
|
|
20068
20179
|
const elementsAtPoint = typeof document.elementsFromPoint === "function" ? document.elementsFromPoint(clientX, clientY) : [document.elementFromPoint(clientX, clientY)].filter((element) => Boolean(element));
|
|
20069
20180
|
for (const element of elementsAtPoint) {
|
|
@@ -20123,59 +20234,59 @@ function XlsxGrid({
|
|
|
20123
20234
|
if (rowIndex === void 0 || colIndex === void 0) {
|
|
20124
20235
|
return null;
|
|
20125
20236
|
}
|
|
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 /
|
|
20237
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20238
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20239
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20240
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20130
20241
|
return {
|
|
20131
20242
|
contentScaleX,
|
|
20132
20243
|
contentScaleY,
|
|
20133
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20134
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20244
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20245
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20135
20246
|
};
|
|
20136
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20247
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20137
20248
|
const resolveRowPointerOrigin = React4.useCallback((actualRow, rect, clientY) => {
|
|
20138
20249
|
const rowIndex = rowIndexByActual.get(actualRow);
|
|
20139
20250
|
if (rowIndex === void 0) {
|
|
20140
20251
|
return null;
|
|
20141
20252
|
}
|
|
20142
|
-
const
|
|
20143
|
-
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height /
|
|
20253
|
+
const displayHeight = displayEffectiveRowHeights[rowIndex] ?? displayDefaultRowHeight;
|
|
20254
|
+
const contentScaleY = Math.max(1e-4, rect.height > 0 ? rect.height / displayHeight : 1);
|
|
20144
20255
|
return {
|
|
20145
|
-
contentScaleX:
|
|
20256
|
+
contentScaleX: 1,
|
|
20146
20257
|
contentScaleY,
|
|
20147
20258
|
originContentX: colPrefixSums[0] ?? 0,
|
|
20148
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20259
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20149
20260
|
};
|
|
20150
|
-
}, [colPrefixSums,
|
|
20261
|
+
}, [colPrefixSums, displayDefaultRowHeight, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20151
20262
|
const resolveColumnPointerOrigin = React4.useCallback((actualCol, rect, clientX) => {
|
|
20152
20263
|
const colIndex = colIndexByActual.get(actualCol);
|
|
20153
20264
|
if (colIndex === void 0) {
|
|
20154
20265
|
return null;
|
|
20155
20266
|
}
|
|
20156
|
-
const
|
|
20157
|
-
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width /
|
|
20267
|
+
const displayWidth = displayEffectiveColWidths[colIndex] ?? displayDefaultColWidth;
|
|
20268
|
+
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width / displayWidth : 1);
|
|
20158
20269
|
return {
|
|
20159
20270
|
contentScaleX,
|
|
20160
|
-
contentScaleY:
|
|
20161
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20271
|
+
contentScaleY: 1,
|
|
20272
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20162
20273
|
originContentY: rowPrefixSums[0] ?? 0
|
|
20163
20274
|
};
|
|
20164
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20275
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayEffectiveColWidths, rowPrefixSums]);
|
|
20165
20276
|
const applyColumnPreview = React4.useCallback((actualCol, widthPx) => {
|
|
20166
20277
|
const colElement = colElementRefs.current.get(actualCol);
|
|
20167
20278
|
if (colElement) {
|
|
20168
20279
|
colElement.style.width = widthPx === null ? "" : `${widthPx}px`;
|
|
20169
20280
|
}
|
|
20170
20281
|
const baseIndex = visibleCols.indexOf(actualCol);
|
|
20171
|
-
const baseWidth = baseIndex >= 0 ?
|
|
20282
|
+
const baseWidth = baseIndex >= 0 ? displayEffectiveColWidths[baseIndex] ?? displayDefaultColWidth : displayDefaultColWidth;
|
|
20172
20283
|
const previewWidth = widthPx ?? baseWidth;
|
|
20173
|
-
const baseTotalWidth =
|
|
20284
|
+
const baseTotalWidth = displayEffectiveColWidths.reduce((sum, width) => sum + width, 0) + displayRowHeaderWidth;
|
|
20174
20285
|
const widthDelta = previewWidth - baseWidth;
|
|
20175
20286
|
if (tableRef.current) {
|
|
20176
20287
|
tableRef.current.style.width = `${baseTotalWidth + widthDelta}px`;
|
|
20177
20288
|
}
|
|
20178
|
-
}, [
|
|
20289
|
+
}, [displayDefaultColWidth, displayEffectiveColWidths, displayRowHeaderWidth, visibleCols]);
|
|
20179
20290
|
const applyRowPreview = React4.useCallback((actualRow, heightPx) => {
|
|
20180
20291
|
const rowElement = rowElementRefs.current.get(actualRow) ?? wrapperRef.current?.querySelector(`tr[data-xlsx-row="${actualRow}"]`) ?? null;
|
|
20181
20292
|
if (rowElement) {
|
|
@@ -20352,7 +20463,7 @@ function XlsxGrid({
|
|
|
20352
20463
|
const viewportRowBatch = getRowsBatchAsync ? asyncViewportRowBatch : syncViewportRowBatch;
|
|
20353
20464
|
React4.useEffect(() => {
|
|
20354
20465
|
cellRenderCacheRef.current.clear();
|
|
20355
|
-
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet]);
|
|
20466
|
+
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet, zoomFactor]);
|
|
20356
20467
|
React4.useEffect(() => {
|
|
20357
20468
|
setAsyncViewportRowBatch(null);
|
|
20358
20469
|
}, [activeSheetIndex, revision]);
|
|
@@ -20374,7 +20485,7 @@ function XlsxGrid({
|
|
|
20374
20485
|
if (!worksheet && !batchedCell) {
|
|
20375
20486
|
const emptyData = {
|
|
20376
20487
|
isMergedSecondary: false,
|
|
20377
|
-
style: {
|
|
20488
|
+
style: scaleCssProperties({
|
|
20378
20489
|
backgroundColor: resolveSheetSurface(activeSheet, palette),
|
|
20379
20490
|
borderBottom: "none",
|
|
20380
20491
|
borderRight: "none",
|
|
@@ -20382,7 +20493,7 @@ function XlsxGrid({
|
|
|
20382
20493
|
padding: DEFAULT_CELL_PADDING,
|
|
20383
20494
|
verticalAlign: "bottom",
|
|
20384
20495
|
whiteSpace: "nowrap"
|
|
20385
|
-
},
|
|
20496
|
+
}, zoomFactor),
|
|
20386
20497
|
value: ""
|
|
20387
20498
|
};
|
|
20388
20499
|
cellRenderCacheRef.current.set(cacheKey, emptyData);
|
|
@@ -20461,9 +20572,9 @@ function XlsxGrid({
|
|
|
20461
20572
|
isTableHeader: Boolean(table && row >= table.start.row && row < table.start.row + headerRowCount),
|
|
20462
20573
|
rowSpan: merge?.rowSpan,
|
|
20463
20574
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
20464
|
-
style: buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20575
|
+
style: scaleCssProperties(buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20465
20576
|
showGridLines: activeSheet?.showGridLines
|
|
20466
|
-
}),
|
|
20577
|
+
}), zoomFactor),
|
|
20467
20578
|
validation: resolveCellDataValidation(row, col, activeSheet),
|
|
20468
20579
|
value: sparkline ? "" : checkboxState !== null ? "" : batchCoversRow || !worksheet ? batchedCell?.value ?? "" : getCellDisplayValue(worksheet, row, col, activeSheet)
|
|
20469
20580
|
};
|
|
@@ -20473,7 +20584,7 @@ function XlsxGrid({
|
|
|
20473
20584
|
const horizontalPadding = getHorizontalPadding(nextData.style.padding);
|
|
20474
20585
|
const textWidth = measureTextWidth(nextData.value, nextData.style);
|
|
20475
20586
|
const requiredWidth = textWidth + horizontalPadding + 2;
|
|
20476
|
-
let availableWidth =
|
|
20587
|
+
let availableWidth = displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth;
|
|
20477
20588
|
if (requiredWidth > availableWidth) {
|
|
20478
20589
|
for (let nextColIndex = startColIndex + 1; nextColIndex < visibleCols.length; nextColIndex += 1) {
|
|
20479
20590
|
const nextActualCol = visibleCols[nextColIndex];
|
|
@@ -20484,12 +20595,12 @@ function XlsxGrid({
|
|
|
20484
20595
|
if (!canReceiveOverflowText(neighborData)) {
|
|
20485
20596
|
break;
|
|
20486
20597
|
}
|
|
20487
|
-
availableWidth +=
|
|
20598
|
+
availableWidth += displayEffectiveColWidths[nextColIndex] ?? displayDefaultColWidth;
|
|
20488
20599
|
if (requiredWidth <= availableWidth) {
|
|
20489
20600
|
break;
|
|
20490
20601
|
}
|
|
20491
20602
|
}
|
|
20492
|
-
if (availableWidth > (
|
|
20603
|
+
if (availableWidth > (displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth)) {
|
|
20493
20604
|
nextData.spillWidth = Math.max(0, availableWidth - horizontalPadding);
|
|
20494
20605
|
}
|
|
20495
20606
|
}
|
|
@@ -20497,7 +20608,7 @@ function XlsxGrid({
|
|
|
20497
20608
|
}
|
|
20498
20609
|
cellRenderCacheRef.current.set(cacheKey, nextData);
|
|
20499
20610
|
return nextData;
|
|
20500
|
-
}, [activeSheet, colIndexByActual,
|
|
20611
|
+
}, [activeSheet, colIndexByActual, displayDefaultColWidth, displayEffectiveColWidths, effectiveTables, palette, sparklinesByCell, viewportRowBatch, visibleCols, worksheet, zoomFactor]);
|
|
20501
20612
|
React4.useEffect(() => {
|
|
20502
20613
|
conditionalFormatMetricsCacheRef.current.clear();
|
|
20503
20614
|
}, [activeSheet?.conditionalFormatRules, activeSheet?.workbookSheetIndex, revision]);
|
|
@@ -20515,11 +20626,11 @@ function XlsxGrid({
|
|
|
20515
20626
|
}
|
|
20516
20627
|
return {
|
|
20517
20628
|
height: sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex),
|
|
20518
|
-
left:
|
|
20519
|
-
top:
|
|
20629
|
+
left: displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1),
|
|
20630
|
+
top: displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1),
|
|
20520
20631
|
width: sumPrefixRange(colPrefixSums, startColIndex, endColIndex)
|
|
20521
20632
|
};
|
|
20522
|
-
}, [colIndexByActual, colPrefixSums, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20633
|
+
}, [colIndexByActual, colPrefixSums, displayHeaderHeight, displayRowHeaderWidth, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20523
20634
|
const resolvedSelectionOverlay = selectionOverlay;
|
|
20524
20635
|
const virtualCols = React4.useMemo(
|
|
20525
20636
|
() => shouldVirtualizeCols ? colVirtualizer.getVirtualItems().map((virtualCol) => ({
|
|
@@ -20532,10 +20643,10 @@ function XlsxGrid({
|
|
|
20532
20643
|
end: colPrefixSums[index + 1] ?? 0,
|
|
20533
20644
|
index,
|
|
20534
20645
|
key: visibleCols[index] ?? index,
|
|
20535
|
-
size:
|
|
20646
|
+
size: displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
20536
20647
|
start: colPrefixSums[index] ?? 0
|
|
20537
20648
|
})),
|
|
20538
|
-
[colPrefixSums, colVirtualizer,
|
|
20649
|
+
[colPrefixSums, colVirtualizer, displayDefaultColWidth, displayEffectiveColWidths, shouldVirtualizeCols, visibleCols]
|
|
20539
20650
|
);
|
|
20540
20651
|
const renderedCols = React4.useMemo(
|
|
20541
20652
|
() => {
|
|
@@ -20554,7 +20665,7 @@ function XlsxGrid({
|
|
|
20554
20665
|
});
|
|
20555
20666
|
return columns;
|
|
20556
20667
|
},
|
|
20557
|
-
[
|
|
20668
|
+
[virtualCols, visibleCols]
|
|
20558
20669
|
);
|
|
20559
20670
|
const totalContentWidth = colPrefixSums[colPrefixSums.length - 1] ?? 0;
|
|
20560
20671
|
const leadingColumnSpacerWidth = shouldVirtualizeCols ? virtualCols[0]?.start ?? 0 : 0;
|
|
@@ -20562,12 +20673,14 @@ function XlsxGrid({
|
|
|
20562
20673
|
const imageRects = React4.useMemo(
|
|
20563
20674
|
() => showImages ? images.map((image) => ({
|
|
20564
20675
|
image,
|
|
20565
|
-
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols,
|
|
20676
|
+
rect: imagePreviewRect && imagePreviewRect.id === image.id ? imagePreviewRect.rect : resolveImageRect(image, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20566
20677
|
actualColPrefixSums,
|
|
20567
20678
|
actualRowPrefixSums,
|
|
20568
20679
|
colIndexByActual,
|
|
20569
20680
|
colPrefixSums,
|
|
20681
|
+
headerHeight: displayHeaderHeight,
|
|
20570
20682
|
rowIndexByActual,
|
|
20683
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20571
20684
|
rowPrefixSums
|
|
20572
20685
|
})
|
|
20573
20686
|
})) : [],
|
|
@@ -20576,8 +20689,10 @@ function XlsxGrid({
|
|
|
20576
20689
|
colPrefixSums,
|
|
20577
20690
|
actualColPrefixSums,
|
|
20578
20691
|
actualRowPrefixSums,
|
|
20579
|
-
|
|
20580
|
-
|
|
20692
|
+
displayHeaderHeight,
|
|
20693
|
+
displayEffectiveColWidths,
|
|
20694
|
+
displayEffectiveRowHeights,
|
|
20695
|
+
displayRowHeaderWidth,
|
|
20581
20696
|
imagePreviewRect,
|
|
20582
20697
|
images,
|
|
20583
20698
|
rowIndexByActual,
|
|
@@ -20589,12 +20704,14 @@ function XlsxGrid({
|
|
|
20589
20704
|
);
|
|
20590
20705
|
const shapeRects = React4.useMemo(
|
|
20591
20706
|
() => showImages ? shapes.map((shape) => ({
|
|
20592
|
-
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols,
|
|
20707
|
+
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20593
20708
|
actualColPrefixSums,
|
|
20594
20709
|
actualRowPrefixSums,
|
|
20595
20710
|
colIndexByActual,
|
|
20596
20711
|
colPrefixSums,
|
|
20712
|
+
headerHeight: displayHeaderHeight,
|
|
20597
20713
|
rowIndexByActual,
|
|
20714
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20598
20715
|
rowPrefixSums
|
|
20599
20716
|
}),
|
|
20600
20717
|
shape
|
|
@@ -20604,8 +20721,10 @@ function XlsxGrid({
|
|
|
20604
20721
|
colPrefixSums,
|
|
20605
20722
|
actualColPrefixSums,
|
|
20606
20723
|
actualRowPrefixSums,
|
|
20607
|
-
|
|
20608
|
-
|
|
20724
|
+
displayHeaderHeight,
|
|
20725
|
+
displayEffectiveColWidths,
|
|
20726
|
+
displayEffectiveRowHeights,
|
|
20727
|
+
displayRowHeaderWidth,
|
|
20609
20728
|
rowIndexByActual,
|
|
20610
20729
|
rowPrefixSums,
|
|
20611
20730
|
shapes,
|
|
@@ -20617,12 +20736,14 @@ function XlsxGrid({
|
|
|
20617
20736
|
const chartRects = React4.useMemo(
|
|
20618
20737
|
() => showImages ? charts.map((chart) => ({
|
|
20619
20738
|
chart,
|
|
20620
|
-
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols,
|
|
20739
|
+
rect: chartPreviewRect && chartPreviewRect.id === chart.id ? chartPreviewRect.rect : resolveAnchoredRect(chart.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20621
20740
|
actualColPrefixSums,
|
|
20622
20741
|
actualRowPrefixSums,
|
|
20623
20742
|
colIndexByActual,
|
|
20624
20743
|
colPrefixSums,
|
|
20744
|
+
headerHeight: displayHeaderHeight,
|
|
20625
20745
|
rowIndexByActual,
|
|
20746
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20626
20747
|
rowPrefixSums
|
|
20627
20748
|
})
|
|
20628
20749
|
})) : [],
|
|
@@ -20633,8 +20754,10 @@ function XlsxGrid({
|
|
|
20633
20754
|
charts,
|
|
20634
20755
|
colIndexByActual,
|
|
20635
20756
|
colPrefixSums,
|
|
20636
|
-
|
|
20637
|
-
|
|
20757
|
+
displayHeaderHeight,
|
|
20758
|
+
displayEffectiveColWidths,
|
|
20759
|
+
displayEffectiveRowHeights,
|
|
20760
|
+
displayRowHeaderWidth,
|
|
20638
20761
|
rowIndexByActual,
|
|
20639
20762
|
rowPrefixSums,
|
|
20640
20763
|
showImages,
|
|
@@ -20680,15 +20803,15 @@ function XlsxGrid({
|
|
|
20680
20803
|
if (startRowIndex === void 0 || endRowIndex === void 0 || startColIndex === void 0 || endColIndex === void 0) {
|
|
20681
20804
|
return null;
|
|
20682
20805
|
}
|
|
20683
|
-
let left =
|
|
20684
|
-
let top =
|
|
20806
|
+
let left = displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1);
|
|
20807
|
+
let top = displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1);
|
|
20685
20808
|
let width = sumPrefixRange(colPrefixSums, startColIndex, endColIndex);
|
|
20686
20809
|
let height = sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex);
|
|
20687
20810
|
const columnPreview = columnPreviewRef.current;
|
|
20688
20811
|
if (columnPreview) {
|
|
20689
20812
|
const previewIndex = colIndexByActual.get(columnPreview.actualIndex);
|
|
20690
20813
|
if (previewIndex !== void 0) {
|
|
20691
|
-
const baseWidth =
|
|
20814
|
+
const baseWidth = displayEffectiveColWidths[previewIndex] ?? displayDefaultColWidth;
|
|
20692
20815
|
const widthDelta = columnPreview.size - baseWidth;
|
|
20693
20816
|
if (previewIndex < startColIndex) {
|
|
20694
20817
|
left += widthDelta;
|
|
@@ -20702,7 +20825,7 @@ function XlsxGrid({
|
|
|
20702
20825
|
if (rowPreview) {
|
|
20703
20826
|
const previewIndex = rowIndexByActual.get(rowPreview.actualIndex);
|
|
20704
20827
|
if (previewIndex !== void 0) {
|
|
20705
|
-
const baseHeight =
|
|
20828
|
+
const baseHeight = displayEffectiveRowHeights[previewIndex] ?? displayDefaultRowHeight;
|
|
20706
20829
|
const heightDelta = rowPreview.size - baseHeight;
|
|
20707
20830
|
if (previewIndex < startRowIndex) {
|
|
20708
20831
|
top += heightDelta;
|
|
@@ -20714,11 +20837,11 @@ function XlsxGrid({
|
|
|
20714
20837
|
}
|
|
20715
20838
|
return {
|
|
20716
20839
|
height: Math.max(0, height),
|
|
20717
|
-
left: Math.max(
|
|
20718
|
-
top: Math.max(
|
|
20840
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20841
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20719
20842
|
width: Math.max(0, width)
|
|
20720
20843
|
};
|
|
20721
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20844
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, displayHeaderHeight, displayRowHeaderWidth, rowIndexByActual, rowPrefixSums]);
|
|
20722
20845
|
const resolveMountedRangeOverlayRect = React4.useCallback((range, geometryRect) => {
|
|
20723
20846
|
const normalized = normalizeRange2(range);
|
|
20724
20847
|
const startRect = resolveMountedCellOverlayRectForAddress(normalized.start);
|
|
@@ -20735,11 +20858,11 @@ function XlsxGrid({
|
|
|
20735
20858
|
const bottom = bottomRect ? bottomRect.top + bottomRect.height : geometryRect.top + geometryRect.height;
|
|
20736
20859
|
return {
|
|
20737
20860
|
height: Math.max(0, bottom - top),
|
|
20738
|
-
left: Math.max(
|
|
20739
|
-
top: Math.max(
|
|
20861
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20862
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20740
20863
|
width: Math.max(0, right - left)
|
|
20741
20864
|
};
|
|
20742
|
-
}, [resolveMountedCellOverlayRectForAddress]);
|
|
20865
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, resolveMountedCellOverlayRectForAddress]);
|
|
20743
20866
|
const resolveDragPreviewRect = React4.useCallback((range) => {
|
|
20744
20867
|
const dragState = selectionDragRef.current;
|
|
20745
20868
|
if (!dragState || !dragState.didDrag || dragState.axis !== "cell" || !dragState.originOverlayRect) {
|
|
@@ -20857,11 +20980,11 @@ function XlsxGrid({
|
|
|
20857
20980
|
overlay.style.visibility = "visible";
|
|
20858
20981
|
const fillHandle = fillHandleRef.current;
|
|
20859
20982
|
if (fillHandle) {
|
|
20860
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20861
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
20983
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
20984
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20862
20985
|
}
|
|
20863
20986
|
applyHeaderSelection(range);
|
|
20864
|
-
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect]);
|
|
20987
|
+
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20865
20988
|
const applyPreviewOverlayFromElement = React4.useCallback((element, range) => {
|
|
20866
20989
|
const overlay = selectionOverlayRef.current;
|
|
20867
20990
|
if (!overlay) {
|
|
@@ -20880,11 +21003,11 @@ function XlsxGrid({
|
|
|
20880
21003
|
overlay.style.visibility = "visible";
|
|
20881
21004
|
const fillHandle = fillHandleRef.current;
|
|
20882
21005
|
if (fillHandle) {
|
|
20883
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20884
|
-
fillHandle.style.top = `${nextRect.top + nextRect.height - 4}px`;
|
|
21006
|
+
fillHandle.style.left = `${nextRect.left + nextRect.width - 4 * zoomFactor}px`;
|
|
21007
|
+
fillHandle.style.top = `${nextRect.top + nextRect.height - 4 * zoomFactor}px`;
|
|
20885
21008
|
}
|
|
20886
21009
|
applyHeaderSelection(range);
|
|
20887
|
-
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect]);
|
|
21010
|
+
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20888
21011
|
const syncActiveValidationOverlay = React4.useCallback((cell) => {
|
|
20889
21012
|
const overlay = activeValidationOverlayRef.current;
|
|
20890
21013
|
if (!overlay || !cell || editingCellRef.current || selectionDragRef.current || fillDragRef.current) {
|
|
@@ -20902,11 +21025,11 @@ function XlsxGrid({
|
|
|
20902
21025
|
overlay.style.visibility = "hidden";
|
|
20903
21026
|
return;
|
|
20904
21027
|
}
|
|
20905
|
-
overlay.style.left = `${rect.left + rect.width - 16}px`;
|
|
21028
|
+
overlay.style.left = `${rect.left + rect.width - 16 * zoomFactor}px`;
|
|
20906
21029
|
overlay.style.top = `${rect.top + rect.height / 2}px`;
|
|
20907
21030
|
overlay.style.opacity = "1";
|
|
20908
21031
|
overlay.style.visibility = "visible";
|
|
20909
|
-
}, [getCellData, resolveOverlayRect]);
|
|
21032
|
+
}, [getCellData, resolveOverlayRect, zoomFactor]);
|
|
20910
21033
|
const commitSelectionRange = React4.useCallback((range) => {
|
|
20911
21034
|
const normalized = normalizeRange2(range);
|
|
20912
21035
|
if (selectionRef.current && rangesEqual(selectionRef.current, normalized) && isSameCell(activeCellRef.current, normalized.end) && selectedChartIdRef.current === null && selectedImageIdRef.current === null) {
|
|
@@ -20944,7 +21067,7 @@ function XlsxGrid({
|
|
|
20944
21067
|
}
|
|
20945
21068
|
pendingResizePreviewRef.current = {
|
|
20946
21069
|
actualIndex: state.actualIndex,
|
|
20947
|
-
size: state.type === "column" ? Math.max(
|
|
21070
|
+
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
21071
|
type: state.type
|
|
20949
21072
|
};
|
|
20950
21073
|
if (resizeFrameRef.current !== null) {
|
|
@@ -20991,9 +21114,9 @@ function XlsxGrid({
|
|
|
20991
21114
|
}
|
|
20992
21115
|
if (preview && preview.actualIndex === resizeState.actualIndex && preview.type === resizeState.type) {
|
|
20993
21116
|
if (preview.type === "column") {
|
|
20994
|
-
controller.resizeColumn(preview.actualIndex, preview.size);
|
|
21117
|
+
controller.resizeColumn(preview.actualIndex, preview.size / zoomFactor);
|
|
20995
21118
|
} else {
|
|
20996
|
-
controller.resizeRow(preview.actualIndex, preview.size);
|
|
21119
|
+
controller.resizeRow(preview.actualIndex, preview.size / zoomFactor);
|
|
20997
21120
|
}
|
|
20998
21121
|
}
|
|
20999
21122
|
}
|
|
@@ -21010,7 +21133,7 @@ function XlsxGrid({
|
|
|
21010
21133
|
resizeFrameRef.current = null;
|
|
21011
21134
|
}
|
|
21012
21135
|
};
|
|
21013
|
-
}, [applyColumnPreview, applyRowPreview, controller, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21136
|
+
}, [applyColumnPreview, applyRowPreview, controller, displayDefaultColWidth, displayDefaultRowHeight, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21014
21137
|
function buildDraggedSelectionRange(dragState, cell) {
|
|
21015
21138
|
if (dragState.axis === "row") {
|
|
21016
21139
|
if (firstVisibleCol === void 0 || lastVisibleCol === void 0) {
|
|
@@ -21339,21 +21462,21 @@ function XlsxGrid({
|
|
|
21339
21462
|
color: palette.mutedText,
|
|
21340
21463
|
cursor: "pointer",
|
|
21341
21464
|
display: "inline-flex",
|
|
21342
|
-
fontSize: 10,
|
|
21343
|
-
height: 16,
|
|
21465
|
+
fontSize: 10 * zoomFactor,
|
|
21466
|
+
height: 16 * zoomFactor,
|
|
21344
21467
|
justifyContent: "center",
|
|
21345
21468
|
padding: 0,
|
|
21346
21469
|
position: "absolute",
|
|
21347
|
-
right: 4,
|
|
21348
|
-
top: 3,
|
|
21349
|
-
width: 16,
|
|
21470
|
+
right: 4 * zoomFactor,
|
|
21471
|
+
top: 3 * zoomFactor,
|
|
21472
|
+
width: 16 * zoomFactor,
|
|
21350
21473
|
zIndex: 6
|
|
21351
21474
|
},
|
|
21352
21475
|
type: "button",
|
|
21353
21476
|
children: direction === "ascending" ? "\u25B2" : direction === "descending" ? "\u25BC" : "\u25BE"
|
|
21354
21477
|
}
|
|
21355
21478
|
);
|
|
21356
|
-
}, [effectiveTables, palette.mutedText, sortState]);
|
|
21479
|
+
}, [effectiveTables, palette.mutedText, sortState, zoomFactor]);
|
|
21357
21480
|
const startChartMove = React4.useCallback((event, chart, rect) => {
|
|
21358
21481
|
if (event.button !== 0) {
|
|
21359
21482
|
return;
|
|
@@ -21559,7 +21682,7 @@ function XlsxGrid({
|
|
|
21559
21682
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21560
21683
|
index,
|
|
21561
21684
|
key: actualRow,
|
|
21562
|
-
size:
|
|
21685
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21563
21686
|
start: rowPrefixSums[index] ?? 0
|
|
21564
21687
|
})) : (() => {
|
|
21565
21688
|
const renderedRowsByIndex = /* @__PURE__ */ new Map();
|
|
@@ -21580,27 +21703,25 @@ function XlsxGrid({
|
|
|
21580
21703
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21581
21704
|
index,
|
|
21582
21705
|
key: visibleRows[index] ?? index,
|
|
21583
|
-
size:
|
|
21706
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21584
21707
|
start: rowPrefixSums[index] ?? 0
|
|
21585
21708
|
});
|
|
21586
21709
|
});
|
|
21587
21710
|
return Array.from(renderedRowsByIndex.values()).sort((left, right) => left.index - right.index);
|
|
21588
21711
|
})();
|
|
21589
21712
|
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;
|
|
21713
|
+
const totalWidth = totalContentWidth + displayRowHeaderWidth;
|
|
21714
|
+
const sheetContentHeight = displayHeaderHeight + totalHeight;
|
|
21594
21715
|
const { fill: selectionFill, header: selectionHeaderSurface, stroke: selectionStroke } = resolveSelectionColors({
|
|
21595
21716
|
palette,
|
|
21596
21717
|
selectionColor,
|
|
21597
21718
|
selectionFillColor,
|
|
21598
21719
|
selectionHeaderColor
|
|
21599
21720
|
});
|
|
21600
|
-
const selectionBorderWidth = 1;
|
|
21721
|
+
const selectionBorderWidth = Math.max(1, zoomFactor);
|
|
21601
21722
|
const rowColSpan = renderedCols.length + 1 + (leadingColumnSpacerWidth > 0 ? 1 : 0) + (trailingColumnSpacerWidth > 0 ? 1 : 0);
|
|
21602
21723
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
21603
|
-
const headerCellStyle = {
|
|
21724
|
+
const headerCellStyle = scaleCssProperties({
|
|
21604
21725
|
backgroundColor: palette.headerSurface,
|
|
21605
21726
|
borderBottom: "none",
|
|
21606
21727
|
borderRight: "none",
|
|
@@ -21617,8 +21738,8 @@ function XlsxGrid({
|
|
|
21617
21738
|
userSelect: "none",
|
|
21618
21739
|
whiteSpace: "nowrap",
|
|
21619
21740
|
zIndex: 50
|
|
21620
|
-
};
|
|
21621
|
-
const columnResizeHandleStyle = {
|
|
21741
|
+
}, zoomFactor);
|
|
21742
|
+
const columnResizeHandleStyle = scaleCssProperties({
|
|
21622
21743
|
backgroundColor: "transparent",
|
|
21623
21744
|
cursor: "col-resize",
|
|
21624
21745
|
position: "absolute",
|
|
@@ -21627,17 +21748,23 @@ function XlsxGrid({
|
|
|
21627
21748
|
width: 16,
|
|
21628
21749
|
height: "100%",
|
|
21629
21750
|
zIndex: 5
|
|
21630
|
-
};
|
|
21751
|
+
}, zoomFactor);
|
|
21631
21752
|
function resolveDrawingPane(rect) {
|
|
21632
21753
|
return resolveFrozenDrawingPane(
|
|
21633
21754
|
rect,
|
|
21634
21755
|
frozenRows,
|
|
21635
21756
|
frozenCols,
|
|
21636
|
-
|
|
21637
|
-
|
|
21757
|
+
displayActualRowHeights,
|
|
21758
|
+
displayActualColWidths,
|
|
21638
21759
|
activeSheet?.freezePanes ?? null,
|
|
21639
21760
|
stickyTopByRow,
|
|
21640
|
-
stickyLeftByCol
|
|
21761
|
+
stickyLeftByCol,
|
|
21762
|
+
{
|
|
21763
|
+
defaultColWidth: displayDefaultColWidth,
|
|
21764
|
+
defaultRowHeight: displayDefaultRowHeight,
|
|
21765
|
+
headerHeight: displayHeaderHeight,
|
|
21766
|
+
rowHeaderWidth: displayRowHeaderWidth
|
|
21767
|
+
}
|
|
21641
21768
|
);
|
|
21642
21769
|
}
|
|
21643
21770
|
function renderShapeDrawing(shape, rect, pane) {
|
|
@@ -21654,12 +21781,12 @@ function XlsxGrid({
|
|
|
21654
21781
|
const groupScaleX = shape.scaleX ?? 1;
|
|
21655
21782
|
const groupScaleY = shape.scaleY ?? 1;
|
|
21656
21783
|
const strokeScale = Math.max(groupScaleX, groupScaleY);
|
|
21657
|
-
const textScale = strokeScale;
|
|
21784
|
+
const textScale = strokeScale * zoomFactor;
|
|
21658
21785
|
const textWidth = groupScaleX !== 0 ? rect.width / groupScaleX : rect.width;
|
|
21659
21786
|
const textHeight = groupScaleY !== 0 ? rect.height / groupScaleY : rect.height;
|
|
21660
21787
|
const vectorShape = resolveShapeVector(shape);
|
|
21661
21788
|
const strokeColor = shape.stroke?.none ? "transparent" : shape.stroke?.color ?? "transparent";
|
|
21662
|
-
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale;
|
|
21789
|
+
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale * zoomFactor;
|
|
21663
21790
|
const headMarkerId = `${shape.id}-${pane}-head-marker`;
|
|
21664
21791
|
const tailMarkerId = `${shape.id}-${pane}-tail-marker`;
|
|
21665
21792
|
const headMarker = vectorShape ? resolveShapeLineEndMarker(
|
|
@@ -21679,7 +21806,7 @@ function XlsxGrid({
|
|
|
21679
21806
|
vectorShape.viewBox
|
|
21680
21807
|
) : null;
|
|
21681
21808
|
const style = {
|
|
21682
|
-
...buildShapeContainerStyle(shape, rect),
|
|
21809
|
+
...buildShapeContainerStyle(shape, rect, zoomFactor),
|
|
21683
21810
|
...vectorShape ? {
|
|
21684
21811
|
backgroundColor: "transparent",
|
|
21685
21812
|
border: "none"
|
|
@@ -21742,13 +21869,13 @@ function XlsxGrid({
|
|
|
21742
21869
|
display: "flex",
|
|
21743
21870
|
flex: 1,
|
|
21744
21871
|
flexDirection: "column",
|
|
21745
|
-
gap: 2,
|
|
21872
|
+
gap: 2 * zoomFactor,
|
|
21746
21873
|
height: textHeight,
|
|
21747
21874
|
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,
|
|
21875
|
+
paddingBottom: (inset?.bottom ?? 4) * zoomFactor,
|
|
21876
|
+
paddingLeft: (inset?.left ?? 6) * zoomFactor,
|
|
21877
|
+
paddingRight: (inset?.right ?? 6) * zoomFactor,
|
|
21878
|
+
paddingTop: (inset?.top ?? 4) * zoomFactor,
|
|
21752
21879
|
pointerEvents: "none",
|
|
21753
21880
|
position: "relative",
|
|
21754
21881
|
transform: groupScaleX !== 1 || groupScaleY !== 1 ? `scale(${groupScaleX}, ${groupScaleY})` : void 0,
|
|
@@ -21820,8 +21947,8 @@ function XlsxGrid({
|
|
|
21820
21947
|
"div",
|
|
21821
21948
|
{
|
|
21822
21949
|
style: {
|
|
21823
|
-
border:
|
|
21824
|
-
boxShadow: `0 0 0
|
|
21950
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
21951
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21825
21952
|
boxSizing: "border-box",
|
|
21826
21953
|
inset: 0,
|
|
21827
21954
|
pointerEvents: "none",
|
|
@@ -21831,7 +21958,7 @@ function XlsxGrid({
|
|
|
21831
21958
|
"div",
|
|
21832
21959
|
{
|
|
21833
21960
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21834
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21961
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21835
21962
|
},
|
|
21836
21963
|
position
|
|
21837
21964
|
)) : null
|
|
@@ -21843,7 +21970,7 @@ function XlsxGrid({
|
|
|
21843
21970
|
startImageResize(event, image, rect, position);
|
|
21844
21971
|
}
|
|
21845
21972
|
},
|
|
21846
|
-
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface), display: "none" }
|
|
21973
|
+
style: canEditImage ? resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor) : { ...resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor), display: "none" }
|
|
21847
21974
|
}),
|
|
21848
21975
|
image,
|
|
21849
21976
|
rect
|
|
@@ -21851,8 +21978,8 @@ function XlsxGrid({
|
|
|
21851
21978
|
"div",
|
|
21852
21979
|
{
|
|
21853
21980
|
style: {
|
|
21854
|
-
border:
|
|
21855
|
-
boxShadow: `0 0 0
|
|
21981
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
21982
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21856
21983
|
boxSizing: "border-box",
|
|
21857
21984
|
inset: 0,
|
|
21858
21985
|
pointerEvents: "none",
|
|
@@ -21862,7 +21989,7 @@ function XlsxGrid({
|
|
|
21862
21989
|
"div",
|
|
21863
21990
|
{
|
|
21864
21991
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21865
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21992
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21866
21993
|
},
|
|
21867
21994
|
position
|
|
21868
21995
|
)) : null
|
|
@@ -21924,8 +22051,8 @@ function XlsxGrid({
|
|
|
21924
22051
|
"div",
|
|
21925
22052
|
{
|
|
21926
22053
|
style: {
|
|
21927
|
-
border:
|
|
21928
|
-
boxShadow: `0 0 0
|
|
22054
|
+
border: `${Math.max(1, zoomFactor)}px solid ${selectionStroke}`,
|
|
22055
|
+
boxShadow: `0 0 0 ${Math.max(1, zoomFactor)}px ${palette.surface}`,
|
|
21929
22056
|
boxSizing: "border-box",
|
|
21930
22057
|
inset: 0,
|
|
21931
22058
|
pointerEvents: "none",
|
|
@@ -21935,7 +22062,7 @@ function XlsxGrid({
|
|
|
21935
22062
|
"div",
|
|
21936
22063
|
{
|
|
21937
22064
|
onPointerDown: (event) => startChartResize(event, chart, rect, position),
|
|
21938
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
22065
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21939
22066
|
},
|
|
21940
22067
|
position
|
|
21941
22068
|
)) : null
|
|
@@ -22171,8 +22298,8 @@ function XlsxGrid({
|
|
|
22171
22298
|
if (!interaction) {
|
|
22172
22299
|
return;
|
|
22173
22300
|
}
|
|
22174
|
-
const deltaX =
|
|
22175
|
-
const deltaY =
|
|
22301
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22302
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22176
22303
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22177
22304
|
interaction.didMove = true;
|
|
22178
22305
|
}
|
|
@@ -22181,7 +22308,12 @@ function XlsxGrid({
|
|
|
22181
22308
|
...interaction.baseRect,
|
|
22182
22309
|
left: interaction.baseRect.left + deltaX,
|
|
22183
22310
|
top: interaction.baseRect.top + deltaY
|
|
22184
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY,
|
|
22311
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, displayImageMinSize),
|
|
22312
|
+
{
|
|
22313
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22314
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22315
|
+
minSizePx: displayImageMinSize
|
|
22316
|
+
}
|
|
22185
22317
|
);
|
|
22186
22318
|
scheduleImagePreviewRect({ id: interaction.imageId, rect: nextRect });
|
|
22187
22319
|
};
|
|
@@ -22216,7 +22348,7 @@ function XlsxGrid({
|
|
|
22216
22348
|
if (interaction.didMove) {
|
|
22217
22349
|
skipNextImageClickRef.current = interaction.imageId;
|
|
22218
22350
|
}
|
|
22219
|
-
setImageRect(interaction.imageId, preview.rect);
|
|
22351
|
+
setImageRect(interaction.imageId, toLogicalRect(preview.rect));
|
|
22220
22352
|
}
|
|
22221
22353
|
imagePreviewRectRef.current = null;
|
|
22222
22354
|
setImagePreviewRect(null);
|
|
@@ -22236,8 +22368,8 @@ function XlsxGrid({
|
|
|
22236
22368
|
if (!interaction) {
|
|
22237
22369
|
return;
|
|
22238
22370
|
}
|
|
22239
|
-
const deltaX =
|
|
22240
|
-
const deltaY =
|
|
22371
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22372
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22241
22373
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22242
22374
|
interaction.didMove = true;
|
|
22243
22375
|
}
|
|
@@ -22246,7 +22378,12 @@ function XlsxGrid({
|
|
|
22246
22378
|
...interaction.baseRect,
|
|
22247
22379
|
left: interaction.baseRect.left + deltaX,
|
|
22248
22380
|
top: interaction.baseRect.top + deltaY
|
|
22249
|
-
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48)
|
|
22381
|
+
} : resizeImageRect(interaction.baseRect, interaction.handle, deltaX, deltaY, 48 * zoomFactor),
|
|
22382
|
+
{
|
|
22383
|
+
contentOffsetLeft: displayRowHeaderWidth,
|
|
22384
|
+
contentOffsetTop: displayHeaderHeight,
|
|
22385
|
+
minSizePx: 48 * zoomFactor
|
|
22386
|
+
}
|
|
22250
22387
|
);
|
|
22251
22388
|
scheduleChartPreviewRect({ id: interaction.chartId, rect: nextRect });
|
|
22252
22389
|
};
|
|
@@ -22281,7 +22418,7 @@ function XlsxGrid({
|
|
|
22281
22418
|
if (interaction.didMove) {
|
|
22282
22419
|
skipNextChartClickRef.current = interaction.chartId;
|
|
22283
22420
|
}
|
|
22284
|
-
setChartRect(interaction.chartId, preview.rect);
|
|
22421
|
+
setChartRect(interaction.chartId, toLogicalRect(preview.rect));
|
|
22285
22422
|
}
|
|
22286
22423
|
chartPreviewRectRef.current = null;
|
|
22287
22424
|
setChartPreviewRect(null);
|
|
@@ -22463,8 +22600,8 @@ function XlsxGrid({
|
|
|
22463
22600
|
minHeight: "100%",
|
|
22464
22601
|
minWidth: "100%",
|
|
22465
22602
|
position: "relative",
|
|
22466
|
-
width:
|
|
22467
|
-
height:
|
|
22603
|
+
width: totalWidth,
|
|
22604
|
+
height: sheetContentHeight
|
|
22468
22605
|
},
|
|
22469
22606
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
22470
22607
|
"div",
|
|
@@ -22475,9 +22612,6 @@ function XlsxGrid({
|
|
|
22475
22612
|
left: 0,
|
|
22476
22613
|
position: "absolute",
|
|
22477
22614
|
top: 0,
|
|
22478
|
-
transform: void 0,
|
|
22479
|
-
transformOrigin: "top left",
|
|
22480
|
-
zoom: useNativeZoomForStickyLayout ? zoomFactor : void 0,
|
|
22481
22615
|
width: totalWidth
|
|
22482
22616
|
},
|
|
22483
22617
|
children: [
|
|
@@ -22500,7 +22634,7 @@ function XlsxGrid({
|
|
|
22500
22634
|
},
|
|
22501
22635
|
children: [
|
|
22502
22636
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("colgroup", { children: [
|
|
22503
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width:
|
|
22637
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: displayRowHeaderWidth } }),
|
|
22504
22638
|
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: leadingColumnSpacerWidth } }) : null,
|
|
22505
22639
|
renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
22506
22640
|
"col",
|
|
@@ -22526,7 +22660,7 @@ function XlsxGrid({
|
|
|
22526
22660
|
...headerCellStyle,
|
|
22527
22661
|
backgroundColor: palette.headerSurface,
|
|
22528
22662
|
left: 0,
|
|
22529
|
-
width:
|
|
22663
|
+
width: displayRowHeaderWidth,
|
|
22530
22664
|
zIndex: 60
|
|
22531
22665
|
}
|
|
22532
22666
|
}
|
|
@@ -22601,10 +22735,12 @@ function XlsxGrid({
|
|
|
22601
22735
|
readOnly,
|
|
22602
22736
|
renderCellAdornment,
|
|
22603
22737
|
rowHeight: virtualRow.size,
|
|
22738
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
22604
22739
|
stickyLeftByCol,
|
|
22605
22740
|
stickyTop: stickyTopByRow.get(actualRow),
|
|
22606
22741
|
trailingSpacerWidth: trailingColumnSpacerWidth,
|
|
22607
|
-
visibleCols: renderedCols
|
|
22742
|
+
visibleCols: renderedCols,
|
|
22743
|
+
zoomFactor
|
|
22608
22744
|
},
|
|
22609
22745
|
virtualRow.key
|
|
22610
22746
|
)
|
|
@@ -22653,16 +22789,16 @@ function XlsxGrid({
|
|
|
22653
22789
|
alignItems: "center",
|
|
22654
22790
|
color: palette.mutedText,
|
|
22655
22791
|
display: "inline-flex",
|
|
22656
|
-
fontSize: 10,
|
|
22792
|
+
fontSize: 10 * zoomFactor,
|
|
22657
22793
|
fontWeight: 700,
|
|
22658
|
-
height: 16,
|
|
22794
|
+
height: 16 * zoomFactor,
|
|
22659
22795
|
justifyContent: "center",
|
|
22660
22796
|
opacity: 0,
|
|
22661
22797
|
pointerEvents: "none",
|
|
22662
22798
|
position: "absolute",
|
|
22663
22799
|
transform: "translateY(-50%)",
|
|
22664
22800
|
visibility: "hidden",
|
|
22665
|
-
width: 12,
|
|
22801
|
+
width: 12 * zoomFactor,
|
|
22666
22802
|
zIndex: 26
|
|
22667
22803
|
},
|
|
22668
22804
|
children: "\u25BE"
|
|
@@ -22682,16 +22818,16 @@ function XlsxGrid({
|
|
|
22682
22818
|
},
|
|
22683
22819
|
style: {
|
|
22684
22820
|
backgroundColor: selectionStroke,
|
|
22685
|
-
border:
|
|
22821
|
+
border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
|
|
22686
22822
|
contain: "layout paint",
|
|
22687
22823
|
cursor: "crosshair",
|
|
22688
22824
|
display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
|
|
22689
|
-
height: 8,
|
|
22690
|
-
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 : 0,
|
|
22825
|
+
height: 8 * zoomFactor,
|
|
22826
|
+
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
|
|
22691
22827
|
pointerEvents: "auto",
|
|
22692
22828
|
position: "absolute",
|
|
22693
|
-
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 : 0,
|
|
22694
|
-
width: 8,
|
|
22829
|
+
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
|
|
22830
|
+
width: 8 * zoomFactor,
|
|
22695
22831
|
zIndex: 25
|
|
22696
22832
|
}
|
|
22697
22833
|
}
|
|
@@ -22702,7 +22838,7 @@ function XlsxGrid({
|
|
|
22702
22838
|
ref: tableMenuRef,
|
|
22703
22839
|
style: {
|
|
22704
22840
|
color: palette.text,
|
|
22705
|
-
left: Math.max(
|
|
22841
|
+
left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
|
|
22706
22842
|
position: "absolute",
|
|
22707
22843
|
top: openTableMenuState.top,
|
|
22708
22844
|
zIndex: 50
|