@extend-ai/react-xlsx 0.20.3 → 0.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{browser-KWIEUO2X.js → browser-IQ4UDS5M.js} +8 -27
- package/dist/{browser-KWIEUO2X.js.map → browser-IQ4UDS5M.js.map} +1 -1
- package/dist/{browser-B73UAN6E.cjs → browser-S6E2BS5S.cjs} +8 -28
- package/dist/browser-S6E2BS5S.cjs.map +1 -0
- package/dist/{chart-renderer-XBF7EPUS.js → chart-renderer-4HTNG3SX.js} +94 -180
- package/dist/chart-renderer-4HTNG3SX.js.map +1 -0
- package/dist/{chart-renderer-ZLJVPLGN.js → chart-renderer-5IN2B3YS.js} +86 -172
- package/dist/chart-renderer-5IN2B3YS.js.map +1 -0
- package/dist/{chart-renderer-2EKXNHUD.cjs → chart-renderer-6CWSXOSC.cjs} +324 -410
- package/dist/chart-renderer-6CWSXOSC.cjs.map +1 -0
- package/dist/{chart-renderer-W7XW24JI.cjs → chart-renderer-H4BLRO5P.cjs} +321 -407
- package/dist/chart-renderer-H4BLRO5P.cjs.map +1 -0
- package/dist/chunk-GX5LAENE.cjs +108 -0
- package/dist/chunk-GX5LAENE.cjs.map +1 -0
- package/dist/{chunk-HEEFCVWS.js → chunk-H62SZBEY.js} +401 -132
- package/dist/chunk-H62SZBEY.js.map +1 -0
- package/dist/{chunk-VG4JELEQ.js → chunk-IISMO3AX.js} +30 -15
- package/dist/chunk-IISMO3AX.js.map +1 -0
- package/dist/{chunk-XISBYOD5.cjs → chunk-KQSUAIZD.cjs} +1168 -899
- package/dist/chunk-KQSUAIZD.cjs.map +1 -0
- package/dist/{chunk-HKMFMIKE.js → chunk-LZXL5E4W.js} +16 -7
- package/dist/chunk-LZXL5E4W.js.map +1 -0
- package/dist/chunk-MYN475JP.cjs +32 -0
- package/dist/chunk-MYN475JP.cjs.map +1 -0
- package/dist/{chunk-WGRRI25I.cjs → chunk-NAYVSTCX.cjs} +22 -9
- package/dist/chunk-NAYVSTCX.cjs.map +1 -0
- package/dist/chunk-PK3MCNDK.js +32 -0
- package/dist/chunk-PK3MCNDK.js.map +1 -0
- package/dist/full-3FSPB3R6.cjs +212 -0
- package/dist/full-3FSPB3R6.cjs.map +1 -0
- package/dist/full-GPY27HZY.js +209 -0
- package/dist/full-GPY27HZY.js.map +1 -0
- package/dist/index.cjs +834 -602
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +347 -115
- package/dist/index.js.map +1 -1
- package/dist/{internal-BJsg5os3.d.cts → internal-Cks9H21d.d.cts} +56 -1
- package/dist/{internal-BJsg5os3.d.ts → internal-Cks9H21d.d.ts} +56 -1
- package/dist/internal.cjs +3 -3
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +2 -2
- package/dist/office_charts_bg.wasm +0 -0
- package/dist/office_charts_full_bg.wasm +0 -0
- package/dist/payload-B55ZKNYO.js +6 -0
- package/dist/payload-B55ZKNYO.js.map +1 -0
- package/dist/payload-E2KM77DZ.js +6 -0
- package/dist/payload-E2KM77DZ.js.map +1 -0
- package/dist/payload-K4S5RLJN.cjs +8 -0
- package/dist/payload-K4S5RLJN.cjs.map +1 -0
- package/dist/payload-PL4646XV.cjs +8 -0
- package/dist/payload-PL4646XV.cjs.map +1 -0
- package/dist/{shared-chart-3STFRVWT.js → shared-chart-5KTGZEZ5.js} +38 -20
- package/dist/shared-chart-5KTGZEZ5.js.map +1 -0
- package/dist/{shared-chart-DVC5S2P6.cjs → shared-chart-ACR4M7BP.cjs} +37 -20
- package/dist/shared-chart-ACR4M7BP.cjs.map +1 -0
- package/dist/{shared-chart-BFQNYOIQ.js → shared-chart-EGN5JTKT.js} +37 -20
- package/dist/shared-chart-EGN5JTKT.js.map +1 -0
- package/dist/{shared-chart-MFQSQG4K.cjs → shared-chart-XAV7VA45.cjs} +37 -19
- package/dist/shared-chart-XAV7VA45.cjs.map +1 -0
- package/dist/{surface-regl-R2N54JT2.js → surface-webgl-2ZZ6JQR2.js} +87 -151
- package/dist/surface-webgl-2ZZ6JQR2.js.map +1 -0
- package/dist/{surface-regl-BBJ6OIKK.cjs → surface-webgl-3HS6VBCK.cjs} +88 -152
- package/dist/surface-webgl-3HS6VBCK.cjs.map +1 -0
- package/dist/{surface-regl-7CDGGVDG.js → surface-webgl-4DQXDDXU.js} +87 -151
- package/dist/surface-webgl-4DQXDDXU.js.map +1 -0
- package/dist/{surface-regl-SUJ2TFZA.cjs → surface-webgl-SVYD564V.cjs} +88 -152
- package/dist/surface-webgl-SVYD564V.cjs.map +1 -0
- package/dist/vanilla.cjs +3 -3
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +2 -2
- package/dist/xlsx-worker.js +298 -92
- package/dist/xlsx-worker.js.map +1 -1
- package/package.json +6 -15
- package/dist/browser-B73UAN6E.cjs.map +0 -1
- package/dist/chart-renderer-2EKXNHUD.cjs.map +0 -1
- package/dist/chart-renderer-W7XW24JI.cjs.map +0 -1
- package/dist/chart-renderer-XBF7EPUS.js.map +0 -1
- package/dist/chart-renderer-ZLJVPLGN.js.map +0 -1
- package/dist/chunk-6IGWCJU5.cjs +0 -90
- package/dist/chunk-6IGWCJU5.cjs.map +0 -1
- package/dist/chunk-HEEFCVWS.js.map +0 -1
- package/dist/chunk-HKMFMIKE.js.map +0 -1
- package/dist/chunk-VG4JELEQ.js.map +0 -1
- package/dist/chunk-WGRRI25I.cjs.map +0 -1
- package/dist/chunk-XISBYOD5.cjs.map +0 -1
- package/dist/payload-JBPE7GEG.cjs +0 -8
- package/dist/payload-JBPE7GEG.cjs.map +0 -1
- package/dist/payload-KYNCVJT5.js +0 -6
- package/dist/payload-KYNCVJT5.js.map +0 -1
- package/dist/region-map-geography-24TXETDP.cjs +0 -184
- package/dist/region-map-geography-24TXETDP.cjs.map +0 -1
- package/dist/region-map-geography-OR6DHAF7.js +0 -182
- package/dist/region-map-geography-OR6DHAF7.js.map +0 -1
- package/dist/shared-chart-3STFRVWT.js.map +0 -1
- package/dist/shared-chart-BFQNYOIQ.js.map +0 -1
- package/dist/shared-chart-DVC5S2P6.cjs.map +0 -1
- package/dist/shared-chart-MFQSQG4K.cjs.map +0 -1
- package/dist/surface-regl-7CDGGVDG.js.map +0 -1
- package/dist/surface-regl-BBJ6OIKK.cjs.map +0 -1
- package/dist/surface-regl-R2N54JT2.js.map +0 -1
- package/dist/surface-regl-SUJ2TFZA.cjs.map +0 -1
- package/dist/world-atlas-LICENSE.txt +0 -13
- /package/dist/{us-atlas-LICENSE.txt → rust-office-charts-MAP-DATA-LICENSE.txt} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;require('./chunk-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;require('./chunk-NAYVSTCX.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -94,6 +94,77 @@ var _internal = require('@extend-ai/react-xlsx/internal');
|
|
|
94
94
|
|
|
95
95
|
var _fflate = require('fflate');
|
|
96
96
|
|
|
97
|
+
// src/chartsheet-payload.ts
|
|
98
|
+
|
|
99
|
+
var REL_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
100
|
+
function readXml(archive, path) {
|
|
101
|
+
const bytes = archive[path];
|
|
102
|
+
if (!bytes || typeof DOMParser === "undefined") return null;
|
|
103
|
+
const document2 = new DOMParser().parseFromString(_fflate.strFromU8.call(void 0, bytes), "application/xml");
|
|
104
|
+
return document2.getElementsByTagName("parsererror").length > 0 ? null : document2;
|
|
105
|
+
}
|
|
106
|
+
function relationshipPath(partPath) {
|
|
107
|
+
const separator = partPath.lastIndexOf("/");
|
|
108
|
+
return `${partPath.slice(0, separator + 1)}_rels/${partPath.slice(separator + 1)}.rels`;
|
|
109
|
+
}
|
|
110
|
+
function resolveTarget(partPath, target) {
|
|
111
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(target) || target.startsWith("//")) return null;
|
|
112
|
+
const segments = target.startsWith("/") ? [] : partPath.split("/").slice(0, -1);
|
|
113
|
+
for (const segment of target.replace(/\\/g, "/").split("/")) {
|
|
114
|
+
if (!segment || segment === ".") continue;
|
|
115
|
+
if (segment === "..") {
|
|
116
|
+
if (segments.length === 0) return null;
|
|
117
|
+
segments.pop();
|
|
118
|
+
} else {
|
|
119
|
+
segments.push(segment);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return segments.join("/");
|
|
123
|
+
}
|
|
124
|
+
function readRelationships(archive, partPath) {
|
|
125
|
+
const relationships = /* @__PURE__ */ new Map();
|
|
126
|
+
const document2 = readXml(archive, relationshipPath(partPath));
|
|
127
|
+
for (const element of Array.from(_nullishCoalesce(_optionalChain([document2, 'optionalAccess', _17 => _17.getElementsByTagNameNS, 'call', _18 => _18("*", "Relationship")]), () => ( [])))) {
|
|
128
|
+
if (element.getAttribute("TargetMode") === "External") continue;
|
|
129
|
+
const id = element.getAttribute("Id");
|
|
130
|
+
const rawTarget = element.getAttribute("Target");
|
|
131
|
+
const type = element.getAttribute("Type");
|
|
132
|
+
const target = rawTarget ? resolveTarget(partPath, rawTarget) : null;
|
|
133
|
+
if (id && type && target && archive[target]) relationships.set(id, { target, type });
|
|
134
|
+
}
|
|
135
|
+
return relationships;
|
|
136
|
+
}
|
|
137
|
+
function collectChartsheetDrawingOrigins(archive, chartsheets) {
|
|
138
|
+
const origins = /* @__PURE__ */ new Map();
|
|
139
|
+
if (chartsheets.length === 0) return origins;
|
|
140
|
+
const workbookPath = "xl/workbook.xml";
|
|
141
|
+
const workbookDocument = readXml(archive, workbookPath);
|
|
142
|
+
const workbookRelationships = readRelationships(archive, workbookPath);
|
|
143
|
+
for (const sheet of Array.from(_nullishCoalesce(_optionalChain([workbookDocument, 'optionalAccess', _19 => _19.getElementsByTagNameNS, 'call', _20 => _20("*", "sheet")]), () => ( [])))) {
|
|
144
|
+
const relationshipId = _nullishCoalesce(sheet.getAttributeNS(REL_NS, "id"), () => ( sheet.getAttribute("r:id")));
|
|
145
|
+
const relationship = relationshipId ? workbookRelationships.get(relationshipId) : null;
|
|
146
|
+
if (!_optionalChain([relationship, 'optionalAccess', _21 => _21.type, 'access', _22 => _22.endsWith, 'call', _23 => _23("/chartsheet")])) continue;
|
|
147
|
+
const chartsheet = chartsheets.find((entry) => entry.name === sheet.getAttribute("name"));
|
|
148
|
+
if (!chartsheet || chartsheet.workbookSheetIndex == null) continue;
|
|
149
|
+
const sheetDocument = readXml(archive, relationship.target);
|
|
150
|
+
const sheetRelationships = readRelationships(archive, relationship.target);
|
|
151
|
+
const attachments = [];
|
|
152
|
+
for (const drawing of Array.from(_nullishCoalesce(_optionalChain([sheetDocument, 'optionalAccess', _24 => _24.getElementsByTagNameNS, 'call', _25 => _25("*", "drawing")]), () => ( [])))) {
|
|
153
|
+
const drawingId = _nullishCoalesce(drawing.getAttributeNS(REL_NS, "id"), () => ( drawing.getAttribute("r:id")));
|
|
154
|
+
const drawingRelationship = drawingId ? sheetRelationships.get(drawingId) : null;
|
|
155
|
+
if (!_optionalChain([drawingRelationship, 'optionalAccess', _26 => _26.type, 'access', _27 => _27.endsWith, 'call', _28 => _28("/drawing")])) continue;
|
|
156
|
+
const drawingRelsPath = relationshipPath(drawingRelationship.target);
|
|
157
|
+
attachments.push({
|
|
158
|
+
drawingPath: drawingRelationship.target,
|
|
159
|
+
drawingRelsPath: archive[drawingRelsPath] ? drawingRelsPath : null,
|
|
160
|
+
mediaPaths: []
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
origins.set(chartsheet.index, { attachments, workbookSheetIndex: chartsheet.workbookSheetIndex });
|
|
164
|
+
}
|
|
165
|
+
return origins;
|
|
166
|
+
}
|
|
167
|
+
|
|
97
168
|
// src/charts.ts
|
|
98
169
|
|
|
99
170
|
var CHART_NS = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
@@ -185,19 +256,19 @@ function splitTopLevelSeriesArguments(value) {
|
|
|
185
256
|
}
|
|
186
257
|
function readSeriesNameFormula(series) {
|
|
187
258
|
const raw = series.raw && typeof series.raw === "object" ? series.raw : null;
|
|
188
|
-
return typeof _optionalChain([raw, 'optionalAccess',
|
|
259
|
+
return typeof _optionalChain([raw, 'optionalAccess', _29 => _29.name]) === "string" && raw.name.length > 0 ? raw.name : null;
|
|
189
260
|
}
|
|
190
261
|
function buildChartSeriesFormula(chart, seriesIndex) {
|
|
191
|
-
const series = _optionalChain([chart, 'optionalAccess',
|
|
262
|
+
const series = _optionalChain([chart, 'optionalAccess', _30 => _30.series, 'access', _31 => _31[seriesIndex]]);
|
|
192
263
|
if (!chart || !series) {
|
|
193
264
|
return "";
|
|
194
265
|
}
|
|
195
266
|
const nameFormula = readSeriesNameFormula(series);
|
|
196
267
|
const nameArgument = _nullishCoalesce(nameFormula, () => ( quoteSeriesFormulaString(_nullishCoalesce(series.name, () => ( `Series ${seriesIndex + 1}`)))));
|
|
197
|
-
const categoryArgument = _nullishCoalesce(_optionalChain([series, 'access',
|
|
198
|
-
const valueArgument = _nullishCoalesce(_optionalChain([series, 'access',
|
|
268
|
+
const categoryArgument = _nullishCoalesce(_optionalChain([series, 'access', _32 => _32.categoriesRef, 'optionalAccess', _33 => _33.formula]), () => ( ""));
|
|
269
|
+
const valueArgument = _nullishCoalesce(_optionalChain([series, 'access', _34 => _34.valuesRef, 'optionalAccess', _35 => _35.formula]), () => ( ""));
|
|
199
270
|
const orderArgument = String(seriesIndex + 1);
|
|
200
|
-
const bubbleArgument = _optionalChain([series, 'access',
|
|
271
|
+
const bubbleArgument = _optionalChain([series, 'access', _36 => _36.bubbleSizeRef, 'optionalAccess', _37 => _37.formula]);
|
|
201
272
|
return [
|
|
202
273
|
`=SERIES(${nameArgument}`,
|
|
203
274
|
categoryArgument,
|
|
@@ -214,7 +285,7 @@ function parseChartSeriesFormula(formula, chart) {
|
|
|
214
285
|
return null;
|
|
215
286
|
}
|
|
216
287
|
const args = splitTopLevelSeriesArguments(match[1]);
|
|
217
|
-
const isBubble = _optionalChain([chart, 'optionalAccess',
|
|
288
|
+
const isBubble = _optionalChain([chart, 'optionalAccess', _38 => _38.chartType]) === "Bubble";
|
|
218
289
|
if (args.length < 4 || args.length > 5 || isBubble && args.length !== 5) {
|
|
219
290
|
return null;
|
|
220
291
|
}
|
|
@@ -244,18 +315,33 @@ function applyChartSeriesFormula(chart, seriesIndex, formula, workbook) {
|
|
|
244
315
|
}
|
|
245
316
|
const categoriesRef = {
|
|
246
317
|
..._nullishCoalesce(currentSeries.categoriesRef, () => ( {})),
|
|
247
|
-
formula: parsed.categoryFormula
|
|
318
|
+
formula: parsed.categoryFormula,
|
|
319
|
+
values: parsed.categoryFormula === _optionalChain([currentSeries, 'access', _39 => _39.categoriesRef, 'optionalAccess', _40 => _40.formula]) ? currentSeries.categoriesRef.values : void 0
|
|
248
320
|
};
|
|
249
321
|
const valuesRef = {
|
|
250
322
|
..._nullishCoalesce(currentSeries.valuesRef, () => ( {})),
|
|
251
|
-
formula: parsed.valueFormula
|
|
323
|
+
formula: parsed.valueFormula,
|
|
324
|
+
values: parsed.valueFormula === _optionalChain([currentSeries, 'access', _41 => _41.valuesRef, 'optionalAccess', _42 => _42.formula]) ? currentSeries.valuesRef.values : void 0
|
|
252
325
|
};
|
|
253
326
|
const bubbleSizeRef = chart.chartType === "Bubble" || parsed.bubbleSizeFormula ? {
|
|
254
327
|
..._nullishCoalesce(currentSeries.bubbleSizeRef, () => ( {})),
|
|
255
|
-
formula: parsed.bubbleSizeFormula
|
|
328
|
+
formula: parsed.bubbleSizeFormula,
|
|
329
|
+
values: parsed.bubbleSizeFormula === _optionalChain([currentSeries, 'access', _43 => _43.bubbleSizeRef, 'optionalAccess', _44 => _44.formula]) ? _optionalChain([currentSeries, 'access', _45 => _45.bubbleSizeRef, 'optionalAccess', _46 => _46.values]) : void 0
|
|
256
330
|
} : _nullishCoalesce(currentSeries.bubbleSizeRef, () => ( null));
|
|
331
|
+
const isUnresolved = (formula2) => Boolean(
|
|
332
|
+
workbook && formula2 && !resolveReferenceSheet(workbook, chart.workbookSheetIndex, formula2).sheet
|
|
333
|
+
);
|
|
334
|
+
const resolveEditedReference = (reference, currentReference, currentValues, mode) => {
|
|
335
|
+
if (!workbook) return currentValues;
|
|
336
|
+
if (_optionalChain([reference, 'optionalAccess', _47 => _47.formula]) === _optionalChain([currentReference, 'optionalAccess', _48 => _48.formula]) && isUnresolved(_optionalChain([reference, 'optionalAccess', _49 => _49.formula]))) return currentValues;
|
|
337
|
+
return resolveReferenceValues(workbook, chart.workbookSheetIndex, reference, mode);
|
|
338
|
+
};
|
|
257
339
|
const raw = {
|
|
258
|
-
..._nullishCoalesce(currentSeries.raw, () => ( {}))
|
|
340
|
+
..._nullishCoalesce(currentSeries.raw, () => ( {})),
|
|
341
|
+
unresolvedCategoriesReference: isUnresolved(categoriesRef.formula),
|
|
342
|
+
unresolvedValuesReference: isUnresolved(valuesRef.formula),
|
|
343
|
+
unresolvedBubbleSizeReference: isUnresolved(_optionalChain([bubbleSizeRef, 'optionalAccess', _50 => _50.formula])),
|
|
344
|
+
unresolvedNameReference: isUnresolved(parsed.nameFormula)
|
|
259
345
|
};
|
|
260
346
|
if (parsed.nameFormula) {
|
|
261
347
|
raw.name = parsed.nameFormula;
|
|
@@ -265,17 +351,21 @@ function applyChartSeriesFormula(chart, seriesIndex, formula, workbook) {
|
|
|
265
351
|
const nextSeries = {
|
|
266
352
|
...currentSeries,
|
|
267
353
|
bubbleSizeRef,
|
|
268
|
-
bubbleSizes:
|
|
269
|
-
categories:
|
|
354
|
+
bubbleSizes: resolveEditedReference(bubbleSizeRef, currentSeries.bubbleSizeRef, _nullishCoalesce(currentSeries.bubbleSizes, () => ( [])), "value").map((value) => typeof value === "number" && Number.isFinite(value) ? value : null),
|
|
355
|
+
categories: resolveEditedReference(categoriesRef, currentSeries.categoriesRef, currentSeries.categories, "category"),
|
|
270
356
|
categoriesRef,
|
|
271
|
-
name: _nullishCoalesce(parsed.nameLiteral, () => ( (parsed.nameFormula && workbook ? resolveSeriesName(workbook, chart.workbookSheetIndex, parsed.nameFormula) : _nullishCoalesce(parsed.nameFormula, () => ( currentSeries.name))))),
|
|
357
|
+
name: _nullishCoalesce(parsed.nameLiteral, () => ( (parsed.nameFormula === _optionalChain([currentSeries, 'access', _51 => _51.raw, 'optionalAccess', _52 => _52.name]) && isUnresolved(parsed.nameFormula) ? currentSeries.name : parsed.nameFormula && workbook ? resolveSeriesName(workbook, chart.workbookSheetIndex, parsed.nameFormula) : _nullishCoalesce(parsed.nameFormula, () => ( currentSeries.name))))),
|
|
272
358
|
raw,
|
|
273
|
-
values:
|
|
359
|
+
values: resolveEditedReference(valuesRef, currentSeries.valuesRef, currentSeries.values, "value").map((value) => typeof value === "number" && Number.isFinite(value) ? value : null),
|
|
274
360
|
valuesRef
|
|
275
361
|
};
|
|
276
362
|
return {
|
|
277
363
|
...chart,
|
|
278
|
-
series: chart.series.map((series, index) => index === seriesIndex ? nextSeries : series)
|
|
364
|
+
series: chart.series.map((series, index) => index === seriesIndex ? nextSeries : series),
|
|
365
|
+
typeGroups: _optionalChain([chart, 'access', _53 => _53.typeGroups, 'optionalAccess', _54 => _54.map, 'call', _55 => _55((group) => ({
|
|
366
|
+
...group,
|
|
367
|
+
series: group.series.map((series) => series.id === currentSeries.id ? nextSeries : series)
|
|
368
|
+
}))])
|
|
279
369
|
};
|
|
280
370
|
}
|
|
281
371
|
function normalizeWorksheetVisibility(value) {
|
|
@@ -339,11 +429,11 @@ function resolveColorFromXmlFragment(fragment, themePalette) {
|
|
|
339
429
|
return void 0;
|
|
340
430
|
}
|
|
341
431
|
const srgbMatch = fragment.match(/<a:srgbClr\b[^>]*\bval="([0-9a-fA-F]{6,8})"/i);
|
|
342
|
-
if (_optionalChain([srgbMatch, 'optionalAccess',
|
|
432
|
+
if (_optionalChain([srgbMatch, 'optionalAccess', _56 => _56[1]])) {
|
|
343
433
|
return _nullishCoalesce(normalizeHexColor(srgbMatch[1]), () => ( void 0));
|
|
344
434
|
}
|
|
345
435
|
const schemeMatch = _nullishCoalesce(fragment.match(/<a:schemeClr\b[^>]*\bval="([^"]+)"[^>]*>([\s\S]*?)<\/a:schemeClr>/i), () => ( fragment.match(/<a:schemeClr\b[^>]*\bval="([^"]+)"[^>]*/i)));
|
|
346
|
-
if (!_optionalChain([schemeMatch, 'optionalAccess',
|
|
436
|
+
if (!_optionalChain([schemeMatch, 'optionalAccess', _57 => _57[1]])) {
|
|
347
437
|
return void 0;
|
|
348
438
|
}
|
|
349
439
|
const baseColor = resolveThemeColor(schemeMatch[1], themePalette);
|
|
@@ -354,7 +444,7 @@ function resolveColorFromXmlFragment(fragment, themePalette) {
|
|
|
354
444
|
let lightnessModifier = 1;
|
|
355
445
|
let lightnessOffset = 0;
|
|
356
446
|
for (const match of transforms.matchAll(/<a:(lumMod|lumOff|tint|shade)\b[^>]*\bval="(-?\d+(?:\.\d+)?)"/gi)) {
|
|
357
|
-
const transform = _optionalChain([match, 'access',
|
|
447
|
+
const transform = _optionalChain([match, 'access', _58 => _58[1], 'optionalAccess', _59 => _59.toLowerCase, 'call', _60 => _60()]);
|
|
358
448
|
const rawValue = Number(_nullishCoalesce(match[2], () => ( Number.NaN)));
|
|
359
449
|
if (!transform || !Number.isFinite(rawValue)) {
|
|
360
450
|
continue;
|
|
@@ -372,7 +462,7 @@ function resolveColorFromXmlFragment(fragment, themePalette) {
|
|
|
372
462
|
return _nullishCoalesce(applyLightnessTransform(baseColor, lightnessModifier, lightnessOffset), () => ( void 0));
|
|
373
463
|
}
|
|
374
464
|
function readHexColorFromXmlFragment(fragment, preferLine = false, themePalette) {
|
|
375
|
-
const source = preferLine ? _nullishCoalesce(_optionalChain([fragment, 'access',
|
|
465
|
+
const source = preferLine ? _nullishCoalesce(_optionalChain([fragment, 'access', _61 => _61.match, 'call', _62 => _62(/<a:ln\b[\s\S]*?<\/a:ln>/i), 'optionalAccess', _63 => _63[0]]), () => ( "")) : _nullishCoalesce(_optionalChain([fragment, 'access', _64 => _64.match, 'call', _65 => _65(/<a:solidFill\b[\s\S]*?<\/a:solidFill>/i), 'optionalAccess', _66 => _66[0]]), () => ( ""));
|
|
376
466
|
return resolveColorFromXmlFragment(source, themePalette);
|
|
377
467
|
}
|
|
378
468
|
function parseFallbackSeriesStylesFromChartXml(chartXml, themePalette) {
|
|
@@ -381,7 +471,7 @@ function parseFallbackSeriesStylesFromChartXml(chartXml, themePalette) {
|
|
|
381
471
|
return [];
|
|
382
472
|
}
|
|
383
473
|
return seriesBlocks.map((seriesBlock) => {
|
|
384
|
-
const shapeBlock = _nullishCoalesce(_optionalChain([seriesBlock, 'access',
|
|
474
|
+
const shapeBlock = _nullishCoalesce(_optionalChain([seriesBlock, 'access', _67 => _67.match, 'call', _68 => _68(/<c:spPr\b[\s\S]*?<\/c:spPr>/i), 'optionalAccess', _69 => _69[0]]), () => ( ""));
|
|
385
475
|
return {
|
|
386
476
|
color: readHexColorFromXmlFragment(shapeBlock, false, themePalette),
|
|
387
477
|
lineColor: readHexColorFromXmlFragment(shapeBlock, true, themePalette)
|
|
@@ -425,12 +515,12 @@ function parseFallbackPointStylesFromChartXml(chartXml, themePalette) {
|
|
|
425
515
|
const styles = [];
|
|
426
516
|
for (const pointBlock of pointBlocks) {
|
|
427
517
|
const indexMatch = pointBlock.match(/<c:idx\b[^>]*\bval="(-?\d+)"/i);
|
|
428
|
-
const index = _optionalChain([indexMatch, 'optionalAccess',
|
|
518
|
+
const index = _optionalChain([indexMatch, 'optionalAccess', _70 => _70[1]]) ? Number(indexMatch[1]) : Number.NaN;
|
|
429
519
|
if (!Number.isFinite(index)) {
|
|
430
520
|
continue;
|
|
431
521
|
}
|
|
432
522
|
const explosionMatch = pointBlock.match(/<c:explosion\b[^>]*\bval="(-?\d+(?:\.\d+)?)"/i);
|
|
433
|
-
const explosionValue = _optionalChain([explosionMatch, 'optionalAccess',
|
|
523
|
+
const explosionValue = _optionalChain([explosionMatch, 'optionalAccess', _71 => _71[1]]) ? Number(explosionMatch[1]) : Number.NaN;
|
|
434
524
|
styles.push({
|
|
435
525
|
color: readHexColorFromXmlFragment(pointBlock, false, themePalette),
|
|
436
526
|
explosion: Number.isFinite(explosionValue) ? explosionValue : void 0,
|
|
@@ -447,7 +537,7 @@ function parseNumericPointCacheFromXmlFragment(fragment) {
|
|
|
447
537
|
return [];
|
|
448
538
|
}
|
|
449
539
|
const explicitPointCountMatch = fragment.match(/<c:ptCount\b[^>]*\bval="(\d+)"/i);
|
|
450
|
-
const explicitPointCount = _optionalChain([explicitPointCountMatch, 'optionalAccess',
|
|
540
|
+
const explicitPointCount = _optionalChain([explicitPointCountMatch, 'optionalAccess', _72 => _72[1]]) ? Number(explicitPointCountMatch[1]) : Number.NaN;
|
|
451
541
|
const maxIndex = pointMatches.reduce((max, match) => {
|
|
452
542
|
const current = Number(_nullishCoalesce(match[1], () => ( Number.NaN)));
|
|
453
543
|
return Number.isFinite(current) ? Math.max(max, current) : max;
|
|
@@ -475,7 +565,7 @@ function parseFallbackBubbleSizesFromChartXml(chartXml) {
|
|
|
475
565
|
return [];
|
|
476
566
|
}
|
|
477
567
|
return seriesBlocks.map((seriesBlock) => {
|
|
478
|
-
const bubbleSizeBlock = _nullishCoalesce(_optionalChain([seriesBlock, 'access',
|
|
568
|
+
const bubbleSizeBlock = _nullishCoalesce(_optionalChain([seriesBlock, 'access', _73 => _73.match, 'call', _74 => _74(/<c:bubbleSize\b[\s\S]*?<\/c:bubbleSize>/i), 'optionalAccess', _75 => _75[0]]), () => ( ""));
|
|
479
569
|
if (!bubbleSizeBlock) {
|
|
480
570
|
return [];
|
|
481
571
|
}
|
|
@@ -597,17 +687,17 @@ function resolveThemeColor(name, themePalette) {
|
|
|
597
687
|
return null;
|
|
598
688
|
}
|
|
599
689
|
const index = THEME_COLOR_INDEX_BY_NAME[name];
|
|
600
|
-
return index === void 0 ? null : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
690
|
+
return index === void 0 ? null : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _76 => _76.colorsByIndex, 'access', _77 => _77[index]]), () => ( null));
|
|
601
691
|
}
|
|
602
692
|
function resolveThemeTypeface(typeface, themePalette) {
|
|
603
693
|
if (!typeface) {
|
|
604
694
|
return null;
|
|
605
695
|
}
|
|
606
696
|
if (typeface === "+mn-lt" || typeface === "+mn-ea" || typeface === "+mn-cs") {
|
|
607
|
-
return _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
697
|
+
return _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _78 => _78.minorLatinFont]), () => ( null));
|
|
608
698
|
}
|
|
609
699
|
if (typeface === "+mj-lt" || typeface === "+mj-ea" || typeface === "+mj-cs") {
|
|
610
|
-
return _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
700
|
+
return _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _79 => _79.majorLatinFont]), () => ( null));
|
|
611
701
|
}
|
|
612
702
|
return typeface;
|
|
613
703
|
}
|
|
@@ -619,8 +709,8 @@ function readChartTextTypeface(textPropertiesNode, themePalette) {
|
|
|
619
709
|
if (!defaultRunProperties) {
|
|
620
710
|
return null;
|
|
621
711
|
}
|
|
622
|
-
const typeface = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
623
|
-
const resolved = _nullishCoalesce(_optionalChain([resolveThemeTypeface, 'call',
|
|
712
|
+
const typeface = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _80 => _80(defaultRunProperties, "latin"), 'optionalAccess', _81 => _81.getAttribute, 'call', _82 => _82("typeface")]), () => ( _optionalChain([getFirstLocalChild, 'call', _83 => _83(defaultRunProperties, "ea"), 'optionalAccess', _84 => _84.getAttribute, 'call', _85 => _85("typeface")]))), () => ( _optionalChain([getFirstLocalChild, 'call', _86 => _86(defaultRunProperties, "cs"), 'optionalAccess', _87 => _87.getAttribute, 'call', _88 => _88("typeface")]))), () => ( null));
|
|
713
|
+
const resolved = _nullishCoalesce(_optionalChain([resolveThemeTypeface, 'call', _89 => _89(typeface, themePalette), 'optionalAccess', _90 => _90.trim, 'call', _91 => _91()]), () => ( ""));
|
|
624
714
|
return resolved.length > 0 ? resolved : null;
|
|
625
715
|
}
|
|
626
716
|
function resolveChartColorNode(node, themePalette) {
|
|
@@ -702,7 +792,7 @@ function resolveChartFillColor(shapeNode, themePalette) {
|
|
|
702
792
|
return resolveChartColorNode(midpointStop.colorNode, themePalette);
|
|
703
793
|
}
|
|
704
794
|
function resolveChartLineStyle(shapeNode, themePalette) {
|
|
705
|
-
const lineNode = _optionalChain([shapeNode, 'optionalAccess',
|
|
795
|
+
const lineNode = _optionalChain([shapeNode, 'optionalAccess', _92 => _92.localName]) === "ln" ? shapeNode : shapeNode ? getFirstLocalChild(shapeNode, "ln") : null;
|
|
706
796
|
if (!lineNode) {
|
|
707
797
|
return { color: null, hidden: false, widthPx: void 0 };
|
|
708
798
|
}
|
|
@@ -748,7 +838,7 @@ function normalizeLegendPosition(position) {
|
|
|
748
838
|
}
|
|
749
839
|
function readChartNumericAttribute(parent, localName) {
|
|
750
840
|
const node = parent ? getFirstLocalChild(parent, localName) : null;
|
|
751
|
-
const value = Number(_nullishCoalesce(_optionalChain([node, 'optionalAccess',
|
|
841
|
+
const value = Number(_nullishCoalesce(_optionalChain([node, 'optionalAccess', _93 => _93.getAttribute, 'call', _94 => _94("val")]), () => ( Number.NaN)));
|
|
752
842
|
return Number.isFinite(value) ? value : void 0;
|
|
753
843
|
}
|
|
754
844
|
function readChartBooleanAttribute(parent, localName) {
|
|
@@ -773,7 +863,7 @@ function readChartLabelFontSizePt(textPropertiesNode) {
|
|
|
773
863
|
return void 0;
|
|
774
864
|
}
|
|
775
865
|
const runPropertiesNode = _nullishCoalesce(getFirstLocalDescendant(textPropertiesNode, "defRPr"), () => ( getFirstLocalDescendant(textPropertiesNode, "rPr")));
|
|
776
|
-
const rawSize = Number(_nullishCoalesce(_optionalChain([runPropertiesNode, 'optionalAccess',
|
|
866
|
+
const rawSize = Number(_nullishCoalesce(_optionalChain([runPropertiesNode, 'optionalAccess', _95 => _95.getAttribute, 'call', _96 => _96("sz")]), () => ( Number.NaN)));
|
|
777
867
|
if (!Number.isFinite(rawSize) || rawSize <= 0) {
|
|
778
868
|
return void 0;
|
|
779
869
|
}
|
|
@@ -819,7 +909,7 @@ function parseChartDataLabelsFromXml(labelsNode) {
|
|
|
819
909
|
showSeriesName: readChartBooleanAttribute(labelsNode, "showSerName"),
|
|
820
910
|
showValue: readChartBooleanAttribute(labelsNode, "showVal")
|
|
821
911
|
};
|
|
822
|
-
const hasValue = labels.showBubbleSize !== void 0 || labels.showCategoryName !== void 0 || labels.showLegendKey !== void 0 || labels.showPercent !== void 0 || (_nullishCoalesce(_optionalChain([labels, 'access',
|
|
912
|
+
const hasValue = labels.showBubbleSize !== void 0 || labels.showCategoryName !== void 0 || labels.showLegendKey !== void 0 || labels.showPercent !== void 0 || (_nullishCoalesce(_optionalChain([labels, 'access', _97 => _97.pointLabels, 'optionalAccess', _98 => _98.length]), () => ( 0))) > 0 || labels.showSeriesName !== void 0 || labels.showValue !== void 0;
|
|
823
913
|
return hasValue ? labels : null;
|
|
824
914
|
}
|
|
825
915
|
function readChartRelationships(archive, chartPath) {
|
|
@@ -849,7 +939,7 @@ function readChartColorPalette(archive, colorStylePath, themePalette) {
|
|
|
849
939
|
return [];
|
|
850
940
|
}
|
|
851
941
|
const colorStyleDocument = parseXml(colorStyleXml);
|
|
852
|
-
if (!_optionalChain([colorStyleDocument, 'optionalAccess',
|
|
942
|
+
if (!_optionalChain([colorStyleDocument, 'optionalAccess', _99 => _99.documentElement])) {
|
|
853
943
|
return [];
|
|
854
944
|
}
|
|
855
945
|
return Array.from(colorStyleDocument.documentElement.childNodes).filter((child) => isElementNode(child) && child.localName !== "variation").map((child) => _nullishCoalesce(resolveChartColorNode(child, themePalette), () => ( resolveChartColorNode(findFirstChartColorElement(child), themePalette)))).filter((color) => typeof color === "string");
|
|
@@ -865,7 +955,7 @@ function readChartStyleAppearance(archive, stylePath, themePalette) {
|
|
|
865
955
|
}
|
|
866
956
|
const dataPointNode = getFirstLocalDescendant(styleDocument, "dataPoint");
|
|
867
957
|
const fillRefNode = dataPointNode ? getFirstLocalChild(dataPointNode, "fillRef") : null;
|
|
868
|
-
const index = Number(_nullishCoalesce(_optionalChain([fillRefNode, 'optionalAccess',
|
|
958
|
+
const index = Number(_nullishCoalesce(_optionalChain([fillRefNode, 'optionalAccess', _100 => _100.getAttribute, 'call', _101 => _101("idx")]), () => ( Number.NaN)));
|
|
869
959
|
const chartAreaNode = getFirstLocalDescendant(styleDocument, "chartArea");
|
|
870
960
|
const chartAreaShapeProperties = chartAreaNode ? getFirstLocalChild(chartAreaNode, "spPr") : null;
|
|
871
961
|
const chartAreaFontRef = chartAreaNode ? getFirstLocalChild(chartAreaNode, "fontRef") : null;
|
|
@@ -889,29 +979,29 @@ function readChartStyleAppearance(archive, stylePath, themePalette) {
|
|
|
889
979
|
};
|
|
890
980
|
}
|
|
891
981
|
function buildThemeSeriesPalette(themePalette) {
|
|
892
|
-
const themeColors = [4, 5, 6, 7, 8, 9].map((index) => _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
982
|
+
const themeColors = [4, 5, 6, 7, 8, 9].map((index) => _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _102 => _102.colorsByIndex, 'access', _103 => _103[index]]), () => ( null))).filter((color) => Boolean(color));
|
|
893
983
|
return themeColors.length > 0 ? themeColors : SERIES_COLORS;
|
|
894
984
|
}
|
|
895
985
|
function applyBuiltinSurfaceDefaults(chart, themePalette) {
|
|
896
986
|
if (chart.chartType !== "Surface") {
|
|
897
987
|
return;
|
|
898
988
|
}
|
|
899
|
-
const builtin = _optionalChain([chart, 'access',
|
|
900
|
-
const colors = _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
901
|
-
const wallFill = _nullishCoalesce(_chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _optionalChain([builtin, 'optionalAccess',
|
|
902
|
-
const floorFill = _nullishCoalesce(_chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _optionalChain([builtin, 'optionalAccess',
|
|
903
|
-
const gridlineColor = _chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _optionalChain([builtin, 'optionalAccess',
|
|
989
|
+
const builtin = _optionalChain([chart, 'access', _104 => _104.raw, 'optionalAccess', _105 => _105.hasCustomChartColorStyle]) !== true ? _chunk5ERNVHSOcjs.getBuiltinChartSurfaceStyle.call(void 0, chart.chartStyleId) : void 0;
|
|
990
|
+
const colors = _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _106 => _106.colorsByIndex]), () => ( {}));
|
|
991
|
+
const wallFill = _nullishCoalesce(_chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _optionalChain([builtin, 'optionalAccess', _107 => _107.wall, 'access', _108 => _108.fill]), colors), () => ( (chart.wireframe ? "#d0d0d0" : "#d9d9df")));
|
|
992
|
+
const floorFill = _nullishCoalesce(_chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _optionalChain([builtin, 'optionalAccess', _109 => _109.floor, 'access', _110 => _110.fill]), colors), () => ( wallFill));
|
|
993
|
+
const gridlineColor = _chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _optionalChain([builtin, 'optionalAccess', _111 => _111.majorGridline]), colors);
|
|
904
994
|
for (const axis of [chart.categoryAxis, chart.valueAxis, chart.seriesAxis]) {
|
|
905
995
|
if (axis && !axis.majorGridlineColor) axis.majorGridlineColor = gridlineColor;
|
|
906
996
|
}
|
|
907
997
|
const wallLine = chart.wireframe ? "#a6a6a6" : "#a8adb7";
|
|
908
|
-
const previousDefaults = _optionalChain([chart, 'access',
|
|
998
|
+
const previousDefaults = _optionalChain([chart, 'access', _112 => _112.raw, 'optionalAccess', _113 => _113.builtinSurfaceDefaults]);
|
|
909
999
|
const nextDefaults = {};
|
|
910
1000
|
for (const key of ["floor", "sideWall", "backWall"]) {
|
|
911
1001
|
const wall = _nullishCoalesce(chart[key], () => ( {}));
|
|
912
|
-
const previous = _optionalChain([previousDefaults, 'optionalAccess',
|
|
913
|
-
const fillIsDefault = wall.fillColor === void 0 || wall.fillColor === _optionalChain([previous, 'optionalAccess',
|
|
914
|
-
const lineIsDefault = wall.lineColor === void 0 || wall.lineColor === _optionalChain([previous, 'optionalAccess',
|
|
1002
|
+
const previous = _optionalChain([previousDefaults, 'optionalAccess', _114 => _114[key]]);
|
|
1003
|
+
const fillIsDefault = wall.fillColor === void 0 || wall.fillColor === _optionalChain([previous, 'optionalAccess', _115 => _115.fillColor]);
|
|
1004
|
+
const lineIsDefault = wall.lineColor === void 0 || wall.lineColor === _optionalChain([previous, 'optionalAccess', _116 => _116.lineColor]);
|
|
915
1005
|
const fillColor = fillIsDefault ? key === "floor" ? floorFill : wallFill : wall.fillColor;
|
|
916
1006
|
const lineColor = lineIsDefault ? wallLine : wall.lineColor;
|
|
917
1007
|
chart[key] = { ...wall, fillColor, lineColor };
|
|
@@ -927,8 +1017,8 @@ function applyBuiltinSurfaceDefaults(chart, themePalette) {
|
|
|
927
1017
|
}
|
|
928
1018
|
function applyBuiltinChartDefaults(chart, themePalette) {
|
|
929
1019
|
const darkBuiltInStyle = typeof chart.chartStyleId === "number" && chart.chartStyleId >= 140 && chart.chartStyleId < 150;
|
|
930
|
-
const textColor = _nullishCoalesce(_nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
931
|
-
const minorTypeface = _optionalChain([themePalette, 'optionalAccess',
|
|
1020
|
+
const textColor = _nullishCoalesce(_nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _117 => _117.colorsByIndex, 'access', _118 => _118[1]]), () => ( _optionalChain([themePalette, 'optionalAccess', _119 => _119.colorsByIndex, 'access', _120 => _120[3]]))), () => ( null));
|
|
1021
|
+
const minorTypeface = _optionalChain([themePalette, 'optionalAccess', _121 => _121.minorLatinFont, 'optionalAccess', _122 => _122.trim, 'call', _123 => _123()]) || void 0;
|
|
932
1022
|
const derivedAxisColor = textColor ? applyLightnessTransform(textColor, 0.35, 0.55) : null;
|
|
933
1023
|
const derivedBorderColor = textColor ? applyLightnessTransform(textColor, chart.is3d ? 0.28 : 0.22, chart.is3d ? 0.6 : 0.7) : null;
|
|
934
1024
|
if (darkBuiltInStyle) {
|
|
@@ -946,10 +1036,10 @@ function applyBuiltinChartDefaults(chart, themePalette) {
|
|
|
946
1036
|
chart.axisLineColor = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(chart.axisLineColor, () => ( derivedAxisColor)), () => ( textColor)), () => ( void 0));
|
|
947
1037
|
chart.fontFamily = _nullishCoalesce(chart.fontFamily, () => ( minorTypeface));
|
|
948
1038
|
chart.titleFontFamily = _nullishCoalesce(_nullishCoalesce(chart.titleFontFamily, () => ( chart.fontFamily)), () => ( minorTypeface));
|
|
949
|
-
const themeColors = _optionalChain([themePalette, 'optionalAccess',
|
|
950
|
-
const useBuiltin = _optionalChain([chart, 'access',
|
|
951
|
-
const colorCount = Math.max(1, chart.series.length, _nullishCoalesce(_optionalChain([chart, 'access',
|
|
952
|
-
const seriesPalette = useBuiltin && chart.chartType !== "Surface" ? Array.from({ length: colorCount }, (_, index) => _nullishCoalesce(_chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _chunk5ERNVHSOcjs.getBuiltinChartColor.call(void 0, chart.chartStyleId, index, colorCount), themeColors), () => ( SERIES_COLORS[index % SERIES_COLORS.length]))) : _optionalChain([chart, 'access',
|
|
1039
|
+
const themeColors = _optionalChain([themePalette, 'optionalAccess', _124 => _124.colorsByIndex]);
|
|
1040
|
+
const useBuiltin = _optionalChain([chart, 'access', _125 => _125.raw, 'optionalAccess', _126 => _126.hasCustomChartColorStyle]) !== true && themeColors && _chunk5ERNVHSOcjs.getBuiltinChartColor.call(void 0, chart.chartStyleId, 0, 1) !== void 0;
|
|
1041
|
+
const colorCount = Math.max(1, chart.series.length, _nullishCoalesce(_optionalChain([chart, 'access', _127 => _127.typeGroups, 'optionalAccess', _128 => _128.reduce, 'call', _129 => _129((total, group) => total + group.series.length, 0)]), () => ( 0)));
|
|
1042
|
+
const seriesPalette = useBuiltin && chart.chartType !== "Surface" ? Array.from({ length: colorCount }, (_, index) => _nullishCoalesce(_chunk5ERNVHSOcjs.resolveBuiltinChartColor.call(void 0, _chunk5ERNVHSOcjs.getBuiltinChartColor.call(void 0, chart.chartStyleId, index, colorCount), themeColors), () => ( SERIES_COLORS[index % SERIES_COLORS.length]))) : _optionalChain([chart, 'access', _130 => _130.chartColorPalette, 'optionalAccess', _131 => _131.length]) ? chart.chartColorPalette : buildThemeSeriesPalette(themePalette);
|
|
953
1043
|
chart.chartColorPalette = seriesPalette;
|
|
954
1044
|
chart.raw = { ...chart.raw, builtinThemeColors: useBuiltin ? themeColors : void 0 };
|
|
955
1045
|
const applySeriesDefaults = (series, index) => {
|
|
@@ -959,7 +1049,7 @@ function applyBuiltinChartDefaults(chart, themePalette) {
|
|
|
959
1049
|
const generated = {};
|
|
960
1050
|
const resolveColor = (key, explicit, fallback) => {
|
|
961
1051
|
const value = series[key];
|
|
962
|
-
if (!explicit && (value == null || value === _optionalChain([previous, 'optionalAccess',
|
|
1052
|
+
if (!explicit && (value == null || value === _optionalChain([previous, 'optionalAccess', _132 => _132[key]]) || (key === "color" || key === "lineColor") && useBuiltin && _optionalChain([chart, 'access', _133 => _133.raw, 'optionalAccess', _134 => _134.xmlChartType]))) {
|
|
963
1053
|
generated[key] = fallback;
|
|
964
1054
|
return fallback;
|
|
965
1055
|
}
|
|
@@ -981,9 +1071,10 @@ function applyBuiltinChartDefaults(chart, themePalette) {
|
|
|
981
1071
|
};
|
|
982
1072
|
};
|
|
983
1073
|
chart.series = chart.series.map(applySeriesDefaults);
|
|
1074
|
+
const canonicalSeries = chart.id.startsWith("chart-ex-") ? null : new Map(chart.series.map((series) => [series.id, series]));
|
|
984
1075
|
let groupSeriesOffset = 0;
|
|
985
|
-
chart.typeGroups = _optionalChain([chart, 'access',
|
|
986
|
-
const series = group.series.map((entry, index) => applySeriesDefaults(entry, groupSeriesOffset + index));
|
|
1076
|
+
chart.typeGroups = _optionalChain([chart, 'access', _135 => _135.typeGroups, 'optionalAccess', _136 => _136.map, 'call', _137 => _137((group) => {
|
|
1077
|
+
const series = group.series.map((entry, index) => _nullishCoalesce(_optionalChain([canonicalSeries, 'optionalAccess', _138 => _138.get, 'call', _139 => _139(entry.id)]), () => ( applySeriesDefaults(entry, groupSeriesOffset + index))));
|
|
987
1078
|
groupSeriesOffset += group.series.length;
|
|
988
1079
|
return { ...group, series };
|
|
989
1080
|
})]);
|
|
@@ -1036,7 +1127,7 @@ function parseChartCacheValues(parentNode, cacheName, mode) {
|
|
|
1036
1127
|
const rawIndex = Number(_nullishCoalesce(pointNode.getAttribute("idx"), () => ( Number.NaN)));
|
|
1037
1128
|
return {
|
|
1038
1129
|
index: Number.isFinite(rawIndex) ? rawIndex : 0,
|
|
1039
|
-
value: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1130
|
+
value: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _140 => _140(pointNode, "v"), 'optionalAccess', _141 => _141.textContent]), () => ( ""))
|
|
1040
1131
|
};
|
|
1041
1132
|
}).sort((left, right) => left.index - right.index);
|
|
1042
1133
|
if (pointNodes.length === 0) {
|
|
@@ -1077,7 +1168,7 @@ function parseChartMultiLevelCacheValues(parentNode, mode) {
|
|
|
1077
1168
|
const rawIndex = Number(_nullishCoalesce(pointNode.getAttribute("idx"), () => ( Number.NaN)));
|
|
1078
1169
|
return {
|
|
1079
1170
|
index: Number.isFinite(rawIndex) ? rawIndex : 0,
|
|
1080
|
-
value: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1171
|
+
value: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _142 => _142(pointNode, "v"), 'optionalAccess', _143 => _143.textContent]), () => ( ""))
|
|
1081
1172
|
};
|
|
1082
1173
|
}).sort((left, right) => left.index - right.index);
|
|
1083
1174
|
if (pointNodes.length === 0) {
|
|
@@ -1114,7 +1205,7 @@ function applyChartSeriesStyleFromXml(chart, chartTypeNode, themePalette) {
|
|
|
1114
1205
|
const fillColor = resolveChartFillColor(shapeProperties, themePalette);
|
|
1115
1206
|
const markerSize = readChartNumericAttribute(markerNode, "size");
|
|
1116
1207
|
const markerSymbolNode = markerNode ? getFirstLocalChild(markerNode, "symbol") : null;
|
|
1117
|
-
const markerSymbol = _nullishCoalesce(_optionalChain([markerSymbolNode, 'optionalAccess',
|
|
1208
|
+
const markerSymbol = _nullishCoalesce(_optionalChain([markerSymbolNode, 'optionalAccess', _144 => _144.getAttribute, 'call', _145 => _145("val")]), () => ( (markerNode || chart.chartType === "Scatter" || ["marker", "lineMarker", "smoothMarker"].includes(_nullishCoalesce(chart.scatterStyle, () => ( ""))) || readChartBooleanAttribute(chartTypeNode, "marker") === true ? "auto" : series.markerSymbol)));
|
|
1118
1209
|
const pointStyles = parseChartPointStyles(seriesNode, themePalette);
|
|
1119
1210
|
const seriesExplosion = readChartNumericAttribute(seriesNode, "explosion");
|
|
1120
1211
|
const invertNegativeStyle = parseInvertNegativeStyle(seriesNode, themePalette);
|
|
@@ -1124,14 +1215,15 @@ function applyChartSeriesStyleFromXml(chart, chartTypeNode, themePalette) {
|
|
|
1124
1215
|
const cachedValues = isScatterChart ? parseChartCacheValues(getFirstLocalChild(seriesNode, "yVal"), "numCache", "value") : parseChartCacheValues(getFirstLocalChild(seriesNode, "val"), "numCache", "value");
|
|
1125
1216
|
const cachedBubbleSizes = chart.chartType === "Bubble" ? parseChartCacheValues(getFirstLocalChild(seriesNode, "bubbleSize"), "numCache", "value") : null;
|
|
1126
1217
|
const existingShapeProperties = series.shapeProperties && typeof series.shapeProperties === "object" ? series.shapeProperties : null;
|
|
1127
|
-
const rawFillColor = typeof _optionalChain([existingShapeProperties, 'optionalAccess',
|
|
1128
|
-
const rawLineColor = typeof _optionalChain([existingShapeProperties, 'optionalAccess',
|
|
1218
|
+
const rawFillColor = typeof _optionalChain([existingShapeProperties, 'optionalAccess', _146 => _146.solidFillHex]) === "string" ? normalizeHexColor(existingShapeProperties.solidFillHex) : null;
|
|
1219
|
+
const rawLineColor = typeof _optionalChain([existingShapeProperties, 'optionalAccess', _147 => _147.lineColorHex]) === "string" ? normalizeHexColor(existingShapeProperties.lineColorHex) : null;
|
|
1129
1220
|
const resolvedLineColor = lineStyle.hidden ? void 0 : _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(rawLineColor, () => ( lineStyle.color)), () => ( rawFillColor)), () => ( fillColor)), () => ( series.lineColor)), () => ( series.color));
|
|
1130
|
-
const hasCategoryReference = typeof _optionalChain([series, 'access',
|
|
1131
|
-
const hasValueReference = typeof _optionalChain([series, 'access',
|
|
1132
|
-
const hasBubbleSizeReference = typeof _optionalChain([series, 'access',
|
|
1221
|
+
const hasCategoryReference = typeof _optionalChain([series, 'access', _148 => _148.categoriesRef, 'optionalAccess', _149 => _149.formula]) === "string" && series.categoriesRef.formula.length > 0 && !_optionalChain([series, 'access', _150 => _150.raw, 'optionalAccess', _151 => _151.unresolvedCategoriesReference]);
|
|
1222
|
+
const hasValueReference = typeof _optionalChain([series, 'access', _152 => _152.valuesRef, 'optionalAccess', _153 => _153.formula]) === "string" && series.valuesRef.formula.length > 0 && !_optionalChain([series, 'access', _154 => _154.raw, 'optionalAccess', _155 => _155.unresolvedValuesReference]);
|
|
1223
|
+
const hasBubbleSizeReference = typeof _optionalChain([series, 'access', _156 => _156.bubbleSizeRef, 'optionalAccess', _157 => _157.formula]) === "string" && series.bubbleSizeRef.formula.length > 0 && !_optionalChain([series, 'access', _158 => _158.raw, 'optionalAccess', _159 => _159.unresolvedBubbleSizeReference]);
|
|
1133
1224
|
return {
|
|
1134
1225
|
...series,
|
|
1226
|
+
name: _optionalChain([series, 'access', _160 => _160.raw, 'optionalAccess', _161 => _161.unresolvedNameReference]) ? _nullishCoalesce(_optionalChain([parseChartCacheValues, 'call', _162 => _162(getFirstLocalChild(seriesNode, "tx"), "strCache", "category"), 'optionalAccess', _163 => _163[0], 'optionalAccess', _164 => _164.toString, 'call', _165 => _165()]), () => ( series.name)) : series.name,
|
|
1135
1227
|
bubbleSizes: !hasBubbleSizeReference && cachedBubbleSizes ? cachedBubbleSizes.map((value) => typeof value === "number" && Number.isFinite(value) ? value : null) : series.bubbleSizes,
|
|
1136
1228
|
categories: !hasCategoryReference && cachedCategories ? cachedCategories : series.categories,
|
|
1137
1229
|
color: _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_nullishCoalesce(rawFillColor, () => ( rawLineColor)), () => ( fillColor)), () => ( lineStyle.color)), () => ( series.color)),
|
|
@@ -1206,10 +1298,10 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1206
1298
|
for (const fallbackStyle of fallbackPointStyles) {
|
|
1207
1299
|
const existing = existingByIndex.get(fallbackStyle.index);
|
|
1208
1300
|
existingByIndex.set(fallbackStyle.index, {
|
|
1209
|
-
color: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
1210
|
-
explosion: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
1301
|
+
color: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _166 => _166.color]), () => ( fallbackStyle.color)),
|
|
1302
|
+
explosion: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _167 => _167.explosion]), () => ( fallbackStyle.explosion)),
|
|
1211
1303
|
index: fallbackStyle.index,
|
|
1212
|
-
lineColor: _nullishCoalesce(_optionalChain([existing, 'optionalAccess',
|
|
1304
|
+
lineColor: _nullishCoalesce(_optionalChain([existing, 'optionalAccess', _168 => _168.lineColor]), () => ( fallbackStyle.lineColor))
|
|
1213
1305
|
});
|
|
1214
1306
|
}
|
|
1215
1307
|
return {
|
|
@@ -1237,7 +1329,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1237
1329
|
};
|
|
1238
1330
|
const applyRelationshipStyles = () => {
|
|
1239
1331
|
chart.chartColorPalette = readChartColorPalette(archive, relationships.get(CHART_COLOR_STYLE_REL_TYPE), themePalette);
|
|
1240
|
-
chart.raw = { ...chart.raw, hasCustomChartColorStyle: Boolean(_optionalChain([chart, 'access',
|
|
1332
|
+
chart.raw = { ...chart.raw, hasCustomChartColorStyle: Boolean(_optionalChain([chart, 'access', _169 => _169.chartColorPalette, 'optionalAccess', _170 => _170.length])) };
|
|
1241
1333
|
const styleAppearance2 = readChartStyleAppearance(
|
|
1242
1334
|
archive,
|
|
1243
1335
|
relationships.get(CHART_STYLE_REL_TYPE),
|
|
@@ -1253,7 +1345,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1253
1345
|
return styleAppearance2;
|
|
1254
1346
|
};
|
|
1255
1347
|
const applyModernChartExStyles = () => {
|
|
1256
|
-
const modernPlotAreaNode = _optionalChain([chartDocument, 'optionalAccess',
|
|
1348
|
+
const modernPlotAreaNode = _optionalChain([chartDocument, 'optionalAccess', _171 => _171.documentElement]) ? getFirstLocalDescendant(chartDocument.documentElement, "plotArea") : null;
|
|
1257
1349
|
if (!modernPlotAreaNode) {
|
|
1258
1350
|
return;
|
|
1259
1351
|
}
|
|
@@ -1335,12 +1427,12 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1335
1427
|
const nextTypeGroups = chart.typeGroups.map((group) => ({ ...group, series: [...group.series] }));
|
|
1336
1428
|
const columnGroupIndex = nextTypeGroups.findIndex((group) => group.chartType === "ColumnClustered");
|
|
1337
1429
|
if (columnGroupIndex >= 0) {
|
|
1338
|
-
const originalColumnSeries = _nullishCoalesce(_optionalChain([nextTypeGroups, 'access',
|
|
1430
|
+
const originalColumnSeries = _nullishCoalesce(_optionalChain([nextTypeGroups, 'access', _172 => _172[columnGroupIndex], 'optionalAccess', _173 => _173.series, 'access', _174 => _174[0]]), () => ( null));
|
|
1339
1431
|
const binnedColumnSeries = replaceColumnSeries(originalColumnSeries);
|
|
1340
1432
|
if (binnedColumnSeries) {
|
|
1341
1433
|
nextTypeGroups[columnGroupIndex].series = [binnedColumnSeries];
|
|
1342
1434
|
const lineGroupIndex = nextTypeGroups.findIndex((group) => group.chartType === "Line");
|
|
1343
|
-
if (lineGroupIndex >= 0 && _optionalChain([nextTypeGroups, 'access',
|
|
1435
|
+
if (lineGroupIndex >= 0 && _optionalChain([nextTypeGroups, 'access', _175 => _175[lineGroupIndex], 'optionalAccess', _176 => _176.series, 'access', _177 => _177[0]])) {
|
|
1344
1436
|
const originalLineSeries = nextTypeGroups[lineGroupIndex].series[0];
|
|
1345
1437
|
const recomputedLine = buildChartExParetoLineSeries(
|
|
1346
1438
|
binnedColumnSeries,
|
|
@@ -1383,7 +1475,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1383
1475
|
const chartDocument = parseXml(chartXml);
|
|
1384
1476
|
const chartNode = chartDocument ? getFirstLocalDescendant(chartDocument, "chart") : null;
|
|
1385
1477
|
const plotAreaNode = chartNode ? getFirstLocalChild(chartNode, "plotArea") : null;
|
|
1386
|
-
const styleIdNode = _optionalChain([chartDocument, 'optionalAccess',
|
|
1478
|
+
const styleIdNode = _optionalChain([chartDocument, 'optionalAccess', _178 => _178.documentElement]) ? getFirstLocalDescendant(chartDocument.documentElement, "style") : null;
|
|
1387
1479
|
const chartTypeNode = findPrimaryChartTypeNode(plotAreaNode);
|
|
1388
1480
|
if (!chartNode || !chartTypeNode) {
|
|
1389
1481
|
applyRelationshipStyles();
|
|
@@ -1391,6 +1483,23 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1391
1483
|
if (typeof fallbackStyleId === "number" && Number.isFinite(fallbackStyleId)) {
|
|
1392
1484
|
chart.chartStyleId = fallbackStyleId;
|
|
1393
1485
|
}
|
|
1486
|
+
const sourceSeries = _optionalChain([chart, 'access', _179 => _179.raw, 'optionalAccess', _180 => _180.officeSourceSeries]);
|
|
1487
|
+
if (sourceSeries && _optionalChain([chartDocument, 'optionalAccess', _181 => _181.documentElement, 'access', _182 => _182.namespaceURI]) === "http://schemas.microsoft.com/office/drawing/2014/chartex") {
|
|
1488
|
+
chart.renderSource = {
|
|
1489
|
+
kind: _nullishCoalesce(chart.chartExLayout, () => ( "")),
|
|
1490
|
+
seriesTypes: getLocalDescendants(chartNode, "series").map((node) => _nullishCoalesce(node.getAttribute("layoutId"), () => ( ""))),
|
|
1491
|
+
sourceSeries,
|
|
1492
|
+
experimental: true,
|
|
1493
|
+
xml: chartXml,
|
|
1494
|
+
themeColors: themePalette ? Object.fromEntries(Object.entries(THEME_COLOR_INDEX_BY_NAME).flatMap(([key, index]) => {
|
|
1495
|
+
const color = themePalette.colorsByIndex[index];
|
|
1496
|
+
return color ? [[key, color]] : [];
|
|
1497
|
+
})) : void 0,
|
|
1498
|
+
themeOverrideXml: _nullishCoalesce(readArchiveText(archive, relationships.get("http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride")), () => ( void 0)),
|
|
1499
|
+
styleXml: _nullishCoalesce(readArchiveText(archive, relationships.get(CHART_STYLE_REL_TYPE)), () => ( void 0)),
|
|
1500
|
+
colorStyleXml: _nullishCoalesce(readArchiveText(archive, relationships.get(CHART_COLOR_STYLE_REL_TYPE)), () => ( void 0))
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1394
1503
|
applyModernChartExStyles();
|
|
1395
1504
|
applyFallbackSeriesStyles();
|
|
1396
1505
|
applyBuiltinChartDefaults(chart, themePalette);
|
|
@@ -1406,8 +1515,8 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1406
1515
|
switch (chartTypeNode.localName) {
|
|
1407
1516
|
case "barChart":
|
|
1408
1517
|
case "bar3DChart": {
|
|
1409
|
-
const grouping = _optionalChain([getFirstLocalChild, 'call',
|
|
1410
|
-
const barDir = _optionalChain([getFirstLocalChild, 'call',
|
|
1518
|
+
const grouping = _optionalChain([getFirstLocalChild, 'call', _183 => _183(chartTypeNode, "grouping"), 'optionalAccess', _184 => _184.getAttribute, 'call', _185 => _185("val")]);
|
|
1519
|
+
const barDir = _optionalChain([getFirstLocalChild, 'call', _186 => _186(chartTypeNode, "barDir"), 'optionalAccess', _187 => _187.getAttribute, 'call', _188 => _188("val")]);
|
|
1411
1520
|
const isHorizontalBar = barDir === "bar";
|
|
1412
1521
|
chart.is3d = chartTypeNode.localName === "bar3DChart" ? true : chart.is3d;
|
|
1413
1522
|
if (grouping === "percentStacked") {
|
|
@@ -1421,7 +1530,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1421
1530
|
}
|
|
1422
1531
|
case "areaChart":
|
|
1423
1532
|
case "area3DChart": {
|
|
1424
|
-
const grouping = _optionalChain([getFirstLocalChild, 'call',
|
|
1533
|
+
const grouping = _optionalChain([getFirstLocalChild, 'call', _189 => _189(chartTypeNode, "grouping"), 'optionalAccess', _190 => _190.getAttribute, 'call', _191 => _191("val")]);
|
|
1425
1534
|
chart.is3d = chartTypeNode.localName === "area3DChart" ? true : chart.is3d;
|
|
1426
1535
|
if (grouping === "stacked") {
|
|
1427
1536
|
chart.chartType = "AreaStacked";
|
|
@@ -1434,7 +1543,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1434
1543
|
}
|
|
1435
1544
|
case "lineChart":
|
|
1436
1545
|
case "line3DChart": {
|
|
1437
|
-
const grouping = _optionalChain([getFirstLocalChild, 'call',
|
|
1546
|
+
const grouping = _optionalChain([getFirstLocalChild, 'call', _192 => _192(chartTypeNode, "grouping"), 'optionalAccess', _193 => _193.getAttribute, 'call', _194 => _194("val")]);
|
|
1438
1547
|
chart.is3d = chartTypeNode.localName === "line3DChart" ? true : chart.is3d;
|
|
1439
1548
|
if (grouping === "stacked") {
|
|
1440
1549
|
chart.chartType = "LineStacked";
|
|
@@ -1459,7 +1568,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1459
1568
|
chart.chartType = "BarOfPie";
|
|
1460
1569
|
break;
|
|
1461
1570
|
case "scatterChart":
|
|
1462
|
-
chart.chartType = resolveScatterChartType(_optionalChain([getFirstLocalChild, 'call',
|
|
1571
|
+
chart.chartType = resolveScatterChartType(_optionalChain([getFirstLocalChild, 'call', _195 => _195(chartTypeNode, "scatterStyle"), 'optionalAccess', _196 => _196.getAttribute, 'call', _197 => _197("val")]));
|
|
1463
1572
|
break;
|
|
1464
1573
|
case "radarChart":
|
|
1465
1574
|
chart.chartType = "Radar";
|
|
@@ -1482,19 +1591,19 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1482
1591
|
break;
|
|
1483
1592
|
}
|
|
1484
1593
|
const legendNode = getFirstLocalChild(chartNode, "legend");
|
|
1485
|
-
const legendPosition = legendNode ? _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1486
|
-
const legendOverlay = legendNode ? _optionalChain([getFirstLocalChild, 'call',
|
|
1594
|
+
const legendPosition = legendNode ? _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _198 => _198(legendNode, "legendPos"), 'optionalAccess', _199 => _199.getAttribute, 'call', _200 => _200("val")]), () => ( void 0)) : void 0;
|
|
1595
|
+
const legendOverlay = legendNode ? _optionalChain([getFirstLocalChild, 'call', _201 => _201(legendNode, "overlay"), 'optionalAccess', _202 => _202.getAttribute, 'call', _203 => _203("val")]) : void 0;
|
|
1487
1596
|
chart.legend = legendNode ? {
|
|
1488
1597
|
overlay: legendOverlay === "1",
|
|
1489
1598
|
position: normalizeLegendPosition(legendPosition),
|
|
1490
|
-
raw: _optionalChain([chart, 'access',
|
|
1599
|
+
raw: _optionalChain([chart, 'access', _204 => _204.legend, 'optionalAccess', _205 => _205.raw])
|
|
1491
1600
|
} : chart.legend;
|
|
1492
1601
|
const plotVisibleOnly = readChartBooleanAttribute(chartNode, "plotVisOnly");
|
|
1493
1602
|
if (plotVisibleOnly !== void 0) {
|
|
1494
1603
|
chart.plotVisibleOnly = plotVisibleOnly;
|
|
1495
1604
|
}
|
|
1496
|
-
chart.displayBlanksAs = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1497
|
-
const styleId = Number(_nullishCoalesce(_optionalChain([styleIdNode, 'optionalAccess',
|
|
1605
|
+
chart.displayBlanksAs = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _206 => _206(chartNode, "dispBlanksAs"), 'optionalAccess', _207 => _207.getAttribute, 'call', _208 => _208("val")]), () => ( chart.displayBlanksAs));
|
|
1606
|
+
const styleId = Number(_nullishCoalesce(_optionalChain([styleIdNode, 'optionalAccess', _209 => _209.getAttribute, 'call', _210 => _210("val")]), () => ( Number.NaN)));
|
|
1498
1607
|
chart.chartStyleId = Number.isFinite(styleId) ? styleId : chart.chartStyleId;
|
|
1499
1608
|
chart.firstSliceAngle = _nullishCoalesce(readChartNumericAttribute(chartTypeNode, "firstSliceAng"), () => ( chart.firstSliceAngle));
|
|
1500
1609
|
chart.gapWidth = _nullishCoalesce(readChartNumericAttribute(chartTypeNode, "gapWidth"), () => ( chart.gapWidth));
|
|
@@ -1504,9 +1613,9 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1504
1613
|
const bubble3dNode = getFirstLocalChild(chartTypeNode, "bubble3D");
|
|
1505
1614
|
chart.bubble3d = bubble3dNode ? bubble3dNode.getAttribute("val") !== "0" : chart.bubble3d;
|
|
1506
1615
|
chart.holeSize = _nullishCoalesce(readChartNumericAttribute(chartTypeNode, "holeSize"), () => ( chart.holeSize));
|
|
1507
|
-
chart.radarStyle = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1508
|
-
chart.scatterStyle = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1509
|
-
chart.shape3d = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1616
|
+
chart.radarStyle = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _211 => _211(chartTypeNode, "radarStyle"), 'optionalAccess', _212 => _212.getAttribute, 'call', _213 => _213("val")]), () => ( chart.radarStyle));
|
|
1617
|
+
chart.scatterStyle = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _214 => _214(chartTypeNode, "scatterStyle"), 'optionalAccess', _215 => _215.getAttribute, 'call', _216 => _216("val")]), () => ( chart.scatterStyle));
|
|
1618
|
+
chart.shape3d = _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _217 => _217(chartTypeNode, "shape"), 'optionalAccess', _218 => _218.getAttribute, 'call', _219 => _219("val")]), () => ( chart.shape3d));
|
|
1510
1619
|
const wireframeNode = getFirstLocalChild(chartTypeNode, "wireframe");
|
|
1511
1620
|
chart.wireframe = wireframeNode ? wireframeNode.getAttribute("val") !== "0" : chart.wireframe;
|
|
1512
1621
|
const chartTypeDataLabels = parseChartDataLabelsFromXml(getFirstLocalChild(chartTypeNode, "dLbls"));
|
|
@@ -1514,7 +1623,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1514
1623
|
const seriesDataLabels = parseChartDataLabelsFromXml(getFirstLocalChild(firstSeriesNode, "dLbls"));
|
|
1515
1624
|
chart.dataLabels = _nullishCoalesce(_nullishCoalesce(chartTypeDataLabels, () => ( seriesDataLabels)), () => ( chart.dataLabels));
|
|
1516
1625
|
const seriesSp3dNode = firstSeriesNode ? getFirstLocalDescendant(firstSeriesNode, "sp3d") : null;
|
|
1517
|
-
chart.surfaceMaterial = _nullishCoalesce(_optionalChain([seriesSp3dNode, 'optionalAccess',
|
|
1626
|
+
chart.surfaceMaterial = _nullishCoalesce(_optionalChain([seriesSp3dNode, 'optionalAccess', _220 => _220.getAttribute, 'call', _221 => _221("prstMaterial")]), () => ( chart.surfaceMaterial));
|
|
1518
1627
|
const bandFormatsNode = _nullishCoalesce(getLocalChildren(chartTypeNode, "bandFmts")[0], () => ( null));
|
|
1519
1628
|
const bandFormatNodes = bandFormatsNode ? getLocalChildren(bandFormatsNode, "bandFmt") : [];
|
|
1520
1629
|
const bandFormatColors = /* @__PURE__ */ Object.create(null);
|
|
@@ -1529,7 +1638,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1529
1638
|
const fillColor = getFirstLocalChild(shapeProperties, "noFill") ? "transparent" : resolveChartFillColor(shapeProperties, themePalette);
|
|
1530
1639
|
const lineStyle = resolveChartLineStyle(shapeProperties, themePalette);
|
|
1531
1640
|
const lineColor = lineStyle.hidden ? "transparent" : lineStyle.color;
|
|
1532
|
-
const lineWidth = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1641
|
+
const lineWidth = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _222 => _222(shapeProperties, "ln"), 'optionalAccess', _223 => _223.getAttribute, 'call', _224 => _224("w")]), () => ( Number.NaN)));
|
|
1533
1642
|
if (fillColor) bandFormatColors[index] = fillColor;
|
|
1534
1643
|
if (lineColor) bandFormatLineColors[index] = lineColor;
|
|
1535
1644
|
if (Number.isFinite(lineWidth) && lineWidth >= 0) bandFormatLineWidths[index] = lineWidth / EMU_PER_PIXEL;
|
|
@@ -1539,16 +1648,16 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1539
1648
|
bandFormatColors: Object.keys(bandFormatColors).length > 0 ? bandFormatColors : void 0,
|
|
1540
1649
|
bandFormatLineColors: Object.keys(bandFormatLineColors).length > 0 ? bandFormatLineColors : void 0,
|
|
1541
1650
|
bandFormatLineWidths: Object.keys(bandFormatLineWidths).length > 0 ? bandFormatLineWidths : void 0,
|
|
1542
|
-
date1904: readChartBooleanAttribute(_nullishCoalesce(_optionalChain([chartDocument, 'optionalAccess',
|
|
1651
|
+
date1904: readChartBooleanAttribute(_nullishCoalesce(_optionalChain([chartDocument, 'optionalAccess', _225 => _225.documentElement]), () => ( null)), "date1904"),
|
|
1543
1652
|
titleOverlay: readChartBooleanAttribute(getFirstLocalChild(chartNode, "title"), "overlay"),
|
|
1544
1653
|
bubble3d: chart.bubble3d,
|
|
1545
|
-
grouping: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1546
|
-
ofPieType: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1547
|
-
shape: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1654
|
+
grouping: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _226 => _226(chartTypeNode, "grouping"), 'optionalAccess', _227 => _227.getAttribute, 'call', _228 => _228("val")]), () => ( void 0)),
|
|
1655
|
+
ofPieType: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _229 => _229(chartTypeNode, "ofPieType"), 'optionalAccess', _230 => _230.getAttribute, 'call', _231 => _231("val")]), () => ( void 0)),
|
|
1656
|
+
shape: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _232 => _232(chartTypeNode, "shape"), 'optionalAccess', _233 => _233.getAttribute, 'call', _234 => _234("val")]), () => ( void 0)),
|
|
1548
1657
|
secondPieSize: readChartNumericAttribute(chartTypeNode, "secondPieSize"),
|
|
1549
1658
|
scatterStyle: chart.scatterStyle,
|
|
1550
1659
|
splitPos: readChartNumericAttribute(chartTypeNode, "splitPos"),
|
|
1551
|
-
splitType: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
1660
|
+
splitType: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _235 => _235(chartTypeNode, "splitType"), 'optionalAccess', _236 => _236.getAttribute, 'call', _237 => _237("val")]), () => ( void 0)),
|
|
1552
1661
|
xmlChartType: chartTypeNode.localName
|
|
1553
1662
|
};
|
|
1554
1663
|
const view3dNode = getFirstLocalDescendant(chartNode, "view3D");
|
|
@@ -1557,7 +1666,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1557
1666
|
depthPercent: readChartNumericAttribute(view3dNode, "depthPercent"),
|
|
1558
1667
|
heightPercent: readChartNumericAttribute(view3dNode, "hPercent"),
|
|
1559
1668
|
perspective: readChartNumericAttribute(view3dNode, "perspective"),
|
|
1560
|
-
rAngAx: _optionalChain([getFirstLocalChild, 'call',
|
|
1669
|
+
rAngAx: _optionalChain([getFirstLocalChild, 'call', _238 => _238(view3dNode, "rAngAx"), 'optionalAccess', _239 => _239.getAttribute, 'call', _240 => _240("val")]) === "1",
|
|
1561
1670
|
rotX: readChartNumericAttribute(view3dNode, "rotX"),
|
|
1562
1671
|
rotY: readChartNumericAttribute(view3dNode, "rotY")
|
|
1563
1672
|
};
|
|
@@ -1566,7 +1675,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1566
1675
|
const wall = readChartWallFromXml(getFirstLocalChild(chartNode, key), themePalette);
|
|
1567
1676
|
if (wall) {
|
|
1568
1677
|
chart[key] = wall;
|
|
1569
|
-
const defaults = _optionalChain([chart, 'access',
|
|
1678
|
+
const defaults = _optionalChain([chart, 'access', _241 => _241.raw, 'optionalAccess', _242 => _242.builtinSurfaceDefaults]);
|
|
1570
1679
|
if (defaults) chart.raw = { ...chart.raw, builtinSurfaceDefaults: { ...defaults, [key]: void 0 } };
|
|
1571
1680
|
}
|
|
1572
1681
|
}
|
|
@@ -1575,7 +1684,7 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1575
1684
|
const titleTypeface = readChartTextTypeface(getFirstLocalDescendant(chartNode, "title"), themePalette);
|
|
1576
1685
|
chart.fontFamily = _nullishCoalesce(chartTextTypeface, () => ( chart.fontFamily));
|
|
1577
1686
|
chart.titleFontFamily = _nullishCoalesce(_nullishCoalesce(titleTypeface, () => ( chart.titleFontFamily)), () => ( chart.fontFamily));
|
|
1578
|
-
const chartAreaShapeProperties = _optionalChain([chartDocument, 'optionalAccess',
|
|
1687
|
+
const chartAreaShapeProperties = _optionalChain([chartDocument, 'optionalAccess', _243 => _243.documentElement]) ? getFirstLocalChild(chartDocument.documentElement, "spPr") : null;
|
|
1579
1688
|
const plotAreaShapeProperties = getFirstLocalChild(plotArea, "spPr");
|
|
1580
1689
|
const chartAreaNoFill = chartAreaShapeProperties ? getFirstLocalChild(chartAreaShapeProperties, "noFill") != null : false;
|
|
1581
1690
|
const plotAreaNoFill = plotAreaShapeProperties ? getFirstLocalChild(plotAreaShapeProperties, "noFill") != null : false;
|
|
@@ -1614,11 +1723,11 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1614
1723
|
let valueAxisNode = _nullishCoalesce(valueAxisNodes[0], () => ( null));
|
|
1615
1724
|
if (!categoryAxisNode && isScatterLikeChart && valueAxisNodes.length >= 2) {
|
|
1616
1725
|
categoryAxisNode = _nullishCoalesce(valueAxisNodes.find((axisNode) => {
|
|
1617
|
-
const position = _optionalChain([getFirstLocalChild, 'call',
|
|
1726
|
+
const position = _optionalChain([getFirstLocalChild, 'call', _244 => _244(axisNode, "axPos"), 'optionalAccess', _245 => _245.getAttribute, 'call', _246 => _246("val")]);
|
|
1618
1727
|
return position === "b" || position === "t";
|
|
1619
1728
|
}), () => ( valueAxisNodes[0]));
|
|
1620
1729
|
valueAxisNode = _nullishCoalesce(_nullishCoalesce(valueAxisNodes.find((axisNode) => {
|
|
1621
|
-
const position = _optionalChain([getFirstLocalChild, 'call',
|
|
1730
|
+
const position = _optionalChain([getFirstLocalChild, 'call', _247 => _247(axisNode, "axPos"), 'optionalAccess', _248 => _248.getAttribute, 'call', _249 => _249("val")]);
|
|
1622
1731
|
return position === "l" || position === "r";
|
|
1623
1732
|
}), () => ( valueAxisNodes[1])), () => ( valueAxisNodes[0]));
|
|
1624
1733
|
}
|
|
@@ -1632,11 +1741,22 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1632
1741
|
chart.axes = [...chart.axes, seriesAxis];
|
|
1633
1742
|
}
|
|
1634
1743
|
}
|
|
1635
|
-
const
|
|
1636
|
-
const
|
|
1637
|
-
|
|
1744
|
+
const groups = Array.from(plotArea.children).filter((entry) => entry.localName.endsWith("Chart"));
|
|
1745
|
+
const seriesTypes = groups.flatMap((group) => getLocalChildren(group, "ser").map(() => group.localName.slice(0, -5)));
|
|
1746
|
+
const seriesNodes = groups.flatMap((group) => getLocalChildren(group, "ser"));
|
|
1747
|
+
const indexedXSeries = seriesNodes.map((series) => {
|
|
1748
|
+
const x = getFirstLocalChild(series, "xVal");
|
|
1749
|
+
return Boolean(x && (getFirstLocalChild(x, "multiLvlStrRef") || getFirstLocalChild(x, "strRef") || getFirstLocalChild(x, "strLit")));
|
|
1750
|
+
});
|
|
1751
|
+
const unsupportedHierarchy = getLocalDescendants(plotArea, "multiLvlStrRef").some((node) => _optionalChain([node, 'access', _250 => _250.parentElement, 'optionalAccess', _251 => _251.localName]) !== "xVal");
|
|
1752
|
+
const kind = chartTypeNode.localName.slice(0, -5);
|
|
1753
|
+
const stable = groups.length === 1 && !chart.is3d && (kind === "line" && chart.chartType === "Line" || kind === "bar" && chart.chartType === "ColumnClustered") && !plotArea.querySelector("trendline, errBars, dropLines, hiLowLines, upDownBars, dateAx, multiLvlStrRef, pictureOptions");
|
|
1754
|
+
if (seriesTypes.length === chart.series.length && !unsupportedHierarchy && !plotArea.querySelector("pictureOptions")) {
|
|
1638
1755
|
chart.renderSource = {
|
|
1639
1756
|
kind,
|
|
1757
|
+
seriesTypes,
|
|
1758
|
+
indexedXSeries,
|
|
1759
|
+
experimental: !stable,
|
|
1640
1760
|
xml: chartXml,
|
|
1641
1761
|
themeColors: themePalette ? Object.fromEntries(Object.entries(THEME_COLOR_INDEX_BY_NAME).flatMap(([key, index]) => {
|
|
1642
1762
|
const color = themePalette.colorsByIndex[index];
|
|
@@ -1647,7 +1767,21 @@ function applyChartStyleFromXml(chart, chartPath, archive, themePalette) {
|
|
|
1647
1767
|
colorStyleXml: _nullishCoalesce(readArchiveText(archive, relationships.get(CHART_COLOR_STYLE_REL_TYPE)), () => ( void 0))
|
|
1648
1768
|
};
|
|
1649
1769
|
}
|
|
1650
|
-
|
|
1770
|
+
if (groups.length > 1 && _optionalChain([chart, 'access', _252 => _252.typeGroups, 'optionalAccess', _253 => _253.length]) === groups.length) {
|
|
1771
|
+
let seriesOffset = 0;
|
|
1772
|
+
const hydratedSeries = [];
|
|
1773
|
+
chart.typeGroups = chart.typeGroups.map((group, index) => {
|
|
1774
|
+
const count = getLocalChildren(groups[index], "ser").length;
|
|
1775
|
+
const groupChart = { ...chart, chartType: group.chartType, series: chart.series.slice(seriesOffset, seriesOffset + count) };
|
|
1776
|
+
applyChartSeriesStyleFromXml(groupChart, groups[index], themePalette);
|
|
1777
|
+
seriesOffset += count;
|
|
1778
|
+
hydratedSeries.push(...groupChart.series);
|
|
1779
|
+
return { ...group, series: groupChart.series };
|
|
1780
|
+
});
|
|
1781
|
+
chart.series = [...hydratedSeries, ...chart.series.slice(seriesOffset)];
|
|
1782
|
+
} else {
|
|
1783
|
+
applyChartSeriesStyleFromXml(chart, chartTypeNode, themePalette);
|
|
1784
|
+
}
|
|
1651
1785
|
applyFallbackSeriesStyles();
|
|
1652
1786
|
applyBuiltinChartDefaults(chart, themePalette);
|
|
1653
1787
|
}
|
|
@@ -1714,15 +1848,15 @@ function serializeXml(document2) {
|
|
|
1714
1848
|
return new XMLSerializer().serializeToString(document2);
|
|
1715
1849
|
}
|
|
1716
1850
|
function getLocalChildren(parent, localName) {
|
|
1717
|
-
return Array.from(_nullishCoalesce(_optionalChain([parent, 'optionalAccess',
|
|
1851
|
+
return Array.from(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _254 => _254.childNodes]), () => ( []))).filter(
|
|
1718
1852
|
(node) => node.nodeType === Node.ELEMENT_NODE && node.localName === localName
|
|
1719
1853
|
);
|
|
1720
1854
|
}
|
|
1721
1855
|
function removeLocalChildren(parent, localName) {
|
|
1722
|
-
getLocalChildren(parent, localName).forEach((node) => _optionalChain([node, 'access',
|
|
1856
|
+
getLocalChildren(parent, localName).forEach((node) => _optionalChain([node, 'access', _255 => _255.parentNode, 'optionalAccess', _256 => _256.removeChild, 'call', _257 => _257(node)]));
|
|
1723
1857
|
}
|
|
1724
1858
|
function getLocalDescendants(parent, localName) {
|
|
1725
|
-
return Array.from(_nullishCoalesce(_optionalChain([parent, 'optionalAccess',
|
|
1859
|
+
return Array.from(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _258 => _258.getElementsByTagName, 'call', _259 => _259("*")]), () => ( []))).filter(
|
|
1726
1860
|
(node) => node.localName === localName
|
|
1727
1861
|
);
|
|
1728
1862
|
}
|
|
@@ -1834,8 +1968,8 @@ function resolveReferenceSheet(workbook, fallbackSheetIndex, formula) {
|
|
|
1834
1968
|
if (!formula) {
|
|
1835
1969
|
return {
|
|
1836
1970
|
range: null,
|
|
1837
|
-
sheet: workbook.getSheet(fallbackSheetIndex),
|
|
1838
|
-
sheetName: _nullishCoalesce(_optionalChain([workbook, 'access',
|
|
1971
|
+
sheet: fallbackSheetIndex < workbook.sheetCount ? workbook.getSheet(fallbackSheetIndex) : null,
|
|
1972
|
+
sheetName: fallbackSheetIndex < workbook.sheetCount ? _nullishCoalesce(_optionalChain([workbook, 'access', _260 => _260.getSheet, 'call', _261 => _261(fallbackSheetIndex), 'optionalAccess', _262 => _262.name]), () => ( "")) : ""
|
|
1839
1973
|
};
|
|
1840
1974
|
}
|
|
1841
1975
|
const trimmedFormula = formula.trim();
|
|
@@ -1852,8 +1986,8 @@ function resolveReferenceSheet(workbook, fallbackSheetIndex, formula) {
|
|
|
1852
1986
|
if (!split) {
|
|
1853
1987
|
return {
|
|
1854
1988
|
range: parseA1Range(trimmedFormula),
|
|
1855
|
-
sheet: workbook.getSheet(fallbackSheetIndex),
|
|
1856
|
-
sheetName: _nullishCoalesce(_optionalChain([workbook, 'access',
|
|
1989
|
+
sheet: fallbackSheetIndex < workbook.sheetCount ? workbook.getSheet(fallbackSheetIndex) : null,
|
|
1990
|
+
sheetName: fallbackSheetIndex < workbook.sheetCount ? _nullishCoalesce(_optionalChain([workbook, 'access', _263 => _263.getSheet, 'call', _264 => _264(fallbackSheetIndex), 'optionalAccess', _265 => _265.name]), () => ( "")) : ""
|
|
1857
1991
|
};
|
|
1858
1992
|
}
|
|
1859
1993
|
try {
|
|
@@ -1865,13 +1999,13 @@ function resolveReferenceSheet(workbook, fallbackSheetIndex, formula) {
|
|
|
1865
1999
|
} catch (e3) {
|
|
1866
2000
|
return {
|
|
1867
2001
|
range: parseA1Range(split.range),
|
|
1868
|
-
sheet:
|
|
1869
|
-
sheetName:
|
|
2002
|
+
sheet: null,
|
|
2003
|
+
sheetName: split.sheetName
|
|
1870
2004
|
};
|
|
1871
2005
|
}
|
|
1872
2006
|
}
|
|
1873
2007
|
function resolveChartReferenceLabel(workbook, fallbackSheetIndex, reference, fallbackLabel) {
|
|
1874
|
-
if (!_optionalChain([reference, 'optionalAccess',
|
|
2008
|
+
if (!_optionalChain([reference, 'optionalAccess', _266 => _266.formula])) {
|
|
1875
2009
|
return fallbackLabel;
|
|
1876
2010
|
}
|
|
1877
2011
|
const resolved = resolveReferenceSheet(workbook, fallbackSheetIndex, reference.formula);
|
|
@@ -1893,7 +2027,7 @@ function resolveChartReferenceLabel(workbook, fallbackSheetIndex, reference, fal
|
|
|
1893
2027
|
return firstDisplay.length > 0 ? firstDisplay : fallbackLabel;
|
|
1894
2028
|
}
|
|
1895
2029
|
function resolveReferenceRowPaths(workbook, fallbackSheetIndex, reference) {
|
|
1896
|
-
if (!_optionalChain([reference, 'optionalAccess',
|
|
2030
|
+
if (!_optionalChain([reference, 'optionalAccess', _267 => _267.formula])) {
|
|
1897
2031
|
return [];
|
|
1898
2032
|
}
|
|
1899
2033
|
const resolved = resolveReferenceSheet(workbook, fallbackSheetIndex, reference.formula);
|
|
@@ -1947,11 +2081,11 @@ function normalizeChartExAxis(raw) {
|
|
|
1947
2081
|
id: typeof axis.id === "number" && Number.isFinite(axis.id) ? axis.id : void 0,
|
|
1948
2082
|
crossId: typeof axis.crossId === "number" && Number.isFinite(axis.crossId) ? axis.crossId : void 0,
|
|
1949
2083
|
majorGridlines: axis.majorGridlines != null ? true : void 0,
|
|
1950
|
-
majorUnit: typeof _optionalChain([scaling, 'optionalAccess',
|
|
1951
|
-
max: typeof _optionalChain([scaling, 'optionalAccess',
|
|
1952
|
-
min: typeof _optionalChain([scaling, 'optionalAccess',
|
|
2084
|
+
majorUnit: typeof _optionalChain([scaling, 'optionalAccess', _268 => _268.majorUnit]) === "number" ? scaling.majorUnit : void 0,
|
|
2085
|
+
max: typeof _optionalChain([scaling, 'optionalAccess', _269 => _269.max]) === "number" ? scaling.max : void 0,
|
|
2086
|
+
min: typeof _optionalChain([scaling, 'optionalAccess', _270 => _270.min]) === "number" ? scaling.min : void 0,
|
|
1953
2087
|
minorGridlines: axis.minorGridlines != null ? true : void 0,
|
|
1954
|
-
minorUnit: typeof _optionalChain([scaling, 'optionalAccess',
|
|
2088
|
+
minorUnit: typeof _optionalChain([scaling, 'optionalAccess', _271 => _271.minorUnit]) === "number" ? scaling.minorUnit : void 0,
|
|
1955
2089
|
numberFormat: numberFormat ? {
|
|
1956
2090
|
formatCode: typeof numberFormat.formatCode === "string" ? numberFormat.formatCode : void 0,
|
|
1957
2091
|
sourceLinked: typeof numberFormat.sourceLinked === "boolean" ? numberFormat.sourceLinked : void 0
|
|
@@ -2043,13 +2177,13 @@ function buildChartExHistogramBins(values, rawSeries, sortByFrequency) {
|
|
|
2043
2177
|
return [];
|
|
2044
2178
|
}
|
|
2045
2179
|
const rawRecord = rawSeries && typeof rawSeries === "object" ? rawSeries : null;
|
|
2046
|
-
const layoutProperties = _optionalChain([rawRecord, 'optionalAccess',
|
|
2047
|
-
const rawBinning = _optionalChain([layoutProperties, 'optionalAccess',
|
|
2180
|
+
const layoutProperties = _optionalChain([rawRecord, 'optionalAccess', _272 => _272.layoutProperties]) && typeof rawRecord.layoutProperties === "object" ? rawRecord.layoutProperties : null;
|
|
2181
|
+
const rawBinning = _optionalChain([layoutProperties, 'optionalAccess', _273 => _273.binning]) && typeof layoutProperties.binning === "object" ? layoutProperties.binning : null;
|
|
2048
2182
|
const minValue = Math.min(...values);
|
|
2049
2183
|
const maxValue = Math.max(...values);
|
|
2050
|
-
const explicitWidth = typeof _optionalChain([rawBinning, 'optionalAccess',
|
|
2051
|
-
const explicitCount = typeof _optionalChain([rawBinning, 'optionalAccess',
|
|
2052
|
-
const closedRight = _optionalChain([rawBinning, 'optionalAccess',
|
|
2184
|
+
const explicitWidth = typeof _optionalChain([rawBinning, 'optionalAccess', _274 => _274.binSize]) === "number" && Number.isFinite(rawBinning.binSize) && rawBinning.binSize > 0 ? rawBinning.binSize : void 0;
|
|
2185
|
+
const explicitCount = typeof _optionalChain([rawBinning, 'optionalAccess', _275 => _275.binCount]) === "number" && Number.isFinite(rawBinning.binCount) && rawBinning.binCount > 0 ? rawBinning.binCount : typeof _optionalChain([rawBinning, 'optionalAccess', _276 => _276.count]) === "number" && Number.isFinite(rawBinning.count) && rawBinning.count > 0 ? rawBinning.count : void 0;
|
|
2186
|
+
const closedRight = _optionalChain([rawBinning, 'optionalAccess', _277 => _277.intervalClosed]) === "r" || _optionalChain([rawBinning, 'optionalAccess', _278 => _278.intervalClosed]) === "right";
|
|
2053
2187
|
const mean = values.reduce((sum, value) => sum + value, 0) / values.length;
|
|
2054
2188
|
const variance = values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / Math.max(1, values.length);
|
|
2055
2189
|
const standardDeviation = Math.sqrt(Math.max(0, variance));
|
|
@@ -2100,7 +2234,7 @@ function buildChartExHistogramSeries(series, rawSeries, sortByFrequency) {
|
|
|
2100
2234
|
const layout = resolveChartExSeriesLayout(rawSeries);
|
|
2101
2235
|
const rawRecord = rawSeries && typeof rawSeries === "object" ? rawSeries : null;
|
|
2102
2236
|
const hasBinning = Boolean(
|
|
2103
|
-
layout === "clusteredColumn" && _optionalChain([rawRecord, 'optionalAccess',
|
|
2237
|
+
layout === "clusteredColumn" && _optionalChain([rawRecord, 'optionalAccess', _279 => _279.layoutProperties]) && typeof rawRecord.layoutProperties === "object" && rawRecord.layoutProperties.binning != null
|
|
2104
2238
|
);
|
|
2105
2239
|
if (!hasBinning) {
|
|
2106
2240
|
return series;
|
|
@@ -2135,13 +2269,14 @@ function buildChartExParetoLineSeries(series, sourceRaw, index) {
|
|
|
2135
2269
|
});
|
|
2136
2270
|
return {
|
|
2137
2271
|
...series,
|
|
2272
|
+
id: series.id.replace(/-series-\d+$/, `-series-${index}`),
|
|
2138
2273
|
color: void 0,
|
|
2139
2274
|
lineColor: void 0,
|
|
2140
2275
|
markerColor: void 0,
|
|
2141
2276
|
markerLineColor: void 0,
|
|
2142
2277
|
markerSize: 7,
|
|
2143
2278
|
markerSymbol: "circle",
|
|
2144
|
-
name: typeof _optionalChain([sourceRaw, 'optionalAccess',
|
|
2279
|
+
name: typeof _optionalChain([sourceRaw, 'optionalAccess', _280 => _280.text]) === "string" ? sourceRaw.text : "Pareto",
|
|
2145
2280
|
raw: {
|
|
2146
2281
|
..._nullishCoalesce(series.raw, () => ( {})),
|
|
2147
2282
|
chartExLayout: "paretoLine",
|
|
@@ -2212,11 +2347,11 @@ function normalizeChartExSeries(workbook, workbookSheetIndex, chartId, raw, data
|
|
|
2212
2347
|
const series = raw && typeof raw === "object" ? raw : {};
|
|
2213
2348
|
const dataId = typeof series.dataId === "number" ? series.dataId : null;
|
|
2214
2349
|
const dataEntry = dataId != null ? _nullishCoalesce(dataById.get(dataId), () => ( null)) : null;
|
|
2215
|
-
const dimensions = Array.isArray(_optionalChain([dataEntry, 'optionalAccess',
|
|
2350
|
+
const dimensions = Array.isArray(_optionalChain([dataEntry, 'optionalAccess', _281 => _281.dimensions])) ? dataEntry.dimensions.filter((value) => Boolean(value && typeof value === "object")) : [];
|
|
2216
2351
|
const categoryDimension = _nullishCoalesce(_nullishCoalesce(dimensions.find((dimension) => dimension.dimType === "cat"), () => ( dimensions.find((dimension) => dimension.dimType === "name"))), () => ( null));
|
|
2217
2352
|
const valueDimension = _nullishCoalesce(_nullishCoalesce(dimensions.find((dimension) => dimension.dimType === "val" || dimension.dimType === "y" || dimension.dimType === "colorVal" || dimension.dimType === "size"), () => ( dimensions.find((dimension) => dimension !== categoryDimension))), () => ( categoryDimension));
|
|
2218
|
-
const categoryDimensionFormula = typeof _optionalChain([categoryDimension, 'optionalAccess',
|
|
2219
|
-
const valueDimensionFormula = typeof _optionalChain([valueDimension, 'optionalAccess',
|
|
2353
|
+
const categoryDimensionFormula = typeof _optionalChain([categoryDimension, 'optionalAccess', _282 => _282.formula]) === "string" ? categoryDimension.formula : void 0;
|
|
2354
|
+
const valueDimensionFormula = typeof _optionalChain([valueDimension, 'optionalAccess', _283 => _283.formula]) === "string" ? valueDimension.formula : void 0;
|
|
2220
2355
|
const fallbackCategoryRef = (chartType === "Sunburst" || chartType === "Treemap") && !categoryDimension && typeof valueDimensionFormula === "string" ? resolveChartExFallbackCategoryReference(workbook, workbookSheetIndex, valueDimensionFormula) : null;
|
|
2221
2356
|
const categoriesRef = categoryDimension ? normalizeChartReference({
|
|
2222
2357
|
formula: categoryDimensionFormula
|
|
@@ -2224,7 +2359,7 @@ function normalizeChartExSeries(workbook, workbookSheetIndex, chartId, raw, data
|
|
|
2224
2359
|
const valuesRef = valueDimension ? normalizeChartReference({
|
|
2225
2360
|
formula: valueDimensionFormula
|
|
2226
2361
|
}) : null;
|
|
2227
|
-
const isCategoricalMap = chartType === "RegionMap" && _optionalChain([valueDimension, 'optionalAccess',
|
|
2362
|
+
const isCategoricalMap = chartType === "RegionMap" && _optionalChain([valueDimension, 'optionalAccess', _284 => _284.dimType]) === "colorStr";
|
|
2228
2363
|
const resolvedValueCells = resolveReferenceValues(workbook, workbookSheetIndex, valuesRef, isCategoricalMap ? "category" : "value");
|
|
2229
2364
|
const values = resolvedValueCells.map((value) => typeof value === "number" && Number.isFinite(value) ? value : null);
|
|
2230
2365
|
const colorStrings = isCategoricalMap ? resolvedValueCells.map((value) => {
|
|
@@ -2242,8 +2377,8 @@ function normalizeChartExSeries(workbook, workbookSheetIndex, chartId, raw, data
|
|
|
2242
2377
|
const hierarchyCategories = chartType === "Sunburst" || chartType === "Treemap" ? resolveReferenceRowPaths(workbook, workbookSheetIndex, categoriesRef) : [];
|
|
2243
2378
|
const seriesTextFormula = resolveChartExTextFormula(series.text);
|
|
2244
2379
|
const shapeProperties = series.shapeProperties && typeof series.shapeProperties === "object" ? series.shapeProperties : void 0;
|
|
2245
|
-
const rawFillColor = typeof _optionalChain([shapeProperties, 'optionalAccess',
|
|
2246
|
-
const rawLineColor = typeof _optionalChain([shapeProperties, 'optionalAccess',
|
|
2380
|
+
const rawFillColor = typeof _optionalChain([shapeProperties, 'optionalAccess', _285 => _285.solidFillHex]) === "string" ? normalizeHexColor(shapeProperties.solidFillHex) : null;
|
|
2381
|
+
const rawLineColor = typeof _optionalChain([shapeProperties, 'optionalAccess', _286 => _286.lineColorHex]) === "string" ? normalizeHexColor(shapeProperties.lineColorHex) : null;
|
|
2247
2382
|
return {
|
|
2248
2383
|
bubbleSizeRef: null,
|
|
2249
2384
|
bubbleSizes: [],
|
|
@@ -2257,7 +2392,7 @@ function normalizeChartExSeries(workbook, workbookSheetIndex, chartId, raw, data
|
|
|
2257
2392
|
id: `${chartId}-series-${index}`,
|
|
2258
2393
|
invertIfNegative: void 0,
|
|
2259
2394
|
lineColor: _nullishCoalesce(_nullishCoalesce(rawLineColor, () => ( rawFillColor)), () => ( void 0)),
|
|
2260
|
-
lineWidthPx: typeof _optionalChain([shapeProperties, 'optionalAccess',
|
|
2395
|
+
lineWidthPx: typeof _optionalChain([shapeProperties, 'optionalAccess', _287 => _287.lineWidth]) === "number" ? Math.max(1, Number(shapeProperties.lineWidth) / EMU_PER_PIXEL) : void 0,
|
|
2261
2396
|
marker: void 0,
|
|
2262
2397
|
markerColor: _nullishCoalesce(rawFillColor, () => ( void 0)),
|
|
2263
2398
|
markerLineColor: _nullishCoalesce(_nullishCoalesce(rawLineColor, () => ( rawFillColor)), () => ( void 0)),
|
|
@@ -2271,7 +2406,7 @@ function normalizeChartExSeries(workbook, workbookSheetIndex, chartId, raw, data
|
|
|
2271
2406
|
chartExColorStrings: colorStrings,
|
|
2272
2407
|
chartExHierarchyCategories: hierarchyCategories,
|
|
2273
2408
|
data: dataEntry,
|
|
2274
|
-
dimType: typeof _optionalChain([valueDimension, 'optionalAccess',
|
|
2409
|
+
dimType: typeof _optionalChain([valueDimension, 'optionalAccess', _288 => _288.dimType]) === "string" ? valueDimension.dimType : void 0
|
|
2275
2410
|
},
|
|
2276
2411
|
shapeProperties,
|
|
2277
2412
|
smooth: void 0,
|
|
@@ -2283,7 +2418,7 @@ function collapseChartExPointSeries(chartType, series) {
|
|
|
2283
2418
|
if (chartType !== "Funnel" && chartType !== "Waterfall") {
|
|
2284
2419
|
if ((chartType === "Sunburst" || chartType === "Treemap") && series.length > 1 && series.every((entry) => {
|
|
2285
2420
|
const raw = entry.raw && typeof entry.raw === "object" ? entry.raw : null;
|
|
2286
|
-
return _optionalChain([raw, 'optionalAccess',
|
|
2421
|
+
return _optionalChain([raw, 'optionalAccess', _289 => _289.dimType]) === "size";
|
|
2287
2422
|
})) {
|
|
2288
2423
|
const primarySeries2 = _nullishCoalesce(_nullishCoalesce(series.find((entry) => entry.hidden !== true), () => ( series[0])), () => ( null));
|
|
2289
2424
|
if (!primarySeries2) {
|
|
@@ -2397,7 +2532,7 @@ function normalizeChartExChart(workbook, workbookSheetIndex, visibleSheetIndex,
|
|
|
2397
2532
|
name: typeof drawing.name === "string" ? drawing.name : chartTitle,
|
|
2398
2533
|
overlap: void 0,
|
|
2399
2534
|
plotVisibleOnly: void 0,
|
|
2400
|
-
raw: chart,
|
|
2535
|
+
raw: { ...chart, officeSourceSeries: normalizedSeries },
|
|
2401
2536
|
radarStyle: void 0,
|
|
2402
2537
|
scatterStyle: void 0,
|
|
2403
2538
|
roundedCorners: void 0,
|
|
@@ -2503,8 +2638,8 @@ function cellValueToDisplay(value) {
|
|
|
2503
2638
|
return String(value);
|
|
2504
2639
|
}
|
|
2505
2640
|
function resolveReferenceValues(workbook, fallbackSheetIndex, reference, mode) {
|
|
2506
|
-
if (!_optionalChain([reference, 'optionalAccess',
|
|
2507
|
-
return _nullishCoalesce(_optionalChain([reference, 'optionalAccess',
|
|
2641
|
+
if (!_optionalChain([reference, 'optionalAccess', _290 => _290.formula])) {
|
|
2642
|
+
return _nullishCoalesce(_optionalChain([reference, 'optionalAccess', _291 => _291.values]), () => ( []));
|
|
2508
2643
|
}
|
|
2509
2644
|
const resolved = resolveReferenceSheet(workbook, fallbackSheetIndex, reference.formula);
|
|
2510
2645
|
if (!resolved.sheet || !resolved.range) {
|
|
@@ -2602,30 +2737,30 @@ function readChartAxisFromXml(axisNode, themePalette) {
|
|
|
2602
2737
|
const scalingNode = getFirstLocalChild(axisNode, "scaling");
|
|
2603
2738
|
return {
|
|
2604
2739
|
crossId: readChartNumericAttribute(axisNode, "crossAx"),
|
|
2605
|
-
crosses: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2606
|
-
crossBetween: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2607
|
-
delete: _optionalChain([getFirstLocalChild, 'call',
|
|
2740
|
+
crosses: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _292 => _292(axisNode, "crosses"), 'optionalAccess', _293 => _293.getAttribute, 'call', _294 => _294("val")]), () => ( void 0)),
|
|
2741
|
+
crossBetween: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _295 => _295(axisNode, "crossBetween"), 'optionalAccess', _296 => _296.getAttribute, 'call', _297 => _297("val")]), () => ( void 0)),
|
|
2742
|
+
delete: _optionalChain([getFirstLocalChild, 'call', _298 => _298(axisNode, "delete"), 'optionalAccess', _299 => _299.getAttribute, 'call', _300 => _300("val")]) === "1" ? true : _optionalChain([getFirstLocalChild, 'call', _301 => _301(axisNode, "delete"), 'optionalAccess', _302 => _302.getAttribute, 'call', _303 => _303("val")]) === "0" ? false : void 0,
|
|
2608
2743
|
id: readChartNumericAttribute(axisNode, "axId"),
|
|
2609
|
-
labelPosition: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2744
|
+
labelPosition: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _304 => _304(axisNode, "tickLblPos"), 'optionalAccess', _305 => _305.getAttribute, 'call', _306 => _306("val")]), () => ( void 0)),
|
|
2610
2745
|
logBase: readChartNumericAttribute(getFirstLocalChild(axisNode, "scaling"), "logBase"),
|
|
2611
|
-
orientation: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2746
|
+
orientation: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _307 => _307(_nullishCoalesce(scalingNode, () => ( axisNode)), "orientation"), 'optionalAccess', _308 => _308.getAttribute, 'call', _309 => _309("val")]), () => ( void 0)),
|
|
2612
2747
|
majorGridlines: Boolean(getFirstLocalChild(axisNode, "majorGridlines")),
|
|
2613
2748
|
majorGridlineColor: (() => {
|
|
2614
2749
|
const style = resolveChartLineStyle(getFirstLocalChild(getFirstLocalChild(axisNode, "majorGridlines"), "spPr"), themePalette);
|
|
2615
2750
|
return style.hidden ? "transparent" : _nullishCoalesce(style.color, () => ( void 0));
|
|
2616
2751
|
})(),
|
|
2617
|
-
majorTickMark: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2752
|
+
majorTickMark: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _310 => _310(axisNode, "majorTickMark"), 'optionalAccess', _311 => _311.getAttribute, 'call', _312 => _312("val")]), () => ( void 0)),
|
|
2618
2753
|
majorUnit: readChartNumericAttribute(axisNode, "majorUnit"),
|
|
2619
2754
|
max: readChartNumericAttribute(scalingNode, "max"),
|
|
2620
2755
|
min: readChartNumericAttribute(scalingNode, "min"),
|
|
2621
2756
|
minorGridlines: Boolean(getFirstLocalChild(axisNode, "minorGridlines")),
|
|
2622
|
-
minorTickMark: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2757
|
+
minorTickMark: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _313 => _313(axisNode, "minorTickMark"), 'optionalAccess', _314 => _314.getAttribute, 'call', _315 => _315("val")]), () => ( void 0)),
|
|
2623
2758
|
minorUnit: readChartNumericAttribute(axisNode, "minorUnit"),
|
|
2624
2759
|
numberFormat: numFmt ? {
|
|
2625
2760
|
formatCode: _nullishCoalesce(numFmt.getAttribute("formatCode"), () => ( void 0)),
|
|
2626
2761
|
sourceLinked: numFmt.getAttribute("sourceLinked") === "1" ? true : numFmt.getAttribute("sourceLinked") === "0" ? false : void 0
|
|
2627
2762
|
} : void 0,
|
|
2628
|
-
position: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2763
|
+
position: _nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _316 => _316(axisNode, "axPos"), 'optionalAccess', _317 => _317.getAttribute, 'call', _318 => _318("val")]), () => ( void 0)),
|
|
2629
2764
|
tickLabelSkip: readChartNumericAttribute(axisNode, "tickLblSkip"),
|
|
2630
2765
|
tickMarkSkip: readChartNumericAttribute(axisNode, "tickMarkSkip")
|
|
2631
2766
|
};
|
|
@@ -2715,10 +2850,10 @@ function normalizeChartAnchor(raw) {
|
|
|
2715
2850
|
if (anchor.type === "oneCell") {
|
|
2716
2851
|
return {
|
|
2717
2852
|
from: {
|
|
2718
|
-
col: typeof _optionalChain([from, 'optionalAccess',
|
|
2719
|
-
colOffsetEmu: typeof _optionalChain([from, 'optionalAccess',
|
|
2720
|
-
row: typeof _optionalChain([from, 'optionalAccess',
|
|
2721
|
-
rowOffsetEmu: typeof _optionalChain([from, 'optionalAccess',
|
|
2853
|
+
col: typeof _optionalChain([from, 'optionalAccess', _319 => _319.col]) === "number" ? from.col : 0,
|
|
2854
|
+
colOffsetEmu: typeof _optionalChain([from, 'optionalAccess', _320 => _320.colOffsetEmu]) === "number" ? from.colOffsetEmu : 0,
|
|
2855
|
+
row: typeof _optionalChain([from, 'optionalAccess', _321 => _321.row]) === "number" ? from.row : 0,
|
|
2856
|
+
rowOffsetEmu: typeof _optionalChain([from, 'optionalAccess', _322 => _322.rowOffsetEmu]) === "number" ? from.rowOffsetEmu : 0
|
|
2722
2857
|
},
|
|
2723
2858
|
kind: "one-cell",
|
|
2724
2859
|
sizeEmu: {
|
|
@@ -2741,14 +2876,14 @@ function normalizeChartAnchor(raw) {
|
|
|
2741
2876
|
};
|
|
2742
2877
|
}
|
|
2743
2878
|
const to = anchor.to && typeof anchor.to === "object" ? anchor.to : null;
|
|
2744
|
-
const fromColValue = _optionalChain([from, 'optionalAccess',
|
|
2745
|
-
const fromColOffsetValue = _optionalChain([from, 'optionalAccess',
|
|
2746
|
-
const fromRowValue = _optionalChain([from, 'optionalAccess',
|
|
2747
|
-
const fromRowOffsetValue = _optionalChain([from, 'optionalAccess',
|
|
2748
|
-
const toColValue = _optionalChain([to, 'optionalAccess',
|
|
2749
|
-
const toColOffsetValue = _optionalChain([to, 'optionalAccess',
|
|
2750
|
-
const toRowValue = _optionalChain([to, 'optionalAccess',
|
|
2751
|
-
const toRowOffsetValue = _optionalChain([to, 'optionalAccess',
|
|
2879
|
+
const fromColValue = _optionalChain([from, 'optionalAccess', _323 => _323.col]);
|
|
2880
|
+
const fromColOffsetValue = _optionalChain([from, 'optionalAccess', _324 => _324.colOffsetEmu]);
|
|
2881
|
+
const fromRowValue = _optionalChain([from, 'optionalAccess', _325 => _325.row]);
|
|
2882
|
+
const fromRowOffsetValue = _optionalChain([from, 'optionalAccess', _326 => _326.rowOffsetEmu]);
|
|
2883
|
+
const toColValue = _optionalChain([to, 'optionalAccess', _327 => _327.col]);
|
|
2884
|
+
const toColOffsetValue = _optionalChain([to, 'optionalAccess', _328 => _328.colOffsetEmu]);
|
|
2885
|
+
const toRowValue = _optionalChain([to, 'optionalAccess', _329 => _329.row]);
|
|
2886
|
+
const toRowOffsetValue = _optionalChain([to, 'optionalAccess', _330 => _330.rowOffsetEmu]);
|
|
2752
2887
|
const fromCol = typeof fromColValue === "number" ? fromColValue : 0;
|
|
2753
2888
|
const fromColOffsetEmu = typeof fromColOffsetValue === "number" ? fromColOffsetValue : 0;
|
|
2754
2889
|
const fromRow = typeof fromRowValue === "number" ? fromRowValue : 0;
|
|
@@ -2777,10 +2912,10 @@ function parseMarkerNode(node) {
|
|
|
2777
2912
|
if (!node) {
|
|
2778
2913
|
return null;
|
|
2779
2914
|
}
|
|
2780
|
-
const col = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2781
|
-
const row = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2782
|
-
const colOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2783
|
-
const rowOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
2915
|
+
const col = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _331 => _331(node, "col"), 'optionalAccess', _332 => _332.textContent]), () => ( Number.NaN)));
|
|
2916
|
+
const row = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _333 => _333(node, "row"), 'optionalAccess', _334 => _334.textContent]), () => ( Number.NaN)));
|
|
2917
|
+
const colOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _335 => _335(node, "colOff"), 'optionalAccess', _336 => _336.textContent]), () => ( 0)));
|
|
2918
|
+
const rowOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _337 => _337(node, "rowOff"), 'optionalAccess', _338 => _338.textContent]), () => ( 0)));
|
|
2784
2919
|
if (!Number.isFinite(col) || !Number.isFinite(row)) {
|
|
2785
2920
|
return null;
|
|
2786
2921
|
}
|
|
@@ -2800,8 +2935,8 @@ function parseChartAnchorNode(anchorNode) {
|
|
|
2800
2935
|
if (anchorNode.localName === "oneCellAnchor") {
|
|
2801
2936
|
const from = parseMarkerNode(getFirstLocalChild(anchorNode, "from"));
|
|
2802
2937
|
const ext2 = getFirstLocalChild(anchorNode, "ext");
|
|
2803
|
-
const cx2 = Number(_nullishCoalesce(_optionalChain([ext2, 'optionalAccess',
|
|
2804
|
-
const cy2 = Number(_nullishCoalesce(_optionalChain([ext2, 'optionalAccess',
|
|
2938
|
+
const cx2 = Number(_nullishCoalesce(_optionalChain([ext2, 'optionalAccess', _339 => _339.getAttribute, 'call', _340 => _340("cx")]), () => ( Number.NaN)));
|
|
2939
|
+
const cy2 = Number(_nullishCoalesce(_optionalChain([ext2, 'optionalAccess', _341 => _341.getAttribute, 'call', _342 => _342("cy")]), () => ( Number.NaN)));
|
|
2805
2940
|
return from && Number.isFinite(cx2) && Number.isFinite(cy2) ? {
|
|
2806
2941
|
from,
|
|
2807
2942
|
kind: "one-cell",
|
|
@@ -2813,10 +2948,10 @@ function parseChartAnchorNode(anchorNode) {
|
|
|
2813
2948
|
}
|
|
2814
2949
|
const pos = getFirstLocalChild(anchorNode, "pos");
|
|
2815
2950
|
const ext = getFirstLocalChild(anchorNode, "ext");
|
|
2816
|
-
const x = Number(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
2817
|
-
const y = Number(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
2818
|
-
const cx = Number(_nullishCoalesce(_optionalChain([ext, 'optionalAccess',
|
|
2819
|
-
const cy = Number(_nullishCoalesce(_optionalChain([ext, 'optionalAccess',
|
|
2951
|
+
const x = Number(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _343 => _343.getAttribute, 'call', _344 => _344("x")]), () => ( Number.NaN)));
|
|
2952
|
+
const y = Number(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _345 => _345.getAttribute, 'call', _346 => _346("y")]), () => ( Number.NaN)));
|
|
2953
|
+
const cx = Number(_nullishCoalesce(_optionalChain([ext, 'optionalAccess', _347 => _347.getAttribute, 'call', _348 => _348("cx")]), () => ( Number.NaN)));
|
|
2954
|
+
const cy = Number(_nullishCoalesce(_optionalChain([ext, 'optionalAccess', _349 => _349.getAttribute, 'call', _350 => _350("cy")]), () => ( Number.NaN)));
|
|
2820
2955
|
return Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(cx) && Number.isFinite(cy) ? {
|
|
2821
2956
|
kind: "absolute",
|
|
2822
2957
|
positionEmu: {
|
|
@@ -2842,8 +2977,8 @@ function normalizeChartSeries(workbook, workbookSheetIndex, chartId, raw, index)
|
|
|
2842
2977
|
const categoriesRef = normalizeChartReference(series.categories);
|
|
2843
2978
|
const valuesRef = normalizeChartReference(series.values);
|
|
2844
2979
|
const shapeProperties = series.shapeProperties && typeof series.shapeProperties === "object" ? series.shapeProperties : void 0;
|
|
2845
|
-
const rawFillColor = typeof _optionalChain([shapeProperties, 'optionalAccess',
|
|
2846
|
-
const rawLineColor = typeof _optionalChain([shapeProperties, 'optionalAccess',
|
|
2980
|
+
const rawFillColor = typeof _optionalChain([shapeProperties, 'optionalAccess', _351 => _351.solidFillHex]) === "string" ? normalizeHexColor(shapeProperties.solidFillHex) : null;
|
|
2981
|
+
const rawLineColor = typeof _optionalChain([shapeProperties, 'optionalAccess', _352 => _352.lineColorHex]) === "string" ? normalizeHexColor(shapeProperties.lineColorHex) : null;
|
|
2847
2982
|
const bubbleSizeRef = normalizeChartReference(_nullishCoalesce(_nullishCoalesce(series.bubbleSize, () => ( series.bubbleSizes)), () => ( series.bubbles)));
|
|
2848
2983
|
return {
|
|
2849
2984
|
bubbleSizeRef,
|
|
@@ -2856,7 +2991,7 @@ function normalizeChartSeries(workbook, workbookSheetIndex, chartId, raw, index)
|
|
|
2856
2991
|
id: `${chartId}-series-${index}`,
|
|
2857
2992
|
invertIfNegative: typeof series.invertIfNegative === "boolean" ? series.invertIfNegative : void 0,
|
|
2858
2993
|
lineColor: _nullishCoalesce(_nullishCoalesce(rawLineColor, () => ( rawFillColor)), () => ( void 0)),
|
|
2859
|
-
lineWidthPx: typeof _optionalChain([shapeProperties, 'optionalAccess',
|
|
2994
|
+
lineWidthPx: typeof _optionalChain([shapeProperties, 'optionalAccess', _353 => _353.lineWidth]) === "number" ? Math.max(1, Number(shapeProperties.lineWidth) / EMU_PER_PIXEL) : void 0,
|
|
2860
2995
|
marker: series.marker && typeof series.marker === "object" ? series.marker : void 0,
|
|
2861
2996
|
markerColor: void 0,
|
|
2862
2997
|
markerLineColor: void 0,
|
|
@@ -2865,7 +3000,13 @@ function normalizeChartSeries(workbook, workbookSheetIndex, chartId, raw, index)
|
|
|
2865
3000
|
name: resolveSeriesName(workbook, workbookSheetIndex, series.name),
|
|
2866
3001
|
negativeColor: void 0,
|
|
2867
3002
|
negativeLineColor: void 0,
|
|
2868
|
-
raw:
|
|
3003
|
+
raw: {
|
|
3004
|
+
...series,
|
|
3005
|
+
unresolvedCategoriesReference: Boolean(_optionalChain([categoriesRef, 'optionalAccess', _354 => _354.formula]) && !resolveReferenceSheet(workbook, workbookSheetIndex, categoriesRef.formula).sheet),
|
|
3006
|
+
unresolvedValuesReference: Boolean(_optionalChain([valuesRef, 'optionalAccess', _355 => _355.formula]) && !resolveReferenceSheet(workbook, workbookSheetIndex, valuesRef.formula).sheet),
|
|
3007
|
+
unresolvedBubbleSizeReference: Boolean(_optionalChain([bubbleSizeRef, 'optionalAccess', _356 => _356.formula]) && !resolveReferenceSheet(workbook, workbookSheetIndex, bubbleSizeRef.formula).sheet),
|
|
3008
|
+
unresolvedNameReference: typeof series.name === "string" && series.name.includes("!") && !resolveReferenceSheet(workbook, workbookSheetIndex, series.name).sheet
|
|
3009
|
+
},
|
|
2869
3010
|
shapeProperties,
|
|
2870
3011
|
smooth: typeof series.smooth === "boolean" ? series.smooth : void 0,
|
|
2871
3012
|
values: resolveReferenceValues(workbook, workbookSheetIndex, valuesRef, "value").map((value) => typeof value === "number" && Number.isFinite(value) ? value : null),
|
|
@@ -2927,12 +3068,15 @@ function buildTabs(workbook, chartsheets, visibleSheetIndexByWorkbookSheetIndex,
|
|
|
2927
3068
|
const slotIndex = typeof entry.index === "number" ? entry.index : index;
|
|
2928
3069
|
if (slotType === "chartsheet") {
|
|
2929
3070
|
const chartsheet = chartsheets[slotIndex];
|
|
3071
|
+
const visibility2 = normalizeWorksheetVisibility(_optionalChain([chartsheet, 'optionalAccess', _357 => _357.raw, 'optionalAccess', _358 => _358.visibility]));
|
|
3072
|
+
if (!showHiddenSheets && visibility2 !== "visible") return [];
|
|
2930
3073
|
return chartsheet ? [{
|
|
2931
3074
|
chartsheetIndex: slotIndex,
|
|
2932
3075
|
id: `chartsheet-${slotIndex}`,
|
|
2933
3076
|
index,
|
|
2934
3077
|
kind: "chartsheet",
|
|
2935
|
-
name: chartsheet.name
|
|
3078
|
+
name: chartsheet.name,
|
|
3079
|
+
visibility: visibility2
|
|
2936
3080
|
}] : [];
|
|
2937
3081
|
}
|
|
2938
3082
|
const worksheet = workbook.getSheet(slotIndex);
|
|
@@ -2986,7 +3130,7 @@ function collectChartOriginsForSheet(archive, origin) {
|
|
|
2986
3130
|
for (const anchorNode of anchorNodes) {
|
|
2987
3131
|
const graphicFrame = getFirstLocalDescendant(anchorNode, "graphicFrame");
|
|
2988
3132
|
const chartNode = graphicFrame ? getFirstLocalDescendant(graphicFrame, "chart") : null;
|
|
2989
|
-
const relationshipId = _nullishCoalesce(_nullishCoalesce(_optionalChain([chartNode, 'optionalAccess',
|
|
3133
|
+
const relationshipId = _nullishCoalesce(_nullishCoalesce(_optionalChain([chartNode, 'optionalAccess', _359 => _359.getAttributeNS, 'call', _360 => _360("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "id")]), () => ( _optionalChain([chartNode, 'optionalAccess', _361 => _361.getAttribute, 'call', _362 => _362("r:id")]))), () => ( _optionalChain([chartNode, 'optionalAccess', _363 => _363.getAttribute, 'call', _364 => _364("id")])));
|
|
2990
3134
|
if (!relationshipId) {
|
|
2991
3135
|
continue;
|
|
2992
3136
|
}
|
|
@@ -3036,9 +3180,24 @@ function applyChartOrigins(chartsByWorkbookSheetIndex, chartOriginsById, archive
|
|
|
3036
3180
|
});
|
|
3037
3181
|
}
|
|
3038
3182
|
}
|
|
3039
|
-
function hydrateWorkbookChartStyles(chartsByWorkbookSheetIndex, imageAssets) {
|
|
3183
|
+
function hydrateWorkbookChartStyles(chartsByWorkbookSheetIndex, imageAssets, chartsheets = []) {
|
|
3040
3184
|
const chartOriginsById = /* @__PURE__ */ new Map();
|
|
3041
3185
|
applyChartOrigins(chartsByWorkbookSheetIndex, chartOriginsById, imageAssets.archive, imageAssets.sheetOrigins);
|
|
3186
|
+
const chartsheetOrigins = collectChartsheetDrawingOrigins(imageAssets.archive, chartsheets);
|
|
3187
|
+
for (const chartsheet of chartsheets) {
|
|
3188
|
+
if (chartsheet.workbookSheetIndex == null) continue;
|
|
3189
|
+
const charts = _nullishCoalesce(chartsByWorkbookSheetIndex[chartsheet.workbookSheetIndex], () => ( []));
|
|
3190
|
+
const origins = collectChartOriginsForSheet(imageAssets.archive, _nullishCoalesce(chartsheetOrigins.get(chartsheet.index), () => ( null)));
|
|
3191
|
+
for (const chart of charts) {
|
|
3192
|
+
const kind = chart.id.startsWith("chart-ex-") ? "modern" : "classic";
|
|
3193
|
+
const origin = origins.find((entry) => entry.chartKind === kind);
|
|
3194
|
+
if (!origin) continue;
|
|
3195
|
+
if (origin.anchor) chart.anchor = origin.anchor;
|
|
3196
|
+
chart.chartPath = _nullishCoalesce(origin.chartPath, () => ( void 0));
|
|
3197
|
+
chartsheet.chartPath = chart.chartPath;
|
|
3198
|
+
chartOriginsById.set(chart.id, origin);
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3042
3201
|
for (const charts of chartsByWorkbookSheetIndex) {
|
|
3043
3202
|
for (const chart of charts) {
|
|
3044
3203
|
applyChartStyleFromXml(chart, chart.chartPath, imageAssets.archive, imageAssets.themePalette);
|
|
@@ -3047,6 +3206,84 @@ function hydrateWorkbookChartStyles(chartsByWorkbookSheetIndex, imageAssets) {
|
|
|
3047
3206
|
}
|
|
3048
3207
|
return chartOriginsById;
|
|
3049
3208
|
}
|
|
3209
|
+
function normalizeClassicChartDrawing(workbook, workbookSheetIndex, visibleSheetIndex, rawChart, chartIndex, chartId = `chart-${workbookSheetIndex}-${chartIndex}`) {
|
|
3210
|
+
const drawing = rawChart && typeof rawChart === "object" ? rawChart : {};
|
|
3211
|
+
const chart = drawing.chart && typeof drawing.chart === "object" ? drawing.chart : {};
|
|
3212
|
+
const rawView3d = chart.view3D && typeof chart.view3D === "object" ? chart.view3D : null;
|
|
3213
|
+
const rawSeries = Array.isArray(chart.series) ? chart.series : [];
|
|
3214
|
+
const typeGroups = Array.isArray(chart.typeGroups) ? chart.typeGroups.map((entry, groupIndex) => normalizeChartTypeGroup(workbook, workbookSheetIndex, chartId, entry, groupIndex)).filter((value) => value != null) : [];
|
|
3215
|
+
let seriesOrdinal = 0;
|
|
3216
|
+
const series = typeGroups.some((group) => group.series.length > 0) ? typeGroups.flatMap((group) => {
|
|
3217
|
+
group.series = group.series.map((entry) => ({ ...entry, id: `${chartId}-series-${seriesOrdinal++}` }));
|
|
3218
|
+
return group.series;
|
|
3219
|
+
}) : rawSeries.map((entry, seriesIndex) => normalizeChartSeries(workbook, workbookSheetIndex, chartId, entry, seriesIndex));
|
|
3220
|
+
const chartLevelDataLabels = normalizeChartDataLabels(chart.dataLabels);
|
|
3221
|
+
const firstSeriesDataLabels = rawSeries.length > 0 && rawSeries[0] && typeof rawSeries[0] === "object" ? normalizeChartDataLabels(rawSeries[0].dataLabels) : null;
|
|
3222
|
+
return {
|
|
3223
|
+
anchor: normalizeChartAnchor(drawing.anchor),
|
|
3224
|
+
autoTitleDeleted: typeof chart.autoTitleDeleted === "boolean" ? chart.autoTitleDeleted : void 0,
|
|
3225
|
+
axes: Array.isArray(chart.axes) ? chart.axes.map(normalizeChartAxis).filter((value) => Boolean(value)) : [],
|
|
3226
|
+
axisLabelColor: void 0,
|
|
3227
|
+
axisLineColor: void 0,
|
|
3228
|
+
categoryAxis: normalizeChartAxis(chart.categoryAxis),
|
|
3229
|
+
chartAreaBorderColor: void 0,
|
|
3230
|
+
chartAreaFillColor: void 0,
|
|
3231
|
+
chartColorPalette: void 0,
|
|
3232
|
+
chartColorPaletteOffset: void 0,
|
|
3233
|
+
chartPath: void 0,
|
|
3234
|
+
chartStyleId: void 0,
|
|
3235
|
+
chartType: typeof chart.chartType === "string" ? chart.chartType : "ColumnClustered",
|
|
3236
|
+
dataLabels: _nullishCoalesce(chartLevelDataLabels, () => ( firstSeriesDataLabels)),
|
|
3237
|
+
displayBlanksAs: typeof chart.displayBlanksAs === "string" ? chart.displayBlanksAs : void 0,
|
|
3238
|
+
editable: true,
|
|
3239
|
+
firstSliceAngle: typeof chart.firstSliceAngle === "number" ? chart.firstSliceAngle : void 0,
|
|
3240
|
+
fontFamily: void 0,
|
|
3241
|
+
gapWidth: typeof chart.gapWidth === "number" ? chart.gapWidth : void 0,
|
|
3242
|
+
holeSize: typeof chart.holeSize === "number" ? chart.holeSize : void 0,
|
|
3243
|
+
id: chartId,
|
|
3244
|
+
is3d: typeof chart.is3D === "boolean" ? chart.is3D : typeof chart.is3d === "boolean" ? chart.is3d : void 0,
|
|
3245
|
+
legend: normalizeLegend(chart.legend) ? {
|
|
3246
|
+
...normalizeLegend(chart.legend),
|
|
3247
|
+
position: normalizeLegendPosition(_optionalChain([normalizeLegend, 'call', _365 => _365(chart.legend), 'optionalAccess', _366 => _366.position]))
|
|
3248
|
+
} : null,
|
|
3249
|
+
name: typeof drawing.name === "string" ? drawing.name : void 0,
|
|
3250
|
+
overlap: typeof chart.overlap === "number" ? chart.overlap : void 0,
|
|
3251
|
+
plotVisibleOnly: typeof chart.plotVisibleOnly === "boolean" ? chart.plotVisibleOnly : void 0,
|
|
3252
|
+
raw: chart,
|
|
3253
|
+
radarStyle: typeof chart.radarStyle === "string" ? chart.radarStyle : void 0,
|
|
3254
|
+
scatterStyle: typeof chart.scatterStyle === "string" ? chart.scatterStyle : void 0,
|
|
3255
|
+
roundedCorners: typeof chart.roundedCorners === "boolean" ? chart.roundedCorners : void 0,
|
|
3256
|
+
shape3d: typeof chart.shape === "string" ? chart.shape : typeof chart.shape3d === "string" ? chart.shape3d : void 0,
|
|
3257
|
+
seriesAxis: null,
|
|
3258
|
+
series,
|
|
3259
|
+
sheetIndex: visibleSheetIndex,
|
|
3260
|
+
showDlblsOverMax: typeof chart.showDlblsOverMax === "boolean" ? chart.showDlblsOverMax : void 0,
|
|
3261
|
+
sideWall: null,
|
|
3262
|
+
backWall: null,
|
|
3263
|
+
bubbleScale: typeof chart.bubbleScale === "number" ? chart.bubbleScale : void 0,
|
|
3264
|
+
bubble3d: typeof chart.bubble3d === "boolean" ? chart.bubble3d : void 0,
|
|
3265
|
+
floor: null,
|
|
3266
|
+
surfaceMaterial: void 0,
|
|
3267
|
+
textColor: void 0,
|
|
3268
|
+
title: typeof chart.title === "string" ? chart.title : void 0,
|
|
3269
|
+
titleColor: void 0,
|
|
3270
|
+
titleFontFamily: void 0,
|
|
3271
|
+
typeGroups,
|
|
3272
|
+
valueAxis: normalizeChartAxis(chart.valueAxis),
|
|
3273
|
+
varyColors: typeof chart.varyColors === "boolean" ? chart.varyColors : void 0,
|
|
3274
|
+
view3d: rawView3d ? {
|
|
3275
|
+
depthPercent: typeof rawView3d.depthPercent === "number" ? rawView3d.depthPercent : void 0,
|
|
3276
|
+
heightPercent: typeof rawView3d.heightPercent === "number" ? rawView3d.heightPercent : void 0,
|
|
3277
|
+
perspective: typeof rawView3d.perspective === "number" ? rawView3d.perspective : void 0,
|
|
3278
|
+
rAngAx: typeof rawView3d.rAngAx === "boolean" ? rawView3d.rAngAx : typeof rawView3d.rightAngleAxes === "boolean" ? rawView3d.rightAngleAxes : void 0,
|
|
3279
|
+
rotX: typeof rawView3d.rotX === "number" ? rawView3d.rotX : typeof rawView3d.rotateX === "number" ? rawView3d.rotateX : void 0,
|
|
3280
|
+
rotY: typeof rawView3d.rotY === "number" ? rawView3d.rotY : typeof rawView3d.rotateY === "number" ? rawView3d.rotateY : void 0
|
|
3281
|
+
} : void 0,
|
|
3282
|
+
wireframe: typeof chart.wireframe === "boolean" ? chart.wireframe : void 0,
|
|
3283
|
+
workbookSheetIndex,
|
|
3284
|
+
zIndex: Array.isArray(drawing.drawingPath) && typeof drawing.drawingPath[0] === "number" ? drawing.drawingPath[0] + 1 : chartIndex + 1
|
|
3285
|
+
};
|
|
3286
|
+
}
|
|
3050
3287
|
function loadWorkbookChartAssets(workbook, imageAssets, visibleSheetIndexByWorkbookSheetIndex, showHiddenSheets = false) {
|
|
3051
3288
|
const excludedChartIds = /* @__PURE__ */ new Set();
|
|
3052
3289
|
const chartsByWorkbookSheetIndex = Array.from({ length: workbook.sheetCount }, (_, workbookSheetIndex) => {
|
|
@@ -3059,76 +3296,7 @@ function loadWorkbookChartAssets(workbook, imageAssets, visibleSheetIndexByWorkb
|
|
|
3059
3296
|
if (rawChart.hidden || !rawChart.anchor) {
|
|
3060
3297
|
excludedChartIds.add(chartId);
|
|
3061
3298
|
}
|
|
3062
|
-
|
|
3063
|
-
const chart = drawing.chart && typeof drawing.chart === "object" ? drawing.chart : {};
|
|
3064
|
-
const rawView3d = chart.view3D && typeof chart.view3D === "object" ? chart.view3D : null;
|
|
3065
|
-
const rawSeries = Array.isArray(chart.series) ? chart.series : [];
|
|
3066
|
-
const chartLevelDataLabels = normalizeChartDataLabels(chart.dataLabels);
|
|
3067
|
-
const firstSeriesDataLabels = rawSeries.length > 0 && rawSeries[0] && typeof rawSeries[0] === "object" ? normalizeChartDataLabels(rawSeries[0].dataLabels) : null;
|
|
3068
|
-
return {
|
|
3069
|
-
anchor: normalizeChartAnchor(drawing.anchor),
|
|
3070
|
-
autoTitleDeleted: typeof chart.autoTitleDeleted === "boolean" ? chart.autoTitleDeleted : void 0,
|
|
3071
|
-
axes: Array.isArray(chart.axes) ? chart.axes.map(normalizeChartAxis).filter((value) => Boolean(value)) : [],
|
|
3072
|
-
axisLabelColor: void 0,
|
|
3073
|
-
axisLineColor: void 0,
|
|
3074
|
-
categoryAxis: normalizeChartAxis(chart.categoryAxis),
|
|
3075
|
-
chartAreaBorderColor: void 0,
|
|
3076
|
-
chartAreaFillColor: void 0,
|
|
3077
|
-
chartColorPalette: void 0,
|
|
3078
|
-
chartColorPaletteOffset: void 0,
|
|
3079
|
-
chartPath: void 0,
|
|
3080
|
-
chartStyleId: void 0,
|
|
3081
|
-
chartType: typeof chart.chartType === "string" ? chart.chartType : "ColumnClustered",
|
|
3082
|
-
dataLabels: _nullishCoalesce(chartLevelDataLabels, () => ( firstSeriesDataLabels)),
|
|
3083
|
-
displayBlanksAs: typeof chart.displayBlanksAs === "string" ? chart.displayBlanksAs : void 0,
|
|
3084
|
-
editable: true,
|
|
3085
|
-
firstSliceAngle: typeof chart.firstSliceAngle === "number" ? chart.firstSliceAngle : void 0,
|
|
3086
|
-
fontFamily: void 0,
|
|
3087
|
-
gapWidth: typeof chart.gapWidth === "number" ? chart.gapWidth : void 0,
|
|
3088
|
-
holeSize: typeof chart.holeSize === "number" ? chart.holeSize : void 0,
|
|
3089
|
-
id: chartId,
|
|
3090
|
-
is3d: typeof chart.is3D === "boolean" ? chart.is3D : void 0,
|
|
3091
|
-
legend: normalizeLegend(chart.legend) ? {
|
|
3092
|
-
...normalizeLegend(chart.legend),
|
|
3093
|
-
position: normalizeLegendPosition(_optionalChain([normalizeLegend, 'call', _313 => _313(chart.legend), 'optionalAccess', _314 => _314.position]))
|
|
3094
|
-
} : null,
|
|
3095
|
-
name: typeof drawing.name === "string" ? drawing.name : void 0,
|
|
3096
|
-
overlap: typeof chart.overlap === "number" ? chart.overlap : void 0,
|
|
3097
|
-
plotVisibleOnly: typeof chart.plotVisibleOnly === "boolean" ? chart.plotVisibleOnly : void 0,
|
|
3098
|
-
raw: chart,
|
|
3099
|
-
radarStyle: typeof chart.radarStyle === "string" ? chart.radarStyle : void 0,
|
|
3100
|
-
scatterStyle: typeof chart.scatterStyle === "string" ? chart.scatterStyle : void 0,
|
|
3101
|
-
roundedCorners: typeof chart.roundedCorners === "boolean" ? chart.roundedCorners : void 0,
|
|
3102
|
-
shape3d: typeof chart.shape === "string" ? chart.shape : typeof chart.shape3d === "string" ? chart.shape3d : void 0,
|
|
3103
|
-
seriesAxis: null,
|
|
3104
|
-
series: rawSeries.map((entry, seriesIndex) => normalizeChartSeries(workbook, workbookSheetIndex, chartId, entry, seriesIndex)),
|
|
3105
|
-
sheetIndex: visibleSheetIndex,
|
|
3106
|
-
showDlblsOverMax: typeof chart.showDlblsOverMax === "boolean" ? chart.showDlblsOverMax : void 0,
|
|
3107
|
-
sideWall: null,
|
|
3108
|
-
backWall: null,
|
|
3109
|
-
bubbleScale: typeof chart.bubbleScale === "number" ? chart.bubbleScale : void 0,
|
|
3110
|
-
bubble3d: typeof chart.bubble3d === "boolean" ? chart.bubble3d : void 0,
|
|
3111
|
-
floor: null,
|
|
3112
|
-
surfaceMaterial: void 0,
|
|
3113
|
-
textColor: void 0,
|
|
3114
|
-
title: typeof chart.title === "string" ? chart.title : void 0,
|
|
3115
|
-
titleColor: void 0,
|
|
3116
|
-
titleFontFamily: void 0,
|
|
3117
|
-
typeGroups: Array.isArray(chart.typeGroups) ? chart.typeGroups.map((entry, groupIndex) => normalizeChartTypeGroup(workbook, workbookSheetIndex, chartId, entry, groupIndex)).filter((value) => value != null) : [],
|
|
3118
|
-
valueAxis: normalizeChartAxis(chart.valueAxis),
|
|
3119
|
-
varyColors: typeof chart.varyColors === "boolean" ? chart.varyColors : void 0,
|
|
3120
|
-
view3d: rawView3d ? {
|
|
3121
|
-
depthPercent: typeof rawView3d.depthPercent === "number" ? rawView3d.depthPercent : void 0,
|
|
3122
|
-
heightPercent: typeof rawView3d.heightPercent === "number" ? rawView3d.heightPercent : void 0,
|
|
3123
|
-
perspective: typeof rawView3d.perspective === "number" ? rawView3d.perspective : void 0,
|
|
3124
|
-
rAngAx: typeof rawView3d.rAngAx === "boolean" ? rawView3d.rAngAx : typeof rawView3d.rightAngleAxes === "boolean" ? rawView3d.rightAngleAxes : void 0,
|
|
3125
|
-
rotX: typeof rawView3d.rotX === "number" ? rawView3d.rotX : typeof rawView3d.rotateX === "number" ? rawView3d.rotateX : void 0,
|
|
3126
|
-
rotY: typeof rawView3d.rotY === "number" ? rawView3d.rotY : typeof rawView3d.rotateY === "number" ? rawView3d.rotateY : void 0
|
|
3127
|
-
} : void 0,
|
|
3128
|
-
wireframe: typeof chart.wireframe === "boolean" ? chart.wireframe : void 0,
|
|
3129
|
-
workbookSheetIndex,
|
|
3130
|
-
zIndex: Array.isArray(drawing.drawingPath) && typeof drawing.drawingPath[0] === "number" ? drawing.drawingPath[0] + 1 : chartIndex + 1
|
|
3131
|
-
};
|
|
3299
|
+
return normalizeClassicChartDrawing(workbook, workbookSheetIndex, visibleSheetIndex, rawChart, chartIndex, chartId);
|
|
3132
3300
|
});
|
|
3133
3301
|
const modernCharts = rawChartsEx.map((rawChartEx, chartExIndex) => {
|
|
3134
3302
|
const chartId = `chart-ex-${workbookSheetIndex}-${chartExIndex}`;
|
|
@@ -3141,14 +3309,42 @@ function loadWorkbookChartAssets(workbook, imageAssets, visibleSheetIndexByWorkb
|
|
|
3141
3309
|
visibleSheetIndex,
|
|
3142
3310
|
rawChartEx,
|
|
3143
3311
|
chartExIndex,
|
|
3144
|
-
_nullishCoalesce(_optionalChain([imageAssets, 'optionalAccess',
|
|
3312
|
+
_nullishCoalesce(_optionalChain([imageAssets, 'optionalAccess', _367 => _367.themePalette]), () => ( null))
|
|
3145
3313
|
);
|
|
3146
3314
|
});
|
|
3147
3315
|
return [...classicCharts, ...modernCharts];
|
|
3148
3316
|
});
|
|
3149
3317
|
const chartsheets = Array.isArray(workbook.chartsheets) ? workbook.chartsheets.map((entry, index) => normalizeChartsheet(entry, index)) : [];
|
|
3318
|
+
for (const chartsheet of chartsheets) {
|
|
3319
|
+
const workbookSheetIndex = workbook.sheetCount + chartsheet.index;
|
|
3320
|
+
const raw = chartsheet.raw;
|
|
3321
|
+
const charts = [];
|
|
3322
|
+
if (_optionalChain([raw, 'optionalAccess', _368 => _368.chart]) && typeof raw.chart === "object") {
|
|
3323
|
+
charts.push(normalizeClassicChartDrawing(
|
|
3324
|
+
workbook,
|
|
3325
|
+
workbookSheetIndex,
|
|
3326
|
+
workbookSheetIndex,
|
|
3327
|
+
raw,
|
|
3328
|
+
0,
|
|
3329
|
+
`${chartsheet.id}-chart-0`
|
|
3330
|
+
));
|
|
3331
|
+
}
|
|
3332
|
+
if (_optionalChain([raw, 'optionalAccess', _369 => _369.chartEx]) && typeof raw.chartEx === "object") {
|
|
3333
|
+
charts.push(normalizeChartExChart(
|
|
3334
|
+
workbook,
|
|
3335
|
+
workbookSheetIndex,
|
|
3336
|
+
workbookSheetIndex,
|
|
3337
|
+
raw,
|
|
3338
|
+
0,
|
|
3339
|
+
_nullishCoalesce(_optionalChain([imageAssets, 'optionalAccess', _370 => _370.themePalette]), () => ( null))
|
|
3340
|
+
));
|
|
3341
|
+
}
|
|
3342
|
+
chartsByWorkbookSheetIndex[workbookSheetIndex] = charts;
|
|
3343
|
+
chartsheet.chartIds = charts.map((chart) => chart.id);
|
|
3344
|
+
chartsheet.workbookSheetIndex = workbookSheetIndex;
|
|
3345
|
+
}
|
|
3150
3346
|
const tabs = buildTabs(workbook, chartsheets, visibleSheetIndexByWorkbookSheetIndex, showHiddenSheets);
|
|
3151
|
-
const chartOriginsById = imageAssets ? hydrateWorkbookChartStyles(chartsByWorkbookSheetIndex, imageAssets) : /* @__PURE__ */ new Map();
|
|
3347
|
+
const chartOriginsById = imageAssets ? hydrateWorkbookChartStyles(chartsByWorkbookSheetIndex, imageAssets, chartsheets) : /* @__PURE__ */ new Map();
|
|
3152
3348
|
if (imageAssets) {
|
|
3153
3349
|
for (let index = 0; index < chartsByWorkbookSheetIndex.length; index += 1) {
|
|
3154
3350
|
chartsByWorkbookSheetIndex[index] = (_nullishCoalesce(chartsByWorkbookSheetIndex[index], () => ( []))).filter((chart) => !excludedChartIds.has(chart.id));
|
|
@@ -3219,7 +3415,7 @@ function updateAnchorNode(anchorNode, anchor) {
|
|
|
3219
3415
|
function setChartTitle(chartNode, value) {
|
|
3220
3416
|
const existing = getFirstLocalChild(chartNode, "title");
|
|
3221
3417
|
if (!value) {
|
|
3222
|
-
_optionalChain([existing, 'optionalAccess',
|
|
3418
|
+
_optionalChain([existing, 'optionalAccess', _371 => _371.remove, 'call', _372 => _372()]);
|
|
3223
3419
|
return;
|
|
3224
3420
|
}
|
|
3225
3421
|
const titleNode = _nullishCoalesce(existing, () => ( chartNode.insertBefore(
|
|
@@ -3253,7 +3449,7 @@ function setRefFormula(parent, refNodeName, formula) {
|
|
|
3253
3449
|
}
|
|
3254
3450
|
function setSeriesText(seriesNode, series) {
|
|
3255
3451
|
const raw = series.raw && typeof series.raw === "object" ? series.raw : null;
|
|
3256
|
-
const nameFormula = typeof _optionalChain([raw, 'optionalAccess',
|
|
3452
|
+
const nameFormula = typeof _optionalChain([raw, 'optionalAccess', _373 => _373.name]) === "string" && raw.name.length > 0 ? raw.name : void 0;
|
|
3257
3453
|
if (!nameFormula && series.name === void 0) {
|
|
3258
3454
|
return;
|
|
3259
3455
|
}
|
|
@@ -3278,12 +3474,12 @@ function updateSeriesNodes(plotAreaNode, chart) {
|
|
|
3278
3474
|
return;
|
|
3279
3475
|
}
|
|
3280
3476
|
setSeriesText(seriesNode, series);
|
|
3281
|
-
if (_optionalChain([series, 'access',
|
|
3477
|
+
if (_optionalChain([series, 'access', _374 => _374.categoriesRef, 'optionalAccess', _375 => _375.formula])) {
|
|
3282
3478
|
const target = _nullishCoalesce(_nullishCoalesce(getFirstLocalChild(seriesNode, "xVal"), () => ( getFirstLocalChild(seriesNode, "cat"))), () => ( (chart.chartType === "Scatter" || chart.chartType === "ScatterLines" || chart.chartType === "ScatterSmooth" || chart.chartType === "Bubble" ? ensureChild(seriesNode, "xVal") : ensureChild(seriesNode, "cat"))));
|
|
3283
3479
|
const categoryRefName = target.localName === "xVal" || getFirstLocalChild(target, "numRef") ? "numRef" : "strRef";
|
|
3284
3480
|
setRefFormula(target, categoryRefName, series.categoriesRef.formula);
|
|
3285
3481
|
}
|
|
3286
|
-
if (_optionalChain([series, 'access',
|
|
3482
|
+
if (_optionalChain([series, 'access', _376 => _376.valuesRef, 'optionalAccess', _377 => _377.formula])) {
|
|
3287
3483
|
const target = _nullishCoalesce(_nullishCoalesce(getFirstLocalChild(seriesNode, "yVal"), () => ( getFirstLocalChild(seriesNode, "val"))), () => ( (chart.chartType === "Scatter" || chart.chartType === "ScatterLines" || chart.chartType === "ScatterSmooth" || chart.chartType === "Bubble" ? ensureChild(seriesNode, "yVal") : ensureChild(seriesNode, "val"))));
|
|
3288
3484
|
setRefFormula(target, "numRef", series.valuesRef.formula);
|
|
3289
3485
|
}
|
|
@@ -3305,14 +3501,14 @@ function updateAxisNode(axisNode, axis) {
|
|
|
3305
3501
|
}
|
|
3306
3502
|
if (axis.position) {
|
|
3307
3503
|
setLeafValue(ensureChild(axisNode, "axPos"), "val", axis.position);
|
|
3308
|
-
_optionalChain([getFirstLocalChild, 'call',
|
|
3504
|
+
_optionalChain([getFirstLocalChild, 'call', _378 => _378(axisNode, "axPos"), 'optionalAccess', _379 => _379.setAttribute, 'call', _380 => _380("val", axis.position)]);
|
|
3309
3505
|
}
|
|
3310
3506
|
if (axis.majorGridlines !== void 0) {
|
|
3311
3507
|
const gridlines = getFirstLocalChild(axisNode, "majorGridlines");
|
|
3312
3508
|
if (axis.majorGridlines && !gridlines) {
|
|
3313
3509
|
axisNode.appendChild(axisNode.ownerDocument.createElementNS(CHART_NS, "c:majorGridlines"));
|
|
3314
3510
|
} else if (!axis.majorGridlines) {
|
|
3315
|
-
_optionalChain([gridlines, 'optionalAccess',
|
|
3511
|
+
_optionalChain([gridlines, 'optionalAccess', _381 => _381.remove, 'call', _382 => _382()]);
|
|
3316
3512
|
}
|
|
3317
3513
|
}
|
|
3318
3514
|
if (axis.minorGridlines !== void 0) {
|
|
@@ -3320,28 +3516,28 @@ function updateAxisNode(axisNode, axis) {
|
|
|
3320
3516
|
if (axis.minorGridlines && !gridlines) {
|
|
3321
3517
|
axisNode.appendChild(axisNode.ownerDocument.createElementNS(CHART_NS, "c:minorGridlines"));
|
|
3322
3518
|
} else if (!axis.minorGridlines) {
|
|
3323
|
-
_optionalChain([gridlines, 'optionalAccess',
|
|
3519
|
+
_optionalChain([gridlines, 'optionalAccess', _383 => _383.remove, 'call', _384 => _384()]);
|
|
3324
3520
|
}
|
|
3325
3521
|
}
|
|
3326
3522
|
if (axis.majorTickMark) {
|
|
3327
|
-
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
3523
|
+
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _385 => _385(axisNode, "majorTickMark"), 'optionalAccess', _386 => _386.setAttribute, 'call', _387 => _387("val", axis.majorTickMark)]), () => ( setBooleanValue(axisNode, "majorTickMark", false).setAttribute("val", axis.majorTickMark)));
|
|
3328
3524
|
}
|
|
3329
3525
|
if (axis.minorTickMark) {
|
|
3330
|
-
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
3526
|
+
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _388 => _388(axisNode, "minorTickMark"), 'optionalAccess', _389 => _389.setAttribute, 'call', _390 => _390("val", axis.minorTickMark)]), () => ( setBooleanValue(axisNode, "minorTickMark", false).setAttribute("val", axis.minorTickMark)));
|
|
3331
3527
|
}
|
|
3332
3528
|
if (axis.labelPosition) {
|
|
3333
|
-
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
3529
|
+
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _391 => _391(axisNode, "tickLblPos"), 'optionalAccess', _392 => _392.setAttribute, 'call', _393 => _393("val", axis.labelPosition)]), () => ( setBooleanValue(axisNode, "tickLblPos", false).setAttribute("val", axis.labelPosition)));
|
|
3334
3530
|
}
|
|
3335
3531
|
if (axis.crosses) {
|
|
3336
|
-
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
3532
|
+
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _394 => _394(axisNode, "crosses"), 'optionalAccess', _395 => _395.setAttribute, 'call', _396 => _396("val", axis.crosses)]), () => ( setBooleanValue(axisNode, "crosses", false).setAttribute("val", axis.crosses)));
|
|
3337
3533
|
}
|
|
3338
3534
|
if (axis.crossBetween) {
|
|
3339
|
-
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call',
|
|
3535
|
+
_nullishCoalesce(_optionalChain([getFirstLocalChild, 'call', _397 => _397(axisNode, "crossBetween"), 'optionalAccess', _398 => _398.setAttribute, 'call', _399 => _399("val", axis.crossBetween)]), () => ( setBooleanValue(axisNode, "crossBetween", false).setAttribute("val", axis.crossBetween)));
|
|
3340
3536
|
}
|
|
3341
3537
|
if (axis.delete !== void 0) {
|
|
3342
3538
|
setBooleanValue(axisNode, "delete", axis.delete);
|
|
3343
3539
|
}
|
|
3344
|
-
if (_optionalChain([axis, 'access',
|
|
3540
|
+
if (_optionalChain([axis, 'access', _400 => _400.numberFormat, 'optionalAccess', _401 => _401.formatCode])) {
|
|
3345
3541
|
const numFmt = ensureChild(axisNode, "numFmt");
|
|
3346
3542
|
numFmt.setAttribute("formatCode", axis.numberFormat.formatCode);
|
|
3347
3543
|
if (axis.numberFormat.sourceLinked !== void 0) {
|
|
@@ -3397,7 +3593,7 @@ function updateWorkbookChartAnchor(imageAssets, chartAssets, chartId, anchor) {
|
|
|
3397
3593
|
}
|
|
3398
3594
|
function updateWorkbookChartDefinition(imageAssets, chartAssets, chartId, patch) {
|
|
3399
3595
|
const origin = chartAssets.chartOriginsById.get(chartId);
|
|
3400
|
-
if (!_optionalChain([origin, 'optionalAccess',
|
|
3596
|
+
if (!_optionalChain([origin, 'optionalAccess', _402 => _402.chartPath])) {
|
|
3401
3597
|
return false;
|
|
3402
3598
|
}
|
|
3403
3599
|
const chartXml = readArchiveText(imageAssets.archive, origin.chartPath);
|
|
@@ -3556,7 +3752,7 @@ function resolveWorkbookColor(color, themePalette) {
|
|
|
3556
3752
|
}
|
|
3557
3753
|
const themeValue = _nullishCoalesce(color.theme, () => ( color.themeIndex));
|
|
3558
3754
|
const numericTheme = typeof themeValue === "number" ? themeValue : typeof themeValue === "string" && themeValue.trim().length > 0 ? Number(themeValue) : Number.NaN;
|
|
3559
|
-
const themeColor = Number.isFinite(numericTheme) ? _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
3755
|
+
const themeColor = Number.isFinite(numericTheme) ? _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _403 => _403.colorsByIndex, 'access', _404 => _404[numericTheme]]), () => ( null)) : null;
|
|
3560
3756
|
if (!themeColor) {
|
|
3561
3757
|
return null;
|
|
3562
3758
|
}
|
|
@@ -3598,7 +3794,7 @@ function resolveWorkbookFillStyle(fill, themePalette) {
|
|
|
3598
3794
|
if (stops.length > 0) {
|
|
3599
3795
|
const gradientType = typeof fill.gradientType === "string" ? fill.gradientType : "linear";
|
|
3600
3796
|
if (gradientType === "path") {
|
|
3601
|
-
const backgroundColor = _nullishCoalesce(_optionalChain([stops, 'access',
|
|
3797
|
+
const backgroundColor = _nullishCoalesce(_optionalChain([stops, 'access', _405 => _405[stops.length - 1], 'optionalAccess', _406 => _406.color]), () => ( null));
|
|
3602
3798
|
return {
|
|
3603
3799
|
backgroundColor,
|
|
3604
3800
|
backgroundImage: `radial-gradient(circle at center, ${stops.map((stop) => `${stop.color} ${Math.max(0, Math.min(100, stop.position * 100))}%`).join(", ")})`
|
|
@@ -3607,7 +3803,7 @@ function resolveWorkbookFillStyle(fill, themePalette) {
|
|
|
3607
3803
|
const degree = typeof fill.degree === "number" ? fill.degree : Number(_nullishCoalesce(fill.degree, () => ( 0)));
|
|
3608
3804
|
const cssAngle = Number.isFinite(degree) ? 90 - degree : 90;
|
|
3609
3805
|
return {
|
|
3610
|
-
backgroundColor: _nullishCoalesce(_optionalChain([stops, 'access',
|
|
3806
|
+
backgroundColor: _nullishCoalesce(_optionalChain([stops, 'access', _407 => _407[stops.length - 1], 'optionalAccess', _408 => _408.color]), () => ( null)),
|
|
3611
3807
|
backgroundImage: `linear-gradient(${cssAngle}deg, ${stops.map((stop) => `${stop.color} ${Math.max(0, Math.min(100, stop.position * 100))}%`).join(", ")})`
|
|
3612
3808
|
};
|
|
3613
3809
|
}
|
|
@@ -3620,7 +3816,7 @@ function resolveWorkbookFillStyle(fill, themePalette) {
|
|
|
3620
3816
|
|
|
3621
3817
|
// src/images.ts
|
|
3622
3818
|
|
|
3623
|
-
var
|
|
3819
|
+
var REL_NS2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
3624
3820
|
var PKG_REL_NS = "http://schemas.openxmlformats.org/package/2006/relationships";
|
|
3625
3821
|
var SPREADSHEET_NS = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
3626
3822
|
var CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
@@ -3669,6 +3865,19 @@ function measureColumnCharacterWidthPx(fontFamily, fontSizePt) {
|
|
|
3669
3865
|
columnCharacterWidthCache.set(cacheKey, width);
|
|
3670
3866
|
return width;
|
|
3671
3867
|
}
|
|
3868
|
+
function measureOfficeDigitWidthPt(fontFamily, fontSizePt) {
|
|
3869
|
+
const family = _optionalChain([fontFamily, 'optionalAccess', _409 => _409.trim, 'call', _410 => _410()]) || "Calibri";
|
|
3870
|
+
const size = typeof fontSizePt === "number" && fontSizePt > 0 ? fontSizePt : 11;
|
|
3871
|
+
const key = `office|${family}|${size}`;
|
|
3872
|
+
const cached = columnCharacterWidthCache.get(key);
|
|
3873
|
+
if (cached !== void 0) return cached;
|
|
3874
|
+
const context = typeof document !== "undefined" ? document.createElement("canvas").getContext("2d") : null;
|
|
3875
|
+
if (!context) return 6;
|
|
3876
|
+
context.font = `${size}px ${JSON.stringify(family)}, "React XLSX Carlito"`;
|
|
3877
|
+
const width = Math.max(1, Math.round(Math.max(...Array.from("0123456789", (digit) => context.measureText(digit).width))));
|
|
3878
|
+
columnCharacterWidthCache.set(key, width);
|
|
3879
|
+
return width;
|
|
3880
|
+
}
|
|
3672
3881
|
function sheetColumnWidthToPixels(width, columnCharacterWidthPx = DEFAULT_COLUMN_CHARACTER_WIDTH_PX) {
|
|
3673
3882
|
if (!Number.isFinite(width) || width <= 0) {
|
|
3674
3883
|
return MIN_COL_WIDTH_PX;
|
|
@@ -3904,7 +4113,7 @@ function readFeaturePropertyBagCheckboxComplements(archive) {
|
|
|
3904
4113
|
return /* @__PURE__ */ new Set();
|
|
3905
4114
|
}
|
|
3906
4115
|
const document2 = parseXml2(xml);
|
|
3907
|
-
if (!_optionalChain([document2, 'optionalAccess',
|
|
4116
|
+
if (!_optionalChain([document2, 'optionalAccess', _411 => _411.documentElement])) {
|
|
3908
4117
|
return /* @__PURE__ */ new Set();
|
|
3909
4118
|
}
|
|
3910
4119
|
const bagNodes = getChildElements(document2.documentElement, "bag");
|
|
@@ -3936,10 +4145,10 @@ function readFeaturePropertyBagCheckboxComplements(archive) {
|
|
|
3936
4145
|
return checkboxComplementIndices;
|
|
3937
4146
|
}
|
|
3938
4147
|
function getRelationshipId(element) {
|
|
3939
|
-
return _nullishCoalesce(_nullishCoalesce(element.getAttributeNS(
|
|
4148
|
+
return _nullishCoalesce(_nullishCoalesce(element.getAttributeNS(REL_NS2, "id"), () => ( element.getAttribute("r:id"))), () => ( element.getAttribute("id")));
|
|
3940
4149
|
}
|
|
3941
4150
|
function getEmbeddedRelationshipId(element) {
|
|
3942
|
-
return _nullishCoalesce(_nullishCoalesce(element.getAttributeNS(
|
|
4151
|
+
return _nullishCoalesce(_nullishCoalesce(element.getAttributeNS(REL_NS2, "embed"), () => ( element.getAttribute("r:embed"))), () => ( element.getAttribute("embed")));
|
|
3943
4152
|
}
|
|
3944
4153
|
function setChildText(parent, localName, value) {
|
|
3945
4154
|
const child = getFirstChild(parent, localName);
|
|
@@ -3989,7 +4198,7 @@ function resolveContentType(contentTypes, path) {
|
|
|
3989
4198
|
if (override) {
|
|
3990
4199
|
return override;
|
|
3991
4200
|
}
|
|
3992
|
-
const extension = _optionalChain([normalized, 'access',
|
|
4201
|
+
const extension = _optionalChain([normalized, 'access', _412 => _412.split, 'call', _413 => _413("."), 'access', _414 => _414.pop, 'call', _415 => _415(), 'optionalAccess', _416 => _416.toLowerCase, 'call', _417 => _417()]);
|
|
3993
4202
|
if (!extension) {
|
|
3994
4203
|
return "application/octet-stream";
|
|
3995
4204
|
}
|
|
@@ -4086,15 +4295,15 @@ function parseWorkbookTheme(archive) {
|
|
|
4086
4295
|
const key = colorNode.localName;
|
|
4087
4296
|
const srgbNode = getFirstChild(colorNode, "srgbClr");
|
|
4088
4297
|
const sysNode = getFirstChild(colorNode, "sysClr");
|
|
4089
|
-
const hex = _nullishCoalesce(_optionalChain([srgbNode, 'optionalAccess',
|
|
4298
|
+
const hex = _nullishCoalesce(_optionalChain([srgbNode, 'optionalAccess', _418 => _418.getAttribute, 'call', _419 => _419("val")]), () => ( _optionalChain([sysNode, 'optionalAccess', _420 => _420.getAttribute, 'call', _421 => _421("lastClr")])));
|
|
4090
4299
|
if (hex) {
|
|
4091
4300
|
colors.set(key, normalizeHexColor3(hex));
|
|
4092
4301
|
}
|
|
4093
4302
|
}
|
|
4094
4303
|
}
|
|
4095
4304
|
const fontSchemeNode = _nullishCoalesce(getLocalElements(themeDocument, "fontScheme")[0], () => ( null));
|
|
4096
|
-
const majorLatinFont = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
4097
|
-
const minorLatinFont = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
4305
|
+
const majorLatinFont = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _422 => _422(getFirstChild(fontSchemeNode, "majorFont"), "latin"), 'optionalAccess', _423 => _423.getAttribute, 'call', _424 => _424("typeface")]), () => ( null));
|
|
4306
|
+
const minorLatinFont = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _425 => _425(getFirstChild(fontSchemeNode, "minorFont"), "latin"), 'optionalAccess', _426 => _426.getAttribute, 'call', _427 => _427("typeface")]), () => ( null));
|
|
4098
4307
|
colors.set("bg1", _nullishCoalesce(_nullishCoalesce(colors.get("lt1"), () => ( defaultTheme.colors.get("bg1"))), () => ( "#ffffff")));
|
|
4099
4308
|
colors.set("tx1", _nullishCoalesce(_nullishCoalesce(colors.get("dk1"), () => ( defaultTheme.colors.get("tx1"))), () => ( "#000000")));
|
|
4100
4309
|
colors.set("bg2", _nullishCoalesce(_nullishCoalesce(colors.get("lt2"), () => ( defaultTheme.colors.get("bg2"))), () => ( "#e7e6e6")));
|
|
@@ -4154,8 +4363,8 @@ function parseSheetSparklines(document2, themePalette) {
|
|
|
4154
4363
|
continue;
|
|
4155
4364
|
}
|
|
4156
4365
|
for (const sparklineNode of getChildElements(sparklineCollectionNode, "sparkline")) {
|
|
4157
|
-
const formula = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
4158
|
-
const targetReference = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
4366
|
+
const formula = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _428 => _428(sparklineNode, "f"), 'optionalAccess', _429 => _429.textContent]), () => ( ""));
|
|
4367
|
+
const targetReference = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _430 => _430(sparklineNode, "sqref"), 'optionalAccess', _431 => _431.textContent]), () => ( ""));
|
|
4159
4368
|
const range = parseFormulaRangeReference(formula);
|
|
4160
4369
|
const target = parseFormulaCellReference(targetReference);
|
|
4161
4370
|
if (!range || !target) {
|
|
@@ -4190,15 +4399,15 @@ function parseSpreadsheetFont(node) {
|
|
|
4190
4399
|
font[property] = hasEnabledSpreadsheetFlag(flag);
|
|
4191
4400
|
}
|
|
4192
4401
|
}
|
|
4193
|
-
const size = _optionalChain([getFirstChild, 'call',
|
|
4194
|
-
const name = _optionalChain([getFirstChild, 'call',
|
|
4195
|
-
const family = _optionalChain([getFirstChild, 'call',
|
|
4196
|
-
const scheme = _optionalChain([getFirstChild, 'call',
|
|
4197
|
-
const charset = _optionalChain([getFirstChild, 'call',
|
|
4198
|
-
const verticalAlign = _optionalChain([getFirstChild, 'call',
|
|
4402
|
+
const size = _optionalChain([getFirstChild, 'call', _432 => _432(node, "sz"), 'optionalAccess', _433 => _433.getAttribute, 'call', _434 => _434("val")]);
|
|
4403
|
+
const name = _optionalChain([getFirstChild, 'call', _435 => _435(node, "name"), 'optionalAccess', _436 => _436.getAttribute, 'call', _437 => _437("val")]);
|
|
4404
|
+
const family = _optionalChain([getFirstChild, 'call', _438 => _438(node, "family"), 'optionalAccess', _439 => _439.getAttribute, 'call', _440 => _440("val")]);
|
|
4405
|
+
const scheme = _optionalChain([getFirstChild, 'call', _441 => _441(node, "scheme"), 'optionalAccess', _442 => _442.getAttribute, 'call', _443 => _443("val")]);
|
|
4406
|
+
const charset = _optionalChain([getFirstChild, 'call', _444 => _444(node, "charset"), 'optionalAccess', _445 => _445.getAttribute, 'call', _446 => _446("val")]);
|
|
4407
|
+
const verticalAlign = _optionalChain([getFirstChild, 'call', _447 => _447(node, "vertAlign"), 'optionalAccess', _448 => _448.getAttribute, 'call', _449 => _449("val")]);
|
|
4199
4408
|
const color = parseSpreadsheetColor(getFirstChild(node, "color"));
|
|
4200
4409
|
if (getFirstChild(node, "u")) {
|
|
4201
|
-
font.underline = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
4410
|
+
font.underline = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _450 => _450(node, "u"), 'optionalAccess', _451 => _451.getAttribute, 'call', _452 => _452("val")]), () => ( "single"));
|
|
4202
4411
|
}
|
|
4203
4412
|
if (size !== null && size !== void 0) {
|
|
4204
4413
|
font.size = Number(size);
|
|
@@ -4389,8 +4598,8 @@ function parseResolvedXfStyle(xfNode, fonts, fills, borders, checkboxComplementI
|
|
|
4389
4598
|
style.alignment = alignment;
|
|
4390
4599
|
}
|
|
4391
4600
|
const xfComplementNode = getFirstDescendant(xfNode, "xfComplement");
|
|
4392
|
-
const xfComplementIndex = Number(_nullishCoalesce(_optionalChain([xfComplementNode, 'optionalAccess',
|
|
4393
|
-
if (Number.isFinite(xfComplementIndex) && _optionalChain([checkboxComplementIndices, 'optionalAccess',
|
|
4601
|
+
const xfComplementIndex = Number(_nullishCoalesce(_optionalChain([xfComplementNode, 'optionalAccess', _453 => _453.getAttribute, 'call', _454 => _454("i")]), () => ( Number.NaN)));
|
|
4602
|
+
if (Number.isFinite(xfComplementIndex) && _optionalChain([checkboxComplementIndices, 'optionalAccess', _455 => _455.has, 'call', _456 => _456(xfComplementIndex)])) {
|
|
4394
4603
|
style.cellControl = { kind: "checkbox" };
|
|
4395
4604
|
}
|
|
4396
4605
|
return style;
|
|
@@ -4484,7 +4693,7 @@ function parseWorkbookStyles(archive) {
|
|
|
4484
4693
|
});
|
|
4485
4694
|
tableStyleByName[name] = elements;
|
|
4486
4695
|
});
|
|
4487
|
-
const normalFont = _nullishCoalesce(_nullishCoalesce(_optionalChain([namedCellStyleByName, 'access',
|
|
4696
|
+
const normalFont = _nullishCoalesce(_nullishCoalesce(_optionalChain([namedCellStyleByName, 'access', _457 => _457.Normal, 'optionalAccess', _458 => _458.font]), () => ( _optionalChain([styleById, 'access', _459 => _459[0], 'optionalAccess', _460 => _460.font]))), () => ( fonts[0]));
|
|
4488
4697
|
const defaultFont = normalFont ? {
|
|
4489
4698
|
family: typeof normalFont.name === "string" ? normalFont.name : void 0,
|
|
4490
4699
|
sizePt: typeof normalFont.size === "number" ? normalFont.size : void 0
|
|
@@ -4514,7 +4723,7 @@ function parseConditionalFormatValueObject(node) {
|
|
|
4514
4723
|
if (!type) {
|
|
4515
4724
|
return null;
|
|
4516
4725
|
}
|
|
4517
|
-
const rawValue = _nullishCoalesce(_nullishCoalesce(node.getAttribute("val"), () => ( _optionalChain([getFirstChild, 'call',
|
|
4726
|
+
const rawValue = _nullishCoalesce(_nullishCoalesce(node.getAttribute("val"), () => ( _optionalChain([getFirstChild, 'call', _461 => _461(node, "f"), 'optionalAccess', _462 => _462.textContent]))), () => ( void 0));
|
|
4518
4727
|
const numericValue = rawValue !== void 0 ? Number(rawValue) : Number.NaN;
|
|
4519
4728
|
return {
|
|
4520
4729
|
type,
|
|
@@ -4563,7 +4772,7 @@ function parseStandardConditionalFormatRule(cfRuleNode, ranges, differentialStyl
|
|
|
4563
4772
|
if (cfvos.length === 0) {
|
|
4564
4773
|
return null;
|
|
4565
4774
|
}
|
|
4566
|
-
const extId = _optionalChain([getFirstDescendant, 'call',
|
|
4775
|
+
const extId = _optionalChain([getFirstDescendant, 'call', _463 => _463(cfRuleNode, "id"), 'optionalAccess', _464 => _464.textContent, 'optionalAccess', _465 => _465.trim, 'call', _466 => _466()]) || void 0;
|
|
4567
4776
|
return {
|
|
4568
4777
|
cfvos,
|
|
4569
4778
|
color: parseSpreadsheetColor(getFirstChild(dataBarNode, "color")),
|
|
@@ -4739,7 +4948,7 @@ function parseConditionalFormatRules(document2, differentialStyles = []) {
|
|
|
4739
4948
|
const extendedRules = [];
|
|
4740
4949
|
getLocalElements(document2, "conditionalFormatting").forEach((conditionalFormattingNode) => {
|
|
4741
4950
|
const isExtended = conditionalFormattingNode.namespaceURI !== SPREADSHEET_NS;
|
|
4742
|
-
const ranges = isExtended ? parseSqrefRanges(_nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
4951
|
+
const ranges = isExtended ? parseSqrefRanges(_nullishCoalesce(_optionalChain([getFirstChild, 'call', _467 => _467(conditionalFormattingNode, "sqref"), 'optionalAccess', _468 => _468.textContent]), () => ( ""))) : parseSqrefRanges(conditionalFormattingNode.getAttribute("sqref"));
|
|
4743
4952
|
getChildElements(conditionalFormattingNode, "cfRule").forEach((cfRuleNode) => {
|
|
4744
4953
|
const parsedRule = isExtended ? parseExtendedConditionalFormatRule(cfRuleNode, ranges) : parseStandardConditionalFormatRule(cfRuleNode, ranges, differentialStyles);
|
|
4745
4954
|
if (parsedRule) {
|
|
@@ -4786,11 +4995,11 @@ function parseSheetState(archive, path, options) {
|
|
|
4786
4995
|
if (!document2) {
|
|
4787
4996
|
return null;
|
|
4788
4997
|
}
|
|
4789
|
-
const includeCachedFormulaValues = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4790
|
-
const autoFilterRanges = parseSqrefRanges(_optionalChain([getLocalElements, 'call',
|
|
4998
|
+
const includeCachedFormulaValues = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _469 => _469.includeCachedFormulaValues]), () => ( true));
|
|
4999
|
+
const autoFilterRanges = parseSqrefRanges(_optionalChain([getLocalElements, 'call', _470 => _470(document2, "autoFilter"), 'access', _471 => _471[0], 'optionalAccess', _472 => _472.getAttribute, 'call', _473 => _473("ref")]));
|
|
4791
5000
|
const cachedFormulaValues = {};
|
|
4792
|
-
const conditionalFormatRules = parseConditionalFormatRules(document2, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
4793
|
-
const sparklines = parseSheetSparklines(document2, _optionalChain([options, 'optionalAccess',
|
|
5001
|
+
const conditionalFormatRules = parseConditionalFormatRules(document2, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _474 => _474.differentialStyles]), () => ( [])));
|
|
5002
|
+
const sparklines = parseSheetSparklines(document2, _optionalChain([options, 'optionalAccess', _475 => _475.themePalette]));
|
|
4794
5003
|
const sheetFormatNode = _nullishCoalesce(getLocalElements(document2, "sheetFormatPr")[0], () => ( null));
|
|
4795
5004
|
const sheetViewNode = _nullishCoalesce(getLocalElements(document2, "sheetView")[0], () => ( null));
|
|
4796
5005
|
const rowHeightOverridesPx = {};
|
|
@@ -4803,15 +5012,27 @@ function parseSheetState(archive, path, options) {
|
|
|
4803
5012
|
let maxContentCol = -1;
|
|
4804
5013
|
let maxContentRow = -1;
|
|
4805
5014
|
const columnWidthCharacterWidthPx = measureColumnCharacterWidthPx(
|
|
4806
|
-
_optionalChain([options, 'optionalAccess',
|
|
4807
|
-
_optionalChain([options, 'optionalAccess',
|
|
5015
|
+
_optionalChain([options, 'optionalAccess', _476 => _476.defaultFont, 'optionalAccess', _477 => _477.family]),
|
|
5016
|
+
_optionalChain([options, 'optionalAccess', _478 => _478.defaultFont, 'optionalAccess', _479 => _479.sizePt])
|
|
4808
5017
|
);
|
|
4809
|
-
const defaultRowHeight = Number(_nullishCoalesce(_optionalChain([sheetFormatNode, 'optionalAccess',
|
|
5018
|
+
const defaultRowHeight = Number(_nullishCoalesce(_optionalChain([sheetFormatNode, 'optionalAccess', _480 => _480.getAttribute, 'call', _481 => _481("defaultRowHeight")]), () => ( 15)));
|
|
5019
|
+
const digitWidthPt = measureOfficeDigitWidthPt(_optionalChain([options, 'optionalAccess', _482 => _482.defaultFont, 'optionalAccess', _483 => _483.family]), _optionalChain([options, 'optionalAccess', _484 => _484.defaultFont, 'optionalAccess', _485 => _485.sizePt]));
|
|
5020
|
+
const storedColumnPixels = (width) => Math.max(0, Math.floor(
|
|
5021
|
+
(256 * width + Math.floor(128 / digitWidthPt)) / 256 * digitWidthPt
|
|
5022
|
+
) * (4 / 3));
|
|
5023
|
+
const explicitDefaultWidth = Number(_nullishCoalesce(_optionalChain([sheetFormatNode, 'optionalAccess', _486 => _486.getAttribute, 'call', _487 => _487("defaultColWidth")]), () => ( Number.NaN)));
|
|
5024
|
+
const baseWidth = Number(_nullishCoalesce(_optionalChain([sheetFormatNode, 'optionalAccess', _488 => _488.getAttribute, 'call', _489 => _489("baseColWidth")]), () => ( 8)));
|
|
5025
|
+
const officeLayout = {
|
|
5026
|
+
defaultColumnPx: Number.isFinite(explicitDefaultWidth) && explicitDefaultWidth > 0 ? storedColumnPixels(explicitDefaultWidth) : ((Number.isFinite(baseWidth) && baseWidth > 0 ? baseWidth : 8) * digitWidthPt + 5) * (4 / 3),
|
|
5027
|
+
defaultRowPx: (Number.isFinite(defaultRowHeight) && defaultRowHeight > 0 ? defaultRowHeight : 15) * (4 / 3),
|
|
5028
|
+
columns: {},
|
|
5029
|
+
rows: {}
|
|
5030
|
+
};
|
|
4810
5031
|
const defaultColWidth = Number(
|
|
4811
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetFormatNode, 'optionalAccess',
|
|
5032
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetFormatNode, 'optionalAccess', _490 => _490.getAttribute, 'call', _491 => _491("defaultColWidth")]), () => ( _optionalChain([sheetFormatNode, 'optionalAccess', _492 => _492.getAttribute, 'call', _493 => _493("baseColWidth")]))), () => ( 8.43))
|
|
4812
5033
|
);
|
|
4813
5034
|
const rawZoomScale = Number(
|
|
4814
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetViewNode, 'optionalAccess',
|
|
5035
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetViewNode, 'optionalAccess', _494 => _494.getAttribute, 'call', _495 => _495("zoomScale")]), () => ( _optionalChain([sheetViewNode, 'optionalAccess', _496 => _496.getAttribute, 'call', _497 => _497("zoomScaleNormal")]))), () => ( Number.NaN))
|
|
4815
5036
|
);
|
|
4816
5037
|
const zoomScale = Number.isFinite(rawZoomScale) && rawZoomScale > 0 ? rawZoomScale : 100;
|
|
4817
5038
|
const trackContentCell = (cellRef) => {
|
|
@@ -4840,6 +5061,7 @@ function parseSheetState(archive, path, options) {
|
|
|
4840
5061
|
const styleId = Number(_nullishCoalesce(rowNode.getAttribute("s"), () => ( Number.NaN)));
|
|
4841
5062
|
if (rowIndex >= 0 && Number.isFinite(height)) {
|
|
4842
5063
|
rowHeightOverridesPx[rowIndex] = Math.max(MIN_ROW_HEIGHT_PX, Math.round(height * 1.33));
|
|
5064
|
+
officeLayout.rows[rowIndex] = { sourcePx: rowHeightOverridesPx[rowIndex], sizePx: Math.max(0, height * (4 / 3)) };
|
|
4843
5065
|
}
|
|
4844
5066
|
if (rowIndex >= 0 && Number.isFinite(styleId)) {
|
|
4845
5067
|
rowStyleIds[rowIndex] = styleId;
|
|
@@ -4878,6 +5100,7 @@ function parseSheetState(archive, path, options) {
|
|
|
4878
5100
|
if (Number.isFinite(width)) {
|
|
4879
5101
|
const widthPx = sheetColumnWidthToPixels(width, columnWidthCharacterWidthPx);
|
|
4880
5102
|
colWidthOverridesPx[col] = widthPx;
|
|
5103
|
+
officeLayout.columns[col] = { sourcePx: widthPx, sizePx: storedColumnPixels(width) };
|
|
4881
5104
|
}
|
|
4882
5105
|
if (Number.isFinite(styleId)) {
|
|
4883
5106
|
colStyleIds[col] = styleId;
|
|
@@ -4894,6 +5117,7 @@ function parseSheetState(archive, path, options) {
|
|
|
4894
5117
|
colStyleIds,
|
|
4895
5118
|
conditionalFormatRules,
|
|
4896
5119
|
defaultColWidthPx: sheetColumnWidthToPixels(defaultColWidth, columnWidthCharacterWidthPx),
|
|
5120
|
+
officeLayout,
|
|
4897
5121
|
defaultRowHeightPx: Math.max(MIN_ROW_HEIGHT_PX, Math.round(defaultRowHeight * 1.33)),
|
|
4898
5122
|
hasHorizontalMerges: false,
|
|
4899
5123
|
hasVerticalMerges: false,
|
|
@@ -4907,7 +5131,7 @@ function parseSheetState(archive, path, options) {
|
|
|
4907
5131
|
hiddenRows: [],
|
|
4908
5132
|
rowHeightOverridesPx,
|
|
4909
5133
|
rowStyleIds,
|
|
4910
|
-
showGridLines: (_nullishCoalesce(_optionalChain([sheetViewNode, 'optionalAccess',
|
|
5134
|
+
showGridLines: (_nullishCoalesce(_optionalChain([sheetViewNode, 'optionalAccess', _498 => _498.getAttribute, 'call', _499 => _499("showGridLines")]), () => ( "1"))) !== "0",
|
|
4911
5135
|
sparklines,
|
|
4912
5136
|
zoomScale
|
|
4913
5137
|
};
|
|
@@ -5042,9 +5266,9 @@ function resolvePreferredTextTypeface(node, theme) {
|
|
|
5042
5266
|
if (!node) {
|
|
5043
5267
|
return void 0;
|
|
5044
5268
|
}
|
|
5045
|
-
const latin = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5046
|
-
const eastAsian = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5047
|
-
const complexScript = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5269
|
+
const latin = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _500 => _500(node, "latin"), 'optionalAccess', _501 => _501.getAttribute, 'call', _502 => _502("typeface")]), () => ( null));
|
|
5270
|
+
const eastAsian = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _503 => _503(node, "ea"), 'optionalAccess', _504 => _504.getAttribute, 'call', _505 => _505("typeface")]), () => ( null));
|
|
5271
|
+
const complexScript = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _506 => _506(node, "cs"), 'optionalAccess', _507 => _507.getAttribute, 'call', _508 => _508("typeface")]), () => ( null));
|
|
5048
5272
|
const candidates = [latin, eastAsian, complexScript];
|
|
5049
5273
|
const explicit = candidates.find((candidate) => candidate && !isThemeTypeface(candidate));
|
|
5050
5274
|
if (explicit) {
|
|
@@ -5055,14 +5279,14 @@ function resolvePreferredTextTypeface(node, theme) {
|
|
|
5055
5279
|
function parseShapeTextStyle(node, theme, fallbackColor) {
|
|
5056
5280
|
if (!node) {
|
|
5057
5281
|
return {
|
|
5058
|
-
color: _optionalChain([fallbackColor, 'optionalAccess',
|
|
5282
|
+
color: _optionalChain([fallbackColor, 'optionalAccess', _509 => _509.color])
|
|
5059
5283
|
};
|
|
5060
5284
|
}
|
|
5061
5285
|
const fillColor = _nullishCoalesce(_nullishCoalesce(resolveFillColor(node, theme), () => ( fallbackColor)), () => ( null));
|
|
5062
5286
|
const underlineValue = node.getAttribute("u");
|
|
5063
5287
|
return {
|
|
5064
5288
|
bold: node.getAttribute("b") === "1" || void 0,
|
|
5065
|
-
color: _optionalChain([fillColor, 'optionalAccess',
|
|
5289
|
+
color: _optionalChain([fillColor, 'optionalAccess', _510 => _510.color]),
|
|
5066
5290
|
fontFamily: resolvePreferredTextTypeface(node, theme),
|
|
5067
5291
|
fontSizePt: node.getAttribute("sz") ? Number(node.getAttribute("sz")) / 100 : void 0,
|
|
5068
5292
|
italic: node.getAttribute("i") === "1" || void 0,
|
|
@@ -5088,10 +5312,10 @@ function parseMarker(node) {
|
|
|
5088
5312
|
if (!node) {
|
|
5089
5313
|
return null;
|
|
5090
5314
|
}
|
|
5091
|
-
const col = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5092
|
-
const row = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5093
|
-
const colOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5094
|
-
const rowOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5315
|
+
const col = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call', _511 => _511(node, "col"), 'optionalAccess', _512 => _512.textContent]), () => ( 0)));
|
|
5316
|
+
const row = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call', _513 => _513(node, "row"), 'optionalAccess', _514 => _514.textContent]), () => ( 0)));
|
|
5317
|
+
const colOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call', _515 => _515(node, "colOff"), 'optionalAccess', _516 => _516.textContent]), () => ( 0)));
|
|
5318
|
+
const rowOffsetEmu = Number(_nullishCoalesce(_optionalChain([getFirstChild, 'call', _517 => _517(node, "rowOff"), 'optionalAccess', _518 => _518.textContent]), () => ( 0)));
|
|
5095
5319
|
return {
|
|
5096
5320
|
col,
|
|
5097
5321
|
colOffsetEmu,
|
|
@@ -5227,15 +5451,15 @@ function resolveDukeDrawingColor(color, themePalette) {
|
|
|
5227
5451
|
function resolveDukeDrawingText(text, themePalette) {
|
|
5228
5452
|
const caption = mapDukeDrawingText(text);
|
|
5229
5453
|
const label = normalizeControlLabel(text.runs.map((run) => run.text).join(""));
|
|
5230
|
-
const firstStyledRun = _optionalChain([text, 'access',
|
|
5454
|
+
const firstStyledRun = _optionalChain([text, 'access', _519 => _519.runs, 'access', _520 => _520.find, 'call', _521 => _521((run) => run.font), 'optionalAccess', _522 => _522.font]);
|
|
5231
5455
|
const horizontalAlignment = text.horizontalAlignment;
|
|
5232
5456
|
return {
|
|
5233
5457
|
caption,
|
|
5234
|
-
fontFamily: _optionalChain([firstStyledRun, 'optionalAccess',
|
|
5235
|
-
fontSizePt: _optionalChain([firstStyledRun, 'optionalAccess',
|
|
5458
|
+
fontFamily: _optionalChain([firstStyledRun, 'optionalAccess', _523 => _523.name]),
|
|
5459
|
+
fontSizePt: _optionalChain([firstStyledRun, 'optionalAccess', _524 => _524.size]),
|
|
5236
5460
|
label,
|
|
5237
5461
|
textAlign: horizontalAlignment === "left" || horizontalAlignment === "center" || horizontalAlignment === "right" ? horizontalAlignment : void 0,
|
|
5238
|
-
textColor: resolveDukeDrawingColor(_optionalChain([firstStyledRun, 'optionalAccess',
|
|
5462
|
+
textColor: resolveDukeDrawingColor(_optionalChain([firstStyledRun, 'optionalAccess', _525 => _525.color]), themePalette)
|
|
5239
5463
|
};
|
|
5240
5464
|
}
|
|
5241
5465
|
function mapDukeFormControlKind(kind, themePalette) {
|
|
@@ -5420,13 +5644,13 @@ function resolveSheetColumnWidthPx(sheetState, col) {
|
|
|
5420
5644
|
if (col < 0) {
|
|
5421
5645
|
return 0;
|
|
5422
5646
|
}
|
|
5423
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
5647
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _526 => _526.colWidthOverridesPx, 'access', _527 => _527[col]]), () => ( _optionalChain([sheetState, 'optionalAccess', _528 => _528.defaultColWidthPx]))), () => ( emuToPixels(DEFAULT_COL_WIDTH_EMU)));
|
|
5424
5648
|
}
|
|
5425
5649
|
function resolveSheetRowHeightPx(sheetState, row) {
|
|
5426
5650
|
if (row < 0) {
|
|
5427
5651
|
return 0;
|
|
5428
5652
|
}
|
|
5429
|
-
return _nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
5653
|
+
return _nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _529 => _529.rowHeightOverridesPx, 'access', _530 => _530[row]]), () => ( _optionalChain([sheetState, 'optionalAccess', _531 => _531.defaultRowHeightPx]))), () => ( emuToPixels(DEFAULT_ROW_HEIGHT_EMU)));
|
|
5430
5654
|
}
|
|
5431
5655
|
function sumSheetColumnWidthsEmu(sheetState, beforeCol) {
|
|
5432
5656
|
let total = 0;
|
|
@@ -5516,10 +5740,10 @@ function parseGroupTransform(groupNode, parentGroup, fallbackAnchor, sheetState)
|
|
|
5516
5740
|
const rootScaleY = rect.cy !== 0 ? anchorRect.cy / rect.cy : 1;
|
|
5517
5741
|
const useRectFrameForRoot = !parentGroup && (rootScaleX < 0.85 || rootScaleX > 1.15 || rootScaleY < 0.85 || rootScaleY > 1.15);
|
|
5518
5742
|
const absoluteRect = parentGroup ? applyGroupTransform(rect, parentGroup) : rootRectMatchesAnchorOrigin ? rect : anchorRect;
|
|
5519
|
-
const childRectX = parentGroup ? Number(_nullishCoalesce(_optionalChain([chOffNode, 'optionalAccess',
|
|
5520
|
-
const childRectY = parentGroup ? Number(_nullishCoalesce(_optionalChain([chOffNode, 'optionalAccess',
|
|
5521
|
-
const childRectCx = parentGroup ? Number(_nullishCoalesce(_optionalChain([chExtNode, 'optionalAccess',
|
|
5522
|
-
const childRectCy = parentGroup ? Number(_nullishCoalesce(_optionalChain([chExtNode, 'optionalAccess',
|
|
5743
|
+
const childRectX = parentGroup ? Number(_nullishCoalesce(_optionalChain([chOffNode, 'optionalAccess', _532 => _532.getAttribute, 'call', _533 => _533("x")]), () => ( 0))) : useRectFrameForRoot ? rect.x : Number(_nullishCoalesce(_optionalChain([chOffNode, 'optionalAccess', _534 => _534.getAttribute, 'call', _535 => _535("x")]), () => ( 0)));
|
|
5744
|
+
const childRectY = parentGroup ? Number(_nullishCoalesce(_optionalChain([chOffNode, 'optionalAccess', _536 => _536.getAttribute, 'call', _537 => _537("y")]), () => ( 0))) : useRectFrameForRoot ? rect.y : Number(_nullishCoalesce(_optionalChain([chOffNode, 'optionalAccess', _538 => _538.getAttribute, 'call', _539 => _539("y")]), () => ( 0)));
|
|
5745
|
+
const childRectCx = parentGroup ? Number(_nullishCoalesce(_optionalChain([chExtNode, 'optionalAccess', _540 => _540.getAttribute, 'call', _541 => _541("cx")]), () => ( rect.cx))) : useRectFrameForRoot ? rect.cx : Number(_nullishCoalesce(_optionalChain([chExtNode, 'optionalAccess', _542 => _542.getAttribute, 'call', _543 => _543("cx")]), () => ( rect.cx)));
|
|
5746
|
+
const childRectCy = parentGroup ? Number(_nullishCoalesce(_optionalChain([chExtNode, 'optionalAccess', _544 => _544.getAttribute, 'call', _545 => _545("cy")]), () => ( rect.cy))) : useRectFrameForRoot ? rect.cy : Number(_nullishCoalesce(_optionalChain([chExtNode, 'optionalAccess', _546 => _546.getAttribute, 'call', _547 => _547("cy")]), () => ( rect.cy)));
|
|
5523
5747
|
return {
|
|
5524
5748
|
chCx: childRectCx,
|
|
5525
5749
|
chCy: childRectCy,
|
|
@@ -5527,8 +5751,8 @@ function parseGroupTransform(groupNode, parentGroup, fallbackAnchor, sheetState)
|
|
|
5527
5751
|
chY: childRectY,
|
|
5528
5752
|
cx: absoluteRect.cx,
|
|
5529
5753
|
cy: absoluteRect.cy,
|
|
5530
|
-
scaleX: childRectCx !== 0 ? absoluteRect.cx / childRectCx : _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess',
|
|
5531
|
-
scaleY: childRectCy !== 0 ? absoluteRect.cy / childRectCy : _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess',
|
|
5754
|
+
scaleX: childRectCx !== 0 ? absoluteRect.cx / childRectCx : _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess', _548 => _548.scaleX]), () => ( 1)),
|
|
5755
|
+
scaleY: childRectCy !== 0 ? absoluteRect.cy / childRectCy : _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess', _549 => _549.scaleY]), () => ( 1)),
|
|
5532
5756
|
x: absoluteRect.x,
|
|
5533
5757
|
y: absoluteRect.y
|
|
5534
5758
|
};
|
|
@@ -5537,8 +5761,8 @@ function anchorFromNodeOrFallback(node, fallbackAnchor, parentGroup) {
|
|
|
5537
5761
|
const xfrmNode = getFirstDescendant(node, "xfrm");
|
|
5538
5762
|
const rect = parseTransformRect(xfrmNode);
|
|
5539
5763
|
if (rect) {
|
|
5540
|
-
const scaleX = _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess',
|
|
5541
|
-
const scaleY = _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess',
|
|
5764
|
+
const scaleX = _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess', _550 => _550.scaleX]), () => ( 1));
|
|
5765
|
+
const scaleY = _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess', _551 => _551.scaleY]), () => ( 1));
|
|
5542
5766
|
return {
|
|
5543
5767
|
anchor: parentGroup ? rectToAbsoluteAnchor(applyGroupTransform(rect, parentGroup)) : fallbackAnchor,
|
|
5544
5768
|
flipH: rect.flipH,
|
|
@@ -5553,8 +5777,8 @@ function anchorFromNodeOrFallback(node, fallbackAnchor, parentGroup) {
|
|
|
5553
5777
|
flipH: false,
|
|
5554
5778
|
flipV: false,
|
|
5555
5779
|
rotationDeg: 0,
|
|
5556
|
-
scaleX: _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess',
|
|
5557
|
-
scaleY: _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess',
|
|
5780
|
+
scaleX: _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess', _552 => _552.scaleX]), () => ( 1)),
|
|
5781
|
+
scaleY: _nullishCoalesce(_optionalChain([parentGroup, 'optionalAccess', _553 => _553.scaleY]), () => ( 1))
|
|
5558
5782
|
};
|
|
5559
5783
|
}
|
|
5560
5784
|
function mapParagraphAlign(value) {
|
|
@@ -5611,15 +5835,15 @@ function parseShapeStroke(node, styleNode, theme) {
|
|
|
5611
5835
|
if (lineNode && getFirstChild(lineNode, "noFill")) {
|
|
5612
5836
|
return { none: true };
|
|
5613
5837
|
}
|
|
5614
|
-
const color = _nullishCoalesce(resolveFillColor(lineNode, theme), () => ( resolveColorValue(_nullishCoalesce(Array.from(_nullishCoalesce(_optionalChain([lineRefNode, 'optionalAccess',
|
|
5615
|
-
const widthEmu = Number(_nullishCoalesce(_optionalChain([lineNode, 'optionalAccess',
|
|
5838
|
+
const color = _nullishCoalesce(resolveFillColor(lineNode, theme), () => ( resolveColorValue(_nullishCoalesce(Array.from(_nullishCoalesce(_optionalChain([lineRefNode, 'optionalAccess', _554 => _554.childNodes]), () => ( []))).filter(isElementNode2)[0], () => ( null)), theme)));
|
|
5839
|
+
const widthEmu = Number(_nullishCoalesce(_optionalChain([lineNode, 'optionalAccess', _555 => _555.getAttribute, 'call', _556 => _556("w")]), () => ( 0)));
|
|
5616
5840
|
return {
|
|
5617
|
-
color: _optionalChain([color, 'optionalAccess',
|
|
5618
|
-
dash: _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5619
|
-
headEndType: _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5841
|
+
color: _optionalChain([color, 'optionalAccess', _557 => _557.color]),
|
|
5842
|
+
dash: _nullishCoalesce(_optionalChain([getFirstChild, 'call', _558 => _558(_nullishCoalesce(lineNode, () => ( node)), "prstDash"), 'optionalAccess', _559 => _559.getAttribute, 'call', _560 => _560("val")]), () => ( void 0)),
|
|
5843
|
+
headEndType: _nullishCoalesce(_optionalChain([getFirstChild, 'call', _561 => _561(_nullishCoalesce(lineNode, () => ( node)), "headEnd"), 'optionalAccess', _562 => _562.getAttribute, 'call', _563 => _563("type")]), () => ( void 0)),
|
|
5620
5844
|
none: false,
|
|
5621
|
-
opacity: _optionalChain([color, 'optionalAccess',
|
|
5622
|
-
tailEndType: _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5845
|
+
opacity: _optionalChain([color, 'optionalAccess', _564 => _564.opacity]),
|
|
5846
|
+
tailEndType: _nullishCoalesce(_optionalChain([getFirstChild, 'call', _565 => _565(_nullishCoalesce(lineNode, () => ( node)), "tailEnd"), 'optionalAccess', _566 => _566.getAttribute, 'call', _567 => _567("type")]), () => ( void 0)),
|
|
5623
5847
|
widthPx: widthEmu > 0 ? emuToPixels(widthEmu) : void 0
|
|
5624
5848
|
};
|
|
5625
5849
|
}
|
|
@@ -5633,7 +5857,7 @@ function parseShapeFill(node, styleNode, theme, geometry) {
|
|
|
5633
5857
|
return { none: true };
|
|
5634
5858
|
}
|
|
5635
5859
|
const fillRefNode = styleNode ? getFirstChild(styleNode, "fillRef") : null;
|
|
5636
|
-
const fillColor = _nullishCoalesce(resolveFillColor(shapePropsNode, theme), () => ( resolveColorValue(_nullishCoalesce(Array.from(_nullishCoalesce(_optionalChain([fillRefNode, 'optionalAccess',
|
|
5860
|
+
const fillColor = _nullishCoalesce(resolveFillColor(shapePropsNode, theme), () => ( resolveColorValue(_nullishCoalesce(Array.from(_nullishCoalesce(_optionalChain([fillRefNode, 'optionalAccess', _568 => _568.childNodes]), () => ( []))).filter(isElementNode2)[0], () => ( null)), theme)));
|
|
5637
5861
|
if (!fillColor) {
|
|
5638
5862
|
return void 0;
|
|
5639
5863
|
}
|
|
@@ -5730,12 +5954,12 @@ function parseShapeParagraphs(shapeNode, styleNode, theme) {
|
|
|
5730
5954
|
return [];
|
|
5731
5955
|
}
|
|
5732
5956
|
const defaultFontRef = styleNode ? getFirstChild(styleNode, "fontRef") : null;
|
|
5733
|
-
const defaultFontColor = resolveColorValue(_nullishCoalesce(Array.from(_nullishCoalesce(_optionalChain([defaultFontRef, 'optionalAccess',
|
|
5957
|
+
const defaultFontColor = resolveColorValue(_nullishCoalesce(Array.from(_nullishCoalesce(_optionalChain([defaultFontRef, 'optionalAccess', _569 => _569.childNodes]), () => ( []))).filter(isElementNode2)[0], () => ( null)), theme);
|
|
5734
5958
|
const listStyleNode = getFirstChild(txBodyNode, "lstStyle");
|
|
5735
5959
|
const paragraphs = [];
|
|
5736
5960
|
getChildElements(txBodyNode, "p").forEach((paragraphNode) => {
|
|
5737
5961
|
const paragraphProps = getFirstChild(paragraphNode, "pPr");
|
|
5738
|
-
const paragraphLevel = Number(_nullishCoalesce(_optionalChain([paragraphProps, 'optionalAccess',
|
|
5962
|
+
const paragraphLevel = Number(_nullishCoalesce(_optionalChain([paragraphProps, 'optionalAccess', _570 => _570.getAttribute, 'call', _571 => _571("lvl")]), () => ( 0)));
|
|
5739
5963
|
const listLevelProps = getFirstChild(_nullishCoalesce(listStyleNode, () => ( txBodyNode)), `lvl${paragraphLevel + 1}pPr`);
|
|
5740
5964
|
const inheritedStyle = mergeShapeTextStyles(
|
|
5741
5965
|
parseShapeTextStyle(getFirstChild(_nullishCoalesce(listLevelProps, () => ( txBodyNode)), "defRPr"), theme, defaultFontColor),
|
|
@@ -5753,7 +5977,7 @@ function parseShapeParagraphs(shapeNode, styleNode, theme) {
|
|
|
5753
5977
|
return;
|
|
5754
5978
|
}
|
|
5755
5979
|
sawRenderableChild = true;
|
|
5756
|
-
const text = _nullishCoalesce(_optionalChain([getFirstChild, 'call',
|
|
5980
|
+
const text = _nullishCoalesce(_optionalChain([getFirstChild, 'call', _572 => _572(child, "t"), 'optionalAccess', _573 => _573.textContent]), () => ( ""));
|
|
5757
5981
|
const runProps = getFirstChild(child, "rPr");
|
|
5758
5982
|
const runStyle = mergeShapeTextStyles(
|
|
5759
5983
|
inheritedStyle,
|
|
@@ -5784,7 +6008,7 @@ function parseShapeParagraphs(shapeNode, styleNode, theme) {
|
|
|
5784
6008
|
});
|
|
5785
6009
|
}
|
|
5786
6010
|
paragraphs.push({
|
|
5787
|
-
align: mapParagraphAlign(_optionalChain([paragraphProps, 'optionalAccess',
|
|
6011
|
+
align: mapParagraphAlign(_optionalChain([paragraphProps, 'optionalAccess', _574 => _574.getAttribute, 'call', _575 => _575("algn")])),
|
|
5788
6012
|
runs
|
|
5789
6013
|
});
|
|
5790
6014
|
});
|
|
@@ -5796,26 +6020,26 @@ function parseTextBox(shapeNode) {
|
|
|
5796
6020
|
return void 0;
|
|
5797
6021
|
}
|
|
5798
6022
|
const bodyProps = getFirstChild(txBodyNode, "bodyPr");
|
|
5799
|
-
const leftInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess',
|
|
5800
|
-
const rightInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess',
|
|
5801
|
-
const topInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess',
|
|
5802
|
-
const bottomInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess',
|
|
6023
|
+
const leftInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess', _576 => _576.getAttribute, 'call', _577 => _577("lIns")]), () => ( 91440))));
|
|
6024
|
+
const rightInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess', _578 => _578.getAttribute, 'call', _579 => _579("rIns")]), () => ( 91440))));
|
|
6025
|
+
const topInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess', _580 => _580.getAttribute, 'call', _581 => _581("tIns")]), () => ( 45720))));
|
|
6026
|
+
const bottomInset = emuToPixels(Number(_nullishCoalesce(_optionalChain([bodyProps, 'optionalAccess', _582 => _582.getAttribute, 'call', _583 => _583("bIns")]), () => ( 45720))));
|
|
5803
6027
|
return {
|
|
5804
|
-
horizontalAlign: _optionalChain([bodyProps, 'optionalAccess',
|
|
6028
|
+
horizontalAlign: _optionalChain([bodyProps, 'optionalAccess', _584 => _584.getAttribute, 'call', _585 => _585("anchorCtr")]) === "1" ? "center" : "left",
|
|
5805
6029
|
insetPx: {
|
|
5806
6030
|
bottom: bottomInset,
|
|
5807
6031
|
left: leftInset,
|
|
5808
6032
|
right: rightInset,
|
|
5809
6033
|
top: topInset
|
|
5810
6034
|
},
|
|
5811
|
-
verticalAlign: mapVerticalAnchor(_optionalChain([bodyProps, 'optionalAccess',
|
|
6035
|
+
verticalAlign: mapVerticalAnchor(_optionalChain([bodyProps, 'optionalAccess', _586 => _586.getAttribute, 'call', _587 => _587("anchor")]))
|
|
5812
6036
|
};
|
|
5813
6037
|
}
|
|
5814
6038
|
function getHyperlinkTarget(node, drawingRelationships) {
|
|
5815
6039
|
const hyperlinkNode = node ? getFirstDescendant(node, "hlinkClick") : null;
|
|
5816
6040
|
const hyperlinkTargetNode = _nullishCoalesce(hyperlinkNode, () => ( node));
|
|
5817
6041
|
const hyperlinkId = hyperlinkTargetNode ? getRelationshipId(hyperlinkTargetNode) : null;
|
|
5818
|
-
return hyperlinkId ? _nullishCoalesce(_optionalChain([drawingRelationships, 'access',
|
|
6042
|
+
return hyperlinkId ? _nullishCoalesce(_optionalChain([drawingRelationships, 'access', _588 => _588.get, 'call', _589 => _589(hyperlinkId), 'optionalAccess', _590 => _590.target]), () => ( void 0)) : void 0;
|
|
5819
6043
|
}
|
|
5820
6044
|
function parsePictureNode(pictureNode, fallbackAnchor, drawingRelationships, archive, contentTypes, objectUrls, workbookSheetIndex, imageId, zIndex, parentGroup) {
|
|
5821
6045
|
const blipNode = getFirstDescendant(pictureNode, "blip");
|
|
@@ -5837,12 +6061,12 @@ function parsePictureNode(pictureNode, fallbackAnchor, drawingRelationships, arc
|
|
|
5837
6061
|
return {
|
|
5838
6062
|
image: {
|
|
5839
6063
|
anchor: transform.anchor,
|
|
5840
|
-
description: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess',
|
|
6064
|
+
description: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess', _591 => _591.getAttribute, 'call', _592 => _592("descr")]), () => ( void 0)),
|
|
5841
6065
|
hyperlink: getHyperlinkTarget(_nullishCoalesce(nonVisualProps, () => ( pictureNode)), drawingRelationships),
|
|
5842
6066
|
id: imageId,
|
|
5843
6067
|
mediaPath: mediaRelationship.target,
|
|
5844
6068
|
mimeType: resolveContentType(contentTypes, mediaRelationship.target),
|
|
5845
|
-
name: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess',
|
|
6069
|
+
name: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess', _593 => _593.getAttribute, 'call', _594 => _594("name")]), () => ( void 0)),
|
|
5846
6070
|
sheetIndex: workbookSheetIndex,
|
|
5847
6071
|
src: createImageSource(mediaBytes, resolveContentType(contentTypes, mediaRelationship.target), objectUrls),
|
|
5848
6072
|
workbookSheetIndex,
|
|
@@ -5855,28 +6079,28 @@ function parseShapeNode(shapeNode, fallbackAnchor, drawingRelationships, theme,
|
|
|
5855
6079
|
const nonVisualProps = getFirstDescendant(shapeNode, "cNvPr");
|
|
5856
6080
|
const styleNode = getFirstChild(shapeNode, "style");
|
|
5857
6081
|
const transform = anchorFromNodeOrFallback(shapeNode, fallbackAnchor, parentGroup);
|
|
5858
|
-
const geometry = _nullishCoalesce(_optionalChain([getFirstDescendant, 'call',
|
|
6082
|
+
const geometry = _nullishCoalesce(_optionalChain([getFirstDescendant, 'call', _595 => _595(shapeNode, "prstGeom"), 'optionalAccess', _596 => _596.getAttribute, 'call', _597 => _597("prst")]), () => ( (getFirstDescendant(shapeNode, "custGeom") ? "custom" : "rect")));
|
|
5859
6083
|
const customPath = geometry === "custom" ? parseCustomGeometryPath(shapeNode) : void 0;
|
|
5860
6084
|
const geometryAdjustments = parseShapeGeometryAdjustments(shapeNode);
|
|
5861
6085
|
return {
|
|
5862
6086
|
anchor: transform.anchor,
|
|
5863
|
-
description: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess',
|
|
6087
|
+
description: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess', _598 => _598.getAttribute, 'call', _599 => _599("descr")]), () => ( void 0)),
|
|
5864
6088
|
fill: parseShapeFill(shapeNode, styleNode, theme, geometry),
|
|
5865
6089
|
flipH: transform.flipH,
|
|
5866
6090
|
flipV: transform.flipV,
|
|
5867
6091
|
geometry,
|
|
5868
6092
|
geometryAdjustments,
|
|
5869
|
-
hidden: _optionalChain([nonVisualProps, 'optionalAccess',
|
|
6093
|
+
hidden: _optionalChain([nonVisualProps, 'optionalAccess', _600 => _600.getAttribute, 'call', _601 => _601("hidden")]) === "1" || void 0,
|
|
5870
6094
|
hyperlink: getHyperlinkTarget(_nullishCoalesce(nonVisualProps, () => ( shapeNode)), drawingRelationships),
|
|
5871
6095
|
id: shapeId,
|
|
5872
|
-
name: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess',
|
|
6096
|
+
name: _nullishCoalesce(_optionalChain([nonVisualProps, 'optionalAccess', _602 => _602.getAttribute, 'call', _603 => _603("name")]), () => ( void 0)),
|
|
5873
6097
|
paragraphs: parseShapeParagraphs(shapeNode, styleNode, theme),
|
|
5874
6098
|
rotationDeg: transform.rotationDeg,
|
|
5875
6099
|
scaleX: transform.scaleX,
|
|
5876
6100
|
scaleY: transform.scaleY,
|
|
5877
6101
|
sheetIndex: workbookSheetIndex,
|
|
5878
|
-
svgPath: _optionalChain([customPath, 'optionalAccess',
|
|
5879
|
-
svgViewBox: _optionalChain([customPath, 'optionalAccess',
|
|
6102
|
+
svgPath: _optionalChain([customPath, 'optionalAccess', _604 => _604.path]),
|
|
6103
|
+
svgViewBox: _optionalChain([customPath, 'optionalAccess', _605 => _605.viewBox]),
|
|
5880
6104
|
stroke: parseShapeStroke(shapeNode, styleNode, theme),
|
|
5881
6105
|
textBox: parseTextBox(shapeNode),
|
|
5882
6106
|
workbookSheetIndex,
|
|
@@ -6185,7 +6409,7 @@ function updateWorkbookImageAnchor(assets, imageId, anchor) {
|
|
|
6185
6409
|
if (!origin) {
|
|
6186
6410
|
return false;
|
|
6187
6411
|
}
|
|
6188
|
-
const attachments = _nullishCoalesce(_optionalChain([assets, 'access',
|
|
6412
|
+
const attachments = _nullishCoalesce(_optionalChain([assets, 'access', _606 => _606.sheetOrigins, 'access', _607 => _607[origin.workbookSheetIndex], 'optionalAccess', _608 => _608.attachments]), () => ( []));
|
|
6189
6413
|
for (const attachment of attachments) {
|
|
6190
6414
|
if (attachment.drawingPath !== origin.drawingPath) {
|
|
6191
6415
|
continue;
|
|
@@ -6295,7 +6519,7 @@ function mergeContentTypeForPath(targetDocument, originalDocument, partPath) {
|
|
|
6295
6519
|
return;
|
|
6296
6520
|
}
|
|
6297
6521
|
}
|
|
6298
|
-
const extension = _optionalChain([normalizedPartName, 'access',
|
|
6522
|
+
const extension = _optionalChain([normalizedPartName, 'access', _609 => _609.split, 'call', _610 => _610("."), 'access', _611 => _611.pop, 'call', _612 => _612(), 'optionalAccess', _613 => _613.toLowerCase, 'call', _614 => _614()]);
|
|
6299
6523
|
if (!extension) {
|
|
6300
6524
|
return;
|
|
6301
6525
|
}
|
|
@@ -6348,7 +6572,7 @@ function appendSheetDrawingReference(sheetDocument, relationshipId) {
|
|
|
6348
6572
|
return;
|
|
6349
6573
|
}
|
|
6350
6574
|
const drawingNode = sheetDocument.createElementNS(SPREADSHEET_NS, "drawing");
|
|
6351
|
-
drawingNode.setAttributeNS(
|
|
6575
|
+
drawingNode.setAttributeNS(REL_NS2, "r:id", relationshipId);
|
|
6352
6576
|
const successorNames = /* @__PURE__ */ new Set([
|
|
6353
6577
|
"legacyDrawing",
|
|
6354
6578
|
"legacyDrawingHF",
|
|
@@ -6398,7 +6622,7 @@ function mergeWorkbookImageAssets(savedBytes, sourceAssets, sheetOrigins) {
|
|
|
6398
6622
|
}
|
|
6399
6623
|
};
|
|
6400
6624
|
sheetOrigins.forEach((origin, workbookSheetIndex) => {
|
|
6401
|
-
if (!_optionalChain([origin, 'optionalAccess',
|
|
6625
|
+
if (!_optionalChain([origin, 'optionalAccess', _615 => _615.attachments, 'access', _616 => _616.length])) {
|
|
6402
6626
|
return;
|
|
6403
6627
|
}
|
|
6404
6628
|
const currentSheet = workbookSheets[workbookSheetIndex];
|
|
@@ -6427,7 +6651,7 @@ function mergeWorkbookImageAssets(savedBytes, sourceAssets, sheetOrigins) {
|
|
|
6427
6651
|
relationshipNode.setAttribute("Id", relationshipId);
|
|
6428
6652
|
relationshipNode.setAttribute("Type", DRAWING_REL_TYPE);
|
|
6429
6653
|
relationshipNode.setAttribute("Target", relativeArchivePath(currentSheet.path, attachment.drawingPath));
|
|
6430
|
-
_optionalChain([relDocument, 'access',
|
|
6654
|
+
_optionalChain([relDocument, 'access', _617 => _617.documentElement, 'optionalAccess', _618 => _618.appendChild, 'call', _619 => _619(relationshipNode)]);
|
|
6431
6655
|
appendSheetDrawingReference(sheetDocument, relationshipId);
|
|
6432
6656
|
});
|
|
6433
6657
|
archive[currentSheet.path] = _fflate.strToU8.call(void 0, serializeXml2(sheetDocument));
|
|
@@ -6598,7 +6822,7 @@ function collectReferencedSheetNames(workbook) {
|
|
|
6598
6822
|
continue;
|
|
6599
6823
|
}
|
|
6600
6824
|
for (const cell of cells) {
|
|
6601
|
-
const formula = _optionalChain([cell, 'optionalAccess',
|
|
6825
|
+
const formula = _optionalChain([cell, 'optionalAccess', _620 => _620.formula]);
|
|
6602
6826
|
if (!formula) {
|
|
6603
6827
|
continue;
|
|
6604
6828
|
}
|
|
@@ -6645,7 +6869,7 @@ function collectFormulaCellsWithSavedValues(workbook) {
|
|
|
6645
6869
|
continue;
|
|
6646
6870
|
}
|
|
6647
6871
|
for (const cell of cells) {
|
|
6648
|
-
if (typeof _optionalChain([cell, 'optionalAccess',
|
|
6872
|
+
if (typeof _optionalChain([cell, 'optionalAccess', _621 => _621.row]) !== "number" || typeof _optionalChain([cell, 'optionalAccess', _622 => _622.col]) !== "number") {
|
|
6649
6873
|
continue;
|
|
6650
6874
|
}
|
|
6651
6875
|
let saved;
|
|
@@ -7210,14 +7434,14 @@ function clampZoomScale(zoomScale) {
|
|
|
7210
7434
|
return Math.min(MAX_ZOOM_SCALE, Math.max(MIN_ZOOM_SCALE, Math.round(zoomScale)));
|
|
7211
7435
|
}
|
|
7212
7436
|
function resolveDefaultZoomScale(activeTab, activeSheet) {
|
|
7213
|
-
if (_optionalChain([activeTab, 'optionalAccess',
|
|
7437
|
+
if (_optionalChain([activeTab, 'optionalAccess', _623 => _623.kind]) !== "sheet") {
|
|
7214
7438
|
return DEFAULT_ZOOM_SCALE;
|
|
7215
7439
|
}
|
|
7216
|
-
return clampZoomScale(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
7440
|
+
return clampZoomScale(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _624 => _624.zoomScale]), () => ( DEFAULT_ZOOM_SCALE)));
|
|
7217
7441
|
}
|
|
7218
7442
|
function resolveWorksheetZoomScale(worksheet, sheetState) {
|
|
7219
7443
|
const candidates = [
|
|
7220
|
-
typeof _optionalChain([sheetState, 'optionalAccess',
|
|
7444
|
+
typeof _optionalChain([sheetState, 'optionalAccess', _625 => _625.zoomScale]) === "number" ? sheetState.zoomScale : void 0,
|
|
7221
7445
|
typeof worksheet.zoomScale === "number" ? worksheet.zoomScale : void 0
|
|
7222
7446
|
];
|
|
7223
7447
|
const value = candidates.find((entry) => typeof entry === "number" && Number.isFinite(entry) && entry > 0);
|
|
@@ -7336,18 +7560,18 @@ function resolveDisplayFileName(src, fileName) {
|
|
|
7336
7560
|
}
|
|
7337
7561
|
function resolveSheetDisplayUsedRange(usedRange, sheetState) {
|
|
7338
7562
|
const [minRow, minCol, maxRow, maxCol] = usedRange;
|
|
7339
|
-
const maxContentRow = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7340
|
-
const maxContentCol = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7341
|
-
const maxVerticalMergeEndRow = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7342
|
-
const maxHorizontalMergeEndCol = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7563
|
+
const maxContentRow = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _626 => _626.maxContentRow]), () => ( -1));
|
|
7564
|
+
const maxContentCol = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _627 => _627.maxContentCol]), () => ( -1));
|
|
7565
|
+
const maxVerticalMergeEndRow = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _628 => _628.maxVerticalMergeEndRow]), () => ( -1));
|
|
7566
|
+
const maxHorizontalMergeEndCol = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _629 => _629.maxHorizontalMergeEndCol]), () => ( -1));
|
|
7343
7567
|
const maxMeaningfulRow = Math.max(maxContentRow, maxVerticalMergeEndRow);
|
|
7344
7568
|
const maxMeaningfulCol = Math.max(maxContentCol, maxHorizontalMergeEndCol);
|
|
7345
7569
|
if (maxMeaningfulRow < 0 && maxMeaningfulCol < 0) {
|
|
7346
7570
|
return usedRange;
|
|
7347
7571
|
}
|
|
7348
7572
|
return [
|
|
7349
|
-
_optionalChain([sheetState, 'optionalAccess',
|
|
7350
|
-
_optionalChain([sheetState, 'optionalAccess',
|
|
7573
|
+
_optionalChain([sheetState, 'optionalAccess', _630 => _630.minContentRow]) !== void 0 && sheetState.minContentRow >= 0 ? Math.min(minRow, sheetState.minContentRow) : minRow,
|
|
7574
|
+
_optionalChain([sheetState, 'optionalAccess', _631 => _631.minContentCol]) !== void 0 && sheetState.minContentCol >= 0 ? Math.min(minCol, sheetState.minContentCol) : minCol,
|
|
7351
7575
|
maxMeaningfulRow >= 0 ? maxContentRow >= 0 ? Math.min(maxRow, maxMeaningfulRow) : Math.max(maxRow, maxMeaningfulRow) : maxRow,
|
|
7352
7576
|
maxMeaningfulCol >= 0 ? maxContentCol >= 0 ? Math.min(maxCol, maxMeaningfulCol) : Math.max(maxCol, maxMeaningfulCol) : maxCol
|
|
7353
7577
|
];
|
|
@@ -7356,18 +7580,18 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
7356
7580
|
const sheets = [];
|
|
7357
7581
|
for (let index = 0; index < workbook.sheetCount; index += 1) {
|
|
7358
7582
|
const worksheet = workbook.getSheet(index);
|
|
7359
|
-
const sheetState = _nullishCoalesce(_optionalChain([sheetStatesByWorkbookSheetIndex, 'optionalAccess',
|
|
7583
|
+
const sheetState = _nullishCoalesce(_optionalChain([sheetStatesByWorkbookSheetIndex, 'optionalAccess', _632 => _632[index]]), () => ( null));
|
|
7360
7584
|
const mergeMetadata = resolveWorksheetMergeMetadata(worksheet);
|
|
7361
7585
|
const effectiveSheetState = {
|
|
7362
7586
|
...sheetState,
|
|
7363
7587
|
...mergeMetadata
|
|
7364
7588
|
};
|
|
7365
|
-
const defaultColWidthPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7589
|
+
const defaultColWidthPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _633 => _633.defaultColWidthPx]), () => ( resolveWorksheetDefaultColumnWidthPixels(
|
|
7366
7590
|
worksheet,
|
|
7367
|
-
_optionalChain([sheetState, 'optionalAccess',
|
|
7591
|
+
_optionalChain([sheetState, 'optionalAccess', _634 => _634.columnWidthCharacterWidthPx]),
|
|
7368
7592
|
DEFAULT_COL_WIDTH
|
|
7369
7593
|
)));
|
|
7370
|
-
const defaultRowHeightPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7594
|
+
const defaultRowHeightPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _635 => _635.defaultRowHeightPx]), () => ( resolveWorksheetDefaultRowHeightPixels(
|
|
7371
7595
|
worksheet,
|
|
7372
7596
|
DEFAULT_ROW_HEIGHT
|
|
7373
7597
|
)));
|
|
@@ -7378,27 +7602,28 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
7378
7602
|
const resolveColumnWidthPx = (col) => {
|
|
7379
7603
|
const width = worksheet.getColumnWidth(col);
|
|
7380
7604
|
if (width !== void 0 && width !== null) {
|
|
7381
|
-
return resolveSheetColumnWidthPixels(width, _optionalChain([sheetState, 'optionalAccess',
|
|
7605
|
+
return resolveSheetColumnWidthPixels(width, _optionalChain([sheetState, 'optionalAccess', _636 => _636.columnWidthCharacterWidthPx]));
|
|
7382
7606
|
}
|
|
7383
|
-
return _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7607
|
+
return _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _637 => _637.colWidthOverridesPx, 'optionalAccess', _638 => _638[col]]), () => ( defaultColWidthPx));
|
|
7384
7608
|
};
|
|
7385
7609
|
const resolveRowHeightPx = (row) => {
|
|
7386
7610
|
const height = worksheet.getRowHeight(row);
|
|
7387
7611
|
if (height !== void 0 && height !== null) {
|
|
7388
7612
|
return Math.max(Math.round(height * 1.33), MIN_ROW_HEIGHT_PX2);
|
|
7389
7613
|
}
|
|
7390
|
-
return _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7614
|
+
return _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _639 => _639.rowHeightOverridesPx, 'optionalAccess', _640 => _640[row]]), () => ( defaultRowHeightPx));
|
|
7391
7615
|
};
|
|
7392
7616
|
const usedRange = worksheet.usedRange();
|
|
7393
7617
|
if (!usedRange) {
|
|
7394
7618
|
sheets.push({
|
|
7395
|
-
autoFilterRanges: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7396
|
-
cachedFormulaValues: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7397
|
-
columnWidthCharacterWidthPx: _optionalChain([sheetState, 'optionalAccess',
|
|
7398
|
-
colWidthOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7399
|
-
colStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7400
|
-
conditionalFormatRules: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7619
|
+
autoFilterRanges: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _641 => _641.autoFilterRanges]), () => ( [])),
|
|
7620
|
+
cachedFormulaValues: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _642 => _642.cachedFormulaValues]), () => ( {})),
|
|
7621
|
+
columnWidthCharacterWidthPx: _optionalChain([sheetState, 'optionalAccess', _643 => _643.columnWidthCharacterWidthPx]),
|
|
7622
|
+
colWidthOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _644 => _644.colWidthOverridesPx]), () => ( {})),
|
|
7623
|
+
colStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _645 => _645.colStyleIds]), () => ( {})),
|
|
7624
|
+
conditionalFormatRules: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _646 => _646.conditionalFormatRules]), () => ( [])),
|
|
7401
7625
|
dataValidations: parseWorksheetDataValidations(worksheet),
|
|
7626
|
+
officeLayout: _optionalChain([sheetState, 'optionalAccess', _647 => _647.officeLayout]),
|
|
7402
7627
|
defaultColWidthPx,
|
|
7403
7628
|
defaultRowHeightPx,
|
|
7404
7629
|
freezePanes: parseWorksheetFreezePanes(worksheet),
|
|
@@ -7418,17 +7643,17 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
7418
7643
|
namedCellStyleByName: _nullishCoalesce(namedCellStyleByName, () => ( {})),
|
|
7419
7644
|
rowCount: 0,
|
|
7420
7645
|
colCount: 0,
|
|
7421
|
-
rowHeightOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7422
|
-
rowStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7423
|
-
cellStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7646
|
+
rowHeightOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _648 => _648.rowHeightOverridesPx]), () => ( {})),
|
|
7647
|
+
rowStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _649 => _649.rowStyleIds]), () => ( {})),
|
|
7648
|
+
cellStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _650 => _650.cellStyleIds]), () => ( {})),
|
|
7424
7649
|
styleById: _nullishCoalesce(styleById, () => ( {})),
|
|
7425
|
-
sparklines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7650
|
+
sparklines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _651 => _651.sparklines]), () => ( [])),
|
|
7426
7651
|
tableStyleByName: _nullishCoalesce(tableStyleByName, () => ( {})),
|
|
7427
7652
|
visibleRows: [],
|
|
7428
7653
|
visibleCols: [],
|
|
7429
7654
|
colWidths: [],
|
|
7430
7655
|
rowHeights: [],
|
|
7431
|
-
showGridLines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7656
|
+
showGridLines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _652 => _652.showGridLines]), () => ( true)),
|
|
7432
7657
|
themePalette: _nullishCoalesce(themePalette, () => ( { colorsByIndex: {} })),
|
|
7433
7658
|
workbookSheetIndex: index,
|
|
7434
7659
|
zoomScale: resolveWorksheetZoomScale(worksheet, sheetState)
|
|
@@ -7481,13 +7706,14 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
7481
7706
|
return colWidthsCache;
|
|
7482
7707
|
};
|
|
7483
7708
|
const sheet = {
|
|
7484
|
-
autoFilterRanges: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7485
|
-
cachedFormulaValues: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7486
|
-
columnWidthCharacterWidthPx: _optionalChain([sheetState, 'optionalAccess',
|
|
7487
|
-
colWidthOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7488
|
-
colStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7489
|
-
conditionalFormatRules: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7709
|
+
autoFilterRanges: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _653 => _653.autoFilterRanges]), () => ( [])),
|
|
7710
|
+
cachedFormulaValues: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _654 => _654.cachedFormulaValues]), () => ( {})),
|
|
7711
|
+
columnWidthCharacterWidthPx: _optionalChain([sheetState, 'optionalAccess', _655 => _655.columnWidthCharacterWidthPx]),
|
|
7712
|
+
colWidthOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _656 => _656.colWidthOverridesPx]), () => ( {})),
|
|
7713
|
+
colStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _657 => _657.colStyleIds]), () => ( {})),
|
|
7714
|
+
conditionalFormatRules: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _658 => _658.conditionalFormatRules]), () => ( [])),
|
|
7490
7715
|
dataValidations: parseWorksheetDataValidations(worksheet),
|
|
7716
|
+
officeLayout: _optionalChain([sheetState, 'optionalAccess', _659 => _659.officeLayout]),
|
|
7491
7717
|
defaultColWidthPx,
|
|
7492
7718
|
defaultRowHeightPx,
|
|
7493
7719
|
freezePanes: parseWorksheetFreezePanes(worksheet),
|
|
@@ -7505,12 +7731,12 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
|
|
|
7505
7731
|
name: worksheet.name,
|
|
7506
7732
|
visibility,
|
|
7507
7733
|
namedCellStyleByName: _nullishCoalesce(namedCellStyleByName, () => ( {})),
|
|
7508
|
-
rowHeightOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7509
|
-
rowStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7510
|
-
cellStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7511
|
-
showGridLines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7734
|
+
rowHeightOverridesPx: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _660 => _660.rowHeightOverridesPx]), () => ( {})),
|
|
7735
|
+
rowStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _661 => _661.rowStyleIds]), () => ( {})),
|
|
7736
|
+
cellStyleIds: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _662 => _662.cellStyleIds]), () => ( {})),
|
|
7737
|
+
showGridLines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _663 => _663.showGridLines]), () => ( true)),
|
|
7512
7738
|
styleById: _nullishCoalesce(styleById, () => ( {})),
|
|
7513
|
-
sparklines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
7739
|
+
sparklines: _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _664 => _664.sparklines]), () => ( [])),
|
|
7514
7740
|
tableStyleByName: _nullishCoalesce(tableStyleByName, () => ( {})),
|
|
7515
7741
|
themePalette: _nullishCoalesce(themePalette, () => ( { colorsByIndex: {} })),
|
|
7516
7742
|
workbookSheetIndex: index,
|
|
@@ -7631,15 +7857,15 @@ function resolveWorkbookReference(workbook, defaultWorkbookSheetIndex, rawRefere
|
|
|
7631
7857
|
}
|
|
7632
7858
|
}
|
|
7633
7859
|
function parseColorHex(hex) {
|
|
7634
|
-
const normalized = _optionalChain([hex, 'optionalAccess',
|
|
7860
|
+
const normalized = _optionalChain([hex, 'optionalAccess', _665 => _665.replace, 'call', _666 => _666(/^#/, "")]);
|
|
7635
7861
|
return normalized && /^[0-9a-f]{6}$/i.test(normalized) ? [0, 2, 4].map((offset) => Number.parseInt(normalized.slice(offset, offset + 2), 16)) : null;
|
|
7636
7862
|
}
|
|
7637
7863
|
function xlsxColorToDukeColor(color) {
|
|
7638
7864
|
if (!color) {
|
|
7639
7865
|
return void 0;
|
|
7640
7866
|
}
|
|
7641
|
-
const normalizedHex = _optionalChain([color, 'access',
|
|
7642
|
-
const colorType = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(color.colorType, () => ( (_optionalChain([normalizedHex, 'optionalAccess',
|
|
7867
|
+
const normalizedHex = _optionalChain([color, 'access', _667 => _667.hex, 'optionalAccess', _668 => _668.replace, 'call', _669 => _669(/^#/, "")]);
|
|
7868
|
+
const colorType = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(color.colorType, () => ( (_optionalChain([normalizedHex, 'optionalAccess', _670 => _670.length]) === 8 ? "argb" : _optionalChain([normalizedHex, 'optionalAccess', _671 => _671.length]) === 6 ? "rgb" : void 0))), () => ( (color.r !== void 0 && color.g !== void 0 && color.b !== void 0 ? color.a !== void 0 ? "argb" : "rgb" : void 0))), () => ( (color.themeIndex !== void 0 ? "theme" : color.paletteIndex !== void 0 ? "indexed" : void 0)));
|
|
7643
7869
|
switch (colorType) {
|
|
7644
7870
|
case "auto":
|
|
7645
7871
|
return { colorType: "auto" };
|
|
@@ -7648,7 +7874,7 @@ function xlsxColorToDukeColor(color) {
|
|
|
7648
7874
|
return channels ? { b: channels[2], colorType: "rgb", g: channels[1], r: channels[0] } : void 0;
|
|
7649
7875
|
}
|
|
7650
7876
|
case "argb": {
|
|
7651
|
-
const normalized = _optionalChain([color, 'access',
|
|
7877
|
+
const normalized = _optionalChain([color, 'access', _672 => _672.hex, 'optionalAccess', _673 => _673.replace, 'call', _674 => _674(/^#/, "")]);
|
|
7652
7878
|
const channels = normalized && /^[0-9a-f]{8}$/i.test(normalized) ? [0, 2, 4, 6].map((offset) => Number.parseInt(normalized.slice(offset, offset + 2), 16)) : color.a !== void 0 && color.r !== void 0 && color.g !== void 0 && color.b !== void 0 ? [color.a, color.r, color.g, color.b] : null;
|
|
7653
7879
|
return channels ? { a: channels[0], b: channels[3], colorType: "argb", g: channels[2], r: channels[1] } : void 0;
|
|
7654
7880
|
}
|
|
@@ -7771,7 +7997,7 @@ function reconcileCheckedOptionButtons(worksheet) {
|
|
|
7771
7997
|
const checkedPaths = worksheet.formControls.flatMap((control) => control.formControl.kind.kind === "optionButton" && control.formControl.kind.state === "checked" ? [control.drawingPath] : []);
|
|
7772
7998
|
for (const path of checkedPaths) {
|
|
7773
7999
|
const current = worksheet.formControls.find((control) => control.drawingPath.length === path.length && control.drawingPath.every((segment, index) => segment === path[index]));
|
|
7774
|
-
if (_optionalChain([current, 'optionalAccess',
|
|
8000
|
+
if (_optionalChain([current, 'optionalAccess', _675 => _675.formControl, 'access', _676 => _676.kind, 'access', _677 => _677.kind]) === "optionButton" && current.formControl.kind.state === "checked") {
|
|
7775
8001
|
worksheet.setFormControlCheckState(current.drawingPath, "checked");
|
|
7776
8002
|
}
|
|
7777
8003
|
}
|
|
@@ -7800,8 +8026,8 @@ function formControlInteractionChanged(current, next) {
|
|
|
7800
8026
|
}
|
|
7801
8027
|
function parseWorksheetFreezePanes(worksheet) {
|
|
7802
8028
|
const rawFreezePanes = worksheet.freezePanes;
|
|
7803
|
-
const row = typeof _optionalChain([rawFreezePanes, 'optionalAccess',
|
|
7804
|
-
const col = typeof _optionalChain([rawFreezePanes, 'optionalAccess',
|
|
8029
|
+
const row = typeof _optionalChain([rawFreezePanes, 'optionalAccess', _678 => _678.row]) === "number" && rawFreezePanes.row >= 0 ? rawFreezePanes.row : null;
|
|
8030
|
+
const col = typeof _optionalChain([rawFreezePanes, 'optionalAccess', _679 => _679.col]) === "number" && rawFreezePanes.col >= 0 ? rawFreezePanes.col : null;
|
|
7805
8031
|
if (row === null && col === null) {
|
|
7806
8032
|
return null;
|
|
7807
8033
|
}
|
|
@@ -7868,7 +8094,7 @@ function rangesIntersect(a, b) {
|
|
|
7868
8094
|
return a.start.row <= b.end.row && a.end.row >= b.start.row && a.start.col <= b.end.col && a.end.col >= b.start.col;
|
|
7869
8095
|
}
|
|
7870
8096
|
function mapWorksheetTables(worksheet, autoFilterRanges = []) {
|
|
7871
|
-
const rawTables = _nullishCoalesce(_optionalChain([worksheet, 'optionalAccess',
|
|
8097
|
+
const rawTables = _nullishCoalesce(_optionalChain([worksheet, 'optionalAccess', _680 => _680.tables]), () => ( []));
|
|
7872
8098
|
const mappedTables = rawTables.flatMap((table, index) => {
|
|
7873
8099
|
const rawColumns = Array.isArray(table.columns) ? table.columns : [];
|
|
7874
8100
|
const rawName = typeof table.name === "string" ? table.name : `Table${index + 1}`;
|
|
@@ -7965,7 +8191,7 @@ function pxToSheetRowHeight(heightPx) {
|
|
|
7965
8191
|
return Math.max(heightPx, MIN_ROW_HEIGHT_PX2) / 1.33;
|
|
7966
8192
|
}
|
|
7967
8193
|
function cssColor(color) {
|
|
7968
|
-
if (!_optionalChain([color, 'optionalAccess',
|
|
8194
|
+
if (!_optionalChain([color, 'optionalAccess', _681 => _681.hex])) {
|
|
7969
8195
|
return null;
|
|
7970
8196
|
}
|
|
7971
8197
|
const hex = String(color.hex);
|
|
@@ -8101,7 +8327,7 @@ function isAbortError(error) {
|
|
|
8101
8327
|
}
|
|
8102
8328
|
async function resolveWorkbookBuffer({ file, src }, signal) {
|
|
8103
8329
|
let buffer;
|
|
8104
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
8330
|
+
if (_optionalChain([signal, 'optionalAccess', _682 => _682.aborted])) {
|
|
8105
8331
|
throw createAbortError2();
|
|
8106
8332
|
}
|
|
8107
8333
|
if (file) {
|
|
@@ -8157,7 +8383,7 @@ function scheduleLowPriorityTask(task) {
|
|
|
8157
8383
|
task();
|
|
8158
8384
|
}, { timeout: 120 });
|
|
8159
8385
|
return () => {
|
|
8160
|
-
_optionalChain([idleWindow, 'access',
|
|
8386
|
+
_optionalChain([idleWindow, 'access', _683 => _683.cancelIdleCallback, 'optionalCall', _684 => _684(idleHandle)]);
|
|
8161
8387
|
};
|
|
8162
8388
|
}
|
|
8163
8389
|
const timeoutHandle = window.setTimeout(task, 0);
|
|
@@ -8170,7 +8396,7 @@ function inferImageMimeType(source) {
|
|
|
8170
8396
|
return source.slice(5, separatorIndex);
|
|
8171
8397
|
}
|
|
8172
8398
|
}
|
|
8173
|
-
const normalized = _nullishCoalesce(_optionalChain([source, 'access',
|
|
8399
|
+
const normalized = _nullishCoalesce(_optionalChain([source, 'access', _685 => _685.split, 'call', _686 => _686("?"), 'access', _687 => _687[0], 'optionalAccess', _688 => _688.toLowerCase, 'call', _689 => _689()]), () => ( ""));
|
|
8174
8400
|
if (normalized.endsWith(".gif")) {
|
|
8175
8401
|
return "image/gif";
|
|
8176
8402
|
}
|
|
@@ -8323,7 +8549,7 @@ function mergeParsedAndApiImages(parsedImages, apiImages, hiddenAnchorKeys) {
|
|
|
8323
8549
|
if (apiImages.length === 0) {
|
|
8324
8550
|
return visibleParsedImages;
|
|
8325
8551
|
}
|
|
8326
|
-
const normalizeTextKey = (value) => _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
8552
|
+
const normalizeTextKey = (value) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _690 => _690.trim, 'call', _691 => _691(), 'access', _692 => _692.toLowerCase, 'call', _693 => _693()]), () => ( ""));
|
|
8327
8553
|
const imageKeys = (image) => {
|
|
8328
8554
|
const keys = [
|
|
8329
8555
|
`${normalizeTextKey(image.mediaPath)}|${normalizeTextKey(image.name)}|${imageAnchorKey(image.anchor)}`,
|
|
@@ -8537,7 +8763,7 @@ function useXlsxViewerController(options) {
|
|
|
8537
8763
|
const shouldForceReadOnlyForBuffer = React.useCallback((bufferByteLength) => !requestedReadOnly && readOnlyAboveBytes > 0 && bufferByteLength > readOnlyAboveBytes, [readOnlyAboveBytes, requestedReadOnly]);
|
|
8538
8764
|
const shouldUseWorkerForReadOnlyLoad = React.useCallback((willForceReadOnly) => workerSupported && (willForceReadOnly || canUseWorkerForRequestedReadOnly), [canUseWorkerForRequestedReadOnly, workerSupported]);
|
|
8539
8765
|
const disposeWorkerClient = React.useCallback(() => {
|
|
8540
|
-
_optionalChain([workerClientRef, 'access',
|
|
8766
|
+
_optionalChain([workerClientRef, 'access', _694 => _694.current, 'optionalAccess', _695 => _695.dispose, 'call', _696 => _696()]);
|
|
8541
8767
|
workerClientRef.current = null;
|
|
8542
8768
|
}, []);
|
|
8543
8769
|
const getWorkerClient = React.useCallback(() => {
|
|
@@ -8556,7 +8782,7 @@ function useXlsxViewerController(options) {
|
|
|
8556
8782
|
}, []);
|
|
8557
8783
|
const clearChartAssets = React.useCallback(() => {
|
|
8558
8784
|
chartLoadRequestTokenRef.current += 1;
|
|
8559
|
-
_optionalChain([chartDisplayFallbackCleanupRef, 'access',
|
|
8785
|
+
_optionalChain([chartDisplayFallbackCleanupRef, 'access', _697 => _697.current, 'optionalCall', _698 => _698()]);
|
|
8560
8786
|
chartDisplayFallbackCleanupRef.current = null;
|
|
8561
8787
|
chartAssetsRef.current = null;
|
|
8562
8788
|
setChartsByWorkbookSheetIndex([]);
|
|
@@ -8567,16 +8793,16 @@ function useXlsxViewerController(options) {
|
|
|
8567
8793
|
const setImageAssets = React.useCallback((assets) => {
|
|
8568
8794
|
revokeWorkbookImageAssets(imageAssetsRef.current);
|
|
8569
8795
|
imageAssetsRef.current = assets;
|
|
8570
|
-
sheetOriginsRef.current = _nullishCoalesce(_optionalChain([assets, 'optionalAccess',
|
|
8571
|
-
setFormControlsByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess',
|
|
8572
|
-
setImagesByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess',
|
|
8573
|
-
setShapesByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess',
|
|
8796
|
+
sheetOriginsRef.current = _nullishCoalesce(_optionalChain([assets, 'optionalAccess', _699 => _699.sheetOrigins, 'access', _700 => _700.slice, 'call', _701 => _701()]), () => ( []));
|
|
8797
|
+
setFormControlsByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess', _702 => _702.formControlsByWorkbookSheetIndex]), () => ( [])));
|
|
8798
|
+
setImagesByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess', _703 => _703.imagesByWorkbookSheetIndex]), () => ( [])));
|
|
8799
|
+
setShapesByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess', _704 => _704.shapesByWorkbookSheetIndex]), () => ( [])));
|
|
8574
8800
|
}, []);
|
|
8575
8801
|
const setChartAssets = React.useCallback((assets) => {
|
|
8576
8802
|
chartAssetsRef.current = assets;
|
|
8577
|
-
setChartsByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess',
|
|
8578
|
-
setChartsheets(_nullishCoalesce(_optionalChain([assets, 'optionalAccess',
|
|
8579
|
-
setTabs(_nullishCoalesce(_optionalChain([assets, 'optionalAccess',
|
|
8803
|
+
setChartsByWorkbookSheetIndex(_nullishCoalesce(_optionalChain([assets, 'optionalAccess', _705 => _705.chartsByWorkbookSheetIndex]), () => ( [])));
|
|
8804
|
+
setChartsheets(_nullishCoalesce(_optionalChain([assets, 'optionalAccess', _706 => _706.chartsheets]), () => ( [])));
|
|
8805
|
+
setTabs(_nullishCoalesce(_optionalChain([assets, 'optionalAccess', _707 => _707.tabs]), () => ( [])));
|
|
8580
8806
|
setIsChartsLoading(false);
|
|
8581
8807
|
}, []);
|
|
8582
8808
|
const shouldFallbackFromWorkerError = React.useCallback((error2) => {
|
|
@@ -8638,7 +8864,7 @@ function useXlsxViewerController(options) {
|
|
|
8638
8864
|
setIsChartsLoading(true);
|
|
8639
8865
|
const requestToken = chartLoadRequestTokenRef.current + 1;
|
|
8640
8866
|
chartLoadRequestTokenRef.current = requestToken;
|
|
8641
|
-
_optionalChain([chartDisplayFallbackCleanupRef, 'access',
|
|
8867
|
+
_optionalChain([chartDisplayFallbackCleanupRef, 'access', _708 => _708.current, 'optionalCall', _709 => _709()]);
|
|
8642
8868
|
chartDisplayFallbackCleanupRef.current = null;
|
|
8643
8869
|
let fallbackTriggered = false;
|
|
8644
8870
|
const triggerFallback = () => {
|
|
@@ -8656,7 +8882,7 @@ function useXlsxViewerController(options) {
|
|
|
8656
8882
|
return;
|
|
8657
8883
|
}
|
|
8658
8884
|
if (imageAssetsRef.current && !effectiveSkipXmlParsing) {
|
|
8659
|
-
const chartOriginsById = hydrateWorkbookChartStyles(result.chartsByWorkbookSheetIndex, imageAssetsRef.current);
|
|
8885
|
+
const chartOriginsById = hydrateWorkbookChartStyles(result.chartsByWorkbookSheetIndex, imageAssetsRef.current, result.chartsheets);
|
|
8660
8886
|
chartAssetsRef.current = { ...result, chartOriginsById };
|
|
8661
8887
|
}
|
|
8662
8888
|
setChartsByWorkbookSheetIndex(result.chartsByWorkbookSheetIndex);
|
|
@@ -8737,11 +8963,11 @@ function useXlsxViewerController(options) {
|
|
|
8737
8963
|
};
|
|
8738
8964
|
}, [skipXmlParsing]);
|
|
8739
8965
|
const refreshWorkbookState = React.useCallback((targetWorkbook) => {
|
|
8740
|
-
const currentFormControls = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access',
|
|
8966
|
+
const currentFormControls = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _710 => _710.current, 'optionalAccess', _711 => _711.formControlsByWorkbookSheetIndex]), () => ( []));
|
|
8741
8967
|
const nextFormControls = refreshWorkbookFormControls(
|
|
8742
8968
|
targetWorkbook,
|
|
8743
8969
|
currentFormControls,
|
|
8744
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
8970
|
+
_optionalChain([imageAssetsRef, 'access', _712 => _712.current, 'optionalAccess', _713 => _713.themePalette])
|
|
8745
8971
|
);
|
|
8746
8972
|
if (imageAssetsRef.current) {
|
|
8747
8973
|
imageAssetsRef.current.formControlsByWorkbookSheetIndex = nextFormControls;
|
|
@@ -8749,11 +8975,11 @@ function useXlsxViewerController(options) {
|
|
|
8749
8975
|
setFormControlsByWorkbookSheetIndex(nextFormControls);
|
|
8750
8976
|
const nextSheets = buildSheetList(
|
|
8751
8977
|
targetWorkbook,
|
|
8752
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
8753
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
8754
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
8755
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
8756
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
8978
|
+
_optionalChain([imageAssetsRef, 'access', _714 => _714.current, 'optionalAccess', _715 => _715.sheetStatesByWorkbookSheetIndex]),
|
|
8979
|
+
_optionalChain([imageAssetsRef, 'access', _716 => _716.current, 'optionalAccess', _717 => _717.themePalette]),
|
|
8980
|
+
_optionalChain([imageAssetsRef, 'access', _718 => _718.current, 'optionalAccess', _719 => _719.styleById]),
|
|
8981
|
+
_optionalChain([imageAssetsRef, 'access', _720 => _720.current, 'optionalAccess', _721 => _721.namedCellStyleByName]),
|
|
8982
|
+
_optionalChain([imageAssetsRef, 'access', _722 => _722.current, 'optionalAccess', _723 => _723.tableStyleByName]),
|
|
8757
8983
|
showHiddenSheets
|
|
8758
8984
|
);
|
|
8759
8985
|
setSheets(nextSheets);
|
|
@@ -8768,7 +8994,7 @@ function useXlsxViewerController(options) {
|
|
|
8768
8994
|
setRevision((current) => current + 1);
|
|
8769
8995
|
}, [setChartAssets, showHiddenSheets]);
|
|
8770
8996
|
React.useEffect(() => () => {
|
|
8771
|
-
_optionalChain([chartDisplayFallbackCleanupRef, 'access',
|
|
8997
|
+
_optionalChain([chartDisplayFallbackCleanupRef, 'access', _724 => _724.current, 'optionalCall', _725 => _725()]);
|
|
8772
8998
|
chartDisplayFallbackCleanupRef.current = null;
|
|
8773
8999
|
revokeWorkbookImageAssets(imageAssetsRef.current);
|
|
8774
9000
|
disposeWorkerClient();
|
|
@@ -8849,7 +9075,7 @@ function useXlsxViewerController(options) {
|
|
|
8849
9075
|
}
|
|
8850
9076
|
buffer = normalizeWorkbookArrayBuffer(buffer);
|
|
8851
9077
|
const preflight = preflightWorkbookBuffer(buffer);
|
|
8852
|
-
if (_optionalChain([preflight, 'optionalAccess',
|
|
9078
|
+
if (_optionalChain([preflight, 'optionalAccess', _726 => _726.tooLarge])) {
|
|
8853
9079
|
throw createWorkbookTooLargeError(preflight);
|
|
8854
9080
|
}
|
|
8855
9081
|
const shouldForceReadOnly = shouldForceReadOnlyForBuffer(buffer.byteLength);
|
|
@@ -8881,10 +9107,10 @@ function useXlsxViewerController(options) {
|
|
|
8881
9107
|
return;
|
|
8882
9108
|
}
|
|
8883
9109
|
setImageAssets(workerImageAssets);
|
|
8884
|
-
const chartOriginsById = workerImageAssets ? hydrateWorkbookChartStyles(snapshot.chartsByWorkbookSheetIndex, workerImageAssets) : /* @__PURE__ */ new Map();
|
|
9110
|
+
const chartOriginsById = workerImageAssets ? hydrateWorkbookChartStyles(snapshot.chartsByWorkbookSheetIndex, workerImageAssets, snapshot.chartsheets) : /* @__PURE__ */ new Map();
|
|
8885
9111
|
setFormControlsByWorkbookSheetIndex(snapshot.formControlsByWorkbookSheetIndex);
|
|
8886
9112
|
setWorkbook(null);
|
|
8887
|
-
setSheets(snapshot.sheets);
|
|
9113
|
+
setSheets(snapshot.sheets.map((sheet) => ({ ...sheet, officeLayout: _optionalChain([workerImageAssets, 'optionalAccess', _727 => _727.sheetStatesByWorkbookSheetIndex, 'access', _728 => _728[sheet.workbookSheetIndex], 'optionalAccess', _729 => _729.officeLayout]) })));
|
|
8888
9114
|
setChartsByWorkbookSheetIndex(snapshot.chartsByWorkbookSheetIndex);
|
|
8889
9115
|
setChartsheets(snapshot.chartsheets);
|
|
8890
9116
|
setTabs(snapshot.tabs);
|
|
@@ -8969,10 +9195,10 @@ function useXlsxViewerController(options) {
|
|
|
8969
9195
|
showHiddenSheets
|
|
8970
9196
|
]);
|
|
8971
9197
|
const activeTab = _nullishCoalesce(tabs[activeTabIndex], () => ( null));
|
|
8972
|
-
const activeSheet = _optionalChain([activeTab, 'optionalAccess',
|
|
9198
|
+
const activeSheet = _optionalChain([activeTab, 'optionalAccess', _730 => _730.kind]) === "sheet" ? _nullishCoalesce(sheets[_nullishCoalesce(activeTab.sheetIndex, () => ( -1))], () => ( null)) : null;
|
|
8973
9199
|
const deferredMetadataCell = React.useDeferredValue(activeCell);
|
|
8974
9200
|
const deferredMetadataSheet = React.useDeferredValue(activeSheet);
|
|
8975
|
-
const activeZoomTabKey = _nullishCoalesce(_optionalChain([activeTab, 'optionalAccess',
|
|
9201
|
+
const activeZoomTabKey = _nullishCoalesce(_optionalChain([activeTab, 'optionalAccess', _731 => _731.id]), () => ( DEFAULT_ZOOM_TAB_KEY));
|
|
8976
9202
|
const defaultZoomScale = React.useMemo(
|
|
8977
9203
|
() => resolveDefaultZoomScale(activeTab, activeSheet),
|
|
8978
9204
|
[activeSheet, activeTab]
|
|
@@ -8998,7 +9224,7 @@ function useXlsxViewerController(options) {
|
|
|
8998
9224
|
return currentIndex;
|
|
8999
9225
|
}
|
|
9000
9226
|
const targetSheet = sheets[index];
|
|
9001
|
-
const tabIndex = tabs.findIndex((tab) => tab.kind === "sheet" && tab.workbookSheetIndex === _optionalChain([targetSheet, 'optionalAccess',
|
|
9227
|
+
const tabIndex = tabs.findIndex((tab) => tab.kind === "sheet" && tab.workbookSheetIndex === _optionalChain([targetSheet, 'optionalAccess', _732 => _732.workbookSheetIndex]));
|
|
9002
9228
|
if (tabIndex >= 0) {
|
|
9003
9229
|
setActiveTabIndexState(tabIndex);
|
|
9004
9230
|
}
|
|
@@ -9011,7 +9237,7 @@ function useXlsxViewerController(options) {
|
|
|
9011
9237
|
return currentIndex;
|
|
9012
9238
|
}
|
|
9013
9239
|
const targetTab = tabs[index];
|
|
9014
|
-
if (_optionalChain([targetTab, 'optionalAccess',
|
|
9240
|
+
if (_optionalChain([targetTab, 'optionalAccess', _733 => _733.kind]) === "sheet" && typeof targetTab.sheetIndex === "number") {
|
|
9015
9241
|
setActiveSheetIndexState(targetTab.sheetIndex);
|
|
9016
9242
|
}
|
|
9017
9243
|
return index;
|
|
@@ -9029,7 +9255,7 @@ function useXlsxViewerController(options) {
|
|
|
9029
9255
|
if (!parsed) {
|
|
9030
9256
|
return false;
|
|
9031
9257
|
}
|
|
9032
|
-
const requestedSheetName = _optionalChain([parsed, 'access',
|
|
9258
|
+
const requestedSheetName = _optionalChain([parsed, 'access', _734 => _734.sheetName, 'optionalAccess', _735 => _735.toLowerCase, 'call', _736 => _736()]);
|
|
9033
9259
|
const sheetIndex = requestedSheetName === void 0 ? _nullishCoalesce(options2.sheetIndex, () => ( activeSheetIndex)) : sheets.findIndex((sheet2) => sheet2.name.toLowerCase() === requestedSheetName);
|
|
9034
9260
|
const sheet = Number.isInteger(sheetIndex) ? sheets[sheetIndex] : void 0;
|
|
9035
9261
|
if (!sheet) {
|
|
@@ -9046,7 +9272,7 @@ function useXlsxViewerController(options) {
|
|
|
9046
9272
|
});
|
|
9047
9273
|
}
|
|
9048
9274
|
setHighlightedRanges(nextHighlights);
|
|
9049
|
-
if (_optionalChain([nextHighlights, 'access',
|
|
9275
|
+
if (_optionalChain([nextHighlights, 'access', _737 => _737[0], 'optionalAccess', _738 => _738.autoScroll])) {
|
|
9050
9276
|
setActiveSheetIndex(firstSheetIndex);
|
|
9051
9277
|
}
|
|
9052
9278
|
return true;
|
|
@@ -9111,7 +9337,7 @@ function useXlsxViewerController(options) {
|
|
|
9111
9337
|
return;
|
|
9112
9338
|
}
|
|
9113
9339
|
const preflight = preflightWorkbookBuffer(deferredBuffer);
|
|
9114
|
-
if (_optionalChain([preflight, 'optionalAccess',
|
|
9340
|
+
if (_optionalChain([preflight, 'optionalAccess', _739 => _739.tooLarge])) {
|
|
9115
9341
|
deferredBufferRef.current = null;
|
|
9116
9342
|
setDeferredLoadFileSize(null);
|
|
9117
9343
|
setWorkbook(null);
|
|
@@ -9137,11 +9363,11 @@ function useXlsxViewerController(options) {
|
|
|
9137
9363
|
}
|
|
9138
9364
|
const workerImageAssets = effectiveSkipXmlParsing ? null : parseWorkbookImageAssets(new Uint8Array(deferredBuffer));
|
|
9139
9365
|
setImageAssets(workerImageAssets);
|
|
9140
|
-
const chartOriginsById = workerImageAssets ? hydrateWorkbookChartStyles(snapshot.chartsByWorkbookSheetIndex, workerImageAssets) : /* @__PURE__ */ new Map();
|
|
9366
|
+
const chartOriginsById = workerImageAssets ? hydrateWorkbookChartStyles(snapshot.chartsByWorkbookSheetIndex, workerImageAssets, snapshot.chartsheets) : /* @__PURE__ */ new Map();
|
|
9141
9367
|
deferredBufferRef.current = null;
|
|
9142
9368
|
setDeferredLoadFileSize(null);
|
|
9143
9369
|
setWorkbook(null);
|
|
9144
|
-
setSheets(snapshot.sheets);
|
|
9370
|
+
setSheets(snapshot.sheets.map((sheet) => ({ ...sheet, officeLayout: _optionalChain([workerImageAssets, 'optionalAccess', _740 => _740.sheetStatesByWorkbookSheetIndex, 'access', _741 => _741[sheet.workbookSheetIndex], 'optionalAccess', _742 => _742.officeLayout]) })));
|
|
9145
9371
|
setChartsByWorkbookSheetIndex(snapshot.chartsByWorkbookSheetIndex);
|
|
9146
9372
|
setChartsheets(snapshot.chartsheets);
|
|
9147
9373
|
setTabs(snapshot.tabs);
|
|
@@ -9283,8 +9509,8 @@ function useXlsxViewerController(options) {
|
|
|
9283
9509
|
}
|
|
9284
9510
|
}, [activeSheetIndex, sheets, workbook]);
|
|
9285
9511
|
const tables = React.useMemo(
|
|
9286
|
-
() => isWorkerBacked ? _nullishCoalesce(workerTablesByWorkbookSheetIndex[_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
9287
|
-
[_optionalChain([activeSheet, 'optionalAccess',
|
|
9512
|
+
() => isWorkerBacked ? _nullishCoalesce(workerTablesByWorkbookSheetIndex[_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _743 => _743.workbookSheetIndex]), () => ( -1))], () => ( [])) : mapWorksheetTables(getActiveWorksheet(), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _744 => _744.autoFilterRanges]), () => ( []))),
|
|
9513
|
+
[_optionalChain([activeSheet, 'optionalAccess', _745 => _745.autoFilterRanges]), _optionalChain([activeSheet, 'optionalAccess', _746 => _746.workbookSheetIndex]), getActiveWorksheet, isWorkerBacked, revision, workerTablesByWorkbookSheetIndex]
|
|
9288
9514
|
);
|
|
9289
9515
|
const getCellSnapshotAsync = React.useCallback((workbookSheetIndex, row, col) => {
|
|
9290
9516
|
if (!isWorkerBacked) {
|
|
@@ -9351,9 +9577,9 @@ function useXlsxViewerController(options) {
|
|
|
9351
9577
|
}, [publicChartById]);
|
|
9352
9578
|
const getChartsheetById = React.useCallback((id) => _nullishCoalesce(chartsheets.find((chartsheet) => chartsheet.id === id), () => ( null)), [chartsheets]);
|
|
9353
9579
|
const charts = React.useMemo(() => {
|
|
9354
|
-
if (_optionalChain([activeTab, 'optionalAccess',
|
|
9580
|
+
if (_optionalChain([activeTab, 'optionalAccess', _747 => _747.kind]) === "chartsheet" && typeof activeTab.chartsheetIndex === "number") {
|
|
9355
9581
|
const chartsheet = chartsheets[activeTab.chartsheetIndex];
|
|
9356
|
-
return (_nullishCoalesce(_optionalChain([chartsheet, 'optionalAccess',
|
|
9582
|
+
return (_nullishCoalesce(_optionalChain([chartsheet, 'optionalAccess', _748 => _748.chartIds]), () => ( []))).map((id) => getChartById(id)).filter((value) => Boolean(value));
|
|
9357
9583
|
}
|
|
9358
9584
|
return getSheetCharts(activeSheetIndex);
|
|
9359
9585
|
}, [activeSheetIndex, activeTab, chartsheets, getChartById, getSheetCharts]);
|
|
@@ -9402,7 +9628,7 @@ function useXlsxViewerController(options) {
|
|
|
9402
9628
|
}, [selectedChartId]);
|
|
9403
9629
|
const selectChartElement = React.useCallback((selection2) => {
|
|
9404
9630
|
setSelectedImageId(null);
|
|
9405
|
-
setSelectedChartId(_nullishCoalesce(_optionalChain([selection2, 'optionalAccess',
|
|
9631
|
+
setSelectedChartId(_nullishCoalesce(_optionalChain([selection2, 'optionalAccess', _749 => _749.chartId]), () => ( null)));
|
|
9406
9632
|
setSelectedChartElement(selection2);
|
|
9407
9633
|
}, []);
|
|
9408
9634
|
const getSheetImages = React.useCallback((sheetIndex = activeSheetIndex) => {
|
|
@@ -9429,11 +9655,11 @@ function useXlsxViewerController(options) {
|
|
|
9429
9655
|
return [];
|
|
9430
9656
|
}
|
|
9431
9657
|
const control2 = (_nullishCoalesce(formControlsByWorkbookSheetIndex[targetSheet.workbookSheetIndex], () => ( []))).find((entry) => entry.controlIndex === controlIndex);
|
|
9432
|
-
return _nullishCoalesce(_optionalChain([control2, 'optionalAccess',
|
|
9658
|
+
return _nullishCoalesce(_optionalChain([control2, 'optionalAccess', _750 => _750.items, 'optionalAccess', _751 => _751.slice, 'call', _752 => _752()]), () => ( []));
|
|
9433
9659
|
}
|
|
9434
9660
|
const control = target.worksheet.formControls[controlIndex];
|
|
9435
|
-
const kind = _optionalChain([control, 'optionalAccess',
|
|
9436
|
-
const inputRange = _optionalChain([kind, 'optionalAccess',
|
|
9661
|
+
const kind = _optionalChain([control, 'optionalAccess', _753 => _753.formControl, 'access', _754 => _754.kind]);
|
|
9662
|
+
const inputRange = _optionalChain([kind, 'optionalAccess', _755 => _755.kind]) === "listBox" || _optionalChain([kind, 'optionalAccess', _756 => _756.kind]) === "dropdown" ? kind.inputRange : void 0;
|
|
9437
9663
|
if (!inputRange) {
|
|
9438
9664
|
return [];
|
|
9439
9665
|
}
|
|
@@ -9465,7 +9691,7 @@ function useXlsxViewerController(options) {
|
|
|
9465
9691
|
const shapes = React.useMemo(() => getSheetShapes(activeSheetIndex), [activeSheetIndex, getSheetShapes]);
|
|
9466
9692
|
const getImageById = React.useCallback((id) => {
|
|
9467
9693
|
for (const sheetImages of imagesByWorkbookSheetIndex) {
|
|
9468
|
-
const match = _optionalChain([sheetImages, 'optionalAccess',
|
|
9694
|
+
const match = _optionalChain([sheetImages, 'optionalAccess', _757 => _757.find, 'call', _758 => _758((image) => image.id === id)]);
|
|
9469
9695
|
if (match) {
|
|
9470
9696
|
return mapPublicImage(match);
|
|
9471
9697
|
}
|
|
@@ -9485,32 +9711,32 @@ function useXlsxViewerController(options) {
|
|
|
9485
9711
|
setSelectedImageId(null);
|
|
9486
9712
|
}, []);
|
|
9487
9713
|
const getColumnWidthPx = React.useCallback((worksheet, col) => {
|
|
9488
|
-
const sheetState = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access',
|
|
9714
|
+
const sheetState = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _759 => _759.current, 'optionalAccess', _760 => _760.sheetStatesByWorkbookSheetIndex, 'access', _761 => _761[_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _762 => _762.workbookSheetIndex]), () => ( -1))]]), () => ( null));
|
|
9489
9715
|
const width = worksheet.getColumnWidth(col);
|
|
9490
|
-
const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
9716
|
+
const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _763 => _763.showGridLines]), () => ( true));
|
|
9491
9717
|
if (width !== void 0 && width !== null) {
|
|
9492
9718
|
return resolveRenderedSheetAxisPixels(
|
|
9493
|
-
resolveSheetColumnWidthPixels(width, _optionalChain([sheetState, 'optionalAccess',
|
|
9719
|
+
resolveSheetColumnWidthPixels(width, _optionalChain([sheetState, 'optionalAccess', _764 => _764.columnWidthCharacterWidthPx])),
|
|
9494
9720
|
showGridLines
|
|
9495
9721
|
);
|
|
9496
9722
|
}
|
|
9497
9723
|
return resolveRenderedSheetAxisPixels(
|
|
9498
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
9724
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _765 => _765.colWidthOverridesPx, 'optionalAccess', _766 => _766[col]]), () => ( _optionalChain([sheetState, 'optionalAccess', _767 => _767.defaultColWidthPx]))), () => ( DEFAULT_COL_WIDTH)),
|
|
9499
9725
|
showGridLines
|
|
9500
9726
|
);
|
|
9501
|
-
}, [_optionalChain([activeSheet, 'optionalAccess',
|
|
9727
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _768 => _768.showGridLines]), _optionalChain([activeSheet, 'optionalAccess', _769 => _769.workbookSheetIndex])]);
|
|
9502
9728
|
const getRowHeightPx = React.useCallback((worksheet, row) => {
|
|
9503
|
-
const sheetState = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access',
|
|
9729
|
+
const sheetState = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _770 => _770.current, 'optionalAccess', _771 => _771.sheetStatesByWorkbookSheetIndex, 'access', _772 => _772[_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _773 => _773.workbookSheetIndex]), () => ( -1))]]), () => ( null));
|
|
9504
9730
|
const height = worksheet.getRowHeight(row);
|
|
9505
|
-
const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
9731
|
+
const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _774 => _774.showGridLines]), () => ( true));
|
|
9506
9732
|
if (height !== void 0 && height !== null) {
|
|
9507
9733
|
return resolveRenderedSheetAxisPixels(resolveSheetRowHeightPixels(height), showGridLines);
|
|
9508
9734
|
}
|
|
9509
9735
|
return resolveRenderedSheetAxisPixels(
|
|
9510
|
-
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess',
|
|
9736
|
+
_nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _775 => _775.rowHeightOverridesPx, 'optionalAccess', _776 => _776[row]]), () => ( _optionalChain([sheetState, 'optionalAccess', _777 => _777.defaultRowHeightPx]))), () => ( DEFAULT_ROW_HEIGHT)),
|
|
9511
9737
|
showGridLines
|
|
9512
9738
|
);
|
|
9513
|
-
}, [_optionalChain([activeSheet, 'optionalAccess',
|
|
9739
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _778 => _778.showGridLines]), _optionalChain([activeSheet, 'optionalAccess', _779 => _779.workbookSheetIndex])]);
|
|
9514
9740
|
const getCellDisplayValue2 = React.useCallback((cell) => {
|
|
9515
9741
|
if (cell && activeSheet) {
|
|
9516
9742
|
const workerSnapshot = workerCellSnapshotCacheRef.current.get(`${locale}:${activeSheet.workbookSheetIndex}:${cell.row}:${cell.col}`);
|
|
@@ -9523,7 +9749,7 @@ function useXlsxViewerController(options) {
|
|
|
9523
9749
|
return "";
|
|
9524
9750
|
}
|
|
9525
9751
|
const formula = worksheet.getFormulaAt(cell.row, cell.col);
|
|
9526
|
-
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess',
|
|
9752
|
+
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _780 => _780.cachedFormulaValues, 'optionalAccess', _781 => _781[cellAddressToA1(cell)]]) : void 0;
|
|
9527
9753
|
const formatted = worksheet.getFormattedValueAt(cell.row, cell.col);
|
|
9528
9754
|
if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
|
|
9529
9755
|
return localizeCellNumber(worksheet, cell.row, cell.col, decodeHtmlEntities(formatted), locale);
|
|
@@ -9585,9 +9811,9 @@ function useXlsxViewerController(options) {
|
|
|
9585
9811
|
"white-space:pre-wrap",
|
|
9586
9812
|
"vertical-align:top"
|
|
9587
9813
|
];
|
|
9588
|
-
const fill = _optionalChain([rawStyle, 'optionalAccess',
|
|
9814
|
+
const fill = _optionalChain([rawStyle, 'optionalAccess', _782 => _782.fill]);
|
|
9589
9815
|
if (fill) {
|
|
9590
|
-
const fillStyle = resolveWorkbookFillStyle(fill, _optionalChain([activeSheet, 'optionalAccess',
|
|
9816
|
+
const fillStyle = resolveWorkbookFillStyle(fill, _optionalChain([activeSheet, 'optionalAccess', _783 => _783.themePalette]));
|
|
9591
9817
|
if (fillStyle.backgroundColor && fillStyle.backgroundColor.toLowerCase() !== "#ffffff") {
|
|
9592
9818
|
cellStyles.push(`background-color:${fillStyle.backgroundColor}`);
|
|
9593
9819
|
}
|
|
@@ -9595,7 +9821,7 @@ function useXlsxViewerController(options) {
|
|
|
9595
9821
|
cellStyles.push(`background-image:${fillStyle.backgroundImage}`);
|
|
9596
9822
|
}
|
|
9597
9823
|
}
|
|
9598
|
-
const font = _optionalChain([rawStyle, 'optionalAccess',
|
|
9824
|
+
const font = _optionalChain([rawStyle, 'optionalAccess', _784 => _784.font]);
|
|
9599
9825
|
if (font) {
|
|
9600
9826
|
if (font.bold) {
|
|
9601
9827
|
cellStyles.push("font-weight:700");
|
|
@@ -9609,7 +9835,7 @@ function useXlsxViewerController(options) {
|
|
|
9609
9835
|
if (font.strikethrough) {
|
|
9610
9836
|
cellStyles.push("text-decoration:line-through");
|
|
9611
9837
|
}
|
|
9612
|
-
const fontColor = resolveWorkbookColor(font.color, _optionalChain([activeSheet, 'optionalAccess',
|
|
9838
|
+
const fontColor = resolveWorkbookColor(font.color, _optionalChain([activeSheet, 'optionalAccess', _785 => _785.themePalette]));
|
|
9613
9839
|
if (fontColor) {
|
|
9614
9840
|
cellStyles.push(`color:${fontColor}`);
|
|
9615
9841
|
}
|
|
@@ -9617,29 +9843,29 @@ function useXlsxViewerController(options) {
|
|
|
9617
9843
|
cellStyles.push(`font-size:${font.size}pt`);
|
|
9618
9844
|
}
|
|
9619
9845
|
}
|
|
9620
|
-
const alignment = _optionalChain([rawStyle, 'optionalAccess',
|
|
9621
|
-
if (_optionalChain([alignment, 'optionalAccess',
|
|
9846
|
+
const alignment = _optionalChain([rawStyle, 'optionalAccess', _786 => _786.alignment]);
|
|
9847
|
+
if (_optionalChain([alignment, 'optionalAccess', _787 => _787.horizontal]) && alignment.horizontal !== "general") {
|
|
9622
9848
|
cellStyles.push(`text-align:${String(alignment.horizontal)}`);
|
|
9623
9849
|
}
|
|
9624
|
-
if (_optionalChain([alignment, 'optionalAccess',
|
|
9850
|
+
if (_optionalChain([alignment, 'optionalAccess', _788 => _788.wrapText])) {
|
|
9625
9851
|
cellStyles.push("white-space:pre-wrap");
|
|
9626
9852
|
cellStyles.push("word-break:break-word");
|
|
9627
9853
|
}
|
|
9628
|
-
const border = _optionalChain([rawStyle, 'optionalAccess',
|
|
9629
|
-
if (_optionalChain([border, 'optionalAccess',
|
|
9854
|
+
const border = _optionalChain([rawStyle, 'optionalAccess', _789 => _789.border]);
|
|
9855
|
+
if (_optionalChain([border, 'optionalAccess', _790 => _790.top, 'optionalAccess', _791 => _791.style]) && border.top.style !== "none") {
|
|
9630
9856
|
cellStyles.push(`border-top:${mapBorder(border.top)}`);
|
|
9631
9857
|
}
|
|
9632
|
-
if (_optionalChain([border, 'optionalAccess',
|
|
9858
|
+
if (_optionalChain([border, 'optionalAccess', _792 => _792.right, 'optionalAccess', _793 => _793.style]) && border.right.style !== "none") {
|
|
9633
9859
|
cellStyles.push(`border-right:${mapBorder(border.right)}`);
|
|
9634
9860
|
}
|
|
9635
|
-
if (_optionalChain([border, 'optionalAccess',
|
|
9861
|
+
if (_optionalChain([border, 'optionalAccess', _794 => _794.bottom, 'optionalAccess', _795 => _795.style]) && border.bottom.style !== "none") {
|
|
9636
9862
|
cellStyles.push(`border-bottom:${mapBorder(border.bottom)}`);
|
|
9637
9863
|
}
|
|
9638
|
-
if (_optionalChain([border, 'optionalAccess',
|
|
9864
|
+
if (_optionalChain([border, 'optionalAccess', _796 => _796.left, 'optionalAccess', _797 => _797.style]) && border.left.style !== "none") {
|
|
9639
9865
|
cellStyles.push(`border-left:${mapBorder(border.left)}`);
|
|
9640
9866
|
}
|
|
9641
|
-
const rowSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
9642
|
-
const colSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
9867
|
+
const rowSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _798 => _798.rowSpan]), () => ( 1)), normalized.end.row - row + 1);
|
|
9868
|
+
const colSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _799 => _799.colSpan]), () => ( 1)), normalized.end.col - col + 1);
|
|
9643
9869
|
payload.cells.push({
|
|
9644
9870
|
colOffset: col - normalized.start.col,
|
|
9645
9871
|
formula,
|
|
@@ -9855,10 +10081,10 @@ function useXlsxViewerController(options) {
|
|
|
9855
10081
|
target.worksheet.addDrawing(xlsxFormControlInputToDukeDrawing(input));
|
|
9856
10082
|
const controlIndex = target.worksheet.formControlCount - 1;
|
|
9857
10083
|
const addedControl = target.worksheet.formControls[controlIndex];
|
|
9858
|
-
const addedKind = _optionalChain([addedControl, 'optionalAccess',
|
|
9859
|
-
if (addedControl && (_optionalChain([addedKind, 'optionalAccess',
|
|
10084
|
+
const addedKind = _optionalChain([addedControl, 'optionalAccess', _800 => _800.formControl, 'access', _801 => _801.kind]);
|
|
10085
|
+
if (addedControl && (_optionalChain([addedKind, 'optionalAccess', _802 => _802.kind]) === "checkbox" || _optionalChain([addedKind, 'optionalAccess', _803 => _803.kind]) === "optionButton")) {
|
|
9860
10086
|
target.worksheet.setFormControlCheckState(addedControl.drawingPath, addedKind.state);
|
|
9861
|
-
} else if (_optionalChain([addedKind, 'optionalAccess',
|
|
10087
|
+
} else if (_optionalChain([addedKind, 'optionalAccess', _804 => _804.kind]) === "groupBox") {
|
|
9862
10088
|
reconcileCheckedOptionButtons(target.worksheet);
|
|
9863
10089
|
} else if (addedKind && "cellLink" in addedKind && addedKind.cellLink) {
|
|
9864
10090
|
workbook.syncFormControls();
|
|
@@ -9869,7 +10095,7 @@ function useXlsxViewerController(options) {
|
|
|
9869
10095
|
}, [activeSheetIndex, getFormControlWorksheet, maybeRecalculateWorkbook, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
|
|
9870
10096
|
const updateFormControl = React.useCallback((controlIndex, patch, sheetIndex = activeSheetIndex) => {
|
|
9871
10097
|
const target = getFormControlWorksheet(sheetIndex);
|
|
9872
|
-
const currentControl = _optionalChain([target, 'optionalAccess',
|
|
10098
|
+
const currentControl = _optionalChain([target, 'optionalAccess', _805 => _805.worksheet, 'access', _806 => _806.formControls, 'access', _807 => _807[controlIndex]]);
|
|
9873
10099
|
if (readOnly || !workbook || !target || !currentControl) {
|
|
9874
10100
|
return false;
|
|
9875
10101
|
}
|
|
@@ -9889,8 +10115,8 @@ function useXlsxViewerController(options) {
|
|
|
9889
10115
|
legacyObjectType: _nullishCoalesce(nextKind.legacyObjectType, () => ( currentControl.formControl.kind.legacyObjectType))
|
|
9890
10116
|
};
|
|
9891
10117
|
}
|
|
9892
|
-
const patchedRawObj = _optionalChain([patch, 'access',
|
|
9893
|
-
const patchedRawProperties = _optionalChain([patch, 'access',
|
|
10118
|
+
const patchedRawObj = _optionalChain([patch, 'access', _808 => _808.kind, 'optionalAccess', _809 => _809.kind]) === "editbox" || _optionalChain([patch, 'access', _810 => _810.kind, 'optionalAccess', _811 => _811.kind]) === "unknown" ? patch.kind.rawObj : void 0;
|
|
10119
|
+
const patchedRawProperties = _optionalChain([patch, 'access', _812 => _812.kind, 'optionalAccess', _813 => _813.kind]) === "editbox" || _optionalChain([patch, 'access', _814 => _814.kind, 'optionalAccess', _815 => _815.kind]) === "unknown" ? patch.kind.rawProperties : void 0;
|
|
9894
10120
|
const nextInput = {
|
|
9895
10121
|
altText: "altText" in patch ? patch.altText : currentControl.altText,
|
|
9896
10122
|
anchor: nextAnchor,
|
|
@@ -9911,10 +10137,10 @@ function useXlsxViewerController(options) {
|
|
|
9911
10137
|
};
|
|
9912
10138
|
target.worksheet.setDrawing(currentControl.drawingPath, nextInput);
|
|
9913
10139
|
const updatedControl = target.worksheet.formControls[controlIndex];
|
|
9914
|
-
const updatedKind = _optionalChain([updatedControl, 'optionalAccess',
|
|
10140
|
+
const updatedKind = _optionalChain([updatedControl, 'optionalAccess', _816 => _816.formControl, 'access', _817 => _817.kind]);
|
|
9915
10141
|
const interactionChanged = updatedKind ? formControlInteractionChanged(currentControl.formControl.kind, updatedKind) : false;
|
|
9916
10142
|
const groupTopologyChanged = patch.anchor !== void 0 || updatedKind !== void 0 && updatedKind.kind !== currentControl.formControl.kind.kind && (updatedKind.kind === "groupBox" || currentControl.formControl.kind.kind === "groupBox");
|
|
9917
|
-
if (interactionChanged && updatedControl && (_optionalChain([updatedKind, 'optionalAccess',
|
|
10143
|
+
if (interactionChanged && updatedControl && (_optionalChain([updatedKind, 'optionalAccess', _818 => _818.kind]) === "checkbox" || _optionalChain([updatedKind, 'optionalAccess', _819 => _819.kind]) === "optionButton")) {
|
|
9918
10144
|
target.worksheet.setFormControlCheckState(updatedControl.drawingPath, updatedKind.state);
|
|
9919
10145
|
} else if (groupTopologyChanged) {
|
|
9920
10146
|
reconcileCheckedOptionButtons(target.worksheet);
|
|
@@ -10026,7 +10252,7 @@ function useXlsxViewerController(options) {
|
|
|
10026
10252
|
const comparedText = left.sortText.localeCompare(right.sortText, void 0, { numeric: true, sensitivity: "base" });
|
|
10027
10253
|
return direction === "ascending" ? comparedText : -comparedText;
|
|
10028
10254
|
});
|
|
10029
|
-
if (sortedRows.every((row, index) => row.index === _optionalChain([rows, 'access',
|
|
10255
|
+
if (sortedRows.every((row, index) => row.index === _optionalChain([rows, 'access', _820 => _820[index], 'optionalAccess', _821 => _821.index]))) {
|
|
10030
10256
|
setSortState({ columnIndex, direction, tableName: targetTable.name });
|
|
10031
10257
|
return;
|
|
10032
10258
|
}
|
|
@@ -10095,9 +10321,9 @@ function useXlsxViewerController(options) {
|
|
|
10095
10321
|
if (!workbook) {
|
|
10096
10322
|
return;
|
|
10097
10323
|
}
|
|
10098
|
-
const activeSheetName = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess',
|
|
10324
|
+
const activeSheetName = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _822 => _822.name]), () => ( "sheet"));
|
|
10099
10325
|
downloadText(workbook.saveCsvString(), `${fileStem(displayFileName)}-${activeSheetName}.csv`, CSV_MIME_TYPE);
|
|
10100
|
-
}, [_optionalChain([activeSheet, 'optionalAccess',
|
|
10326
|
+
}, [_optionalChain([activeSheet, 'optionalAccess', _823 => _823.name]), displayFileName, workbook]);
|
|
10101
10327
|
const recalculate = React.useCallback(() => {
|
|
10102
10328
|
if (!workbook) {
|
|
10103
10329
|
return;
|
|
@@ -10261,10 +10487,10 @@ function useXlsxViewerController(options) {
|
|
|
10261
10487
|
const currentChart = getChartById(id);
|
|
10262
10488
|
console.info("[react-xlsx debug] currentChart", {
|
|
10263
10489
|
activeWorkbookSheetIndex: activeSheet.workbookSheetIndex,
|
|
10264
|
-
editable: _optionalChain([currentChart, 'optionalAccess',
|
|
10490
|
+
editable: _optionalChain([currentChart, 'optionalAccess', _824 => _824.editable]),
|
|
10265
10491
|
found: Boolean(currentChart),
|
|
10266
10492
|
originCount: hydratedChartAssets.chartOriginsById.size,
|
|
10267
|
-
workbookSheetIndex: _optionalChain([currentChart, 'optionalAccess',
|
|
10493
|
+
workbookSheetIndex: _optionalChain([currentChart, 'optionalAccess', _825 => _825.workbookSheetIndex])
|
|
10268
10494
|
});
|
|
10269
10495
|
if (!currentChart || currentChart.editable === false || currentChart.workbookSheetIndex !== activeSheet.workbookSheetIndex) {
|
|
10270
10496
|
return;
|
|
@@ -10272,8 +10498,8 @@ function useXlsxViewerController(options) {
|
|
|
10272
10498
|
const nextAnchor = rectToImageAnchor(rect, currentChart.anchor, {
|
|
10273
10499
|
contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
|
|
10274
10500
|
contentOffsetTop: GRID_HEADER_HEIGHT,
|
|
10275
|
-
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
10276
|
-
getRowHeightPx: (row) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
10501
|
+
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _826 => _826.columnWidths, 'access', _827 => _827[col]]), () => ( getColumnWidthPx(worksheet, col))),
|
|
10502
|
+
getRowHeightPx: (row) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _828 => _828.rowHeights, 'access', _829 => _829[row]]), () => ( getRowHeightPx(worksheet, row)))
|
|
10277
10503
|
});
|
|
10278
10504
|
recordHistoryBeforeMutation();
|
|
10279
10505
|
const didUpdateAnchor = updateWorkbookChartAnchor(imageAssetsRef.current, hydratedChartAssets, id, nextAnchor);
|
|
@@ -10304,8 +10530,8 @@ function useXlsxViewerController(options) {
|
|
|
10304
10530
|
const nextAnchor = rectToImageAnchor(rect, currentImage.anchor, {
|
|
10305
10531
|
contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
|
|
10306
10532
|
contentOffsetTop: GRID_HEADER_HEIGHT,
|
|
10307
|
-
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
10308
|
-
getRowHeightPx: (row) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess',
|
|
10533
|
+
getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _830 => _830.columnWidths, 'access', _831 => _831[col]]), () => ( getColumnWidthPx(worksheet, col))),
|
|
10534
|
+
getRowHeightPx: (row) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _832 => _832.rowHeights, 'access', _833 => _833[row]]), () => ( getRowHeightPx(worksheet, row)))
|
|
10309
10535
|
});
|
|
10310
10536
|
recordHistoryBeforeMutation();
|
|
10311
10537
|
if (!updateWorkbookImageAnchor(imageAssetsRef.current, id, nextAnchor)) {
|
|
@@ -10464,7 +10690,13 @@ function useXlsxViewerController(options) {
|
|
|
10464
10690
|
if (!nextChart) {
|
|
10465
10691
|
return false;
|
|
10466
10692
|
}
|
|
10467
|
-
|
|
10693
|
+
const source = chart.renderSource;
|
|
10694
|
+
const indexedCategoryFormulaChanged = _optionalChain([source, 'optionalAccess', _834 => _834.indexedXSeries, 'optionalAccess', _835 => _835[seriesIndex]]) && _optionalChain([chart, 'access', _836 => _836.series, 'access', _837 => _837[seriesIndex], 'optionalAccess', _838 => _838.categoriesRef, 'optionalAccess', _839 => _839.formula]) !== _optionalChain([nextChart, 'access', _840 => _840.series, 'access', _841 => _841[seriesIndex], 'optionalAccess', _842 => _842.categoriesRef, 'optionalAccess', _843 => _843.formula]);
|
|
10695
|
+
updateChart(chartId, {
|
|
10696
|
+
series: nextChart.series,
|
|
10697
|
+
typeGroups: nextChart.typeGroups,
|
|
10698
|
+
renderSource: _optionalChain([source, 'optionalAccess', _844 => _844.sourceSeries]) || indexedCategoryFormulaChanged ? void 0 : source
|
|
10699
|
+
});
|
|
10468
10700
|
const selectedSeries = nextChart.series[seriesIndex];
|
|
10469
10701
|
if (selectedSeries) {
|
|
10470
10702
|
setSelectedChartElement((current) => current && current.chartId === chartId && current.kind !== "chart" ? {
|
|
@@ -10480,7 +10712,7 @@ function useXlsxViewerController(options) {
|
|
|
10480
10712
|
setSelectedChartElement(null);
|
|
10481
10713
|
setSelectedImageId(null);
|
|
10482
10714
|
setActiveCell(cell);
|
|
10483
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
10715
|
+
if (_optionalChain([options2, 'optionalAccess', _845 => _845.extend]) && selectionAnchorRef.current) {
|
|
10484
10716
|
setSelection(normalizeRange({ start: selectionAnchorRef.current, end: cell }));
|
|
10485
10717
|
return;
|
|
10486
10718
|
}
|
|
@@ -10621,7 +10853,7 @@ function useXlsxViewerController(options) {
|
|
|
10621
10853
|
setCellFormula(activeCell, formula);
|
|
10622
10854
|
}, [activeCell, setCellFormula]);
|
|
10623
10855
|
const setSelectedFormula = React.useCallback((formula) => {
|
|
10624
|
-
if (_optionalChain([selectedFormulaTarget, 'optionalAccess',
|
|
10856
|
+
if (_optionalChain([selectedFormulaTarget, 'optionalAccess', _846 => _846.kind]) === "chartSeries") {
|
|
10625
10857
|
return setChartSeriesFormula(selectedFormulaTarget.chartId, selectedFormulaTarget.seriesIndex, formula);
|
|
10626
10858
|
}
|
|
10627
10859
|
if (!activeCell) {
|
|
@@ -10783,7 +11015,7 @@ function useXlsxViewerController(options) {
|
|
|
10783
11015
|
return;
|
|
10784
11016
|
}
|
|
10785
11017
|
recordHistoryBeforeMutation();
|
|
10786
|
-
const baseName = _optionalChain([name, 'optionalAccess',
|
|
11018
|
+
const baseName = _optionalChain([name, 'optionalAccess', _847 => _847.trim, 'call', _848 => _848()]) || "Sheet";
|
|
10787
11019
|
let candidate = baseName;
|
|
10788
11020
|
let counter = 2;
|
|
10789
11021
|
while (workbook.sheetIndex(candidate) !== void 0) {
|
|
@@ -10803,11 +11035,11 @@ function useXlsxViewerController(options) {
|
|
|
10803
11035
|
}
|
|
10804
11036
|
const nextSheets = buildSheetList(
|
|
10805
11037
|
workbook,
|
|
10806
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10807
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10808
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10809
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10810
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
11038
|
+
_optionalChain([imageAssetsRef, 'access', _849 => _849.current, 'optionalAccess', _850 => _850.sheetStatesByWorkbookSheetIndex]),
|
|
11039
|
+
_optionalChain([imageAssetsRef, 'access', _851 => _851.current, 'optionalAccess', _852 => _852.themePalette]),
|
|
11040
|
+
_optionalChain([imageAssetsRef, 'access', _853 => _853.current, 'optionalAccess', _854 => _854.styleById]),
|
|
11041
|
+
_optionalChain([imageAssetsRef, 'access', _855 => _855.current, 'optionalAccess', _856 => _856.namedCellStyleByName]),
|
|
11042
|
+
_optionalChain([imageAssetsRef, 'access', _857 => _857.current, 'optionalAccess', _858 => _858.tableStyleByName]),
|
|
10811
11043
|
showHiddenSheets
|
|
10812
11044
|
);
|
|
10813
11045
|
setSheets(nextSheets);
|
|
@@ -10817,7 +11049,7 @@ function useXlsxViewerController(options) {
|
|
|
10817
11049
|
}
|
|
10818
11050
|
const nextIndex = nextSheets.findIndex((sheet) => sheet.name === candidate);
|
|
10819
11051
|
setActiveSheetIndexState(nextIndex >= 0 ? nextIndex : 0);
|
|
10820
|
-
const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess',
|
|
11052
|
+
const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess', _859 => _859.tabs, 'access', _860 => _860.findIndex, 'call', _861 => _861((tab) => tab.kind === "sheet" && tab.name === candidate)]), () => ( -1));
|
|
10821
11053
|
if (nextTabIndex >= 0) {
|
|
10822
11054
|
setActiveTabIndexState(nextTabIndex);
|
|
10823
11055
|
}
|
|
@@ -10843,11 +11075,11 @@ function useXlsxViewerController(options) {
|
|
|
10843
11075
|
}
|
|
10844
11076
|
const nextSheets = buildSheetList(
|
|
10845
11077
|
workbook,
|
|
10846
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10847
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10848
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10849
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
10850
|
-
_optionalChain([imageAssetsRef, 'access',
|
|
11078
|
+
_optionalChain([imageAssetsRef, 'access', _862 => _862.current, 'optionalAccess', _863 => _863.sheetStatesByWorkbookSheetIndex]),
|
|
11079
|
+
_optionalChain([imageAssetsRef, 'access', _864 => _864.current, 'optionalAccess', _865 => _865.themePalette]),
|
|
11080
|
+
_optionalChain([imageAssetsRef, 'access', _866 => _866.current, 'optionalAccess', _867 => _867.styleById]),
|
|
11081
|
+
_optionalChain([imageAssetsRef, 'access', _868 => _868.current, 'optionalAccess', _869 => _869.namedCellStyleByName]),
|
|
11082
|
+
_optionalChain([imageAssetsRef, 'access', _870 => _870.current, 'optionalAccess', _871 => _871.tableStyleByName]),
|
|
10851
11083
|
showHiddenSheets
|
|
10852
11084
|
);
|
|
10853
11085
|
setSheets(nextSheets);
|
|
@@ -10875,7 +11107,7 @@ function useXlsxViewerController(options) {
|
|
|
10875
11107
|
}, [readOnly, recordHistoryBeforeMutation, selection, workbook]);
|
|
10876
11108
|
const pasteText = React.useCallback((text) => {
|
|
10877
11109
|
const worksheet = getActiveWorksheet();
|
|
10878
|
-
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess',
|
|
11110
|
+
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _872 => _872.start]))), () => ( null));
|
|
10879
11111
|
if (readOnly || !worksheet || !workbook || !targetCell || !text) {
|
|
10880
11112
|
return false;
|
|
10881
11113
|
}
|
|
@@ -10939,7 +11171,7 @@ function useXlsxViewerController(options) {
|
|
|
10939
11171
|
}, [activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
|
|
10940
11172
|
const pasteStructuredClipboardData = React.useCallback((serializedPayload) => {
|
|
10941
11173
|
const worksheet = getActiveWorksheet();
|
|
10942
|
-
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess',
|
|
11174
|
+
const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _873 => _873.start]))), () => ( null));
|
|
10943
11175
|
if (readOnly || !worksheet || !workbook || !targetCell || !serializedPayload) {
|
|
10944
11176
|
return false;
|
|
10945
11177
|
}
|
|
@@ -12014,7 +12246,7 @@ function parseCanvasGradientStops(value) {
|
|
|
12014
12246
|
if (!match) {
|
|
12015
12247
|
return null;
|
|
12016
12248
|
}
|
|
12017
|
-
const color = _optionalChain([match, 'access',
|
|
12249
|
+
const color = _optionalChain([match, 'access', _874 => _874[1], 'optionalAccess', _875 => _875.trim, 'call', _876 => _876()]);
|
|
12018
12250
|
const percent = match[2] ? Number.parseFloat(match[2]) : Number.NaN;
|
|
12019
12251
|
if (!color) {
|
|
12020
12252
|
return null;
|
|
@@ -12030,7 +12262,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
|
|
|
12030
12262
|
if (linearMatch) {
|
|
12031
12263
|
const parts = splitCssGradientArgs(_nullishCoalesce(linearMatch[1], () => ( "")));
|
|
12032
12264
|
if (parts.length >= 2) {
|
|
12033
|
-
const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access',
|
|
12265
|
+
const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _877 => _877[0], 'optionalAccess', _878 => _878.trim, 'call', _879 => _879()]), () => ( "180deg"));
|
|
12034
12266
|
const angleMatch = rawAngle.match(/(-?\d*\.?\d+)deg/i);
|
|
12035
12267
|
const cssAngle = angleMatch ? Number.parseFloat(_nullishCoalesce(angleMatch[1], () => ( "180"))) : 180;
|
|
12036
12268
|
const radians = (90 - cssAngle) * Math.PI / 180;
|
|
@@ -12060,7 +12292,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
|
|
|
12060
12292
|
const radialMatch = backgroundImage.match(/^radial-gradient\((.*)\)$/i);
|
|
12061
12293
|
if (radialMatch) {
|
|
12062
12294
|
const parts = splitCssGradientArgs(_nullishCoalesce(radialMatch[1], () => ( "")));
|
|
12063
|
-
const stopParts = _optionalChain([parts, 'access',
|
|
12295
|
+
const stopParts = _optionalChain([parts, 'access', _880 => _880[0], 'optionalAccess', _881 => _881.startsWith, 'call', _882 => _882("circle")]) ? parts.slice(1) : parts;
|
|
12064
12296
|
const gradient = context.createRadialGradient(
|
|
12065
12297
|
rect.left + rect.width / 2,
|
|
12066
12298
|
rect.top + rect.height / 2,
|
|
@@ -12173,7 +12405,7 @@ function resolveDarkModeSurface(themePalette, palette) {
|
|
|
12173
12405
|
return "hsl(225 4% 6%)";
|
|
12174
12406
|
}
|
|
12175
12407
|
function resolveSheetSurface(sheet, palette) {
|
|
12176
|
-
return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess',
|
|
12408
|
+
return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _883 => _883.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _884 => _884.themePalette, 'access', _885 => _885.colorsByIndex, 'access', _886 => _886[0]]), () => ( SHEET_SURFACE));
|
|
12177
12409
|
}
|
|
12178
12410
|
function normalizeRange2(range) {
|
|
12179
12411
|
return {
|
|
@@ -12205,7 +12437,7 @@ function buildVisibleAxisIndices(precomputed, displayLimit, maxUsedIndex, hidden
|
|
|
12205
12437
|
const visible2 = [];
|
|
12206
12438
|
const usedLimit = Math.min(displayLimit, Math.max(0, maxUsedIndex + 1));
|
|
12207
12439
|
for (let index = 0; index < usedLimit; index += 1) {
|
|
12208
|
-
if (!_optionalChain([hiddenIndices, 'optionalAccess',
|
|
12440
|
+
if (!_optionalChain([hiddenIndices, 'optionalAccess', _887 => _887.has, 'call', _888 => _888(index)])) {
|
|
12209
12441
|
visible2.push(index);
|
|
12210
12442
|
}
|
|
12211
12443
|
}
|
|
@@ -12247,7 +12479,7 @@ function clampPercent(value, fallback) {
|
|
|
12247
12479
|
return Math.max(0, Math.min(100, value));
|
|
12248
12480
|
}
|
|
12249
12481
|
function resolveShapeAdjustment(shape, name, fallback) {
|
|
12250
|
-
const rawValue = _optionalChain([shape, 'access',
|
|
12482
|
+
const rawValue = _optionalChain([shape, 'access', _889 => _889.geometryAdjustments, 'optionalAccess', _890 => _890[name]]);
|
|
12251
12483
|
if (typeof rawValue !== "number") {
|
|
12252
12484
|
return fallback;
|
|
12253
12485
|
}
|
|
@@ -13147,8 +13379,8 @@ function normalizeThumbnailResolution(resolution) {
|
|
|
13147
13379
|
}
|
|
13148
13380
|
const resolvedObject = typeof resolution === "object" && resolution ? resolution : void 0;
|
|
13149
13381
|
return {
|
|
13150
|
-
maxHeight: _optionalChain([resolvedObject, 'optionalAccess',
|
|
13151
|
-
maxWidth: _optionalChain([resolvedObject, 'optionalAccess',
|
|
13382
|
+
maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _891 => _891.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
|
|
13383
|
+
maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _892 => _892.maxWidth]) && Number.isFinite(resolvedObject.maxWidth) && resolvedObject.maxWidth > 0 ? resolvedObject.maxWidth : THUMBNAIL_DEFAULT_MAX_DIMENSION
|
|
13152
13384
|
};
|
|
13153
13385
|
}
|
|
13154
13386
|
function resolveThumbnailOutputSize(sourceWidth, sourceHeight, resolution) {
|
|
@@ -13467,24 +13699,24 @@ function escapeCssFontFamily(name) {
|
|
|
13467
13699
|
return /[\s"'(),]/.test(name) ? `"${name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : name;
|
|
13468
13700
|
}
|
|
13469
13701
|
function resolveSpreadsheetThemeFont(font, themePalette) {
|
|
13470
|
-
const scheme = typeof _optionalChain([font, 'optionalAccess',
|
|
13702
|
+
const scheme = typeof _optionalChain([font, 'optionalAccess', _893 => _893.scheme]) === "string" ? font.scheme : null;
|
|
13471
13703
|
if (scheme === "major") {
|
|
13472
|
-
return _optionalChain([themePalette, 'optionalAccess',
|
|
13704
|
+
return _optionalChain([themePalette, 'optionalAccess', _894 => _894.majorLatinFont]);
|
|
13473
13705
|
}
|
|
13474
13706
|
if (scheme === "minor") {
|
|
13475
|
-
return _optionalChain([themePalette, 'optionalAccess',
|
|
13707
|
+
return _optionalChain([themePalette, 'optionalAccess', _895 => _895.minorLatinFont]);
|
|
13476
13708
|
}
|
|
13477
13709
|
return void 0;
|
|
13478
13710
|
}
|
|
13479
13711
|
function buildSpreadsheetFontFamily(font, themePalette) {
|
|
13480
13712
|
const candidates = [
|
|
13481
|
-
typeof _optionalChain([font, 'optionalAccess',
|
|
13482
|
-
_nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call',
|
|
13713
|
+
typeof _optionalChain([font, 'optionalAccess', _896 => _896.name]) === "string" ? font.name.trim() : "",
|
|
13714
|
+
_nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _897 => _897(font, themePalette), 'optionalAccess', _898 => _898.trim, 'call', _899 => _899()]), () => ( ""))
|
|
13483
13715
|
].filter((value, index, array) => value.length > 0 && array.indexOf(value) === index);
|
|
13484
13716
|
if (candidates.length === 0) {
|
|
13485
13717
|
return void 0;
|
|
13486
13718
|
}
|
|
13487
|
-
const primaryFont = _optionalChain([candidates, 'access',
|
|
13719
|
+
const primaryFont = _optionalChain([candidates, 'access', _900 => _900[0], 'optionalAccess', _901 => _901.toLowerCase, 'call', _902 => _902()]);
|
|
13488
13720
|
if (primaryFont === "calibri") {
|
|
13489
13721
|
return [
|
|
13490
13722
|
"Calibri",
|
|
@@ -13517,17 +13749,17 @@ function resolveSpreadsheetLineHeight(fontSizePt) {
|
|
|
13517
13749
|
}
|
|
13518
13750
|
function buildGridlineShadow(color, options) {
|
|
13519
13751
|
const parts = [];
|
|
13520
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13752
|
+
if (_optionalChain([options, 'optionalAccess', _903 => _903.right]) !== false) {
|
|
13521
13753
|
parts.push(`inset -1px 0 0 ${color}`);
|
|
13522
13754
|
}
|
|
13523
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13755
|
+
if (_optionalChain([options, 'optionalAccess', _904 => _904.bottom]) !== false) {
|
|
13524
13756
|
parts.push(`inset 0 -1px 0 ${color}`);
|
|
13525
13757
|
}
|
|
13526
13758
|
return parts.join(", ");
|
|
13527
13759
|
}
|
|
13528
13760
|
function buildCellStyle(style, palette, themePalette, options) {
|
|
13529
|
-
const showGridLines = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13530
|
-
const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess',
|
|
13761
|
+
const showGridLines = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _905 => _905.showGridLines]), () => ( true));
|
|
13762
|
+
const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _906 => _906.colorsByIndex, 'access', _907 => _907[0]]), () => ( SHEET_SURFACE));
|
|
13531
13763
|
const gridlineShadow = showGridLines ? buildGridlineShadow(palette.border) : void 0;
|
|
13532
13764
|
const css = {
|
|
13533
13765
|
backgroundColor: baseSurface,
|
|
@@ -13540,7 +13772,7 @@ function buildCellStyle(style, palette, themePalette, options) {
|
|
|
13540
13772
|
lineHeight: String(resolveSpreadsheetLineHeight(11)),
|
|
13541
13773
|
overflow: "hidden",
|
|
13542
13774
|
padding: DEFAULT_CELL_PADDING,
|
|
13543
|
-
textAlign: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13775
|
+
textAlign: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _908 => _908.generalAlignment]), () => ( "left")),
|
|
13544
13776
|
textOverflow: "clip",
|
|
13545
13777
|
verticalAlign: "bottom",
|
|
13546
13778
|
whiteSpace: "nowrap"
|
|
@@ -13624,24 +13856,24 @@ function buildCellStyle(style, palette, themePalette, options) {
|
|
|
13624
13856
|
}
|
|
13625
13857
|
const border = style.border;
|
|
13626
13858
|
if (border) {
|
|
13627
|
-
const hasRightBorder = Boolean(_optionalChain([border, 'access',
|
|
13628
|
-
const hasBottomBorder = Boolean(_optionalChain([border, 'access',
|
|
13859
|
+
const hasRightBorder = Boolean(_optionalChain([border, 'access', _909 => _909.right, 'optionalAccess', _910 => _910.style]) && border.right.style !== "none");
|
|
13860
|
+
const hasBottomBorder = Boolean(_optionalChain([border, 'access', _911 => _911.bottom, 'optionalAccess', _912 => _912.style]) && border.bottom.style !== "none");
|
|
13629
13861
|
if (showGridLines && (hasRightBorder || hasBottomBorder)) {
|
|
13630
13862
|
css.boxShadow = buildGridlineShadow(palette.border, {
|
|
13631
13863
|
bottom: !hasBottomBorder,
|
|
13632
13864
|
right: !hasRightBorder
|
|
13633
13865
|
}) || void 0;
|
|
13634
13866
|
}
|
|
13635
|
-
if (_optionalChain([border, 'access',
|
|
13867
|
+
if (_optionalChain([border, 'access', _913 => _913.top, 'optionalAccess', _914 => _914.style]) && border.top.style !== "none") {
|
|
13636
13868
|
css.borderTop = mapBorder2(border.top, themePalette);
|
|
13637
13869
|
}
|
|
13638
|
-
if (_optionalChain([border, 'access',
|
|
13870
|
+
if (_optionalChain([border, 'access', _915 => _915.right, 'optionalAccess', _916 => _916.style]) && border.right.style !== "none") {
|
|
13639
13871
|
css.borderRight = mapBorder2(border.right, themePalette);
|
|
13640
13872
|
}
|
|
13641
|
-
if (_optionalChain([border, 'access',
|
|
13873
|
+
if (_optionalChain([border, 'access', _917 => _917.bottom, 'optionalAccess', _918 => _918.style]) && border.bottom.style !== "none") {
|
|
13642
13874
|
css.borderBottom = mapBorder2(border.bottom, themePalette);
|
|
13643
13875
|
}
|
|
13644
|
-
if (_optionalChain([border, 'access',
|
|
13876
|
+
if (_optionalChain([border, 'access', _919 => _919.left, 'optionalAccess', _920 => _920.style]) && border.left.style !== "none") {
|
|
13645
13877
|
css.borderLeft = mapBorder2(border.left, themePalette);
|
|
13646
13878
|
}
|
|
13647
13879
|
}
|
|
@@ -13668,7 +13900,7 @@ function measureTextWidth(value, style) {
|
|
|
13668
13900
|
}
|
|
13669
13901
|
function getCellDisplayValue(worksheet, row, col, activeSheet, locale = "en-US") {
|
|
13670
13902
|
const formula = worksheet.getFormulaAt(row, col);
|
|
13671
|
-
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess',
|
|
13903
|
+
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _921 => _921.cachedFormulaValues, 'optionalAccess', _922 => _922[cellAddressToA12({ row, col })]]) : void 0;
|
|
13672
13904
|
const formatted = worksheet.getFormattedValueAt(row, col);
|
|
13673
13905
|
if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
|
|
13674
13906
|
return localizeCellNumber(worksheet, row, col, decodeHtmlEntities2(formatted), locale);
|
|
@@ -13915,7 +14147,7 @@ function normalizeBatchedMergeSpan(value) {
|
|
|
13915
14147
|
}
|
|
13916
14148
|
function normalizeBatchedCellValue(rawValue, formula, row, col, activeSheet) {
|
|
13917
14149
|
const value = typeof rawValue === "string" ? decodeHtmlEntities2(rawValue) : rawValue === null || rawValue === void 0 ? "" : String(rawValue);
|
|
13918
|
-
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess',
|
|
14150
|
+
const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _923 => _923.cachedFormulaValues, 'optionalAccess', _924 => _924[cellAddressToA12({ row, col })]]) : void 0;
|
|
13919
14151
|
if (formula && cachedFormulaValue !== void 0 && value.startsWith("#")) {
|
|
13920
14152
|
return cachedFormulaValue;
|
|
13921
14153
|
}
|
|
@@ -13962,31 +14194,31 @@ function mergeResolvedCellStyle(base, overlay, options) {
|
|
|
13962
14194
|
..._nullishCoalesce(base, () => ( {})),
|
|
13963
14195
|
..._nullishCoalesce(overlay, () => ( {}))
|
|
13964
14196
|
};
|
|
13965
|
-
const baseAlignment = _optionalChain([base, 'optionalAccess',
|
|
13966
|
-
const overlayAlignment = _optionalChain([overlay, 'optionalAccess',
|
|
14197
|
+
const baseAlignment = _optionalChain([base, 'optionalAccess', _925 => _925.alignment]);
|
|
14198
|
+
const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _926 => _926.alignment]);
|
|
13967
14199
|
if (baseAlignment || overlayAlignment) {
|
|
13968
14200
|
nextStyle.alignment = {
|
|
13969
14201
|
..._nullishCoalesce(baseAlignment, () => ( {})),
|
|
13970
14202
|
..._nullishCoalesce(overlayAlignment, () => ( {}))
|
|
13971
14203
|
};
|
|
13972
14204
|
}
|
|
13973
|
-
const baseBorder = _optionalChain([base, 'optionalAccess',
|
|
13974
|
-
const overlayBorder = _optionalChain([overlay, 'optionalAccess',
|
|
14205
|
+
const baseBorder = _optionalChain([base, 'optionalAccess', _927 => _927.border]);
|
|
14206
|
+
const overlayBorder = _optionalChain([overlay, 'optionalAccess', _928 => _928.border]);
|
|
13975
14207
|
if (baseBorder || overlayBorder) {
|
|
13976
|
-
nextStyle.border = _optionalChain([options, 'optionalAccess',
|
|
14208
|
+
nextStyle.border = _optionalChain([options, 'optionalAccess', _929 => _929.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
|
|
13977
14209
|
..._nullishCoalesce(baseBorder, () => ( {})),
|
|
13978
14210
|
..._nullishCoalesce(overlayBorder, () => ( {}))
|
|
13979
14211
|
};
|
|
13980
14212
|
}
|
|
13981
|
-
const baseFill = _optionalChain([base, 'optionalAccess',
|
|
13982
|
-
const overlayFill = _optionalChain([overlay, 'optionalAccess',
|
|
14213
|
+
const baseFill = _optionalChain([base, 'optionalAccess', _930 => _930.fill]);
|
|
14214
|
+
const overlayFill = _optionalChain([overlay, 'optionalAccess', _931 => _931.fill]);
|
|
13983
14215
|
if (baseFill || overlayFill) {
|
|
13984
|
-
nextStyle.fill = _optionalChain([options, 'optionalAccess',
|
|
14216
|
+
nextStyle.fill = _optionalChain([options, 'optionalAccess', _932 => _932.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
|
|
13985
14217
|
}
|
|
13986
|
-
const baseFont = _optionalChain([base, 'optionalAccess',
|
|
13987
|
-
const overlayFont = _optionalChain([overlay, 'optionalAccess',
|
|
14218
|
+
const baseFont = _optionalChain([base, 'optionalAccess', _933 => _933.font]);
|
|
14219
|
+
const overlayFont = _optionalChain([overlay, 'optionalAccess', _934 => _934.font]);
|
|
13988
14220
|
if (baseFont || overlayFont) {
|
|
13989
|
-
nextStyle.font = _optionalChain([options, 'optionalAccess',
|
|
14221
|
+
nextStyle.font = _optionalChain([options, 'optionalAccess', _935 => _935.replaceXfSubtrees]) && overlayFont ? overlayFont : {
|
|
13990
14222
|
..._nullishCoalesce(baseFont, () => ( {})),
|
|
13991
14223
|
..._nullishCoalesce(overlayFont, () => ( {}))
|
|
13992
14224
|
};
|
|
@@ -14342,11 +14574,11 @@ function resolveConditionalFormulaComparable(formula, worksheet, sheet, batchedC
|
|
|
14342
14574
|
return literal;
|
|
14343
14575
|
}
|
|
14344
14576
|
const splitReference = splitSheetFormulaReference(normalized);
|
|
14345
|
-
const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess',
|
|
14346
|
-
if (targetSheetName && _optionalChain([sheet, 'optionalAccess',
|
|
14577
|
+
const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _936 => _936.sheetName]), () => ( null));
|
|
14578
|
+
if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _937 => _937.name]) && targetSheetName !== sheet.name) {
|
|
14347
14579
|
return literal;
|
|
14348
14580
|
}
|
|
14349
|
-
const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess',
|
|
14581
|
+
const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _938 => _938.range]), () => ( normalized));
|
|
14350
14582
|
const cell = parseA1CellReference3(cellRef.replace(/\$/g, ""));
|
|
14351
14583
|
if (!cell) {
|
|
14352
14584
|
return literal;
|
|
@@ -14378,8 +14610,8 @@ function normalizeConditionalTextOperand(value) {
|
|
|
14378
14610
|
}
|
|
14379
14611
|
function resolveConditionalStyledRuleMatch(rule, numericValue, textValue, worksheet, sheet, batchedCells) {
|
|
14380
14612
|
const normalizedRuleType = rule.ruleType.trim().toLowerCase();
|
|
14381
|
-
const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access',
|
|
14382
|
-
const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access',
|
|
14613
|
+
const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _939 => _939.formulas, 'optionalAccess', _940 => _940[0]]), () => ( "")), worksheet, sheet, batchedCells);
|
|
14614
|
+
const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _941 => _941.formulas, 'optionalAccess', _942 => _942[1]]), () => ( "")), worksheet, sheet, batchedCells);
|
|
14383
14615
|
if (normalizedRuleType === "cellis") {
|
|
14384
14616
|
return resolveConditionalCellIsMatch(_nullishCoalesce(rule.operator, () => ( "equal")), left, right, numericValue, textValue);
|
|
14385
14617
|
}
|
|
@@ -14410,7 +14642,7 @@ function getStyledConditionalRules(rules) {
|
|
|
14410
14642
|
return styledRules;
|
|
14411
14643
|
}
|
|
14412
14644
|
function resolveConditionalCellStyleForCell(row, col, sheet, readNumericValue, readTextValue, worksheet, batchedCells) {
|
|
14413
|
-
const rules = _optionalChain([sheet, 'optionalAccess',
|
|
14645
|
+
const rules = _optionalChain([sheet, 'optionalAccess', _943 => _943.conditionalFormatRules]);
|
|
14414
14646
|
if (!sheet || !rules || rules.length === 0) {
|
|
14415
14647
|
return null;
|
|
14416
14648
|
}
|
|
@@ -14614,11 +14846,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
14614
14846
|
if (shape.paragraphs.length === 0) {
|
|
14615
14847
|
return;
|
|
14616
14848
|
}
|
|
14617
|
-
const inset = _optionalChain([shape, 'access',
|
|
14618
|
-
const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
14619
|
-
const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
14620
|
-
const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
14621
|
-
const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess',
|
|
14849
|
+
const inset = _optionalChain([shape, 'access', _944 => _944.textBox, 'optionalAccess', _945 => _945.insetPx]);
|
|
14850
|
+
const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _946 => _946.left]), () => ( 6))) * zoomFactor;
|
|
14851
|
+
const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _947 => _947.right]), () => ( 6))) * zoomFactor;
|
|
14852
|
+
const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _948 => _948.top]), () => ( 4))) * zoomFactor;
|
|
14853
|
+
const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _949 => _949.bottom]), () => ( 4))) * zoomFactor;
|
|
14622
14854
|
const textLeft = left + paddingLeft;
|
|
14623
14855
|
const textTop = top + paddingTop;
|
|
14624
14856
|
const textWidth = Math.max(0, width - paddingLeft - paddingRight);
|
|
@@ -14640,9 +14872,9 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
14640
14872
|
});
|
|
14641
14873
|
const totalTextHeight = lineMetrics.reduce((total, metric) => total + metric.lineHeight, 0);
|
|
14642
14874
|
let y = textTop;
|
|
14643
|
-
if (_optionalChain([shape, 'access',
|
|
14875
|
+
if (_optionalChain([shape, 'access', _950 => _950.textBox, 'optionalAccess', _951 => _951.verticalAlign]) === "middle") {
|
|
14644
14876
|
y = textTop + Math.max(0, (textHeight - totalTextHeight) / 2);
|
|
14645
|
-
} else if (_optionalChain([shape, 'access',
|
|
14877
|
+
} else if (_optionalChain([shape, 'access', _952 => _952.textBox, 'optionalAccess', _953 => _953.verticalAlign]) === "bottom") {
|
|
14646
14878
|
y = textTop + Math.max(0, textHeight - totalTextHeight);
|
|
14647
14879
|
}
|
|
14648
14880
|
context.save();
|
|
@@ -14653,7 +14885,7 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
14653
14885
|
shape.paragraphs.forEach((paragraph, paragraphIndex) => {
|
|
14654
14886
|
const metric = _nullishCoalesce(lineMetrics[paragraphIndex], () => ( { lineHeight: 14 * zoomFactor, widthPx: 0 }));
|
|
14655
14887
|
let x = textLeft;
|
|
14656
|
-
const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access',
|
|
14888
|
+
const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _954 => _954.textBox, 'optionalAccess', _955 => _955.horizontalAlign]))), () => ( "left"));
|
|
14657
14889
|
if (align === "center") {
|
|
14658
14890
|
x = textLeft + Math.max(0, (textWidth - metric.widthPx) / 2);
|
|
14659
14891
|
} else if (align === "right") {
|
|
@@ -14682,11 +14914,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
|
|
|
14682
14914
|
context.restore();
|
|
14683
14915
|
}
|
|
14684
14916
|
function drawStaticShape(context, shape, rect, zoomFactor) {
|
|
14685
|
-
const fillColor = _optionalChain([shape, 'access',
|
|
14686
|
-
const strokeColor = _optionalChain([shape, 'access',
|
|
14687
|
-
const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access',
|
|
14917
|
+
const fillColor = _optionalChain([shape, 'access', _956 => _956.fill, 'optionalAccess', _957 => _957.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _958 => _958.fill, 'optionalAccess', _959 => _959.color]), () => ( "transparent"));
|
|
14918
|
+
const strokeColor = _optionalChain([shape, 'access', _960 => _960.stroke, 'optionalAccess', _961 => _961.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _962 => _962.stroke, 'optionalAccess', _963 => _963.color]), () => ( "transparent"));
|
|
14919
|
+
const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _964 => _964.stroke, 'optionalAccess', _965 => _965.widthPx]), () => ( (shape.geometry === "line" ? 2 : 1)))) * zoomFactor);
|
|
14688
14920
|
const vectorShape = resolveShapeVector(shape);
|
|
14689
|
-
const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access',
|
|
14921
|
+
const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _966 => _966.fill, 'optionalAccess', _967 => _967.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _968 => _968.stroke, 'optionalAccess', _969 => _969.opacity]), () => ( 1)));
|
|
14690
14922
|
context.save();
|
|
14691
14923
|
context.translate(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
14692
14924
|
if (shape.rotationDeg) {
|
|
@@ -14697,7 +14929,7 @@ function drawStaticShape(context, shape, rect, zoomFactor) {
|
|
|
14697
14929
|
context.lineWidth = lineWidth;
|
|
14698
14930
|
context.strokeStyle = strokeColor;
|
|
14699
14931
|
context.fillStyle = fillColor;
|
|
14700
|
-
applyCanvasShapeDash(context, _optionalChain([shape, 'access',
|
|
14932
|
+
applyCanvasShapeDash(context, _optionalChain([shape, 'access', _970 => _970.stroke, 'optionalAccess', _971 => _971.dash]), lineWidth);
|
|
14701
14933
|
const localLeft = -rect.width / 2;
|
|
14702
14934
|
const localTop = -rect.height / 2;
|
|
14703
14935
|
if (vectorShape && typeof Path2D !== "undefined") {
|
|
@@ -14834,7 +15066,7 @@ function drawStaticFormControl(context, control, rect, palette, zoomFactor, shee
|
|
|
14834
15066
|
context.restore();
|
|
14835
15067
|
}
|
|
14836
15068
|
function resolveConditionalDataBarForCell(row, col, worksheet, sheet, metricsCache) {
|
|
14837
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
15069
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _972 => _972.conditionalFormatRules]), () => ( []));
|
|
14838
15070
|
const matchingRule = rules.find(
|
|
14839
15071
|
(rule) => rule.kind === "dataBar" && rule.ranges.some((range) => isCellInRange({ row, col }, range))
|
|
14840
15072
|
);
|
|
@@ -14872,23 +15104,23 @@ function resolveConditionalDataBarForCell(row, col, worksheet, sheet, metricsCac
|
|
|
14872
15104
|
const span = maxValue - minValue;
|
|
14873
15105
|
const ratio = span === 0 ? numericValue >= maxValue ? 1 : 0 : (numericValue - minValue) / span;
|
|
14874
15106
|
const widthPercent = minLength + Math.max(0, Math.min(1, ratio)) * (maxLength - minLength);
|
|
14875
|
-
const color = resolveWorkbookColor(matchingRule.color, _optionalChain([sheet, 'optionalAccess',
|
|
15107
|
+
const color = resolveWorkbookColor(matchingRule.color, _optionalChain([sheet, 'optionalAccess', _973 => _973.themePalette]));
|
|
14876
15108
|
if (!color || widthPercent <= 0) {
|
|
14877
15109
|
return null;
|
|
14878
15110
|
}
|
|
14879
15111
|
return {
|
|
14880
|
-
axisColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess',
|
|
15112
|
+
axisColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _974 => _974.themePalette])), () => ( void 0)),
|
|
14881
15113
|
border: _nullishCoalesce(matchingRule.border, () => ( void 0)),
|
|
14882
|
-
borderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess',
|
|
15114
|
+
borderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _975 => _975.themePalette])), () => ( void 0)),
|
|
14883
15115
|
color,
|
|
14884
15116
|
gradient: _nullishCoalesce(matchingRule.gradient, () => ( void 0)),
|
|
14885
|
-
negativeBorderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess',
|
|
14886
|
-
negativeFillColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess',
|
|
15117
|
+
negativeBorderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _976 => _976.themePalette])), () => ( void 0)),
|
|
15118
|
+
negativeFillColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _977 => _977.themePalette])), () => ( void 0)),
|
|
14887
15119
|
widthPercent
|
|
14888
15120
|
};
|
|
14889
15121
|
}
|
|
14890
15122
|
function resolveConditionalColorScaleForCell(row, col, worksheet, sheet, metricsCache) {
|
|
14891
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
15123
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _978 => _978.conditionalFormatRules]), () => ( []));
|
|
14892
15124
|
const matchingRule = rules.find(
|
|
14893
15125
|
(rule) => rule.kind === "colorScale" && rule.ranges.some((range) => isCellInRange({ row, col }, range))
|
|
14894
15126
|
);
|
|
@@ -14916,7 +15148,7 @@ function resolveConditionalColorScaleForCell(row, col, worksheet, sheet, metrics
|
|
|
14916
15148
|
});
|
|
14917
15149
|
metricsCache.set(cacheKey, ruleValues);
|
|
14918
15150
|
}
|
|
14919
|
-
const colors = matchingRule.colors.map((color) => resolveWorkbookColor(color, _optionalChain([sheet, 'optionalAccess',
|
|
15151
|
+
const colors = matchingRule.colors.map((color) => resolveWorkbookColor(color, _optionalChain([sheet, 'optionalAccess', _979 => _979.themePalette]))).filter((color) => typeof color === "string");
|
|
14920
15152
|
const thresholds = matchingRule.cfvos.map((threshold) => resolveConditionalRuleThreshold(threshold, ruleValues)).filter((value) => typeof value === "number" && Number.isFinite(value));
|
|
14921
15153
|
if (colors.length < 2 || thresholds.length < 2) {
|
|
14922
15154
|
return null;
|
|
@@ -14935,7 +15167,7 @@ function resolveConditionalColorScaleForCell(row, col, worksheet, sheet, metrics
|
|
|
14935
15167
|
return { color: resolvedColor };
|
|
14936
15168
|
}
|
|
14937
15169
|
function resolveConditionalIconForCell(row, col, worksheet, sheet, metricsCache) {
|
|
14938
|
-
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess',
|
|
15170
|
+
const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _980 => _980.conditionalFormatRules]), () => ( []));
|
|
14939
15171
|
const matchingRule = rules.find(
|
|
14940
15172
|
(rule) => rule.kind === "iconSet" && rule.ranges.some((range) => isCellInRange({ row, col }, range))
|
|
14941
15173
|
);
|
|
@@ -15222,7 +15454,7 @@ function GridRow({
|
|
|
15222
15454
|
whiteSpace: "nowrap",
|
|
15223
15455
|
width: "max-content"
|
|
15224
15456
|
} : null;
|
|
15225
|
-
const title = [_optionalChain([cellData, 'access',
|
|
15457
|
+
const title = [_optionalChain([cellData, 'access', _981 => _981.hyperlink, 'optionalAccess', _982 => _982.tooltip]), _optionalChain([cellData, 'access', _983 => _983.validation, 'optionalAccess', _984 => _984.message]), cellData.value].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join("\n");
|
|
15226
15458
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
15227
15459
|
"td",
|
|
15228
15460
|
{
|
|
@@ -15406,8 +15638,8 @@ var MemoGridRow = React4.memo(GridRow, (prev, next) => {
|
|
|
15406
15638
|
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.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment) {
|
|
15407
15639
|
return false;
|
|
15408
15640
|
}
|
|
15409
|
-
const prevEditingCol = _optionalChain([prev, 'access',
|
|
15410
|
-
const nextEditingCol = _optionalChain([next, 'access',
|
|
15641
|
+
const prevEditingCol = _optionalChain([prev, 'access', _985 => _985.editingCell, 'optionalAccess', _986 => _986.row]) === prev.actualRow ? prev.editingCell.col : -1;
|
|
15642
|
+
const nextEditingCol = _optionalChain([next, 'access', _987 => _987.editingCell, 'optionalAccess', _988 => _988.row]) === next.actualRow ? next.editingCell.col : -1;
|
|
15411
15643
|
if (prevEditingCol !== nextEditingCol) {
|
|
15412
15644
|
return false;
|
|
15413
15645
|
}
|
|
@@ -15874,8 +16106,8 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
15874
16106
|
const pendingRequest = workerThumbnailRowBatchRequestRef.current.get(sheet);
|
|
15875
16107
|
if (!pendingRequest) {
|
|
15876
16108
|
const request = {
|
|
15877
|
-
endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess',
|
|
15878
|
-
startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess',
|
|
16109
|
+
endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _989 => _989.endRow]), () => ( endRow))),
|
|
16110
|
+
startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _990 => _990.startRow]), () => ( startRow)))
|
|
15879
16111
|
};
|
|
15880
16112
|
workerThumbnailRowBatchRequestRef.current.set(sheet, request);
|
|
15881
16113
|
void getRowsBatchAsync(
|
|
@@ -15939,7 +16171,7 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
15939
16171
|
}, []);
|
|
15940
16172
|
const thumbnails = React4.useMemo(() => {
|
|
15941
16173
|
return sheets.map((sheet, sheetIndex) => {
|
|
15942
|
-
const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess',
|
|
16174
|
+
const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _991 => _991.getSheet, 'call', _992 => _992(sheet.workbookSheetIndex)]), () => ( null));
|
|
15943
16175
|
const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
|
|
15944
16176
|
const sheetShapes = getSheetShapes(sheetIndex);
|
|
15945
16177
|
const sheetFormControls = getSheetFormControls(sheetIndex).filter((control) => !control.hidden);
|
|
@@ -15955,18 +16187,18 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
15955
16187
|
minRow: 0
|
|
15956
16188
|
}));
|
|
15957
16189
|
return {
|
|
15958
|
-
maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
15959
|
-
maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
15960
|
-
minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
15961
|
-
minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess',
|
|
16190
|
+
maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _993 => _993.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
|
|
16191
|
+
maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _994 => _994.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
|
|
16192
|
+
minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _995 => _995.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
|
|
16193
|
+
minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _996 => _996.minRow]), () => ( drawingBound.minRow)), drawingBound.minRow)
|
|
15962
16194
|
};
|
|
15963
16195
|
}, null);
|
|
15964
16196
|
const sheetMinUsedRow = (_nullishCoalesce(sheet.maxUsedRow, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedRow, () => ( 0))) ? _nullishCoalesce(sheet.minUsedRow, () => ( 0)) : void 0;
|
|
15965
16197
|
const sheetMinUsedCol = (_nullishCoalesce(sheet.maxUsedCol, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedCol, () => ( 0))) ? _nullishCoalesce(sheet.minUsedCol, () => ( 0)) : void 0;
|
|
15966
|
-
const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess',
|
|
15967
|
-
const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess',
|
|
15968
|
-
const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess',
|
|
15969
|
-
const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess',
|
|
16198
|
+
const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _997 => _997.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _998 => _998.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
|
|
16199
|
+
const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _999 => _999.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1000 => _1000.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
|
|
16200
|
+
const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1001 => _1001.maxRow]), () => ( -1)));
|
|
16201
|
+
const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1002 => _1002.maxCol]), () => ( -1)));
|
|
15970
16202
|
const showGridLines = _nullishCoalesce(sheet.showGridLines, () => ( true));
|
|
15971
16203
|
const hiddenRowSet = new Set(_nullishCoalesce(sheet.hiddenRows, () => ( [])));
|
|
15972
16204
|
const hiddenColSet = new Set(_nullishCoalesce(sheet.hiddenCols, () => ( [])));
|
|
@@ -16179,8 +16411,8 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
16179
16411
|
return cached;
|
|
16180
16412
|
}
|
|
16181
16413
|
const batchCoversRow = workerRowBatch ? row >= workerRowBatch.startRow && row <= workerRowBatch.endRow : false;
|
|
16182
|
-
const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess',
|
|
16183
|
-
if (_optionalChain([batchedCell, 'optionalAccess',
|
|
16414
|
+
const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _1003 => _1003.cells, 'access', _1004 => _1004.get, 'call', _1005 => _1005(cacheKey)]) : void 0;
|
|
16415
|
+
if (_optionalChain([batchedCell, 'optionalAccess', _1006 => _1006.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _1007 => _1007.isMergedSecondary, 'call', _1008 => _1008(row, col)])) {
|
|
16184
16416
|
const mergedSecondaryData = {
|
|
16185
16417
|
isMergedSecondary: true,
|
|
16186
16418
|
style: {},
|
|
@@ -16189,23 +16421,23 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
16189
16421
|
cellRenderCache.set(cacheKey, mergedSecondaryData);
|
|
16190
16422
|
return mergedSecondaryData;
|
|
16191
16423
|
}
|
|
16192
|
-
const merge = worksheet ? worksheet.getMergeSpan(row, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
16424
|
+
const merge = worksheet ? worksheet.getMergeSpan(row, col) : _optionalChain([batchedCell, 'optionalAccess', _1009 => _1009.mergeSpan]);
|
|
16193
16425
|
const inheritedStyle = resolveInheritedCellStyle2(sheet, row, col);
|
|
16194
|
-
const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
16426
|
+
const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1010 => _1010.style]), () => ( null));
|
|
16195
16427
|
const mergedStyle = mergeResolvedCellStyle(inheritedStyle, worksheetStyle, { replaceXfSubtrees: true });
|
|
16196
16428
|
const conditionalCellStyle = resolveConditionalCellStyleForCell(
|
|
16197
16429
|
row,
|
|
16198
16430
|
col,
|
|
16199
16431
|
sheet,
|
|
16200
16432
|
() => worksheet ? getCellNumericValue(worksheet, row, col) : getBatchedCellNumericValue(batchedCell),
|
|
16201
|
-
() => worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
16433
|
+
() => worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1011 => _1011.value]), () => ( "")),
|
|
16202
16434
|
worksheet,
|
|
16203
|
-
_optionalChain([workerRowBatch, 'optionalAccess',
|
|
16435
|
+
_optionalChain([workerRowBatch, 'optionalAccess', _1012 => _1012.cells])
|
|
16204
16436
|
);
|
|
16205
16437
|
const finalResolvedStyle = mergeResolvedCellStyle(mergedStyle, conditionalCellStyle);
|
|
16206
|
-
const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess',
|
|
16438
|
+
const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _1013 => _1013.alignment]);
|
|
16207
16439
|
const sparkline = _nullishCoalesce(sparklineByCell.get(cacheKey), () => ( null));
|
|
16208
|
-
const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess',
|
|
16440
|
+
const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _1014 => _1014.cells, 'access', _1015 => _1015.get, 'call', _1016 => _1016(`${targetRow}:${targetCol}`)]));
|
|
16209
16441
|
const sparklineValues = sparkline ? sparkline.range.start.row === sparkline.range.end.row ? Array.from(
|
|
16210
16442
|
{ length: Math.abs(sparkline.range.end.col - sparkline.range.start.col) + 1 },
|
|
16211
16443
|
(_, index) => getNumericValue(
|
|
@@ -16219,23 +16451,23 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
16219
16451
|
sparkline.range.start.col
|
|
16220
16452
|
)
|
|
16221
16453
|
) : null;
|
|
16222
|
-
const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess',
|
|
16454
|
+
const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _1017 => _1017.cellControl]) ? worksheet ? getCellBooleanValue(worksheet, row, col) : getBatchedCellBooleanValue(batchedCell) : null;
|
|
16223
16455
|
const nextData = {
|
|
16224
16456
|
canvas: void 0,
|
|
16225
16457
|
checkboxState,
|
|
16226
|
-
colSpan: _optionalChain([merge, 'optionalAccess',
|
|
16458
|
+
colSpan: _optionalChain([merge, 'optionalAccess', _1018 => _1018.colSpan]),
|
|
16227
16459
|
conditionalColorScale: worksheet ? resolveConditionalColorScaleForCell(row, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
16228
16460
|
conditionalDataBar: worksheet ? resolveConditionalDataBarForCell(row, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
16229
16461
|
conditionalIcon: worksheet ? resolveConditionalIconForCell(row, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
|
|
16230
16462
|
isMergedSecondary: false,
|
|
16231
|
-
rowSpan: _optionalChain([merge, 'optionalAccess',
|
|
16463
|
+
rowSpan: _optionalChain([merge, 'optionalAccess', _1019 => _1019.rowSpan]),
|
|
16232
16464
|
sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
|
|
16233
16465
|
style: buildCellStyle(finalResolvedStyle, palette, sheet.themePalette, {
|
|
16234
|
-
generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row, col) : _optionalChain([batchedCell, 'optionalAccess',
|
|
16466
|
+
generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row, col) : _optionalChain([batchedCell, 'optionalAccess', _1020 => _1020.generalAlignment]),
|
|
16235
16467
|
showGridLines
|
|
16236
16468
|
}),
|
|
16237
|
-
textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess',
|
|
16238
|
-
value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess',
|
|
16469
|
+
textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _1021 => _1021.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _1022 => _1022.textRotation])))),
|
|
16470
|
+
value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1023 => _1023.value]), () => ( ""))
|
|
16239
16471
|
};
|
|
16240
16472
|
nextData.canvas = buildCanvasCellStyleCache(nextData.style);
|
|
16241
16473
|
cellRenderCache.set(cacheKey, nextData);
|
|
@@ -16253,11 +16485,11 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
16253
16485
|
let height = rowItem.size;
|
|
16254
16486
|
for (let colOffset = 1; colOffset < colSpan; colOffset += 1) {
|
|
16255
16487
|
const nextCol = colItemByActual.get(colItem.actualIndex + colOffset);
|
|
16256
|
-
width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess',
|
|
16488
|
+
width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _1024 => _1024.size]), () => ( 0));
|
|
16257
16489
|
}
|
|
16258
16490
|
for (let rowOffset = 1; rowOffset < rowSpan; rowOffset += 1) {
|
|
16259
16491
|
const nextRow = rowItemByActual.get(rowItem.actualIndex + rowOffset);
|
|
16260
|
-
height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess',
|
|
16492
|
+
height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _1025 => _1025.size]), () => ( 0));
|
|
16261
16493
|
}
|
|
16262
16494
|
const rect = {
|
|
16263
16495
|
height,
|
|
@@ -16267,7 +16499,7 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
16267
16499
|
};
|
|
16268
16500
|
const canvasCellStyle = _nullishCoalesce(cellData.canvas, () => ( buildCanvasCellStyleCache(cellData.style)));
|
|
16269
16501
|
const gradientFill = typeof cellData.style.backgroundImage === "string" ? resolveCanvasGradientFill(context, rect, cellData.style.backgroundImage) : null;
|
|
16270
|
-
const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access',
|
|
16502
|
+
const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _1026 => _1026.conditionalColorScale, 'optionalAccess', _1027 => _1027.color]), () => ( (typeof cellData.style.backgroundColor === "string" ? cellData.style.backgroundColor : thumbnailSheetSurface)));
|
|
16271
16503
|
context.fillStyle = _nullishCoalesce(gradientFill, () => ( fillColor));
|
|
16272
16504
|
context.fillRect(rect.left, rect.top, rect.width, rect.height);
|
|
16273
16505
|
if (cellData.conditionalDataBar) {
|
|
@@ -16511,7 +16743,7 @@ function useXlsxViewerThumbnails(options = {}) {
|
|
|
16511
16743
|
workbook
|
|
16512
16744
|
]);
|
|
16513
16745
|
const paintThumbnail = React4.useCallback(
|
|
16514
|
-
(sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access',
|
|
16746
|
+
(sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _1028 => _1028[sheetIndex], 'optionalAccess', _1029 => _1029.paint, 'call', _1030 => _1030(canvas)]), () => ( false)),
|
|
16515
16747
|
[thumbnails]
|
|
16516
16748
|
);
|
|
16517
16749
|
return React4.useMemo(
|
|
@@ -16570,7 +16802,7 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init8.call
|
|
|
16570
16802
|
}
|
|
16571
16803
|
destroy() {
|
|
16572
16804
|
this.destroyed = true;
|
|
16573
|
-
_optionalChain([this, 'access',
|
|
16805
|
+
_optionalChain([this, 'access', _1031 => _1031.observer, 'optionalAccess', _1032 => _1032.disconnect, 'call', _1033 => _1033()]);
|
|
16574
16806
|
this.observer = null;
|
|
16575
16807
|
this.slots.clear();
|
|
16576
16808
|
this.listeners.clear();
|
|
@@ -16612,7 +16844,7 @@ function RuntimeContent({ content }) {
|
|
|
16612
16844
|
};
|
|
16613
16845
|
}, []);
|
|
16614
16846
|
React5.useLayoutEffect(() => {
|
|
16615
|
-
_optionalChain([rootRef, 'access',
|
|
16847
|
+
_optionalChain([rootRef, 'access', _1034 => _1034.current, 'optionalAccess', _1035 => _1035.update, 'call', _1036 => _1036(content)]);
|
|
16616
16848
|
}, [content]);
|
|
16617
16849
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: hostRef, style: { display: "contents" } });
|
|
16618
16850
|
}
|
|
@@ -16674,7 +16906,7 @@ function BoundViewer({ props, controller }) {
|
|
|
16674
16906
|
}, [slots]);
|
|
16675
16907
|
React5.useLayoutEffect(() => {
|
|
16676
16908
|
const host = hostRef.current;
|
|
16677
|
-
if (host) _optionalChain([viewerRef, 'access',
|
|
16909
|
+
if (host) _optionalChain([viewerRef, 'access', _1037 => _1037.current, 'optionalAccess', _1038 => _1038.update, 'call', _1039 => _1039(renderOptions(props, controller, slots, host.ownerDocument))]);
|
|
16678
16910
|
}, [controller, props, slots]);
|
|
16679
16911
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ViewerAppearanceContext.Provider, { value: {
|
|
16680
16912
|
headerBackgroundColor: props.headerBackgroundColor,
|