@extend-ai/react-xlsx 0.23.2 → 0.24.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/README.md +17 -1
- package/dist/{chunk-UICWNF5V.js → chunk-2TLD35UF.js} +3 -27
- package/dist/chunk-2TLD35UF.js.map +1 -0
- package/dist/{chunk-M7QVMFYT.js → chunk-C4WTJIRG.js} +709 -487
- package/dist/chunk-C4WTJIRG.js.map +1 -0
- package/dist/{chunk-FGJY2TIS.cjs → chunk-DGNSB5M5.cjs} +2563 -2341
- package/dist/chunk-DGNSB5M5.cjs.map +1 -0
- package/dist/{chunk-A3WA6ZLI.cjs → chunk-GP5SOQQH.cjs} +3 -29
- package/dist/chunk-GP5SOQQH.cjs.map +1 -0
- package/dist/{chunk-MEZOJBL5.js → chunk-HAV76TR2.js} +57 -1
- package/dist/{chunk-MEZOJBL5.js.map → chunk-HAV76TR2.js.map} +1 -1
- package/dist/{chunk-JJJZYWAL.js → chunk-MNIFKMIL.js} +57 -1
- package/dist/chunk-MNIFKMIL.js.map +1 -0
- package/dist/{chunk-3JFYU42O.js → chunk-Q6YY3AB4.js} +2 -28
- package/dist/chunk-Q6YY3AB4.js.map +1 -0
- package/dist/{chunk-JCSAS3M2.cjs → chunk-XZJLPW64.cjs} +2 -26
- package/dist/chunk-XZJLPW64.cjs.map +1 -0
- package/dist/{chunk-TMYAG7GY.cjs → chunk-YOLIVKZD.cjs} +57 -1
- package/dist/chunk-YOLIVKZD.cjs.map +1 -0
- package/dist/{chunk-R3FQM7V3.cjs → chunk-Z4WMURVU.cjs} +57 -1
- package/dist/chunk-Z4WMURVU.cjs.map +1 -0
- package/dist/duke-sheets-provenance.json +5 -5
- package/dist/{duke_sheets_wasm-TLSZAVKP.cjs → duke_sheets_wasm-GM4K5QQX.cjs} +57 -1
- package/dist/duke_sheets_wasm-GM4K5QQX.cjs.map +1 -0
- package/dist/{duke_sheets_wasm-V4J6QYIZ.js → duke_sheets_wasm-MYY4ZNUI.js} +57 -1
- package/dist/duke_sheets_wasm-MYY4ZNUI.js.map +1 -0
- package/dist/{duke_sheets_wasm-R7KXJNYL.js → duke_sheets_wasm-UXZ2KTVD.js} +57 -1
- package/dist/duke_sheets_wasm-UXZ2KTVD.js.map +1 -0
- package/dist/duke_sheets_wasm_bg.wasm +0 -0
- package/dist/index.cjs +695 -606
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -7
- package/dist/index.d.ts +45 -7
- package/dist/index.js +674 -585
- package/dist/index.js.map +1 -1
- package/dist/{internal-BVZRgYaH.d.ts → internal-CwTqluL7.d.cts} +106 -64
- package/dist/{internal-BVZRgYaH.d.cts → internal-CwTqluL7.d.ts} +106 -64
- package/dist/internal.cjs +4 -4
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +3 -3
- package/dist/{shared-chart-V24MOVXX.js → shared-chart-24MCGSFJ.js} +2 -2
- package/dist/{shared-chart-N44DT2QV.cjs → shared-chart-7E6KMGTG.cjs} +3 -3
- package/dist/{shared-chart-N44DT2QV.cjs.map → shared-chart-7E6KMGTG.cjs.map} +1 -1
- package/dist/{shared-chart-64L5EL3Z.js → shared-chart-CGEK7EAB.js} +2 -2
- package/dist/{shared-chart-BZTEPO7C.cjs → shared-chart-GKNMM72Q.cjs} +15 -15
- package/dist/{shared-chart-BZTEPO7C.cjs.map → shared-chart-GKNMM72Q.cjs.map} +1 -1
- package/dist/vanilla.cjs +4 -4
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +3 -3
- package/dist/{workbook-runtime-O3QY5UED.js → workbook-runtime-56Y3B64Y.js} +8 -12
- package/dist/workbook-runtime-56Y3B64Y.js.map +1 -0
- package/dist/{workbook-runtime-FXUSOOFT.js → workbook-runtime-7DSKESFL.js} +8 -12
- package/dist/workbook-runtime-7DSKESFL.js.map +1 -0
- package/dist/{workbook-runtime-2HYFRGZD.cjs → workbook-runtime-MEI3CEWO.cjs} +64 -68
- package/dist/workbook-runtime-MEI3CEWO.cjs.map +1 -0
- package/dist/{workbook-runtime-OJDBGHMM.cjs → workbook-runtime-QFXDLSSI.cjs} +66 -70
- package/dist/workbook-runtime-QFXDLSSI.cjs.map +1 -0
- package/dist/xlsx-worker.js +7 -11
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-3JFYU42O.js.map +0 -1
- package/dist/chunk-A3WA6ZLI.cjs.map +0 -1
- package/dist/chunk-FGJY2TIS.cjs.map +0 -1
- package/dist/chunk-JCSAS3M2.cjs.map +0 -1
- package/dist/chunk-JJJZYWAL.js.map +0 -1
- package/dist/chunk-M7QVMFYT.js.map +0 -1
- package/dist/chunk-R3FQM7V3.cjs.map +0 -1
- package/dist/chunk-TMYAG7GY.cjs.map +0 -1
- package/dist/chunk-UICWNF5V.js.map +0 -1
- package/dist/duke_sheets_wasm-R7KXJNYL.js.map +0 -1
- package/dist/duke_sheets_wasm-TLSZAVKP.cjs.map +0 -1
- package/dist/duke_sheets_wasm-V4J6QYIZ.js.map +0 -1
- package/dist/workbook-runtime-2HYFRGZD.cjs.map +0 -1
- package/dist/workbook-runtime-FXUSOOFT.js.map +0 -1
- package/dist/workbook-runtime-O3QY5UED.js.map +0 -1
- package/dist/workbook-runtime-OJDBGHMM.cjs.map +0 -1
- /package/dist/{shared-chart-V24MOVXX.js.map → shared-chart-24MCGSFJ.js.map} +0 -0
- /package/dist/{shared-chart-64L5EL3Z.js.map → shared-chart-CGEK7EAB.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _chunkXZJLPW64cjs = require('./chunk-XZJLPW64.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
var
|
|
45
|
+
var _chunkYOLIVKZDcjs = require('./chunk-YOLIVKZD.cjs');
|
|
46
46
|
require('./chunk-JRWNIQWR.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
@@ -55,6 +55,47 @@ var _chunkJI2BMZ67cjs = require('./chunk-JI2BMZ67.cjs');
|
|
|
55
55
|
|
|
56
56
|
var _chunkAD4CGQN2cjs = require('./chunk-AD4CGQN2.cjs');
|
|
57
57
|
|
|
58
|
+
// src/selection-ranges.ts
|
|
59
|
+
function resolveFreezePanesCell(activeCell, selection) {
|
|
60
|
+
if (activeCell && selection && (activeCell.row < selection.start.row || activeCell.col < selection.start.col)) {
|
|
61
|
+
return selection.start;
|
|
62
|
+
}
|
|
63
|
+
return activeCell;
|
|
64
|
+
}
|
|
65
|
+
function subtractRange(area, cut) {
|
|
66
|
+
const top = Math.max(area.start.row, cut.start.row);
|
|
67
|
+
const bottom = Math.min(area.end.row, cut.end.row);
|
|
68
|
+
const left = Math.max(area.start.col, cut.start.col);
|
|
69
|
+
const right = Math.min(area.end.col, cut.end.col);
|
|
70
|
+
if (top > bottom || left > right) return [area];
|
|
71
|
+
const remaining = [];
|
|
72
|
+
if (area.start.row < top) remaining.push({ start: area.start, end: { row: top - 1, col: area.end.col } });
|
|
73
|
+
if (bottom < area.end.row) remaining.push({ start: { row: bottom + 1, col: area.start.col }, end: area.end });
|
|
74
|
+
if (area.start.col < left) remaining.push({ start: { row: top, col: area.start.col }, end: { row: bottom, col: left - 1 } });
|
|
75
|
+
if (right < area.end.col) remaining.push({ start: { row: top, col: right + 1 }, end: { row: bottom, col: area.end.col } });
|
|
76
|
+
return remaining;
|
|
77
|
+
}
|
|
78
|
+
function addSelectionRange(areas, range) {
|
|
79
|
+
return [...areas.flatMap((area) => subtractRange(area, range)), range];
|
|
80
|
+
}
|
|
81
|
+
function clipboardBands(areas) {
|
|
82
|
+
const first = areas[0];
|
|
83
|
+
if (!first) return null;
|
|
84
|
+
const sameExtent = (axis) => areas.every((area) => area.start[axis] === first.start[axis] && area.end[axis] === first.end[axis]);
|
|
85
|
+
const bands = (axis, ranges) => ranges.map((range) => ({ start: range.start[axis], end: range.end[axis] })).sort((a, b) => a.start - b.start);
|
|
86
|
+
if (sameExtent("col")) return { rows: bands("row", areas), cols: bands("col", [first]) };
|
|
87
|
+
if (sameExtent("row")) return { rows: bands("row", [first]), cols: bands("col", areas) };
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function* bandIndices(bands) {
|
|
91
|
+
let offset = 0;
|
|
92
|
+
for (const band of bands) {
|
|
93
|
+
for (let index = band.start; index <= band.end; index++) {
|
|
94
|
+
yield { index, offset: offset++, remaining: band.end - index + 1 };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
58
99
|
// src/merged-range-lookup.ts
|
|
59
100
|
function createMergedRangeLookup(ranges) {
|
|
60
101
|
const normalizedRanges = [];
|
|
@@ -679,7 +720,7 @@ function getFormulaReferences(value, sheetName) {
|
|
|
679
720
|
const end = index + match[0].length;
|
|
680
721
|
const previous = value[index - 1];
|
|
681
722
|
const next = value[end];
|
|
682
|
-
const parsed =
|
|
723
|
+
const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, match[0].replace(/\s*:\s*/g, ":"));
|
|
683
724
|
if (parsed && !NAME_CHARACTER.test(previous) && previous !== "]" && previous !== "!" && previous !== ":" && (!next || !NAME_CHARACTER.test(next) && !/[!\[]/.test(next)) && !/^\s*\(/.test(value.slice(end))) {
|
|
684
725
|
const { range } = parsed;
|
|
685
726
|
const key = `${(_nullishCoalesce(parsed.sheetName, () => ( sheetName))).toLowerCase()}:${range.start.row},${range.start.col}:${range.end.row},${range.end.col}`;
|
|
@@ -716,7 +757,7 @@ function coerceUserEnteredValue(value, locale = "en-US", source = "edit") {
|
|
|
716
757
|
const trimmed = value.trim();
|
|
717
758
|
if (!trimmed) return value;
|
|
718
759
|
if (/^(true|false)$/i.test(trimmed)) return trimmed.toLowerCase() === "true";
|
|
719
|
-
const localized =
|
|
760
|
+
const localized = _chunkXZJLPW64cjs.parseLocaleNumber.call(void 0, trimmed, locale);
|
|
720
761
|
if (localized !== void 0) return localized;
|
|
721
762
|
if (/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(trimmed)) {
|
|
722
763
|
const number = Number(trimmed);
|
|
@@ -774,7 +815,7 @@ function quoteClipboardField(value) {
|
|
|
774
815
|
}
|
|
775
816
|
|
|
776
817
|
// src/controller.tsx
|
|
777
|
-
var _react = require('react'); var React = _interopRequireWildcard(_react); var
|
|
818
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react); var React16 = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react);
|
|
778
819
|
var _internal = require('@extend-ai/react-xlsx/internal');
|
|
779
820
|
|
|
780
821
|
|
|
@@ -878,7 +919,7 @@ var XlsxWorkerClient = (_class = class {
|
|
|
878
919
|
type: "load"
|
|
879
920
|
}, [workerBuffer]);
|
|
880
921
|
}, () => this.loadOnMainThread());
|
|
881
|
-
|
|
922
|
+
_chunkXZJLPW64cjs.restoreWorkerImageBlobs.call(void 0, result.imageAssets, result.imageBlobs);
|
|
882
923
|
delete result.imageBlobs;
|
|
883
924
|
for (const [key, value] of result.columnFontMeasurements) columnFontMeasurements.set(key, value);
|
|
884
925
|
while (columnFontMeasurements.size > 256) columnFontMeasurements.delete(columnFontMeasurements.keys().next().value);
|
|
@@ -924,7 +965,7 @@ var XlsxWorkerClient = (_class = class {
|
|
|
924
965
|
}
|
|
925
966
|
async getMainRuntime() {
|
|
926
967
|
if (this.disposed) throw createAbortError();
|
|
927
|
-
this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-
|
|
968
|
+
this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-MEI3CEWO.cjs"))).then(({ createWorkbookRuntime }) => createWorkbookRuntime());
|
|
928
969
|
const runtime = await this.mainRuntime;
|
|
929
970
|
if (this.disposed) {
|
|
930
971
|
runtime.dispose();
|
|
@@ -1102,17 +1143,17 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
1102
1143
|
for (let index = 0; index < workbook.sheetCount; index += 1) {
|
|
1103
1144
|
const worksheet = workbook.getSheet(index);
|
|
1104
1145
|
const sheetState = _nullishCoalesce(_optionalChain([sheetStatesByWorkbookSheetIndex, 'optionalAccess', _115 => _115[index]]), () => ( null));
|
|
1105
|
-
const mergeMetadata =
|
|
1146
|
+
const mergeMetadata = _chunkXZJLPW64cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet);
|
|
1106
1147
|
const effectiveSheetState = {
|
|
1107
1148
|
...sheetState,
|
|
1108
1149
|
...mergeMetadata
|
|
1109
1150
|
};
|
|
1110
|
-
const defaultColWidthPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _116 => _116.defaultColWidthPx]), () => (
|
|
1151
|
+
const defaultColWidthPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _116 => _116.defaultColWidthPx]), () => ( _chunkXZJLPW64cjs.resolveWorksheetDefaultColumnWidthPixels.call(void 0,
|
|
1111
1152
|
worksheet,
|
|
1112
1153
|
_optionalChain([sheetState, 'optionalAccess', _117 => _117.columnWidthCharacterWidthPx]),
|
|
1113
1154
|
DEFAULT_COL_WIDTH
|
|
1114
1155
|
)));
|
|
1115
|
-
const defaultRowHeightPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _118 => _118.defaultRowHeightPx]), () => (
|
|
1156
|
+
const defaultRowHeightPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _118 => _118.defaultRowHeightPx]), () => ( _chunkXZJLPW64cjs.resolveWorksheetDefaultRowHeightPixels.call(void 0,
|
|
1116
1157
|
worksheet,
|
|
1117
1158
|
DEFAULT_ROW_HEIGHT
|
|
1118
1159
|
)));
|
|
@@ -1123,7 +1164,7 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
1123
1164
|
const resolveColumnWidthPx = (col) => {
|
|
1124
1165
|
const width = worksheet.getColumnWidth(col);
|
|
1125
1166
|
if (width !== void 0 && width !== null) {
|
|
1126
|
-
return
|
|
1167
|
+
return _chunkXZJLPW64cjs.resolveSheetColumnWidthPixels.call(void 0, width, _optionalChain([sheetState, 'optionalAccess', _119 => _119.columnWidthCharacterWidthPx]));
|
|
1127
1168
|
}
|
|
1128
1169
|
return _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _120 => _120.colWidthOverridesPx, 'optionalAccess', _121 => _121[col]]), () => ( defaultColWidthPx));
|
|
1129
1170
|
};
|
|
@@ -1153,8 +1194,8 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
1153
1194
|
maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
|
|
1154
1195
|
maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
|
|
1155
1196
|
mergedRanges: mergeMetadata.mergedRanges,
|
|
1156
|
-
hiddenCols:
|
|
1157
|
-
hiddenRows:
|
|
1197
|
+
hiddenCols: Array.from(worksheet.hiddenColumns),
|
|
1198
|
+
hiddenRows: Array.from(worksheet.hiddenRows),
|
|
1158
1199
|
minUsedCol: -1,
|
|
1159
1200
|
minUsedRow: -1,
|
|
1160
1201
|
maxUsedCol: -1,
|
|
@@ -1243,8 +1284,8 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
1243
1284
|
maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
|
|
1244
1285
|
maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
|
|
1245
1286
|
mergedRanges: mergeMetadata.mergedRanges,
|
|
1246
|
-
hiddenCols:
|
|
1247
|
-
hiddenRows:
|
|
1287
|
+
hiddenCols: Array.from(worksheet.hiddenColumns),
|
|
1288
|
+
hiddenRows: Array.from(worksheet.hiddenRows),
|
|
1248
1289
|
minUsedCol: minCol,
|
|
1249
1290
|
minUsedRow: minRow,
|
|
1250
1291
|
maxUsedCol: maxCol,
|
|
@@ -1498,7 +1539,7 @@ function formControlInputFromDukeControl(control2) {
|
|
|
1498
1539
|
function xlsxFormControlInputToDukeDrawing(input) {
|
|
1499
1540
|
return {
|
|
1500
1541
|
altText: input.altText,
|
|
1501
|
-
anchor:
|
|
1542
|
+
anchor: _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, input.anchor, input.editAs),
|
|
1502
1543
|
formControl: {
|
|
1503
1544
|
kind: xlsxFormControlKindToDukeKind(input.kind),
|
|
1504
1545
|
macroName: input.macroName,
|
|
@@ -1538,9 +1579,9 @@ function formControlLinkTouchesPivot(workbook, pivots, sourceSheetIndex, kind) {
|
|
|
1538
1579
|
if (sheetIndex < 0) return false;
|
|
1539
1580
|
address2 = address2.slice(separator + 1);
|
|
1540
1581
|
}
|
|
1541
|
-
const parsed =
|
|
1582
|
+
const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, address2);
|
|
1542
1583
|
if (_optionalChain([parsed, 'optionalAccess', _161 => _161.kind]) === "cells" && !parsed.sheetName && parsed.range.start.row === parsed.range.end.row && parsed.range.start.col === parsed.range.end.col) {
|
|
1543
|
-
return Boolean(
|
|
1584
|
+
return Boolean(_chunkXZJLPW64cjs.findIntersectingPivot.call(void 0, pivots, sheetNames[sheetIndex], parsed.range));
|
|
1544
1585
|
}
|
|
1545
1586
|
const matching = names.filter((name) => name.name.toLowerCase() === address2.toLowerCase());
|
|
1546
1587
|
const named = _nullishCoalesce(matching.find((name) => name.sheetIndex === sheetIndex), () => ( matching.find((name) => name.sheetIndex == null)));
|
|
@@ -1914,7 +1955,7 @@ function useXlsxViewerController(options2) {
|
|
|
1914
1955
|
src,
|
|
1915
1956
|
useWorker = true
|
|
1916
1957
|
} = options2;
|
|
1917
|
-
const messages = React.useMemo(() =>
|
|
1958
|
+
const messages = React.useMemo(() => _chunkYOLIVKZDcjs.resolveMessages.call(void 0, locale, messageOverrides), [locale, messageOverrides]);
|
|
1918
1959
|
const [isLoading, setIsLoading] = React.useState(Boolean(_nullishCoalesce(file, () => ( src))));
|
|
1919
1960
|
const [error, setError] = React.useState(null);
|
|
1920
1961
|
const [workbook, setWorkbook] = React.useState(null);
|
|
@@ -1938,7 +1979,11 @@ function useXlsxViewerController(options2) {
|
|
|
1938
1979
|
const [activeTabIndex, setActiveTabIndexState] = React.useState(0);
|
|
1939
1980
|
const [zoomScaleOverridesByTabId, setZoomScaleOverridesByTabId] = React.useState({});
|
|
1940
1981
|
const [activeCell, setActiveCell] = React.useState(null);
|
|
1941
|
-
const [
|
|
1982
|
+
const [selectionRanges, setSelectionRanges] = React.useState([]);
|
|
1983
|
+
const selection = _nullishCoalesce(selectionRanges.at(-1), () => ( null));
|
|
1984
|
+
const setSelection = React.useCallback((range) => {
|
|
1985
|
+
setSelectionRanges(range ? [range] : []);
|
|
1986
|
+
}, []);
|
|
1942
1987
|
const [highlightedRanges, setHighlightedRanges] = React.useState([]);
|
|
1943
1988
|
const [selectedChartId, setSelectedChartId] = React.useState(null);
|
|
1944
1989
|
const [selectedChartElement, setSelectedChartElement] = React.useState(null);
|
|
@@ -1989,7 +2034,7 @@ function useXlsxViewerController(options2) {
|
|
|
1989
2034
|
releaseXmlRecordsRef.current = null;
|
|
1990
2035
|
for (const url of retainedObjectUrlsRef.current) URL.revokeObjectURL(url);
|
|
1991
2036
|
retainedObjectUrlsRef.current.clear();
|
|
1992
|
-
|
|
2037
|
+
_chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, imageAssetsRef.current);
|
|
1993
2038
|
imageAssetsRef.current = null;
|
|
1994
2039
|
sheetOriginsRef.current = [];
|
|
1995
2040
|
setFormControlsByWorkbookSheetIndex([]);
|
|
@@ -2049,7 +2094,7 @@ function useXlsxViewerController(options2) {
|
|
|
2049
2094
|
if (!targetWorkbook || !imageAssetsRef.current) {
|
|
2050
2095
|
return chartAssetsRef.current;
|
|
2051
2096
|
}
|
|
2052
|
-
const assets =
|
|
2097
|
+
const assets = _chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0,
|
|
2053
2098
|
targetWorkbook,
|
|
2054
2099
|
imageAssetsRef.current,
|
|
2055
2100
|
buildVisibleSheetIndexMap(targetSheets),
|
|
@@ -2059,12 +2104,12 @@ function useXlsxViewerController(options2) {
|
|
|
2059
2104
|
return assets;
|
|
2060
2105
|
}, [showHiddenSheets]);
|
|
2061
2106
|
const loadPreparedWorkbook = React.useCallback(async (buffer, isCurrent = () => true) => {
|
|
2062
|
-
const defaultFonts =
|
|
2107
|
+
const defaultFonts = _chunkXZJLPW64cjs.loadSpreadsheetFonts.call(void 0, ["Calibri", "Arial"]);
|
|
2063
2108
|
const forced = shouldForceReadOnlyForBuffer(buffer.byteLength);
|
|
2064
2109
|
const editable = !requestedReadOnly && !forced;
|
|
2065
2110
|
const snapshot = await getWorkerClient().loadWorkbook(buffer, skipXmlParsing, showHiddenSheets, editable || !useWorker);
|
|
2066
2111
|
if (!isCurrent()) return;
|
|
2067
|
-
await Promise.all([defaultFonts,
|
|
2112
|
+
await Promise.all([defaultFonts, _chunkXZJLPW64cjs.loadSpreadsheetFonts.call(void 0, snapshot.fontFamilies)]);
|
|
2068
2113
|
if (!isCurrent()) return;
|
|
2069
2114
|
const nextWorkbook = snapshot.workbookSnapshot ? (await _internal.getSheetsWasmModule.call(void 0, )).Workbook.fromSnapshot(snapshot.workbookSnapshot) : null;
|
|
2070
2115
|
if (!isCurrent()) {
|
|
@@ -2087,9 +2132,9 @@ function useXlsxViewerController(options2) {
|
|
|
2087
2132
|
setIsLoading(false);
|
|
2088
2133
|
}, [getWorkerClient, requestedReadOnly, setChartAssets, setImageAssets, shouldForceReadOnlyForBuffer, showHiddenSheets, skipXmlParsing, useWorker]);
|
|
2089
2134
|
const refreshWorkbookState = React.useCallback((targetWorkbook) => {
|
|
2090
|
-
setPivotTables(
|
|
2135
|
+
setPivotTables(_chunkXZJLPW64cjs.readPivotTables.call(void 0, targetWorkbook));
|
|
2091
2136
|
const currentFormControls = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _201 => _201.current, 'optionalAccess', _202 => _202.formControlsByWorkbookSheetIndex]), () => ( []));
|
|
2092
|
-
const nextFormControls =
|
|
2137
|
+
const nextFormControls = _chunkXZJLPW64cjs.refreshWorkbookFormControls.call(void 0,
|
|
2093
2138
|
targetWorkbook,
|
|
2094
2139
|
currentFormControls,
|
|
2095
2140
|
_optionalChain([imageAssetsRef, 'access', _203 => _203.current, 'optionalAccess', _204 => _204.themePalette])
|
|
@@ -2109,7 +2154,7 @@ function useXlsxViewerController(options2) {
|
|
|
2109
2154
|
);
|
|
2110
2155
|
setSheets(nextSheets);
|
|
2111
2156
|
setChartAssets(
|
|
2112
|
-
|
|
2157
|
+
_chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0,
|
|
2113
2158
|
targetWorkbook,
|
|
2114
2159
|
imageAssetsRef.current,
|
|
2115
2160
|
buildVisibleSheetIndexMap(nextSheets),
|
|
@@ -2125,7 +2170,7 @@ function useXlsxViewerController(options2) {
|
|
|
2125
2170
|
chartDisplayFallbackCleanupRef.current = null;
|
|
2126
2171
|
for (const url of retainedObjectUrlsRef.current) URL.revokeObjectURL(url);
|
|
2127
2172
|
retainedObjectUrlsRef.current.clear();
|
|
2128
|
-
|
|
2173
|
+
_chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, imageAssetsRef.current);
|
|
2129
2174
|
disposeWorkerClient();
|
|
2130
2175
|
}, [disposeWorkerClient]);
|
|
2131
2176
|
React.useEffect(() => {
|
|
@@ -2306,7 +2351,7 @@ function useXlsxViewerController(options2) {
|
|
|
2306
2351
|
const nextHighlights = [];
|
|
2307
2352
|
let firstSheetIndex = activeSheetIndex;
|
|
2308
2353
|
for (const reference of inputs) {
|
|
2309
|
-
const parsed =
|
|
2354
|
+
const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, reference);
|
|
2310
2355
|
if (!parsed) {
|
|
2311
2356
|
return false;
|
|
2312
2357
|
}
|
|
@@ -2400,7 +2445,7 @@ function useXlsxViewerController(options2) {
|
|
|
2400
2445
|
if (!shouldAutoCalculate) {
|
|
2401
2446
|
return;
|
|
2402
2447
|
}
|
|
2403
|
-
const result =
|
|
2448
|
+
const result = _chunkXZJLPW64cjs.tryRecalculate.call(void 0, targetWorkbook);
|
|
2404
2449
|
if (!result.calculated) {
|
|
2405
2450
|
setShouldAutoCalculate(false);
|
|
2406
2451
|
}
|
|
@@ -2633,12 +2678,12 @@ function useXlsxViewerController(options2) {
|
|
|
2633
2678
|
const width = worksheet.getColumnWidth(col);
|
|
2634
2679
|
const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _248 => _248.showGridLines]), () => ( true));
|
|
2635
2680
|
if (width !== void 0 && width !== null) {
|
|
2636
|
-
return
|
|
2637
|
-
|
|
2681
|
+
return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
|
|
2682
|
+
_chunkXZJLPW64cjs.resolveSheetColumnWidthPixels.call(void 0, width, _optionalChain([sheetState, 'optionalAccess', _249 => _249.columnWidthCharacterWidthPx])),
|
|
2638
2683
|
showGridLines
|
|
2639
2684
|
);
|
|
2640
2685
|
}
|
|
2641
|
-
return
|
|
2686
|
+
return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
|
|
2642
2687
|
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _250 => _250.colWidthOverridesPx, 'optionalAccess', _251 => _251[col]]), () => ( _optionalChain([sheetState, 'optionalAccess', _252 => _252.defaultColWidthPx]))), () => ( DEFAULT_COL_WIDTH)),
|
|
2643
2688
|
showGridLines
|
|
2644
2689
|
);
|
|
@@ -2648,9 +2693,9 @@ function useXlsxViewerController(options2) {
|
|
|
2648
2693
|
const height = worksheet.getRowHeight(row2);
|
|
2649
2694
|
const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _259 => _259.showGridLines]), () => ( true));
|
|
2650
2695
|
if (height !== void 0 && height !== null) {
|
|
2651
|
-
return
|
|
2696
|
+
return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkXZJLPW64cjs.resolveSheetRowHeightPixels.call(void 0, height), showGridLines);
|
|
2652
2697
|
}
|
|
2653
|
-
return
|
|
2698
|
+
return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
|
|
2654
2699
|
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _260 => _260.rowHeightOverridesPx, 'optionalAccess', _261 => _261[row2]]), () => ( _optionalChain([sheetState, 'optionalAccess', _262 => _262.defaultRowHeightPx]))), () => ( DEFAULT_ROW_HEIGHT)),
|
|
2655
2700
|
showGridLines
|
|
2656
2701
|
);
|
|
@@ -2670,7 +2715,7 @@ function useXlsxViewerController(options2) {
|
|
|
2670
2715
|
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _265 => _265.cachedFormulaValues, 'optionalAccess', _266 => _266[cellAddressToA1(cell)]]) : void 0;
|
|
2671
2716
|
const formatted = worksheet.getFormattedValueAt(cell.row, cell.col);
|
|
2672
2717
|
if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
|
|
2673
|
-
return
|
|
2718
|
+
return _chunkXZJLPW64cjs.localizeCellNumber.call(void 0, worksheet, cell.row, cell.col, decodeHtmlEntities(formatted), locale);
|
|
2674
2719
|
}
|
|
2675
2720
|
const calculated = worksheet.getCalculatedValueAt(cell.row, cell.col);
|
|
2676
2721
|
if (formula && cachedFormulaValue !== void 0 && calculated.is_error) {
|
|
@@ -2699,23 +2744,20 @@ function useXlsxViewerController(options2) {
|
|
|
2699
2744
|
}, [activeSheet, getActiveWorksheet, locale]);
|
|
2700
2745
|
const getClipboardData = React.useCallback(() => {
|
|
2701
2746
|
const worksheet = getActiveWorksheet();
|
|
2702
|
-
const
|
|
2703
|
-
if (!worksheet || !
|
|
2704
|
-
return null;
|
|
2705
|
-
}
|
|
2706
|
-
const normalized = normalizeRange(targetRange);
|
|
2747
|
+
const bands = clipboardBands(selectionRanges);
|
|
2748
|
+
if (!worksheet || !bands) return null;
|
|
2707
2749
|
const rows = [];
|
|
2708
2750
|
const htmlRows = [];
|
|
2709
2751
|
const payload = {
|
|
2710
2752
|
cells: [],
|
|
2711
|
-
cols:
|
|
2753
|
+
cols: bands.cols.reduce((total, band) => total + band.end - band.start + 1, 0),
|
|
2712
2754
|
merges: [],
|
|
2713
|
-
rows:
|
|
2755
|
+
rows: bands.rows.reduce((total, band) => total + band.end - band.start + 1, 0)
|
|
2714
2756
|
};
|
|
2715
|
-
for (
|
|
2757
|
+
for (const { index: row2, offset: rowOffset, remaining: rowsRemaining } of bandIndices(bands.rows)) {
|
|
2716
2758
|
const textCells = [];
|
|
2717
2759
|
const htmlCells = [];
|
|
2718
|
-
for (
|
|
2760
|
+
for (const { index: col, offset: colOffset, remaining: colsRemaining } of bandIndices(bands.cols)) {
|
|
2719
2761
|
if (worksheet.isMergedSecondary(row2, col)) {
|
|
2720
2762
|
textCells.push("");
|
|
2721
2763
|
continue;
|
|
@@ -2731,7 +2773,7 @@ function useXlsxViewerController(options2) {
|
|
|
2731
2773
|
];
|
|
2732
2774
|
const fill = _optionalChain([rawStyle, 'optionalAccess', _267 => _267.fill]);
|
|
2733
2775
|
if (fill) {
|
|
2734
|
-
const fillStyle =
|
|
2776
|
+
const fillStyle = _chunkXZJLPW64cjs.resolveWorkbookFillStyle.call(void 0, fill, _optionalChain([activeSheet, 'optionalAccess', _268 => _268.themePalette]));
|
|
2735
2777
|
if (fillStyle.backgroundColor && fillStyle.backgroundColor.toLowerCase() !== "#ffffff") {
|
|
2736
2778
|
cellStyles.push(`background-color:${fillStyle.backgroundColor}`);
|
|
2737
2779
|
}
|
|
@@ -2753,7 +2795,7 @@ function useXlsxViewerController(options2) {
|
|
|
2753
2795
|
if (font.strikethrough) {
|
|
2754
2796
|
cellStyles.push("text-decoration:line-through");
|
|
2755
2797
|
}
|
|
2756
|
-
const fontColor =
|
|
2798
|
+
const fontColor = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, font.color, _optionalChain([activeSheet, 'optionalAccess', _270 => _270.themePalette]));
|
|
2757
2799
|
if (fontColor) {
|
|
2758
2800
|
cellStyles.push(`color:${fontColor}`);
|
|
2759
2801
|
}
|
|
@@ -2782,19 +2824,19 @@ function useXlsxViewerController(options2) {
|
|
|
2782
2824
|
if (_optionalChain([border, 'optionalAccess', _281 => _281.left, 'optionalAccess', _282 => _282.style]) && border.left.style !== "none") {
|
|
2783
2825
|
cellStyles.push(`border-left:${mapBorder(border.left)}`);
|
|
2784
2826
|
}
|
|
2785
|
-
const rowSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _283 => _283.rowSpan]), () => ( 1)),
|
|
2786
|
-
const colSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _284 => _284.colSpan]), () => ( 1)),
|
|
2827
|
+
const rowSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _283 => _283.rowSpan]), () => ( 1)), rowsRemaining);
|
|
2828
|
+
const colSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _284 => _284.colSpan]), () => ( 1)), colsRemaining);
|
|
2787
2829
|
payload.cells.push({
|
|
2788
|
-
colOffset
|
|
2830
|
+
colOffset,
|
|
2789
2831
|
formula,
|
|
2790
|
-
rowOffset
|
|
2832
|
+
rowOffset,
|
|
2791
2833
|
value
|
|
2792
2834
|
});
|
|
2793
2835
|
if (rowSpan > 1 || colSpan > 1) {
|
|
2794
2836
|
payload.merges.push({
|
|
2795
|
-
colOffset
|
|
2837
|
+
colOffset,
|
|
2796
2838
|
colSpan,
|
|
2797
|
-
rowOffset
|
|
2839
|
+
rowOffset,
|
|
2798
2840
|
rowSpan
|
|
2799
2841
|
});
|
|
2800
2842
|
}
|
|
@@ -2811,7 +2853,7 @@ function useXlsxViewerController(options2) {
|
|
|
2811
2853
|
structured: JSON.stringify(payload),
|
|
2812
2854
|
text: rows.join("\n")
|
|
2813
2855
|
};
|
|
2814
|
-
}, [
|
|
2856
|
+
}, [activeSheet, getActiveWorksheet, getCellDisplayValue2, selectionRanges]);
|
|
2815
2857
|
React.useEffect(() => {
|
|
2816
2858
|
if (!isWorkerBacked || !deferredMetadataSheet || !deferredMetadataCell) {
|
|
2817
2859
|
return;
|
|
@@ -2842,7 +2884,7 @@ function useXlsxViewerController(options2) {
|
|
|
2842
2884
|
};
|
|
2843
2885
|
}, [deferredMetadataCell, deferredMetadataSheet, getCellSnapshotAsync, isWorkerBacked, locale]);
|
|
2844
2886
|
const activeCellAddress = React.useMemo(() => activeCell ? cellAddressToA1(activeCell) : null, [activeCell]);
|
|
2845
|
-
const selectedRangeAddress = React.useMemo(() =>
|
|
2887
|
+
const selectedRangeAddress = React.useMemo(() => selectionRanges.map(rangeToA1).join(",") || null, [selectionRanges]);
|
|
2846
2888
|
const selectedValue = React.useMemo(
|
|
2847
2889
|
() => getCellDisplayValue2(deferredMetadataCell),
|
|
2848
2890
|
[deferredMetadataCell, getCellDisplayValue2, revision, workerCellSnapshotRevision]
|
|
@@ -2851,7 +2893,7 @@ function useXlsxViewerController(options2) {
|
|
|
2851
2893
|
() => getCellFormula(deferredMetadataCell),
|
|
2852
2894
|
[deferredMetadataCell, getCellFormula, revision, workerCellSnapshotRevision]
|
|
2853
2895
|
);
|
|
2854
|
-
const getChartSeriesFormula = React.useCallback((chartId, seriesIndex) =>
|
|
2896
|
+
const getChartSeriesFormula = React.useCallback((chartId, seriesIndex) => _chunkXZJLPW64cjs.buildChartSeriesFormula.call(void 0, getChartById(chartId), seriesIndex), [getChartById]);
|
|
2855
2897
|
const selectedChartFormula = React.useMemo(() => {
|
|
2856
2898
|
if (!selectedChartElement || selectedChartElement.kind === "chart" || selectedChartElement.kind === "legend" || selectedChartElement.seriesIndex < 0) {
|
|
2857
2899
|
return null;
|
|
@@ -2892,10 +2934,10 @@ function useXlsxViewerController(options2) {
|
|
|
2892
2934
|
bytes: workbook.exportSnapshot(),
|
|
2893
2935
|
assets: imageAssetsRef.current ? structuredClone(imageAssetsRef.current) : null,
|
|
2894
2936
|
origins: structuredClone(sheetOriginsRef.current),
|
|
2895
|
-
|
|
2937
|
+
selectionRanges,
|
|
2896
2938
|
sortState
|
|
2897
2939
|
};
|
|
2898
|
-
}, [activeCell, activeSheetIndex,
|
|
2940
|
+
}, [activeCell, activeSheetIndex, selectionRanges, sortState, workbook]);
|
|
2899
2941
|
const captureCellMutationState = React.useCallback((cell) => {
|
|
2900
2942
|
const worksheet = getActiveWorksheet();
|
|
2901
2943
|
if (!worksheet) {
|
|
@@ -2928,8 +2970,8 @@ function useXlsxViewerController(options2) {
|
|
|
2928
2970
|
sheetOriginsRef.current = structuredClone(entry.origins);
|
|
2929
2971
|
setWorkbook(nextWorkbook);
|
|
2930
2972
|
setSheets(nextSheets);
|
|
2931
|
-
setPivotTables(
|
|
2932
|
-
const nextChartAssets =
|
|
2973
|
+
setPivotTables(_chunkXZJLPW64cjs.readPivotTables.call(void 0, nextWorkbook));
|
|
2974
|
+
const nextChartAssets = _chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0, nextWorkbook, nextImageAssets, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets);
|
|
2933
2975
|
setChartAssets(nextChartAssets);
|
|
2934
2976
|
setActiveSheetIndexState(nextSheetIndex);
|
|
2935
2977
|
const nextTabIndex = nextChartAssets.tabs.findIndex((tab) => tab.kind === "sheet" && tab.sheetIndex === nextSheetIndex);
|
|
@@ -2937,9 +2979,9 @@ function useXlsxViewerController(options2) {
|
|
|
2937
2979
|
setActiveTabIndexState(nextTabIndex);
|
|
2938
2980
|
}
|
|
2939
2981
|
setActiveCell(entry.activeCell);
|
|
2940
|
-
|
|
2982
|
+
setSelectionRanges(entry.selectionRanges);
|
|
2941
2983
|
setSortState(entry.sortState);
|
|
2942
|
-
selectionAnchorRef.current = entry.
|
|
2984
|
+
selectionAnchorRef.current = _nullishCoalesce(_optionalChain([entry, 'access', _290 => _290.selectionRanges, 'access', _291 => _291.at, 'call', _292 => _292(-1), 'optionalAccess', _293 => _293.start]), () => ( entry.activeCell));
|
|
2943
2985
|
setRevision((current) => current + 1);
|
|
2944
2986
|
}, [setChartAssets, setImageAssets]);
|
|
2945
2987
|
const applyCellEditHistoryEntry = React.useCallback((entry, direction) => {
|
|
@@ -2959,8 +3001,8 @@ function useXlsxViewerController(options2) {
|
|
|
2959
3001
|
setActiveSheetIndexState(visibleSheetIndex);
|
|
2960
3002
|
}
|
|
2961
3003
|
setActiveCell(nextActiveCell);
|
|
2962
|
-
|
|
2963
|
-
selectionAnchorRef.current = nextSelection
|
|
3004
|
+
setSelectionRanges(nextSelection);
|
|
3005
|
+
selectionAnchorRef.current = _nullishCoalesce(_optionalChain([nextSelection, 'access', _294 => _294.at, 'call', _295 => _295(-1), 'optionalAccess', _296 => _296.start]), () => ( nextActiveCell));
|
|
2964
3006
|
isApplyingHistoryRef.current = false;
|
|
2965
3007
|
}, [maybeRecalculateWorkbook, refreshWorkbookState, sheets, workbook]);
|
|
2966
3008
|
const applyRangeEditHistoryEntry = React.useCallback((entry, direction) => {
|
|
@@ -2982,8 +3024,8 @@ function useXlsxViewerController(options2) {
|
|
|
2982
3024
|
setActiveSheetIndexState(visibleSheetIndex);
|
|
2983
3025
|
}
|
|
2984
3026
|
setActiveCell(nextActiveCell);
|
|
2985
|
-
|
|
2986
|
-
selectionAnchorRef.current = nextSelection
|
|
3027
|
+
setSelectionRanges(nextSelection);
|
|
3028
|
+
selectionAnchorRef.current = _nullishCoalesce(_optionalChain([nextSelection, 'access', _297 => _297.at, 'call', _298 => _298(-1), 'optionalAccess', _299 => _299.start]), () => ( nextActiveCell));
|
|
2987
3029
|
isApplyingHistoryRef.current = false;
|
|
2988
3030
|
}, [maybeRecalculateWorkbook, refreshWorkbookState, sheets, workbook]);
|
|
2989
3031
|
const recordHistoryBeforeMutation = React.useCallback(() => {
|
|
@@ -3000,17 +3042,17 @@ function useXlsxViewerController(options2) {
|
|
|
3000
3042
|
}, [createHistoryEntry]);
|
|
3001
3043
|
const getPivotSourceFields = React.useCallback((source) => {
|
|
3002
3044
|
if (!workbook) throw new Error("Load an editable workbook to inspect a pivot source.");
|
|
3003
|
-
return
|
|
3045
|
+
return _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, workbook).getPivotSourceFields(source);
|
|
3004
3046
|
}, [workbook]);
|
|
3005
|
-
const getPivotTableAtCell = React.useCallback((cell, sheetName = _optionalChain([activeSheet, 'optionalAccess',
|
|
3047
|
+
const getPivotTableAtCell = React.useCallback((cell, sheetName = _optionalChain([activeSheet, 'optionalAccess', _300 => _300.name])) => _chunkXZJLPW64cjs.findIntersectingPivot.call(void 0, pivotTables, sheetName, { start: cell, end: cell }), [_optionalChain([activeSheet, 'optionalAccess', _301 => _301.name]), pivotTables]);
|
|
3006
3048
|
React.useEffect(() => {
|
|
3007
3049
|
const insidePivot = activeCell && !selectedChartId && !selectedImageId && getPivotTableAtCell(activeCell);
|
|
3008
3050
|
setPivotFieldListVisibleState(Boolean(pivotFieldListRequestedRef.current && insidePivot));
|
|
3009
|
-
}, [_optionalChain([activeCell, 'optionalAccess',
|
|
3010
|
-
const intersectsPivot = React.useCallback((range) => Boolean(
|
|
3051
|
+
}, [_optionalChain([activeCell, 'optionalAccess', _302 => _302.row]), _optionalChain([activeCell, 'optionalAccess', _303 => _303.col]), _optionalChain([activeSheet, 'optionalAccess', _304 => _304.name]), getPivotTableAtCell, selectedChartId, selectedImageId]);
|
|
3052
|
+
const intersectsPivot = React.useCallback((range) => Boolean(_chunkXZJLPW64cjs.findIntersectingPivot.call(void 0, pivotTables, _optionalChain([activeSheet, 'optionalAccess', _305 => _305.name]), range)), [_optionalChain([activeSheet, 'optionalAccess', _306 => _306.name]), pivotTables]);
|
|
3011
3053
|
const calculateForPivotMutation = React.useCallback((target, preserveSavedValues = true) => {
|
|
3012
3054
|
const snapshot = preserveSavedValues ? target.exportSnapshot() : null;
|
|
3013
|
-
const result =
|
|
3055
|
+
const result = _chunkXZJLPW64cjs.safeCalculate.call(void 0, target, snapshot ? { reparse: () => target.constructor.fromSnapshot(snapshot) } : {});
|
|
3014
3056
|
if (!result.calculated) {
|
|
3015
3057
|
if (result.workbook !== target) result.workbook.free();
|
|
3016
3058
|
throw new Error("The workbook formulas could not be recalculated safely. The pivot table and existing values have been kept.");
|
|
@@ -3020,7 +3062,7 @@ function useXlsxViewerController(options2) {
|
|
|
3020
3062
|
if (readOnly) throw new Error("Enable editing to change pivot tables.");
|
|
3021
3063
|
if (!workbook) throw new Error("Load a workbook before changing pivot tables.");
|
|
3022
3064
|
const before = createHistoryEntry();
|
|
3023
|
-
const next = workbook.constructor.fromSnapshot(_nullishCoalesce(_optionalChain([before, 'optionalAccess',
|
|
3065
|
+
const next = workbook.constructor.fromSnapshot(_nullishCoalesce(_optionalChain([before, 'optionalAccess', _307 => _307.bytes]), () => ( workbook.exportSnapshot())));
|
|
3024
3066
|
let result;
|
|
3025
3067
|
try {
|
|
3026
3068
|
if (recalculate2) calculateForPivotMutation(next);
|
|
@@ -3036,17 +3078,17 @@ function useXlsxViewerController(options2) {
|
|
|
3036
3078
|
setHistoryRevision((current) => current + 1);
|
|
3037
3079
|
}
|
|
3038
3080
|
if (recalculate2) {
|
|
3039
|
-
for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access',
|
|
3081
|
+
for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _308 => _308.current, 'optionalAccess', _309 => _309.sheetStatesByWorkbookSheetIndex]), () => ( []))) if (sheet) sheet.cachedFormulaValues = {};
|
|
3040
3082
|
}
|
|
3041
3083
|
setWorkbook(next);
|
|
3042
3084
|
refreshWorkbookState(next);
|
|
3043
3085
|
return result;
|
|
3044
3086
|
}, [calculateForPivotMutation, createHistoryEntry, readOnly, refreshWorkbookState, workbook]);
|
|
3045
3087
|
const upsertPivotTable = React.useCallback((input) => {
|
|
3046
|
-
return commitPivotMutation((target) =>
|
|
3088
|
+
return commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).upsertPivotTable(input));
|
|
3047
3089
|
}, [commitPivotMutation]);
|
|
3048
|
-
const refreshPivotTable = React.useCallback((id) => commitPivotMutation((target) =>
|
|
3049
|
-
const createPivotChart = React.useCallback((id, options3 = {}) => commitPivotMutation((target) =>
|
|
3090
|
+
const refreshPivotTable = React.useCallback((id) => commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).refreshPivotTable(id), true), [commitPivotMutation]);
|
|
3091
|
+
const createPivotChart = React.useCallback((id, options3 = {}) => commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).createPivotChart(id, { ...options3, workbookName: `${fileStem(displayFileName)}.xlsx` }), false), [commitPivotMutation, displayFileName]);
|
|
3050
3092
|
const togglePivotGroup = React.useCallback((id, toggle) => {
|
|
3051
3093
|
const pivot = pivotTables.find((item) => item.id === id);
|
|
3052
3094
|
if (!pivot) throw new Error("The pivot table no longer exists.");
|
|
@@ -3060,7 +3102,7 @@ function useXlsxViewerController(options2) {
|
|
|
3060
3102
|
}, [pivotTables, upsertPivotTable]);
|
|
3061
3103
|
const removePivotTable = React.useCallback((id) => {
|
|
3062
3104
|
if (!pivotTables.some((pivot) => pivot.id === id)) return false;
|
|
3063
|
-
return commitPivotMutation((target) =>
|
|
3105
|
+
return commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).removePivotTable(id));
|
|
3064
3106
|
}, [commitPivotMutation, pivotTables]);
|
|
3065
3107
|
const refreshAllPivotTables = React.useCallback(() => {
|
|
3066
3108
|
if (readOnly) throw new Error("Enable editing to refresh pivot tables.");
|
|
@@ -3070,7 +3112,7 @@ function useXlsxViewerController(options2) {
|
|
|
3070
3112
|
const next = workbook.constructor.fromSnapshot(workbook.exportSnapshot());
|
|
3071
3113
|
try {
|
|
3072
3114
|
calculateForPivotMutation(next);
|
|
3073
|
-
const engine =
|
|
3115
|
+
const engine = _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, next);
|
|
3074
3116
|
for (const pivot of engine.pivotTables) {
|
|
3075
3117
|
engine.refreshPivotTable(pivot.id);
|
|
3076
3118
|
calculateForPivotMutation(next, false);
|
|
@@ -3084,19 +3126,19 @@ function useXlsxViewerController(options2) {
|
|
|
3084
3126
|
redoStackRef.current = [];
|
|
3085
3127
|
setHistoryRevision((current) => current + 1);
|
|
3086
3128
|
}
|
|
3087
|
-
for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access',
|
|
3129
|
+
for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _310 => _310.current, 'optionalAccess', _311 => _311.sheetStatesByWorkbookSheetIndex]), () => ( []))) if (sheet) sheet.cachedFormulaValues = {};
|
|
3088
3130
|
setWorkbook(next);
|
|
3089
3131
|
refreshWorkbookState(next);
|
|
3090
|
-
return
|
|
3132
|
+
return _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, next).pivotTables;
|
|
3091
3133
|
}, [calculateForPivotMutation, createHistoryEntry, pivotTables.length, readOnly, refreshWorkbookState, workbook]);
|
|
3092
3134
|
const pivotDrillDown = React.useCallback((id, row2, col) => {
|
|
3093
3135
|
if (!workbook) throw new Error("Load an editable workbook to inspect pivot details.");
|
|
3094
|
-
return
|
|
3136
|
+
return _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, workbook).pivotDrillDown(id, row2, col);
|
|
3095
3137
|
}, [workbook]);
|
|
3096
3138
|
const showPivotDetails = React.useCallback((id, row2, col) => {
|
|
3097
3139
|
if (readOnly) throw new Error("Enable editing to create a details worksheet.");
|
|
3098
3140
|
if (!workbook) throw new Error("Load a workbook before inspecting pivot details.");
|
|
3099
|
-
const details =
|
|
3141
|
+
const details = _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, workbook).pivotDrillDown(id, row2, col);
|
|
3100
3142
|
if (!details.rows.length) throw new Error("This pivot cell has no source records to display.");
|
|
3101
3143
|
const before = createHistoryEntry();
|
|
3102
3144
|
const next = workbook.constructor.fromSnapshot(workbook.exportSnapshot());
|
|
@@ -3142,10 +3184,10 @@ function useXlsxViewerController(options2) {
|
|
|
3142
3184
|
target.worksheet.addDrawing(xlsxFormControlInputToDukeDrawing(input));
|
|
3143
3185
|
const controlIndex = target.worksheet.formControlCount - 1;
|
|
3144
3186
|
const addedControl = target.worksheet.formControls[controlIndex];
|
|
3145
|
-
const addedKind = _optionalChain([addedControl, 'optionalAccess',
|
|
3146
|
-
if (addedControl && (_optionalChain([addedKind, 'optionalAccess',
|
|
3187
|
+
const addedKind = _optionalChain([addedControl, 'optionalAccess', _312 => _312.formControl, 'access', _313 => _313.kind]);
|
|
3188
|
+
if (addedControl && (_optionalChain([addedKind, 'optionalAccess', _314 => _314.kind]) === "checkbox" || _optionalChain([addedKind, 'optionalAccess', _315 => _315.kind]) === "optionButton")) {
|
|
3147
3189
|
target.worksheet.setFormControlCheckState(addedControl.drawingPath, addedKind.state);
|
|
3148
|
-
} else if (_optionalChain([addedKind, 'optionalAccess',
|
|
3190
|
+
} else if (_optionalChain([addedKind, 'optionalAccess', _316 => _316.kind]) === "groupBox") {
|
|
3149
3191
|
reconcileCheckedOptionButtons(target.worksheet);
|
|
3150
3192
|
} else if (addedKind && "cellLink" in addedKind && addedKind.cellLink) {
|
|
3151
3193
|
workbook.syncFormControls();
|
|
@@ -3156,7 +3198,7 @@ function useXlsxViewerController(options2) {
|
|
|
3156
3198
|
}, [activeSheetIndex, getFormControlWorksheet, maybeRecalculateWorkbook, pivotTables, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
3157
3199
|
const updateFormControl = React.useCallback((controlIndex, patch, sheetIndex = activeSheetIndex) => {
|
|
3158
3200
|
const target = getFormControlWorksheet(sheetIndex);
|
|
3159
|
-
const currentControl = _optionalChain([target, 'optionalAccess',
|
|
3201
|
+
const currentControl = _optionalChain([target, 'optionalAccess', _317 => _317.worksheet, 'access', _318 => _318.formControls, 'access', _319 => _319[controlIndex]]);
|
|
3160
3202
|
if (readOnly || !workbook || !target || !currentControl) {
|
|
3161
3203
|
return false;
|
|
3162
3204
|
}
|
|
@@ -3164,7 +3206,7 @@ function useXlsxViewerController(options2) {
|
|
|
3164
3206
|
if (currentInput.kind !== "formControl" || !currentControl.anchor) {
|
|
3165
3207
|
return false;
|
|
3166
3208
|
}
|
|
3167
|
-
const nextAnchor = patch.anchor ?
|
|
3209
|
+
const nextAnchor = patch.anchor ? _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0,
|
|
3168
3210
|
patch.anchor,
|
|
3169
3211
|
_nullishCoalesce(patch.editAs, () => ( (currentControl.anchor.type === "twoCell" ? currentControl.anchor.editAs : void 0)))
|
|
3170
3212
|
) : patch.editAs !== void 0 && currentControl.anchor.type === "twoCell" ? { ...currentControl.anchor, editAs: patch.editAs } : currentControl.anchor;
|
|
@@ -3178,8 +3220,8 @@ function useXlsxViewerController(options2) {
|
|
|
3178
3220
|
legacyObjectType: _nullishCoalesce(nextKind.legacyObjectType, () => ( currentControl.formControl.kind.legacyObjectType))
|
|
3179
3221
|
};
|
|
3180
3222
|
}
|
|
3181
|
-
const patchedRawObj = _optionalChain([patch, 'access',
|
|
3182
|
-
const patchedRawProperties = _optionalChain([patch, 'access',
|
|
3223
|
+
const patchedRawObj = _optionalChain([patch, 'access', _320 => _320.kind, 'optionalAccess', _321 => _321.kind]) === "editbox" || _optionalChain([patch, 'access', _322 => _322.kind, 'optionalAccess', _323 => _323.kind]) === "unknown" ? patch.kind.rawObj : void 0;
|
|
3224
|
+
const patchedRawProperties = _optionalChain([patch, 'access', _324 => _324.kind, 'optionalAccess', _325 => _325.kind]) === "editbox" || _optionalChain([patch, 'access', _326 => _326.kind, 'optionalAccess', _327 => _327.kind]) === "unknown" ? patch.kind.rawProperties : void 0;
|
|
3183
3225
|
const nextInput = {
|
|
3184
3226
|
altText: "altText" in patch ? patch.altText : currentControl.altText,
|
|
3185
3227
|
anchor: nextAnchor,
|
|
@@ -3201,10 +3243,10 @@ function useXlsxViewerController(options2) {
|
|
|
3201
3243
|
recordHistoryBeforeMutation();
|
|
3202
3244
|
target.worksheet.setDrawing(currentControl.drawingPath, nextInput);
|
|
3203
3245
|
const updatedControl = target.worksheet.formControls[controlIndex];
|
|
3204
|
-
const updatedKind = _optionalChain([updatedControl, 'optionalAccess',
|
|
3246
|
+
const updatedKind = _optionalChain([updatedControl, 'optionalAccess', _328 => _328.formControl, 'access', _329 => _329.kind]);
|
|
3205
3247
|
const interactionChanged = updatedKind ? formControlInteractionChanged(currentControl.formControl.kind, updatedKind) : false;
|
|
3206
3248
|
const groupTopologyChanged = patch.anchor !== void 0 || updatedKind !== void 0 && updatedKind.kind !== currentControl.formControl.kind.kind && (updatedKind.kind === "groupBox" || currentControl.formControl.kind.kind === "groupBox");
|
|
3207
|
-
if (interactionChanged && updatedControl && (_optionalChain([updatedKind, 'optionalAccess',
|
|
3249
|
+
if (interactionChanged && updatedControl && (_optionalChain([updatedKind, 'optionalAccess', _330 => _330.kind]) === "checkbox" || _optionalChain([updatedKind, 'optionalAccess', _331 => _331.kind]) === "optionButton")) {
|
|
3208
3250
|
target.worksheet.setFormControlCheckState(updatedControl.drawingPath, updatedKind.state);
|
|
3209
3251
|
} else if (groupTopologyChanged) {
|
|
3210
3252
|
reconcileCheckedOptionButtons(target.worksheet);
|
|
@@ -3242,13 +3284,13 @@ function useXlsxViewerController(options2) {
|
|
|
3242
3284
|
after,
|
|
3243
3285
|
before,
|
|
3244
3286
|
cell,
|
|
3245
|
-
selectionAfter: { start: cell, end: cell },
|
|
3246
|
-
selectionBefore:
|
|
3287
|
+
selectionAfter: [{ start: cell, end: cell }],
|
|
3288
|
+
selectionBefore: selectionRanges,
|
|
3247
3289
|
sheetIndex: activeSheet.workbookSheetIndex
|
|
3248
3290
|
});
|
|
3249
3291
|
redoStackRef.current = [];
|
|
3250
3292
|
setHistoryRevision((current) => current + 1);
|
|
3251
|
-
}, [activeCell, activeSheet,
|
|
3293
|
+
}, [activeCell, activeSheet, selectionRanges]);
|
|
3252
3294
|
const recordRangeEditHistory = React.useCallback((mutations, selectionAfter, activeCellAfter, sortStateAfter = sortState) => {
|
|
3253
3295
|
if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0 && sortStateAfter === sortState) {
|
|
3254
3296
|
return;
|
|
@@ -3259,14 +3301,14 @@ function useXlsxViewerController(options2) {
|
|
|
3259
3301
|
activeCellBefore: activeCell,
|
|
3260
3302
|
mutations,
|
|
3261
3303
|
selectionAfter,
|
|
3262
|
-
selectionBefore:
|
|
3304
|
+
selectionBefore: selectionRanges,
|
|
3263
3305
|
sheetIndex: activeSheet.workbookSheetIndex,
|
|
3264
3306
|
sortStateAfter,
|
|
3265
3307
|
sortStateBefore: sortState
|
|
3266
3308
|
});
|
|
3267
3309
|
redoStackRef.current = [];
|
|
3268
3310
|
setHistoryRevision((current) => current + 1);
|
|
3269
|
-
}, [activeCell, activeSheet,
|
|
3311
|
+
}, [activeCell, activeSheet, selectionRanges, sortState]);
|
|
3270
3312
|
const sortTable = React.useCallback((tableName, columnIndex, direction) => {
|
|
3271
3313
|
const worksheet = getActiveWorksheet();
|
|
3272
3314
|
const targetTable = tables.find((table) => table.name === tableName || table.displayName === tableName);
|
|
@@ -3320,12 +3362,12 @@ function useXlsxViewerController(options2) {
|
|
|
3320
3362
|
return direction === "ascending" ? comparedText : -comparedText;
|
|
3321
3363
|
});
|
|
3322
3364
|
const nextSortState = { columnIndex, direction, tableName: targetTable.name };
|
|
3323
|
-
if (sortedRows.every((row2, index) => row2.index === _optionalChain([rows, 'access',
|
|
3324
|
-
if (_optionalChain([sortState, 'optionalAccess',
|
|
3365
|
+
if (sortedRows.every((row2, index) => row2.index === _optionalChain([rows, 'access', _332 => _332[index], 'optionalAccess', _333 => _333.index]))) {
|
|
3366
|
+
if (_optionalChain([sortState, 'optionalAccess', _334 => _334.tableName]) === targetTable.name && sortState.columnIndex === columnIndex && sortState.direction === direction) {
|
|
3325
3367
|
return;
|
|
3326
3368
|
}
|
|
3327
3369
|
setSortState(nextSortState);
|
|
3328
|
-
recordRangeEditHistory([],
|
|
3370
|
+
recordRangeEditHistory([], selectionRanges, activeCell, nextSortState);
|
|
3329
3371
|
return;
|
|
3330
3372
|
}
|
|
3331
3373
|
const mutations = [];
|
|
@@ -3354,7 +3396,7 @@ function useXlsxViewerController(options2) {
|
|
|
3354
3396
|
maybeRecalculateWorkbook(workbook);
|
|
3355
3397
|
refreshWorkbookState(workbook);
|
|
3356
3398
|
setSortState(nextSortState);
|
|
3357
|
-
recordRangeEditHistory(mutations,
|
|
3399
|
+
recordRangeEditHistory(mutations, selectionRanges, activeCell, nextSortState);
|
|
3358
3400
|
}, [
|
|
3359
3401
|
intersectsPivot,
|
|
3360
3402
|
activeCell,
|
|
@@ -3364,7 +3406,7 @@ function useXlsxViewerController(options2) {
|
|
|
3364
3406
|
readOnly,
|
|
3365
3407
|
recordRangeEditHistory,
|
|
3366
3408
|
refreshWorkbookState,
|
|
3367
|
-
|
|
3409
|
+
selectionRanges,
|
|
3368
3410
|
sortState,
|
|
3369
3411
|
tables,
|
|
3370
3412
|
workbook
|
|
@@ -3395,120 +3437,136 @@ function useXlsxViewerController(options2) {
|
|
|
3395
3437
|
if (!workbook) {
|
|
3396
3438
|
return;
|
|
3397
3439
|
}
|
|
3398
|
-
const activeSheetName = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
3440
|
+
const activeSheetName = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _335 => _335.name]), () => ( "sheet"));
|
|
3399
3441
|
downloadText(workbook.saveCsvString(), `${fileStem(displayFileName)}-${activeSheetName}.csv`, CSV_MIME_TYPE);
|
|
3400
|
-
}, [_optionalChain([activeSheet, 'optionalAccess',
|
|
3442
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _336 => _336.name]), displayFileName, workbook]);
|
|
3401
3443
|
const recalculate = React.useCallback(() => {
|
|
3402
3444
|
if (!workbook) {
|
|
3403
3445
|
return;
|
|
3404
3446
|
}
|
|
3405
|
-
const result =
|
|
3447
|
+
const result = _chunkXZJLPW64cjs.tryRecalculate.call(void 0, workbook);
|
|
3406
3448
|
if (result.calculated) {
|
|
3407
3449
|
refreshWorkbookState(workbook);
|
|
3408
3450
|
return;
|
|
3409
3451
|
}
|
|
3410
3452
|
setShouldAutoCalculate(false);
|
|
3411
3453
|
}, [refreshWorkbookState, workbook]);
|
|
3412
|
-
const applyReadOnlyResizeOverride = React.useCallback((axis,
|
|
3413
|
-
if (!activeSheet)
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
...sheet.colWidthOverridesPx,
|
|
3425
|
-
[actualIndex]: contentSizePx
|
|
3426
|
-
};
|
|
3427
|
-
const nextColWidths = [...sheet.colWidths];
|
|
3428
|
-
const visibleColIndex = sheet.visibleCols.indexOf(actualIndex);
|
|
3429
|
-
if (visibleColIndex >= 0) {
|
|
3430
|
-
nextColWidths[visibleColIndex] = contentSizePx;
|
|
3431
|
-
}
|
|
3432
|
-
return {
|
|
3433
|
-
...sheet,
|
|
3434
|
-
colWidthOverridesPx: nextColWidthOverridesPx,
|
|
3435
|
-
colWidths: nextColWidths
|
|
3436
|
-
};
|
|
3437
|
-
}
|
|
3438
|
-
const nextRowHeightOverridesPx = {
|
|
3439
|
-
...sheet.rowHeightOverridesPx,
|
|
3440
|
-
[actualIndex]: contentSizePx
|
|
3441
|
-
};
|
|
3442
|
-
const nextRowHeights = [...sheet.rowHeights];
|
|
3443
|
-
const visibleRowIndex = sheet.visibleRows.indexOf(actualIndex);
|
|
3444
|
-
if (visibleRowIndex >= 0) {
|
|
3445
|
-
nextRowHeights[visibleRowIndex] = contentSizePx;
|
|
3446
|
-
}
|
|
3447
|
-
return {
|
|
3448
|
-
...sheet,
|
|
3449
|
-
rowHeightOverridesPx: nextRowHeightOverridesPx,
|
|
3450
|
-
rowHeights: nextRowHeights
|
|
3451
|
-
};
|
|
3454
|
+
const applyReadOnlyResizeOverride = React.useCallback((axis, indices, sizePx) => {
|
|
3455
|
+
if (!activeSheet) return;
|
|
3456
|
+
const contentSizePx = activeSheet.officeLayout ? sizePx : _chunkXZJLPW64cjs.resolveContentSheetAxisPixels.call(void 0, sizePx, activeSheet.showGridLines);
|
|
3457
|
+
const selected = new Set(indices);
|
|
3458
|
+
setSheets((current) => current.map((sheet) => {
|
|
3459
|
+
if (sheet.workbookSheetIndex !== activeSheet.workbookSheetIndex) return sheet;
|
|
3460
|
+
const isRow = axis === "row";
|
|
3461
|
+
const overrides = { ...isRow ? sheet.rowHeightOverridesPx : sheet.colWidthOverridesPx };
|
|
3462
|
+
for (const index of selected) overrides[index] = contentSizePx;
|
|
3463
|
+
const visible = isRow ? sheet.visibleRows : sheet.visibleCols;
|
|
3464
|
+
const sizes = (isRow ? sheet.rowHeights : sheet.colWidths).map((size, offset) => selected.has(visible[offset]) ? contentSizePx : size);
|
|
3465
|
+
return isRow ? { ...sheet, rowHeightOverridesPx: overrides, rowHeights: sizes } : { ...sheet, colWidthOverridesPx: overrides, colWidths: sizes };
|
|
3452
3466
|
}));
|
|
3453
3467
|
setRevision((current) => current + 1);
|
|
3454
3468
|
}, [activeSheet]);
|
|
3455
|
-
const
|
|
3456
|
-
if (!
|
|
3457
|
-
|
|
3458
|
-
}
|
|
3459
|
-
if (
|
|
3460
|
-
applyReadOnlyResizeOverride("column", col, widthPx);
|
|
3461
|
-
return;
|
|
3462
|
-
}
|
|
3463
|
-
if (!workbook) {
|
|
3464
|
-
return;
|
|
3465
|
-
}
|
|
3466
|
-
recordHistoryBeforeMutation();
|
|
3469
|
+
const setAxisHidden = React.useCallback((axis, hidden, start, end = start) => {
|
|
3470
|
+
if (readOnly || !workbook || !activeSheet) return;
|
|
3471
|
+
const limit = axis === "row" ? _chunkXZJLPW64cjs.XLSX_MAX_ROWS : _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS;
|
|
3472
|
+
const ranges = start === void 0 && end === void 0 ? selectionRanges.map((area) => ({ start: area.start[axis], end: area.end[axis] })) : [{ start: _nullishCoalesce(start, () => ( -1)), end: _nullishCoalesce(end, () => ( -1)) }];
|
|
3473
|
+
if (!ranges.length || ranges.some((range) => !Number.isInteger(range.start) || !Number.isInteger(range.end) || range.start < 0 || range.end < range.start || range.end >= limit)) return;
|
|
3467
3474
|
const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3475
|
+
try {
|
|
3476
|
+
const existing = new Set(axis === "row" ? worksheet.hiddenRows : worksheet.hiddenColumns);
|
|
3477
|
+
if (!hidden && !existing.size) return;
|
|
3478
|
+
if (!hidden && start === void 0 && existing.has(0)) {
|
|
3479
|
+
let firstVisible = 0;
|
|
3480
|
+
while (existing.has(firstVisible)) firstVisible++;
|
|
3481
|
+
for (const range of ranges) {
|
|
3482
|
+
if (range.start === firstVisible) range.start = 0;
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
const changes = ranges.filter((range) => {
|
|
3486
|
+
for (let index = range.start; index <= range.end; index++) {
|
|
3487
|
+
if (existing.has(index) !== hidden) return true;
|
|
3488
|
+
}
|
|
3489
|
+
return false;
|
|
3490
|
+
});
|
|
3491
|
+
if (!changes.length) return;
|
|
3492
|
+
recordHistoryBeforeMutation();
|
|
3493
|
+
for (const range of changes) {
|
|
3494
|
+
if (axis === "row") worksheet.setRowsHidden(range.start, range.end, hidden);
|
|
3495
|
+
else worksheet.setColumnsHidden(range.start, range.end, hidden);
|
|
3496
|
+
}
|
|
3497
|
+
if (hidden && activeCell && changes.some((range) => range.start <= activeCell[axis] && activeCell[axis] <= range.end)) {
|
|
3498
|
+
const isHidden = (index2) => axis === "row" ? worksheet.isRowHidden(index2) : worksheet.isColumnHidden(index2);
|
|
3499
|
+
let index = activeCell[axis];
|
|
3500
|
+
while (index < limit && isHidden(index)) index++;
|
|
3501
|
+
if (index === limit) {
|
|
3502
|
+
index = activeCell[axis] - 1;
|
|
3503
|
+
while (index >= 0 && isHidden(index)) index--;
|
|
3504
|
+
}
|
|
3505
|
+
if (index >= 0) {
|
|
3506
|
+
const cell = { ...activeCell, [axis]: index };
|
|
3507
|
+
setActiveCell(cell);
|
|
3508
|
+
setSelection({ start: cell, end: cell });
|
|
3509
|
+
selectionAnchorRef.current = cell;
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
refreshWorkbookState(workbook);
|
|
3513
|
+
} finally {
|
|
3514
|
+
worksheet.free();
|
|
3515
|
+
}
|
|
3516
|
+
}, [activeCell, activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
|
|
3517
|
+
const hideRows = React.useCallback((start, end) => setAxisHidden("row", true, start, end), [setAxisHidden]);
|
|
3518
|
+
const unhideRows = React.useCallback((start, end) => setAxisHidden("row", false, start, end), [setAxisHidden]);
|
|
3519
|
+
const hideColumns = React.useCallback((start, end) => setAxisHidden("col", true, start, end), [setAxisHidden]);
|
|
3520
|
+
const unhideColumns = React.useCallback((start, end) => setAxisHidden("col", false, start, end), [setAxisHidden]);
|
|
3521
|
+
const setFreezeBoundary = React.useCallback((cell) => {
|
|
3522
|
+
if (readOnly || !workbook || !activeSheet) return;
|
|
3523
|
+
const { row: row2, col } = cell;
|
|
3524
|
+
if (!Number.isInteger(row2) || row2 < 0 || row2 >= _chunkXZJLPW64cjs.XLSX_MAX_ROWS || !Number.isInteger(col) || col < 0 || col >= _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS) return;
|
|
3525
|
+
const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
|
|
3526
|
+
try {
|
|
3527
|
+
const current = parseWorksheetFreezePanes(worksheet);
|
|
3528
|
+
if (row2 === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _337 => _337.row]), () => ( 0))) && col === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _338 => _338.col]), () => ( 0)))) return;
|
|
3529
|
+
recordHistoryBeforeMutation();
|
|
3530
|
+
worksheet.setFreezePanes(row2, col);
|
|
3531
|
+
refreshWorkbookState(workbook);
|
|
3532
|
+
} finally {
|
|
3533
|
+
worksheet.free();
|
|
3534
|
+
}
|
|
3535
|
+
}, [activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
3536
|
+
const freezeCell = resolveFreezePanesCell(activeCell, selection);
|
|
3537
|
+
const canFreezePanes = Boolean(!readOnly && workbook && activeSheet && freezeCell && (freezeCell.row > 0 || freezeCell.col > 0));
|
|
3538
|
+
const freezePanes = React.useCallback((cell = freezeCell) => {
|
|
3539
|
+
if (cell) setFreezeBoundary(cell);
|
|
3540
|
+
}, [freezeCell, setFreezeBoundary]);
|
|
3541
|
+
const unfreezePanes = React.useCallback(() => setFreezeBoundary({ row: 0, col: 0 }), [setFreezeBoundary]);
|
|
3542
|
+
const resizeAxis = React.useCallback((axis, target, sizePx) => {
|
|
3543
|
+
if (!canResize || !activeSheet || !Number.isFinite(sizePx)) return;
|
|
3544
|
+
const indices = typeof target === "number" ? [target] : target;
|
|
3545
|
+
const limit = axis === "row" ? _chunkXZJLPW64cjs.XLSX_MAX_ROWS : _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS;
|
|
3546
|
+
if (!indices.length || indices.some((index) => !Number.isInteger(index) || index < 0 || index >= limit)) return;
|
|
3489
3547
|
if (isWorkerBacked) {
|
|
3490
|
-
applyReadOnlyResizeOverride(
|
|
3491
|
-
return;
|
|
3492
|
-
}
|
|
3493
|
-
if (!workbook) {
|
|
3548
|
+
applyReadOnlyResizeOverride(axis, indices, sizePx);
|
|
3494
3549
|
return;
|
|
3495
3550
|
}
|
|
3496
|
-
|
|
3551
|
+
if (!workbook) return;
|
|
3497
3552
|
const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3553
|
+
try {
|
|
3554
|
+
recordHistoryBeforeMutation();
|
|
3555
|
+
const contentPx = _chunkXZJLPW64cjs.resolveContentSheetAxisPixels.call(void 0, sizePx, activeSheet.showGridLines);
|
|
3556
|
+
if (axis === "row") {
|
|
3557
|
+
const points = activeSheet.officeLayout ? Math.max(sizePx, MIN_ROW_HEIGHT_PX) * 3 / 4 : pxToSheetRowHeight(contentPx);
|
|
3558
|
+
for (const index of indices) worksheet.setRowHeight(index, points);
|
|
3559
|
+
} else {
|
|
3560
|
+
const width = activeSheet.officeLayout ? _chunkXZJLPW64cjs.pxToOfficeColumnWidth.call(void 0, sizePx, activeSheet.officeLayout.columnDigitWidthPt) : _chunkXZJLPW64cjs.pxToSheetColumnWidth.call(void 0, contentPx, activeSheet.columnWidthCharacterWidthPx);
|
|
3561
|
+
for (const index of indices) worksheet.setColumnWidth(index, width);
|
|
3562
|
+
}
|
|
3563
|
+
refreshWorkbookState(workbook);
|
|
3564
|
+
} finally {
|
|
3565
|
+
worksheet.free();
|
|
3566
|
+
}
|
|
3567
|
+
}, [activeSheet, applyReadOnlyResizeOverride, canResize, isWorkerBacked, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
3568
|
+
const resizeColumn = React.useCallback((col, widthPx) => resizeAxis("column", col, widthPx), [resizeAxis]);
|
|
3569
|
+
const resizeRow = React.useCallback((row2, heightPx) => resizeAxis("row", row2, heightPx), [resizeAxis]);
|
|
3512
3570
|
const resolveAnchoredObjectRect = React.useCallback((anchor, worksheet) => {
|
|
3513
3571
|
const resolveAxisSum = (index, getSize) => {
|
|
3514
3572
|
let total = 0;
|
|
@@ -3554,21 +3612,21 @@ function useXlsxViewerController(options2) {
|
|
|
3554
3612
|
if (!currentChart || currentChart.editable === false || currentChart.workbookSheetIndex !== activeSheet.workbookSheetIndex) {
|
|
3555
3613
|
return;
|
|
3556
3614
|
}
|
|
3557
|
-
const nextAnchor =
|
|
3615
|
+
const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentChart.anchor, {
|
|
3558
3616
|
contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
|
|
3559
3617
|
contentOffsetTop: GRID_HEADER_HEIGHT,
|
|
3560
|
-
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3561
|
-
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3618
|
+
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _339 => _339.columnWidths, 'access', _340 => _340[col]]), () => ( getColumnWidthPx(worksheet, col))),
|
|
3619
|
+
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _341 => _341.rowHeights, 'access', _342 => _342[row2]]), () => ( getRowHeightPx(worksheet, row2)))
|
|
3562
3620
|
});
|
|
3563
|
-
if (_optionalChain([currentChart, 'access',
|
|
3564
|
-
commitPivotMutation((target) =>
|
|
3565
|
-
anchor:
|
|
3621
|
+
if (_optionalChain([currentChart, 'access', _343 => _343.raw, 'optionalAccess', _344 => _344.pivotSource]) && currentChart.name) {
|
|
3622
|
+
commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(worksheet.name, currentChart.name, {
|
|
3623
|
+
anchor: _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, nextAnchor)
|
|
3566
3624
|
}), false);
|
|
3567
3625
|
return;
|
|
3568
3626
|
}
|
|
3569
3627
|
if (!imageAssetsRef.current || !hydratedChartAssets) return;
|
|
3570
3628
|
recordHistoryBeforeMutation();
|
|
3571
|
-
if (!
|
|
3629
|
+
if (!_chunkXZJLPW64cjs.updateWorkbookChartAnchor.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, nextAnchor)) return;
|
|
3572
3630
|
hydratedChartAssets.chartsByWorkbookSheetIndex = hydratedChartAssets.chartsByWorkbookSheetIndex.map((sheetCharts) => sheetCharts.map((chart) => chart.id === id ? { ...chart, anchor: nextAnchor } : chart));
|
|
3573
3631
|
setChartsByWorkbookSheetIndex((current) => current.map((sheetCharts) => sheetCharts.map((chart) => chart.id === id ? { ...chart, anchor: nextAnchor } : chart)));
|
|
3574
3632
|
setRevision((current) => current + 1);
|
|
@@ -3593,14 +3651,14 @@ function useXlsxViewerController(options2) {
|
|
|
3593
3651
|
if (!currentImage || currentImage.editable === false || currentImage.workbookSheetIndex !== activeSheet.workbookSheetIndex) {
|
|
3594
3652
|
return;
|
|
3595
3653
|
}
|
|
3596
|
-
const nextAnchor =
|
|
3654
|
+
const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentImage.anchor, {
|
|
3597
3655
|
contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
|
|
3598
3656
|
contentOffsetTop: GRID_HEADER_HEIGHT,
|
|
3599
|
-
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3600
|
-
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
3657
|
+
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _345 => _345.columnWidths, 'access', _346 => _346[col]]), () => ( getColumnWidthPx(worksheet, col))),
|
|
3658
|
+
getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _347 => _347.rowHeights, 'access', _348 => _348[row2]]), () => ( getRowHeightPx(worksheet, row2)))
|
|
3601
3659
|
});
|
|
3602
3660
|
recordHistoryBeforeMutation();
|
|
3603
|
-
if (!
|
|
3661
|
+
if (!_chunkXZJLPW64cjs.updateWorkbookImageAnchor.call(void 0, imageAssetsRef.current, id, nextAnchor)) {
|
|
3604
3662
|
return;
|
|
3605
3663
|
}
|
|
3606
3664
|
setImagesByWorkbookSheetIndex([...imageAssetsRef.current.imagesByWorkbookSheetIndex]);
|
|
@@ -3693,7 +3751,7 @@ function useXlsxViewerController(options2) {
|
|
|
3693
3751
|
return;
|
|
3694
3752
|
}
|
|
3695
3753
|
const currentRect = resolveAnchoredObjectRect(currentChart.anchor, worksheet);
|
|
3696
|
-
setChartRect(id,
|
|
3754
|
+
setChartRect(id, _chunkXZJLPW64cjs.resizeImageRect.call(void 0, currentRect, handle, deltaX, deltaY, 48));
|
|
3697
3755
|
}, [getActiveWorksheet, getChartById, resolveAnchoredObjectRect, setChartRect]);
|
|
3698
3756
|
const resizeImageBy = React.useCallback((id, handle, deltaX, deltaY) => {
|
|
3699
3757
|
const currentImage = getImageById(id);
|
|
@@ -3721,7 +3779,7 @@ function useXlsxViewerController(options2) {
|
|
|
3721
3779
|
1,
|
|
3722
3780
|
GRID_HEADER_HEIGHT + resolveAxisSum(currentImage.anchor.to.row, (row2) => getRowHeightPx(worksheet, row2)) + currentImage.anchor.to.rowOffsetEmu / 9525 - top
|
|
3723
3781
|
) : currentImage.anchor.sizeEmu.cy / 9525;
|
|
3724
|
-
const nextRect =
|
|
3782
|
+
const nextRect = _chunkXZJLPW64cjs.resizeImageRect.call(void 0, { height, left, top, width }, handle, deltaX, deltaY);
|
|
3725
3783
|
setImageRect(id, nextRect);
|
|
3726
3784
|
}, [getActiveWorksheet, getColumnWidthPx, getImageById, getRowHeightPx, setImageRect]);
|
|
3727
3785
|
const commitDrawingArchiveMutation = React.useCallback(async (mutate, target) => {
|
|
@@ -3743,10 +3801,10 @@ function useXlsxViewerController(options2) {
|
|
|
3743
3801
|
let nextAssets = null;
|
|
3744
3802
|
let published = false;
|
|
3745
3803
|
try {
|
|
3746
|
-
nextAssets = await
|
|
3804
|
+
nextAssets = await _chunkXZJLPW64cjs.loadWorkbookImageAssets.call(void 0, bytes, next);
|
|
3747
3805
|
const latest = drawingMutationState.current;
|
|
3748
3806
|
if (epoch !== drawingMutationEpoch.current || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly) {
|
|
3749
|
-
|
|
3807
|
+
_chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, nextAssets);
|
|
3750
3808
|
next.free();
|
|
3751
3809
|
return false;
|
|
3752
3810
|
}
|
|
@@ -3762,17 +3820,17 @@ function useXlsxViewerController(options2) {
|
|
|
3762
3820
|
setSelectedChartId(null);
|
|
3763
3821
|
setSelectedChartElement(null);
|
|
3764
3822
|
if (target.kind === "chart") {
|
|
3765
|
-
const chart = _optionalChain([chartAssetsRef, 'access',
|
|
3766
|
-
setSelectedChartId(_nullishCoalesce(_optionalChain([chart, 'optionalAccess',
|
|
3823
|
+
const chart = _optionalChain([chartAssetsRef, 'access', _349 => _349.current, 'optionalAccess', _350 => _350.chartsByWorkbookSheetIndex, 'access', _351 => _351.flat, 'call', _352 => _352(), 'access', _353 => _353.find, 'call', _354 => _354((chart2) => target.path ? chart2.chartPath === target.path : chart2.name === target.name)]);
|
|
3824
|
+
setSelectedChartId(_nullishCoalesce(_optionalChain([chart, 'optionalAccess', _355 => _355.id]), () => ( null)));
|
|
3767
3825
|
setSelectedChartElement(chart ? { kind: "chart", chartId: chart.id } : null);
|
|
3768
3826
|
} else if (target.kind === "image") {
|
|
3769
|
-
const image = _optionalChain([nextAssets, 'optionalAccess',
|
|
3770
|
-
setSelectedImageId(_nullishCoalesce(_optionalChain([image, 'optionalAccess',
|
|
3827
|
+
const image = _optionalChain([nextAssets, 'optionalAccess', _356 => _356.imagesByWorkbookSheetIndex, 'access', _357 => _357.flat, 'call', _358 => _358(), 'access', _359 => _359.find, 'call', _360 => _360((image2) => image2.name === target.name)]);
|
|
3828
|
+
setSelectedImageId(_nullishCoalesce(_optionalChain([image, 'optionalAccess', _361 => _361.id]), () => ( null)));
|
|
3771
3829
|
}
|
|
3772
3830
|
return true;
|
|
3773
3831
|
} catch (cause) {
|
|
3774
3832
|
if (!published) {
|
|
3775
|
-
|
|
3833
|
+
_chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, nextAssets);
|
|
3776
3834
|
next.free();
|
|
3777
3835
|
}
|
|
3778
3836
|
throw cause;
|
|
@@ -3794,7 +3852,7 @@ function useXlsxViewerController(options2) {
|
|
|
3794
3852
|
const generation = loadGenerationRef.current;
|
|
3795
3853
|
const data = input === void 0 ? (await readBrowserClipboard()).drawing : typeof input === "string" ? decodeExcelDrawingClipboard(input) : input.type.startsWith("image/") ? await imageDrawingClipboard(input) : decodeExcelDrawingClipboard(new Uint8Array(await input.arrayBuffer()));
|
|
3796
3854
|
const latest = drawingMutationState.current;
|
|
3797
|
-
if (!data || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access',
|
|
3855
|
+
if (!data || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _362 => _362.activeCell, 'optionalAccess', _363 => _363.row]) !== _optionalChain([state, 'access', _364 => _364.activeCell, 'optionalAccess', _365 => _365.row]) || _optionalChain([latest, 'access', _366 => _366.activeCell, 'optionalAccess', _367 => _367.col]) !== _optionalChain([state, 'access', _368 => _368.activeCell, 'optionalAccess', _369 => _369.col])) return false;
|
|
3798
3856
|
return pasteDrawing(data);
|
|
3799
3857
|
}, [activeSheet, pasteDrawing, readOnly, workbook]);
|
|
3800
3858
|
const arrangeDrawing = React.useCallback(async (kind, id, order) => {
|
|
@@ -3833,9 +3891,9 @@ function useXlsxViewerController(options2) {
|
|
|
3833
3891
|
const chart = getChartById(id);
|
|
3834
3892
|
const option = chartTypeOptions.find((option2) => option2.id === type);
|
|
3835
3893
|
if (readOnly || !chart || !option || chartTypeUnavailable(chart, option)) return false;
|
|
3836
|
-
if (_optionalChain([chart, 'access',
|
|
3894
|
+
if (_optionalChain([chart, 'access', _370 => _370.raw, 'optionalAccess', _371 => _371.pivotSource])) {
|
|
3837
3895
|
if (!workbook || !chart.name) return false;
|
|
3838
|
-
commitPivotMutation((target) =>
|
|
3896
|
+
commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(workbook.getSheet(chart.workbookSheetIndex).name, chart.name, { chartType: option.chartType }), false);
|
|
3839
3897
|
return true;
|
|
3840
3898
|
}
|
|
3841
3899
|
const assets = imageAssetsRef.current;
|
|
@@ -3856,7 +3914,7 @@ function useXlsxViewerController(options2) {
|
|
|
3856
3914
|
assets.archive = nextAssets.archive;
|
|
3857
3915
|
assets.dirtyArchivePaths = nextAssets.dirtyArchivePaths;
|
|
3858
3916
|
origin.chartKind = option.layout ? "modern" : "classic";
|
|
3859
|
-
const nextChart =
|
|
3917
|
+
const nextChart = _chunkXZJLPW64cjs.refreshChartRenderSource.call(void 0, { ...chart, chartType: option.chartType, chartExLayout: option.layout, is3d: option.is3d, typeGroups: void 0 }, assets, workbook);
|
|
3860
3918
|
charts2.chartsByWorkbookSheetIndex = charts2.chartsByWorkbookSheetIndex.map((items) => items.map((item) => item.id === id ? nextChart : item));
|
|
3861
3919
|
setChartsByWorkbookSheetIndex(charts2.chartsByWorkbookSheetIndex);
|
|
3862
3920
|
setSelectedChartElement({ kind: "chart", chartId: id });
|
|
@@ -3869,30 +3927,30 @@ function useXlsxViewerController(options2) {
|
|
|
3869
3927
|
if (readOnly || !currentChart) {
|
|
3870
3928
|
return;
|
|
3871
3929
|
}
|
|
3872
|
-
if (_optionalChain([currentChart, 'access',
|
|
3930
|
+
if (_optionalChain([currentChart, 'access', _372 => _372.raw, 'optionalAccess', _373 => _373.pivotSource])) {
|
|
3873
3931
|
if (!workbook || !currentChart.name) return;
|
|
3874
3932
|
if (Object.keys(patch).some((key) => !["title", "chartType", "anchor"].includes(key))) {
|
|
3875
3933
|
throw new Error("Change PivotChart data through the pivot table field settings.");
|
|
3876
3934
|
}
|
|
3877
3935
|
const sheetName = workbook.getSheet(currentChart.workbookSheetIndex).name;
|
|
3878
|
-
commitPivotMutation((target) =>
|
|
3936
|
+
commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(sheetName, currentChart.name, {
|
|
3879
3937
|
title: patch.title,
|
|
3880
3938
|
chartType: patch.chartType,
|
|
3881
|
-
anchor: patch.anchor ?
|
|
3939
|
+
anchor: patch.anchor ? _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, patch.anchor) : void 0
|
|
3882
3940
|
}), false);
|
|
3883
3941
|
return;
|
|
3884
3942
|
}
|
|
3885
3943
|
recordHistoryBeforeMutation();
|
|
3886
3944
|
if (patch.anchor && imageAssetsRef.current && hydratedChartAssets) {
|
|
3887
|
-
|
|
3945
|
+
_chunkXZJLPW64cjs.updateWorkbookChartAnchor.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, patch.anchor);
|
|
3888
3946
|
}
|
|
3889
3947
|
if (imageAssetsRef.current && hydratedChartAssets) {
|
|
3890
|
-
|
|
3948
|
+
_chunkXZJLPW64cjs.updateWorkbookChartDefinition.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, patch);
|
|
3891
3949
|
}
|
|
3892
3950
|
setChartsByWorkbookSheetIndex((current) => current.map((sheetCharts) => sheetCharts.map((chart) => {
|
|
3893
3951
|
if (chart.id !== id) return chart;
|
|
3894
3952
|
const nextChart = { ...chart, ...patch, renderSource: _nullishCoalesce(patch.renderSource, () => ( chart.renderSource)) };
|
|
3895
|
-
return imageAssetsRef.current ?
|
|
3953
|
+
return imageAssetsRef.current ? _chunkXZJLPW64cjs.refreshChartRenderSource.call(void 0, nextChart, imageAssetsRef.current, workbook) : nextChart;
|
|
3896
3954
|
})));
|
|
3897
3955
|
setRevision((current) => current + 1);
|
|
3898
3956
|
}, [commitPivotMutation, ensureChartAssetsHydrated, getChartById, readOnly, recordHistoryBeforeMutation, sheets, workbook]);
|
|
@@ -3901,10 +3959,10 @@ function useXlsxViewerController(options2) {
|
|
|
3901
3959
|
return false;
|
|
3902
3960
|
}
|
|
3903
3961
|
const chart = getChartById(chartId);
|
|
3904
|
-
if (!chart || chart.editable === false || _optionalChain([chart, 'access',
|
|
3962
|
+
if (!chart || chart.editable === false || _optionalChain([chart, 'access', _374 => _374.raw, 'optionalAccess', _375 => _375.pivotSource])) {
|
|
3905
3963
|
return false;
|
|
3906
3964
|
}
|
|
3907
|
-
const nextChart =
|
|
3965
|
+
const nextChart = _chunkXZJLPW64cjs.applyChartSeriesFormula.call(void 0, chart, seriesIndex, formula, workbook);
|
|
3908
3966
|
if (!nextChart) {
|
|
3909
3967
|
return false;
|
|
3910
3968
|
}
|
|
@@ -3923,30 +3981,35 @@ function useXlsxViewerController(options2) {
|
|
|
3923
3981
|
}
|
|
3924
3982
|
return true;
|
|
3925
3983
|
}, [getChartById, readOnly, updateChart, workbook]);
|
|
3926
|
-
const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
3984
|
+
const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _376 => _376.mergedRanges]), () => ( []))), [_optionalChain([activeSheet, 'optionalAccess', _377 => _377.mergedRanges])]);
|
|
3927
3985
|
const selectCell = React.useCallback((cell, options3) => {
|
|
3928
3986
|
const merged = findSelectionMerge(cell);
|
|
3929
|
-
const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess',
|
|
3987
|
+
const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess', _378 => _378.start]), () => ( cell));
|
|
3930
3988
|
setSelectedChartId(null);
|
|
3931
3989
|
setSelectedChartElement(null);
|
|
3932
3990
|
setSelectedImageId(null);
|
|
3933
3991
|
setActiveCell(anchorCell);
|
|
3934
|
-
if (_optionalChain([options3, 'optionalAccess',
|
|
3935
|
-
setSelection(expandHighlightedRange(normalizeRange({ start: selectionAnchorRef.current, end: cell }), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
3992
|
+
if (_optionalChain([options3, 'optionalAccess', _379 => _379.extend]) && selectionAnchorRef.current) {
|
|
3993
|
+
setSelection(expandHighlightedRange(normalizeRange({ start: selectionAnchorRef.current, end: cell }), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _380 => _380.mergedRanges]), () => ( []))));
|
|
3936
3994
|
return;
|
|
3937
3995
|
}
|
|
3938
3996
|
selectionAnchorRef.current = anchorCell;
|
|
3939
3997
|
setSelection(_nullishCoalesce(merged, () => ( { start: cell, end: cell })));
|
|
3940
|
-
}, [_optionalChain([activeSheet, 'optionalAccess',
|
|
3941
|
-
const
|
|
3942
|
-
const
|
|
3998
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _381 => _381.mergedRanges]), findSelectionMerge]);
|
|
3999
|
+
const selectRanges = React.useCallback((ranges, activeCorner = "end") => {
|
|
4000
|
+
const areas = ranges.reduce((previous, range) => addSelectionRange(previous, normalizeRange(range)), []);
|
|
4001
|
+
const active = areas.at(-1);
|
|
3943
4002
|
setSelectedChartId(null);
|
|
3944
4003
|
setSelectedChartElement(null);
|
|
3945
4004
|
setSelectedImageId(null);
|
|
3946
|
-
selectionAnchorRef.current =
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
4005
|
+
selectionAnchorRef.current = _nullishCoalesce(_optionalChain([active, 'optionalAccess', _382 => _382.start]), () => ( null));
|
|
4006
|
+
const cell = _optionalChain([active, 'optionalAccess', _383 => _383[activeCorner]]);
|
|
4007
|
+
setActiveCell(cell ? _nullishCoalesce(_optionalChain([findSelectionMerge, 'call', _384 => _384(cell), 'optionalAccess', _385 => _385.start]), () => ( cell)) : null);
|
|
4008
|
+
setSelectionRanges(areas);
|
|
4009
|
+
}, [findSelectionMerge]);
|
|
4010
|
+
const selectRange = React.useCallback((range) => {
|
|
4011
|
+
selectRanges([expandHighlightedRange(normalizeRange(range), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _386 => _386.mergedRanges]), () => ( [])))]);
|
|
4012
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _387 => _387.mergedRanges]), selectRanges]);
|
|
3950
4013
|
const clearSelection = React.useCallback(() => {
|
|
3951
4014
|
selectionAnchorRef.current = null;
|
|
3952
4015
|
setActiveCell(null);
|
|
@@ -3957,38 +4020,35 @@ function useXlsxViewerController(options2) {
|
|
|
3957
4020
|
}, []);
|
|
3958
4021
|
const clearSelectedCells = React.useCallback(() => {
|
|
3959
4022
|
const worksheet = getActiveWorksheet();
|
|
3960
|
-
|
|
3961
|
-
if (readOnly || !worksheet || !workbook || !targetRange) {
|
|
3962
|
-
return;
|
|
3963
|
-
}
|
|
3964
|
-
if (intersectsPivot(targetRange)) return;
|
|
3965
|
-
const normalized = normalizeRange(targetRange);
|
|
4023
|
+
if (readOnly || !worksheet || !workbook || !selectionRanges.length || selectionRanges.some(intersectsPivot)) return;
|
|
3966
4024
|
const mutations = [];
|
|
3967
|
-
for (
|
|
3968
|
-
for (let
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
4025
|
+
for (const area of selectionRanges) {
|
|
4026
|
+
for (let row2 = area.start.row; row2 <= area.end.row; row2 += 1) {
|
|
4027
|
+
for (let col = area.start.col; col <= area.end.col; col += 1) {
|
|
4028
|
+
if (worksheet.isMergedSecondary(row2, col)) {
|
|
4029
|
+
continue;
|
|
4030
|
+
}
|
|
4031
|
+
const cell = { row: row2, col };
|
|
4032
|
+
const before = captureCellMutationState(cell);
|
|
4033
|
+
if (!before) {
|
|
4034
|
+
continue;
|
|
4035
|
+
}
|
|
4036
|
+
worksheet.setCell(cellAddressToA1({ row: row2, col }), "");
|
|
4037
|
+
const after = captureCellMutationState(cell);
|
|
4038
|
+
if (!after) {
|
|
4039
|
+
continue;
|
|
4040
|
+
}
|
|
4041
|
+
mutations.push({
|
|
4042
|
+
after,
|
|
4043
|
+
before,
|
|
4044
|
+
cell
|
|
4045
|
+
});
|
|
3981
4046
|
}
|
|
3982
|
-
mutations.push({
|
|
3983
|
-
after,
|
|
3984
|
-
before,
|
|
3985
|
-
cell
|
|
3986
|
-
});
|
|
3987
4047
|
}
|
|
3988
4048
|
}
|
|
3989
4049
|
maybeRecalculateWorkbook(workbook);
|
|
3990
4050
|
refreshWorkbookState(workbook);
|
|
3991
|
-
recordRangeEditHistory(mutations,
|
|
4051
|
+
recordRangeEditHistory(mutations, selectionRanges, activeCell);
|
|
3992
4052
|
}, [
|
|
3993
4053
|
intersectsPivot,
|
|
3994
4054
|
activeCell,
|
|
@@ -3998,7 +4058,7 @@ function useXlsxViewerController(options2) {
|
|
|
3998
4058
|
readOnly,
|
|
3999
4059
|
recordRangeEditHistory,
|
|
4000
4060
|
refreshWorkbookState,
|
|
4001
|
-
|
|
4061
|
+
selectionRanges,
|
|
4002
4062
|
workbook
|
|
4003
4063
|
]);
|
|
4004
4064
|
const setCellValue = React.useCallback((cell, value) => {
|
|
@@ -4083,8 +4143,8 @@ function useXlsxViewerController(options2) {
|
|
|
4083
4143
|
if (after) mutations.push({ cell, before, after });
|
|
4084
4144
|
}
|
|
4085
4145
|
refreshWorkbookState(workbook);
|
|
4086
|
-
recordRangeEditHistory(mutations,
|
|
4087
|
-
}, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState,
|
|
4146
|
+
recordRangeEditHistory(mutations, selectionRanges, activeCell);
|
|
4147
|
+
}, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState, selectionRanges, workbook]);
|
|
4088
4148
|
const setSelectedCellValue = React.useCallback((value) => {
|
|
4089
4149
|
if (!activeCell) {
|
|
4090
4150
|
return;
|
|
@@ -4098,7 +4158,7 @@ function useXlsxViewerController(options2) {
|
|
|
4098
4158
|
setCellFormula(activeCell, formula);
|
|
4099
4159
|
}, [activeCell, setCellFormula]);
|
|
4100
4160
|
const setSelectedFormula = React.useCallback((formula) => {
|
|
4101
|
-
if (_optionalChain([selectedFormulaTarget, 'optionalAccess',
|
|
4161
|
+
if (_optionalChain([selectedFormulaTarget, 'optionalAccess', _388 => _388.kind]) === "chartSeries") {
|
|
4102
4162
|
return setChartSeriesFormula(selectedFormulaTarget.chartId, selectedFormulaTarget.seriesIndex, formula);
|
|
4103
4163
|
}
|
|
4104
4164
|
if (readOnly || !activeCell || getPivotTableAtCell(activeCell)) {
|
|
@@ -4118,25 +4178,27 @@ function useXlsxViewerController(options2) {
|
|
|
4118
4178
|
if (readOnly || !worksheet || !workbook) {
|
|
4119
4179
|
return;
|
|
4120
4180
|
}
|
|
4121
|
-
const
|
|
4181
|
+
const areas = "start" in range ? [normalizeRange(range)] : range.map(normalizeRange);
|
|
4122
4182
|
const beforeStates = [];
|
|
4123
|
-
for (
|
|
4124
|
-
for (let
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4183
|
+
for (const area of areas) {
|
|
4184
|
+
for (let row2 = area.start.row; row2 <= area.end.row; row2 += 1) {
|
|
4185
|
+
for (let col = area.start.col; col <= area.end.col; col += 1) {
|
|
4186
|
+
const cell = { row: row2, col };
|
|
4187
|
+
const before = captureCellMutationState(cell);
|
|
4188
|
+
if (!before) {
|
|
4189
|
+
continue;
|
|
4190
|
+
}
|
|
4191
|
+
beforeStates.push({
|
|
4192
|
+
before,
|
|
4193
|
+
cell
|
|
4194
|
+
});
|
|
4129
4195
|
}
|
|
4130
|
-
beforeStates.push({
|
|
4131
|
-
before,
|
|
4132
|
-
cell
|
|
4133
|
-
});
|
|
4134
4196
|
}
|
|
4135
4197
|
}
|
|
4136
4198
|
if (beforeStates.length === 0) {
|
|
4137
4199
|
return;
|
|
4138
4200
|
}
|
|
4139
|
-
worksheet.setRangeStyle(rangeToA1(
|
|
4201
|
+
for (const area of areas) worksheet.setRangeStyle(rangeToA1(area), style);
|
|
4140
4202
|
const mutations = [];
|
|
4141
4203
|
for (const mutation of beforeStates) {
|
|
4142
4204
|
const after = captureCellMutationState(mutation.cell);
|
|
@@ -4150,11 +4212,11 @@ function useXlsxViewerController(options2) {
|
|
|
4150
4212
|
});
|
|
4151
4213
|
}
|
|
4152
4214
|
refreshWorkbookState(workbook);
|
|
4153
|
-
recordRangeEditHistory(mutations,
|
|
4154
|
-
}, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState,
|
|
4215
|
+
recordRangeEditHistory(mutations, selectionRanges, activeCell);
|
|
4216
|
+
}, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState, selectionRanges, workbook]);
|
|
4155
4217
|
const fillSelection = React.useCallback((targetRange) => {
|
|
4156
4218
|
const worksheet = getActiveWorksheet();
|
|
4157
|
-
if (readOnly || !worksheet || !workbook || !selection) {
|
|
4219
|
+
if (readOnly || !worksheet || !workbook || !selection || selectionRanges.length > 1) {
|
|
4158
4220
|
return;
|
|
4159
4221
|
}
|
|
4160
4222
|
if (intersectsPivot(targetRange)) return;
|
|
@@ -4205,15 +4267,15 @@ function useXlsxViewerController(options2) {
|
|
|
4205
4267
|
setSelection(nextRange);
|
|
4206
4268
|
setActiveCell(nextRange.end);
|
|
4207
4269
|
selectionAnchorRef.current = nextRange.start;
|
|
4208
|
-
recordRangeEditHistory(mutations, nextRange, nextRange.end);
|
|
4209
|
-
}, [intersectsPivot, captureCellMutationState, getActiveWorksheet, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
|
|
4270
|
+
recordRangeEditHistory(mutations, [nextRange], nextRange.end);
|
|
4271
|
+
}, [intersectsPivot, captureCellMutationState, getActiveWorksheet, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, selectionRanges, workbook]);
|
|
4210
4272
|
const mergeSelection = React.useCallback((mode = "cells") => {
|
|
4211
4273
|
const worksheet = getActiveWorksheet();
|
|
4212
|
-
if (readOnly || !worksheet || !selection || !workbook) {
|
|
4274
|
+
if (readOnly || !worksheet || !selection || selectionRanges.length > 1 || !workbook) {
|
|
4213
4275
|
return;
|
|
4214
4276
|
}
|
|
4215
4277
|
if (intersectsPivot(selection)) return;
|
|
4216
|
-
const mergedRanges =
|
|
4278
|
+
const mergedRanges = _chunkXZJLPW64cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet).mergedRanges;
|
|
4217
4279
|
const range = expandHighlightedRange(normalizeRange(selection), mergedRanges);
|
|
4218
4280
|
const isSingleCell = range.start.row === range.end.row && range.start.col === range.end.col;
|
|
4219
4281
|
if (isSingleCell && mode !== "center" || mode === "across" && range.start.col === range.end.col) {
|
|
@@ -4242,28 +4304,28 @@ function useXlsxViewerController(options2) {
|
|
|
4242
4304
|
selectionAnchorRef.current = range.start;
|
|
4243
4305
|
setSelection(range);
|
|
4244
4306
|
setActiveCell(range.start);
|
|
4245
|
-
}, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, workbook]);
|
|
4307
|
+
}, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, selectionRanges, workbook]);
|
|
4246
4308
|
const unmergeSelection = React.useCallback(() => {
|
|
4247
4309
|
const worksheet = getActiveWorksheet();
|
|
4248
|
-
if (readOnly || !worksheet || !selection || !workbook) {
|
|
4310
|
+
if (readOnly || !worksheet || !selection || selectionRanges.length > 1 || !workbook) {
|
|
4249
4311
|
return;
|
|
4250
4312
|
}
|
|
4251
4313
|
const range = normalizeRange(selection);
|
|
4252
4314
|
if (intersectsPivot(selection)) return;
|
|
4253
|
-
const mergedRanges =
|
|
4315
|
+
const mergedRanges = _chunkXZJLPW64cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet).mergedRanges.filter((merged) => rangesIntersect(range, merged));
|
|
4254
4316
|
if (mergedRanges.length === 0) return;
|
|
4255
4317
|
recordHistoryBeforeMutation();
|
|
4256
4318
|
for (const merged of mergedRanges) {
|
|
4257
4319
|
worksheet.unmergeCells(rangeToA1(merged));
|
|
4258
4320
|
}
|
|
4259
4321
|
refreshWorkbookState(workbook);
|
|
4260
|
-
}, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, workbook]);
|
|
4322
|
+
}, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, selectionRanges, workbook]);
|
|
4261
4323
|
const addSheet = React.useCallback((name) => {
|
|
4262
4324
|
if (readOnly || !workbook) {
|
|
4263
4325
|
return;
|
|
4264
4326
|
}
|
|
4265
4327
|
recordHistoryBeforeMutation();
|
|
4266
|
-
const baseName = _optionalChain([name, 'optionalAccess',
|
|
4328
|
+
const baseName = _optionalChain([name, 'optionalAccess', _389 => _389.trim, 'call', _390 => _390()]) || "Sheet";
|
|
4267
4329
|
let candidate = baseName;
|
|
4268
4330
|
let counter = 2;
|
|
4269
4331
|
while (workbook.sheetIndex(candidate) !== void 0) {
|
|
@@ -4283,21 +4345,21 @@ function useXlsxViewerController(options2) {
|
|
|
4283
4345
|
}
|
|
4284
4346
|
const nextSheets = buildSheetList(
|
|
4285
4347
|
workbook,
|
|
4286
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4287
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4288
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4289
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4290
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4348
|
+
_optionalChain([imageAssetsRef, 'access', _391 => _391.current, 'optionalAccess', _392 => _392.sheetStatesByWorkbookSheetIndex]),
|
|
4349
|
+
_optionalChain([imageAssetsRef, 'access', _393 => _393.current, 'optionalAccess', _394 => _394.themePalette]),
|
|
4350
|
+
_optionalChain([imageAssetsRef, 'access', _395 => _395.current, 'optionalAccess', _396 => _396.styleById]),
|
|
4351
|
+
_optionalChain([imageAssetsRef, 'access', _397 => _397.current, 'optionalAccess', _398 => _398.namedCellStyleByName]),
|
|
4352
|
+
_optionalChain([imageAssetsRef, 'access', _399 => _399.current, 'optionalAccess', _400 => _400.tableStyleByName]),
|
|
4291
4353
|
showHiddenSheets
|
|
4292
4354
|
);
|
|
4293
4355
|
setSheets(nextSheets);
|
|
4294
|
-
const nextChartAssets = imageAssetsRef.current ?
|
|
4356
|
+
const nextChartAssets = imageAssetsRef.current ? _chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0, workbook, imageAssetsRef.current, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets) : null;
|
|
4295
4357
|
if (imageAssetsRef.current) {
|
|
4296
4358
|
setChartAssets(nextChartAssets);
|
|
4297
4359
|
}
|
|
4298
4360
|
const nextIndex = nextSheets.findIndex((sheet) => sheet.name === candidate);
|
|
4299
4361
|
setActiveSheetIndexState(nextIndex >= 0 ? nextIndex : 0);
|
|
4300
|
-
const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess',
|
|
4362
|
+
const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess', _401 => _401.tabs, 'access', _402 => _402.findIndex, 'call', _403 => _403((tab) => tab.kind === "sheet" && tab.name === candidate)]), () => ( -1));
|
|
4301
4363
|
if (nextTabIndex >= 0) {
|
|
4302
4364
|
setActiveTabIndexState(nextTabIndex);
|
|
4303
4365
|
}
|
|
@@ -4309,7 +4371,7 @@ function useXlsxViewerController(options2) {
|
|
|
4309
4371
|
}
|
|
4310
4372
|
recordHistoryBeforeMutation();
|
|
4311
4373
|
workbook.removeSheet(activeSheet.workbookSheetIndex);
|
|
4312
|
-
setPivotTables(
|
|
4374
|
+
setPivotTables(_chunkXZJLPW64cjs.readPivotTables.call(void 0, workbook));
|
|
4313
4375
|
sheetOriginsRef.current = sheetOriginsRef.current.filter((_, index) => index !== activeSheet.workbookSheetIndex);
|
|
4314
4376
|
setFormControlsByWorkbookSheetIndex((current) => current.filter((_, index) => index !== activeSheet.workbookSheetIndex));
|
|
4315
4377
|
setImagesByWorkbookSheetIndex((current) => current.filter((_, index) => index !== activeSheet.workbookSheetIndex));
|
|
@@ -4324,16 +4386,16 @@ function useXlsxViewerController(options2) {
|
|
|
4324
4386
|
}
|
|
4325
4387
|
const nextSheets = buildSheetList(
|
|
4326
4388
|
workbook,
|
|
4327
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4328
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4329
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4330
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4331
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
4389
|
+
_optionalChain([imageAssetsRef, 'access', _404 => _404.current, 'optionalAccess', _405 => _405.sheetStatesByWorkbookSheetIndex]),
|
|
4390
|
+
_optionalChain([imageAssetsRef, 'access', _406 => _406.current, 'optionalAccess', _407 => _407.themePalette]),
|
|
4391
|
+
_optionalChain([imageAssetsRef, 'access', _408 => _408.current, 'optionalAccess', _409 => _409.styleById]),
|
|
4392
|
+
_optionalChain([imageAssetsRef, 'access', _410 => _410.current, 'optionalAccess', _411 => _411.namedCellStyleByName]),
|
|
4393
|
+
_optionalChain([imageAssetsRef, 'access', _412 => _412.current, 'optionalAccess', _413 => _413.tableStyleByName]),
|
|
4332
4394
|
showHiddenSheets
|
|
4333
4395
|
);
|
|
4334
4396
|
setSheets(nextSheets);
|
|
4335
4397
|
if (imageAssetsRef.current) {
|
|
4336
|
-
setChartAssets(
|
|
4398
|
+
setChartAssets(_chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0, workbook, imageAssetsRef.current, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets));
|
|
4337
4399
|
}
|
|
4338
4400
|
setActiveSheetIndexState((current) => Math.max(0, Math.min(current, nextSheets.length - 1)));
|
|
4339
4401
|
setRevision((current) => current + 1);
|
|
@@ -4346,18 +4408,18 @@ function useXlsxViewerController(options2) {
|
|
|
4346
4408
|
if (!trimmed) {
|
|
4347
4409
|
return;
|
|
4348
4410
|
}
|
|
4349
|
-
const targetRange = _nullishCoalesce(range, () => ( selection));
|
|
4411
|
+
const targetRange = _nullishCoalesce(range, () => ( (selectionRanges.length === 1 ? selection : null)));
|
|
4350
4412
|
if (!targetRange) {
|
|
4351
4413
|
return;
|
|
4352
4414
|
}
|
|
4353
4415
|
recordHistoryBeforeMutation();
|
|
4354
4416
|
workbook.defineName(trimmed, rangeToA1(targetRange));
|
|
4355
4417
|
setRevision((current) => current + 1);
|
|
4356
|
-
}, [readOnly, recordHistoryBeforeMutation, selection, workbook]);
|
|
4418
|
+
}, [readOnly, recordHistoryBeforeMutation, selection, selectionRanges, workbook]);
|
|
4357
4419
|
const pasteText = React.useCallback((text) => {
|
|
4358
4420
|
const worksheet = getActiveWorksheet();
|
|
4359
|
-
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess',
|
|
4360
|
-
if (readOnly || !worksheet || !workbook || !targetCell || !text) {
|
|
4421
|
+
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _414 => _414.start]))), () => ( null));
|
|
4422
|
+
if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !text) {
|
|
4361
4423
|
return false;
|
|
4362
4424
|
}
|
|
4363
4425
|
const grid = parseClipboardText(text);
|
|
@@ -4420,13 +4482,13 @@ function useXlsxViewerController(options2) {
|
|
|
4420
4482
|
setActiveCell(targetCell);
|
|
4421
4483
|
setSelection(nextRange);
|
|
4422
4484
|
selectionAnchorRef.current = targetCell;
|
|
4423
|
-
recordRangeEditHistory(mutations, nextRange, targetCell);
|
|
4485
|
+
recordRangeEditHistory(mutations, [nextRange], targetCell);
|
|
4424
4486
|
return true;
|
|
4425
|
-
}, [intersectsPivot, activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
|
|
4487
|
+
}, [intersectsPivot, activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, selectionRanges, workbook]);
|
|
4426
4488
|
const pasteStructuredClipboardData = React.useCallback((serializedPayload) => {
|
|
4427
4489
|
const worksheet = getActiveWorksheet();
|
|
4428
|
-
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess',
|
|
4429
|
-
if (readOnly || !worksheet || !workbook || !targetCell || !serializedPayload) {
|
|
4490
|
+
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _415 => _415.start]))), () => ( null));
|
|
4491
|
+
if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !serializedPayload) {
|
|
4430
4492
|
return false;
|
|
4431
4493
|
}
|
|
4432
4494
|
let payload;
|
|
@@ -4515,7 +4577,7 @@ function useXlsxViewerController(options2) {
|
|
|
4515
4577
|
setSelection(nextRange);
|
|
4516
4578
|
selectionAnchorRef.current = targetCell;
|
|
4517
4579
|
if (!hasMergeOperations) {
|
|
4518
|
-
recordRangeEditHistory(mutations, nextRange, targetCell);
|
|
4580
|
+
recordRangeEditHistory(mutations, [nextRange], targetCell);
|
|
4519
4581
|
}
|
|
4520
4582
|
return true;
|
|
4521
4583
|
}, [
|
|
@@ -4529,33 +4591,37 @@ function useXlsxViewerController(options2) {
|
|
|
4529
4591
|
recordRangeEditHistory,
|
|
4530
4592
|
refreshWorkbookState,
|
|
4531
4593
|
selection,
|
|
4594
|
+
selectionRanges,
|
|
4532
4595
|
workbook
|
|
4533
4596
|
]);
|
|
4534
4597
|
const copySelectionToClipboard = React.useCallback(async () => {
|
|
4535
4598
|
if (typeof navigator === "undefined" || !navigator.clipboard) {
|
|
4536
4599
|
return false;
|
|
4537
4600
|
}
|
|
4538
|
-
if (isWorkerBacked && activeSheet
|
|
4539
|
-
const
|
|
4601
|
+
if (isWorkerBacked && activeSheet) {
|
|
4602
|
+
const bands = clipboardBands(selectionRanges);
|
|
4603
|
+
if (!bands) return false;
|
|
4540
4604
|
const textPromise = (async () => {
|
|
4541
4605
|
const lines = [];
|
|
4542
|
-
for (
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
for (const
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4606
|
+
for (const band of bands.rows) {
|
|
4607
|
+
for (let startRow = band.start; startRow <= band.end; startRow += 128) {
|
|
4608
|
+
const count = Math.min(128, band.end - startRow + 1);
|
|
4609
|
+
const batch = await getRowsBatchAsync(activeSheet.workbookSheetIndex, startRow, count);
|
|
4610
|
+
if (!batch) throw new Error("Unable to read the selected cells.");
|
|
4611
|
+
const values = /* @__PURE__ */ new Map();
|
|
4612
|
+
for (const entry of batch) {
|
|
4613
|
+
for (const cell of _nullishCoalesce(entry.cells, () => ( []))) {
|
|
4614
|
+
if (cell.isMergedSecondary) continue;
|
|
4615
|
+
const value = String(_nullishCoalesce(cell.value, () => ( "")));
|
|
4616
|
+
const cached = cell.formula ? activeSheet.cachedFormulaValues[cellAddressToA1({ row: entry.index, col: cell.col })] : void 0;
|
|
4617
|
+
values.set(`${entry.index}:${cell.col}`, decodeHtmlEntities(cached !== void 0 && value.startsWith("#") ? cached : value));
|
|
4618
|
+
}
|
|
4619
|
+
}
|
|
4620
|
+
for (let row2 = startRow; row2 < startRow + count; row2++) {
|
|
4621
|
+
const cells = [];
|
|
4622
|
+
for (const { index: col } of bandIndices(bands.cols)) cells.push(_nullishCoalesce(values.get(`${row2}:${col}`), () => ( "")));
|
|
4623
|
+
lines.push(cells.join(" "));
|
|
4553
4624
|
}
|
|
4554
|
-
}
|
|
4555
|
-
for (let row2 = startRow; row2 < startRow + count; row2++) {
|
|
4556
|
-
const cells = [];
|
|
4557
|
-
for (let col = range.start.col; col <= range.end.col; col++) cells.push(_nullishCoalesce(values.get(`${row2}:${col}`), () => ( "")));
|
|
4558
|
-
lines.push(cells.join(" "));
|
|
4559
4625
|
}
|
|
4560
4626
|
}
|
|
4561
4627
|
return lines.join("\n");
|
|
@@ -4593,14 +4659,14 @@ function useXlsxViewerController(options2) {
|
|
|
4593
4659
|
}
|
|
4594
4660
|
await navigator.clipboard.writeText(clipboardData.text);
|
|
4595
4661
|
return true;
|
|
4596
|
-
}, [activeSheet, getClipboardData, getRowsBatchAsync, isWorkerBacked,
|
|
4662
|
+
}, [activeSheet, getClipboardData, getRowsBatchAsync, isWorkerBacked, selectionRanges]);
|
|
4597
4663
|
const pasteFromClipboard = React.useCallback(async (clipboardData) => {
|
|
4598
4664
|
if (readOnly) return false;
|
|
4599
4665
|
const state = drawingMutationState.current;
|
|
4600
4666
|
const generation = loadGenerationRef.current;
|
|
4601
4667
|
const data = await readBrowserClipboard(clipboardData);
|
|
4602
4668
|
const latest = drawingMutationState.current;
|
|
4603
|
-
if (generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access',
|
|
4669
|
+
if (generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _416 => _416.activeCell, 'optionalAccess', _417 => _417.row]) !== _optionalChain([state, 'access', _418 => _418.activeCell, 'optionalAccess', _419 => _419.row]) || _optionalChain([latest, 'access', _420 => _420.activeCell, 'optionalAccess', _421 => _421.col]) !== _optionalChain([state, 'access', _422 => _422.activeCell, 'optionalAccess', _423 => _423.col])) return false;
|
|
4604
4670
|
if (data.drawing) return pasteDrawing(data.drawing);
|
|
4605
4671
|
if (data.structured && pasteStructuredClipboardData(data.structured)) return true;
|
|
4606
4672
|
return Boolean(data.text) && pasteText(data.text);
|
|
@@ -4758,6 +4824,14 @@ function useXlsxViewerController(options2) {
|
|
|
4758
4824
|
revision,
|
|
4759
4825
|
resizeChartBy,
|
|
4760
4826
|
resizeImageBy,
|
|
4827
|
+
frozenPanes: _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _424 => _424.freezePanes]), () => ( null)),
|
|
4828
|
+
canFreezePanes,
|
|
4829
|
+
hideRows,
|
|
4830
|
+
unhideRows,
|
|
4831
|
+
hideColumns,
|
|
4832
|
+
unhideColumns,
|
|
4833
|
+
freezePanes,
|
|
4834
|
+
unfreezePanes,
|
|
4761
4835
|
resizeColumn,
|
|
4762
4836
|
resizeRow,
|
|
4763
4837
|
setCellFormula,
|
|
@@ -4786,6 +4860,8 @@ function useXlsxViewerController(options2) {
|
|
|
4786
4860
|
selectChartElement,
|
|
4787
4861
|
selectImage,
|
|
4788
4862
|
selectRange,
|
|
4863
|
+
selectRanges,
|
|
4864
|
+
selectionRanges,
|
|
4789
4865
|
selection,
|
|
4790
4866
|
setActiveSheetIndex,
|
|
4791
4867
|
setActiveTabIndex,
|
|
@@ -4901,6 +4977,13 @@ function useXlsxViewerController(options2) {
|
|
|
4901
4977
|
revision,
|
|
4902
4978
|
resizeChartBy,
|
|
4903
4979
|
resizeImageBy,
|
|
4980
|
+
canFreezePanes,
|
|
4981
|
+
hideRows,
|
|
4982
|
+
unhideRows,
|
|
4983
|
+
hideColumns,
|
|
4984
|
+
unhideColumns,
|
|
4985
|
+
freezePanes,
|
|
4986
|
+
unfreezePanes,
|
|
4904
4987
|
resizeColumn,
|
|
4905
4988
|
resizeRow,
|
|
4906
4989
|
setCellFormula,
|
|
@@ -4929,6 +5012,8 @@ function useXlsxViewerController(options2) {
|
|
|
4929
5012
|
selectChartElement,
|
|
4930
5013
|
selectImage,
|
|
4931
5014
|
selectRange,
|
|
5015
|
+
selectRanges,
|
|
5016
|
+
selectionRanges,
|
|
4932
5017
|
selection,
|
|
4933
5018
|
setActiveSheetIndex,
|
|
4934
5019
|
setActiveTabIndex,
|
|
@@ -4989,7 +5074,7 @@ function CellEditor({
|
|
|
4989
5074
|
onNavigate
|
|
4990
5075
|
}) {
|
|
4991
5076
|
const rootRef = React2.useRef(null);
|
|
4992
|
-
const messages =
|
|
5077
|
+
const messages = _chunkYOLIVKZDcjs.useXlsxMessages.call(void 0, );
|
|
4993
5078
|
const mirrorRef = React2.useRef(null);
|
|
4994
5079
|
const textRef = React2.useRef(null);
|
|
4995
5080
|
const baselineRef = React2.useRef(null);
|
|
@@ -5001,8 +5086,8 @@ function CellEditor({
|
|
|
5001
5086
|
const [bounds, setBounds] = React2.useState({ width: 0, height: 0, cellWidth: 0 });
|
|
5002
5087
|
React2.useLayoutEffect(() => {
|
|
5003
5088
|
const root = rootRef.current;
|
|
5004
|
-
const anchor = _optionalChain([root, 'optionalAccess',
|
|
5005
|
-
const viewport = _optionalChain([root, 'optionalAccess',
|
|
5089
|
+
const anchor = _optionalChain([root, 'optionalAccess', _425 => _425.parentElement]);
|
|
5090
|
+
const viewport = _optionalChain([root, 'optionalAccess', _426 => _426.closest, 'call', _427 => _427('[role="grid"]')]);
|
|
5006
5091
|
if (!root || !anchor || !viewport) {
|
|
5007
5092
|
return;
|
|
5008
5093
|
}
|
|
@@ -5059,8 +5144,8 @@ function CellEditor({
|
|
|
5059
5144
|
const canvas = canvasRef.current;
|
|
5060
5145
|
if (canvas && paintCanvasText) {
|
|
5061
5146
|
const dpr = window.devicePixelRatio || 1;
|
|
5062
|
-
const offsetX = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess',
|
|
5063
|
-
const offsetY = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess',
|
|
5147
|
+
const offsetX = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _428 => _428.left]), () => ( 0))) * dpr % 1 / dpr;
|
|
5148
|
+
const offsetY = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _429 => _429.top]), () => ( 0))) * dpr % 1 / dpr;
|
|
5064
5149
|
const width = rootRect.width / scale;
|
|
5065
5150
|
const height = rootRect.height / scale;
|
|
5066
5151
|
canvas.width = Math.ceil((width + offsetX) * dpr);
|
|
@@ -5071,11 +5156,11 @@ function CellEditor({
|
|
|
5071
5156
|
canvas.style.top = `${-offsetY}px`;
|
|
5072
5157
|
const context = canvas.getContext("2d");
|
|
5073
5158
|
if (context) {
|
|
5074
|
-
const node = _optionalChain([plainTextRef, 'access',
|
|
5159
|
+
const node = _optionalChain([plainTextRef, 'access', _430 => _430.current, 'optionalAccess', _431 => _431.firstChild]);
|
|
5075
5160
|
const lines = [];
|
|
5076
5161
|
if (node) {
|
|
5077
5162
|
const range = document.createRange();
|
|
5078
|
-
const length = _nullishCoalesce(_optionalChain([node, 'access',
|
|
5163
|
+
const length = _nullishCoalesce(_optionalChain([node, 'access', _432 => _432.textContent, 'optionalAccess', _433 => _433.length]), () => ( 0));
|
|
5079
5164
|
let start = 0;
|
|
5080
5165
|
while (start < length) {
|
|
5081
5166
|
range.setStart(node, start);
|
|
@@ -5189,7 +5274,7 @@ function CellEditor({
|
|
|
5189
5274
|
onKeyDown: (event) => {
|
|
5190
5275
|
event.stopPropagation();
|
|
5191
5276
|
if (event.nativeEvent.isComposing) return;
|
|
5192
|
-
if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall',
|
|
5277
|
+
if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall', _434 => _434()])) {
|
|
5193
5278
|
event.preventDefault();
|
|
5194
5279
|
} else if (event.key === "Enter" && !event.altKey) {
|
|
5195
5280
|
event.preventDefault();
|
|
@@ -5262,6 +5347,11 @@ function getCellGeneralAlignment(worksheet, row2, col) {
|
|
|
5262
5347
|
}
|
|
5263
5348
|
}
|
|
5264
5349
|
|
|
5350
|
+
// src/header-size-dialog.tsx
|
|
5351
|
+
|
|
5352
|
+
|
|
5353
|
+
|
|
5354
|
+
|
|
5265
5355
|
// src/context-menu.tsx
|
|
5266
5356
|
|
|
5267
5357
|
|
|
@@ -5363,18 +5453,18 @@ function copyPivot(pivot) {
|
|
|
5363
5453
|
function usePivotTableEditor(viewer, options2 = {}) {
|
|
5364
5454
|
const open = viewer.pivotFieldListVisible;
|
|
5365
5455
|
const setOpen = viewer.setPivotFieldListVisible;
|
|
5366
|
-
const [draft, setDraft] =
|
|
5367
|
-
const [dirty, setDirty] =
|
|
5368
|
-
const [error, setError] =
|
|
5369
|
-
const [status, setStatus] =
|
|
5370
|
-
const [details, setDetails] =
|
|
5371
|
-
const [detailContext, setDetailContext] =
|
|
5372
|
-
const [loadedSource, setLoadedSource] =
|
|
5373
|
-
const [savedDefinition, setSavedDefinition] =
|
|
5374
|
-
const [pendingFocus, setPendingFocus] =
|
|
5456
|
+
const [draft, setDraft] = React11.useState(null);
|
|
5457
|
+
const [dirty, setDirty] = React11.useState(false);
|
|
5458
|
+
const [error, setError] = React11.useState(null);
|
|
5459
|
+
const [status, setStatus] = React11.useState(null);
|
|
5460
|
+
const [details, setDetails] = React11.useState(null);
|
|
5461
|
+
const [detailContext, setDetailContext] = React11.useState(null);
|
|
5462
|
+
const [loadedSource, setLoadedSource] = React11.useState("");
|
|
5463
|
+
const [savedDefinition, setSavedDefinition] = React11.useState("");
|
|
5464
|
+
const [pendingFocus, setPendingFocus] = React11.useState(null);
|
|
5375
5465
|
const sourceNeedsLoad = Boolean(draft && JSON.stringify(draft.source) !== loadedSource);
|
|
5376
|
-
const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess',
|
|
5377
|
-
const run =
|
|
5466
|
+
const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess', _435 => _435.id]) && savedDefinition !== JSON.stringify(_nullishCoalesce(viewer.pivotTables.find((pivot) => pivot.id === draft.id), () => ( null))));
|
|
5467
|
+
const run = React11.useCallback((action) => {
|
|
5378
5468
|
setError(null);
|
|
5379
5469
|
setStatus(null);
|
|
5380
5470
|
try {
|
|
@@ -5384,7 +5474,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5384
5474
|
setOpen(true);
|
|
5385
5475
|
}
|
|
5386
5476
|
}, []);
|
|
5387
|
-
|
|
5477
|
+
React11.useEffect(() => {
|
|
5388
5478
|
if (options2.enabled === false) return;
|
|
5389
5479
|
setDraft(null);
|
|
5390
5480
|
setDirty(false);
|
|
@@ -5397,8 +5487,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5397
5487
|
setPendingFocus(null);
|
|
5398
5488
|
if (options2.initialOpen !== void 0) setOpen(options2.initialOpen);
|
|
5399
5489
|
}, [viewer.src, viewer.file]);
|
|
5400
|
-
|
|
5401
|
-
if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess',
|
|
5490
|
+
React11.useEffect(() => {
|
|
5491
|
+
if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess', _436 => _436.id])) return;
|
|
5402
5492
|
const current = viewer.pivotTables.find((pivot) => pivot.id === draft.id);
|
|
5403
5493
|
setDraft(current ? copyPivot(current) : null);
|
|
5404
5494
|
if (current) {
|
|
@@ -5406,26 +5496,26 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5406
5496
|
setSavedDefinition(JSON.stringify(current));
|
|
5407
5497
|
}
|
|
5408
5498
|
}, [viewer.pivotTables]);
|
|
5409
|
-
|
|
5499
|
+
React11.useEffect(() => {
|
|
5410
5500
|
if (options2.enabled === false || options2.autoSelect === false || dirty || pendingFocus || !viewer.activeCell || !viewer.activeSheet) return;
|
|
5411
5501
|
const current = viewer.getPivotTableAtCell(viewer.activeCell, viewer.activeSheet.name);
|
|
5412
|
-
if (!current || current.id === _optionalChain([draft, 'optionalAccess',
|
|
5502
|
+
if (!current || current.id === _optionalChain([draft, 'optionalAccess', _437 => _437.id])) return;
|
|
5413
5503
|
setDraft(copyPivot(current));
|
|
5414
5504
|
setLoadedSource(JSON.stringify(current.source));
|
|
5415
5505
|
setSavedDefinition(JSON.stringify(current));
|
|
5416
5506
|
setError(null);
|
|
5417
5507
|
setStatus(null);
|
|
5418
5508
|
setDetails(null);
|
|
5419
|
-
}, [_optionalChain([viewer, 'access',
|
|
5420
|
-
|
|
5421
|
-
if (!pendingFocus || _optionalChain([viewer, 'access',
|
|
5509
|
+
}, [_optionalChain([viewer, 'access', _438 => _438.activeCell, 'optionalAccess', _439 => _439.row]), _optionalChain([viewer, 'access', _440 => _440.activeCell, 'optionalAccess', _441 => _441.col]), _optionalChain([viewer, 'access', _442 => _442.activeSheet, 'optionalAccess', _443 => _443.name]), viewer.pivotTables, options2.autoSelect, options2.enabled]);
|
|
5510
|
+
React11.useEffect(() => {
|
|
5511
|
+
if (!pendingFocus || _optionalChain([viewer, 'access', _444 => _444.activeSheet, 'optionalAccess', _445 => _445.name, 'access', _446 => _446.toLowerCase, 'call', _447 => _447()]) !== pendingFocus.sheet.toLowerCase()) return;
|
|
5422
5512
|
viewer.selectCell({ row: pendingFocus.row, col: pendingFocus.col });
|
|
5423
5513
|
setPendingFocus(null);
|
|
5424
|
-
}, [pendingFocus, _optionalChain([viewer, 'access',
|
|
5514
|
+
}, [pendingFocus, _optionalChain([viewer, 'access', _448 => _448.activeSheet, 'optionalAccess', _449 => _449.name]), viewer.selectCell]);
|
|
5425
5515
|
const focus = (pivot) => {
|
|
5426
5516
|
const sheetIndex = viewer.sheets.findIndex((sheet) => sheet.name.toLowerCase() === pivot.target.sheet.toLowerCase());
|
|
5427
5517
|
if (sheetIndex >= 0) viewer.setActiveSheetIndex(sheetIndex);
|
|
5428
|
-
const parsed =
|
|
5518
|
+
const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, pivot.outputRange || pivot.target.cell);
|
|
5429
5519
|
if (parsed) setPendingFocus({ sheet: pivot.target.sheet, ...parsed.range.start });
|
|
5430
5520
|
};
|
|
5431
5521
|
const select = (id) => run(() => {
|
|
@@ -5441,7 +5531,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5441
5531
|
focus(pivot);
|
|
5442
5532
|
});
|
|
5443
5533
|
const edit = (change) => {
|
|
5444
|
-
if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess',
|
|
5534
|
+
if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess', _450 => _450.unsupportedFeatures, 'access', _451 => _451.length])) return;
|
|
5445
5535
|
setDraft((current) => current ? change(current) : current);
|
|
5446
5536
|
setDirty(true);
|
|
5447
5537
|
setStatus(null);
|
|
@@ -5492,7 +5582,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5492
5582
|
if (!draft) return;
|
|
5493
5583
|
const fields = viewer.getPivotSourceFields(draft.source);
|
|
5494
5584
|
setLoadedSource(JSON.stringify(draft.source));
|
|
5495
|
-
const sameSchema = fields.length === draft.fields.length && fields.every((field, index) => field.name === _optionalChain([draft, 'access',
|
|
5585
|
+
const sameSchema = fields.length === draft.fields.length && fields.every((field, index) => field.name === _optionalChain([draft, 'access', _452 => _452.fields, 'access', _453 => _453[index], 'optionalAccess', _454 => _454.name]));
|
|
5496
5586
|
edit((pivot) => ({ ...pivot, fields, ...sameSchema ? {} : { rows: [], columns: [], values: [], filters: [], reportFilters: [], calculatedItems: [] } }));
|
|
5497
5587
|
setStatus(sameSchema ? "Source fields updated." : "Fields loaded. Choose the fields to summarize.");
|
|
5498
5588
|
});
|
|
@@ -5514,7 +5604,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5514
5604
|
if (all) {
|
|
5515
5605
|
const refreshed = viewer.refreshAllPivotTables();
|
|
5516
5606
|
setStatus(`${refreshed.length} PivotTable${refreshed.length === 1 ? "" : "s"} refreshed.`);
|
|
5517
|
-
} else if (_optionalChain([draft, 'optionalAccess',
|
|
5607
|
+
} else if (_optionalChain([draft, 'optionalAccess', _455 => _455.id])) {
|
|
5518
5608
|
const refreshed = viewer.refreshPivotTable(draft.id);
|
|
5519
5609
|
setDraft(copyPivot(refreshed));
|
|
5520
5610
|
setLoadedSource(JSON.stringify(refreshed.source));
|
|
@@ -5526,7 +5616,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5526
5616
|
});
|
|
5527
5617
|
const remove = () => run(() => {
|
|
5528
5618
|
if (dirty) throw new Error("Apply or discard your changes before removing the report.");
|
|
5529
|
-
if (!_optionalChain([draft, 'optionalAccess',
|
|
5619
|
+
if (!_optionalChain([draft, 'optionalAccess', _456 => _456.id])) return;
|
|
5530
5620
|
if (viewer.removePivotTable(draft.id)) {
|
|
5531
5621
|
setDraft(null);
|
|
5532
5622
|
setDirty(false);
|
|
@@ -5535,7 +5625,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5535
5625
|
}
|
|
5536
5626
|
});
|
|
5537
5627
|
const reset = () => run(() => {
|
|
5538
|
-
const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess',
|
|
5628
|
+
const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess', _457 => _457.id]));
|
|
5539
5629
|
setDraft(saved ? copyPivot(saved) : null);
|
|
5540
5630
|
setLoadedSource(saved ? JSON.stringify(saved.source) : "");
|
|
5541
5631
|
setSavedDefinition(saved ? JSON.stringify(saved) : "");
|
|
@@ -5543,8 +5633,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5543
5633
|
setDetails(null);
|
|
5544
5634
|
});
|
|
5545
5635
|
const showDetails = () => run(() => {
|
|
5546
|
-
if (!_optionalChain([draft, 'optionalAccess',
|
|
5547
|
-
if (_optionalChain([viewer, 'access',
|
|
5636
|
+
if (!_optionalChain([draft, 'optionalAccess', _458 => _458.id]) || !viewer.activeCell) return;
|
|
5637
|
+
if (_optionalChain([viewer, 'access', _459 => _459.activeSheet, 'optionalAccess', _460 => _460.name, 'access', _461 => _461.toLowerCase, 'call', _462 => _462()]) !== draft.target.sheet.toLowerCase()) throw new Error("Select a value cell inside this PivotTable first.");
|
|
5548
5638
|
setDetails(viewer.pivotDrillDown(draft.id, viewer.activeCell.row, viewer.activeCell.col));
|
|
5549
5639
|
setDetailContext({ id: draft.id, row: viewer.activeCell.row, col: viewer.activeCell.col });
|
|
5550
5640
|
setOpen(true);
|
|
@@ -5584,7 +5674,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5584
5674
|
});
|
|
5585
5675
|
const removeField = (area, index) => edit((pivot) => area === "values" ? replaceValues(pivot, pivot.values.filter((_, position) => position !== index)) : { ...pivot, [area]: pivot[area].filter((_, position) => position !== index) });
|
|
5586
5676
|
const moveField = (fromArea, fromIndex, toArea, toIndex) => {
|
|
5587
|
-
if (fromArea === "values" && toArea !== "values" && _optionalChain([draft, 'optionalAccess',
|
|
5677
|
+
if (fromArea === "values" && toArea !== "values" && _optionalChain([draft, 'optionalAccess', _463 => _463.values, 'access', _464 => _464[fromIndex], 'optionalAccess', _465 => _465.formula, 'optionalAccess', _466 => _466.trim, 'call', _467 => _467()])) {
|
|
5588
5678
|
run(() => {
|
|
5589
5679
|
throw new Error("Calculated fields can only be placed in Values.");
|
|
5590
5680
|
});
|
|
@@ -5592,7 +5682,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5592
5682
|
}
|
|
5593
5683
|
edit((pivot) => {
|
|
5594
5684
|
const entry = pivot[fromArea][fromIndex];
|
|
5595
|
-
if (entry === void 0 || fromArea === "values" && toArea !== "values" && typeof entry === "object" && "formula" in entry && _optionalChain([entry, 'access',
|
|
5685
|
+
if (entry === void 0 || fromArea === "values" && toArea !== "values" && typeof entry === "object" && "formula" in entry && _optionalChain([entry, 'access', _468 => _468.formula, 'optionalAccess', _469 => _469.trim, 'call', _470 => _470()])) return pivot;
|
|
5596
5686
|
if (fromArea === toArea) {
|
|
5597
5687
|
const entries2 = [...pivot[fromArea]];
|
|
5598
5688
|
entries2.splice(fromIndex, 1);
|
|
@@ -5615,7 +5705,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
|
|
|
5615
5705
|
return { ...next, [toArea]: entries };
|
|
5616
5706
|
});
|
|
5617
5707
|
};
|
|
5618
|
-
return { viewer, readOnly: viewer.readOnly || Boolean(_optionalChain([draft, 'optionalAccess',
|
|
5708
|
+
return { viewer, readOnly: viewer.readOnly || Boolean(_optionalChain([draft, 'optionalAccess', _471 => _471.unsupportedFeatures, 'access', _472 => _472.length])), open, setOpen, draft, dirty, edit, select, create, apply, reset, remove, refresh, readFields, addField, removeField, moveField, details, detailContext, showDetails, clearDetails: () => {
|
|
5619
5709
|
setDetails(null);
|
|
5620
5710
|
setDetailContext(null);
|
|
5621
5711
|
}, sourceNeedsLoad, stale, error, status, run };
|
|
@@ -5638,16 +5728,16 @@ var row = { display: "flex", alignItems: "center", gap: 6, minWidth: 0 };
|
|
|
5638
5728
|
var hint = { color: "var(--xlsx-pivot-muted)", fontSize: 11, lineHeight: 1.5, margin: 0 };
|
|
5639
5729
|
var control = { boxSizing: "border-box", width: "100%", minWidth: 0, minHeight: 30, border: "1px solid var(--xlsx-pivot-border)", borderRadius: 3, background: "var(--xlsx-pivot-input)", color: "inherit", padding: "4px 7px", font: "inherit" };
|
|
5640
5730
|
function fieldName(pivot, index) {
|
|
5641
|
-
return _nullishCoalesce(_optionalChain([pivot, 'access',
|
|
5731
|
+
return _nullishCoalesce(_optionalChain([pivot, 'access', _473 => _473.fields, 'access', _474 => _474.find, 'call', _475 => _475((field) => field.index === index), 'optionalAccess', _476 => _476.name]), () => ( `Field ${index + 1}`));
|
|
5642
5732
|
}
|
|
5643
5733
|
function fieldIndex(pivot, area, index) {
|
|
5644
|
-
return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access',
|
|
5734
|
+
return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access', _477 => _477[area], 'access', _478 => _478[index], 'optionalAccess', _479 => _479.field]);
|
|
5645
5735
|
}
|
|
5646
5736
|
function sourceFieldIndex(pivot, area, index) {
|
|
5647
|
-
return area === "values" && _optionalChain([pivot, 'access',
|
|
5737
|
+
return area === "values" && _optionalChain([pivot, 'access', _480 => _480.values, 'access', _481 => _481[index], 'optionalAccess', _482 => _482.formula, 'optionalAccess', _483 => _483.trim, 'call', _484 => _484()]) ? void 0 : fieldIndex(pivot, area, index);
|
|
5648
5738
|
}
|
|
5649
5739
|
function groupingUnit(axis) {
|
|
5650
|
-
return _optionalChain([axis, 'optionalAccess',
|
|
5740
|
+
return _optionalChain([axis, 'optionalAccess', _485 => _485.grouping]) ? axis.grouping.kind === "date" ? axis.grouping.unit : axis.grouping.kind : null;
|
|
5651
5741
|
}
|
|
5652
5742
|
function Action({ children: children2, primary, style, ...props }) {
|
|
5653
5743
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...props, style: { ...control, width: "auto", cursor: props.disabled ? "default" : "pointer", opacity: props.disabled ? 0.55 : 1, ...primary ? { background: "var(--xlsx-pivot-accent)", borderColor: "var(--xlsx-pivot-accent)", color: "#fff" } : {}, ...style }, children: children2 });
|
|
@@ -5680,7 +5770,7 @@ function Section({ title, children: children2 }) {
|
|
|
5680
5770
|
] });
|
|
5681
5771
|
}
|
|
5682
5772
|
function Members({ items, selected, onChange, label = "Items" }) {
|
|
5683
|
-
const [search, setSearch] =
|
|
5773
|
+
const [search, setSearch] = React12.useState("");
|
|
5684
5774
|
const visible = items.filter((item) => item.caption.toLocaleLowerCase().includes(search.toLocaleLowerCase()));
|
|
5685
5775
|
const keys = new Set(selected);
|
|
5686
5776
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, gap: 6 }, children: [
|
|
@@ -5714,10 +5804,10 @@ function ValueSettings({ pivot, value, onChange }) {
|
|
|
5714
5804
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5715
5805
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: value.name, onChange: (name) => onChange({ ...value, name }) }),
|
|
5716
5806
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Summarize values by", value: value.aggregation, options: AGGREGATIONS, onChange: (aggregation) => onChange({ ...value, aggregation }) }),
|
|
5717
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Show values as", value: value.showAs, options: SHOW_AS, onChange: (showAs) => onChange({ ...value, showAs, baseField: _nullishCoalesce(value.baseField, () => ( _optionalChain([axes, 'access',
|
|
5807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Show values as", value: value.showAs, options: SHOW_AS, onChange: (showAs) => onChange({ ...value, showAs, baseField: _nullishCoalesce(value.baseField, () => ( _optionalChain([axes, 'access', _486 => _486[0], 'optionalAccess', _487 => _487.field]))) }) }),
|
|
5718
5808
|
needsBase ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base field", value: value.baseField == null ? "" : String(value.baseField), placeholder: "Choose a field", options: pivot.fields.filter((field) => axes.some((axis) => axis.field === field.index)).map((field) => [String(field.index), field.name]), onChange: (field) => onChange({ ...value, baseField: Number(field), baseGroupingUnit: null, baseItem: null }) }) : null,
|
|
5719
5809
|
needsBase && baseAxes.length > 1 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base grouping level", value: _nullishCoalesce(_nullishCoalesce(value.baseGroupingUnit, () => ( groupingUnit(base))), () => ( "")), options: baseAxes.map((axis) => [_nullishCoalesce(groupingUnit(axis), () => ( "")), axis.name || groupingUnit(axis) || "Source items"]), onChange: (unit) => onChange({ ...value, baseGroupingUnit: unit || null, baseItem: null }) }) : null,
|
|
5720
|
-
needsItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base item", value: _nullishCoalesce(value.baseItem, () => ( "previous")), options: [["previous", "(previous)"], ["next", "(next)"], ...(_optionalChain([base, 'optionalAccess',
|
|
5810
|
+
needsItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base item", value: _nullishCoalesce(value.baseItem, () => ( "previous")), options: [["previous", "(previous)"], ["next", "(next)"], ...(_optionalChain([base, 'optionalAccess', _488 => _488.items, 'optionalAccess', _489 => _489.length]) ? base.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _490 => _490.items]), () => ( []))).map((item) => [item.key, item.caption])], onChange: (baseItem) => onChange({ ...value, baseItem }) }) : null,
|
|
5721
5811
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Number format", value: _nullishCoalesce(value.numberFormat, () => ( "")), placeholder: "General", onChange: (numberFormat) => onChange({ ...value, numberFormat: numberFormat || null }) }),
|
|
5722
5812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Calculated field formula", value: _nullishCoalesce(value.formula, () => ( "")), placeholder: "Leave blank for a source field", onChange: (formula) => onChange({ ...value, formula: formula || null }) }),
|
|
5723
5813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Use field names in formulas. Enclose names containing spaces in single quotes or square brackets." }),
|
|
@@ -5728,20 +5818,20 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
|
5728
5818
|
const source = pivot.fields.find((field) => field.index === axis.field);
|
|
5729
5819
|
const grouping = axis.grouping;
|
|
5730
5820
|
const updateGrouping = (patch) => onChange({ ...axis, grouping: { ...grouping, ...patch }, items: [], collapsed: [] });
|
|
5731
|
-
const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && _optionalChain([field, 'access',
|
|
5821
|
+
const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && _optionalChain([field, 'access', _491 => _491.grouping, 'optionalAccess', _492 => _492.kind]) === "date" && field.grouping.unit === unit));
|
|
5732
5822
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5733
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: _nullishCoalesce(axis.name, () => ( "")), placeholder: _optionalChain([source, 'optionalAccess',
|
|
5823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: _nullishCoalesce(axis.name, () => ( "")), placeholder: _optionalChain([source, 'optionalAccess', _493 => _493.name]), onChange: (name) => onChange({ ...axis, name: name || null }) }),
|
|
5734
5824
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Sort", value: axis.sort, options: [["ascending", "Ascending (A to Z)"], ["descending", "Descending (Z to A)"], ["manual", "Source order"], ["valueAscending", "Smallest to largest by value"], ["valueDescending", "Largest to smallest by value"]], onChange: (sort) => onChange({ ...axis, sort, sortMeasure: _nullishCoalesce(axis.sortMeasure, () => ( 0)) }) }),
|
|
5735
5825
|
axis.sort.startsWith("value") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Sort by value", value: String(_nullishCoalesce(axis.sortMeasure, () => ( 0))), options: pivot.values.map((value, index) => [String(index), value.name]), onChange: (sortMeasure) => onChange({ ...axis, sortMeasure: Number(sortMeasure) }) }) : null,
|
|
5736
5826
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show subtotals", checked: axis.subtotals, onChange: (subtotals) => onChange({ ...axis, subtotals }) }),
|
|
5737
5827
|
axis.subtotals ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
|
|
5738
5828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Custom subtotal functions" }),
|
|
5739
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 3, marginTop: 6 }, children: AGGREGATIONS.map(([value, label]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label, checked: _nullishCoalesce(_optionalChain([axis, 'access',
|
|
5829
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 3, marginTop: 6 }, children: AGGREGATIONS.map(([value, label]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label, checked: _nullishCoalesce(_optionalChain([axis, 'access', _494 => _494.subtotalFunctions, 'optionalAccess', _495 => _495.includes, 'call', _496 => _496(value)]), () => ( false)), onChange: (checked) => onChange({ ...axis, subtotalFunctions: checked ? [..._nullishCoalesce(axis.subtotalFunctions, () => ( [])), value] : _optionalChain([axis, 'access', _497 => _497.subtotalFunctions, 'optionalAccess', _498 => _498.filter, 'call', _499 => _499((item) => item !== value)]) }) }, value)) }),
|
|
5740
5830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Leave unchecked to use the value field\u2019s summary function." })
|
|
5741
5831
|
] }) : null,
|
|
5742
5832
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show items with no data", checked: _nullishCoalesce(axis.showItemsWithNoData, () => ( false)), onChange: (showItemsWithNoData) => onChange({ ...axis, showItemsWithNoData }) }),
|
|
5743
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Grouping", value: _nullishCoalesce(_optionalChain([grouping, 'optionalAccess',
|
|
5744
|
-
_optionalChain([grouping, 'optionalAccess',
|
|
5833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Grouping", value: _nullishCoalesce(_optionalChain([grouping, 'optionalAccess', _500 => _500.kind]), () => ( "none")), options: [["none", "None"], ["number", "Numeric intervals"], ["date", "Date intervals"], ["manual", "Named groups"]], onChange: (kind) => onChange({ ...axis, grouping: kind === "none" ? null : { kind, unit: "months", interval: 1, groups: [] }, items: [], collapsed: [] }) }),
|
|
5834
|
+
_optionalChain([grouping, 'optionalAccess', _501 => _501.kind]) === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Group dates by", value: grouping.unit, options: DATE_UNITS.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => updateGrouping({ unit }) }) : null,
|
|
5745
5835
|
grouping && grouping.kind !== "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5746
5836
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Interval", type: "number", min: 1e-6, step: "any", value: String(grouping.interval), onChange: (interval) => updateGrouping({ interval: Number(interval) }) }),
|
|
5747
5837
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
@@ -5750,18 +5840,18 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
|
|
|
5750
5840
|
] }),
|
|
5751
5841
|
grouping.kind === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Optional bounds use Excel date serial values." }) : null
|
|
5752
5842
|
] }) : null,
|
|
5753
|
-
_optionalChain([grouping, 'optionalAccess',
|
|
5754
|
-
_optionalChain([grouping, 'optionalAccess',
|
|
5843
|
+
_optionalChain([grouping, 'optionalAccess', _502 => _502.kind]) === "date" && availableUnits.length ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Add date grouping level", value: "", placeholder: "Choose a level", options: availableUnits.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => onAddDateLevel(unit) }) : null,
|
|
5844
|
+
_optionalChain([grouping, 'optionalAccess', _503 => _503.kind]) === "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5755
5845
|
grouping.groups.map((group, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, borderTop: "1px solid var(--xlsx-pivot-border)", paddingTop: 8 }, children: [
|
|
5756
5846
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Group name", value: group.name, onChange: (name) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, name } : item) }) }),
|
|
5757
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
5847
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: _nullishCoalesce(_optionalChain([source, 'optionalAccess', _504 => _504.items]), () => ( [])), selected: group.members, onChange: (members) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, members } : item) }) }),
|
|
5758
5848
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: grouping.groups.filter((_, position) => position !== index) }), children: "Remove group" })
|
|
5759
5849
|
] }, index)),
|
|
5760
5850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: [...grouping.groups, { name: `Group ${grouping.groups.length + 1}`, members: [] }] }), children: "Add named group" })
|
|
5761
5851
|
] }) : null,
|
|
5762
5852
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
|
|
5763
5853
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Collapse members" }),
|
|
5764
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { paddingTop: 8 }, children: grouping && !_optionalChain([axis, 'access',
|
|
5854
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { paddingTop: 8 }, children: grouping && !_optionalChain([axis, 'access', _505 => _505.items, 'optionalAccess', _506 => _506.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping to load its members." }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { label: "Members to collapse", items: _optionalChain([axis, 'access', _507 => _507.items, 'optionalAccess', _508 => _508.length]) ? axis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _509 => _509.items]), () => ( [])), selected: axis.collapsed, onChange: (collapsed) => onChange({ ...axis, collapsed }) }) })
|
|
5765
5855
|
] })
|
|
5766
5856
|
] });
|
|
5767
5857
|
}
|
|
@@ -5769,7 +5859,7 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5769
5859
|
const source = pivot.fields.find((item) => item.index === field);
|
|
5770
5860
|
const filterAxis = _nullishCoalesce(axis, () => ( [...pivot.rows, ...pivot.columns].find((item) => item.field === field && item.grouping)));
|
|
5771
5861
|
const unit = groupingUnit(filterAxis);
|
|
5772
|
-
const members = _optionalChain([filterAxis, 'optionalAccess',
|
|
5862
|
+
const members = _optionalChain([filterAxis, 'optionalAccess', _510 => _510.items, 'optionalAccess', _511 => _511.length]) ? filterAxis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _512 => _512.items]), () => ( []));
|
|
5773
5863
|
const filters = pivot.filters.map((filter, index) => ({ filter, index })).filter(({ filter }) => filter.field === field && (_nullishCoalesce(filter.groupingUnit, () => ( null))) === unit);
|
|
5774
5864
|
const kinds = [["members", "Select items"], ["label", "Label filter"], ["value", "Value filter"], ["top10", "Top / bottom filter"]];
|
|
5775
5865
|
const update = (index, next) => editor.edit((current) => ({ ...current, filters: current.filters.flatMap((filter, position) => position === index ? next ? [next] : [] : [filter]) }));
|
|
@@ -5778,10 +5868,10 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5778
5868
|
"Field filters",
|
|
5779
5869
|
unit ? ` \xB7 ${unit}` : ""
|
|
5780
5870
|
] }),
|
|
5781
|
-
_optionalChain([filterAxis, 'optionalAccess',
|
|
5871
|
+
_optionalChain([filterAxis, 'optionalAccess', _513 => _513.grouping]) && !_optionalChain([filterAxis, 'access', _514 => _514.items, 'optionalAccess', _515 => _515.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping before selecting its members." }) : null,
|
|
5782
5872
|
filters.map(({ filter, index }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, paddingBlock: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
|
|
5783
5873
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, justifyContent: "space-between" }, children: [
|
|
5784
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _optionalChain([kinds, 'access',
|
|
5874
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _optionalChain([kinds, 'access', _516 => _516.find, 'call', _517 => _517(([kind]) => kind === filter.kind), 'optionalAccess', _518 => _518[1]]) }),
|
|
5785
5875
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { "aria-label": `Remove ${filter.kind} filter`, onClick: () => update(index, null), children: "\xD7" })
|
|
5786
5876
|
] }),
|
|
5787
5877
|
filter.kind === "members" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: members, selected: filter.values, onChange: (values) => update(index, { ...filter, values }) }) : null,
|
|
@@ -5801,13 +5891,13 @@ function FieldFilters({ editor, pivot, field, axis }) {
|
|
|
5801
5891
|
] });
|
|
5802
5892
|
}
|
|
5803
5893
|
function Advanced({ editor, pivot }) {
|
|
5804
|
-
const [chartType, setChartType] =
|
|
5805
|
-
const [chartCell, setChartCell] =
|
|
5806
|
-
const [chartTitle, setChartTitle] =
|
|
5807
|
-
const [chartMeasure, setChartMeasure] =
|
|
5808
|
-
const [chartSheet, setChartSheet] =
|
|
5809
|
-
const [chartWidth, setChartWidth] =
|
|
5810
|
-
const [chartHeight, setChartHeight] =
|
|
5894
|
+
const [chartType, setChartType] = React12.useState("ColumnClustered");
|
|
5895
|
+
const [chartCell, setChartCell] = React12.useState("I2");
|
|
5896
|
+
const [chartTitle, setChartTitle] = React12.useState("");
|
|
5897
|
+
const [chartMeasure, setChartMeasure] = React12.useState("");
|
|
5898
|
+
const [chartSheet, setChartSheet] = React12.useState("");
|
|
5899
|
+
const [chartWidth, setChartWidth] = React12.useState("560");
|
|
5900
|
+
const [chartHeight, setChartHeight] = React12.useState("340");
|
|
5811
5901
|
const update = (patch) => editor.edit((current) => ({ ...current, ...patch }));
|
|
5812
5902
|
const sheets = editor.viewer.sheets.map((sheet) => [sheet.name, sheet.name]);
|
|
5813
5903
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
@@ -5841,10 +5931,10 @@ function Advanced({ editor, pivot }) {
|
|
|
5841
5931
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Formula", value: item.formula, onChange: (formula) => update({ calculatedItems: pivot.calculatedItems.map((entry, position) => position === index ? { ...entry, formula } : entry) }) }),
|
|
5842
5932
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => update({ calculatedItems: pivot.calculatedItems.filter((_, position) => position !== index) }), children: "Remove calculated item" })
|
|
5843
5933
|
] }, index)),
|
|
5844
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: _nullishCoalesce(_optionalChain([pivot, 'access',
|
|
5934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: _nullishCoalesce(_optionalChain([pivot, 'access', _519 => _519.rows, 'access', _520 => _520[0], 'optionalAccess', _521 => _521.field]), () => ( pivot.fields[0].index)), name: `Calculated item ${pivot.calculatedItems.length + 1}`, formula: "0" }] }), children: "Add calculated item" })
|
|
5845
5935
|
] }),
|
|
5846
5936
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Section, { title: "PivotChart", children: [
|
|
5847
|
-
_optionalChain([pivot, 'access',
|
|
5937
|
+
_optionalChain([pivot, 'access', _522 => _522.charts, 'optionalAccess', _523 => _523.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
|
|
5848
5938
|
pivot.charts.length,
|
|
5849
5939
|
" linked chart",
|
|
5850
5940
|
pivot.charts.length === 1 ? "" : "s",
|
|
@@ -5868,22 +5958,22 @@ function Advanced({ editor, pivot }) {
|
|
|
5868
5958
|
] });
|
|
5869
5959
|
}
|
|
5870
5960
|
function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, style }) {
|
|
5871
|
-
const paneRef =
|
|
5872
|
-
const [placement, setPlacement] =
|
|
5873
|
-
const [search, setSearch] =
|
|
5874
|
-
const [selected, setSelected] =
|
|
5875
|
-
const [dragOver, setDragOver] =
|
|
5876
|
-
const [announcement, setAnnouncement] =
|
|
5877
|
-
const titleId =
|
|
5878
|
-
const settingsId =
|
|
5961
|
+
const paneRef = React12.useRef(null);
|
|
5962
|
+
const [placement, setPlacement] = React12.useState({ overlay: false, top: 0, width: 324 });
|
|
5963
|
+
const [search, setSearch] = React12.useState("");
|
|
5964
|
+
const [selected, setSelected] = React12.useState(null);
|
|
5965
|
+
const [dragOver, setDragOver] = React12.useState(null);
|
|
5966
|
+
const [announcement, setAnnouncement] = React12.useState("");
|
|
5967
|
+
const titleId = React12.useId();
|
|
5968
|
+
const settingsId = React12.useId();
|
|
5879
5969
|
const pivot = editor.draft;
|
|
5880
|
-
const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess',
|
|
5881
|
-
|
|
5970
|
+
const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess', _524 => _524.unsupportedFeatures, 'access', _525 => _525.length])) || editor.sourceNeedsLoad;
|
|
5971
|
+
React12.useEffect(() => {
|
|
5882
5972
|
setSelected(null);
|
|
5883
5973
|
setSearch("");
|
|
5884
|
-
}, [_optionalChain([pivot, 'optionalAccess',
|
|
5885
|
-
|
|
5886
|
-
const parent = _optionalChain([paneRef, 'access',
|
|
5974
|
+
}, [_optionalChain([pivot, 'optionalAccess', _526 => _526.id])]);
|
|
5975
|
+
React12.useEffect(() => {
|
|
5976
|
+
const parent = _optionalChain([paneRef, 'access', _527 => _527.current, 'optionalAccess', _528 => _528.parentElement]);
|
|
5887
5977
|
if (!parent) return;
|
|
5888
5978
|
const viewer = parent.closest(".react-xlsx-viewer");
|
|
5889
5979
|
const measure = () => {
|
|
@@ -5893,16 +5983,16 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
5893
5983
|
};
|
|
5894
5984
|
measure();
|
|
5895
5985
|
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
5896
|
-
_optionalChain([observer, 'optionalAccess',
|
|
5897
|
-
if (viewer) _optionalChain([observer, 'optionalAccess',
|
|
5986
|
+
_optionalChain([observer, 'optionalAccess', _529 => _529.observe, 'call', _530 => _530(parent)]);
|
|
5987
|
+
if (viewer) _optionalChain([observer, 'optionalAccess', _531 => _531.observe, 'call', _532 => _532(viewer)]);
|
|
5898
5988
|
window.addEventListener("resize", measure);
|
|
5899
5989
|
return () => {
|
|
5900
|
-
_optionalChain([observer, 'optionalAccess',
|
|
5990
|
+
_optionalChain([observer, 'optionalAccess', _533 => _533.disconnect, 'call', _534 => _534()]);
|
|
5901
5991
|
window.removeEventListener("resize", measure);
|
|
5902
5992
|
};
|
|
5903
5993
|
}, []);
|
|
5904
5994
|
const selectedField = pivot && selected ? fieldIndex(pivot, selected.area, selected.index) : void 0;
|
|
5905
|
-
const selectedCalculated = Boolean(pivot && _optionalChain([selected, 'optionalAccess',
|
|
5995
|
+
const selectedCalculated = Boolean(pivot && _optionalChain([selected, 'optionalAccess', _535 => _535.area]) === "values" && _optionalChain([pivot, 'access', _536 => _536.values, 'access', _537 => _537[selected.index], 'optionalAccess', _538 => _538.formula, 'optionalAccess', _539 => _539.trim, 'call', _540 => _540()]));
|
|
5906
5996
|
const theme = {
|
|
5907
5997
|
"--xlsx-pivot-bg": isDark ? "#242729" : "#fafbfa",
|
|
5908
5998
|
"--xlsx-pivot-input": isDark ? "#303437" : "#ffffff",
|
|
@@ -5912,7 +6002,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
5912
6002
|
"--xlsx-pivot-hover": isDark ? "#35483d" : "#edf5ef"
|
|
5913
6003
|
};
|
|
5914
6004
|
const move = (from, to, index) => {
|
|
5915
|
-
if (from.area === "values" && to !== "values" && _optionalChain([pivot, 'optionalAccess',
|
|
6005
|
+
if (from.area === "values" && to !== "values" && _optionalChain([pivot, 'optionalAccess', _541 => _541.values, 'access', _542 => _542[from.index], 'optionalAccess', _543 => _543.formula, 'optionalAccess', _544 => _544.trim, 'call', _545 => _545()])) {
|
|
5916
6006
|
setAnnouncement("Calculated fields stay in the Values area.");
|
|
5917
6007
|
return;
|
|
5918
6008
|
}
|
|
@@ -5927,7 +6017,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
5927
6017
|
if (disabled) return;
|
|
5928
6018
|
try {
|
|
5929
6019
|
const data = JSON.parse(event.dataTransfer.getData(DRAG_TYPE));
|
|
5930
|
-
if ("field" in data && Number.isInteger(data.field) && _optionalChain([pivot, 'optionalAccess',
|
|
6020
|
+
if ("field" in data && Number.isInteger(data.field) && _optionalChain([pivot, 'optionalAccess', _546 => _546.fields, 'access', _547 => _547.some, 'call', _548 => _548((field) => field.index === data.field)])) {
|
|
5931
6021
|
editor.addField(area, data.field);
|
|
5932
6022
|
setAnnouncement(`Field added to ${AREA_NAMES[area]}.`);
|
|
5933
6023
|
} else if ("area" in data && AREAS.includes(data.area) && Number.isInteger(data.index) && pivot && data.index >= 0 && data.index < pivot[data.area].length) move(data, area, index);
|
|
@@ -5947,14 +6037,14 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
5947
6037
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { overflowY: "auto", flex: 1, minHeight: 0 }, children: [
|
|
5948
6038
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, padding: 12 }, children: [
|
|
5949
6039
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, alignItems: "end" }, children: [
|
|
5950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "PivotTable", value: _nullishCoalesce(_optionalChain([pivot, 'optionalAccess',
|
|
6040
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "PivotTable", value: _nullishCoalesce(_optionalChain([pivot, 'optionalAccess', _549 => _549.id]), () => ( "")), placeholder: pivot && !pivot.id ? pivot.name : "Choose a PivotTable", options: editor.viewer.pivotTables.map((item) => [item.id, item.name]), onChange: editor.select, disabled: editor.dirty }) }),
|
|
5951
6041
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: editor.viewer.readOnly || editor.dirty, onClick: editor.create, children: "New" })
|
|
5952
6042
|
] }),
|
|
5953
6043
|
editor.error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "alert", style: { margin: 0, color: isDark ? "#ffb7b0" : "#a12622", overflowWrap: "anywhere" }, children: editor.error }) : null,
|
|
5954
6044
|
editor.status ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", style: hint, children: editor.status }) : null,
|
|
5955
6045
|
editor.stale ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "alert", style: hint, children: "The worksheet changed while you were editing. Discard these changes to load the current PivotTable." }) : null,
|
|
5956
6046
|
editor.sourceNeedsLoad ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", style: hint, children: "The source changed. Load its fields under Source and location." }) : null,
|
|
5957
|
-
_optionalChain([pivot, 'optionalAccess',
|
|
6047
|
+
_optionalChain([pivot, 'optionalAccess', _550 => _550.unsupportedFeatures, 'access', _551 => _551.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
|
|
5958
6048
|
"This PivotTable is preserved for Excel. Editing is unavailable for: ",
|
|
5959
6049
|
pivot.unsupportedFeatures.join(", "),
|
|
5960
6050
|
"."
|
|
@@ -5996,7 +6086,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
|
|
|
5996
6086
|
pivot[area].map((_, index) => {
|
|
5997
6087
|
const field = fieldIndex(pivot, area, index);
|
|
5998
6088
|
const name = area === "values" ? pivot.values[index].name : area === "reportFilters" ? fieldName(pivot, field) : pivot[area][index].name || fieldName(pivot, field);
|
|
5999
|
-
const active = _optionalChain([selected, 'optionalAccess',
|
|
6089
|
+
const active = _optionalChain([selected, 'optionalAccess', _552 => _552.area]) === area && selected.index === index;
|
|
6000
6090
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { draggable: !disabled, onDragStart: (event) => drag(event, { area, index }), onDrop: (event) => drop(event, area, index), style: { marginBottom: 3 }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", "aria-expanded": active, "aria-controls": settingsId, title: `${name} settings. Alt+Up or Alt+Down reorders the field.`, onClick: () => setSelected(active ? null : { area, index }), onKeyDown: (event) => {
|
|
6001
6091
|
if (!event.altKey || !["ArrowUp", "ArrowDown"].includes(event.key)) return;
|
|
6002
6092
|
event.preventDefault();
|
|
@@ -6112,7 +6202,7 @@ function createChartModule(importModule) {
|
|
|
6112
6202
|
};
|
|
6113
6203
|
}
|
|
6114
6204
|
var officeChartRenderer = createChartModule(async () => {
|
|
6115
|
-
const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-
|
|
6205
|
+
const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-7E6KMGTG.cjs")));
|
|
6116
6206
|
return { renderer: null, SharedChartSvg };
|
|
6117
6207
|
});
|
|
6118
6208
|
|
|
@@ -6143,7 +6233,7 @@ var DEFAULT_COL_WIDTH2 = 80;
|
|
|
6143
6233
|
var MAX_AUTOFIT_ROW_HEIGHT_PX = 409 * (4 / 3);
|
|
6144
6234
|
var HEADER_HEIGHT = 24;
|
|
6145
6235
|
var ROW_HEADER_WIDTH = 40;
|
|
6146
|
-
var
|
|
6236
|
+
var HEADER_RESIZE_HANDLE_PX = 8;
|
|
6147
6237
|
var CANVAS_VIEWPORT_OVERSCAN_PX = 480;
|
|
6148
6238
|
var CANVAS_SCROLL_BUFFER_PX = 480;
|
|
6149
6239
|
var CANVAS_DEFERRED_VIEWPORT_SYNC_THRESHOLD_PX = CANVAS_SCROLL_BUFFER_PX - 96;
|
|
@@ -6656,7 +6746,7 @@ function parseCanvasGradientStops(value) {
|
|
|
6656
6746
|
if (!match) {
|
|
6657
6747
|
return null;
|
|
6658
6748
|
}
|
|
6659
|
-
const color = _optionalChain([match, 'access',
|
|
6749
|
+
const color = _optionalChain([match, 'access', _553 => _553[1], 'optionalAccess', _554 => _554.trim, 'call', _555 => _555()]);
|
|
6660
6750
|
const percent = match[2] ? Number.parseFloat(match[2]) : Number.NaN;
|
|
6661
6751
|
if (!color) {
|
|
6662
6752
|
return null;
|
|
@@ -6672,7 +6762,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
|
|
|
6672
6762
|
if (linearMatch) {
|
|
6673
6763
|
const parts = splitCssGradientArgs(_nullishCoalesce(linearMatch[1], () => ( "")));
|
|
6674
6764
|
if (parts.length >= 2) {
|
|
6675
|
-
const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access',
|
|
6765
|
+
const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _556 => _556[0], 'optionalAccess', _557 => _557.trim, 'call', _558 => _558()]), () => ( "180deg"));
|
|
6676
6766
|
const angleMatch = rawAngle.match(/(-?\d*\.?\d+)deg/i);
|
|
6677
6767
|
const cssAngle = angleMatch ? Number.parseFloat(_nullishCoalesce(angleMatch[1], () => ( "180"))) : 180;
|
|
6678
6768
|
const radians = (90 - cssAngle) * Math.PI / 180;
|
|
@@ -6702,7 +6792,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
|
|
|
6702
6792
|
const radialMatch = backgroundImage.match(/^radial-gradient\((.*)\)$/i);
|
|
6703
6793
|
if (radialMatch) {
|
|
6704
6794
|
const parts = splitCssGradientArgs(_nullishCoalesce(radialMatch[1], () => ( "")));
|
|
6705
|
-
const stopParts = _optionalChain([parts, 'access',
|
|
6795
|
+
const stopParts = _optionalChain([parts, 'access', _559 => _559[0], 'optionalAccess', _560 => _560.startsWith, 'call', _561 => _561("circle")]) ? parts.slice(1) : parts;
|
|
6706
6796
|
const gradient = context.createRadialGradient(
|
|
6707
6797
|
rect.left + rect.width / 2,
|
|
6708
6798
|
rect.top + rect.height / 2,
|
|
@@ -6811,8 +6901,8 @@ function lightenColor(color, ratio) {
|
|
|
6811
6901
|
function darkenColor(color, ratio) {
|
|
6812
6902
|
return mixRgbColor(color, "#000000", ratio);
|
|
6813
6903
|
}
|
|
6814
|
-
var ViewerContext =
|
|
6815
|
-
var ViewerAppearanceContext =
|
|
6904
|
+
var ViewerContext = React15.createContext(null);
|
|
6905
|
+
var ViewerAppearanceContext = React15.createContext({ isDark: false });
|
|
6816
6906
|
function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
|
|
6817
6907
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: [top && "top", bottom && "bottom"].flatMap((vertical) => vertical ? [left && "left", right && "right"].map((horizontal) => horizontal ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
|
|
6818
6908
|
position: "absolute",
|
|
@@ -6828,7 +6918,7 @@ function resolveDarkModeSurface(themePalette, palette) {
|
|
|
6828
6918
|
return "hsl(225 4% 6%)";
|
|
6829
6919
|
}
|
|
6830
6920
|
function resolveSheetSurface(sheet, palette) {
|
|
6831
|
-
return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess',
|
|
6921
|
+
return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _562 => _562.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _563 => _563.themePalette, 'access', _564 => _564.colorsByIndex, 'access', _565 => _565[0]]), () => ( SHEET_SURFACE));
|
|
6832
6922
|
}
|
|
6833
6923
|
function normalizeRange2(range) {
|
|
6834
6924
|
return {
|
|
@@ -6856,23 +6946,10 @@ function buildVisibleAxisIndices(precomputed, displayLimit, maxUsedIndex, hidden
|
|
|
6856
6946
|
if (displayLimit <= 0) {
|
|
6857
6947
|
return [];
|
|
6858
6948
|
}
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
if (!_optionalChain([hiddenIndices, 'optionalAccess', _551 => _551.has, 'call', _552 => _552(index)])) {
|
|
6864
|
-
visible2.push(index);
|
|
6865
|
-
}
|
|
6866
|
-
}
|
|
6867
|
-
for (let index = usedLimit; index < displayLimit; index += 1) {
|
|
6868
|
-
visible2.push(index);
|
|
6869
|
-
}
|
|
6870
|
-
return visible2;
|
|
6871
|
-
}
|
|
6872
|
-
const visible = precomputed.filter((value) => value < displayLimit);
|
|
6873
|
-
const appendStart = Math.max(0, maxUsedIndex + 1);
|
|
6874
|
-
for (let index = appendStart; index < displayLimit; index += 1) {
|
|
6875
|
-
visible.push(index);
|
|
6949
|
+
const visible = precomputed.filter((index) => index < displayLimit);
|
|
6950
|
+
const appendStart = precomputed.length ? Math.max(0, maxUsedIndex + 1) : 0;
|
|
6951
|
+
for (let index = appendStart; index < displayLimit; index++) {
|
|
6952
|
+
if (!_optionalChain([hiddenIndices, 'optionalAccess', _566 => _566.has, 'call', _567 => _567(index)])) visible.push(index);
|
|
6876
6953
|
}
|
|
6877
6954
|
return visible;
|
|
6878
6955
|
}
|
|
@@ -6905,7 +6982,7 @@ function clampPercent(value, fallback) {
|
|
|
6905
6982
|
return Math.max(0, Math.min(100, value));
|
|
6906
6983
|
}
|
|
6907
6984
|
function resolveShapeAdjustment(shape, name, fallback) {
|
|
6908
|
-
const rawValue = _optionalChain([shape, 'access',
|
|
6985
|
+
const rawValue = _optionalChain([shape, 'access', _568 => _568.geometryAdjustments, 'optionalAccess', _569 => _569[name]]);
|
|
6909
6986
|
if (typeof rawValue !== "number") {
|
|
6910
6987
|
return fallback;
|
|
6911
6988
|
}
|
|
@@ -7791,7 +7868,7 @@ function applyCanvasShapeDash(context, dash, lineWidth) {
|
|
|
7791
7868
|
}
|
|
7792
7869
|
}
|
|
7793
7870
|
function useViewerPalette(isDark = false, headerBackgroundColor, headerTextColor) {
|
|
7794
|
-
return
|
|
7871
|
+
return React15.useMemo(
|
|
7795
7872
|
() => resolveViewerPalette(isDark, headerBackgroundColor, headerTextColor),
|
|
7796
7873
|
[headerBackgroundColor, headerTextColor, isDark]
|
|
7797
7874
|
);
|
|
@@ -7805,8 +7882,8 @@ function normalizeThumbnailResolution(resolution) {
|
|
|
7805
7882
|
}
|
|
7806
7883
|
const resolvedObject = typeof resolution === "object" && resolution ? resolution : void 0;
|
|
7807
7884
|
return {
|
|
7808
|
-
maxHeight: _optionalChain([resolvedObject, 'optionalAccess',
|
|
7809
|
-
maxWidth: _optionalChain([resolvedObject, 'optionalAccess',
|
|
7885
|
+
maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _570 => _570.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
|
|
7886
|
+
maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _571 => _571.maxWidth]) && Number.isFinite(resolvedObject.maxWidth) && resolvedObject.maxWidth > 0 ? resolvedObject.maxWidth : THUMBNAIL_DEFAULT_MAX_DIMENSION
|
|
7810
7887
|
};
|
|
7811
7888
|
}
|
|
7812
7889
|
function resolveThumbnailOutputSize(sourceWidth, sourceHeight, resolution) {
|
|
@@ -7904,7 +7981,7 @@ function resolveThumbnailAxisMarkerOffset({
|
|
|
7904
7981
|
offsetEmu,
|
|
7905
7982
|
previewStartActualIndex
|
|
7906
7983
|
}) {
|
|
7907
|
-
return resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, actualIndex) - resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, previewStartActualIndex) +
|
|
7984
|
+
return resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, actualIndex) - resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, previewStartActualIndex) + _chunkXZJLPW64cjs.emuToPixels.call(void 0, offsetEmu);
|
|
7908
7985
|
}
|
|
7909
7986
|
function resolveThumbnailAnchoredRect(anchor, visibleRows, visibleCols, getRowHeightPx, getColWidthPx, previewRows, previewCols, options2) {
|
|
7910
7987
|
const previewStartRow = _nullishCoalesce(previewRows[0], () => ( 0));
|
|
@@ -7927,18 +8004,18 @@ function resolveThumbnailAnchoredRect(anchor, visibleRows, visibleCols, getRowHe
|
|
|
7927
8004
|
});
|
|
7928
8005
|
if (anchor.kind === "absolute") {
|
|
7929
8006
|
return {
|
|
7930
|
-
height: Math.max(1,
|
|
7931
|
-
left: options2.rowHeaderWidth +
|
|
7932
|
-
top: options2.headerHeight +
|
|
7933
|
-
width: Math.max(1,
|
|
8007
|
+
height: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cy)),
|
|
8008
|
+
left: options2.rowHeaderWidth + _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.positionEmu.x) - previewOriginX,
|
|
8009
|
+
top: options2.headerHeight + _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.positionEmu.y) - previewOriginY,
|
|
8010
|
+
width: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cx))
|
|
7934
8011
|
};
|
|
7935
8012
|
}
|
|
7936
8013
|
if (anchor.kind === "one-cell") {
|
|
7937
8014
|
return {
|
|
7938
|
-
height: Math.max(1,
|
|
8015
|
+
height: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cy)),
|
|
7939
8016
|
left: resolveMarkerLeft(anchor.from.col, anchor.from.colOffsetEmu),
|
|
7940
8017
|
top: resolveMarkerTop(anchor.from.row, anchor.from.rowOffsetEmu),
|
|
7941
|
-
width: Math.max(1,
|
|
8018
|
+
width: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cx))
|
|
7942
8019
|
};
|
|
7943
8020
|
}
|
|
7944
8021
|
const left = resolveMarkerLeft(anchor.from.col, anchor.from.colOffsetEmu);
|
|
@@ -7993,7 +8070,7 @@ function decodeHtmlEntities2(value) {
|
|
|
7993
8070
|
return value.replace(/"/g, '"').replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
7994
8071
|
}
|
|
7995
8072
|
function mapBorder2(edge, themePalette) {
|
|
7996
|
-
const color = _nullishCoalesce(
|
|
8073
|
+
const color = _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, edge.color, themePalette), () => ( "#000"));
|
|
7997
8074
|
const widthMap = {
|
|
7998
8075
|
dashed: "1px",
|
|
7999
8076
|
dotted: "1px",
|
|
@@ -8125,24 +8202,24 @@ function escapeCssFontFamily(name) {
|
|
|
8125
8202
|
return /[\s"'(),]/.test(name) ? `"${name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : name;
|
|
8126
8203
|
}
|
|
8127
8204
|
function resolveSpreadsheetThemeFont(font, themePalette) {
|
|
8128
|
-
const scheme = typeof _optionalChain([font, 'optionalAccess',
|
|
8205
|
+
const scheme = typeof _optionalChain([font, 'optionalAccess', _572 => _572.scheme]) === "string" ? font.scheme : null;
|
|
8129
8206
|
if (scheme === "major") {
|
|
8130
|
-
return _optionalChain([themePalette, 'optionalAccess',
|
|
8207
|
+
return _optionalChain([themePalette, 'optionalAccess', _573 => _573.majorLatinFont]);
|
|
8131
8208
|
}
|
|
8132
8209
|
if (scheme === "minor") {
|
|
8133
|
-
return _optionalChain([themePalette, 'optionalAccess',
|
|
8210
|
+
return _optionalChain([themePalette, 'optionalAccess', _574 => _574.minorLatinFont]);
|
|
8134
8211
|
}
|
|
8135
8212
|
return void 0;
|
|
8136
8213
|
}
|
|
8137
8214
|
function buildSpreadsheetFontFamily(font, themePalette) {
|
|
8138
8215
|
const candidates = [
|
|
8139
|
-
typeof _optionalChain([font, 'optionalAccess',
|
|
8140
|
-
_nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call',
|
|
8216
|
+
typeof _optionalChain([font, 'optionalAccess', _575 => _575.name]) === "string" ? font.name.trim() : "",
|
|
8217
|
+
_nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _576 => _576(font, themePalette), 'optionalAccess', _577 => _577.trim, 'call', _578 => _578()]), () => ( ""))
|
|
8141
8218
|
].filter((value, index, array) => value.length > 0 && array.indexOf(value) === index);
|
|
8142
8219
|
if (candidates.length === 0) {
|
|
8143
8220
|
return void 0;
|
|
8144
8221
|
}
|
|
8145
|
-
const primaryFont = _optionalChain([candidates, 'access',
|
|
8222
|
+
const primaryFont = _optionalChain([candidates, 'access', _579 => _579[0], 'optionalAccess', _580 => _580.toLowerCase, 'call', _581 => _581()]);
|
|
8146
8223
|
if (primaryFont === "calibri") {
|
|
8147
8224
|
return [
|
|
8148
8225
|
"Calibri",
|
|
@@ -8175,17 +8252,17 @@ function resolveSpreadsheetLineHeight(fontSizePt) {
|
|
|
8175
8252
|
}
|
|
8176
8253
|
function buildGridlineShadow(color, options2) {
|
|
8177
8254
|
const parts = [];
|
|
8178
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8255
|
+
if (_optionalChain([options2, 'optionalAccess', _582 => _582.right]) !== false) {
|
|
8179
8256
|
parts.push(`inset -1px 0 0 ${color}`);
|
|
8180
8257
|
}
|
|
8181
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
8258
|
+
if (_optionalChain([options2, 'optionalAccess', _583 => _583.bottom]) !== false) {
|
|
8182
8259
|
parts.push(`inset 0 -1px 0 ${color}`);
|
|
8183
8260
|
}
|
|
8184
8261
|
return parts.join(", ");
|
|
8185
8262
|
}
|
|
8186
8263
|
function buildCellStyle(style, palette, themePalette, options2) {
|
|
8187
|
-
const showGridLines = _nullishCoalesce(_optionalChain([options2, 'optionalAccess',
|
|
8188
|
-
const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
8264
|
+
const showGridLines = _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _584 => _584.showGridLines]), () => ( true));
|
|
8265
|
+
const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _585 => _585.colorsByIndex, 'access', _586 => _586[0]]), () => ( SHEET_SURFACE));
|
|
8189
8266
|
const gridlineShadow = showGridLines ? buildGridlineShadow(palette.border) : void 0;
|
|
8190
8267
|
const css = {
|
|
8191
8268
|
backgroundColor: baseSurface,
|
|
@@ -8198,7 +8275,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
|
|
|
8198
8275
|
lineHeight: String(resolveSpreadsheetLineHeight(11)),
|
|
8199
8276
|
overflow: "hidden",
|
|
8200
8277
|
padding: DEFAULT_CELL_PADDING,
|
|
8201
|
-
textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess',
|
|
8278
|
+
textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _587 => _587.generalAlignment]), () => ( "left")),
|
|
8202
8279
|
textOverflow: "clip",
|
|
8203
8280
|
verticalAlign: "bottom",
|
|
8204
8281
|
whiteSpace: "nowrap"
|
|
@@ -8210,7 +8287,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
|
|
|
8210
8287
|
let resolvedFillColor = null;
|
|
8211
8288
|
let hasExplicitFill = false;
|
|
8212
8289
|
if (fill) {
|
|
8213
|
-
const fillStyle =
|
|
8290
|
+
const fillStyle = _chunkXZJLPW64cjs.resolveWorkbookFillStyle.call(void 0, fill, themePalette);
|
|
8214
8291
|
if (fillStyle.backgroundColor || fillStyle.backgroundImage) {
|
|
8215
8292
|
hasExplicitFill = true;
|
|
8216
8293
|
resolvedFillColor = fillStyle.backgroundColor;
|
|
@@ -8238,7 +8315,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
|
|
|
8238
8315
|
if (font.strikethrough) {
|
|
8239
8316
|
css.textDecoration = `${_nullishCoalesce(css.textDecoration, () => ( ""))} line-through`.trim();
|
|
8240
8317
|
}
|
|
8241
|
-
const fontColor =
|
|
8318
|
+
const fontColor = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, font.color, themePalette);
|
|
8242
8319
|
if (fontColor) {
|
|
8243
8320
|
resolvedFontColor = fontColor;
|
|
8244
8321
|
css.color = fontColor;
|
|
@@ -8282,24 +8359,24 @@ function buildCellStyle(style, palette, themePalette, options2) {
|
|
|
8282
8359
|
}
|
|
8283
8360
|
const border = style.border;
|
|
8284
8361
|
if (border) {
|
|
8285
|
-
const hasRightBorder = Boolean(_optionalChain([border, 'access',
|
|
8286
|
-
const hasBottomBorder = Boolean(_optionalChain([border, 'access',
|
|
8362
|
+
const hasRightBorder = Boolean(_optionalChain([border, 'access', _588 => _588.right, 'optionalAccess', _589 => _589.style]) && border.right.style !== "none");
|
|
8363
|
+
const hasBottomBorder = Boolean(_optionalChain([border, 'access', _590 => _590.bottom, 'optionalAccess', _591 => _591.style]) && border.bottom.style !== "none");
|
|
8287
8364
|
if (showGridLines && (hasRightBorder || hasBottomBorder)) {
|
|
8288
8365
|
css.boxShadow = buildGridlineShadow(palette.border, {
|
|
8289
8366
|
bottom: !hasBottomBorder,
|
|
8290
8367
|
right: !hasRightBorder
|
|
8291
8368
|
}) || void 0;
|
|
8292
8369
|
}
|
|
8293
|
-
if (_optionalChain([border, 'access',
|
|
8370
|
+
if (_optionalChain([border, 'access', _592 => _592.top, 'optionalAccess', _593 => _593.style]) && border.top.style !== "none") {
|
|
8294
8371
|
css.borderTop = mapBorder2(border.top, themePalette);
|
|
8295
8372
|
}
|
|
8296
|
-
if (_optionalChain([border, 'access',
|
|
8373
|
+
if (_optionalChain([border, 'access', _594 => _594.right, 'optionalAccess', _595 => _595.style]) && border.right.style !== "none") {
|
|
8297
8374
|
css.borderRight = mapBorder2(border.right, themePalette);
|
|
8298
8375
|
}
|
|
8299
|
-
if (_optionalChain([border, 'access',
|
|
8376
|
+
if (_optionalChain([border, 'access', _596 => _596.bottom, 'optionalAccess', _597 => _597.style]) && border.bottom.style !== "none") {
|
|
8300
8377
|
css.borderBottom = mapBorder2(border.bottom, themePalette);
|
|
8301
8378
|
}
|
|
8302
|
-
if (_optionalChain([border, 'access',
|
|
8379
|
+
if (_optionalChain([border, 'access', _598 => _598.left, 'optionalAccess', _599 => _599.style]) && border.left.style !== "none") {
|
|
8303
8380
|
css.borderLeft = mapBorder2(border.left, themePalette);
|
|
8304
8381
|
}
|
|
8305
8382
|
}
|
|
@@ -8345,10 +8422,10 @@ function measureTextWidth(value, style) {
|
|
|
8345
8422
|
}
|
|
8346
8423
|
function getCellDisplayValue(worksheet, row2, col, activeSheet, locale = "en-US") {
|
|
8347
8424
|
const formula = worksheet.getFormulaAt(row2, col);
|
|
8348
|
-
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess',
|
|
8425
|
+
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _600 => _600.cachedFormulaValues, 'optionalAccess', _601 => _601[cellAddressToA12({ row: row2, col })]]) : void 0;
|
|
8349
8426
|
const formatted = worksheet.getFormattedValueAt(row2, col);
|
|
8350
8427
|
if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
|
|
8351
|
-
return
|
|
8428
|
+
return _chunkXZJLPW64cjs.localizeCellNumber.call(void 0, worksheet, row2, col, decodeHtmlEntities2(formatted), locale);
|
|
8352
8429
|
}
|
|
8353
8430
|
const cellValue = worksheet.getCalculatedValueAt(row2, col);
|
|
8354
8431
|
if (formula && cachedFormulaValue !== void 0 && cellValue.is_error) {
|
|
@@ -8592,7 +8669,7 @@ function normalizeBatchedMergeSpan(value) {
|
|
|
8592
8669
|
}
|
|
8593
8670
|
function normalizeBatchedCellValue(rawValue, formula, row2, col, activeSheet) {
|
|
8594
8671
|
const value = typeof rawValue === "string" ? decodeHtmlEntities2(rawValue) : rawValue === null || rawValue === void 0 ? "" : String(rawValue);
|
|
8595
|
-
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess',
|
|
8672
|
+
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _602 => _602.cachedFormulaValues, 'optionalAccess', _603 => _603[cellAddressToA12({ row: row2, col })]]) : void 0;
|
|
8596
8673
|
if (formula && cachedFormulaValue !== void 0 && value.startsWith("#")) {
|
|
8597
8674
|
return cachedFormulaValue;
|
|
8598
8675
|
}
|
|
@@ -8640,31 +8717,31 @@ function mergeResolvedCellStyle(base, overlay, options2) {
|
|
|
8640
8717
|
..._nullishCoalesce(base, () => ( {})),
|
|
8641
8718
|
..._nullishCoalesce(overlay, () => ( {}))
|
|
8642
8719
|
};
|
|
8643
|
-
const baseAlignment = _optionalChain([base, 'optionalAccess',
|
|
8644
|
-
const overlayAlignment = _optionalChain([overlay, 'optionalAccess',
|
|
8720
|
+
const baseAlignment = _optionalChain([base, 'optionalAccess', _604 => _604.alignment]);
|
|
8721
|
+
const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _605 => _605.alignment]);
|
|
8645
8722
|
if (baseAlignment || overlayAlignment) {
|
|
8646
8723
|
nextStyle.alignment = {
|
|
8647
8724
|
..._nullishCoalesce(baseAlignment, () => ( {})),
|
|
8648
8725
|
..._nullishCoalesce(overlayAlignment, () => ( {}))
|
|
8649
8726
|
};
|
|
8650
8727
|
}
|
|
8651
|
-
const baseBorder = _optionalChain([base, 'optionalAccess',
|
|
8652
|
-
const overlayBorder = _optionalChain([overlay, 'optionalAccess',
|
|
8728
|
+
const baseBorder = _optionalChain([base, 'optionalAccess', _606 => _606.border]);
|
|
8729
|
+
const overlayBorder = _optionalChain([overlay, 'optionalAccess', _607 => _607.border]);
|
|
8653
8730
|
if (baseBorder || overlayBorder) {
|
|
8654
|
-
nextStyle.border = _optionalChain([options2, 'optionalAccess',
|
|
8731
|
+
nextStyle.border = _optionalChain([options2, 'optionalAccess', _608 => _608.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
|
|
8655
8732
|
..._nullishCoalesce(baseBorder, () => ( {})),
|
|
8656
8733
|
..._nullishCoalesce(overlayBorder, () => ( {}))
|
|
8657
8734
|
};
|
|
8658
8735
|
}
|
|
8659
|
-
const baseFill = _optionalChain([base, 'optionalAccess',
|
|
8660
|
-
const overlayFill = _optionalChain([overlay, 'optionalAccess',
|
|
8736
|
+
const baseFill = _optionalChain([base, 'optionalAccess', _609 => _609.fill]);
|
|
8737
|
+
const overlayFill = _optionalChain([overlay, 'optionalAccess', _610 => _610.fill]);
|
|
8661
8738
|
if (baseFill || overlayFill) {
|
|
8662
|
-
nextStyle.fill = _optionalChain([options2, 'optionalAccess',
|
|
8739
|
+
nextStyle.fill = _optionalChain([options2, 'optionalAccess', _611 => _611.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
|
|
8663
8740
|
}
|
|
8664
|
-
const baseFont = _optionalChain([base, 'optionalAccess',
|
|
8665
|
-
const overlayFont = _optionalChain([overlay, 'optionalAccess',
|
|
8741
|
+
const baseFont = _optionalChain([base, 'optionalAccess', _612 => _612.font]);
|
|
8742
|
+
const overlayFont = _optionalChain([overlay, 'optionalAccess', _613 => _613.font]);
|
|
8666
8743
|
if (baseFont || overlayFont) {
|
|
8667
|
-
nextStyle.font = _optionalChain([options2, 'optionalAccess',
|
|
8744
|
+
nextStyle.font = _optionalChain([options2, 'optionalAccess', _614 => _614.replaceXfSubtrees]) && overlayFont ? overlayFont : {
|
|
8668
8745
|
..._nullishCoalesce(baseFont, () => ( {})),
|
|
8669
8746
|
..._nullishCoalesce(overlayFont, () => ( {}))
|
|
8670
8747
|
};
|
|
@@ -8910,7 +8987,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
|
|
|
8910
8987
|
items: tabs.map((tab, index) => ({
|
|
8911
8988
|
id: String(index),
|
|
8912
8989
|
label: tab.name,
|
|
8913
|
-
title: tab.visibility === "hidden" ?
|
|
8990
|
+
title: tab.visibility === "hidden" ? _chunkYOLIVKZDcjs.formatMessage.call(void 0, messages.hiddenSheet, { sheet: tab.name }) : tab.visibility === "veryHidden" ? _chunkYOLIVKZDcjs.formatMessage.call(void 0, messages.veryHiddenSheet, { sheet: tab.name }) : tab.name,
|
|
8914
8991
|
visibility: tab.visibility
|
|
8915
8992
|
})),
|
|
8916
8993
|
onValueChange: (value) => setActiveTabIndex(Number(value)),
|
|
@@ -8933,7 +9010,7 @@ function resolveRichCellRuns(raw, value, base, theme, zoom) {
|
|
|
8933
9010
|
if (typeof font.size === "number" && font.size > 0) style.fontSize = font.size * (4 / 3) * zoom;
|
|
8934
9011
|
if (typeof font.bold === "boolean") style.fontWeight = font.bold ? "bold" : "normal";
|
|
8935
9012
|
if (typeof font.italic === "boolean") style.fontStyle = font.italic ? "italic" : "normal";
|
|
8936
|
-
const color =
|
|
9013
|
+
const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, font.color, theme);
|
|
8937
9014
|
if (color) style.color = color;
|
|
8938
9015
|
const decorations = new Set(String(_nullishCoalesce(base.textDecoration, () => ( ""))).split(/\s+/).filter(Boolean));
|
|
8939
9016
|
if (font.underline != null) {
|
|
@@ -9178,11 +9255,11 @@ function resolveConditionalFormulaComparable(formula, worksheet, sheet, batchedC
|
|
|
9178
9255
|
return literal;
|
|
9179
9256
|
}
|
|
9180
9257
|
const splitReference = splitSheetFormulaReference(normalized);
|
|
9181
|
-
const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess',
|
|
9182
|
-
if (targetSheetName && _optionalChain([sheet, 'optionalAccess',
|
|
9258
|
+
const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _615 => _615.sheetName]), () => ( null));
|
|
9259
|
+
if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _616 => _616.name]) && targetSheetName !== sheet.name) {
|
|
9183
9260
|
return literal;
|
|
9184
9261
|
}
|
|
9185
|
-
const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess',
|
|
9262
|
+
const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _617 => _617.range]), () => ( normalized));
|
|
9186
9263
|
const cell = parseA1CellReference2(cellRef.replace(/\$/g, ""));
|
|
9187
9264
|
if (!cell) {
|
|
9188
9265
|
return literal;
|
|
@@ -9214,8 +9291,8 @@ function normalizeConditionalTextOperand(value) {
|
|
|
9214
9291
|
}
|
|
9215
9292
|
function resolveConditionalStyledRuleMatch(rule, numericValue, textValue, worksheet, sheet, batchedCells) {
|
|
9216
9293
|
const normalizedRuleType = rule.ruleType.trim().toLowerCase();
|
|
9217
|
-
const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access',
|
|
9218
|
-
const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access',
|
|
9294
|
+
const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _618 => _618.formulas, 'optionalAccess', _619 => _619[0]]), () => ( "")), worksheet, sheet, batchedCells);
|
|
9295
|
+
const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _620 => _620.formulas, 'optionalAccess', _621 => _621[1]]), () => ( "")), worksheet, sheet, batchedCells);
|
|
9219
9296
|
if (normalizedRuleType === "cellis") {
|
|
9220
9297
|
return resolveConditionalCellIsMatch(_nullishCoalesce(rule.operator, () => ( "equal")), left, right, numericValue, textValue);
|
|
9221
9298
|
}
|
|
@@ -9246,7 +9323,7 @@ function getStyledConditionalRules(rules) {
|
|
|
9246
9323
|
return styledRules;
|
|
9247
9324
|
}
|
|
9248
9325
|
function resolveConditionalCellStyleForCell(row2, col, sheet, readNumericValue, readTextValue, worksheet, batchedCells) {
|
|
9249
|
-
const rules = _optionalChain([sheet, 'optionalAccess',
|
|
9326
|
+
const rules = _optionalChain([sheet, 'optionalAccess', _622 => _622.conditionalFormatRules]);
|
|
9250
9327
|
if (!sheet || !rules || rules.length === 0) {
|
|
9251
9328
|
return null;
|
|
9252
9329
|
}
|
|
@@ -9450,11 +9527,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9450
9527
|
if (shape.paragraphs.length === 0) {
|
|
9451
9528
|
return;
|
|
9452
9529
|
}
|
|
9453
|
-
const inset = _optionalChain([shape, 'access',
|
|
9454
|
-
const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9455
|
-
const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9456
|
-
const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9457
|
-
const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
9530
|
+
const inset = _optionalChain([shape, 'access', _623 => _623.textBox, 'optionalAccess', _624 => _624.insetPx]);
|
|
9531
|
+
const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _625 => _625.left]), () => ( 6))) * zoomFactor;
|
|
9532
|
+
const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _626 => _626.right]), () => ( 6))) * zoomFactor;
|
|
9533
|
+
const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _627 => _627.top]), () => ( 4))) * zoomFactor;
|
|
9534
|
+
const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _628 => _628.bottom]), () => ( 4))) * zoomFactor;
|
|
9458
9535
|
const textLeft = left + paddingLeft;
|
|
9459
9536
|
const textTop = top + paddingTop;
|
|
9460
9537
|
const textWidth = Math.max(0, width - paddingLeft - paddingRight);
|
|
@@ -9476,9 +9553,9 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9476
9553
|
});
|
|
9477
9554
|
const totalTextHeight = lineMetrics.reduce((total, metric) => total + metric.lineHeight, 0);
|
|
9478
9555
|
let y = textTop;
|
|
9479
|
-
if (_optionalChain([shape, 'access',
|
|
9556
|
+
if (_optionalChain([shape, 'access', _629 => _629.textBox, 'optionalAccess', _630 => _630.verticalAlign]) === "middle") {
|
|
9480
9557
|
y = textTop + Math.max(0, (textHeight - totalTextHeight) / 2);
|
|
9481
|
-
} else if (_optionalChain([shape, 'access',
|
|
9558
|
+
} else if (_optionalChain([shape, 'access', _631 => _631.textBox, 'optionalAccess', _632 => _632.verticalAlign]) === "bottom") {
|
|
9482
9559
|
y = textTop + Math.max(0, textHeight - totalTextHeight);
|
|
9483
9560
|
}
|
|
9484
9561
|
context.save();
|
|
@@ -9489,7 +9566,7 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9489
9566
|
shape.paragraphs.forEach((paragraph, paragraphIndex) => {
|
|
9490
9567
|
const metric = _nullishCoalesce(lineMetrics[paragraphIndex], () => ( { lineHeight: 14 * zoomFactor, widthPx: 0 }));
|
|
9491
9568
|
let x = textLeft;
|
|
9492
|
-
const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access',
|
|
9569
|
+
const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _633 => _633.textBox, 'optionalAccess', _634 => _634.horizontalAlign]))), () => ( "left"));
|
|
9493
9570
|
if (align === "center") {
|
|
9494
9571
|
x = textLeft + Math.max(0, (textWidth - metric.widthPx) / 2);
|
|
9495
9572
|
} else if (align === "right") {
|
|
@@ -9518,11 +9595,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
9518
9595
|
context.restore();
|
|
9519
9596
|
}
|
|
9520
9597
|
function drawStaticShape(context, shape, rect, zoomFactor) {
|
|
9521
|
-
const fillColor = _optionalChain([shape, 'access',
|
|
9522
|
-
const strokeColor = _optionalChain([shape, 'access',
|
|
9523
|
-
const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access',
|
|
9598
|
+
const fillColor = _optionalChain([shape, 'access', _635 => _635.fill, 'optionalAccess', _636 => _636.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _637 => _637.fill, 'optionalAccess', _638 => _638.color]), () => ( "transparent"));
|
|
9599
|
+
const strokeColor = _optionalChain([shape, 'access', _639 => _639.stroke, 'optionalAccess', _640 => _640.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _641 => _641.stroke, 'optionalAccess', _642 => _642.color]), () => ( "transparent"));
|
|
9600
|
+
const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _643 => _643.stroke, 'optionalAccess', _644 => _644.widthPx]), () => ( (shape.geometry === "line" ? 2 : 1)))) * zoomFactor);
|
|
9524
9601
|
const vectorShape = resolveShapeVector(shape);
|
|
9525
|
-
const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access',
|
|
9602
|
+
const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _645 => _645.fill, 'optionalAccess', _646 => _646.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _647 => _647.stroke, 'optionalAccess', _648 => _648.opacity]), () => ( 1)));
|
|
9526
9603
|
context.save();
|
|
9527
9604
|
context.translate(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
9528
9605
|
if (shape.rotationDeg) {
|
|
@@ -9533,7 +9610,7 @@ function drawStaticShape(context, shape, rect, zoomFactor) {
|
|
|
9533
9610
|
context.lineWidth = lineWidth;
|
|
9534
9611
|
context.strokeStyle = strokeColor;
|
|
9535
9612
|
context.fillStyle = fillColor;
|
|
9536
|
-
applyCanvasShapeDash(context, _optionalChain([shape, 'access',
|
|
9613
|
+
applyCanvasShapeDash(context, _optionalChain([shape, 'access', _649 => _649.stroke, 'optionalAccess', _650 => _650.dash]), lineWidth);
|
|
9537
9614
|
const localLeft = -rect.width / 2;
|
|
9538
9615
|
const localTop = -rect.height / 2;
|
|
9539
9616
|
if (vectorShape && typeof Path2D !== "undefined") {
|
|
@@ -9670,7 +9747,7 @@ function drawStaticFormControl(context, control2, rect, palette, zoomFactor, she
|
|
|
9670
9747
|
context.restore();
|
|
9671
9748
|
}
|
|
9672
9749
|
function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCache) {
|
|
9673
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
9750
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _651 => _651.conditionalFormatRules]), () => ( []));
|
|
9674
9751
|
const matchingRule = rules.find(
|
|
9675
9752
|
(rule) => rule.kind === "dataBar" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
|
|
9676
9753
|
);
|
|
@@ -9708,23 +9785,23 @@ function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCa
|
|
|
9708
9785
|
const span = maxValue - minValue;
|
|
9709
9786
|
const ratio = span === 0 ? numericValue >= maxValue ? 1 : 0 : (numericValue - minValue) / span;
|
|
9710
9787
|
const widthPercent = minLength + Math.max(0, Math.min(1, ratio)) * (maxLength - minLength);
|
|
9711
|
-
const color =
|
|
9788
|
+
const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.color, _optionalChain([sheet, 'optionalAccess', _652 => _652.themePalette]));
|
|
9712
9789
|
if (!color || widthPercent <= 0) {
|
|
9713
9790
|
return null;
|
|
9714
9791
|
}
|
|
9715
9792
|
return {
|
|
9716
|
-
axisColor: _nullishCoalesce(
|
|
9793
|
+
axisColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _653 => _653.themePalette])), () => ( void 0)),
|
|
9717
9794
|
border: _nullishCoalesce(matchingRule.border, () => ( void 0)),
|
|
9718
|
-
borderColor: _nullishCoalesce(
|
|
9795
|
+
borderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _654 => _654.themePalette])), () => ( void 0)),
|
|
9719
9796
|
color,
|
|
9720
9797
|
gradient: _nullishCoalesce(matchingRule.gradient, () => ( void 0)),
|
|
9721
|
-
negativeBorderColor: _nullishCoalesce(
|
|
9722
|
-
negativeFillColor: _nullishCoalesce(
|
|
9798
|
+
negativeBorderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _655 => _655.themePalette])), () => ( void 0)),
|
|
9799
|
+
negativeFillColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _656 => _656.themePalette])), () => ( void 0)),
|
|
9723
9800
|
widthPercent
|
|
9724
9801
|
};
|
|
9725
9802
|
}
|
|
9726
9803
|
function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metricsCache) {
|
|
9727
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
9804
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _657 => _657.conditionalFormatRules]), () => ( []));
|
|
9728
9805
|
const matchingRule = rules.find(
|
|
9729
9806
|
(rule) => rule.kind === "colorScale" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
|
|
9730
9807
|
);
|
|
@@ -9752,7 +9829,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
|
|
|
9752
9829
|
});
|
|
9753
9830
|
metricsCache.set(cacheKey, ruleValues);
|
|
9754
9831
|
}
|
|
9755
|
-
const colors = matchingRule.colors.map((color) =>
|
|
9832
|
+
const colors = matchingRule.colors.map((color) => _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, color, _optionalChain([sheet, 'optionalAccess', _658 => _658.themePalette]))).filter((color) => typeof color === "string");
|
|
9756
9833
|
const thresholds = matchingRule.cfvos.map((threshold) => resolveConditionalRuleThreshold(threshold, ruleValues)).filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
9757
9834
|
if (colors.length < 2 || thresholds.length < 2) {
|
|
9758
9835
|
return null;
|
|
@@ -9771,7 +9848,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
|
|
|
9771
9848
|
return { color: resolvedColor };
|
|
9772
9849
|
}
|
|
9773
9850
|
function resolveConditionalIconForCell(row2, col, worksheet, sheet, metricsCache) {
|
|
9774
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
9851
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _659 => _659.conditionalFormatRules]), () => ( []));
|
|
9775
9852
|
const matchingRule = rules.find(
|
|
9776
9853
|
(rule) => rule.kind === "iconSet" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
|
|
9777
9854
|
);
|
|
@@ -9916,7 +9993,7 @@ function GridRow({
|
|
|
9916
9993
|
style: {
|
|
9917
9994
|
bottom: 0,
|
|
9918
9995
|
cursor: "row-resize",
|
|
9919
|
-
height:
|
|
9996
|
+
height: HEADER_RESIZE_HANDLE_PX,
|
|
9920
9997
|
left: 0,
|
|
9921
9998
|
position: "absolute",
|
|
9922
9999
|
width: "100%",
|
|
@@ -10073,7 +10150,7 @@ function GridRow({
|
|
|
10073
10150
|
whiteSpace: "nowrap",
|
|
10074
10151
|
width: "max-content"
|
|
10075
10152
|
} : null;
|
|
10076
|
-
const title = [_optionalChain([cellData, 'access',
|
|
10153
|
+
const title = [_optionalChain([cellData, 'access', _660 => _660.hyperlink, 'optionalAccess', _661 => _661.tooltip]), _optionalChain([cellData, 'access', _662 => _662.validation, 'optionalAccess', _663 => _663.message]), cellData.value].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join("\n");
|
|
10077
10154
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
10078
10155
|
"td",
|
|
10079
10156
|
{
|
|
@@ -10258,12 +10335,12 @@ function GridRow({
|
|
|
10258
10335
|
) : null
|
|
10259
10336
|
] });
|
|
10260
10337
|
}
|
|
10261
|
-
var MemoGridRow =
|
|
10338
|
+
var MemoGridRow = React15.memo(GridRow, (prev, next) => {
|
|
10262
10339
|
if (prev.actualRow !== next.actualRow || prev.rowHeight !== next.rowHeight || prev.headerLabelLiveScale !== next.headerLabelLiveScale || 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.onEditingBlur !== next.onEditingBlur || prev.onEditingCancel !== next.onEditingCancel || prev.onEditingCommit !== next.onEditingCommit || prev.onEditingNavigate !== next.onEditingNavigate || prev.onEditingValueChange !== next.onEditingValueChange || prev.onRowHeaderRef !== next.onRowHeaderRef || prev.onRowPointerDown !== next.onRowPointerDown || prev.onRowResizeDoubleClick !== next.onRowResizeDoubleClick || prev.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment || prev.cellEditorStyle !== next.cellEditorStyle || prev.onFocusEditorOverlay !== next.onFocusEditorOverlay) {
|
|
10263
10340
|
return false;
|
|
10264
10341
|
}
|
|
10265
|
-
const prevEditingCol = _optionalChain([prev, 'access',
|
|
10266
|
-
const nextEditingCol = _optionalChain([next, 'access',
|
|
10342
|
+
const prevEditingCol = _optionalChain([prev, 'access', _664 => _664.editingCell, 'optionalAccess', _665 => _665.row]) === prev.actualRow ? prev.editingCell.col : -1;
|
|
10343
|
+
const nextEditingCol = _optionalChain([next, 'access', _666 => _666.editingCell, 'optionalAccess', _667 => _667.row]) === next.actualRow ? next.editingCell.col : -1;
|
|
10267
10344
|
if (prevEditingCol !== nextEditingCol) {
|
|
10268
10345
|
return false;
|
|
10269
10346
|
}
|
|
@@ -10287,7 +10364,7 @@ function XlsxViewerProvider({ children: children2, controller, isDark = false, .
|
|
|
10287
10364
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, XlsxViewerProviderWithInlineController, { ...options2, isDark, children: children2 });
|
|
10288
10365
|
}
|
|
10289
10366
|
function useXlsxViewer() {
|
|
10290
|
-
const context =
|
|
10367
|
+
const context = React15.useContext(ViewerContext);
|
|
10291
10368
|
if (!context) {
|
|
10292
10369
|
throw new Error("useXlsxViewer must be used inside XlsxViewer or XlsxViewerProvider.");
|
|
10293
10370
|
}
|
|
@@ -10301,9 +10378,11 @@ function useXlsxViewerSelection() {
|
|
|
10301
10378
|
selectedRangeAddress,
|
|
10302
10379
|
selectCell,
|
|
10303
10380
|
selectRange,
|
|
10381
|
+
selectRanges,
|
|
10382
|
+
selectionRanges,
|
|
10304
10383
|
selection
|
|
10305
10384
|
} = useXlsxViewer();
|
|
10306
|
-
return
|
|
10385
|
+
return React15.useMemo(
|
|
10307
10386
|
() => ({
|
|
10308
10387
|
activeCell,
|
|
10309
10388
|
activeCellAddress,
|
|
@@ -10311,9 +10390,18 @@ function useXlsxViewerSelection() {
|
|
|
10311
10390
|
selectedRangeAddress,
|
|
10312
10391
|
selectCell,
|
|
10313
10392
|
selectRange,
|
|
10393
|
+
selectRanges,
|
|
10394
|
+
selectionRanges,
|
|
10314
10395
|
selection
|
|
10315
10396
|
}),
|
|
10316
|
-
[activeCell, activeCellAddress, clearSelection, selectedRangeAddress, selectCell, selectRange, selection]
|
|
10397
|
+
[activeCell, activeCellAddress, clearSelection, selectedRangeAddress, selectCell, selectRange, selectRanges, selectionRanges, selection]
|
|
10398
|
+
);
|
|
10399
|
+
}
|
|
10400
|
+
function useXlsxViewerLayout() {
|
|
10401
|
+
const { canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
|
|
10402
|
+
return React15.useMemo(
|
|
10403
|
+
() => ({ canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
|
|
10404
|
+
[canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
|
|
10317
10405
|
);
|
|
10318
10406
|
}
|
|
10319
10407
|
function useXlsxViewerZoom() {
|
|
@@ -10329,7 +10417,7 @@ function useXlsxViewerZoom() {
|
|
|
10329
10417
|
zoomOut,
|
|
10330
10418
|
zoomScale
|
|
10331
10419
|
} = useXlsxViewer();
|
|
10332
|
-
return
|
|
10420
|
+
return React15.useMemo(
|
|
10333
10421
|
() => ({
|
|
10334
10422
|
canZoomIn,
|
|
10335
10423
|
canZoomOut,
|
|
@@ -10398,7 +10486,7 @@ function useXlsxViewerEditing() {
|
|
|
10398
10486
|
unmergeSelection,
|
|
10399
10487
|
updateFormControl
|
|
10400
10488
|
} = useXlsxViewer();
|
|
10401
|
-
return
|
|
10489
|
+
return React15.useMemo(
|
|
10402
10490
|
() => ({
|
|
10403
10491
|
addFormControl,
|
|
10404
10492
|
addSheet,
|
|
@@ -10485,7 +10573,7 @@ function useXlsxViewerEditing() {
|
|
|
10485
10573
|
}
|
|
10486
10574
|
function useXlsxViewerTables() {
|
|
10487
10575
|
const { sortState, sortTable, tables } = useXlsxViewer();
|
|
10488
|
-
return
|
|
10576
|
+
return React15.useMemo(
|
|
10489
10577
|
() => ({
|
|
10490
10578
|
sortState,
|
|
10491
10579
|
sortTable,
|
|
@@ -10496,7 +10584,7 @@ function useXlsxViewerTables() {
|
|
|
10496
10584
|
}
|
|
10497
10585
|
function useXlsxViewerPivots() {
|
|
10498
10586
|
const { pivotTables, pivotFieldListVisible, setPivotFieldListVisible, getPivotSourceFields, getPivotTableAtCell, upsertPivotTable, refreshPivotTable, refreshAllPivotTables, removePivotTable, pivotDrillDown, showPivotDetails, createPivotChart, togglePivotGroup } = useXlsxViewer();
|
|
10499
|
-
return
|
|
10587
|
+
return React15.useMemo(() => ({
|
|
10500
10588
|
pivotTables,
|
|
10501
10589
|
pivotFieldListVisible,
|
|
10502
10590
|
setPivotFieldListVisible,
|
|
@@ -10550,7 +10638,7 @@ function useXlsxViewerImages() {
|
|
|
10550
10638
|
setImageRect,
|
|
10551
10639
|
updateChart
|
|
10552
10640
|
} = useXlsxViewer();
|
|
10553
|
-
return
|
|
10641
|
+
return React15.useMemo(
|
|
10554
10642
|
() => ({
|
|
10555
10643
|
arrangeDrawing,
|
|
10556
10644
|
changeChartType,
|
|
@@ -10652,7 +10740,7 @@ function useXlsxViewerCharts() {
|
|
|
10652
10740
|
tabs,
|
|
10653
10741
|
updateChart
|
|
10654
10742
|
} = useXlsxViewer();
|
|
10655
|
-
return
|
|
10743
|
+
return React15.useMemo(
|
|
10656
10744
|
() => ({
|
|
10657
10745
|
activeTab,
|
|
10658
10746
|
activeTabIndex,
|
|
@@ -10725,30 +10813,30 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10725
10813
|
workbook,
|
|
10726
10814
|
sheets
|
|
10727
10815
|
} = useXlsxViewer();
|
|
10728
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
10816
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React15.useContext(ViewerAppearanceContext);
|
|
10729
10817
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
10730
10818
|
const includeHeaders = _nullishCoalesce(options2.includeHeaders, () => ( true));
|
|
10731
10819
|
const resolution = options2.resolution;
|
|
10732
|
-
const thumbnailImageCacheRef =
|
|
10733
|
-
const workerThumbnailRowBatchCacheRef =
|
|
10734
|
-
const workerThumbnailRowBatchRequestRef =
|
|
10820
|
+
const thumbnailImageCacheRef = React15.useRef(/* @__PURE__ */ new Map());
|
|
10821
|
+
const workerThumbnailRowBatchCacheRef = React15.useRef(/* @__PURE__ */ new Map());
|
|
10822
|
+
const workerThumbnailRowBatchRequestRef = React15.useRef(
|
|
10735
10823
|
/* @__PURE__ */ new Map()
|
|
10736
10824
|
);
|
|
10737
|
-
const isMountedRef =
|
|
10738
|
-
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] =
|
|
10739
|
-
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] =
|
|
10740
|
-
|
|
10825
|
+
const isMountedRef = React15.useRef(false);
|
|
10826
|
+
const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React15.useState(0);
|
|
10827
|
+
const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React15.useState(0);
|
|
10828
|
+
React15.useEffect(() => {
|
|
10741
10829
|
isMountedRef.current = true;
|
|
10742
10830
|
return () => {
|
|
10743
10831
|
isMountedRef.current = false;
|
|
10744
10832
|
};
|
|
10745
10833
|
}, []);
|
|
10746
|
-
|
|
10834
|
+
React15.useEffect(() => {
|
|
10747
10835
|
workerThumbnailRowBatchCacheRef.current.clear();
|
|
10748
10836
|
workerThumbnailRowBatchRequestRef.current.clear();
|
|
10749
10837
|
setWorkerThumbnailRowBatchVersion((version) => version + 1);
|
|
10750
10838
|
}, [locale]);
|
|
10751
|
-
|
|
10839
|
+
React15.useEffect(() => {
|
|
10752
10840
|
const currentSheets = new Set(sheets);
|
|
10753
10841
|
for (const sheet of workerThumbnailRowBatchCacheRef.current.keys()) {
|
|
10754
10842
|
if (!currentSheets.has(sheet)) {
|
|
@@ -10761,7 +10849,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10761
10849
|
}
|
|
10762
10850
|
}
|
|
10763
10851
|
}, [sheets]);
|
|
10764
|
-
const getWorkerThumbnailRowBatch =
|
|
10852
|
+
const getWorkerThumbnailRowBatch = React15.useCallback((sheet, startRow, endRow) => {
|
|
10765
10853
|
const cachedBatch = workerThumbnailRowBatchCacheRef.current.get(sheet);
|
|
10766
10854
|
if (cachedBatch && startRow >= cachedBatch.startRow && endRow <= cachedBatch.endRow) {
|
|
10767
10855
|
return cachedBatch;
|
|
@@ -10772,8 +10860,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10772
10860
|
const pendingRequest = workerThumbnailRowBatchRequestRef.current.get(sheet);
|
|
10773
10861
|
if (!pendingRequest) {
|
|
10774
10862
|
const request = {
|
|
10775
|
-
endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess',
|
|
10776
|
-
startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess',
|
|
10863
|
+
endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _668 => _668.endRow]), () => ( endRow))),
|
|
10864
|
+
startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _669 => _669.startRow]), () => ( startRow)))
|
|
10777
10865
|
};
|
|
10778
10866
|
workerThumbnailRowBatchRequestRef.current.set(sheet, request);
|
|
10779
10867
|
void getRowsBatchAsync(
|
|
@@ -10803,7 +10891,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10803
10891
|
}
|
|
10804
10892
|
return null;
|
|
10805
10893
|
}, [getRowsBatchAsync]);
|
|
10806
|
-
const getThumbnailImage =
|
|
10894
|
+
const getThumbnailImage = React15.useCallback((image) => {
|
|
10807
10895
|
if (typeof Image === "undefined") {
|
|
10808
10896
|
return null;
|
|
10809
10897
|
}
|
|
@@ -10835,9 +10923,9 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10835
10923
|
imageElement.src = image.src;
|
|
10836
10924
|
return null;
|
|
10837
10925
|
}, []);
|
|
10838
|
-
const thumbnails =
|
|
10926
|
+
const thumbnails = React15.useMemo(() => {
|
|
10839
10927
|
return sheets.map((sheet, sheetIndex) => {
|
|
10840
|
-
const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess',
|
|
10928
|
+
const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _670 => _670.getSheet, 'call', _671 => _671(sheet.workbookSheetIndex)]), () => ( null));
|
|
10841
10929
|
const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
|
|
10842
10930
|
const sheetShapes = getSheetShapes(sheetIndex);
|
|
10843
10931
|
const sheetFormControls = getSheetFormControls(sheetIndex).filter((control2) => !control2.hidden);
|
|
@@ -10853,18 +10941,18 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10853
10941
|
minRow: 0
|
|
10854
10942
|
}));
|
|
10855
10943
|
return {
|
|
10856
|
-
maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
10857
|
-
maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
10858
|
-
minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
10859
|
-
minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
10944
|
+
maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _672 => _672.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
|
|
10945
|
+
maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _673 => _673.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
|
|
10946
|
+
minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _674 => _674.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
|
|
10947
|
+
minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _675 => _675.minRow]), () => ( drawingBound.minRow)), drawingBound.minRow)
|
|
10860
10948
|
};
|
|
10861
10949
|
}, null);
|
|
10862
10950
|
const sheetMinUsedRow = (_nullishCoalesce(sheet.maxUsedRow, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedRow, () => ( 0))) ? _nullishCoalesce(sheet.minUsedRow, () => ( 0)) : void 0;
|
|
10863
10951
|
const sheetMinUsedCol = (_nullishCoalesce(sheet.maxUsedCol, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedCol, () => ( 0))) ? _nullishCoalesce(sheet.minUsedCol, () => ( 0)) : void 0;
|
|
10864
|
-
const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess',
|
|
10865
|
-
const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess',
|
|
10866
|
-
const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess',
|
|
10867
|
-
const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess',
|
|
10952
|
+
const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _676 => _676.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _677 => _677.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
|
|
10953
|
+
const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _678 => _678.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _679 => _679.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
|
|
10954
|
+
const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _680 => _680.maxRow]), () => ( -1)));
|
|
10955
|
+
const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _681 => _681.maxCol]), () => ( -1)));
|
|
10868
10956
|
const showGridLines = _nullishCoalesce(sheet.showGridLines, () => ( true));
|
|
10869
10957
|
const hiddenRowSet = new Set(_nullishCoalesce(sheet.hiddenRows, () => ( [])));
|
|
10870
10958
|
const hiddenColSet = new Set(_nullishCoalesce(sheet.hiddenCols, () => ( [])));
|
|
@@ -10885,13 +10973,13 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10885
10973
|
const width = worksheet.getColumnWidth(actualCol);
|
|
10886
10974
|
if (width !== void 0 && width !== null) {
|
|
10887
10975
|
return Math.max(
|
|
10888
|
-
|
|
10976
|
+
_chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkXZJLPW64cjs.resolveSheetColumnWidthPixels.call(void 0, width, sheet.columnWidthCharacterWidthPx), showGridLines),
|
|
10889
10977
|
DEFAULT_COL_WIDTH2 / 2
|
|
10890
10978
|
);
|
|
10891
10979
|
}
|
|
10892
10980
|
}
|
|
10893
10981
|
return Math.max(
|
|
10894
|
-
|
|
10982
|
+
_chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
|
|
10895
10983
|
_nullishCoalesce(_nullishCoalesce(sheet.colWidthOverridesPx[actualCol], () => ( sheet.defaultColWidthPx)), () => ( DEFAULT_COL_WIDTH2)),
|
|
10896
10984
|
showGridLines
|
|
10897
10985
|
),
|
|
@@ -10903,13 +10991,13 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
10903
10991
|
const height = worksheet.getRowHeight(actualRow);
|
|
10904
10992
|
if (height !== void 0 && height !== null) {
|
|
10905
10993
|
return Math.max(
|
|
10906
|
-
|
|
10994
|
+
_chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkXZJLPW64cjs.resolveSheetRowHeightPixels.call(void 0, height), showGridLines),
|
|
10907
10995
|
DEFAULT_ROW_HEIGHT2 / 1.5
|
|
10908
10996
|
);
|
|
10909
10997
|
}
|
|
10910
10998
|
}
|
|
10911
10999
|
return Math.max(
|
|
10912
|
-
|
|
11000
|
+
_chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
|
|
10913
11001
|
_nullishCoalesce(_nullishCoalesce(sheet.rowHeightOverridesPx[actualRow], () => ( sheet.defaultRowHeightPx)), () => ( DEFAULT_ROW_HEIGHT2)),
|
|
10914
11002
|
showGridLines
|
|
10915
11003
|
),
|
|
@@ -11077,8 +11165,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11077
11165
|
return cached;
|
|
11078
11166
|
}
|
|
11079
11167
|
const batchCoversRow = workerRowBatch ? row2 >= workerRowBatch.startRow && row2 <= workerRowBatch.endRow : false;
|
|
11080
|
-
const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess',
|
|
11081
|
-
if (_optionalChain([batchedCell, 'optionalAccess',
|
|
11168
|
+
const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _682 => _682.cells, 'access', _683 => _683.get, 'call', _684 => _684(cacheKey)]) : void 0;
|
|
11169
|
+
if (_optionalChain([batchedCell, 'optionalAccess', _685 => _685.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _686 => _686.isMergedSecondary, 'call', _687 => _687(row2, col)])) {
|
|
11082
11170
|
const mergedSecondaryData = {
|
|
11083
11171
|
isMergedSecondary: true,
|
|
11084
11172
|
style: {},
|
|
@@ -11087,23 +11175,23 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11087
11175
|
cellRenderCache.set(cacheKey, mergedSecondaryData);
|
|
11088
11176
|
return mergedSecondaryData;
|
|
11089
11177
|
}
|
|
11090
|
-
const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
11178
|
+
const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _688 => _688.mergeSpan]);
|
|
11091
11179
|
const inheritedStyle = resolveInheritedCellStyle2(sheet, row2, col);
|
|
11092
|
-
const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
11180
|
+
const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _689 => _689.style]), () => ( null));
|
|
11093
11181
|
const mergedStyle = mergeResolvedCellStyle(inheritedStyle, worksheetStyle, { replaceXfSubtrees: true });
|
|
11094
11182
|
const conditionalCellStyle = resolveConditionalCellStyleForCell(
|
|
11095
11183
|
row2,
|
|
11096
11184
|
col,
|
|
11097
11185
|
sheet,
|
|
11098
11186
|
() => worksheet ? getCellNumericValue(worksheet, row2, col) : getBatchedCellNumericValue(batchedCell),
|
|
11099
|
-
() => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
11187
|
+
() => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _690 => _690.value]), () => ( "")),
|
|
11100
11188
|
worksheet,
|
|
11101
|
-
_optionalChain([workerRowBatch, 'optionalAccess',
|
|
11189
|
+
_optionalChain([workerRowBatch, 'optionalAccess', _691 => _691.cells])
|
|
11102
11190
|
);
|
|
11103
11191
|
const finalResolvedStyle = mergeResolvedCellStyle(mergedStyle, conditionalCellStyle);
|
|
11104
|
-
const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess',
|
|
11192
|
+
const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _692 => _692.alignment]);
|
|
11105
11193
|
const sparkline = _nullishCoalesce(sparklineByCell.get(cacheKey), () => ( null));
|
|
11106
|
-
const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess',
|
|
11194
|
+
const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _693 => _693.cells, 'access', _694 => _694.get, 'call', _695 => _695(`${targetRow}:${targetCol}`)]));
|
|
11107
11195
|
const sparklineValues = sparkline ? sparkline.range.start.row === sparkline.range.end.row ? Array.from(
|
|
11108
11196
|
{ length: Math.abs(sparkline.range.end.col - sparkline.range.start.col) + 1 },
|
|
11109
11197
|
(_, index) => getNumericValue(
|
|
@@ -11117,26 +11205,26 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11117
11205
|
sparkline.range.start.col
|
|
11118
11206
|
)
|
|
11119
11207
|
) : null;
|
|
11120
|
-
const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess',
|
|
11208
|
+
const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _696 => _696.cellControl]) ? worksheet ? getCellBooleanValue(worksheet, row2, col) : getBatchedCellBooleanValue(batchedCell) : null;
|
|
11121
11209
|
const nextData = {
|
|
11122
11210
|
canvas: void 0,
|
|
11123
11211
|
checkboxState,
|
|
11124
|
-
colSpan: _optionalChain([merge, 'optionalAccess',
|
|
11212
|
+
colSpan: _optionalChain([merge, 'optionalAccess', _697 => _697.colSpan]),
|
|
11125
11213
|
conditionalColorScale: worksheet ? resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
11126
11214
|
conditionalDataBar: worksheet ? resolveConditionalDataBarForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
11127
11215
|
conditionalIcon: worksheet ? resolveConditionalIconForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
11128
11216
|
isMergedSecondary: false,
|
|
11129
|
-
rowSpan: _optionalChain([merge, 'optionalAccess',
|
|
11217
|
+
rowSpan: _optionalChain([merge, 'optionalAccess', _698 => _698.rowSpan]),
|
|
11130
11218
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
11131
11219
|
style: buildCellStyle(finalResolvedStyle, palette, sheet.themePalette, {
|
|
11132
|
-
generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
11220
|
+
generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess', _699 => _699.generalAlignment]),
|
|
11133
11221
|
showGridLines
|
|
11134
11222
|
}),
|
|
11135
|
-
textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess',
|
|
11136
|
-
value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
11223
|
+
textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _700 => _700.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _701 => _701.textRotation])))),
|
|
11224
|
+
value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _702 => _702.value]), () => ( ""))
|
|
11137
11225
|
};
|
|
11138
11226
|
nextData.richText = resolveRichCellRuns(
|
|
11139
|
-
worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
11227
|
+
worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _703 => _703.richText]),
|
|
11140
11228
|
nextData.value,
|
|
11141
11229
|
nextData.style,
|
|
11142
11230
|
sheet.themePalette,
|
|
@@ -11158,11 +11246,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11158
11246
|
let height = rowItem.size;
|
|
11159
11247
|
for (let colOffset = 1; colOffset < colSpan; colOffset += 1) {
|
|
11160
11248
|
const nextCol = colItemByActual.get(colItem.actualIndex + colOffset);
|
|
11161
|
-
width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess',
|
|
11249
|
+
width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _704 => _704.size]), () => ( 0));
|
|
11162
11250
|
}
|
|
11163
11251
|
for (let rowOffset = 1; rowOffset < rowSpan; rowOffset += 1) {
|
|
11164
11252
|
const nextRow = rowItemByActual.get(rowItem.actualIndex + rowOffset);
|
|
11165
|
-
height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess',
|
|
11253
|
+
height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _705 => _705.size]), () => ( 0));
|
|
11166
11254
|
}
|
|
11167
11255
|
const rect = {
|
|
11168
11256
|
height,
|
|
@@ -11172,7 +11260,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11172
11260
|
};
|
|
11173
11261
|
const canvasCellStyle = _nullishCoalesce(cellData.canvas, () => ( buildCanvasCellStyleCache(cellData.style)));
|
|
11174
11262
|
const gradientFill = typeof cellData.style.backgroundImage === "string" ? resolveCanvasGradientFill(context, rect, cellData.style.backgroundImage) : null;
|
|
11175
|
-
const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access',
|
|
11263
|
+
const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _706 => _706.conditionalColorScale, 'optionalAccess', _707 => _707.color]), () => ( (typeof cellData.style.backgroundColor === "string" ? cellData.style.backgroundColor : thumbnailSheetSurface)));
|
|
11176
11264
|
context.fillStyle = _nullishCoalesce(gradientFill, () => ( fillColor));
|
|
11177
11265
|
context.fillRect(rect.left, rect.top, rect.width, rect.height);
|
|
11178
11266
|
if (cellData.conditionalDataBar) {
|
|
@@ -11418,11 +11506,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11418
11506
|
locale,
|
|
11419
11507
|
workbook
|
|
11420
11508
|
]);
|
|
11421
|
-
const paintThumbnail =
|
|
11422
|
-
(sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access',
|
|
11509
|
+
const paintThumbnail = React15.useCallback(
|
|
11510
|
+
(sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _708 => _708[sheetIndex], 'optionalAccess', _709 => _709.paint, 'call', _710 => _710(canvas)]), () => ( false)),
|
|
11423
11511
|
[thumbnails]
|
|
11424
11512
|
);
|
|
11425
|
-
return
|
|
11513
|
+
return React15.useMemo(
|
|
11426
11514
|
() => ({
|
|
11427
11515
|
paintThumbnail,
|
|
11428
11516
|
thumbnails
|
|
@@ -11432,7 +11520,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
|
|
|
11432
11520
|
}
|
|
11433
11521
|
function DefaultXlsxToolbar({ pivotTableEditor } = {}) {
|
|
11434
11522
|
const controller = useXlsxViewer();
|
|
11435
|
-
const { headerBackgroundColor, headerTextColor, isDark } =
|
|
11523
|
+
const { headerBackgroundColor, headerTextColor, isDark } = React15.useContext(ViewerAppearanceContext);
|
|
11436
11524
|
const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
|
|
11437
11525
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultToolbar, { controller, palette, pivotTableEditor });
|
|
11438
11526
|
}
|
|
@@ -11478,7 +11566,7 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
|
|
|
11478
11566
|
}
|
|
11479
11567
|
destroy() {
|
|
11480
11568
|
this.destroyed = true;
|
|
11481
|
-
_optionalChain([this, 'access',
|
|
11569
|
+
_optionalChain([this, 'access', _711 => _711.observer, 'optionalAccess', _712 => _712.disconnect, 'call', _713 => _713()]);
|
|
11482
11570
|
this.observer = null;
|
|
11483
11571
|
this.slots.clear();
|
|
11484
11572
|
this.listeners.clear();
|
|
@@ -11507,9 +11595,9 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
|
|
|
11507
11595
|
}
|
|
11508
11596
|
}, _class2);
|
|
11509
11597
|
function RuntimeContent({ content }) {
|
|
11510
|
-
const hostRef =
|
|
11511
|
-
const rootRef =
|
|
11512
|
-
|
|
11598
|
+
const hostRef = React16.useRef(null);
|
|
11599
|
+
const rootRef = React16.useRef(null);
|
|
11600
|
+
React16.useLayoutEffect(() => {
|
|
11513
11601
|
const host = hostRef.current;
|
|
11514
11602
|
if (!host) return;
|
|
11515
11603
|
const root = _internal.__createContentRoot.call(void 0, host);
|
|
@@ -11519,8 +11607,8 @@ function RuntimeContent({ content }) {
|
|
|
11519
11607
|
root.destroy();
|
|
11520
11608
|
};
|
|
11521
11609
|
}, []);
|
|
11522
|
-
|
|
11523
|
-
_optionalChain([rootRef, 'access',
|
|
11610
|
+
React16.useLayoutEffect(() => {
|
|
11611
|
+
_optionalChain([rootRef, 'access', _714 => _714.current, 'optionalAccess', _715 => _715.update, 'call', _716 => _716(content)]);
|
|
11524
11612
|
}, [content]);
|
|
11525
11613
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: hostRef, style: { display: "contents" } });
|
|
11526
11614
|
}
|
|
@@ -11582,13 +11670,13 @@ function renderOptions(props, controller, slots, owner) {
|
|
|
11582
11670
|
};
|
|
11583
11671
|
}
|
|
11584
11672
|
function BoundViewer({ props, controller: sourceController }) {
|
|
11585
|
-
const messages =
|
|
11586
|
-
const controller =
|
|
11587
|
-
const hostRef =
|
|
11588
|
-
const viewerRef =
|
|
11589
|
-
const slots =
|
|
11590
|
-
|
|
11591
|
-
|
|
11673
|
+
const messages = React16.useMemo(() => _chunkYOLIVKZDcjs.mergeMessages.call(void 0, sourceController.messages, props.messages), [sourceController.messages, props.messages]);
|
|
11674
|
+
const controller = React16.useMemo(() => ({ ...sourceController, messages }), [sourceController, messages]);
|
|
11675
|
+
const hostRef = React16.useRef(null);
|
|
11676
|
+
const viewerRef = React16.useRef(null);
|
|
11677
|
+
const slots = React16.useMemo(() => new SlotStore(), []);
|
|
11678
|
+
React16.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
|
|
11679
|
+
React16.useLayoutEffect(() => {
|
|
11592
11680
|
const host = hostRef.current;
|
|
11593
11681
|
if (!host) return;
|
|
11594
11682
|
slots.observe(host);
|
|
@@ -11600,9 +11688,9 @@ function BoundViewer({ props, controller: sourceController }) {
|
|
|
11600
11688
|
slots.destroy();
|
|
11601
11689
|
};
|
|
11602
11690
|
}, [slots]);
|
|
11603
|
-
|
|
11691
|
+
React16.useLayoutEffect(() => {
|
|
11604
11692
|
const host = hostRef.current;
|
|
11605
|
-
if (host) _optionalChain([viewerRef, 'access',
|
|
11693
|
+
if (host) _optionalChain([viewerRef, 'access', _717 => _717.current, 'optionalAccess', _718 => _718.update, 'call', _719 => _719(renderOptions(props, controller, slots, host.ownerDocument))]);
|
|
11606
11694
|
}, [controller, props, slots]);
|
|
11607
11695
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ViewerAppearanceContext.Provider, { value: {
|
|
11608
11696
|
headerBackgroundColor: props.headerBackgroundColor,
|
|
@@ -11618,7 +11706,7 @@ function UncontrolledViewer(props) {
|
|
|
11618
11706
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller });
|
|
11619
11707
|
}
|
|
11620
11708
|
function XlsxViewer(props) {
|
|
11621
|
-
const context =
|
|
11709
|
+
const context = React16.useContext(ViewerContext);
|
|
11622
11710
|
const controller = _nullishCoalesce(props.controller, () => ( context));
|
|
11623
11711
|
return controller ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UncontrolledViewer, { ...props });
|
|
11624
11712
|
}
|
|
@@ -11642,5 +11730,6 @@ function XlsxViewer(props) {
|
|
|
11642
11730
|
|
|
11643
11731
|
|
|
11644
11732
|
|
|
11645
|
-
|
|
11733
|
+
|
|
11734
|
+
exports.DefaultXlsxPivotTableFieldList = DefaultXlsxPivotTableFieldList; exports.DefaultXlsxToolbar = DefaultXlsxToolbar; exports.XlsxFileSizeLimitExceededError = _vanilla.XlsxFileSizeLimitExceededError; exports.XlsxViewer = XlsxViewer; exports.XlsxViewerProvider = XlsxViewerProvider; exports.initWasm = _vanilla.initWasm; exports.parseXlsxRange = _vanilla.parseXlsxRange; exports.setWasmSource = _vanilla.setWasmSource; exports.useXlsxPivotTableEditor = useXlsxPivotTableEditor; exports.useXlsxViewer = useXlsxViewer; exports.useXlsxViewerCharts = useXlsxViewerCharts; exports.useXlsxViewerController = useXlsxViewerController; exports.useXlsxViewerEditing = useXlsxViewerEditing; exports.useXlsxViewerImages = useXlsxViewerImages; exports.useXlsxViewerLayout = useXlsxViewerLayout; exports.useXlsxViewerPivots = useXlsxViewerPivots; exports.useXlsxViewerSelection = useXlsxViewerSelection; exports.useXlsxViewerTables = useXlsxViewerTables; exports.useXlsxViewerThumbnails = useXlsxViewerThumbnails; exports.useXlsxViewerZoom = useXlsxViewerZoom;
|
|
11646
11735
|
//# sourceMappingURL=index.cjs.map
|