@extend-ai/react-xlsx 0.1.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 +480 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +480 -332
- 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)}%`;
|
|
@@ -16009,6 +16095,7 @@ function darkenColor3(color, ratio) {
|
|
|
16009
16095
|
return mixRgbColor3(color, "#000000", ratio);
|
|
16010
16096
|
}
|
|
16011
16097
|
var ViewerContext = React4.createContext(null);
|
|
16098
|
+
var ViewerAppearanceContext = React4.createContext({ isDark: false });
|
|
16012
16099
|
function classNames(...values) {
|
|
16013
16100
|
return values.filter(Boolean).join(" ");
|
|
16014
16101
|
}
|
|
@@ -16166,7 +16253,9 @@ function resolveAxisStartOffset(actualIndex, actualIndices, sizes, indexByActual
|
|
|
16166
16253
|
return sumBeforeActualIndex(actualIndices, sizes, actualIndex);
|
|
16167
16254
|
}
|
|
16168
16255
|
function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWidths, options) {
|
|
16169
|
-
const
|
|
16256
|
+
const headerHeight = options?.headerHeight ?? HEADER_HEIGHT;
|
|
16257
|
+
const rowHeaderWidth = options?.rowHeaderWidth ?? ROW_HEADER_WIDTH;
|
|
16258
|
+
const resolveMarkerLeft = (col, colOffsetEmu) => rowHeaderWidth + resolveAxisStartOffset(
|
|
16170
16259
|
col,
|
|
16171
16260
|
visibleCols,
|
|
16172
16261
|
colWidths,
|
|
@@ -16174,7 +16263,7 @@ function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWi
|
|
|
16174
16263
|
options?.colPrefixSums,
|
|
16175
16264
|
options?.actualColPrefixSums
|
|
16176
16265
|
) + emuToPixels(colOffsetEmu);
|
|
16177
|
-
const resolveMarkerTop = (row, rowOffsetEmu) =>
|
|
16266
|
+
const resolveMarkerTop = (row, rowOffsetEmu) => headerHeight + resolveAxisStartOffset(
|
|
16178
16267
|
row,
|
|
16179
16268
|
visibleRows,
|
|
16180
16269
|
rowHeights,
|
|
@@ -16185,8 +16274,8 @@ function resolveAnchoredRect(anchor, visibleRows, visibleCols, rowHeights, colWi
|
|
|
16185
16274
|
if (anchor.kind === "absolute") {
|
|
16186
16275
|
return {
|
|
16187
16276
|
height: Math.max(1, emuToPixels(anchor.sizeEmu.cy)),
|
|
16188
|
-
left:
|
|
16189
|
-
top:
|
|
16277
|
+
left: rowHeaderWidth + emuToPixels(anchor.positionEmu.x),
|
|
16278
|
+
top: headerHeight + emuToPixels(anchor.positionEmu.y),
|
|
16190
16279
|
width: Math.max(1, emuToPixels(anchor.sizeEmu.cx))
|
|
16191
16280
|
};
|
|
16192
16281
|
}
|
|
@@ -16266,14 +16355,18 @@ function rectIntersectsViewport(rect, viewport, overscan = 240) {
|
|
|
16266
16355
|
const rectBottom = rect.top + rect.height;
|
|
16267
16356
|
return rectRight >= viewportLeft && rect.left <= viewportRight && rectBottom >= viewportTop && rect.top <= viewportBottom;
|
|
16268
16357
|
}
|
|
16269
|
-
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;
|
|
16270
16363
|
const frozenPaneBottom = freezePanes?.row && freezePanes.row > 0 && frozenRows.length > 0 ? frozenRows.reduce(
|
|
16271
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
16272
|
-
|
|
16364
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? headerHeight) + (actualRowHeights[row] ?? defaultRowHeight)),
|
|
16365
|
+
headerHeight
|
|
16273
16366
|
) : null;
|
|
16274
16367
|
const frozenPaneRight = freezePanes?.col && freezePanes.col > 0 && frozenCols.length > 0 ? frozenCols.reduce(
|
|
16275
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
16276
|
-
|
|
16368
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? rowHeaderWidth) + (actualColWidths[col] ?? defaultColWidth)),
|
|
16369
|
+
rowHeaderWidth
|
|
16277
16370
|
) : null;
|
|
16278
16371
|
const freezeTop = frozenPaneBottom !== null && rect.top + rect.height <= frozenPaneBottom + 0.5;
|
|
16279
16372
|
const freezeLeft = frozenPaneRight !== null && rect.left + rect.width <= frozenPaneRight + 0.5;
|
|
@@ -16288,8 +16381,8 @@ function resolveFrozenDrawingPane(rect, frozenRows, frozenCols, actualRowHeights
|
|
|
16288
16381
|
}
|
|
16289
16382
|
return "scroll";
|
|
16290
16383
|
}
|
|
16291
|
-
function buildShapeContainerStyle(shape, rect) {
|
|
16292
|
-
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;
|
|
16293
16386
|
const strokeColor = shape.stroke?.color ?? "transparent";
|
|
16294
16387
|
const fillColor = shape.fill?.none ? "transparent" : shape.fill?.color ?? "transparent";
|
|
16295
16388
|
const hasVisibleText = shape.paragraphs.some((paragraph) => paragraph.runs.some((run) => run.text.trim().length > 0));
|
|
@@ -16302,7 +16395,7 @@ function buildShapeContainerStyle(shape, rect) {
|
|
|
16302
16395
|
if (shape.geometry === "ellipse") {
|
|
16303
16396
|
borderRadius = "9999px";
|
|
16304
16397
|
} else if (shape.geometry === "roundRect") {
|
|
16305
|
-
borderRadius = 12;
|
|
16398
|
+
borderRadius = 12 * viewerScale;
|
|
16306
16399
|
}
|
|
16307
16400
|
return {
|
|
16308
16401
|
alignItems: shape.textBox?.verticalAlign === "middle" ? "center" : shape.textBox?.verticalAlign === "bottom" ? "flex-end" : "flex-start",
|
|
@@ -17230,25 +17323,29 @@ function renderShapeParagraph(paragraph, index, fallbackAlign = "left", textScal
|
|
|
17230
17323
|
index
|
|
17231
17324
|
);
|
|
17232
17325
|
}
|
|
17233
|
-
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;
|
|
17234
17330
|
return {
|
|
17235
|
-
height: Math.max(
|
|
17236
|
-
left: Math.max(
|
|
17237
|
-
top: Math.max(
|
|
17238
|
-
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)
|
|
17239
17335
|
};
|
|
17240
17336
|
}
|
|
17241
|
-
function resolveImageHandleStyle(position, stroke, surface) {
|
|
17242
|
-
const
|
|
17337
|
+
function resolveImageHandleStyle(position, stroke, surface, scale = 1) {
|
|
17338
|
+
const handleSize = IMAGE_HANDLE_SIZE_PX * scale;
|
|
17339
|
+
const offset = handleSize / 2;
|
|
17243
17340
|
const style = {
|
|
17244
17341
|
backgroundColor: surface,
|
|
17245
|
-
border:
|
|
17246
|
-
borderRadius: 6,
|
|
17342
|
+
border: `${Math.max(1, scale)}px solid ${stroke}`,
|
|
17343
|
+
borderRadius: 6 * scale,
|
|
17247
17344
|
cursor: IMAGE_HANDLE_CURSOR[position],
|
|
17248
|
-
height:
|
|
17345
|
+
height: handleSize,
|
|
17249
17346
|
pointerEvents: "auto",
|
|
17250
17347
|
position: "absolute",
|
|
17251
|
-
width:
|
|
17348
|
+
width: handleSize
|
|
17252
17349
|
};
|
|
17253
17350
|
if (position.includes("n")) {
|
|
17254
17351
|
style.top = -offset;
|
|
@@ -17270,40 +17367,8 @@ function resolveImageHandleStyle(position, stroke, surface) {
|
|
|
17270
17367
|
}
|
|
17271
17368
|
return style;
|
|
17272
17369
|
}
|
|
17273
|
-
function
|
|
17274
|
-
|
|
17275
|
-
return false;
|
|
17276
|
-
}
|
|
17277
|
-
const classList = document.documentElement.classList;
|
|
17278
|
-
if (classList.contains("dark")) {
|
|
17279
|
-
return true;
|
|
17280
|
-
}
|
|
17281
|
-
if (classList.contains("light")) {
|
|
17282
|
-
return false;
|
|
17283
|
-
}
|
|
17284
|
-
return typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
17285
|
-
}
|
|
17286
|
-
function useViewerPalette() {
|
|
17287
|
-
const [isDarkMode, setIsDarkMode] = React4.useState(resolveIsDarkMode);
|
|
17288
|
-
React4.useEffect(() => {
|
|
17289
|
-
if (typeof window === "undefined") {
|
|
17290
|
-
return;
|
|
17291
|
-
}
|
|
17292
|
-
const update = () => setIsDarkMode(resolveIsDarkMode());
|
|
17293
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
17294
|
-
const observer = new MutationObserver(update);
|
|
17295
|
-
observer.observe(document.documentElement, {
|
|
17296
|
-
attributeFilter: ["class", "data-theme"],
|
|
17297
|
-
attributes: true
|
|
17298
|
-
});
|
|
17299
|
-
mediaQuery.addEventListener?.("change", update);
|
|
17300
|
-
update();
|
|
17301
|
-
return () => {
|
|
17302
|
-
observer.disconnect();
|
|
17303
|
-
mediaQuery.removeEventListener?.("change", update);
|
|
17304
|
-
};
|
|
17305
|
-
}, []);
|
|
17306
|
-
return isDarkMode ? DARK_PALETTE : LIGHT_PALETTE;
|
|
17370
|
+
function useViewerPalette(isDark = false) {
|
|
17371
|
+
return isDark ? DARK_PALETTE : LIGHT_PALETTE;
|
|
17307
17372
|
}
|
|
17308
17373
|
function columnLabel2(col) {
|
|
17309
17374
|
let label = "";
|
|
@@ -18148,6 +18213,57 @@ function DefaultTableHeaderMenu({
|
|
|
18148
18213
|
}
|
|
18149
18214
|
);
|
|
18150
18215
|
}
|
|
18216
|
+
function SegmentedControl({
|
|
18217
|
+
items,
|
|
18218
|
+
onValueChange,
|
|
18219
|
+
palette,
|
|
18220
|
+
value
|
|
18221
|
+
}) {
|
|
18222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18223
|
+
"div",
|
|
18224
|
+
{
|
|
18225
|
+
"aria-label": "Workbook sheets",
|
|
18226
|
+
role: "tablist",
|
|
18227
|
+
style: {
|
|
18228
|
+
alignItems: "center",
|
|
18229
|
+
backgroundColor: palette.sheetInactiveSurface,
|
|
18230
|
+
border: `1px solid ${palette.strongBorder}`,
|
|
18231
|
+
borderRadius: 10,
|
|
18232
|
+
display: "inline-flex",
|
|
18233
|
+
gap: 2,
|
|
18234
|
+
minHeight: 36,
|
|
18235
|
+
padding: 2
|
|
18236
|
+
},
|
|
18237
|
+
children: items.map((item) => {
|
|
18238
|
+
const selected = item.id === value;
|
|
18239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18240
|
+
"button",
|
|
18241
|
+
{
|
|
18242
|
+
"aria-selected": selected,
|
|
18243
|
+
onClick: () => onValueChange(item.id),
|
|
18244
|
+
role: "tab",
|
|
18245
|
+
style: {
|
|
18246
|
+
backgroundColor: selected ? palette.sheetActiveSurface : "transparent",
|
|
18247
|
+
border: "none",
|
|
18248
|
+
borderRadius: 8,
|
|
18249
|
+
boxShadow: selected ? palette.shadow : "none",
|
|
18250
|
+
color: selected ? palette.sheetActiveText : palette.sheetInactiveText,
|
|
18251
|
+
cursor: "pointer",
|
|
18252
|
+
fontSize: 12,
|
|
18253
|
+
fontWeight: selected ? 600 : 500,
|
|
18254
|
+
padding: "7px 12px",
|
|
18255
|
+
transition: "background-color 120ms ease, color 120ms ease, box-shadow 120ms ease",
|
|
18256
|
+
whiteSpace: "nowrap"
|
|
18257
|
+
},
|
|
18258
|
+
type: "button",
|
|
18259
|
+
children: item.label
|
|
18260
|
+
},
|
|
18261
|
+
item.id
|
|
18262
|
+
);
|
|
18263
|
+
})
|
|
18264
|
+
}
|
|
18265
|
+
);
|
|
18266
|
+
}
|
|
18151
18267
|
function DefaultToolbar({ controller, palette }) {
|
|
18152
18268
|
const {
|
|
18153
18269
|
activeTabIndex,
|
|
@@ -18269,19 +18385,26 @@ function DefaultToolbar({ controller, palette }) {
|
|
|
18269
18385
|
canDownload ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18270
18386
|
"button",
|
|
18271
18387
|
{
|
|
18388
|
+
"aria-label": "Download workbook",
|
|
18272
18389
|
onClick: download,
|
|
18273
18390
|
style: {
|
|
18391
|
+
alignItems: "center",
|
|
18274
18392
|
background: palette.buttonSurface,
|
|
18275
18393
|
border: `1px solid ${palette.strongBorder}`,
|
|
18276
18394
|
borderRadius: 8,
|
|
18277
18395
|
color: palette.buttonText,
|
|
18278
18396
|
cursor: "pointer",
|
|
18279
|
-
|
|
18397
|
+
display: "inline-flex",
|
|
18398
|
+
fontSize: 16,
|
|
18280
18399
|
fontWeight: 500,
|
|
18281
|
-
|
|
18400
|
+
height: 32,
|
|
18401
|
+
justifyContent: "center",
|
|
18402
|
+
padding: 0,
|
|
18403
|
+
width: 32
|
|
18282
18404
|
},
|
|
18405
|
+
title: "Download workbook",
|
|
18283
18406
|
type: "button",
|
|
18284
|
-
children: "
|
|
18407
|
+
children: "\u2193"
|
|
18285
18408
|
}
|
|
18286
18409
|
) : null
|
|
18287
18410
|
] })
|
|
@@ -18294,32 +18417,18 @@ function DefaultToolbar({ controller, palette }) {
|
|
|
18294
18417
|
style: {
|
|
18295
18418
|
backgroundColor: palette.subtleSurface,
|
|
18296
18419
|
borderBottom: `1px solid ${palette.border}`,
|
|
18297
|
-
display: "flex",
|
|
18298
|
-
gap: 6,
|
|
18299
18420
|
overflowX: "auto",
|
|
18300
18421
|
padding: "8px 12px"
|
|
18301
18422
|
},
|
|
18302
|
-
children:
|
|
18303
|
-
|
|
18423
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18424
|
+
SegmentedControl,
|
|
18304
18425
|
{
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
|
|
18309
|
-
|
|
18310
|
-
|
|
18311
|
-
color: index === activeTabIndex ? palette.sheetActiveText : palette.sheetInactiveText,
|
|
18312
|
-
cursor: "pointer",
|
|
18313
|
-
fontSize: 12,
|
|
18314
|
-
fontWeight: 500,
|
|
18315
|
-
padding: "6px 12px",
|
|
18316
|
-
whiteSpace: "nowrap"
|
|
18317
|
-
},
|
|
18318
|
-
type: "button",
|
|
18319
|
-
children: tab.name
|
|
18320
|
-
},
|
|
18321
|
-
tab.id
|
|
18322
|
-
))
|
|
18426
|
+
items: tabs.map((tab, index) => ({ id: String(index), label: tab.name })),
|
|
18427
|
+
onValueChange: (value) => setActiveTabIndex(Number(value)),
|
|
18428
|
+
palette,
|
|
18429
|
+
value: String(activeTabIndex)
|
|
18430
|
+
}
|
|
18431
|
+
)
|
|
18323
18432
|
}
|
|
18324
18433
|
) : null
|
|
18325
18434
|
] });
|
|
@@ -18692,7 +18801,8 @@ function buildConditionalIcon(iconSet, iconId) {
|
|
|
18692
18801
|
};
|
|
18693
18802
|
}
|
|
18694
18803
|
}
|
|
18695
|
-
function renderConditionalIcon(icon) {
|
|
18804
|
+
function renderConditionalIcon(icon, scale = 1) {
|
|
18805
|
+
const iconSize = 14 * scale;
|
|
18696
18806
|
if (icon.shape === "arrow") {
|
|
18697
18807
|
const fill = icon.color ?? "#111827";
|
|
18698
18808
|
const stroke = icon.borderColor ?? darkenColor3(fill, 0.32);
|
|
@@ -18700,10 +18810,10 @@ function renderConditionalIcon(icon) {
|
|
|
18700
18810
|
"svg",
|
|
18701
18811
|
{
|
|
18702
18812
|
"aria-hidden": "true",
|
|
18703
|
-
height:
|
|
18813
|
+
height: iconSize,
|
|
18704
18814
|
style: { display: "block" },
|
|
18705
18815
|
viewBox: "0 0 16 16",
|
|
18706
|
-
width:
|
|
18816
|
+
width: iconSize,
|
|
18707
18817
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", { transform: `rotate(${icon.rotationDeg ?? 0} 8 8)`, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18708
18818
|
"path",
|
|
18709
18819
|
{
|
|
@@ -18725,12 +18835,12 @@ function renderConditionalIcon(icon) {
|
|
|
18725
18835
|
alignItems: "center",
|
|
18726
18836
|
color: icon.color ?? "#111827",
|
|
18727
18837
|
display: "inline-flex",
|
|
18728
|
-
fontSize: 13,
|
|
18838
|
+
fontSize: 13 * scale,
|
|
18729
18839
|
fontWeight: 700,
|
|
18730
|
-
height:
|
|
18840
|
+
height: iconSize,
|
|
18731
18841
|
justifyContent: "center",
|
|
18732
18842
|
lineHeight: 1,
|
|
18733
|
-
width:
|
|
18843
|
+
width: iconSize
|
|
18734
18844
|
},
|
|
18735
18845
|
children: icon.glyph
|
|
18736
18846
|
}
|
|
@@ -18744,17 +18854,17 @@ function renderConditionalIcon(icon) {
|
|
|
18744
18854
|
border: icon.borderColor ? `1px solid ${icon.borderColor}` : "none",
|
|
18745
18855
|
borderRadius: "999px",
|
|
18746
18856
|
display: "inline-block",
|
|
18747
|
-
height: 12,
|
|
18748
|
-
width: 12
|
|
18857
|
+
height: 12 * scale,
|
|
18858
|
+
width: 12 * scale
|
|
18749
18859
|
}
|
|
18750
18860
|
}
|
|
18751
18861
|
);
|
|
18752
18862
|
}
|
|
18753
|
-
function renderCheckboxControl(checked, palette) {
|
|
18863
|
+
function renderCheckboxControl(checked, palette, scale = 1) {
|
|
18754
18864
|
const stroke = paletteIsDark(palette) ? "#cbd5e1" : "#475569";
|
|
18755
18865
|
const fill = checked ? paletteIsDark(palette) ? "#60a5fa" : "#2563eb" : "transparent";
|
|
18756
18866
|
const check = paletteIsDark(palette) ? "#020617" : "#ffffff";
|
|
18757
|
-
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: [
|
|
18758
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 }),
|
|
18759
18869
|
checked ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
18760
18870
|
"path",
|
|
@@ -18952,10 +19062,12 @@ function GridRow({
|
|
|
18952
19062
|
readOnly,
|
|
18953
19063
|
renderCellAdornment,
|
|
18954
19064
|
rowHeight,
|
|
19065
|
+
rowHeaderWidth,
|
|
18955
19066
|
stickyLeftByCol,
|
|
18956
19067
|
stickyTop,
|
|
18957
19068
|
trailingSpacerWidth,
|
|
18958
|
-
visibleCols
|
|
19069
|
+
visibleCols,
|
|
19070
|
+
zoomFactor
|
|
18959
19071
|
}) {
|
|
18960
19072
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
18961
19073
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { "data-xlsx-row": actualRow, style: { height: rowHeight }, children: [
|
|
@@ -18971,17 +19083,17 @@ function GridRow({
|
|
|
18971
19083
|
boxSizing: "border-box",
|
|
18972
19084
|
boxShadow: gutterSeparatorShadow,
|
|
18973
19085
|
color: palette.mutedText,
|
|
18974
|
-
fontSize: "11px",
|
|
19086
|
+
fontSize: scaleCssLengthExpression("11px", zoomFactor),
|
|
18975
19087
|
height: rowHeight,
|
|
18976
19088
|
left: 0,
|
|
18977
19089
|
maxHeight: rowHeight,
|
|
18978
|
-
minWidth:
|
|
18979
|
-
padding: "2px 4px",
|
|
19090
|
+
minWidth: rowHeaderWidth,
|
|
19091
|
+
padding: scaleCssLengthExpression("2px 4px", zoomFactor),
|
|
18980
19092
|
position: "sticky",
|
|
18981
19093
|
top: stickyTop,
|
|
18982
19094
|
textAlign: "center",
|
|
18983
19095
|
userSelect: "none",
|
|
18984
|
-
width:
|
|
19096
|
+
width: rowHeaderWidth,
|
|
18985
19097
|
zIndex: stickyTop !== void 0 ? 45 : 35
|
|
18986
19098
|
},
|
|
18987
19099
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { position: "relative" }, children: [
|
|
@@ -18992,9 +19104,9 @@ function GridRow({
|
|
|
18992
19104
|
onPointerDown: (event) => onRowResizePointerDown(event, actualRow, rowHeight),
|
|
18993
19105
|
style: {
|
|
18994
19106
|
backgroundColor: "transparent",
|
|
18995
|
-
bottom: -8,
|
|
19107
|
+
bottom: -8 * zoomFactor,
|
|
18996
19108
|
cursor: "row-resize",
|
|
18997
|
-
height: 16,
|
|
19109
|
+
height: 16 * zoomFactor,
|
|
18998
19110
|
left: 0,
|
|
18999
19111
|
position: "absolute",
|
|
19000
19112
|
width: "100%",
|
|
@@ -19095,7 +19207,7 @@ function GridRow({
|
|
|
19095
19207
|
cellContentStyle.zIndex = 1;
|
|
19096
19208
|
}
|
|
19097
19209
|
if (trailingInset > 0) {
|
|
19098
|
-
cellContentStyle.paddingRight = trailingInset + 4;
|
|
19210
|
+
cellContentStyle.paddingRight = (trailingInset + 4) * zoomFactor;
|
|
19099
19211
|
}
|
|
19100
19212
|
if (cellData.conditionalIcon) {
|
|
19101
19213
|
cellContentStyle.position = "relative";
|
|
@@ -19129,13 +19241,13 @@ function GridRow({
|
|
|
19129
19241
|
"aria-hidden": "true",
|
|
19130
19242
|
style: {
|
|
19131
19243
|
alignItems: "center",
|
|
19132
|
-
bottom: 4,
|
|
19244
|
+
bottom: 4 * zoomFactor,
|
|
19133
19245
|
display: "flex",
|
|
19134
|
-
left: 4,
|
|
19246
|
+
left: 4 * zoomFactor,
|
|
19135
19247
|
pointerEvents: "none",
|
|
19136
19248
|
position: "absolute",
|
|
19137
|
-
right: 4,
|
|
19138
|
-
top: 4,
|
|
19249
|
+
right: 4 * zoomFactor,
|
|
19250
|
+
top: 4 * zoomFactor,
|
|
19139
19251
|
zIndex: 0
|
|
19140
19252
|
},
|
|
19141
19253
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -19164,12 +19276,12 @@ function GridRow({
|
|
|
19164
19276
|
justifyContent: "center",
|
|
19165
19277
|
pointerEvents: "none",
|
|
19166
19278
|
position: "absolute",
|
|
19167
|
-
right: conditionalIconRight,
|
|
19279
|
+
right: conditionalIconRight * zoomFactor,
|
|
19168
19280
|
top: "50%",
|
|
19169
19281
|
transform: "translateY(-50%)",
|
|
19170
19282
|
zIndex: 2
|
|
19171
19283
|
},
|
|
19172
|
-
children: renderConditionalIcon(cellData.conditionalIcon)
|
|
19284
|
+
children: renderConditionalIcon(cellData.conditionalIcon, zoomFactor)
|
|
19173
19285
|
}
|
|
19174
19286
|
) : null,
|
|
19175
19287
|
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -19198,7 +19310,7 @@ function GridRow({
|
|
|
19198
19310
|
height: "100%",
|
|
19199
19311
|
margin: 0,
|
|
19200
19312
|
outline: "none",
|
|
19201
|
-
padding: DEFAULT_CELL_PADDING,
|
|
19313
|
+
padding: scaleCssLengthExpression(DEFAULT_CELL_PADDING, zoomFactor),
|
|
19202
19314
|
width: "100%"
|
|
19203
19315
|
},
|
|
19204
19316
|
value: editingValue
|
|
@@ -19240,7 +19352,7 @@ function GridRow({
|
|
|
19240
19352
|
pointerEvents: "none",
|
|
19241
19353
|
width: "100%"
|
|
19242
19354
|
},
|
|
19243
|
-
children: renderCheckboxControl(cellData.checkboxState, palette)
|
|
19355
|
+
children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
|
|
19244
19356
|
}
|
|
19245
19357
|
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cellContentStyle, children: cellData.value })
|
|
19246
19358
|
]
|
|
@@ -19263,7 +19375,7 @@ function GridRow({
|
|
|
19263
19375
|
] });
|
|
19264
19376
|
}
|
|
19265
19377
|
var MemoGridRow = React4.memo(GridRow, (prev, next) => {
|
|
19266
|
-
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) {
|
|
19267
19379
|
return false;
|
|
19268
19380
|
}
|
|
19269
19381
|
const prevEditingCol = prev.editingCell?.row === prev.actualRow ? prev.editingCell.col : -1;
|
|
@@ -19440,20 +19552,25 @@ function XlsxGrid({
|
|
|
19440
19552
|
);
|
|
19441
19553
|
const hiddenRowSet = React4.useMemo(() => new Set(activeSheet?.hiddenRows ?? []), [activeSheet?.hiddenRows]);
|
|
19442
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;
|
|
19443
19560
|
const syncDrawingViewport = React4.useCallback((scroller) => {
|
|
19444
19561
|
if (!scroller) {
|
|
19445
19562
|
return;
|
|
19446
19563
|
}
|
|
19447
19564
|
setDrawingViewport((current) => {
|
|
19448
19565
|
const next = {
|
|
19449
|
-
height: scroller.clientHeight
|
|
19450
|
-
left: scroller.scrollLeft
|
|
19451
|
-
top: scroller.scrollTop
|
|
19452
|
-
width: scroller.clientWidth
|
|
19566
|
+
height: scroller.clientHeight,
|
|
19567
|
+
left: scroller.scrollLeft,
|
|
19568
|
+
top: scroller.scrollTop,
|
|
19569
|
+
width: scroller.clientWidth
|
|
19453
19570
|
};
|
|
19454
19571
|
return current.left === next.left && current.top === next.top && current.width === next.width && current.height === next.height ? current : next;
|
|
19455
19572
|
});
|
|
19456
|
-
}, [
|
|
19573
|
+
}, []);
|
|
19457
19574
|
const visibleRows = React4.useMemo(() => {
|
|
19458
19575
|
return buildVisibleAxisIndices(
|
|
19459
19576
|
activeSheet?.visibleRows ?? [],
|
|
@@ -19607,47 +19724,54 @@ function XlsxGrid({
|
|
|
19607
19724
|
revision
|
|
19608
19725
|
]
|
|
19609
19726
|
);
|
|
19610
|
-
const
|
|
19611
|
-
() =>
|
|
19612
|
-
[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]
|
|
19734
|
+
);
|
|
19735
|
+
const displayEffectiveColWidths = React4.useMemo(
|
|
19736
|
+
() => visibleCols.map((col) => displayActualColWidths[col] ?? displayDefaultColWidth),
|
|
19737
|
+
[displayActualColWidths, displayDefaultColWidth, visibleCols]
|
|
19613
19738
|
);
|
|
19614
|
-
const
|
|
19615
|
-
() => visibleRows.map((row) =>
|
|
19616
|
-
[
|
|
19739
|
+
const displayEffectiveRowHeights = React4.useMemo(
|
|
19740
|
+
() => visibleRows.map((row) => displayActualRowHeights[row] ?? displayDefaultRowHeight),
|
|
19741
|
+
[displayActualRowHeights, displayDefaultRowHeight, visibleRows]
|
|
19617
19742
|
);
|
|
19618
19743
|
const rowIndexByActual = React4.useMemo(() => new Map(visibleRows.map((row, index) => [row, index])), [visibleRows]);
|
|
19619
19744
|
const colIndexByActual = React4.useMemo(() => new Map(visibleCols.map((col, index) => [col, index])), [visibleCols]);
|
|
19620
19745
|
const visibleRowsRef = React4.useRef(visibleRows);
|
|
19621
19746
|
const visibleColsRef = React4.useRef(visibleCols);
|
|
19622
|
-
const effectiveRowHeightsRef = React4.useRef(
|
|
19623
|
-
const effectiveColWidthsRef = React4.useRef(
|
|
19624
|
-
const rowPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19625
|
-
const colPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19626
|
-
const actualRowPrefixSums = React4.useMemo(() => buildPrefixSums(
|
|
19627
|
-
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]);
|
|
19628
19753
|
const stickyTopByRow = React4.useMemo(
|
|
19629
|
-
() => buildStickyOffsets(frozenRows,
|
|
19630
|
-
[
|
|
19754
|
+
() => buildStickyOffsets(frozenRows, displayActualRowHeights, displayHeaderHeight),
|
|
19755
|
+
[displayActualRowHeights, displayHeaderHeight, frozenRows]
|
|
19631
19756
|
);
|
|
19632
19757
|
const stickyLeftByCol = React4.useMemo(
|
|
19633
|
-
() => buildStickyOffsets(frozenCols,
|
|
19634
|
-
[
|
|
19758
|
+
() => buildStickyOffsets(frozenCols, displayActualColWidths, displayRowHeaderWidth),
|
|
19759
|
+
[displayActualColWidths, displayRowHeaderWidth, frozenCols]
|
|
19635
19760
|
);
|
|
19636
19761
|
const frozenPaneBottom = React4.useMemo(
|
|
19637
19762
|
() => frozenRows.length > 0 ? frozenRows.reduce(
|
|
19638
|
-
(max, row) => Math.max(max, (stickyTopByRow.get(row) ??
|
|
19639
|
-
|
|
19640
|
-
) :
|
|
19641
|
-
[
|
|
19763
|
+
(max, row) => Math.max(max, (stickyTopByRow.get(row) ?? displayHeaderHeight) + (displayActualRowHeights[row] ?? displayDefaultRowHeight)),
|
|
19764
|
+
displayHeaderHeight
|
|
19765
|
+
) : displayHeaderHeight,
|
|
19766
|
+
[displayActualRowHeights, displayDefaultRowHeight, displayHeaderHeight, frozenRows, stickyTopByRow]
|
|
19642
19767
|
);
|
|
19643
19768
|
const frozenPaneRight = React4.useMemo(
|
|
19644
19769
|
() => frozenCols.length > 0 ? frozenCols.reduce(
|
|
19645
|
-
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ??
|
|
19646
|
-
|
|
19647
|
-
) :
|
|
19648
|
-
[
|
|
19770
|
+
(max, col) => Math.max(max, (stickyLeftByCol.get(col) ?? displayRowHeaderWidth) + (displayActualColWidths[col] ?? displayDefaultColWidth)),
|
|
19771
|
+
displayRowHeaderWidth
|
|
19772
|
+
) : displayRowHeaderWidth,
|
|
19773
|
+
[displayActualColWidths, displayDefaultColWidth, displayRowHeaderWidth, frozenCols, stickyLeftByCol]
|
|
19649
19774
|
);
|
|
19650
|
-
const useNativeZoomForStickyLayout = zoomFactor !== 1;
|
|
19651
19775
|
const rowPrefixSumsRef = React4.useRef(rowPrefixSums);
|
|
19652
19776
|
const colPrefixSumsRef = React4.useRef(colPrefixSums);
|
|
19653
19777
|
const firstVisibleRow = visibleRows[0];
|
|
@@ -19655,6 +19779,12 @@ function XlsxGrid({
|
|
|
19655
19779
|
const firstVisibleCol = visibleCols[0];
|
|
19656
19780
|
const lastVisibleCol = visibleCols[visibleCols.length - 1];
|
|
19657
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]);
|
|
19658
19788
|
const drawingExtents = React4.useMemo(() => {
|
|
19659
19789
|
const imageExtents = images.reduce(
|
|
19660
19790
|
(current, image) => {
|
|
@@ -19696,24 +19826,18 @@ function XlsxGrid({
|
|
|
19696
19826
|
const shouldVirtualizeCols = !activeSheet?.hasHorizontalMerges && frozenCols.length === 0;
|
|
19697
19827
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
19698
19828
|
count: visibleRows.length,
|
|
19699
|
-
estimateSize: (index) =>
|
|
19829
|
+
estimateSize: (index) => displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
19700
19830
|
getScrollElement: () => scrollRef.current,
|
|
19701
19831
|
getItemKey: (index) => visibleRows[index] ?? index,
|
|
19702
|
-
|
|
19703
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19704
|
-
overscan: 10,
|
|
19705
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19832
|
+
overscan: 10
|
|
19706
19833
|
});
|
|
19707
19834
|
const colVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
19708
19835
|
count: visibleCols.length,
|
|
19709
|
-
estimateSize: (index) =>
|
|
19836
|
+
estimateSize: (index) => displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
19710
19837
|
getScrollElement: () => scrollRef.current,
|
|
19711
19838
|
getItemKey: (index) => visibleCols[index] ?? index,
|
|
19712
19839
|
horizontal: true,
|
|
19713
|
-
|
|
19714
|
-
observeElementRect: (instance, cb) => observeZoomedElementRect(instance, zoomFactor, cb),
|
|
19715
|
-
overscan: 6,
|
|
19716
|
-
scrollToFn: (offset, options, instance) => scrollToZoomedOffset(offset, zoomFactor, options, instance)
|
|
19840
|
+
overscan: 6
|
|
19717
19841
|
});
|
|
19718
19842
|
const currentRowVirtualItems = rowVirtualizer.getVirtualItems();
|
|
19719
19843
|
const currentColVirtualItems = colVirtualizer.getVirtualItems();
|
|
@@ -19849,11 +19973,11 @@ function XlsxGrid({
|
|
|
19849
19973
|
React4.useEffect(() => {
|
|
19850
19974
|
visibleRowsRef.current = visibleRows;
|
|
19851
19975
|
visibleColsRef.current = visibleCols;
|
|
19852
|
-
effectiveRowHeightsRef.current =
|
|
19853
|
-
effectiveColWidthsRef.current =
|
|
19976
|
+
effectiveRowHeightsRef.current = displayEffectiveRowHeights;
|
|
19977
|
+
effectiveColWidthsRef.current = displayEffectiveColWidths;
|
|
19854
19978
|
rowPrefixSumsRef.current = rowPrefixSums;
|
|
19855
19979
|
colPrefixSumsRef.current = colPrefixSums;
|
|
19856
|
-
}, [colPrefixSums,
|
|
19980
|
+
}, [colPrefixSums, displayEffectiveColWidths, displayEffectiveRowHeights, rowPrefixSums, visibleCols, visibleRows]);
|
|
19857
19981
|
React4.useLayoutEffect(() => {
|
|
19858
19982
|
const scroller = scrollRef.current;
|
|
19859
19983
|
const previousZoomFactor = previousZoomFactorRef.current;
|
|
@@ -19978,13 +20102,13 @@ function XlsxGrid({
|
|
|
19978
20102
|
const currentScroller = event.currentTarget;
|
|
19979
20103
|
cachedScrollerRectRef.current = null;
|
|
19980
20104
|
syncDrawingViewport(currentScroller);
|
|
19981
|
-
if (
|
|
20105
|
+
if (currentScroller.scrollHeight - (currentScroller.scrollTop + currentScroller.clientHeight) < OPEN_GRID_VERTICAL_EDGE_PX) {
|
|
19982
20106
|
setDisplayRowLimit((current) => current + OPEN_GRID_ROW_GROWTH);
|
|
19983
20107
|
}
|
|
19984
|
-
if (
|
|
20108
|
+
if (currentScroller.scrollWidth - (currentScroller.scrollLeft + currentScroller.clientWidth) < OPEN_GRID_HORIZONTAL_EDGE_PX) {
|
|
19985
20109
|
setDisplayColLimit((current) => current + OPEN_GRID_COL_GROWTH);
|
|
19986
20110
|
}
|
|
19987
|
-
}, [syncDrawingViewport
|
|
20111
|
+
}, [syncDrawingViewport]);
|
|
19988
20112
|
React4.useEffect(() => {
|
|
19989
20113
|
if (!openTableMenu) {
|
|
19990
20114
|
return;
|
|
@@ -20023,24 +20147,24 @@ function XlsxGrid({
|
|
|
20023
20147
|
}
|
|
20024
20148
|
const pointerOffsetX = clientX - scrollerRect.left;
|
|
20025
20149
|
const pointerOffsetY = clientY - scrollerRect.top;
|
|
20026
|
-
const localX = pointerOffsetX
|
|
20027
|
-
const localY = pointerOffsetY
|
|
20028
|
-
const rowContentOffset = localY -
|
|
20029
|
-
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;
|
|
20030
20154
|
let geometryCell = null;
|
|
20031
|
-
if (localY >=
|
|
20155
|
+
if (localY >= displayHeaderHeight && localX < displayRowHeaderWidth) {
|
|
20032
20156
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20033
20157
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
20034
20158
|
if (actualRow !== void 0 && firstVisibleColRef.current !== void 0) {
|
|
20035
20159
|
geometryCell = { row: actualRow, col: firstVisibleColRef.current };
|
|
20036
20160
|
}
|
|
20037
|
-
} else if (localY <
|
|
20161
|
+
} else if (localY < displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20038
20162
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20039
20163
|
const actualCol = visibleColsCurrent[colIndex];
|
|
20040
20164
|
if (actualCol !== void 0 && firstVisibleRowRef.current !== void 0) {
|
|
20041
20165
|
geometryCell = { row: firstVisibleRowRef.current, col: actualCol };
|
|
20042
20166
|
}
|
|
20043
|
-
} else if (localY >=
|
|
20167
|
+
} else if (localY >= displayHeaderHeight && localX >= displayRowHeaderWidth) {
|
|
20044
20168
|
const rowIndex = findIndexForOffsetPrefix(rowPrefixSumsCurrent, rowContentOffset);
|
|
20045
20169
|
const colIndex = findIndexForOffsetPrefix(colPrefixSumsCurrent, colContentOffset);
|
|
20046
20170
|
const actualRow = visibleRowsCurrent[rowIndex];
|
|
@@ -20050,7 +20174,7 @@ function XlsxGrid({
|
|
|
20050
20174
|
}
|
|
20051
20175
|
}
|
|
20052
20176
|
return geometryCell;
|
|
20053
|
-
}, [frozenPaneBottom, frozenPaneRight
|
|
20177
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, frozenPaneBottom, frozenPaneRight]);
|
|
20054
20178
|
const resolvePointerCellFromHitTest = React4.useCallback((clientX, clientY) => {
|
|
20055
20179
|
const elementsAtPoint = typeof document.elementsFromPoint === "function" ? document.elementsFromPoint(clientX, clientY) : [document.elementFromPoint(clientX, clientY)].filter((element) => Boolean(element));
|
|
20056
20180
|
for (const element of elementsAtPoint) {
|
|
@@ -20110,59 +20234,59 @@ function XlsxGrid({
|
|
|
20110
20234
|
if (rowIndex === void 0 || colIndex === void 0) {
|
|
20111
20235
|
return null;
|
|
20112
20236
|
}
|
|
20113
|
-
const
|
|
20114
|
-
const
|
|
20115
|
-
const contentScaleX = Math.max(1e-4, rect.width > 0 ? rect.width /
|
|
20116
|
-
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);
|
|
20117
20241
|
return {
|
|
20118
20242
|
contentScaleX,
|
|
20119
20243
|
contentScaleY,
|
|
20120
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20121
|
-
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)
|
|
20122
20246
|
};
|
|
20123
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20247
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20124
20248
|
const resolveRowPointerOrigin = React4.useCallback((actualRow, rect, clientY) => {
|
|
20125
20249
|
const rowIndex = rowIndexByActual.get(actualRow);
|
|
20126
20250
|
if (rowIndex === void 0) {
|
|
20127
20251
|
return null;
|
|
20128
20252
|
}
|
|
20129
|
-
const
|
|
20130
|
-
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);
|
|
20131
20255
|
return {
|
|
20132
|
-
contentScaleX:
|
|
20256
|
+
contentScaleX: 1,
|
|
20133
20257
|
contentScaleY,
|
|
20134
20258
|
originContentX: colPrefixSums[0] ?? 0,
|
|
20135
|
-
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY,
|
|
20259
|
+
originContentY: (rowPrefixSums[rowIndex] ?? 0) + clampContentOffset((clientY - rect.top) / contentScaleY, displayHeight)
|
|
20136
20260
|
};
|
|
20137
|
-
}, [colPrefixSums,
|
|
20261
|
+
}, [colPrefixSums, displayDefaultRowHeight, displayEffectiveRowHeights, rowIndexByActual, rowPrefixSums]);
|
|
20138
20262
|
const resolveColumnPointerOrigin = React4.useCallback((actualCol, rect, clientX) => {
|
|
20139
20263
|
const colIndex = colIndexByActual.get(actualCol);
|
|
20140
20264
|
if (colIndex === void 0) {
|
|
20141
20265
|
return null;
|
|
20142
20266
|
}
|
|
20143
|
-
const
|
|
20144
|
-
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);
|
|
20145
20269
|
return {
|
|
20146
20270
|
contentScaleX,
|
|
20147
|
-
contentScaleY:
|
|
20148
|
-
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX,
|
|
20271
|
+
contentScaleY: 1,
|
|
20272
|
+
originContentX: (colPrefixSums[colIndex] ?? 0) + clampContentOffset((clientX - rect.left) / contentScaleX, displayWidth),
|
|
20149
20273
|
originContentY: rowPrefixSums[0] ?? 0
|
|
20150
20274
|
};
|
|
20151
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20275
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayEffectiveColWidths, rowPrefixSums]);
|
|
20152
20276
|
const applyColumnPreview = React4.useCallback((actualCol, widthPx) => {
|
|
20153
20277
|
const colElement = colElementRefs.current.get(actualCol);
|
|
20154
20278
|
if (colElement) {
|
|
20155
20279
|
colElement.style.width = widthPx === null ? "" : `${widthPx}px`;
|
|
20156
20280
|
}
|
|
20157
20281
|
const baseIndex = visibleCols.indexOf(actualCol);
|
|
20158
|
-
const baseWidth = baseIndex >= 0 ?
|
|
20282
|
+
const baseWidth = baseIndex >= 0 ? displayEffectiveColWidths[baseIndex] ?? displayDefaultColWidth : displayDefaultColWidth;
|
|
20159
20283
|
const previewWidth = widthPx ?? baseWidth;
|
|
20160
|
-
const baseTotalWidth =
|
|
20284
|
+
const baseTotalWidth = displayEffectiveColWidths.reduce((sum, width) => sum + width, 0) + displayRowHeaderWidth;
|
|
20161
20285
|
const widthDelta = previewWidth - baseWidth;
|
|
20162
20286
|
if (tableRef.current) {
|
|
20163
20287
|
tableRef.current.style.width = `${baseTotalWidth + widthDelta}px`;
|
|
20164
20288
|
}
|
|
20165
|
-
}, [
|
|
20289
|
+
}, [displayDefaultColWidth, displayEffectiveColWidths, displayRowHeaderWidth, visibleCols]);
|
|
20166
20290
|
const applyRowPreview = React4.useCallback((actualRow, heightPx) => {
|
|
20167
20291
|
const rowElement = rowElementRefs.current.get(actualRow) ?? wrapperRef.current?.querySelector(`tr[data-xlsx-row="${actualRow}"]`) ?? null;
|
|
20168
20292
|
if (rowElement) {
|
|
@@ -20339,7 +20463,7 @@ function XlsxGrid({
|
|
|
20339
20463
|
const viewportRowBatch = getRowsBatchAsync ? asyncViewportRowBatch : syncViewportRowBatch;
|
|
20340
20464
|
React4.useEffect(() => {
|
|
20341
20465
|
cellRenderCacheRef.current.clear();
|
|
20342
|
-
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet]);
|
|
20466
|
+
}, [activeSheetIndex, displayColLimit, displayRowLimit, palette, revision, viewportRowBatch, worksheet, zoomFactor]);
|
|
20343
20467
|
React4.useEffect(() => {
|
|
20344
20468
|
setAsyncViewportRowBatch(null);
|
|
20345
20469
|
}, [activeSheetIndex, revision]);
|
|
@@ -20361,7 +20485,7 @@ function XlsxGrid({
|
|
|
20361
20485
|
if (!worksheet && !batchedCell) {
|
|
20362
20486
|
const emptyData = {
|
|
20363
20487
|
isMergedSecondary: false,
|
|
20364
|
-
style: {
|
|
20488
|
+
style: scaleCssProperties({
|
|
20365
20489
|
backgroundColor: resolveSheetSurface(activeSheet, palette),
|
|
20366
20490
|
borderBottom: "none",
|
|
20367
20491
|
borderRight: "none",
|
|
@@ -20369,7 +20493,7 @@ function XlsxGrid({
|
|
|
20369
20493
|
padding: DEFAULT_CELL_PADDING,
|
|
20370
20494
|
verticalAlign: "bottom",
|
|
20371
20495
|
whiteSpace: "nowrap"
|
|
20372
|
-
},
|
|
20496
|
+
}, zoomFactor),
|
|
20373
20497
|
value: ""
|
|
20374
20498
|
};
|
|
20375
20499
|
cellRenderCacheRef.current.set(cacheKey, emptyData);
|
|
@@ -20448,9 +20572,9 @@ function XlsxGrid({
|
|
|
20448
20572
|
isTableHeader: Boolean(table && row >= table.start.row && row < table.start.row + headerRowCount),
|
|
20449
20573
|
rowSpan: merge?.rowSpan,
|
|
20450
20574
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
20451
|
-
style: buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20575
|
+
style: scaleCssProperties(buildCellStyle(mergedStyle, palette, activeSheet?.themePalette, {
|
|
20452
20576
|
showGridLines: activeSheet?.showGridLines
|
|
20453
|
-
}),
|
|
20577
|
+
}), zoomFactor),
|
|
20454
20578
|
validation: resolveCellDataValidation(row, col, activeSheet),
|
|
20455
20579
|
value: sparkline ? "" : checkboxState !== null ? "" : batchCoversRow || !worksheet ? batchedCell?.value ?? "" : getCellDisplayValue(worksheet, row, col, activeSheet)
|
|
20456
20580
|
};
|
|
@@ -20460,7 +20584,7 @@ function XlsxGrid({
|
|
|
20460
20584
|
const horizontalPadding = getHorizontalPadding(nextData.style.padding);
|
|
20461
20585
|
const textWidth = measureTextWidth(nextData.value, nextData.style);
|
|
20462
20586
|
const requiredWidth = textWidth + horizontalPadding + 2;
|
|
20463
|
-
let availableWidth =
|
|
20587
|
+
let availableWidth = displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth;
|
|
20464
20588
|
if (requiredWidth > availableWidth) {
|
|
20465
20589
|
for (let nextColIndex = startColIndex + 1; nextColIndex < visibleCols.length; nextColIndex += 1) {
|
|
20466
20590
|
const nextActualCol = visibleCols[nextColIndex];
|
|
@@ -20471,12 +20595,12 @@ function XlsxGrid({
|
|
|
20471
20595
|
if (!canReceiveOverflowText(neighborData)) {
|
|
20472
20596
|
break;
|
|
20473
20597
|
}
|
|
20474
|
-
availableWidth +=
|
|
20598
|
+
availableWidth += displayEffectiveColWidths[nextColIndex] ?? displayDefaultColWidth;
|
|
20475
20599
|
if (requiredWidth <= availableWidth) {
|
|
20476
20600
|
break;
|
|
20477
20601
|
}
|
|
20478
20602
|
}
|
|
20479
|
-
if (availableWidth > (
|
|
20603
|
+
if (availableWidth > (displayEffectiveColWidths[startColIndex] ?? displayDefaultColWidth)) {
|
|
20480
20604
|
nextData.spillWidth = Math.max(0, availableWidth - horizontalPadding);
|
|
20481
20605
|
}
|
|
20482
20606
|
}
|
|
@@ -20484,7 +20608,7 @@ function XlsxGrid({
|
|
|
20484
20608
|
}
|
|
20485
20609
|
cellRenderCacheRef.current.set(cacheKey, nextData);
|
|
20486
20610
|
return nextData;
|
|
20487
|
-
}, [activeSheet, colIndexByActual,
|
|
20611
|
+
}, [activeSheet, colIndexByActual, displayDefaultColWidth, displayEffectiveColWidths, effectiveTables, palette, sparklinesByCell, viewportRowBatch, visibleCols, worksheet, zoomFactor]);
|
|
20488
20612
|
React4.useEffect(() => {
|
|
20489
20613
|
conditionalFormatMetricsCacheRef.current.clear();
|
|
20490
20614
|
}, [activeSheet?.conditionalFormatRules, activeSheet?.workbookSheetIndex, revision]);
|
|
@@ -20502,11 +20626,11 @@ function XlsxGrid({
|
|
|
20502
20626
|
}
|
|
20503
20627
|
return {
|
|
20504
20628
|
height: sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex),
|
|
20505
|
-
left:
|
|
20506
|
-
top:
|
|
20629
|
+
left: displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1),
|
|
20630
|
+
top: displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1),
|
|
20507
20631
|
width: sumPrefixRange(colPrefixSums, startColIndex, endColIndex)
|
|
20508
20632
|
};
|
|
20509
|
-
}, [colIndexByActual, colPrefixSums, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20633
|
+
}, [colIndexByActual, colPrefixSums, displayHeaderHeight, displayRowHeaderWidth, displayedSelection, rowIndexByActual, rowPrefixSums]);
|
|
20510
20634
|
const resolvedSelectionOverlay = selectionOverlay;
|
|
20511
20635
|
const virtualCols = React4.useMemo(
|
|
20512
20636
|
() => shouldVirtualizeCols ? colVirtualizer.getVirtualItems().map((virtualCol) => ({
|
|
@@ -20519,10 +20643,10 @@ function XlsxGrid({
|
|
|
20519
20643
|
end: colPrefixSums[index + 1] ?? 0,
|
|
20520
20644
|
index,
|
|
20521
20645
|
key: visibleCols[index] ?? index,
|
|
20522
|
-
size:
|
|
20646
|
+
size: displayEffectiveColWidths[index] ?? displayDefaultColWidth,
|
|
20523
20647
|
start: colPrefixSums[index] ?? 0
|
|
20524
20648
|
})),
|
|
20525
|
-
[colPrefixSums, colVirtualizer,
|
|
20649
|
+
[colPrefixSums, colVirtualizer, displayDefaultColWidth, displayEffectiveColWidths, shouldVirtualizeCols, visibleCols]
|
|
20526
20650
|
);
|
|
20527
20651
|
const renderedCols = React4.useMemo(
|
|
20528
20652
|
() => {
|
|
@@ -20541,7 +20665,7 @@ function XlsxGrid({
|
|
|
20541
20665
|
});
|
|
20542
20666
|
return columns;
|
|
20543
20667
|
},
|
|
20544
|
-
[
|
|
20668
|
+
[virtualCols, visibleCols]
|
|
20545
20669
|
);
|
|
20546
20670
|
const totalContentWidth = colPrefixSums[colPrefixSums.length - 1] ?? 0;
|
|
20547
20671
|
const leadingColumnSpacerWidth = shouldVirtualizeCols ? virtualCols[0]?.start ?? 0 : 0;
|
|
@@ -20549,12 +20673,14 @@ function XlsxGrid({
|
|
|
20549
20673
|
const imageRects = React4.useMemo(
|
|
20550
20674
|
() => showImages ? images.map((image) => ({
|
|
20551
20675
|
image,
|
|
20552
|
-
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, {
|
|
20553
20677
|
actualColPrefixSums,
|
|
20554
20678
|
actualRowPrefixSums,
|
|
20555
20679
|
colIndexByActual,
|
|
20556
20680
|
colPrefixSums,
|
|
20681
|
+
headerHeight: displayHeaderHeight,
|
|
20557
20682
|
rowIndexByActual,
|
|
20683
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20558
20684
|
rowPrefixSums
|
|
20559
20685
|
})
|
|
20560
20686
|
})) : [],
|
|
@@ -20563,8 +20689,10 @@ function XlsxGrid({
|
|
|
20563
20689
|
colPrefixSums,
|
|
20564
20690
|
actualColPrefixSums,
|
|
20565
20691
|
actualRowPrefixSums,
|
|
20566
|
-
|
|
20567
|
-
|
|
20692
|
+
displayHeaderHeight,
|
|
20693
|
+
displayEffectiveColWidths,
|
|
20694
|
+
displayEffectiveRowHeights,
|
|
20695
|
+
displayRowHeaderWidth,
|
|
20568
20696
|
imagePreviewRect,
|
|
20569
20697
|
images,
|
|
20570
20698
|
rowIndexByActual,
|
|
@@ -20576,12 +20704,14 @@ function XlsxGrid({
|
|
|
20576
20704
|
);
|
|
20577
20705
|
const shapeRects = React4.useMemo(
|
|
20578
20706
|
() => showImages ? shapes.map((shape) => ({
|
|
20579
|
-
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols,
|
|
20707
|
+
rect: resolveAnchoredRect(shape.anchor, visibleRows, visibleCols, displayEffectiveRowHeights, displayEffectiveColWidths, {
|
|
20580
20708
|
actualColPrefixSums,
|
|
20581
20709
|
actualRowPrefixSums,
|
|
20582
20710
|
colIndexByActual,
|
|
20583
20711
|
colPrefixSums,
|
|
20712
|
+
headerHeight: displayHeaderHeight,
|
|
20584
20713
|
rowIndexByActual,
|
|
20714
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20585
20715
|
rowPrefixSums
|
|
20586
20716
|
}),
|
|
20587
20717
|
shape
|
|
@@ -20591,8 +20721,10 @@ function XlsxGrid({
|
|
|
20591
20721
|
colPrefixSums,
|
|
20592
20722
|
actualColPrefixSums,
|
|
20593
20723
|
actualRowPrefixSums,
|
|
20594
|
-
|
|
20595
|
-
|
|
20724
|
+
displayHeaderHeight,
|
|
20725
|
+
displayEffectiveColWidths,
|
|
20726
|
+
displayEffectiveRowHeights,
|
|
20727
|
+
displayRowHeaderWidth,
|
|
20596
20728
|
rowIndexByActual,
|
|
20597
20729
|
rowPrefixSums,
|
|
20598
20730
|
shapes,
|
|
@@ -20604,12 +20736,14 @@ function XlsxGrid({
|
|
|
20604
20736
|
const chartRects = React4.useMemo(
|
|
20605
20737
|
() => showImages ? charts.map((chart) => ({
|
|
20606
20738
|
chart,
|
|
20607
|
-
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, {
|
|
20608
20740
|
actualColPrefixSums,
|
|
20609
20741
|
actualRowPrefixSums,
|
|
20610
20742
|
colIndexByActual,
|
|
20611
20743
|
colPrefixSums,
|
|
20744
|
+
headerHeight: displayHeaderHeight,
|
|
20612
20745
|
rowIndexByActual,
|
|
20746
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
20613
20747
|
rowPrefixSums
|
|
20614
20748
|
})
|
|
20615
20749
|
})) : [],
|
|
@@ -20620,8 +20754,10 @@ function XlsxGrid({
|
|
|
20620
20754
|
charts,
|
|
20621
20755
|
colIndexByActual,
|
|
20622
20756
|
colPrefixSums,
|
|
20623
|
-
|
|
20624
|
-
|
|
20757
|
+
displayHeaderHeight,
|
|
20758
|
+
displayEffectiveColWidths,
|
|
20759
|
+
displayEffectiveRowHeights,
|
|
20760
|
+
displayRowHeaderWidth,
|
|
20625
20761
|
rowIndexByActual,
|
|
20626
20762
|
rowPrefixSums,
|
|
20627
20763
|
showImages,
|
|
@@ -20667,15 +20803,15 @@ function XlsxGrid({
|
|
|
20667
20803
|
if (startRowIndex === void 0 || endRowIndex === void 0 || startColIndex === void 0 || endColIndex === void 0) {
|
|
20668
20804
|
return null;
|
|
20669
20805
|
}
|
|
20670
|
-
let left =
|
|
20671
|
-
let top =
|
|
20806
|
+
let left = displayRowHeaderWidth + sumPrefixRange(colPrefixSums, 0, startColIndex - 1);
|
|
20807
|
+
let top = displayHeaderHeight + sumPrefixRange(rowPrefixSums, 0, startRowIndex - 1);
|
|
20672
20808
|
let width = sumPrefixRange(colPrefixSums, startColIndex, endColIndex);
|
|
20673
20809
|
let height = sumPrefixRange(rowPrefixSums, startRowIndex, endRowIndex);
|
|
20674
20810
|
const columnPreview = columnPreviewRef.current;
|
|
20675
20811
|
if (columnPreview) {
|
|
20676
20812
|
const previewIndex = colIndexByActual.get(columnPreview.actualIndex);
|
|
20677
20813
|
if (previewIndex !== void 0) {
|
|
20678
|
-
const baseWidth =
|
|
20814
|
+
const baseWidth = displayEffectiveColWidths[previewIndex] ?? displayDefaultColWidth;
|
|
20679
20815
|
const widthDelta = columnPreview.size - baseWidth;
|
|
20680
20816
|
if (previewIndex < startColIndex) {
|
|
20681
20817
|
left += widthDelta;
|
|
@@ -20689,7 +20825,7 @@ function XlsxGrid({
|
|
|
20689
20825
|
if (rowPreview) {
|
|
20690
20826
|
const previewIndex = rowIndexByActual.get(rowPreview.actualIndex);
|
|
20691
20827
|
if (previewIndex !== void 0) {
|
|
20692
|
-
const baseHeight =
|
|
20828
|
+
const baseHeight = displayEffectiveRowHeights[previewIndex] ?? displayDefaultRowHeight;
|
|
20693
20829
|
const heightDelta = rowPreview.size - baseHeight;
|
|
20694
20830
|
if (previewIndex < startRowIndex) {
|
|
20695
20831
|
top += heightDelta;
|
|
@@ -20701,11 +20837,11 @@ function XlsxGrid({
|
|
|
20701
20837
|
}
|
|
20702
20838
|
return {
|
|
20703
20839
|
height: Math.max(0, height),
|
|
20704
|
-
left: Math.max(
|
|
20705
|
-
top: Math.max(
|
|
20840
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20841
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20706
20842
|
width: Math.max(0, width)
|
|
20707
20843
|
};
|
|
20708
|
-
}, [colIndexByActual, colPrefixSums,
|
|
20844
|
+
}, [colIndexByActual, colPrefixSums, displayDefaultColWidth, displayDefaultRowHeight, displayEffectiveColWidths, displayEffectiveRowHeights, displayHeaderHeight, displayRowHeaderWidth, rowIndexByActual, rowPrefixSums]);
|
|
20709
20845
|
const resolveMountedRangeOverlayRect = React4.useCallback((range, geometryRect) => {
|
|
20710
20846
|
const normalized = normalizeRange2(range);
|
|
20711
20847
|
const startRect = resolveMountedCellOverlayRectForAddress(normalized.start);
|
|
@@ -20722,11 +20858,11 @@ function XlsxGrid({
|
|
|
20722
20858
|
const bottom = bottomRect ? bottomRect.top + bottomRect.height : geometryRect.top + geometryRect.height;
|
|
20723
20859
|
return {
|
|
20724
20860
|
height: Math.max(0, bottom - top),
|
|
20725
|
-
left: Math.max(
|
|
20726
|
-
top: Math.max(
|
|
20861
|
+
left: Math.max(displayRowHeaderWidth, left),
|
|
20862
|
+
top: Math.max(displayHeaderHeight, top),
|
|
20727
20863
|
width: Math.max(0, right - left)
|
|
20728
20864
|
};
|
|
20729
|
-
}, [resolveMountedCellOverlayRectForAddress]);
|
|
20865
|
+
}, [displayHeaderHeight, displayRowHeaderWidth, resolveMountedCellOverlayRectForAddress]);
|
|
20730
20866
|
const resolveDragPreviewRect = React4.useCallback((range) => {
|
|
20731
20867
|
const dragState = selectionDragRef.current;
|
|
20732
20868
|
if (!dragState || !dragState.didDrag || dragState.axis !== "cell" || !dragState.originOverlayRect) {
|
|
@@ -20844,11 +20980,11 @@ function XlsxGrid({
|
|
|
20844
20980
|
overlay.style.visibility = "visible";
|
|
20845
20981
|
const fillHandle = fillHandleRef.current;
|
|
20846
20982
|
if (fillHandle) {
|
|
20847
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20848
|
-
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`;
|
|
20849
20985
|
}
|
|
20850
20986
|
applyHeaderSelection(range);
|
|
20851
|
-
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect]);
|
|
20987
|
+
}, [applyHeaderSelection, resolveDragPreviewRect, resolveGeometryOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20852
20988
|
const applyPreviewOverlayFromElement = React4.useCallback((element, range) => {
|
|
20853
20989
|
const overlay = selectionOverlayRef.current;
|
|
20854
20990
|
if (!overlay) {
|
|
@@ -20867,11 +21003,11 @@ function XlsxGrid({
|
|
|
20867
21003
|
overlay.style.visibility = "visible";
|
|
20868
21004
|
const fillHandle = fillHandleRef.current;
|
|
20869
21005
|
if (fillHandle) {
|
|
20870
|
-
fillHandle.style.left = `${nextRect.left + nextRect.width - 4}px`;
|
|
20871
|
-
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`;
|
|
20872
21008
|
}
|
|
20873
21009
|
applyHeaderSelection(range);
|
|
20874
|
-
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect]);
|
|
21010
|
+
}, [applyHeaderSelection, resolveMountedCellOverlayRect, resolveOverlayRect, zoomFactor]);
|
|
20875
21011
|
const syncActiveValidationOverlay = React4.useCallback((cell) => {
|
|
20876
21012
|
const overlay = activeValidationOverlayRef.current;
|
|
20877
21013
|
if (!overlay || !cell || editingCellRef.current || selectionDragRef.current || fillDragRef.current) {
|
|
@@ -20889,11 +21025,11 @@ function XlsxGrid({
|
|
|
20889
21025
|
overlay.style.visibility = "hidden";
|
|
20890
21026
|
return;
|
|
20891
21027
|
}
|
|
20892
|
-
overlay.style.left = `${rect.left + rect.width - 16}px`;
|
|
21028
|
+
overlay.style.left = `${rect.left + rect.width - 16 * zoomFactor}px`;
|
|
20893
21029
|
overlay.style.top = `${rect.top + rect.height / 2}px`;
|
|
20894
21030
|
overlay.style.opacity = "1";
|
|
20895
21031
|
overlay.style.visibility = "visible";
|
|
20896
|
-
}, [getCellData, resolveOverlayRect]);
|
|
21032
|
+
}, [getCellData, resolveOverlayRect, zoomFactor]);
|
|
20897
21033
|
const commitSelectionRange = React4.useCallback((range) => {
|
|
20898
21034
|
const normalized = normalizeRange2(range);
|
|
20899
21035
|
if (selectionRef.current && rangesEqual(selectionRef.current, normalized) && isSameCell(activeCellRef.current, normalized.end) && selectedChartIdRef.current === null && selectedImageIdRef.current === null) {
|
|
@@ -20931,7 +21067,7 @@ function XlsxGrid({
|
|
|
20931
21067
|
}
|
|
20932
21068
|
pendingResizePreviewRef.current = {
|
|
20933
21069
|
actualIndex: state.actualIndex,
|
|
20934
|
-
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)),
|
|
20935
21071
|
type: state.type
|
|
20936
21072
|
};
|
|
20937
21073
|
if (resizeFrameRef.current !== null) {
|
|
@@ -20978,9 +21114,9 @@ function XlsxGrid({
|
|
|
20978
21114
|
}
|
|
20979
21115
|
if (preview && preview.actualIndex === resizeState.actualIndex && preview.type === resizeState.type) {
|
|
20980
21116
|
if (preview.type === "column") {
|
|
20981
|
-
controller.resizeColumn(preview.actualIndex, preview.size);
|
|
21117
|
+
controller.resizeColumn(preview.actualIndex, preview.size / zoomFactor);
|
|
20982
21118
|
} else {
|
|
20983
|
-
controller.resizeRow(preview.actualIndex, preview.size);
|
|
21119
|
+
controller.resizeRow(preview.actualIndex, preview.size / zoomFactor);
|
|
20984
21120
|
}
|
|
20985
21121
|
}
|
|
20986
21122
|
}
|
|
@@ -20997,7 +21133,7 @@ function XlsxGrid({
|
|
|
20997
21133
|
resizeFrameRef.current = null;
|
|
20998
21134
|
}
|
|
20999
21135
|
};
|
|
21000
|
-
}, [applyColumnPreview, applyRowPreview, controller, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21136
|
+
}, [applyColumnPreview, applyRowPreview, controller, displayDefaultColWidth, displayDefaultRowHeight, refreshOverlayFromCurrentSelection, rowVirtualizer, shouldVirtualizeRows, zoomFactor]);
|
|
21001
21137
|
function buildDraggedSelectionRange(dragState, cell) {
|
|
21002
21138
|
if (dragState.axis === "row") {
|
|
21003
21139
|
if (firstVisibleCol === void 0 || lastVisibleCol === void 0) {
|
|
@@ -21326,21 +21462,21 @@ function XlsxGrid({
|
|
|
21326
21462
|
color: palette.mutedText,
|
|
21327
21463
|
cursor: "pointer",
|
|
21328
21464
|
display: "inline-flex",
|
|
21329
|
-
fontSize: 10,
|
|
21330
|
-
height: 16,
|
|
21465
|
+
fontSize: 10 * zoomFactor,
|
|
21466
|
+
height: 16 * zoomFactor,
|
|
21331
21467
|
justifyContent: "center",
|
|
21332
21468
|
padding: 0,
|
|
21333
21469
|
position: "absolute",
|
|
21334
|
-
right: 4,
|
|
21335
|
-
top: 3,
|
|
21336
|
-
width: 16,
|
|
21470
|
+
right: 4 * zoomFactor,
|
|
21471
|
+
top: 3 * zoomFactor,
|
|
21472
|
+
width: 16 * zoomFactor,
|
|
21337
21473
|
zIndex: 6
|
|
21338
21474
|
},
|
|
21339
21475
|
type: "button",
|
|
21340
21476
|
children: direction === "ascending" ? "\u25B2" : direction === "descending" ? "\u25BC" : "\u25BE"
|
|
21341
21477
|
}
|
|
21342
21478
|
);
|
|
21343
|
-
}, [effectiveTables, palette.mutedText, sortState]);
|
|
21479
|
+
}, [effectiveTables, palette.mutedText, sortState, zoomFactor]);
|
|
21344
21480
|
const startChartMove = React4.useCallback((event, chart, rect) => {
|
|
21345
21481
|
if (event.button !== 0) {
|
|
21346
21482
|
return;
|
|
@@ -21546,7 +21682,7 @@ function XlsxGrid({
|
|
|
21546
21682
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21547
21683
|
index,
|
|
21548
21684
|
key: actualRow,
|
|
21549
|
-
size:
|
|
21685
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21550
21686
|
start: rowPrefixSums[index] ?? 0
|
|
21551
21687
|
})) : (() => {
|
|
21552
21688
|
const renderedRowsByIndex = /* @__PURE__ */ new Map();
|
|
@@ -21567,27 +21703,25 @@ function XlsxGrid({
|
|
|
21567
21703
|
end: rowPrefixSums[index + 1] ?? 0,
|
|
21568
21704
|
index,
|
|
21569
21705
|
key: visibleRows[index] ?? index,
|
|
21570
|
-
size:
|
|
21706
|
+
size: displayEffectiveRowHeights[index] ?? displayDefaultRowHeight,
|
|
21571
21707
|
start: rowPrefixSums[index] ?? 0
|
|
21572
21708
|
});
|
|
21573
21709
|
});
|
|
21574
21710
|
return Array.from(renderedRowsByIndex.values()).sort((left, right) => left.index - right.index);
|
|
21575
21711
|
})();
|
|
21576
21712
|
const totalHeight = shouldVirtualizeRows ? rowVirtualizer.getTotalSize() : rowPrefixSums[rowPrefixSums.length - 1] ?? 0;
|
|
21577
|
-
const totalWidth = totalContentWidth +
|
|
21578
|
-
const sheetContentHeight =
|
|
21579
|
-
const zoomedSheetHeight = sheetContentHeight * zoomFactor;
|
|
21580
|
-
const zoomedSheetWidth = totalWidth * zoomFactor;
|
|
21713
|
+
const totalWidth = totalContentWidth + displayRowHeaderWidth;
|
|
21714
|
+
const sheetContentHeight = displayHeaderHeight + totalHeight;
|
|
21581
21715
|
const { fill: selectionFill, header: selectionHeaderSurface, stroke: selectionStroke } = resolveSelectionColors({
|
|
21582
21716
|
palette,
|
|
21583
21717
|
selectionColor,
|
|
21584
21718
|
selectionFillColor,
|
|
21585
21719
|
selectionHeaderColor
|
|
21586
21720
|
});
|
|
21587
|
-
const selectionBorderWidth = 1
|
|
21721
|
+
const selectionBorderWidth = Math.max(1, zoomFactor);
|
|
21588
21722
|
const rowColSpan = renderedCols.length + 1 + (leadingColumnSpacerWidth > 0 ? 1 : 0) + (trailingColumnSpacerWidth > 0 ? 1 : 0);
|
|
21589
21723
|
const gutterSeparatorShadow = `inset -1px 0 0 ${palette.border}, inset 0 -1px 0 ${palette.border}`;
|
|
21590
|
-
const headerCellStyle = {
|
|
21724
|
+
const headerCellStyle = scaleCssProperties({
|
|
21591
21725
|
backgroundColor: palette.headerSurface,
|
|
21592
21726
|
borderBottom: "none",
|
|
21593
21727
|
borderRight: "none",
|
|
@@ -21604,8 +21738,8 @@ function XlsxGrid({
|
|
|
21604
21738
|
userSelect: "none",
|
|
21605
21739
|
whiteSpace: "nowrap",
|
|
21606
21740
|
zIndex: 50
|
|
21607
|
-
};
|
|
21608
|
-
const columnResizeHandleStyle = {
|
|
21741
|
+
}, zoomFactor);
|
|
21742
|
+
const columnResizeHandleStyle = scaleCssProperties({
|
|
21609
21743
|
backgroundColor: "transparent",
|
|
21610
21744
|
cursor: "col-resize",
|
|
21611
21745
|
position: "absolute",
|
|
@@ -21614,17 +21748,23 @@ function XlsxGrid({
|
|
|
21614
21748
|
width: 16,
|
|
21615
21749
|
height: "100%",
|
|
21616
21750
|
zIndex: 5
|
|
21617
|
-
};
|
|
21751
|
+
}, zoomFactor);
|
|
21618
21752
|
function resolveDrawingPane(rect) {
|
|
21619
21753
|
return resolveFrozenDrawingPane(
|
|
21620
21754
|
rect,
|
|
21621
21755
|
frozenRows,
|
|
21622
21756
|
frozenCols,
|
|
21623
|
-
|
|
21624
|
-
|
|
21757
|
+
displayActualRowHeights,
|
|
21758
|
+
displayActualColWidths,
|
|
21625
21759
|
activeSheet?.freezePanes ?? null,
|
|
21626
21760
|
stickyTopByRow,
|
|
21627
|
-
stickyLeftByCol
|
|
21761
|
+
stickyLeftByCol,
|
|
21762
|
+
{
|
|
21763
|
+
defaultColWidth: displayDefaultColWidth,
|
|
21764
|
+
defaultRowHeight: displayDefaultRowHeight,
|
|
21765
|
+
headerHeight: displayHeaderHeight,
|
|
21766
|
+
rowHeaderWidth: displayRowHeaderWidth
|
|
21767
|
+
}
|
|
21628
21768
|
);
|
|
21629
21769
|
}
|
|
21630
21770
|
function renderShapeDrawing(shape, rect, pane) {
|
|
@@ -21641,12 +21781,12 @@ function XlsxGrid({
|
|
|
21641
21781
|
const groupScaleX = shape.scaleX ?? 1;
|
|
21642
21782
|
const groupScaleY = shape.scaleY ?? 1;
|
|
21643
21783
|
const strokeScale = Math.max(groupScaleX, groupScaleY);
|
|
21644
|
-
const textScale = strokeScale;
|
|
21784
|
+
const textScale = strokeScale * zoomFactor;
|
|
21645
21785
|
const textWidth = groupScaleX !== 0 ? rect.width / groupScaleX : rect.width;
|
|
21646
21786
|
const textHeight = groupScaleY !== 0 ? rect.height / groupScaleY : rect.height;
|
|
21647
21787
|
const vectorShape = resolveShapeVector(shape);
|
|
21648
21788
|
const strokeColor = shape.stroke?.none ? "transparent" : shape.stroke?.color ?? "transparent";
|
|
21649
|
-
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale;
|
|
21789
|
+
const scaledStrokeWidth = (shape.stroke?.widthPx ?? (shape.geometry === "line" ? 2 : 1)) * strokeScale * zoomFactor;
|
|
21650
21790
|
const headMarkerId = `${shape.id}-${pane}-head-marker`;
|
|
21651
21791
|
const tailMarkerId = `${shape.id}-${pane}-tail-marker`;
|
|
21652
21792
|
const headMarker = vectorShape ? resolveShapeLineEndMarker(
|
|
@@ -21666,7 +21806,7 @@ function XlsxGrid({
|
|
|
21666
21806
|
vectorShape.viewBox
|
|
21667
21807
|
) : null;
|
|
21668
21808
|
const style = {
|
|
21669
|
-
...buildShapeContainerStyle(shape, rect),
|
|
21809
|
+
...buildShapeContainerStyle(shape, rect, zoomFactor),
|
|
21670
21810
|
...vectorShape ? {
|
|
21671
21811
|
backgroundColor: "transparent",
|
|
21672
21812
|
border: "none"
|
|
@@ -21729,13 +21869,13 @@ function XlsxGrid({
|
|
|
21729
21869
|
display: "flex",
|
|
21730
21870
|
flex: 1,
|
|
21731
21871
|
flexDirection: "column",
|
|
21732
|
-
gap: 2,
|
|
21872
|
+
gap: 2 * zoomFactor,
|
|
21733
21873
|
height: textHeight,
|
|
21734
21874
|
justifyContent: shape.textBox?.verticalAlign === "middle" ? "center" : shape.textBox?.verticalAlign === "bottom" ? "flex-end" : "flex-start",
|
|
21735
|
-
paddingBottom: inset?.bottom ?? 4,
|
|
21736
|
-
paddingLeft: inset?.left ?? 6,
|
|
21737
|
-
paddingRight: inset?.right ?? 6,
|
|
21738
|
-
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,
|
|
21739
21879
|
pointerEvents: "none",
|
|
21740
21880
|
position: "relative",
|
|
21741
21881
|
transform: groupScaleX !== 1 || groupScaleY !== 1 ? `scale(${groupScaleX}, ${groupScaleY})` : void 0,
|
|
@@ -21807,8 +21947,8 @@ function XlsxGrid({
|
|
|
21807
21947
|
"div",
|
|
21808
21948
|
{
|
|
21809
21949
|
style: {
|
|
21810
|
-
border:
|
|
21811
|
-
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}`,
|
|
21812
21952
|
boxSizing: "border-box",
|
|
21813
21953
|
inset: 0,
|
|
21814
21954
|
pointerEvents: "none",
|
|
@@ -21818,7 +21958,7 @@ function XlsxGrid({
|
|
|
21818
21958
|
"div",
|
|
21819
21959
|
{
|
|
21820
21960
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21821
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21961
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21822
21962
|
},
|
|
21823
21963
|
position
|
|
21824
21964
|
)) : null
|
|
@@ -21830,7 +21970,7 @@ function XlsxGrid({
|
|
|
21830
21970
|
startImageResize(event, image, rect, position);
|
|
21831
21971
|
}
|
|
21832
21972
|
},
|
|
21833
|
-
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" }
|
|
21834
21974
|
}),
|
|
21835
21975
|
image,
|
|
21836
21976
|
rect
|
|
@@ -21838,8 +21978,8 @@ function XlsxGrid({
|
|
|
21838
21978
|
"div",
|
|
21839
21979
|
{
|
|
21840
21980
|
style: {
|
|
21841
|
-
border:
|
|
21842
|
-
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}`,
|
|
21843
21983
|
boxSizing: "border-box",
|
|
21844
21984
|
inset: 0,
|
|
21845
21985
|
pointerEvents: "none",
|
|
@@ -21849,7 +21989,7 @@ function XlsxGrid({
|
|
|
21849
21989
|
"div",
|
|
21850
21990
|
{
|
|
21851
21991
|
onPointerDown: (event) => startImageResize(event, image, rect, position),
|
|
21852
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
21992
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21853
21993
|
},
|
|
21854
21994
|
position
|
|
21855
21995
|
)) : null
|
|
@@ -21911,8 +22051,8 @@ function XlsxGrid({
|
|
|
21911
22051
|
"div",
|
|
21912
22052
|
{
|
|
21913
22053
|
style: {
|
|
21914
|
-
border:
|
|
21915
|
-
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}`,
|
|
21916
22056
|
boxSizing: "border-box",
|
|
21917
22057
|
inset: 0,
|
|
21918
22058
|
pointerEvents: "none",
|
|
@@ -21922,7 +22062,7 @@ function XlsxGrid({
|
|
|
21922
22062
|
"div",
|
|
21923
22063
|
{
|
|
21924
22064
|
onPointerDown: (event) => startChartResize(event, chart, rect, position),
|
|
21925
|
-
style: resolveImageHandleStyle(position, selectionStroke, palette.surface)
|
|
22065
|
+
style: resolveImageHandleStyle(position, selectionStroke, palette.surface, zoomFactor)
|
|
21926
22066
|
},
|
|
21927
22067
|
position
|
|
21928
22068
|
)) : null
|
|
@@ -22158,8 +22298,8 @@ function XlsxGrid({
|
|
|
22158
22298
|
if (!interaction) {
|
|
22159
22299
|
return;
|
|
22160
22300
|
}
|
|
22161
|
-
const deltaX =
|
|
22162
|
-
const deltaY =
|
|
22301
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22302
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22163
22303
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22164
22304
|
interaction.didMove = true;
|
|
22165
22305
|
}
|
|
@@ -22168,7 +22308,12 @@ function XlsxGrid({
|
|
|
22168
22308
|
...interaction.baseRect,
|
|
22169
22309
|
left: interaction.baseRect.left + deltaX,
|
|
22170
22310
|
top: interaction.baseRect.top + deltaY
|
|
22171
|
-
} : 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
|
+
}
|
|
22172
22317
|
);
|
|
22173
22318
|
scheduleImagePreviewRect({ id: interaction.imageId, rect: nextRect });
|
|
22174
22319
|
};
|
|
@@ -22203,7 +22348,7 @@ function XlsxGrid({
|
|
|
22203
22348
|
if (interaction.didMove) {
|
|
22204
22349
|
skipNextImageClickRef.current = interaction.imageId;
|
|
22205
22350
|
}
|
|
22206
|
-
setImageRect(interaction.imageId, preview.rect);
|
|
22351
|
+
setImageRect(interaction.imageId, toLogicalRect(preview.rect));
|
|
22207
22352
|
}
|
|
22208
22353
|
imagePreviewRectRef.current = null;
|
|
22209
22354
|
setImagePreviewRect(null);
|
|
@@ -22223,8 +22368,8 @@ function XlsxGrid({
|
|
|
22223
22368
|
if (!interaction) {
|
|
22224
22369
|
return;
|
|
22225
22370
|
}
|
|
22226
|
-
const deltaX =
|
|
22227
|
-
const deltaY =
|
|
22371
|
+
const deltaX = event.clientX - interaction.startClientX;
|
|
22372
|
+
const deltaY = event.clientY - interaction.startClientY;
|
|
22228
22373
|
if (!interaction.didMove && (Math.abs(deltaX) > 3 || Math.abs(deltaY) > 3)) {
|
|
22229
22374
|
interaction.didMove = true;
|
|
22230
22375
|
}
|
|
@@ -22233,7 +22378,12 @@ function XlsxGrid({
|
|
|
22233
22378
|
...interaction.baseRect,
|
|
22234
22379
|
left: interaction.baseRect.left + deltaX,
|
|
22235
22380
|
top: interaction.baseRect.top + deltaY
|
|
22236
|
-
} : 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
|
+
}
|
|
22237
22387
|
);
|
|
22238
22388
|
scheduleChartPreviewRect({ id: interaction.chartId, rect: nextRect });
|
|
22239
22389
|
};
|
|
@@ -22268,7 +22418,7 @@ function XlsxGrid({
|
|
|
22268
22418
|
if (interaction.didMove) {
|
|
22269
22419
|
skipNextChartClickRef.current = interaction.chartId;
|
|
22270
22420
|
}
|
|
22271
|
-
setChartRect(interaction.chartId, preview.rect);
|
|
22421
|
+
setChartRect(interaction.chartId, toLogicalRect(preview.rect));
|
|
22272
22422
|
}
|
|
22273
22423
|
chartPreviewRectRef.current = null;
|
|
22274
22424
|
setChartPreviewRect(null);
|
|
@@ -22450,8 +22600,8 @@ function XlsxGrid({
|
|
|
22450
22600
|
minHeight: "100%",
|
|
22451
22601
|
minWidth: "100%",
|
|
22452
22602
|
position: "relative",
|
|
22453
|
-
width:
|
|
22454
|
-
height:
|
|
22603
|
+
width: totalWidth,
|
|
22604
|
+
height: sheetContentHeight
|
|
22455
22605
|
},
|
|
22456
22606
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
22457
22607
|
"div",
|
|
@@ -22462,9 +22612,6 @@ function XlsxGrid({
|
|
|
22462
22612
|
left: 0,
|
|
22463
22613
|
position: "absolute",
|
|
22464
22614
|
top: 0,
|
|
22465
|
-
transform: void 0,
|
|
22466
|
-
transformOrigin: "top left",
|
|
22467
|
-
zoom: useNativeZoomForStickyLayout ? zoomFactor : void 0,
|
|
22468
22615
|
width: totalWidth
|
|
22469
22616
|
},
|
|
22470
22617
|
children: [
|
|
@@ -22487,7 +22634,7 @@ function XlsxGrid({
|
|
|
22487
22634
|
},
|
|
22488
22635
|
children: [
|
|
22489
22636
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("colgroup", { children: [
|
|
22490
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width:
|
|
22637
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: displayRowHeaderWidth } }),
|
|
22491
22638
|
leadingColumnSpacerWidth > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("col", { style: { width: leadingColumnSpacerWidth } }) : null,
|
|
22492
22639
|
renderedCols.map((column) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
22493
22640
|
"col",
|
|
@@ -22513,7 +22660,7 @@ function XlsxGrid({
|
|
|
22513
22660
|
...headerCellStyle,
|
|
22514
22661
|
backgroundColor: palette.headerSurface,
|
|
22515
22662
|
left: 0,
|
|
22516
|
-
width:
|
|
22663
|
+
width: displayRowHeaderWidth,
|
|
22517
22664
|
zIndex: 60
|
|
22518
22665
|
}
|
|
22519
22666
|
}
|
|
@@ -22588,10 +22735,12 @@ function XlsxGrid({
|
|
|
22588
22735
|
readOnly,
|
|
22589
22736
|
renderCellAdornment,
|
|
22590
22737
|
rowHeight: virtualRow.size,
|
|
22738
|
+
rowHeaderWidth: displayRowHeaderWidth,
|
|
22591
22739
|
stickyLeftByCol,
|
|
22592
22740
|
stickyTop: stickyTopByRow.get(actualRow),
|
|
22593
22741
|
trailingSpacerWidth: trailingColumnSpacerWidth,
|
|
22594
|
-
visibleCols: renderedCols
|
|
22742
|
+
visibleCols: renderedCols,
|
|
22743
|
+
zoomFactor
|
|
22595
22744
|
},
|
|
22596
22745
|
virtualRow.key
|
|
22597
22746
|
)
|
|
@@ -22640,16 +22789,16 @@ function XlsxGrid({
|
|
|
22640
22789
|
alignItems: "center",
|
|
22641
22790
|
color: palette.mutedText,
|
|
22642
22791
|
display: "inline-flex",
|
|
22643
|
-
fontSize: 10,
|
|
22792
|
+
fontSize: 10 * zoomFactor,
|
|
22644
22793
|
fontWeight: 700,
|
|
22645
|
-
height: 16,
|
|
22794
|
+
height: 16 * zoomFactor,
|
|
22646
22795
|
justifyContent: "center",
|
|
22647
22796
|
opacity: 0,
|
|
22648
22797
|
pointerEvents: "none",
|
|
22649
22798
|
position: "absolute",
|
|
22650
22799
|
transform: "translateY(-50%)",
|
|
22651
22800
|
visibility: "hidden",
|
|
22652
|
-
width: 12,
|
|
22801
|
+
width: 12 * zoomFactor,
|
|
22653
22802
|
zIndex: 26
|
|
22654
22803
|
},
|
|
22655
22804
|
children: "\u25BE"
|
|
@@ -22669,16 +22818,16 @@ function XlsxGrid({
|
|
|
22669
22818
|
},
|
|
22670
22819
|
style: {
|
|
22671
22820
|
backgroundColor: selectionStroke,
|
|
22672
|
-
border:
|
|
22821
|
+
border: `${Math.max(1, zoomFactor)}px solid ${palette.surface}`,
|
|
22673
22822
|
contain: "layout paint",
|
|
22674
22823
|
cursor: "crosshair",
|
|
22675
22824
|
display: !readOnly && resolvedSelectionOverlay ? "block" : "none",
|
|
22676
|
-
height: 8,
|
|
22677
|
-
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 : 0,
|
|
22825
|
+
height: 8 * zoomFactor,
|
|
22826
|
+
left: resolvedSelectionOverlay ? resolvedSelectionOverlay.left + resolvedSelectionOverlay.width - 4 * zoomFactor : 0,
|
|
22678
22827
|
pointerEvents: "auto",
|
|
22679
22828
|
position: "absolute",
|
|
22680
|
-
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 : 0,
|
|
22681
|
-
width: 8,
|
|
22829
|
+
top: resolvedSelectionOverlay ? resolvedSelectionOverlay.top + resolvedSelectionOverlay.height - 4 * zoomFactor : 0,
|
|
22830
|
+
width: 8 * zoomFactor,
|
|
22682
22831
|
zIndex: 25
|
|
22683
22832
|
}
|
|
22684
22833
|
}
|
|
@@ -22689,7 +22838,7 @@ function XlsxGrid({
|
|
|
22689
22838
|
ref: tableMenuRef,
|
|
22690
22839
|
style: {
|
|
22691
22840
|
color: palette.text,
|
|
22692
|
-
left: Math.max(
|
|
22841
|
+
left: Math.max(displayRowHeaderWidth + 4 * zoomFactor, openTableMenuState.left),
|
|
22693
22842
|
position: "absolute",
|
|
22694
22843
|
top: openTableMenuState.top,
|
|
22695
22844
|
zIndex: 50
|
|
@@ -22729,7 +22878,8 @@ function XlsxViewerInner({
|
|
|
22729
22878
|
emptyState,
|
|
22730
22879
|
errorState,
|
|
22731
22880
|
fileTooLargeState,
|
|
22732
|
-
height
|
|
22881
|
+
height,
|
|
22882
|
+
isDark = false,
|
|
22733
22883
|
loadingComponent,
|
|
22734
22884
|
loadingState,
|
|
22735
22885
|
renderChartLoading,
|
|
@@ -22744,15 +22894,14 @@ function XlsxViewerInner({
|
|
|
22744
22894
|
showDefaultToolbar = true,
|
|
22745
22895
|
toolbar
|
|
22746
22896
|
}) {
|
|
22747
|
-
const palette = useViewerPalette();
|
|
22748
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerContext.Provider, { value: controller, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
22897
|
+
const palette = useViewerPalette(isDark);
|
|
22898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerContext.Provider, { value: controller, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
22749
22899
|
"div",
|
|
22750
22900
|
{
|
|
22751
22901
|
className: classNames("react-xlsx-viewer", className),
|
|
22752
22902
|
style: {
|
|
22753
22903
|
blockSize: height,
|
|
22754
22904
|
backgroundColor: palette.surface,
|
|
22755
|
-
border: `1px solid ${palette.border}`,
|
|
22756
22905
|
borderRadius: rounded ? 12 : 0,
|
|
22757
22906
|
color: palette.text,
|
|
22758
22907
|
display: "flex",
|
|
@@ -22790,7 +22939,7 @@ function XlsxViewerInner({
|
|
|
22790
22939
|
) })
|
|
22791
22940
|
]
|
|
22792
22941
|
}
|
|
22793
|
-
) });
|
|
22942
|
+
) }) });
|
|
22794
22943
|
}
|
|
22795
22944
|
function XlsxViewerWithInlineController(props) {
|
|
22796
22945
|
const controller = useXlsxViewerController(props);
|
|
@@ -22798,16 +22947,17 @@ function XlsxViewerWithInlineController(props) {
|
|
|
22798
22947
|
}
|
|
22799
22948
|
function XlsxViewerProviderWithInlineController({
|
|
22800
22949
|
children,
|
|
22950
|
+
isDark = false,
|
|
22801
22951
|
...options
|
|
22802
22952
|
}) {
|
|
22803
22953
|
const controller = useXlsxViewerController(options);
|
|
22804
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerContext.Provider, { value: controller, children });
|
|
22954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerContext.Provider, { value: controller, children }) });
|
|
22805
22955
|
}
|
|
22806
|
-
function XlsxViewerProvider({ children, controller, ...options }) {
|
|
22956
|
+
function XlsxViewerProvider({ children, controller, isDark = false, ...options }) {
|
|
22807
22957
|
if (controller) {
|
|
22808
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerContext.Provider, { value: controller, children });
|
|
22958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerAppearanceContext.Provider, { value: { isDark }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewerContext.Provider, { value: controller, children }) });
|
|
22809
22959
|
}
|
|
22810
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(XlsxViewerProviderWithInlineController, { ...options, children });
|
|
22960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(XlsxViewerProviderWithInlineController, { ...options, isDark, children });
|
|
22811
22961
|
}
|
|
22812
22962
|
function useXlsxViewer() {
|
|
22813
22963
|
const context = React4.useContext(ViewerContext);
|
|
@@ -23133,7 +23283,8 @@ function XlsxViewer(props) {
|
|
|
23133
23283
|
}
|
|
23134
23284
|
function DefaultXlsxToolbar() {
|
|
23135
23285
|
const controller = useXlsxViewer();
|
|
23136
|
-
const
|
|
23286
|
+
const { isDark } = React4.useContext(ViewerAppearanceContext);
|
|
23287
|
+
const palette = useViewerPalette(isDark);
|
|
23137
23288
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DefaultToolbar, { controller, palette });
|
|
23138
23289
|
}
|
|
23139
23290
|
// Annotate the CommonJS export names for ESM import in node:
|