ooxml-core 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PptxHandler-DNZHAHUY.cjs +12 -0
- package/dist/PptxHandler-E44KDHMQ.mjs +3 -0
- package/dist/{PptxHandler-EX4WBIQQ.mjs → PptxHandler-NROFYT2N.mjs} +2 -2
- package/dist/automation/index.cjs +3236 -2258
- package/dist/automation/index.mjs +3236 -2258
- package/dist/{chunk-SWF7KVL5.cjs → chunk-2UVH6RHI.cjs} +1608 -1163
- package/dist/{chunk-M76PHYRR.mjs → chunk-7DSZI7S6.mjs} +1 -1
- package/dist/{chunk-AT66SA5M.cjs → chunk-7QZGRB3T.cjs} +28 -10
- package/dist/chunk-ANZ4Q6I3.cjs +21 -0
- package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
- package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
- package/dist/{chunk-FIELY5PI.mjs → chunk-EC2W2MDY.mjs} +30 -2
- package/dist/chunk-EGTRL3QJ.mjs +19 -0
- package/dist/chunk-GXHKNSZX.mjs +9 -0
- package/dist/{chunk-OXHMZS7B.mjs → chunk-HCXUI5UC.mjs} +943 -273
- package/dist/chunk-HDQXPSHY.cjs +17 -0
- package/dist/chunk-KTYBFGEY.mjs +14 -0
- package/dist/chunk-QOO36KG4.cjs +42 -0
- package/dist/chunk-R2KZXD6U.mjs +39 -0
- package/dist/{chunk-IGOA57LE.mjs → chunk-U2DF3EGK.mjs} +1 -1
- package/dist/{chunk-OB277ZGE.mjs → chunk-UAY26XOI.mjs} +27 -9
- package/dist/{chunk-WSO4T2LJ.mjs → chunk-W5ARCUJB.mjs} +26 -3
- package/dist/chunk-XZPZHXV4.cjs +12 -0
- package/dist/{chunk-LCS3J3QI.mjs → chunk-YB5SRNFS.mjs} +717 -272
- package/dist/docx/layout/adapt-table.d.ts +2 -2
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +554 -83
- package/dist/docx/layout/index.mjs +554 -84
- package/dist/docx/layout/nested-fragment-edges.d.ts +9 -0
- package/dist/docx/layout/nested-fragment-edges.d.ts.map +1 -0
- package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
- package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
- package/dist/docx/layout/page-cursor.d.ts +2 -0
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +20 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/table-border-layout.d.ts +16 -0
- package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-cell-layout.d.ts +3 -2
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-content.d.ts +4 -0
- package/dist/docx/layout/table-content.d.ts.map +1 -0
- package/dist/docx/layout/table-footnotes.d.ts +5 -0
- package/dist/docx/layout/table-footnotes.d.ts.map +1 -1
- package/dist/docx/layout/table-frames.d.ts +4 -0
- package/dist/docx/layout/table-frames.d.ts.map +1 -0
- package/dist/docx/layout/table-layout.d.ts +8 -3
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-note-completion.d.ts +5 -0
- package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
- package/dist/docx/layout/table-note-stories.d.ts +6 -0
- package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
- package/dist/pptx/automation/index.cjs +801 -296
- package/dist/pptx/automation/index.d.ts +5 -4
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{text-operations-BLodkuXE.d.ts → elements-DD3UGOMd.d.ts} +27 -3248
- package/dist/pptx/chunks/elements-DD3UGOMd.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B4cnSPNz.d.ts → index-BZrFyNtU.d.ts} +113 -5
- package/dist/pptx/chunks/index-BZrFyNtU.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BZh-IMkN.d.ts → index-DdX02BSm.d.ts} +19 -3
- package/dist/pptx/chunks/index-DdX02BSm.d.ts.map +1 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts +1512 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts.map +1 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts +1473 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +1 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts +3261 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +801 -296
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +1 -0
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +19 -18
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +3 -2
- package/dist/pptx/editor/render/font-family-update.cjs +14 -0
- package/dist/pptx/editor/render/font-family-update.d.ts +17 -0
- package/dist/pptx/editor/render/font-family-update.d.ts.map +1 -0
- package/dist/pptx/editor/render/font-family-update.mjs +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.cjs +14 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +17 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts.map +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.mjs +12 -0
- package/dist/pptx/editor/render/remap-text.cjs +2 -2
- package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-text.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +9 -8
- package/dist/pptx/editor/render/slide-operations.mjs +3 -2
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.cjs +18 -0
- package/dist/pptx/editor/render/text-content-style.d.ts +9 -0
- package/dist/pptx/editor/render/text-content-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-content-style.mjs +5 -0
- package/dist/pptx/editor/render/text-runs-style-patch.cjs +17 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +7 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-runs-style-patch.mjs +15 -0
- package/dist/pptx/editor/render/text-style-scope.cjs +173 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts +76 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-style-scope.mjs +164 -0
- package/dist/pptx/editor/render/theme-editor-model.cjs +1 -1
- package/dist/pptx/editor/render/theme-editor-model.mjs +1 -1
- package/dist/pptx/editor/render/update-text-segment-style.cjs +11 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +14 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/update-text-segment-style.mjs +2 -0
- package/dist/pptx/index.cjs +1091 -296
- package/dist/pptx/index.d.ts +7 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +590 -122
- package/dist/teams/index.mjs +590 -122
- package/dist/visio/date-cache.d.ts +3 -0
- package/dist/visio/date-cache.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +3 -3
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-text-field-commands.d.ts +15 -0
- package/dist/visio/edit-text-field-commands.d.ts.map +1 -1
- package/dist/visio/edit-text-field.d.ts +2 -2
- package/dist/visio/edit-text-field.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +501 -220
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +501 -220
- package/dist/visio/model.d.ts +6 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/style.d.ts +1 -1
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/text-field-display.d.ts +3 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-editability.d.ts +6 -0
- package/dist/visio/text-field-editability.d.ts.map +1 -0
- package/dist/visio/text-field-fraction.d.ts +3 -0
- package/dist/visio/text-field-fraction.d.ts.map +1 -0
- package/dist/visio/text-field-independent.d.ts +4 -0
- package/dist/visio/text-field-independent.d.ts.map +1 -0
- package/dist/visio/text-field-numeric.d.ts +1 -1
- package/dist/visio/text-field-numeric.d.ts.map +1 -1
- package/dist/visio/text-field-source.d.ts +6 -0
- package/dist/visio/text-field-source.d.ts.map +1 -0
- package/dist/visio/text-field-system-date.d.ts +4 -0
- package/dist/visio/text-field-system-date.d.ts.map +1 -0
- package/dist/visio/text-fields.d.ts +1 -0
- package/dist/visio/text-fields.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +514 -221
- package/dist/visio/ui/index.mjs +514 -221
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
- package/dist/xlsx/edit/pivots.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +1362 -659
- package/dist/xlsx/index.mjs +1361 -660
- package/dist/xlsx/load/index.cjs +1091 -430
- package/dist/xlsx/load/index.mjs +1091 -430
- package/dist/xlsx/model-pivots.d.ts +31 -2
- package/dist/xlsx/model-pivots.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts.map +1 -1
- package/dist/xlsx/pivot/aggregate.d.ts +3 -1
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
- package/dist/xlsx/pivot/data.d.ts +2 -2
- package/dist/xlsx/pivot/data.d.ts.map +1 -1
- package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
- package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy.d.ts +2 -4
- package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -1
- package/dist/xlsx/pivot/index.d.ts +2 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -1
- package/dist/xlsx/pivot/measures.d.ts +13 -0
- package/dist/xlsx/pivot/measures.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts +5 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter.d.ts +11 -0
- package/dist/xlsx/pivot/page-filter.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -1
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/values-axis.d.ts +12 -0
- package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +640 -137
- package/dist/xlsx/ui/index.mjs +640 -137
- package/package.json +2 -2
- package/dist/PptxHandler-AT7FVG5Q.mjs +0 -2
- package/dist/PptxHandler-VFSCECPL.cjs +0 -11
- package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BZh-IMkN.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts +0 -2970
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +0 -1
package/dist/xlsx/index.mjs
CHANGED
|
@@ -276,7 +276,7 @@ function createWorksheet(name, sheetId) {
|
|
|
276
276
|
function createWorkbook(options = {}) {
|
|
277
277
|
const names = options.sheets?.length ? options.sheets : ["Sheet1"];
|
|
278
278
|
return {
|
|
279
|
-
sheets: names.map((name,
|
|
279
|
+
sheets: names.map((name, index3) => createWorksheet(name, index3 + 1)),
|
|
280
280
|
styles: [defaultCellStyle()],
|
|
281
281
|
namedStyles: [{ name: "Normal", style: defaultCellStyle(), builtinId: 0 }],
|
|
282
282
|
definedNames: [],
|
|
@@ -298,7 +298,7 @@ function validateSheetName(workbook, name, exceptIndex = -1) {
|
|
|
298
298
|
return "A sheet name cannot start or end with an apostrophe.";
|
|
299
299
|
if (name.toLowerCase() === "history") return '"History" is reserved by Excel.';
|
|
300
300
|
const clash = workbook.sheets.findIndex(
|
|
301
|
-
(sheet,
|
|
301
|
+
(sheet, index3) => index3 !== exceptIndex && sheet.name.toLowerCase() === name.toLowerCase()
|
|
302
302
|
);
|
|
303
303
|
return clash >= 0 ? "That name is already taken." : void 0;
|
|
304
304
|
}
|
|
@@ -337,10 +337,10 @@ function internStyle(workbook, style2) {
|
|
|
337
337
|
const known = cache3.get(key);
|
|
338
338
|
if (known !== void 0 && workbook.styles[known] && styleKey(workbook.styles[known]) === key)
|
|
339
339
|
return known;
|
|
340
|
-
const
|
|
341
|
-
if (
|
|
342
|
-
cache3.set(key,
|
|
343
|
-
return
|
|
340
|
+
const index3 = workbook.styles.findIndex((candidate) => styleKey(candidate) === key);
|
|
341
|
+
if (index3 >= 0) {
|
|
342
|
+
cache3.set(key, index3);
|
|
343
|
+
return index3;
|
|
344
344
|
}
|
|
345
345
|
workbook.styles.push(style2);
|
|
346
346
|
cache3.set(key, workbook.styles.length - 1);
|
|
@@ -1746,10 +1746,10 @@ var MONTH_NAMES = [
|
|
|
1746
1746
|
function monthFromName(name) {
|
|
1747
1747
|
const lower2 = name.toLowerCase();
|
|
1748
1748
|
if (lower2.length < 3) return void 0;
|
|
1749
|
-
const
|
|
1749
|
+
const index3 = MONTH_NAMES.findIndex(
|
|
1750
1750
|
(m) => m.startsWith(lower2) || lower2.length > 3 && lower2 === m
|
|
1751
1751
|
);
|
|
1752
|
-
return
|
|
1752
|
+
return index3 < 0 ? void 0 : index3 + 1;
|
|
1753
1753
|
}
|
|
1754
1754
|
function fullYear(text3) {
|
|
1755
1755
|
const y = Number(text3);
|
|
@@ -3004,10 +3004,10 @@ var MONTHS2 = [
|
|
|
3004
3004
|
function monthFromName2(name) {
|
|
3005
3005
|
const lower2 = name.toLowerCase();
|
|
3006
3006
|
if (lower2.length < 3) return void 0;
|
|
3007
|
-
const
|
|
3008
|
-
if (
|
|
3009
|
-
const full = new Date(Date.UTC(2e3,
|
|
3010
|
-
return lower2.length === 3 || full.startsWith(lower2) || lower2 === "sept" ?
|
|
3007
|
+
const index3 = MONTHS2.findIndex((m) => lower2.startsWith(m));
|
|
3008
|
+
if (index3 < 0) return void 0;
|
|
3009
|
+
const full = new Date(Date.UTC(2e3, index3, 1)).toLocaleString("en-US", { month: "long", timeZone: "UTC" }).toLowerCase();
|
|
3010
|
+
return lower2.length === 3 || full.startsWith(lower2) || lower2 === "sept" ? index3 + 1 : void 0;
|
|
3011
3011
|
}
|
|
3012
3012
|
var NUMBER_RE3 = /^(\d+(?:,\d{3,})+|\d*)(\.\d*)?(?:e([+-]?\d+))?$/i;
|
|
3013
3013
|
var TIME_RE2 = /^(\d{1,4})(?::(\d+))?(?::(\d+(?:\.\d*)?))?(?:\s+(am|pm|a|p))?$/i;
|
|
@@ -3775,11 +3775,11 @@ function sort(args, ctx) {
|
|
|
3775
3775
|
if (byCol) m = transpose(m);
|
|
3776
3776
|
const indexes2 = args.length > 1 && args[1] !== null ? ctx.toMatrix(args[1] ?? null).flat().map((v) => Math.trunc(num(v))) : [1];
|
|
3777
3777
|
const orders = args.length > 2 && args[2] !== null ? ctx.toMatrix(args[2] ?? null).flat().map((v) => num(v)) : [1];
|
|
3778
|
-
const keys = indexes2.map((
|
|
3779
|
-
if (
|
|
3778
|
+
const keys = indexes2.map((index3, k) => {
|
|
3779
|
+
if (index3 < 1 || index3 > m.cols) fail(ERR.VALUE);
|
|
3780
3780
|
const order = orders[Math.min(k, orders.length - 1)] ?? 1;
|
|
3781
3781
|
if (order !== 1 && order !== -1) fail(ERR.VALUE);
|
|
3782
|
-
return { values: m.data.map((row2) => row2[
|
|
3782
|
+
return { values: m.data.map((row2) => row2[index3 - 1] ?? null), descending: order === -1 };
|
|
3783
3783
|
});
|
|
3784
3784
|
const sorted2 = new Matrix(sortRows(m.data, keys));
|
|
3785
3785
|
return byCol ? transpose(sorted2) : sorted2;
|
|
@@ -3907,14 +3907,14 @@ var ARRAY_FUNCTIONS = [
|
|
|
3907
3907
|
const cols = optInt(ctx, args, 1, 1);
|
|
3908
3908
|
const min = args.length > 2 && args[2] !== null ? num(ctx.toScalar(args[2] ?? null)) : 0;
|
|
3909
3909
|
const max = args.length > 3 && args[3] !== null ? num(ctx.toScalar(args[3] ?? null)) : 1;
|
|
3910
|
-
const
|
|
3910
|
+
const integer2 = args.length > 4 && args[4] !== null && toBool(ctx.toScalar(args[4] ?? null));
|
|
3911
3911
|
if (rows < 1 || cols < 1) return ERR.CALC;
|
|
3912
3912
|
if (min > max) fail(ERR.VALUE);
|
|
3913
3913
|
const random = () => ctx.frame.host.random();
|
|
3914
3914
|
return Matrix.build(
|
|
3915
3915
|
rows,
|
|
3916
3916
|
cols,
|
|
3917
|
-
() =>
|
|
3917
|
+
() => integer2 ? Math.ceil(min) + Math.floor(random() * (Math.floor(max) - Math.ceil(min) + 1)) : min + random() * (max - min)
|
|
3918
3918
|
);
|
|
3919
3919
|
},
|
|
3920
3920
|
["any"],
|
|
@@ -3969,8 +3969,8 @@ function modes(values2) {
|
|
|
3969
3969
|
function kth(values2, k, largest) {
|
|
3970
3970
|
const n2 = values2.length;
|
|
3971
3971
|
if (n2 === 0 || !(k >= 1) || k > n2) fail(ERR.NUM);
|
|
3972
|
-
const
|
|
3973
|
-
return sorted(values2)[
|
|
3972
|
+
const index3 = Math.floor(largest ? n2 + 1 - k : k) - 1;
|
|
3973
|
+
return sorted(values2)[index3];
|
|
3974
3974
|
}
|
|
3975
3975
|
function extreme(values2, max) {
|
|
3976
3976
|
if (values2.length === 0) return 0;
|
|
@@ -4110,13 +4110,13 @@ function fieldIndex(table2, field) {
|
|
|
4110
4110
|
const value2 = scalar(field);
|
|
4111
4111
|
if (isError(value2)) fail(value2);
|
|
4112
4112
|
if (typeof value2 === "number") {
|
|
4113
|
-
const
|
|
4114
|
-
if (
|
|
4115
|
-
return
|
|
4113
|
+
const index4 = Math.trunc(value2) - 1;
|
|
4114
|
+
if (index4 < 0 || index4 >= table2.headers.length) fail(ERR.VALUE);
|
|
4115
|
+
return index4;
|
|
4116
4116
|
}
|
|
4117
|
-
const
|
|
4118
|
-
if (
|
|
4119
|
-
return
|
|
4117
|
+
const index3 = table2.headers.indexOf(label(value2).toLowerCase());
|
|
4118
|
+
if (index3 < 0) fail(ERR.VALUE);
|
|
4119
|
+
return index3;
|
|
4120
4120
|
}
|
|
4121
4121
|
function recordFilter(table2, criteria) {
|
|
4122
4122
|
const [head, ...rows] = criteria;
|
|
@@ -5402,8 +5402,8 @@ function cumulative(args, principal) {
|
|
|
5402
5402
|
|
|
5403
5403
|
// xlsx/formula/functions/bonds.ts
|
|
5404
5404
|
var C9 = "Financial";
|
|
5405
|
-
var basisOf = (args,
|
|
5406
|
-
const basis = args.length >
|
|
5405
|
+
var basisOf = (args, index3) => {
|
|
5406
|
+
const basis = args.length > index3 && args[index3] !== null ? int(args[index3]) : 0;
|
|
5407
5407
|
if (basis < 0 || basis > 4) fail(ERR.NUM);
|
|
5408
5408
|
return basis;
|
|
5409
5409
|
};
|
|
@@ -5585,9 +5585,9 @@ var AMORLINC = {
|
|
|
5585
5585
|
}
|
|
5586
5586
|
const fraction = purchase === firstPeriod ? 1 : basis === 1 ? (firstPeriod - purchase) / (isLeapYear(serialToYmd(purchase, ctx.date1904).year) ? 366 : 365) : yearFrac(purchase, firstPeriod, basis, ctx);
|
|
5587
5587
|
const first2 = Math.min(cost - salvage, annual * fraction);
|
|
5588
|
-
const
|
|
5589
|
-
if (
|
|
5590
|
-
return Math.max(0, Math.min(annual, cost - salvage - first2 - (
|
|
5588
|
+
const index3 = Math.trunc(period);
|
|
5589
|
+
if (index3 === 0) return first2;
|
|
5590
|
+
return Math.max(0, Math.min(annual, cost - salvage - first2 - (index3 - 1) * annual));
|
|
5591
5591
|
}
|
|
5592
5592
|
),
|
|
5593
5593
|
missingRequiredError: "#N/A"
|
|
@@ -5814,8 +5814,8 @@ var DEPRECIATION_FUNCTIONS = [
|
|
|
5814
5814
|
|
|
5815
5815
|
// xlsx/formula/functions/securities.ts
|
|
5816
5816
|
var C11 = "Financial";
|
|
5817
|
-
var basisOf2 = (args,
|
|
5818
|
-
const basis = args.length >
|
|
5817
|
+
var basisOf2 = (args, index3) => {
|
|
5818
|
+
const basis = args.length > index3 && args[index3] !== null ? int(args[index3]) : 0;
|
|
5819
5819
|
if (basis < 0 || basis > 4) fail(ERR.NUM);
|
|
5820
5820
|
return basis;
|
|
5821
5821
|
};
|
|
@@ -6181,8 +6181,8 @@ function resolveStructured(ref, frame) {
|
|
|
6181
6181
|
const totalsRow = table2.totalsRow ? range.end.row : -1;
|
|
6182
6182
|
const columnOf = (name) => {
|
|
6183
6183
|
const lower2 = name.toLowerCase();
|
|
6184
|
-
const
|
|
6185
|
-
return
|
|
6184
|
+
const index3 = table2.columns.findIndex((c3) => c3.name.toLowerCase() === lower2);
|
|
6185
|
+
return index3 < 0 ? -1 : range.start.col + index3;
|
|
6186
6186
|
};
|
|
6187
6187
|
let c1 = range.start.col;
|
|
6188
6188
|
let c2 = range.end.col;
|
|
@@ -6427,8 +6427,8 @@ var INFO_FUNCTIONS = [
|
|
|
6427
6427
|
const v = args[0];
|
|
6428
6428
|
if (v === void 0) return ctx.sheet + 1;
|
|
6429
6429
|
if (v instanceof RefValue) return (v.areas[0]?.sheet ?? ctx.sheet) + 1;
|
|
6430
|
-
const
|
|
6431
|
-
return
|
|
6430
|
+
const index3 = sheetIndex(ctx.frame.host, str(v));
|
|
6431
|
+
return index3 < 0 ? ERR.NA : index3 + 1;
|
|
6432
6432
|
},
|
|
6433
6433
|
["any"]
|
|
6434
6434
|
),
|
|
@@ -6986,14 +6986,14 @@ function shape(value2) {
|
|
|
6986
6986
|
if (value2 instanceof Matrix) return { rows: value2.rows, cols: value2.cols };
|
|
6987
6987
|
return { rows: 1, cols: 1 };
|
|
6988
6988
|
}
|
|
6989
|
-
function line(ctx, value2, axis,
|
|
6989
|
+
function line(ctx, value2, axis, index3) {
|
|
6990
6990
|
if (value2 instanceof RefValue) {
|
|
6991
6991
|
const area = value2.areas[0];
|
|
6992
6992
|
if (!area || value2.areas.length !== 1) fail(ERR.VALUE);
|
|
6993
6993
|
const { start, end } = area.range;
|
|
6994
6994
|
const bounds = ctx.frame.host.bounds(area.sheet);
|
|
6995
6995
|
if (axis === "col") {
|
|
6996
|
-
const col = start.col +
|
|
6996
|
+
const col = start.col + index3;
|
|
6997
6997
|
const length2 = Math.max(0, Math.min(end.row, bounds.rows - 1) - start.row + 1);
|
|
6998
6998
|
return {
|
|
6999
6999
|
length: length2,
|
|
@@ -7001,7 +7001,7 @@ function line(ctx, value2, axis, index2) {
|
|
|
7001
7001
|
get: (i2) => ctx.readCell(area.sheet, start.row + i2, col)
|
|
7002
7002
|
};
|
|
7003
7003
|
}
|
|
7004
|
-
const row2 = start.row +
|
|
7004
|
+
const row2 = start.row + index3;
|
|
7005
7005
|
const length = Math.max(0, Math.min(end.col, bounds.cols - 1) - start.col + 1);
|
|
7006
7006
|
return {
|
|
7007
7007
|
length,
|
|
@@ -7010,8 +7010,8 @@ function line(ctx, value2, axis, index2) {
|
|
|
7010
7010
|
};
|
|
7011
7011
|
}
|
|
7012
7012
|
const m = value2 instanceof Matrix ? value2 : new Matrix([[value2]]);
|
|
7013
|
-
if (axis === "col") return { length: m.rows, get: (i2) => m.get(i2,
|
|
7014
|
-
return { length: m.cols, get: (i2) => m.get(
|
|
7013
|
+
if (axis === "col") return { length: m.rows, get: (i2) => m.get(i2, index3) };
|
|
7014
|
+
return { length: m.cols, get: (i2) => m.get(index3, i2) };
|
|
7015
7015
|
}
|
|
7016
7016
|
function vectorOf(ctx, value2) {
|
|
7017
7017
|
const { rows, cols } = shape(value2);
|
|
@@ -7405,24 +7405,24 @@ function cellOf(value2, row2, col) {
|
|
|
7405
7405
|
if (value2 instanceof Matrix) return value2.get(row2, col);
|
|
7406
7406
|
return value2;
|
|
7407
7407
|
}
|
|
7408
|
-
function sliceOf(value2, axis,
|
|
7408
|
+
function sliceOf(value2, axis, index3) {
|
|
7409
7409
|
const { rows } = shape(value2);
|
|
7410
7410
|
if (value2 instanceof RefValue) {
|
|
7411
7411
|
const area = value2.areas[0];
|
|
7412
7412
|
if (!area) fail(ERR.REF);
|
|
7413
7413
|
const { start, end } = area.range;
|
|
7414
7414
|
const range = axis === "row" ? {
|
|
7415
|
-
start: { row: start.row +
|
|
7416
|
-
end: { row: start.row +
|
|
7415
|
+
start: { row: start.row + index3, col: start.col },
|
|
7416
|
+
end: { row: start.row + index3, col: end.col }
|
|
7417
7417
|
} : {
|
|
7418
|
-
start: { row: start.row, col: start.col +
|
|
7419
|
-
end: { row: end.row, col: start.col +
|
|
7418
|
+
start: { row: start.row, col: start.col + index3 },
|
|
7419
|
+
end: { row: end.row, col: start.col + index3 }
|
|
7420
7420
|
};
|
|
7421
7421
|
return new RefValue([{ sheet: area.sheet, range }]);
|
|
7422
7422
|
}
|
|
7423
7423
|
const m = value2 instanceof Matrix ? value2 : new Matrix([[value2]]);
|
|
7424
|
-
if (axis === "row") return new Matrix([m.data[
|
|
7425
|
-
return new Matrix(Array.from({ length: rows }, (_, r) => [m.get(r,
|
|
7424
|
+
if (axis === "row") return new Matrix([m.data[index3] ?? []]);
|
|
7425
|
+
return new Matrix(Array.from({ length: rows }, (_, r) => [m.get(r, index3)]));
|
|
7426
7426
|
}
|
|
7427
7427
|
function lookupValue(args) {
|
|
7428
7428
|
const v = scalar(args[0]);
|
|
@@ -7438,15 +7438,15 @@ function lookupArray(value2) {
|
|
|
7438
7438
|
function vhlookup(args, ctx, vertical) {
|
|
7439
7439
|
const lookup2 = blankAsZero(args);
|
|
7440
7440
|
const table2 = lookupArray(args[1] ?? null);
|
|
7441
|
-
const
|
|
7441
|
+
const index3 = int(args[2]);
|
|
7442
7442
|
const approximate2 = args.length < 4 ? true : bool(args[3]);
|
|
7443
7443
|
const { rows, cols } = shape(table2);
|
|
7444
|
-
if (
|
|
7445
|
-
if (
|
|
7444
|
+
if (index3 < 1) fail(ERR.VALUE);
|
|
7445
|
+
if (index3 > (vertical ? cols : rows)) fail(ERR.REF);
|
|
7446
7446
|
const keys = line(ctx, table2, vertical ? "col" : "row", 0);
|
|
7447
7447
|
const at = approximate2 ? findAscending(keys, lookup2) : findExact(keys, lookup2, true);
|
|
7448
7448
|
if (at < 0) fail(ERR.NA);
|
|
7449
|
-
return vertical ? cellOf(table2, at,
|
|
7449
|
+
return vertical ? cellOf(table2, at, index3 - 1) : cellOf(table2, index3 - 1, at);
|
|
7450
7450
|
}
|
|
7451
7451
|
function match(args, ctx) {
|
|
7452
7452
|
const lookup2 = blankAsZero(args);
|
|
@@ -7645,27 +7645,27 @@ function valueKeys(value2, out) {
|
|
|
7645
7645
|
}
|
|
7646
7646
|
}
|
|
7647
7647
|
function positionsOf(block, key) {
|
|
7648
|
-
let
|
|
7649
|
-
if (!
|
|
7648
|
+
let index3 = indexes.get(block);
|
|
7649
|
+
if (!index3) {
|
|
7650
7650
|
const count2 = (uses.get(block) ?? 0) + 1;
|
|
7651
7651
|
uses.set(block, count2);
|
|
7652
7652
|
if (count2 < 2 || block.isPadded) return void 0;
|
|
7653
|
-
|
|
7653
|
+
index3 = /* @__PURE__ */ new Map();
|
|
7654
7654
|
const keys = [];
|
|
7655
7655
|
const cols = block.cols;
|
|
7656
7656
|
for (let r = 0; r < block.rows; r++) {
|
|
7657
7657
|
for (let c2 = 0; c2 < cols; c2++) {
|
|
7658
7658
|
valueKeys(block.get(r, c2), keys);
|
|
7659
7659
|
for (const k of keys) {
|
|
7660
|
-
const list =
|
|
7660
|
+
const list = index3.get(k);
|
|
7661
7661
|
if (list) list.push(r * cols + c2);
|
|
7662
|
-
else
|
|
7662
|
+
else index3.set(k, [r * cols + c2]);
|
|
7663
7663
|
}
|
|
7664
7664
|
}
|
|
7665
7665
|
}
|
|
7666
|
-
indexes.set(block,
|
|
7666
|
+
indexes.set(block, index3);
|
|
7667
7667
|
}
|
|
7668
|
-
return
|
|
7668
|
+
return index3.get(key) ?? [];
|
|
7669
7669
|
}
|
|
7670
7670
|
|
|
7671
7671
|
// xlsx/formula/functions/criteria.ts
|
|
@@ -8882,7 +8882,7 @@ function layout(ctx, args) {
|
|
|
8882
8882
|
}
|
|
8883
8883
|
return { y, x, column };
|
|
8884
8884
|
}
|
|
8885
|
-
var withConst = (args,
|
|
8885
|
+
var withConst = (args, index3) => omitted(args, index3) ? true : bool(args[index3]);
|
|
8886
8886
|
var row = (values2, width) => [
|
|
8887
8887
|
...values2,
|
|
8888
8888
|
...new Array(Math.max(0, width - values2.length)).fill(ERR.NA)
|
|
@@ -11196,7 +11196,7 @@ function compile(pattern, caseMode2, global) {
|
|
|
11196
11196
|
return fail(ERR.VALUE);
|
|
11197
11197
|
}
|
|
11198
11198
|
}
|
|
11199
|
-
var caseMode = (args,
|
|
11199
|
+
var caseMode = (args, index3) => optNum(args, index3, 0);
|
|
11200
11200
|
function encodeUrl(text3) {
|
|
11201
11201
|
return encodeURIComponent(text3).replace(
|
|
11202
11202
|
/[!'()*]/g,
|
|
@@ -11315,9 +11315,9 @@ function textAround(args, ctx, before) {
|
|
|
11315
11315
|
if (instance > 0) found.push({ at: text3.length, length: 0 });
|
|
11316
11316
|
else found.unshift({ at: 0, length: 0 });
|
|
11317
11317
|
}
|
|
11318
|
-
const
|
|
11319
|
-
const hit = found[
|
|
11320
|
-
if (!hit ||
|
|
11318
|
+
const index3 = instance > 0 ? instance - 1 : found.length + instance;
|
|
11319
|
+
const hit = found[index3];
|
|
11320
|
+
if (!hit || index3 < 0) return notFound;
|
|
11321
11321
|
return before ? text3.slice(0, hit.at) : text3.slice(hit.at + hit.length);
|
|
11322
11322
|
}
|
|
11323
11323
|
function splitText(text3, delimiters, insensitive, ignoreEmpty) {
|
|
@@ -11433,10 +11433,10 @@ var FUNCTION_CATALOG = Object.freeze(
|
|
|
11433
11433
|
);
|
|
11434
11434
|
|
|
11435
11435
|
// xlsx/formula/functions/types.ts
|
|
11436
|
-
var paramKind = (spec2,
|
|
11436
|
+
var paramKind = (spec2, index3) => {
|
|
11437
11437
|
const params = spec2.params;
|
|
11438
11438
|
if (!params || params.length === 0) return "value";
|
|
11439
|
-
return params[Math.min(
|
|
11439
|
+
return params[Math.min(index3, params.length - 1)] ?? "value";
|
|
11440
11440
|
};
|
|
11441
11441
|
|
|
11442
11442
|
// xlsx/formula/call.ts
|
|
@@ -12372,16 +12372,16 @@ var EngineHost = class {
|
|
|
12372
12372
|
}
|
|
12373
12373
|
/** Formulas by the area their spill or CSE array covers (spatial lookup for every read). */
|
|
12374
12374
|
footprintsBy() {
|
|
12375
|
-
let
|
|
12376
|
-
if (!
|
|
12377
|
-
|
|
12375
|
+
let index3 = this.footprintIndex;
|
|
12376
|
+
if (!index3) {
|
|
12377
|
+
index3 = new AreaIndex();
|
|
12378
12378
|
for (const node of this.footprints) {
|
|
12379
12379
|
const fp = node.spill ?? node.blockedSpill ?? node.arrayRange;
|
|
12380
|
-
if (fp)
|
|
12380
|
+
if (fp) index3.add({ sheet: node.sheet, range: fp }, node);
|
|
12381
12381
|
}
|
|
12382
|
-
this.footprintIndex =
|
|
12382
|
+
this.footprintIndex = index3;
|
|
12383
12383
|
}
|
|
12384
|
-
return
|
|
12384
|
+
return index3;
|
|
12385
12385
|
}
|
|
12386
12386
|
allNodes() {
|
|
12387
12387
|
const out = [];
|
|
@@ -12398,17 +12398,17 @@ var EngineHost = class {
|
|
|
12398
12398
|
|
|
12399
12399
|
// xlsx/formula/scc.ts
|
|
12400
12400
|
function stronglyConnected(nodes, successors) {
|
|
12401
|
-
const
|
|
12401
|
+
const index3 = /* @__PURE__ */ new Map();
|
|
12402
12402
|
const low = /* @__PURE__ */ new Map();
|
|
12403
12403
|
const onStack = /* @__PURE__ */ new Set();
|
|
12404
12404
|
const stack2 = [];
|
|
12405
12405
|
const out = [];
|
|
12406
12406
|
let counter = 0;
|
|
12407
12407
|
for (const root of nodes) {
|
|
12408
|
-
if (
|
|
12408
|
+
if (index3.has(root)) continue;
|
|
12409
12409
|
const work = [];
|
|
12410
12410
|
const open = (node) => {
|
|
12411
|
-
|
|
12411
|
+
index3.set(node, counter);
|
|
12412
12412
|
low.set(node, counter);
|
|
12413
12413
|
counter++;
|
|
12414
12414
|
stack2.push(node);
|
|
@@ -12420,9 +12420,9 @@ function stronglyConnected(nodes, successors) {
|
|
|
12420
12420
|
const frame = work[work.length - 1];
|
|
12421
12421
|
if (frame.i < frame.succ.length) {
|
|
12422
12422
|
const next = frame.succ[frame.i++];
|
|
12423
|
-
if (!
|
|
12423
|
+
if (!index3.has(next)) open(next);
|
|
12424
12424
|
else if (onStack.has(next)) {
|
|
12425
|
-
low.set(frame.node, Math.min(low.get(frame.node),
|
|
12425
|
+
low.set(frame.node, Math.min(low.get(frame.node), index3.get(next)));
|
|
12426
12426
|
}
|
|
12427
12427
|
continue;
|
|
12428
12428
|
}
|
|
@@ -12433,7 +12433,7 @@ function stronglyConnected(nodes, successors) {
|
|
|
12433
12433
|
parent.node,
|
|
12434
12434
|
Math.min(low.get(parent.node), low.get(frame.node))
|
|
12435
12435
|
);
|
|
12436
|
-
if (low.get(frame.node) ===
|
|
12436
|
+
if (low.get(frame.node) === index3.get(frame.node)) {
|
|
12437
12437
|
const component = [];
|
|
12438
12438
|
let member;
|
|
12439
12439
|
do {
|
|
@@ -13639,9 +13639,9 @@ function renameTableColumnInFormula(formula, tableName, oldName, newName, inside
|
|
|
13639
13639
|
if (!tokens2) return formula;
|
|
13640
13640
|
const escaped = newName.replace(/['#@[\]]/g, "'$&");
|
|
13641
13641
|
let changed = false;
|
|
13642
|
-
for (const [
|
|
13642
|
+
for (const [index3, token] of tokens2.entries()) {
|
|
13643
13643
|
if (token.kind !== "structured" || token.prefix) continue;
|
|
13644
|
-
if (token.value === "" && tokens2[
|
|
13644
|
+
if (token.value === "" && tokens2[index3 - 1]?.prefix) continue;
|
|
13645
13645
|
if (token.value === "" ? !insideTable : String(token.value).toLowerCase() !== tableName.toLowerCase())
|
|
13646
13646
|
continue;
|
|
13647
13647
|
const next = token.text.replace(
|
|
@@ -13665,13 +13665,13 @@ var abs = (row2, col, rowAbs = true) => `$${columnLabel(col)}${rowAbs ? "$" : ""
|
|
|
13665
13665
|
function a1For(ref, t) {
|
|
13666
13666
|
const { table: table2 } = t;
|
|
13667
13667
|
const { start, end } = table2.range;
|
|
13668
|
-
const
|
|
13668
|
+
const index3 = (name) => {
|
|
13669
13669
|
if (name === void 0) return void 0;
|
|
13670
13670
|
const i2 = table2.columns.findIndex((c3) => c3.name.toLowerCase() === name.toLowerCase());
|
|
13671
13671
|
return i2 < 0 ? -1 : start.col + i2;
|
|
13672
13672
|
};
|
|
13673
|
-
const c1 =
|
|
13674
|
-
const c2 =
|
|
13673
|
+
const c1 = index3(ref.column);
|
|
13674
|
+
const c2 = index3(ref.column2) ?? c1;
|
|
13675
13675
|
if (c1 === -1 || c2 === -1) return "#REF!";
|
|
13676
13676
|
const colLo = c1 ?? start.col;
|
|
13677
13677
|
const colHi = c2 ?? end.col;
|
|
@@ -13823,17 +13823,17 @@ function coloredReferences(text3) {
|
|
|
13823
13823
|
const seen = /* @__PURE__ */ new Map();
|
|
13824
13824
|
return referenceSpans(text3.slice(1), "").map((span3) => {
|
|
13825
13825
|
const key = span3.text.replace(/\$/g, "").toUpperCase();
|
|
13826
|
-
let
|
|
13827
|
-
if (
|
|
13828
|
-
|
|
13829
|
-
seen.set(key,
|
|
13826
|
+
let index3 = seen.get(key);
|
|
13827
|
+
if (index3 === void 0) {
|
|
13828
|
+
index3 = seen.size;
|
|
13829
|
+
seen.set(key, index3);
|
|
13830
13830
|
}
|
|
13831
13831
|
return {
|
|
13832
13832
|
start: span3.start + 1,
|
|
13833
13833
|
end: span3.end + 1,
|
|
13834
13834
|
text: span3.text,
|
|
13835
|
-
index:
|
|
13836
|
-
color: REFERENCE_COLORS[
|
|
13835
|
+
index: index3,
|
|
13836
|
+
color: REFERENCE_COLORS[index3 % REFERENCE_COLORS.length] ?? REFERENCE_COLORS[0]
|
|
13837
13837
|
};
|
|
13838
13838
|
});
|
|
13839
13839
|
}
|
|
@@ -14491,7 +14491,7 @@ var PartPatch = class {
|
|
|
14491
14491
|
const { root, children: children2 } = scan3(xml);
|
|
14492
14492
|
const kids2 = elements(rootElement);
|
|
14493
14493
|
if (kids2.length !== children2.length) throw new Error("Property part markup is not supported");
|
|
14494
|
-
kids2.forEach((kid,
|
|
14494
|
+
kids2.forEach((kid, index3) => this.spans.set(kid, children2[index3]));
|
|
14495
14495
|
this.root = root;
|
|
14496
14496
|
for (const attribute2 of Array.from(rootElement.attributes)) {
|
|
14497
14497
|
if (attribute2.name === "xmlns") this.defaultNs = attribute2.value;
|
|
@@ -14741,7 +14741,7 @@ function writeAppProperties(props, sourceXml) {
|
|
|
14741
14741
|
const patch3 = new PartPatch(xml, root);
|
|
14742
14742
|
const prior = readKnown(root, ns);
|
|
14743
14743
|
const ownPrefix = root.prefix ? `${root.prefix}:` : "";
|
|
14744
|
-
FIELDS2.forEach(([field, local, kind],
|
|
14744
|
+
FIELDS2.forEach(([field, local, kind], index3) => {
|
|
14745
14745
|
const value2 = props[field];
|
|
14746
14746
|
const existing = first(root, local, ns.app);
|
|
14747
14747
|
if (value2 === void 0 || kind === "text" && value2 === "") {
|
|
@@ -14755,7 +14755,7 @@ function writeAppProperties(props, sourceXml) {
|
|
|
14755
14755
|
patch3.setContent(existing, body);
|
|
14756
14756
|
return;
|
|
14757
14757
|
}
|
|
14758
|
-
const next = FIELDS2.slice(
|
|
14758
|
+
const next = FIELDS2.slice(index3 + 1).map(([, name]) => first(root, name, ns.app)).find((node) => node !== void 0);
|
|
14759
14759
|
patch3.insert(`<${ownPrefix}${local}>${body}</${ownPrefix}${local}>`, next);
|
|
14760
14760
|
});
|
|
14761
14761
|
return patch3.toString();
|
|
@@ -14850,9 +14850,9 @@ function writeCustomProperties(properties2) {
|
|
|
14850
14850
|
});
|
|
14851
14851
|
if (!unique2.length) return void 0;
|
|
14852
14852
|
const pids = allocateCustomPropertyIds(unique2);
|
|
14853
|
-
const body = unique2.map((property,
|
|
14853
|
+
const body = unique2.map((property, index3) => {
|
|
14854
14854
|
const link = property.linkTarget ? ` linkTarget="${escape(property.linkTarget, true)}"` : "";
|
|
14855
|
-
return `<property fmtid="${CUSTOM_PROPERTIES_FMTID}" pid="${pids[
|
|
14855
|
+
return `<property fmtid="${CUSTOM_PROPERTIES_FMTID}" pid="${pids[index3] ?? index3 + 2}" name="${escape(property.name, true)}"${link}>${variantXml(property)}</property>`;
|
|
14856
14856
|
}).join("");
|
|
14857
14857
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
14858
14858
|
<Properties xmlns="${NS.customProperties}" xmlns:vt="${NS.vt}">${body}</Properties>`;
|
|
@@ -14947,9 +14947,9 @@ function sparklineDataRange(workbook, sheet, source2) {
|
|
|
14947
14947
|
}
|
|
14948
14948
|
if (ast.type !== "ref" || !ast.ref || !["cell", "area"].includes(ast.ref.kind) || ast.prefix?.book || ast.prefix?.sheet2 || ast.spill)
|
|
14949
14949
|
throw new Error("The reference is not valid.");
|
|
14950
|
-
const
|
|
14951
|
-
if (!workbook.sheets[
|
|
14952
|
-
return { sheet:
|
|
14950
|
+
const index3 = ast.prefix ? workbook.sheets.findIndex((ws) => ws.name.toLowerCase() === ast.prefix.sheet.toLowerCase()) : sheet;
|
|
14951
|
+
if (!workbook.sheets[index3]) throw new Error("The reference is not valid.");
|
|
14952
|
+
return { sheet: index3, range: checkedSparklineRange({ start: ast.ref.start, end: ast.ref.end }) };
|
|
14953
14953
|
}
|
|
14954
14954
|
function newSparklines(workbook, sheet, source2, locations) {
|
|
14955
14955
|
const data = sparklineDataRange(workbook, sheet, source2);
|
|
@@ -14976,6 +14976,99 @@ function newSparklines(workbook, sheet, source2, locations) {
|
|
|
14976
14976
|
return out;
|
|
14977
14977
|
}
|
|
14978
14978
|
|
|
14979
|
+
// xlsx/pivot/page-filter.ts
|
|
14980
|
+
function validatePivotPageFilter(pivot) {
|
|
14981
|
+
const filter2 = pivot.pageFilter;
|
|
14982
|
+
const extras = Array.isArray(pivot.additionalValues) ? pivot.additionalValues : [];
|
|
14983
|
+
if (filter2 === void 0) return;
|
|
14984
|
+
if (!filter2 || typeof filter2 !== "object" || Array.isArray(filter2) || Object.keys(filter2).some((key) => key !== "field" && key !== "item") || typeof filter2.field !== "string" || !pivot.fields.includes(filter2.field) || [
|
|
14985
|
+
pivot.rowField,
|
|
14986
|
+
pivot.secondRowField,
|
|
14987
|
+
pivot.columnField,
|
|
14988
|
+
pivot.valueField,
|
|
14989
|
+
...extras.map((v) => v?.field)
|
|
14990
|
+
].includes(filter2.field) || pivot.valuesAxis === "rows")
|
|
14991
|
+
throw new Error("Report filters require Values on columns and a separate source field.");
|
|
14992
|
+
if (filter2.item !== void 0 && !(filter2.item === null || typeof filter2.item === "string" || typeof filter2.item === "boolean" || typeof filter2.item === "number" && Number.isFinite(filter2.item) || isCellError(filter2.item) && isErrorCode(filter2.item.error) && Object.keys(filter2.item).length === 1))
|
|
14993
|
+
throw new Error("Choose a cached literal report filter item.");
|
|
14994
|
+
}
|
|
14995
|
+
function pivotPageProjection(pivot) {
|
|
14996
|
+
const filter2 = pivot.pageFilter;
|
|
14997
|
+
if (!filter2) return pivot;
|
|
14998
|
+
const labels = /* @__PURE__ */ new Map();
|
|
14999
|
+
for (const item of pivotItems(pivot, filter2.field)) {
|
|
15000
|
+
const label3 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
|
|
15001
|
+
if (label3 === "(all)" || labels.has(label3) && labels.get(label3) !== key2)
|
|
15002
|
+
throw new Error("Ambiguous report filter item captions are preserved.");
|
|
15003
|
+
labels.set(label3, key2);
|
|
15004
|
+
}
|
|
15005
|
+
if (filter2.item === void 0) return pivot;
|
|
15006
|
+
const index3 = pivot.fields.indexOf(filter2.field), key = pivotValueKey(filter2.item);
|
|
15007
|
+
const records = pivot.records.filter((record) => pivotValueKey(record[index3] ?? null) === key);
|
|
15008
|
+
if (!records.length) throw new Error("The report filter item is missing from the source.");
|
|
15009
|
+
if (JSON.stringify(records[0][index3] ?? null) !== JSON.stringify(filter2.item))
|
|
15010
|
+
throw new Error("Choose an exact cached literal report filter item.");
|
|
15011
|
+
return { ...pivot, records };
|
|
15012
|
+
}
|
|
15013
|
+
function prependPivotPage(grid, pivot) {
|
|
15014
|
+
if (!pivot.pageFilter) return grid;
|
|
15015
|
+
const width = grid.values[0].length;
|
|
15016
|
+
return {
|
|
15017
|
+
...grid,
|
|
15018
|
+
values: [
|
|
15019
|
+
[
|
|
15020
|
+
pivot.pageFilter.field,
|
|
15021
|
+
pivot.pageFilter.item === void 0 ? "(All)" : pivotItemLabel(pivot.pageFilter.item),
|
|
15022
|
+
...Array(width - 2).fill(null)
|
|
15023
|
+
],
|
|
15024
|
+
Array(width).fill(null),
|
|
15025
|
+
...grid.values
|
|
15026
|
+
],
|
|
15027
|
+
firstDataRow: grid.firstDataRow + 2,
|
|
15028
|
+
...grid.firstHeaderRow !== void 0 ? { firstHeaderRow: grid.firstHeaderRow + 2 } : {},
|
|
15029
|
+
...grid.indents ? { indents: [0, 0, ...grid.indents] } : {}
|
|
15030
|
+
};
|
|
15031
|
+
}
|
|
15032
|
+
var index2 = (raw2) => raw2 !== null && /^\d+$/.test(raw2.trim()) && Number.isSafeInteger(Number(raw2)) ? Number(raw2) : NaN;
|
|
15033
|
+
function readPivotPageFilter(root, fields, shared) {
|
|
15034
|
+
const list = first(root, "pageFields", NS.x), location = first(root, "location", NS.x);
|
|
15035
|
+
const definitions = children(first(root, "pivotFields", NS.x), "pivotField", NS.x);
|
|
15036
|
+
if (!list) {
|
|
15037
|
+
if (definitions.some((n2) => n2.getAttribute("axis") === "axisPage") || location?.hasAttribute("rowPageCount") || location?.hasAttribute("colPageCount"))
|
|
15038
|
+
throw new Error("Unmodeled report filter metadata");
|
|
15039
|
+
return;
|
|
15040
|
+
}
|
|
15041
|
+
if (root.getAttribute("multipleFieldFilters") === "1")
|
|
15042
|
+
throw new Error("Multiple report filters are preserved");
|
|
15043
|
+
const pages = children(list, "pageField", NS.x);
|
|
15044
|
+
if (pages.length !== 1 || list.getAttribute("count") !== "1" || location?.getAttribute("rowPageCount") !== "1" || location.getAttribute("colPageCount") !== "1")
|
|
15045
|
+
throw new Error("Only one report filter is modeled");
|
|
15046
|
+
const page = pages[0], field = index2(page.getAttribute("fld"));
|
|
15047
|
+
if (page.getAttribute("hier") !== "-1" || !fields[field] || definitions[field]?.getAttribute("axis") !== "axisPage" || definitions.filter((n2) => n2.getAttribute("axis") === "axisPage").length !== 1)
|
|
15048
|
+
throw new Error("Unsupported report field");
|
|
15049
|
+
const container = first(definitions[field], "items", NS.x);
|
|
15050
|
+
const items = children(container, "item", NS.x);
|
|
15051
|
+
if (!container || index2(container.getAttribute("count")) !== items.length || items.filter((n2) => n2.getAttribute("t") === "default").length !== 1 || items.at(-1)?.getAttribute("t") !== "default" || items.at(-1)?.hasAttribute("x"))
|
|
15052
|
+
throw new Error("Unsupported report field items");
|
|
15053
|
+
const data = items.slice(0, -1).map((item2) => {
|
|
15054
|
+
const i2 = index2(item2.getAttribute("x"));
|
|
15055
|
+
if (item2.hasAttribute("t") || !Number.isInteger(i2) || i2 >= shared[field].length)
|
|
15056
|
+
throw new Error("Invalid report cache item");
|
|
15057
|
+
return i2;
|
|
15058
|
+
});
|
|
15059
|
+
if (new Set(data).size !== data.length || data.length !== shared[field].length)
|
|
15060
|
+
throw new Error("Incomplete report cache items");
|
|
15061
|
+
const item = page.getAttribute("item");
|
|
15062
|
+
if (item === null) return { field: fields[field] };
|
|
15063
|
+
const selected2 = index2(item);
|
|
15064
|
+
if (!Number.isInteger(selected2) || selected2 >= data.length)
|
|
15065
|
+
throw new Error("Invalid report item selection");
|
|
15066
|
+
return { field: fields[field], item: shared[field][data[selected2]] };
|
|
15067
|
+
}
|
|
15068
|
+
function pivotPageItems(pivot, field) {
|
|
15069
|
+
return pivotItems(pivot, field);
|
|
15070
|
+
}
|
|
15071
|
+
|
|
14979
15072
|
// xlsx/pivot/data.ts
|
|
14980
15073
|
var PIVOT_AGGREGATES = ["sum", "count", "average", "min", "max"];
|
|
14981
15074
|
function pivotSourceData(workbook, sheet, source2) {
|
|
@@ -15006,10 +15099,10 @@ function pivotValueKey(value2) {
|
|
|
15006
15099
|
return value2 === null || value2 === "" ? "blank" : isCellError(value2) ? `error:${value2.error}` : `${typeof value2}:${String(value2).toLowerCase()}`;
|
|
15007
15100
|
}
|
|
15008
15101
|
function pivotItems(pivot, field) {
|
|
15009
|
-
const
|
|
15102
|
+
const index3 = pivot.fields.indexOf(field);
|
|
15010
15103
|
const items = /* @__PURE__ */ new Map();
|
|
15011
15104
|
for (const record of pivot.records) {
|
|
15012
|
-
const value2 = record[
|
|
15105
|
+
const value2 = record[index3] ?? null;
|
|
15013
15106
|
const key = pivotValueKey(value2);
|
|
15014
15107
|
if (!items.has(key)) items.set(key, value2);
|
|
15015
15108
|
}
|
|
@@ -15027,12 +15120,32 @@ function pivotItemLabel(value2) {
|
|
|
15027
15120
|
return isCellError(value2) ? value2.error : value2;
|
|
15028
15121
|
}
|
|
15029
15122
|
function validatePivotFields(pivot) {
|
|
15123
|
+
validatePivotPageFilter(pivot);
|
|
15030
15124
|
const used = [
|
|
15031
15125
|
pivot.rowField,
|
|
15032
15126
|
...pivot.secondRowField ? [pivot.secondRowField] : [],
|
|
15033
15127
|
...pivot.columnField ? [pivot.columnField] : [],
|
|
15034
15128
|
pivot.valueField
|
|
15035
15129
|
];
|
|
15130
|
+
const extras = pivot.additionalValues ?? [];
|
|
15131
|
+
if (pivot.valuesAxis !== void 0 && !["columns", "rows"].includes(pivot.valuesAxis))
|
|
15132
|
+
throw new Error("Choose a valid Values axis.");
|
|
15133
|
+
if (pivot.valuesPosition !== void 0 && !["last", "between", "first"].includes(pivot.valuesPosition))
|
|
15134
|
+
throw new Error("Choose a valid Values position.");
|
|
15135
|
+
if ((pivot.valuesPosition === "between" || pivot.valuesPosition === "first") && (pivot.valuesAxis !== "rows" || !pivot.secondRowField))
|
|
15136
|
+
throw new Error("Values before or between fields require two row fields and Values on rows.");
|
|
15137
|
+
if (pivot.valuesAxis === "rows" && (!Array.isArray(extras) || !extras.length))
|
|
15138
|
+
throw new Error("Values on rows require multiple measures.");
|
|
15139
|
+
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== "Values")
|
|
15140
|
+
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
15141
|
+
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
15142
|
+
(measure) => !measure || !pivot.fields.includes(measure.field) || !PIVOT_AGGREGATES.includes(measure.aggregate) || typeof measure.caption !== "string" || !measure.caption.trim() || measure.caption.length > 255 || pivot.fields.some((field) => field.toLowerCase() === measure.caption.toLowerCase())
|
|
15143
|
+
) || new Set(
|
|
15144
|
+
[pivot.valueCaption, ...extras.map((measure) => measure.caption)].map(
|
|
15145
|
+
(caption) => caption?.toLowerCase()
|
|
15146
|
+
)
|
|
15147
|
+
).size !== extras.length + 1)
|
|
15148
|
+
throw new Error("Choose PivotTable value fields with valid aggregates and unique captions.");
|
|
15036
15149
|
if (pivot.layout !== void 0 && !["tabular", "compact", "outline"].includes(pivot.layout) || pivot.subtotalPosition !== void 0 && !["top", "bottom"].includes(pivot.subtotalPosition) || !PIVOT_AGGREGATES.includes(pivot.aggregate) || used.some((field) => !pivot.fields.includes(field)) || new Set([pivot.rowField, pivot.secondRowField, pivot.columnField].filter(Boolean)).size !== [pivot.rowField, pivot.secondRowField, pivot.columnField].filter(Boolean).length || pivot.subtotals !== void 0 && typeof pivot.subtotals !== "boolean" || pivot.repeatLabels !== void 0 && typeof pivot.repeatLabels !== "boolean")
|
|
15037
15150
|
throw new Error("Choose valid PivotTable fields; row and column fields must differ.");
|
|
15038
15151
|
}
|
|
@@ -15040,25 +15153,195 @@ function pivotCaption(aggregate3, field) {
|
|
|
15040
15153
|
return `${aggregate3[0].toUpperCase()}${aggregate3.slice(1)} of ${field}`;
|
|
15041
15154
|
}
|
|
15042
15155
|
|
|
15156
|
+
// xlsx/pivot/measures.ts
|
|
15157
|
+
var pivotMeasures = (pivot) => [
|
|
15158
|
+
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
15159
|
+
...pivot.additionalValues ?? []
|
|
15160
|
+
];
|
|
15161
|
+
function normalizedPivotMeasures(values2) {
|
|
15162
|
+
if (!Array.isArray(values2) || values2.length > 15)
|
|
15163
|
+
throw new Error("Choose between one and sixteen PivotTable value fields.");
|
|
15164
|
+
return values2.map((value2) => {
|
|
15165
|
+
if (!value2 || typeof value2.field !== "string")
|
|
15166
|
+
throw new Error("Choose valid PivotTable value fields.");
|
|
15167
|
+
const aggregate3 = value2.aggregate ?? "sum";
|
|
15168
|
+
if (!PIVOT_AGGREGATES.includes(aggregate3))
|
|
15169
|
+
throw new Error("Choose a valid PivotTable aggregate.");
|
|
15170
|
+
return {
|
|
15171
|
+
field: value2.field,
|
|
15172
|
+
aggregate: aggregate3,
|
|
15173
|
+
caption: value2.caption ?? `${aggregate3[0].toUpperCase()}${aggregate3.slice(1)} of ${value2.field}`
|
|
15174
|
+
};
|
|
15175
|
+
});
|
|
15176
|
+
}
|
|
15177
|
+
function aggregate2(records, field, type) {
|
|
15178
|
+
if (!records.length) return null;
|
|
15179
|
+
const values2 = records.map((record) => record[field] ?? null);
|
|
15180
|
+
if (type === "count") return values2.filter((value2) => value2 !== null && value2 !== "").length;
|
|
15181
|
+
const error = values2.find(isCellError);
|
|
15182
|
+
if (error) return error;
|
|
15183
|
+
const numbers3 = values2.filter((value2) => typeof value2 === "number");
|
|
15184
|
+
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
15185
|
+
if (type === "min") return numbers3.reduce((a2, b) => Math.min(a2, b));
|
|
15186
|
+
if (type === "max") return numbers3.reduce((a2, b) => Math.max(a2, b));
|
|
15187
|
+
const sum2 = numbers3.reduce((total2, value2) => total2 + value2, 0);
|
|
15188
|
+
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
15189
|
+
}
|
|
15190
|
+
var pivotMeasureNumber = (pivot, records, measure) => aggregate2(records, pivot.fields.indexOf(measure.field), measure.aggregate);
|
|
15191
|
+
var pivotNumbers = (pivot, records) => pivotMeasures(pivot).map((measure) => pivotMeasureNumber(pivot, records, measure));
|
|
15192
|
+
function pivotHeaderDimensions(pivot, columnItems, rowLabels) {
|
|
15193
|
+
const measures = 1 + (pivot.additionalValues?.length ?? 0);
|
|
15194
|
+
if (pivot.valuesAxis === "rows")
|
|
15195
|
+
return {
|
|
15196
|
+
rows: (pivot.columnField ? 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
15197
|
+
width: rowLabels + (pivot.columnField ? columnItems + 1 : 1)
|
|
15198
|
+
};
|
|
15199
|
+
return {
|
|
15200
|
+
rows: (pivot.columnField ? measures > 1 ? 3 : 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
15201
|
+
width: rowLabels + (pivot.columnField ? measures === 1 ? Math.max(1, columnItems) + 1 : (columnItems + 1) * measures : measures)
|
|
15202
|
+
};
|
|
15203
|
+
}
|
|
15204
|
+
function pivotHeaders(pivot, columns, labels, label3) {
|
|
15205
|
+
const measures = pivotMeasures(pivot);
|
|
15206
|
+
if (pivot.valuesAxis === "rows") {
|
|
15207
|
+
const rowLabels = pivot.layout === "compact" ? ["Row Labels"] : pivot.valuesPosition === "first" ? ["Values", ...labels] : pivot.valuesPosition === "between" ? [labels[0], "Values", labels[1]] : [...labels, "Values"];
|
|
15208
|
+
return pivot.columnField ? [
|
|
15209
|
+
[
|
|
15210
|
+
...rowLabels.map(() => null),
|
|
15211
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
15212
|
+
...columns.map(() => null)
|
|
15213
|
+
],
|
|
15214
|
+
[...rowLabels, ...columns.map(label3), "Grand Total"]
|
|
15215
|
+
] : [[...rowLabels, null]];
|
|
15216
|
+
}
|
|
15217
|
+
if (!pivot.columnField) return [[...labels, ...measures.map((measure) => measure.caption)]];
|
|
15218
|
+
if (measures.length === 1)
|
|
15219
|
+
return [
|
|
15220
|
+
[
|
|
15221
|
+
pivot.valueCaption,
|
|
15222
|
+
...labels.slice(1).map(() => null),
|
|
15223
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
15224
|
+
...columns.slice(1).map(() => null),
|
|
15225
|
+
null
|
|
15226
|
+
],
|
|
15227
|
+
[...labels, ...columns.map(label3), "Grand Total"]
|
|
15228
|
+
];
|
|
15229
|
+
const { width } = pivotHeaderDimensions(pivot, columns.length, labels.length);
|
|
15230
|
+
const first2 = Array(width).fill(null);
|
|
15231
|
+
first2[labels.length] = pivot.layout === "compact" ? "Column Labels" : pivot.columnField;
|
|
15232
|
+
if (pivot.layout !== "compact") first2[labels.length + 1] = "Values";
|
|
15233
|
+
return [
|
|
15234
|
+
first2,
|
|
15235
|
+
[
|
|
15236
|
+
...labels.map(() => null),
|
|
15237
|
+
...columns.flatMap((column) => [label3(column), ...measures.slice(1).map(() => null)]),
|
|
15238
|
+
...measures.map((measure) => `Total ${measure.caption}`)
|
|
15239
|
+
],
|
|
15240
|
+
[
|
|
15241
|
+
...labels,
|
|
15242
|
+
...columns.flatMap(() => measures.map((measure) => measure.caption)),
|
|
15243
|
+
...measures.map(() => null)
|
|
15244
|
+
]
|
|
15245
|
+
];
|
|
15246
|
+
}
|
|
15247
|
+
|
|
15248
|
+
// xlsx/pivot/hierarchy-first.ts
|
|
15249
|
+
function appendFirstPivotValues(pivot, context) {
|
|
15250
|
+
const {
|
|
15251
|
+
rowItems,
|
|
15252
|
+
secondRowItems,
|
|
15253
|
+
columnItems,
|
|
15254
|
+
children: children2,
|
|
15255
|
+
innerIndices,
|
|
15256
|
+
groups,
|
|
15257
|
+
details,
|
|
15258
|
+
buckets,
|
|
15259
|
+
width,
|
|
15260
|
+
rowLabels,
|
|
15261
|
+
top,
|
|
15262
|
+
bottom,
|
|
15263
|
+
append
|
|
15264
|
+
} = context;
|
|
15265
|
+
const compact3 = pivot.layout === "compact";
|
|
15266
|
+
const tabular = !pivot.layout || pivot.layout === "tabular";
|
|
15267
|
+
const blank = () => Array(width - rowLabels).fill(null);
|
|
15268
|
+
pivotMeasures(pivot).forEach((measure, m) => {
|
|
15269
|
+
const numbers3 = (keys, records) => [
|
|
15270
|
+
...columnItems.map(
|
|
15271
|
+
(column) => pivotMeasureNumber(
|
|
15272
|
+
pivot,
|
|
15273
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
15274
|
+
measure
|
|
15275
|
+
)
|
|
15276
|
+
),
|
|
15277
|
+
pivotMeasureNumber(pivot, records, measure)
|
|
15278
|
+
];
|
|
15279
|
+
if (!tabular)
|
|
15280
|
+
append([measure.caption, ...Array(rowLabels - 1).fill(null)], blank(), {
|
|
15281
|
+
indices: [m],
|
|
15282
|
+
measure: m
|
|
15283
|
+
});
|
|
15284
|
+
let first2 = true;
|
|
15285
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
15286
|
+
const key = pivotValueKey(outer);
|
|
15287
|
+
const group = groups.get(key) ?? [];
|
|
15288
|
+
if (!tabular)
|
|
15289
|
+
append(
|
|
15290
|
+
compact3 ? [pivotItemLabel(outer)] : [null, pivotItemLabel(outer), null],
|
|
15291
|
+
top ? numbers3([key], group) : blank(),
|
|
15292
|
+
{ indices: [m, outerIndex], measure: m },
|
|
15293
|
+
compact3 ? 1 : 0
|
|
15294
|
+
);
|
|
15295
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
15296
|
+
(a2, b) => innerIndices.get(a2) - innerIndices.get(b)
|
|
15297
|
+
);
|
|
15298
|
+
innerKeys.forEach((innerKey, child3) => {
|
|
15299
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
15300
|
+
append(
|
|
15301
|
+
compact3 ? [pivotItemLabel(secondRowItems[innerIndex])] : [
|
|
15302
|
+
tabular && first2 ? measure.caption : null,
|
|
15303
|
+
pivot.repeatLabels || tabular && child3 === 0 ? pivotItemLabel(outer) : null,
|
|
15304
|
+
pivotItemLabel(secondRowItems[innerIndex])
|
|
15305
|
+
],
|
|
15306
|
+
numbers3([key, innerKey], details.get(JSON.stringify([key, innerKey]))),
|
|
15307
|
+
{ indices: [m, outerIndex, innerIndex], measure: m },
|
|
15308
|
+
compact3 ? 2 : 0
|
|
15309
|
+
);
|
|
15310
|
+
first2 = false;
|
|
15311
|
+
});
|
|
15312
|
+
if (bottom)
|
|
15313
|
+
append(
|
|
15314
|
+
compact3 ? [`${String(pivotItemLabel(outer))} Total`] : [null, `${String(pivotItemLabel(outer))} Total`, null],
|
|
15315
|
+
numbers3([key], group),
|
|
15316
|
+
{ indices: [m, outerIndex], measure: m, type: "default" },
|
|
15317
|
+
compact3 ? 1 : 0
|
|
15318
|
+
);
|
|
15319
|
+
});
|
|
15320
|
+
});
|
|
15321
|
+
}
|
|
15322
|
+
|
|
15043
15323
|
// xlsx/pivot/hierarchy.ts
|
|
15044
15324
|
var label2 = pivotItemLabel;
|
|
15045
|
-
function hierarchicalPivotGrid(pivot
|
|
15325
|
+
function hierarchicalPivotGrid(pivot) {
|
|
15046
15326
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
15047
15327
|
const secondRowItems = pivotItems(pivot, pivot.secondRowField);
|
|
15048
15328
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
15049
15329
|
const outerField = pivot.fields.indexOf(pivot.rowField);
|
|
15050
15330
|
const innerField = pivot.fields.indexOf(pivot.secondRowField);
|
|
15051
15331
|
const columnField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
15052
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
15053
15332
|
const layout2 = pivot.layout ?? "tabular";
|
|
15054
15333
|
const compact3 = layout2 === "compact";
|
|
15055
|
-
const
|
|
15334
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
15335
|
+
const firstValues = rowsAxis && pivot.valuesPosition === "first";
|
|
15336
|
+
const between = rowsAxis && pivot.valuesPosition === "between";
|
|
15337
|
+
const measures = pivotMeasures(pivot);
|
|
15338
|
+
const top = (!rowsAxis || firstValues) && layout2 !== "tabular" && pivot.subtotals !== false && (pivot.subtotalPosition ?? "top") === "top";
|
|
15056
15339
|
const bottom = pivot.subtotals !== false && !top;
|
|
15057
|
-
const rowLabelColumns = compact3 ? 1 : 2;
|
|
15340
|
+
const rowLabelColumns = compact3 ? 1 : rowsAxis ? 3 : 2;
|
|
15058
15341
|
const groups = /* @__PURE__ */ new Map();
|
|
15059
15342
|
const details = /* @__PURE__ */ new Map();
|
|
15060
15343
|
const children2 = /* @__PURE__ */ new Map();
|
|
15061
|
-
const innerIndices = new Map(secondRowItems.map((item,
|
|
15344
|
+
const innerIndices = new Map(secondRowItems.map((item, index3) => [pivotValueKey(item), index3]));
|
|
15062
15345
|
const buckets = /* @__PURE__ */ new Map();
|
|
15063
15346
|
const collect2 = (map, key, record) => {
|
|
15064
15347
|
const list = map.get(key);
|
|
@@ -15078,20 +15361,12 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
15078
15361
|
collect2(buckets, JSON.stringify([...key, column]), record);
|
|
15079
15362
|
}
|
|
15080
15363
|
}
|
|
15081
|
-
const
|
|
15082
|
-
|
|
15083
|
-
|
|
15364
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowLabelColumns);
|
|
15365
|
+
const rows = (details.size + rowItems.length * Number(bottom) + 1) * (rowsAxis ? measures.length : 1) + rowItems.length * Number(layout2 !== "tabular") * (firstValues ? measures.length : 1) + (firstValues ? measures.length : between ? rowItems.length * measures.length : details.size) * Number(rowsAxis && layout2 !== "tabular") + dimensions.rows;
|
|
15366
|
+
if (rows * dimensions.width > 1e6) throw new Error("The PivotTable result is too large.");
|
|
15084
15367
|
const labels = compact3 ? ["Row Labels"] : [pivot.rowField, pivot.secondRowField];
|
|
15085
|
-
const values2 = pivot
|
|
15086
|
-
|
|
15087
|
-
pivot.valueCaption,
|
|
15088
|
-
...compact3 ? [] : [null],
|
|
15089
|
-
compact3 ? "Column Labels" : pivot.columnField,
|
|
15090
|
-
...columnItems.slice(1).map(() => null),
|
|
15091
|
-
null
|
|
15092
|
-
],
|
|
15093
|
-
[...labels, ...columnItems.map(label2), "Grand Total"]
|
|
15094
|
-
] : [[...labels, pivot.valueCaption]];
|
|
15368
|
+
const values2 = pivotHeaders(pivot, columnItems, labels, label2);
|
|
15369
|
+
const firstDataRow = values2.length;
|
|
15095
15370
|
const indents = values2.map(() => 0);
|
|
15096
15371
|
const rowEntries = [];
|
|
15097
15372
|
const append = (labels2, numbers4, entry3, indent = 0) => {
|
|
@@ -15099,91 +15374,187 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
15099
15374
|
rowEntries.push(entry3);
|
|
15100
15375
|
indents.push(indent);
|
|
15101
15376
|
};
|
|
15102
|
-
const
|
|
15377
|
+
const bands = (keys, records) => [
|
|
15103
15378
|
...columnItems.map(
|
|
15104
|
-
(column) =>
|
|
15105
|
-
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
15106
|
-
valueField,
|
|
15107
|
-
pivot.aggregate
|
|
15108
|
-
)
|
|
15379
|
+
(column) => pivotNumbers(pivot, buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [])
|
|
15109
15380
|
),
|
|
15110
|
-
|
|
15381
|
+
pivotNumbers(pivot, records)
|
|
15111
15382
|
];
|
|
15112
|
-
|
|
15113
|
-
|
|
15114
|
-
|
|
15115
|
-
|
|
15116
|
-
|
|
15117
|
-
|
|
15118
|
-
|
|
15119
|
-
|
|
15120
|
-
|
|
15121
|
-
|
|
15122
|
-
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
const records = details.get(JSON.stringify(keys));
|
|
15126
|
-
if (!records) return;
|
|
15127
|
-
append(
|
|
15128
|
-
compact3 ? [label2(inner2)] : [
|
|
15129
|
-
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
15130
|
-
label2(inner2)
|
|
15383
|
+
const numbers3 = (keys, records) => bands(keys, records).flat();
|
|
15384
|
+
const appendMeasures = (labels2, keys, records, indices, type) => {
|
|
15385
|
+
const values3 = bands(keys, records);
|
|
15386
|
+
measures.forEach(
|
|
15387
|
+
(measure, m) => append(
|
|
15388
|
+
type ? [
|
|
15389
|
+
`${type === "grand" ? "Total" : String(labels2[0])} ${measure.caption}`,
|
|
15390
|
+
...Array(rowLabelColumns - 1).fill(null)
|
|
15391
|
+
] : compact3 ? [measure.caption] : [
|
|
15392
|
+
...labels2.map(
|
|
15393
|
+
(label3) => layout2 === "tabular" && m === 0 || pivot.repeatLabels ? label3 : null
|
|
15394
|
+
),
|
|
15395
|
+
measure.caption
|
|
15131
15396
|
],
|
|
15132
|
-
|
|
15133
|
-
{ indices: [
|
|
15134
|
-
compact3 ?
|
|
15135
|
-
)
|
|
15136
|
-
|
|
15397
|
+
values3.map((band) => band[m] ?? null),
|
|
15398
|
+
{ indices: type ? indices : [...indices, m], measure: m, ...type ? { type } : {} },
|
|
15399
|
+
compact3 && !type ? 2 : 0
|
|
15400
|
+
)
|
|
15401
|
+
);
|
|
15402
|
+
};
|
|
15403
|
+
if (firstValues)
|
|
15404
|
+
appendFirstPivotValues(pivot, {
|
|
15405
|
+
rowItems,
|
|
15406
|
+
secondRowItems,
|
|
15407
|
+
columnItems,
|
|
15408
|
+
children: children2,
|
|
15409
|
+
innerIndices,
|
|
15410
|
+
groups,
|
|
15411
|
+
details,
|
|
15412
|
+
buckets,
|
|
15413
|
+
width: dimensions.width,
|
|
15414
|
+
rowLabels: rowLabelColumns,
|
|
15415
|
+
top,
|
|
15416
|
+
bottom,
|
|
15417
|
+
append
|
|
15137
15418
|
});
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15419
|
+
else
|
|
15420
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
15421
|
+
const key = pivotValueKey(outer);
|
|
15422
|
+
if (layout2 !== "tabular")
|
|
15423
|
+
append(
|
|
15424
|
+
[label2(outer), ...Array(rowLabelColumns - 1).fill(null)],
|
|
15425
|
+
top ? numbers3([key], groups.get(key) ?? []) : Array(dimensions.width - rowLabelColumns).fill(null),
|
|
15426
|
+
{ indices: [outerIndex] }
|
|
15427
|
+
);
|
|
15428
|
+
let first2 = true;
|
|
15429
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
15430
|
+
(a2, b) => innerIndices.get(a2) - innerIndices.get(b)
|
|
15144
15431
|
);
|
|
15145
|
-
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15432
|
+
if (between)
|
|
15433
|
+
measures.forEach((measure, m) => {
|
|
15434
|
+
if (layout2 !== "tabular")
|
|
15435
|
+
append(
|
|
15436
|
+
compact3 ? [measure.caption] : [pivot.repeatLabels ? label2(outer) : null, measure.caption, null],
|
|
15437
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
15438
|
+
{ indices: [outerIndex, m], measure: m },
|
|
15439
|
+
compact3 ? 1 : 0
|
|
15440
|
+
);
|
|
15441
|
+
innerKeys.forEach((innerKey, child3) => {
|
|
15442
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
15443
|
+
const keys = [key, innerKey];
|
|
15444
|
+
const records = details.get(JSON.stringify(keys));
|
|
15445
|
+
append(
|
|
15446
|
+
compact3 ? [label2(secondRowItems[innerIndex])] : [
|
|
15447
|
+
pivot.repeatLabels || layout2 === "tabular" && m === 0 && child3 === 0 ? label2(outer) : null,
|
|
15448
|
+
layout2 === "tabular" && child3 === 0 ? measure.caption : null,
|
|
15449
|
+
label2(secondRowItems[innerIndex])
|
|
15450
|
+
],
|
|
15451
|
+
[
|
|
15452
|
+
...columnItems.map(
|
|
15453
|
+
(column) => pivotMeasureNumber(
|
|
15454
|
+
pivot,
|
|
15455
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
15456
|
+
measure
|
|
15457
|
+
)
|
|
15458
|
+
),
|
|
15459
|
+
pivotMeasureNumber(pivot, records, measure)
|
|
15460
|
+
],
|
|
15461
|
+
{ indices: [outerIndex, m, innerIndex], measure: m },
|
|
15462
|
+
compact3 ? 2 : 0
|
|
15463
|
+
);
|
|
15464
|
+
});
|
|
15465
|
+
});
|
|
15466
|
+
else
|
|
15467
|
+
innerKeys.forEach((innerKey) => {
|
|
15468
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
15469
|
+
const inner2 = secondRowItems[innerIndex];
|
|
15470
|
+
const keys = [key, innerKey];
|
|
15471
|
+
const records = details.get(JSON.stringify(keys));
|
|
15472
|
+
if (!records) return;
|
|
15473
|
+
if (rowsAxis) {
|
|
15474
|
+
if (layout2 !== "tabular")
|
|
15475
|
+
append(
|
|
15476
|
+
compact3 ? [label2(inner2)] : [pivot.repeatLabels ? label2(outer) : null, label2(inner2), null],
|
|
15477
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
15478
|
+
{ indices: [outerIndex, innerIndex] },
|
|
15479
|
+
compact3 ? 1 : 0
|
|
15480
|
+
);
|
|
15481
|
+
appendMeasures(
|
|
15482
|
+
[pivot.repeatLabels || first2 ? label2(outer) : null, label2(inner2)],
|
|
15483
|
+
keys,
|
|
15484
|
+
records,
|
|
15485
|
+
[outerIndex, innerIndex]
|
|
15486
|
+
);
|
|
15487
|
+
first2 = false;
|
|
15488
|
+
return;
|
|
15489
|
+
}
|
|
15490
|
+
append(
|
|
15491
|
+
compact3 ? [label2(inner2)] : [
|
|
15492
|
+
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
15493
|
+
label2(inner2)
|
|
15494
|
+
],
|
|
15495
|
+
numbers3(keys, records),
|
|
15496
|
+
{ indices: [outerIndex, innerIndex] },
|
|
15497
|
+
compact3 ? 1 : 0
|
|
15498
|
+
);
|
|
15499
|
+
first2 = false;
|
|
15500
|
+
});
|
|
15501
|
+
if (bottom) {
|
|
15502
|
+
if (rowsAxis) {
|
|
15503
|
+
appendMeasures([label2(outer)], [key], groups.get(key) ?? [], [outerIndex], "default");
|
|
15504
|
+
return;
|
|
15505
|
+
}
|
|
15506
|
+
const caption = String(label2(outer));
|
|
15507
|
+
append(
|
|
15508
|
+
[`${caption} Total`, ...compact3 ? [] : [null]],
|
|
15509
|
+
numbers3([key], groups.get(key) ?? []),
|
|
15510
|
+
{ indices: [outerIndex], type: "default" }
|
|
15511
|
+
);
|
|
15512
|
+
}
|
|
15513
|
+
});
|
|
15514
|
+
if (rowsAxis) appendMeasures([], [], pivot.records, [0], "grand");
|
|
15515
|
+
else
|
|
15516
|
+
append(["Grand Total", ...compact3 ? [] : [null]], numbers3([], pivot.records), {
|
|
15517
|
+
indices: [0],
|
|
15518
|
+
type: "grand"
|
|
15519
|
+
});
|
|
15151
15520
|
return {
|
|
15152
15521
|
values: values2,
|
|
15153
15522
|
rowItems,
|
|
15154
15523
|
secondRowItems,
|
|
15155
15524
|
columnItems,
|
|
15156
15525
|
rowEntries,
|
|
15157
|
-
firstDataRow
|
|
15526
|
+
firstDataRow,
|
|
15158
15527
|
rowLabelColumns,
|
|
15159
|
-
indents
|
|
15528
|
+
indents,
|
|
15529
|
+
...rowsAxis ? { firstHeaderRow: 1 } : {}
|
|
15160
15530
|
};
|
|
15161
15531
|
}
|
|
15162
15532
|
|
|
15163
15533
|
// xlsx/pivot/aggregate.ts
|
|
15164
|
-
function aggregate2(records, field, type) {
|
|
15165
|
-
if (!records.length) return null;
|
|
15166
|
-
const values2 = records.map((record) => record[field] ?? null);
|
|
15167
|
-
if (type === "count") return values2.filter((value2) => value2 !== null && value2 !== "").length;
|
|
15168
|
-
const error = values2.find(isCellError);
|
|
15169
|
-
if (error) return error;
|
|
15170
|
-
const numbers3 = values2.filter((value2) => typeof value2 === "number");
|
|
15171
|
-
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
15172
|
-
if (type === "min") return numbers3.reduce((a2, b) => Math.min(a2, b));
|
|
15173
|
-
if (type === "max") return numbers3.reduce((a2, b) => Math.max(a2, b));
|
|
15174
|
-
const sum2 = numbers3.reduce((total2, value2) => total2 + value2, 0);
|
|
15175
|
-
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
15176
|
-
}
|
|
15177
15534
|
function pivotGrid(pivot) {
|
|
15178
15535
|
validatePivotFields(pivot);
|
|
15179
|
-
|
|
15536
|
+
return prependPivotPage(pivotDataGrid(pivotPageProjection(pivot)), pivot);
|
|
15537
|
+
}
|
|
15538
|
+
function pivotDataGrid(pivot) {
|
|
15539
|
+
if (pivot.secondRowField) return hierarchicalPivotGrid(pivot);
|
|
15180
15540
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
15181
15541
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
15182
|
-
|
|
15542
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
15543
|
+
const compact3 = pivot.layout === "compact";
|
|
15544
|
+
const headings = rowsAxis && pivot.layout !== void 0 && pivot.layout !== "tabular";
|
|
15545
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowsAxis && !compact3 ? 2 : 1);
|
|
15546
|
+
const dataRows = (rowItems.length + 1) * (rowsAxis ? 1 + (pivot.additionalValues?.length ?? 0) : 1) + (headings ? rowItems.length : 0);
|
|
15547
|
+
if ((dataRows + dimensions.rows) * dimensions.width > 1e6)
|
|
15183
15548
|
throw new Error("The PivotTable result is too large.");
|
|
15549
|
+
const label3 = pivotItemLabel;
|
|
15550
|
+
const values2 = pivotHeaders(
|
|
15551
|
+
pivot,
|
|
15552
|
+
columnItems,
|
|
15553
|
+
[pivot.layout === "compact" ? "Row Labels" : pivot.rowField],
|
|
15554
|
+
label3
|
|
15555
|
+
);
|
|
15184
15556
|
const rowField = pivot.fields.indexOf(pivot.rowField);
|
|
15185
15557
|
const colField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
15186
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
15187
15558
|
const groups = /* @__PURE__ */ new Map();
|
|
15188
15559
|
const cells = /* @__PURE__ */ new Map();
|
|
15189
15560
|
const columns = /* @__PURE__ */ new Map();
|
|
@@ -15201,42 +15572,85 @@ function pivotGrid(pivot) {
|
|
|
15201
15572
|
collect2(cells, JSON.stringify([key, col]), record);
|
|
15202
15573
|
}
|
|
15203
15574
|
}
|
|
15204
|
-
const
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15575
|
+
const firstDataRow = values2.length;
|
|
15576
|
+
if (rowsAxis) {
|
|
15577
|
+
const measures = pivotMeasures(pivot);
|
|
15578
|
+
const rowEntries = [];
|
|
15579
|
+
const indents = values2.map(() => 0);
|
|
15580
|
+
const append = (caption, bands, index3, grand = false) => {
|
|
15581
|
+
measures.forEach((measure, m) => {
|
|
15582
|
+
values2.push([
|
|
15583
|
+
...compact3 ? [grand ? `Total ${measure.caption}` : measure.caption] : [
|
|
15584
|
+
grand ? `Total ${measure.caption}` : pivot.repeatLabels || !headings && m === 0 ? caption : null,
|
|
15585
|
+
grand ? null : measure.caption
|
|
15586
|
+
],
|
|
15587
|
+
...bands.map((band) => band[m] ?? null)
|
|
15588
|
+
]);
|
|
15589
|
+
indents.push(compact3 && !grand ? 1 : 0);
|
|
15590
|
+
rowEntries.push({
|
|
15591
|
+
indices: grand ? [0] : [index3, m],
|
|
15592
|
+
measure: m,
|
|
15593
|
+
...grand ? { type: "grand" } : {}
|
|
15594
|
+
});
|
|
15595
|
+
});
|
|
15596
|
+
};
|
|
15597
|
+
rowItems.forEach((item, index3) => {
|
|
15598
|
+
const key = pivotValueKey(item);
|
|
15599
|
+
if (headings) {
|
|
15600
|
+
values2.push([label3(item), ...Array(dimensions.width - 1).fill(null)]);
|
|
15601
|
+
rowEntries.push({ indices: [index3] });
|
|
15602
|
+
indents.push(0);
|
|
15603
|
+
}
|
|
15604
|
+
append(
|
|
15605
|
+
label3(item),
|
|
15606
|
+
[
|
|
15607
|
+
...columnItems.map(
|
|
15608
|
+
(col) => pivotNumbers(pivot, cells.get(JSON.stringify([key, pivotValueKey(col)])) ?? [])
|
|
15609
|
+
),
|
|
15610
|
+
pivotNumbers(pivot, groups.get(key) ?? [])
|
|
15611
|
+
],
|
|
15612
|
+
index3
|
|
15613
|
+
);
|
|
15614
|
+
});
|
|
15615
|
+
append(
|
|
15616
|
+
"Grand Total",
|
|
15617
|
+
[
|
|
15618
|
+
...columnItems.map((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
15619
|
+
pivotNumbers(pivot, pivot.records)
|
|
15620
|
+
],
|
|
15621
|
+
0,
|
|
15622
|
+
true
|
|
15623
|
+
);
|
|
15624
|
+
return {
|
|
15625
|
+
values: values2,
|
|
15626
|
+
rowItems,
|
|
15627
|
+
columnItems,
|
|
15628
|
+
firstDataRow,
|
|
15629
|
+
rowLabelColumns: compact3 ? 1 : 2,
|
|
15630
|
+
indents,
|
|
15631
|
+
firstHeaderRow: 1,
|
|
15632
|
+
rowEntries
|
|
15633
|
+
};
|
|
15634
|
+
}
|
|
15218
15635
|
for (const row2 of rowItems) {
|
|
15219
15636
|
const records = groups.get(pivotValueKey(row2)) ?? [];
|
|
15220
15637
|
values2.push([
|
|
15221
15638
|
label3(row2),
|
|
15222
|
-
...columnItems.
|
|
15223
|
-
(col) =>
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
pivot.aggregate
|
|
15639
|
+
...columnItems.flatMap(
|
|
15640
|
+
(col) => pivotNumbers(
|
|
15641
|
+
pivot,
|
|
15642
|
+
cells.get(JSON.stringify([pivotValueKey(row2), pivotValueKey(col)])) ?? []
|
|
15227
15643
|
)
|
|
15228
15644
|
),
|
|
15229
|
-
|
|
15645
|
+
...pivotNumbers(pivot, records)
|
|
15230
15646
|
]);
|
|
15231
15647
|
}
|
|
15232
15648
|
values2.push([
|
|
15233
15649
|
"Grand Total",
|
|
15234
|
-
...columnItems.
|
|
15235
|
-
|
|
15236
|
-
),
|
|
15237
|
-
aggregate2(pivot.records, valueField, pivot.aggregate)
|
|
15650
|
+
...columnItems.flatMap((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
15651
|
+
...pivotNumbers(pivot, pivot.records)
|
|
15238
15652
|
]);
|
|
15239
|
-
return { values: values2, rowItems, columnItems, firstDataRow
|
|
15653
|
+
return { values: values2, rowItems, columnItems, firstDataRow };
|
|
15240
15654
|
}
|
|
15241
15655
|
function pivotTableAt(sheet, at) {
|
|
15242
15656
|
return sheet.pivotTables?.find((pivot) => rangeContains(pivot.location, at));
|
|
@@ -15246,8 +15660,10 @@ function pivotTableAt(sheet, at) {
|
|
|
15246
15660
|
var X14 = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
|
|
15247
15661
|
var LAYOUT = "http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout";
|
|
15248
15662
|
var TABLE = {
|
|
15249
|
-
pivotTableDefinition: "name cacheId dataCaption updatedVersion minRefreshableVersion createdVersion applyNumberFormats applyBorderFormats applyFontFormats applyPatternFormats applyAlignmentFormats applyWidthHeightFormats useAutoFormatting itemPrintTitles indent compact compactData outline outlineData multipleFieldFilters rowGrandTotals colGrandTotals",
|
|
15250
|
-
location: "ref firstHeaderRow firstDataRow firstDataCol",
|
|
15663
|
+
pivotTableDefinition: "name cacheId dataCaption dataOnRows dataPosition updatedVersion minRefreshableVersion createdVersion applyNumberFormats applyBorderFormats applyFontFormats applyPatternFormats applyAlignmentFormats applyWidthHeightFormats useAutoFormatting itemPrintTitles indent compact compactData outline outlineData multipleFieldFilters rowGrandTotals colGrandTotals",
|
|
15664
|
+
location: "ref firstHeaderRow firstDataRow firstDataCol rowPageCount colPageCount",
|
|
15665
|
+
pageFields: "count",
|
|
15666
|
+
pageField: "fld item hier",
|
|
15251
15667
|
pivotFields: "count",
|
|
15252
15668
|
pivotField: "axis dataField compact outline showAll subtotalTop defaultSubtotal",
|
|
15253
15669
|
items: "count",
|
|
@@ -15257,7 +15673,7 @@ var TABLE = {
|
|
|
15257
15673
|
field: "x",
|
|
15258
15674
|
rowItems: "count",
|
|
15259
15675
|
colItems: "count",
|
|
15260
|
-
i: "t r",
|
|
15676
|
+
i: "t r i",
|
|
15261
15677
|
x: "v",
|
|
15262
15678
|
dataFields: "count",
|
|
15263
15679
|
dataField: "name fld subtotal baseField baseItem showDataAs",
|
|
@@ -15288,7 +15704,7 @@ function inspect(node, profile, cache3) {
|
|
|
15288
15704
|
for (let i2 = 0; i2 < node.attributes.length; i2++) {
|
|
15289
15705
|
const attr2 = node.attributes.item(i2);
|
|
15290
15706
|
if (attr2.name.startsWith("xmlns")) continue;
|
|
15291
|
-
if (!cache3 && node.namespaceURI === X14 && node.localName === "pivotTableDefinition" && attr2.name === "hideValuesRow" &&
|
|
15707
|
+
if (!cache3 && node.namespaceURI === X14 && node.localName === "pivotTableDefinition" && attr2.name === "hideValuesRow" && ["0", "1"].includes(attr2.value))
|
|
15292
15708
|
continue;
|
|
15293
15709
|
if (!cache3 && node.namespaceURI === X14 && (node.localName === "pivotField" && attr2.name === "fillDownLabels" || node.localName === "pivotTableDefinition" && attr2.name === "fillDownLabelsDefault") && ["0", "1"].includes(attr2.value))
|
|
15294
15710
|
continue;
|
|
@@ -15317,7 +15733,9 @@ function inspect(node, profile, cache3) {
|
|
|
15317
15733
|
throw new Error("Unsupported PivotTable option");
|
|
15318
15734
|
if (attr2.localName === "numFmtId" && attr2.value !== "0")
|
|
15319
15735
|
throw new Error("Unsupported PivotTable field number format");
|
|
15320
|
-
if (node.localName === "pivotTableDefinition" && ["compact", "compactData", "outline", "outlineData"
|
|
15736
|
+
if (node.localName === "pivotTableDefinition" && ["compact", "compactData", "outline", "outlineData", "dataOnRows"].includes(
|
|
15737
|
+
attr2.localName
|
|
15738
|
+
) && !["0", "1"].includes(attr2.value))
|
|
15321
15739
|
throw new Error("Unsupported PivotTable global layout");
|
|
15322
15740
|
if (node.localName === "item" && attr2.localName === "t" && !["default", "data"].includes(attr2.value))
|
|
15323
15741
|
throw new Error("Unsupported PivotTable subtotal");
|
|
@@ -15340,6 +15758,258 @@ function assertPivotRecords(records) {
|
|
|
15340
15758
|
);
|
|
15341
15759
|
}
|
|
15342
15760
|
|
|
15761
|
+
// xlsx/write/xml-out.ts
|
|
15762
|
+
var XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
|
|
15763
|
+
var CONTROL2 = "\0-\b\v\f-" + String.fromCharCode(65534, 65535);
|
|
15764
|
+
var NEEDS_ESCAPE = new RegExp(`[${CONTROL2}\r]|_x[0-9A-Fa-f]{4}_`);
|
|
15765
|
+
var ESCAPABLE = new RegExp(`[${CONTROL2}\r]|_(?=x[0-9A-Fa-f]{4}_)`, "g");
|
|
15766
|
+
function encodeEscapes(text3) {
|
|
15767
|
+
if (!NEEDS_ESCAPE.test(text3)) return text3;
|
|
15768
|
+
return text3.replace(
|
|
15769
|
+
ESCAPABLE,
|
|
15770
|
+
(ch) => `_x${ch.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0")}_`
|
|
15771
|
+
);
|
|
15772
|
+
}
|
|
15773
|
+
var INVALID_XML = new RegExp(`[${CONTROL2}]`, "g");
|
|
15774
|
+
var escapeText2 = (text3) => text3.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
15775
|
+
var escapeAttr3 = (text3) => text3.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
15776
|
+
function attrs(values2) {
|
|
15777
|
+
let out = "";
|
|
15778
|
+
for (const [name, value2] of Object.entries(values2)) {
|
|
15779
|
+
if (value2 === void 0) continue;
|
|
15780
|
+
const text3 = typeof value2 === "boolean" ? value2 ? "1" : "0" : typeof value2 === "number" ? num2(value2) : value2;
|
|
15781
|
+
out += ` ${name}="${escapeAttr3(text3)}"`;
|
|
15782
|
+
}
|
|
15783
|
+
return out;
|
|
15784
|
+
}
|
|
15785
|
+
var el = (name, values2 = {}, content2 = "") => content2 ? `<${name}${attrs(values2)}>${content2}</${name}>` : `<${name}${attrs(values2)}/>`;
|
|
15786
|
+
var num2 = (value2) => Object.is(value2, -0) ? "0" : String(value2);
|
|
15787
|
+
function tElement(text3, name = "t") {
|
|
15788
|
+
const encoded = escapeText2(encodeEscapes(text3));
|
|
15789
|
+
const preserve = /^\s|\s$|\n|\t/.test(text3) ? ' xml:space="preserve"' : "";
|
|
15790
|
+
return `<${name}${preserve}>${encoded}</${name}>`;
|
|
15791
|
+
}
|
|
15792
|
+
var MAIN_NS = ' xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"';
|
|
15793
|
+
function inlineFragment(xml) {
|
|
15794
|
+
const end = xml.indexOf(">");
|
|
15795
|
+
if (end < 0) return xml;
|
|
15796
|
+
const head = xml.slice(0, end);
|
|
15797
|
+
return head.includes(MAIN_NS) ? head.replace(MAIN_NS, "") + xml.slice(end) : xml;
|
|
15798
|
+
}
|
|
15799
|
+
|
|
15800
|
+
// xlsx/pivot/values-axis.ts
|
|
15801
|
+
function remapPivotRowEntries(entries, axes3) {
|
|
15802
|
+
return entries.map(
|
|
15803
|
+
(entry3) => entry3.type === "grand" ? entry3 : {
|
|
15804
|
+
...entry3,
|
|
15805
|
+
indices: entry3.indices.map((item, axis) => {
|
|
15806
|
+
const index3 = axes3[axis]?.[item];
|
|
15807
|
+
if (index3 === void 0) throw new Error("Invalid report row axis item");
|
|
15808
|
+
return index3;
|
|
15809
|
+
})
|
|
15810
|
+
}
|
|
15811
|
+
);
|
|
15812
|
+
}
|
|
15813
|
+
function pivotFieldIndex(field) {
|
|
15814
|
+
const raw2 = field?.getAttribute("x");
|
|
15815
|
+
if (raw2 === null || raw2 === void 0 || !/^-?\d+$/.test(raw2.trim())) return NaN;
|
|
15816
|
+
const value2 = Number(raw2);
|
|
15817
|
+
return Number.isSafeInteger(value2) ? value2 : NaN;
|
|
15818
|
+
}
|
|
15819
|
+
function pivotValueIndex(root, axis) {
|
|
15820
|
+
const index3 = axis.findIndex((field) => pivotFieldIndex(field) === -2);
|
|
15821
|
+
const position = root.getAttribute("dataPosition");
|
|
15822
|
+
if (position !== null && (!/^\d+$/.test(position.trim()) || Number(position) !== index3))
|
|
15823
|
+
throw new Error("Inconsistent Values axis position");
|
|
15824
|
+
if (axis.length === 3 && index3 < 2 && position === null)
|
|
15825
|
+
throw new Error("Missing leading or between-field Values position");
|
|
15826
|
+
return index3;
|
|
15827
|
+
}
|
|
15828
|
+
function pivotValueAxisItems(measures, columns, columnIndices) {
|
|
15829
|
+
const entries = [];
|
|
15830
|
+
if (columns === void 0) {
|
|
15831
|
+
for (let measure = 0; measure < measures; measure++)
|
|
15832
|
+
entries.push(
|
|
15833
|
+
`<i${attrs({ i: measure || void 0 })}><x${attrs({ v: measure || void 0 })}/></i>`
|
|
15834
|
+
);
|
|
15835
|
+
} else {
|
|
15836
|
+
for (let column = 0; column < columns; column++)
|
|
15837
|
+
for (let measure = 0; measure < measures; measure++) {
|
|
15838
|
+
entries.push(
|
|
15839
|
+
`<i${attrs({ r: measure ? 1 : void 0, i: measure || void 0 })}>${measure ? "" : `<x${attrs({ v: (columnIndices?.[column] ?? column) || void 0 })}/>`}<x${attrs({ v: measure || void 0 })}/></i>`
|
|
15840
|
+
);
|
|
15841
|
+
}
|
|
15842
|
+
for (let measure = 0; measure < measures; measure++)
|
|
15843
|
+
entries.push(`<i${attrs({ t: "grand", i: measure || void 0 })}><x/></i>`);
|
|
15844
|
+
}
|
|
15845
|
+
return `<colItems count="${entries.length}">${entries.join("")}</colItems>`;
|
|
15846
|
+
}
|
|
15847
|
+
function supportedPivotAxes(rows, columns, measures, valuesOnRows) {
|
|
15848
|
+
const index3 = pivotFieldIndex;
|
|
15849
|
+
if (valuesOnRows)
|
|
15850
|
+
return measures > 1 && (rows.length === 2 || rows.length === 3) && (index3(rows[0]) >= 0 || rows.length === 3) && rows.filter((field) => index3(field) === -2).length === 1 && rows.filter((field) => index3(field) !== -2).every((field) => index3(field) >= 0) && columns.length <= 1 && (!columns.length || index3(columns[0]) >= 0);
|
|
15851
|
+
if (rows.some((field) => !Number.isInteger(index3(field)) || index3(field) < 0)) return false;
|
|
15852
|
+
return measures === 1 ? columns.length <= 1 : columns.length >= 1 && columns.length <= 2 && index3(columns.at(-1)) === -2 && (columns.length !== 2 || index3(columns[0]) >= 0);
|
|
15853
|
+
}
|
|
15854
|
+
|
|
15855
|
+
// drawingml/dom.ts
|
|
15856
|
+
function attributeReader(element2) {
|
|
15857
|
+
return (name) => {
|
|
15858
|
+
if (!element2) return void 0;
|
|
15859
|
+
const direct = element2.getAttribute(name);
|
|
15860
|
+
if (direct !== null) return direct;
|
|
15861
|
+
const attributes = element2.attributes;
|
|
15862
|
+
for (let index3 = 0; index3 < attributes.length; index3++) {
|
|
15863
|
+
const candidate = attributes.item(index3);
|
|
15864
|
+
if (candidate && candidate.localName === name) return candidate.value;
|
|
15865
|
+
}
|
|
15866
|
+
return void 0;
|
|
15867
|
+
};
|
|
15868
|
+
}
|
|
15869
|
+
function stringAttribute(element2, name) {
|
|
15870
|
+
const value2 = attributeReader(element2)(name)?.trim();
|
|
15871
|
+
return value2 ? value2 : void 0;
|
|
15872
|
+
}
|
|
15873
|
+
function integerAttribute(element2, name) {
|
|
15874
|
+
const parsed = Number.parseInt(attributeReader(element2)(name) ?? "", 10);
|
|
15875
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
15876
|
+
}
|
|
15877
|
+
function booleanAttribute(element2, name) {
|
|
15878
|
+
const value2 = attributeReader(element2)(name)?.trim().toLowerCase();
|
|
15879
|
+
if (value2 === "1" || value2 === "true") return true;
|
|
15880
|
+
if (value2 === "0" || value2 === "false") return false;
|
|
15881
|
+
return void 0;
|
|
15882
|
+
}
|
|
15883
|
+
function descendants2(root, local) {
|
|
15884
|
+
const result2 = [];
|
|
15885
|
+
const visit2 = (node) => {
|
|
15886
|
+
for (const child3 of Array.from(node.childNodes)) {
|
|
15887
|
+
if (!isElement(child3)) continue;
|
|
15888
|
+
if (child3.localName === local) result2.push(child3);
|
|
15889
|
+
visit2(child3);
|
|
15890
|
+
}
|
|
15891
|
+
};
|
|
15892
|
+
visit2(root);
|
|
15893
|
+
return result2;
|
|
15894
|
+
}
|
|
15895
|
+
|
|
15896
|
+
// xlsx/pivot/page-filter-admission.ts
|
|
15897
|
+
var integer = (value2, fallback) => value2 === null ? fallback ?? NaN : /^\d+$/.test(value2.trim()) && Number.isSafeInteger(Number(value2)) ? Number(value2) : NaN;
|
|
15898
|
+
function assertPageAxisItems(root, pivot, shared, cache3, recordRoot) {
|
|
15899
|
+
if (!pivot.pageFilter) return;
|
|
15900
|
+
const literals = (node) => {
|
|
15901
|
+
const raw2 = node.getAttribute("v");
|
|
15902
|
+
if (node.localName === "x" && (raw2 === null || !/^\d+$/.test(raw2.trim())) || node.localName === "b" && !["0", "1"].includes(raw2 ?? "") || node.localName === "n" && (raw2 === null || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(raw2.trim())))
|
|
15903
|
+
throw new Error("Unmodeled report cache literal");
|
|
15904
|
+
for (const child3 of elements(node)) literals(child3);
|
|
15905
|
+
};
|
|
15906
|
+
literals(cache3);
|
|
15907
|
+
literals(recordRoot);
|
|
15908
|
+
const cacheFields = children(first(cache3, "cacheFields", NS.x), "cacheField", NS.x);
|
|
15909
|
+
if (pivot.columnField) {
|
|
15910
|
+
const column = children(first(root, "pivotFields", NS.x), "pivotField", NS.x)[pivot.fields.indexOf(pivot.columnField)];
|
|
15911
|
+
const list = first(column, "extLst", NS.x);
|
|
15912
|
+
const extensions = list ? children(list, "ext", NS.x) : [];
|
|
15913
|
+
if (extensions.some(
|
|
15914
|
+
(extension) => children(
|
|
15915
|
+
extension,
|
|
15916
|
+
"pivotField",
|
|
15917
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
15918
|
+
).some((field) => {
|
|
15919
|
+
const raw2 = field.getAttribute("fillDownLabels");
|
|
15920
|
+
if (raw2 !== null && !["0", "1", "false", "true"].includes(raw2.trim()))
|
|
15921
|
+
throw new Error("Invalid report column label repetition");
|
|
15922
|
+
return booleanAttribute(field, "fillDownLabels") === true;
|
|
15923
|
+
})
|
|
15924
|
+
))
|
|
15925
|
+
throw new Error("Repeated report column labels are preserved");
|
|
15926
|
+
}
|
|
15927
|
+
if (integer(first(cache3, "cacheFields", NS.x)?.getAttribute("count") ?? null) !== pivot.fields.length || integer(cache3.getAttribute("recordCount")) !== pivot.records.length || integer(recordRoot.getAttribute("count")) !== pivot.records.length)
|
|
15928
|
+
throw new Error("Inconsistent report cache counts");
|
|
15929
|
+
for (const name of [
|
|
15930
|
+
pivot.rowField,
|
|
15931
|
+
pivot.secondRowField,
|
|
15932
|
+
pivot.columnField,
|
|
15933
|
+
pivot.pageFilter.field
|
|
15934
|
+
].filter(Boolean)) {
|
|
15935
|
+
const field = pivot.fields.indexOf(name);
|
|
15936
|
+
if (integer(first(cacheFields[field], "sharedItems", NS.x)?.getAttribute("count") ?? null) !== shared[field].length)
|
|
15937
|
+
throw new Error("Inconsistent report shared-item counts");
|
|
15938
|
+
}
|
|
15939
|
+
for (const name of ["rowFields", "colFields"]) {
|
|
15940
|
+
const list = first(root, name, NS.x);
|
|
15941
|
+
if (list && integer(list.getAttribute("count")) !== children(list, "field", NS.x).length)
|
|
15942
|
+
throw new Error("Inconsistent report axis counts");
|
|
15943
|
+
}
|
|
15944
|
+
const projected = pivotPageProjection(pivot), fields = children(first(root, "pivotFields", NS.x), "pivotField", NS.x);
|
|
15945
|
+
const axisValues = (name, axis) => {
|
|
15946
|
+
const f6 = pivot.fields.indexOf(name), node = fields[f6], list = first(node, "items", NS.x), items = children(list, "item", NS.x), count2 = shared[f6].length;
|
|
15947
|
+
if (node.getAttribute("axis") !== axis) throw new Error("Inconsistent report axis field");
|
|
15948
|
+
const defaults = node.getAttribute("defaultSubtotal") !== "0";
|
|
15949
|
+
if (!list || integer(list.getAttribute("count")) !== items.length || items.length !== count2 + Number(defaults))
|
|
15950
|
+
throw new Error("Incomplete page-axis field items");
|
|
15951
|
+
const data = items.slice(0, count2).map((item) => {
|
|
15952
|
+
const i2 = integer(item.getAttribute("x"));
|
|
15953
|
+
if (item.hasAttribute("t") || !Number.isInteger(i2) || i2 >= count2)
|
|
15954
|
+
throw new Error("Invalid page-axis cache item");
|
|
15955
|
+
return shared[f6][i2];
|
|
15956
|
+
});
|
|
15957
|
+
if (new Set(data.map(pivotValueKey)).size !== count2 || defaults && (items.at(-1)?.getAttribute("t") !== "default" || items.at(-1)?.hasAttribute("x")))
|
|
15958
|
+
throw new Error("Invalid page-axis default item");
|
|
15959
|
+
const indices = new Map(data.map((v, i2) => [pivotValueKey(v), i2]));
|
|
15960
|
+
return pivotItems(projected, name).map((v) => indices.get(pivotValueKey(v)));
|
|
15961
|
+
};
|
|
15962
|
+
const read = (name) => {
|
|
15963
|
+
const list = first(root, name, NS.x), items = children(list, "i", NS.x);
|
|
15964
|
+
if (!list || integer(list.getAttribute("count")) !== items.length)
|
|
15965
|
+
throw new Error("Invalid page-axis item count");
|
|
15966
|
+
return items;
|
|
15967
|
+
};
|
|
15968
|
+
const rows = axisValues(pivot.rowField, "axisRow"), rowItems = read("rowItems");
|
|
15969
|
+
const grid = pivotGrid(pivot);
|
|
15970
|
+
const entries = grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, [
|
|
15971
|
+
rows,
|
|
15972
|
+
pivot.secondRowField ? axisValues(pivot.secondRowField, "axisRow") : []
|
|
15973
|
+
]) : [
|
|
15974
|
+
...rows.map((index3) => ({ indices: [index3], type: void 0 })),
|
|
15975
|
+
{ indices: [0], type: "grand" }
|
|
15976
|
+
];
|
|
15977
|
+
if (rowItems.length !== entries.length) throw new Error("Invalid page row items");
|
|
15978
|
+
let previousRow = [];
|
|
15979
|
+
rowItems.forEach((item, i2) => {
|
|
15980
|
+
const expected2 = entries[i2];
|
|
15981
|
+
const xs = children(item, "x", NS.x).map((x) => integer(x.getAttribute("v"), 0)), prefix = integer(item.getAttribute("r"), 0);
|
|
15982
|
+
if (item.getAttribute("t") !== (expected2.type ?? null) || !Number.isInteger(prefix) || prefix < 0 || prefix > previousRow.length || prefix >= expected2.indices.length || expected2.type && prefix !== 0 || integer(item.getAttribute("i"), 0) !== 0 || JSON.stringify([...previousRow.slice(0, prefix), ...xs]) !== JSON.stringify(expected2.indices))
|
|
15983
|
+
throw new Error("Unmodeled page row item");
|
|
15984
|
+
previousRow = expected2.type ? [] : expected2.indices;
|
|
15985
|
+
});
|
|
15986
|
+
const measures = 1 + (pivot.additionalValues?.length ?? 0), columns = pivot.columnField ? axisValues(pivot.columnField, "axisCol") : void 0, expected = [];
|
|
15987
|
+
if (columns)
|
|
15988
|
+
for (const col of columns)
|
|
15989
|
+
for (let m = 0; m < measures; m++) expected.push(measures > 1 ? [col, m] : [col]);
|
|
15990
|
+
else for (let m = 0; m < measures; m++) expected.push([m]);
|
|
15991
|
+
const colItems = read("colItems");
|
|
15992
|
+
if (colItems.length !== expected.length + (columns ? measures : 0))
|
|
15993
|
+
throw new Error("Invalid page column items");
|
|
15994
|
+
let previous = [];
|
|
15995
|
+
colItems.forEach((item, i2) => {
|
|
15996
|
+
const grand = i2 >= expected.length, measure = grand ? i2 - expected.length : i2 % measures;
|
|
15997
|
+
const xs = children(item, "x", NS.x).map((x) => integer(x.getAttribute("v"), 0)), prefix = integer(item.getAttribute("r"), 0);
|
|
15998
|
+
if (integer(item.getAttribute("i"), 0) !== measure || !Number.isInteger(prefix) || prefix < 0 || prefix > Math.max(0, previous.length - 1))
|
|
15999
|
+
throw new Error("Invalid page column prefix");
|
|
16000
|
+
if (grand) {
|
|
16001
|
+
if (item.getAttribute("t") !== "grand" || prefix !== 0 || xs.length !== 1 || xs[0] !== 0)
|
|
16002
|
+
throw new Error("Unmodeled page grand item");
|
|
16003
|
+
previous = [];
|
|
16004
|
+
return;
|
|
16005
|
+
}
|
|
16006
|
+
const values2 = !columns && measures === 1 && xs.length === 0 && prefix === 0 ? [0] : [...previous.slice(0, prefix), ...xs];
|
|
16007
|
+
if (item.hasAttribute("t") || JSON.stringify(values2) !== JSON.stringify(expected[i2]))
|
|
16008
|
+
throw new Error("Unmodeled page column item");
|
|
16009
|
+
previous = values2;
|
|
16010
|
+
});
|
|
16011
|
+
}
|
|
16012
|
+
|
|
15343
16013
|
// xlsx/pivot/read.ts
|
|
15344
16014
|
function value(node) {
|
|
15345
16015
|
const v = att(node, "v") ?? "";
|
|
@@ -15374,22 +16044,24 @@ function readOne(workbook, source2, part) {
|
|
|
15374
16044
|
const dataSheet = sourceNode && att(sourceNode, "sheet");
|
|
15375
16045
|
const dataRange = sourceNode && parseRange(att(sourceNode, "ref") ?? "");
|
|
15376
16046
|
const recordPart = source2.targetOfType(cachePart, `${NS.r}/pivotCacheRecords`);
|
|
16047
|
+
const rowsAxis = att(root, "dataOnRows") === "1";
|
|
15377
16048
|
if (!dataSheet || !dataRange || !recordPart || !workbook.sheets.some((sheet) => sheet.name === dataSheet))
|
|
15378
16049
|
throw new Error("Unsupported pivot source");
|
|
15379
|
-
|
|
16050
|
+
const recordRoot = parseXml(source2.text(recordPart)).documentElement;
|
|
16051
|
+
assertPivotRecords(recordRoot);
|
|
15380
16052
|
const fields = children(first(cache3, "cacheFields", NS.x), "cacheField", NS.x);
|
|
15381
16053
|
if (fields.some((field) => first(field, "fieldGroup", NS.x) || field.hasAttribute("formula")))
|
|
15382
16054
|
throw new Error("Grouped or calculated cache field");
|
|
15383
16055
|
const shared = fields.map(
|
|
15384
16056
|
(field) => elements(first(field, "sharedItems", NS.x) ?? parseXml("<root/>").documentElement).map(value)
|
|
15385
16057
|
);
|
|
15386
|
-
const records = children(
|
|
16058
|
+
const records = children(recordRoot, "r", NS.x).map(
|
|
15387
16059
|
(record) => elements(record).map((node, field) => {
|
|
15388
16060
|
if (node.localName !== "x") return value(node);
|
|
15389
|
-
const
|
|
15390
|
-
if (!Number.isInteger(
|
|
16061
|
+
const index3 = Number(att(node, "v"));
|
|
16062
|
+
if (!Number.isInteger(index3) || index3 < 0 || index3 >= (shared[field]?.length ?? 0))
|
|
15391
16063
|
throw new Error("Invalid pivot cache index");
|
|
15392
|
-
return shared[field][
|
|
16064
|
+
return shared[field][index3];
|
|
15393
16065
|
})
|
|
15394
16066
|
);
|
|
15395
16067
|
if (records.some((record) => record.length !== fields.length) || records.length * fields.length > 1e6)
|
|
@@ -15409,17 +16081,43 @@ function readOne(workbook, source2, part) {
|
|
|
15409
16081
|
"dataField",
|
|
15410
16082
|
NS.x
|
|
15411
16083
|
);
|
|
15412
|
-
if (rowFields.length < 1 || rowFields.length > 2 ||
|
|
16084
|
+
if (rowFields.length < 1 || rowFields.length > (rowsAxis ? 3 : 2) || dataFields.length < 1 || dataFields.length > 16 || !supportedPivotAxes(rowFields, colFields, dataFields.length, rowsAxis) || first(root, "filters", NS.x) || root.getAttribute("rowGrandTotals") === "0" || root.getAttribute("colGrandTotals") === "0")
|
|
15413
16085
|
throw new Error("Unsupported pivot layout");
|
|
16086
|
+
const valueIndex = pivotValueIndex(root, rowsAxis ? rowFields : colFields);
|
|
15414
16087
|
const measure = dataFields[0];
|
|
16088
|
+
const definition = elements(first(root, "extLst", NS.x) ?? parseXml("<root/>").documentElement).map(
|
|
16089
|
+
(extension) => first(
|
|
16090
|
+
extension,
|
|
16091
|
+
"pivotTableDefinition",
|
|
16092
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
16093
|
+
)
|
|
16094
|
+
).find(Boolean);
|
|
16095
|
+
if (dataFields.length > 1 && att(definition, "hideValuesRow") !== "1")
|
|
16096
|
+
throw new Error("Visible Values header rows are preserved");
|
|
16097
|
+
for (const [axis, count2] of [
|
|
16098
|
+
["rowItems", rowsAxis ? dataFields.length : 1],
|
|
16099
|
+
["colItems", rowsAxis ? 1 : dataFields.length]
|
|
16100
|
+
]) {
|
|
16101
|
+
for (const item of children(
|
|
16102
|
+
first(root, axis, NS.x) ?? parseXml("<root/>").documentElement,
|
|
16103
|
+
"i",
|
|
16104
|
+
NS.x
|
|
16105
|
+
)) {
|
|
16106
|
+
const index3 = Number(att(item, "i") ?? "0");
|
|
16107
|
+
if (!Number.isInteger(index3) || index3 < 0 || index3 >= count2)
|
|
16108
|
+
throw new Error("Unsupported Values axis item");
|
|
16109
|
+
}
|
|
16110
|
+
}
|
|
15415
16111
|
const aggregate3 = att(measure, "subtotal") ?? "sum";
|
|
15416
16112
|
if (!PIVOT_AGGREGATES.includes(aggregate3) || att(measure, "showDataAs") && att(measure, "showDataAs") !== "normal")
|
|
15417
16113
|
throw new Error("Unsupported pivot aggregate");
|
|
15418
16114
|
const names = fields.map((field) => decodeEscapes(att(field, "name") ?? ""));
|
|
15419
|
-
const
|
|
15420
|
-
const
|
|
16115
|
+
const realRows = rowsAxis ? rowFields.filter((field) => pivotFieldIndex(field) !== -2) : rowFields;
|
|
16116
|
+
const row2 = names[pivotFieldIndex(realRows[0])];
|
|
16117
|
+
const second = realRows[1] ? names[Number(att(realRows[1], "x"))] : void 0;
|
|
16118
|
+
const pageFilter = readPivotPageFilter(root, names, shared);
|
|
15421
16119
|
const tableFields = children(first(root, "pivotFields", NS.x), "pivotField", NS.x);
|
|
15422
|
-
const outer = tableFields[
|
|
16120
|
+
const outer = tableFields[pivotFieldIndex(realRows[0])];
|
|
15423
16121
|
const compact3 = att(outer, "compact") !== "0";
|
|
15424
16122
|
const outline = att(outer, "outline") !== "0";
|
|
15425
16123
|
const layout2 = compact3 ? "compact" : outline ? "outline" : "tabular";
|
|
@@ -15428,7 +16126,7 @@ function readOne(workbook, source2, part) {
|
|
|
15428
16126
|
) || att(root, "compact") !== "0" !== compact3 || att(root, "compactData") !== "0" !== compact3 || att(root, "outline") === "1" !== outline || att(root, "outlineData") === "1" !== outline || layout2 === "compact" && att(root, "indent") !== "0")
|
|
15429
16127
|
throw new Error("Mixed field layouts or custom compact indentation are preserved");
|
|
15430
16128
|
const subtotal = att(outer, "defaultSubtotal") !== "0";
|
|
15431
|
-
const repeat =
|
|
16129
|
+
const repeat = realRows.map((field) => {
|
|
15432
16130
|
const node = tableFields[Number(att(field, "x"))];
|
|
15433
16131
|
const extension = first(first(node, "extLst", NS.x), "ext", NS.x);
|
|
15434
16132
|
return att(
|
|
@@ -15441,16 +16139,24 @@ function readOne(workbook, source2, part) {
|
|
|
15441
16139
|
) === "1";
|
|
15442
16140
|
});
|
|
15443
16141
|
if (repeat.some((entry4) => entry4 !== repeat[0])) throw new Error("Mixed field label repetition");
|
|
15444
|
-
const
|
|
16142
|
+
const hasColumn = colFields.length > (dataFields.length > 1 && !rowsAxis ? 1 : 0);
|
|
16143
|
+
const col = hasColumn ? names[Number(att(colFields[0], "x"))] : void 0;
|
|
15445
16144
|
const data = names[Number(att(measure, "fld"))];
|
|
15446
16145
|
const location = parseRange(att(first(root, "location", NS.x), "ref") ?? "");
|
|
15447
|
-
if (!row2 || !data || !location ||
|
|
16146
|
+
if (!row2 || !data || !location || hasColumn && !col || realRows.length === 2 && !second)
|
|
15448
16147
|
throw new Error("Invalid pivot fields");
|
|
16148
|
+
if (pageFilter) {
|
|
16149
|
+
if (location.start.row < 2) throw new Error("Invalid report filter location");
|
|
16150
|
+
location.start.row -= 2;
|
|
16151
|
+
}
|
|
15449
16152
|
const pivot = {
|
|
16153
|
+
...pageFilter ? { pageFilter } : {},
|
|
15450
16154
|
name: att(root, "name") ?? "PivotTable",
|
|
15451
16155
|
source: `${quoteSheetName(dataSheet)}!${formatRange(dataRange)}`,
|
|
15452
16156
|
rowField: row2,
|
|
15453
16157
|
layout: layout2,
|
|
16158
|
+
...rowsAxis ? { valuesAxis: "rows" } : {},
|
|
16159
|
+
...rowsAxis && realRows.length === 2 && valueIndex < 2 ? { valuesPosition: valueIndex === 0 ? "first" : "between" } : {},
|
|
15454
16160
|
subtotalPosition: att(outer, "subtotalTop") === "0" ? "bottom" : "top",
|
|
15455
16161
|
...second ? { secondRowField: second, subtotals: subtotal, repeatLabels: repeat[0] ?? false } : {
|
|
15456
16162
|
...subtotal ? {} : { subtotals: false },
|
|
@@ -15459,6 +16165,15 @@ function readOne(workbook, source2, part) {
|
|
|
15459
16165
|
valueField: data,
|
|
15460
16166
|
aggregate: aggregate3,
|
|
15461
16167
|
valueCaption: decodeEscapes(att(measure, "name") ?? data),
|
|
16168
|
+
...dataFields.length > 1 ? {
|
|
16169
|
+
additionalValues: dataFields.slice(1).map((measure2) => {
|
|
16170
|
+
const field = names[Number(att(measure2, "fld"))];
|
|
16171
|
+
const aggregate4 = att(measure2, "subtotal") ?? "sum";
|
|
16172
|
+
if (!field || !PIVOT_AGGREGATES.includes(aggregate4) || att(measure2, "showDataAs") && att(measure2, "showDataAs") !== "normal")
|
|
16173
|
+
throw new Error("Unsupported pivot measure");
|
|
16174
|
+
return { field, aggregate: aggregate4, caption: decodeEscapes(att(measure2, "name") ?? field) };
|
|
16175
|
+
})
|
|
16176
|
+
} : {},
|
|
15462
16177
|
fields: names,
|
|
15463
16178
|
records,
|
|
15464
16179
|
location,
|
|
@@ -15467,6 +16182,7 @@ function readOne(workbook, source2, part) {
|
|
|
15467
16182
|
sourceXml: xml,
|
|
15468
16183
|
...col ? { columnField: col } : {}
|
|
15469
16184
|
};
|
|
16185
|
+
assertPageAxisItems(root, pivot, shared, cache3, recordRoot);
|
|
15470
16186
|
return pivot;
|
|
15471
16187
|
}
|
|
15472
16188
|
function readPivotTables(workbook, source2, warn) {
|
|
@@ -15792,10 +16508,10 @@ function parseDynamicArrayMetadata(xml) {
|
|
|
15792
16508
|
const flag2 = props?.getAttribute("fDynamic");
|
|
15793
16509
|
return flag2 === "1" || flag2 === "true";
|
|
15794
16510
|
});
|
|
15795
|
-
childrenNamed(top.get("cellMetadata")?.[0], "bk").forEach((bk,
|
|
16511
|
+
childrenNamed(top.get("cellMetadata")?.[0], "bk").forEach((bk, index3) => {
|
|
15796
16512
|
for (const rc of childrenNamed(bk, "rc")) {
|
|
15797
16513
|
const type = types[Number(att(rc, "t")) - 1];
|
|
15798
|
-
if (type === DYNAMIC_ARRAY_TYPE && dynamic[Number(att(rc, "v"))]) out.add(
|
|
16514
|
+
if (type === DYNAMIC_ARRAY_TYPE && dynamic[Number(att(rc, "v"))]) out.add(index3 + 1);
|
|
15799
16515
|
}
|
|
15800
16516
|
});
|
|
15801
16517
|
return out;
|
|
@@ -16073,13 +16789,13 @@ function parseStyles(xml, warnings) {
|
|
|
16073
16789
|
const named2 = namesByXf.get(xfId);
|
|
16074
16790
|
if (named2 && xfId !== 0 && named2 !== "Normal") style2.cellStyleName = named2;
|
|
16075
16791
|
const key = styleKey(style2);
|
|
16076
|
-
let
|
|
16077
|
-
if (
|
|
16078
|
-
|
|
16792
|
+
let index3 = keys.get(key);
|
|
16793
|
+
if (index3 === void 0) {
|
|
16794
|
+
index3 = styles.length;
|
|
16079
16795
|
styles.push(style2);
|
|
16080
|
-
keys.set(key,
|
|
16796
|
+
keys.set(key, index3);
|
|
16081
16797
|
}
|
|
16082
|
-
xfMap.push(
|
|
16798
|
+
xfMap.push(index3);
|
|
16083
16799
|
}
|
|
16084
16800
|
if (!styles.length) {
|
|
16085
16801
|
styles.push(fallback);
|
|
@@ -16488,11 +17204,11 @@ function sigmaGradientStops(stops) {
|
|
|
16488
17204
|
const front = hexToRgbChannels(stops[0].color);
|
|
16489
17205
|
const back = hexToRgbChannels(stops[1].color);
|
|
16490
17206
|
if (!front || !back) return void 0;
|
|
16491
|
-
return OFFICE_SIGMA_FACTORS.map((value2,
|
|
17207
|
+
return OFFICE_SIGMA_FACTORS.map((value2, index3) => {
|
|
16492
17208
|
const factor = value2 / 65536;
|
|
16493
17209
|
const mix = (a2, b) => toHex(255 * ((a2 / 255) ** 2.2 * (1 - factor) + (b / 255) ** 2.2 * factor) ** (1 / 2.2));
|
|
16494
17210
|
return {
|
|
16495
|
-
offset: Math.fround(
|
|
17211
|
+
offset: Math.fround(index3 / 255),
|
|
16496
17212
|
color: `#${mix(front.r, back.r)}${mix(front.g, back.g)}${mix(front.b, back.b)}`,
|
|
16497
17213
|
opacity: 1
|
|
16498
17214
|
};
|
|
@@ -16509,47 +17225,6 @@ function parseArgbHex(hex) {
|
|
|
16509
17225
|
var clamp255 = (v) => Math.max(0, Math.min(255, v));
|
|
16510
17226
|
var rgbToUpperHex = (rgb2) => `#${rgb2.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
|
|
16511
17227
|
|
|
16512
|
-
// drawingml/dom.ts
|
|
16513
|
-
function attributeReader(element2) {
|
|
16514
|
-
return (name) => {
|
|
16515
|
-
if (!element2) return void 0;
|
|
16516
|
-
const direct = element2.getAttribute(name);
|
|
16517
|
-
if (direct !== null) return direct;
|
|
16518
|
-
const attributes = element2.attributes;
|
|
16519
|
-
for (let index2 = 0; index2 < attributes.length; index2++) {
|
|
16520
|
-
const candidate = attributes.item(index2);
|
|
16521
|
-
if (candidate && candidate.localName === name) return candidate.value;
|
|
16522
|
-
}
|
|
16523
|
-
return void 0;
|
|
16524
|
-
};
|
|
16525
|
-
}
|
|
16526
|
-
function stringAttribute(element2, name) {
|
|
16527
|
-
const value2 = attributeReader(element2)(name)?.trim();
|
|
16528
|
-
return value2 ? value2 : void 0;
|
|
16529
|
-
}
|
|
16530
|
-
function integerAttribute(element2, name) {
|
|
16531
|
-
const parsed = Number.parseInt(attributeReader(element2)(name) ?? "", 10);
|
|
16532
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
16533
|
-
}
|
|
16534
|
-
function booleanAttribute(element2, name) {
|
|
16535
|
-
const value2 = attributeReader(element2)(name)?.trim().toLowerCase();
|
|
16536
|
-
if (value2 === "1" || value2 === "true") return true;
|
|
16537
|
-
if (value2 === "0" || value2 === "false") return false;
|
|
16538
|
-
return void 0;
|
|
16539
|
-
}
|
|
16540
|
-
function descendants2(root, local) {
|
|
16541
|
-
const result2 = [];
|
|
16542
|
-
const visit2 = (node) => {
|
|
16543
|
-
for (const child3 of Array.from(node.childNodes)) {
|
|
16544
|
-
if (!isElement(child3)) continue;
|
|
16545
|
-
if (child3.localName === local) result2.push(child3);
|
|
16546
|
-
visit2(child3);
|
|
16547
|
-
}
|
|
16548
|
-
};
|
|
16549
|
-
visit2(root);
|
|
16550
|
-
return result2;
|
|
16551
|
-
}
|
|
16552
|
-
|
|
16553
17228
|
// drawingml/ordered-color-transforms.ts
|
|
16554
17229
|
function orderedColorTransforms(channels, transforms) {
|
|
16555
17230
|
let { r, g: g2, b } = channels;
|
|
@@ -16871,7 +17546,7 @@ function parseTheme2(xml) {
|
|
|
16871
17546
|
if (!xml) return palette;
|
|
16872
17547
|
const theme2 = parseTheme(parseXml(xml, { label: "XLSX theme" }));
|
|
16873
17548
|
palette.colors = PALETTE_SLOTS.map(
|
|
16874
|
-
(slot2,
|
|
17549
|
+
(slot2, index3) => paletteHex(theme2.colorScheme.colors[slot2]) ?? DEFAULT_THEME.colors[index3] ?? "000000"
|
|
16875
17550
|
);
|
|
16876
17551
|
palette.majorFont = theme2.fontScheme.major.latin ?? palette.majorFont;
|
|
16877
17552
|
palette.minorFont = theme2.fontScheme.minor.latin ?? palette.minorFont;
|
|
@@ -17054,11 +17729,11 @@ function readModernHash(node, prefix = "") {
|
|
|
17054
17729
|
function parseWorkbookPart(xml) {
|
|
17055
17730
|
const root = parseXml(xml, { label: "XLSX workbook" }).documentElement;
|
|
17056
17731
|
const sheets = [];
|
|
17057
|
-
xChildren(xFirst(root, "sheets") ?? root, "sheet").forEach((node,
|
|
17732
|
+
xChildren(xFirst(root, "sheets") ?? root, "sheet").forEach((node, index3) => {
|
|
17058
17733
|
const state = att(node, "state");
|
|
17059
17734
|
sheets.push({
|
|
17060
|
-
name: att(node, "name") ?? `Sheet${
|
|
17061
|
-
sheetId: numAttr(node, "sheetId") ??
|
|
17735
|
+
name: att(node, "name") ?? `Sheet${index3 + 1}`,
|
|
17736
|
+
sheetId: numAttr(node, "sheetId") ?? index3 + 1,
|
|
17062
17737
|
state: state === "hidden" || state === "veryHidden" ? state : "visible",
|
|
17063
17738
|
relId: relAttr(node, "id") ?? ""
|
|
17064
17739
|
});
|
|
@@ -17408,8 +18083,8 @@ function styleRef(element2) {
|
|
|
17408
18083
|
if (element2.localName === "fontRef") {
|
|
17409
18084
|
if (raw2) ref.fontIndex = raw2;
|
|
17410
18085
|
} else {
|
|
17411
|
-
const
|
|
17412
|
-
if (Number.isFinite(
|
|
18086
|
+
const index3 = Number.parseInt(raw2 ?? "", 10);
|
|
18087
|
+
if (Number.isFinite(index3)) ref.index = index3;
|
|
17413
18088
|
}
|
|
17414
18089
|
const color = parseDrawingColorIn(element2);
|
|
17415
18090
|
if (color) ref.color = color;
|
|
@@ -17797,11 +18472,11 @@ function groupTransform(group, parent) {
|
|
|
17797
18472
|
scaleY: parent.scaleY * local.scaleY
|
|
17798
18473
|
};
|
|
17799
18474
|
}
|
|
17800
|
-
function parseShape(sp,
|
|
18475
|
+
function parseShape(sp, index3, group, issues) {
|
|
17801
18476
|
const spPr = first(sp, "spPr", NS.dsp);
|
|
17802
18477
|
const transform6 = parseTransform(first(spPr, "xfrm", NS.a));
|
|
17803
18478
|
if (!transform6) return void 0;
|
|
17804
|
-
const modelId = stringAttribute(sp, "modelId") ?? stringAttribute(first(first(sp, "nvSpPr", NS.dsp), "cNvPr", NS.dsp), "id") ?? `dsp-${
|
|
18479
|
+
const modelId = stringAttribute(sp, "modelId") ?? stringAttribute(first(first(sp, "nvSpPr", NS.dsp), "cNvPr", NS.dsp), "id") ?? `dsp-${index3}`;
|
|
17805
18480
|
const { geometry, adjustments, paths, issue } = parseDrawingGeometry(spPr);
|
|
17806
18481
|
if (issue) issues.push({ code: issue, message: `Shape ${modelId}: ${issue}.` });
|
|
17807
18482
|
const frame = applyGroup(transform6.frame, group);
|
|
@@ -18019,8 +18694,8 @@ function drawingFillXml(fill) {
|
|
|
18019
18694
|
const stops = children(list, "gs", NS.a).filter(
|
|
18020
18695
|
(node) => parseDrawingColorIn(node) && Number.isFinite(Number.parseInt(node.getAttribute("pos") ?? "", 10))
|
|
18021
18696
|
);
|
|
18022
|
-
fill.stops.forEach((stop,
|
|
18023
|
-
const node = stops[
|
|
18697
|
+
fill.stops.forEach((stop, index3) => {
|
|
18698
|
+
const node = stops[index3] ?? doc.createElementNS(NS.a, "a:gs");
|
|
18024
18699
|
if (!node.parentNode) list.appendChild(node);
|
|
18025
18700
|
node.setAttribute("pos", String(Math.round(stop.position * 1e3)));
|
|
18026
18701
|
for (const old of elements(node))
|
|
@@ -18378,8 +19053,8 @@ var OFFICE_GRADIENT_PRESET_DATA = [
|
|
|
18378
19053
|
];
|
|
18379
19054
|
|
|
18380
19055
|
// drawingml/gradient-presets.ts
|
|
18381
|
-
OFFICE_GRADIENT_PRESET_DATA.map(([label3],
|
|
18382
|
-
id:
|
|
19056
|
+
OFFICE_GRADIENT_PRESET_DATA.map(([label3], index3) => ({
|
|
19057
|
+
id: index3 + 1,
|
|
18383
19058
|
label: label3
|
|
18384
19059
|
}));
|
|
18385
19060
|
function officeGradientPresetFill(id) {
|
|
@@ -18987,45 +19662,6 @@ function readDataValidations(node) {
|
|
|
18987
19662
|
return out;
|
|
18988
19663
|
}
|
|
18989
19664
|
|
|
18990
|
-
// xlsx/write/xml-out.ts
|
|
18991
|
-
var XML_HEADER = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
|
|
18992
|
-
var CONTROL2 = "\0-\b\v\f-" + String.fromCharCode(65534, 65535);
|
|
18993
|
-
var NEEDS_ESCAPE = new RegExp(`[${CONTROL2}\r]|_x[0-9A-Fa-f]{4}_`);
|
|
18994
|
-
var ESCAPABLE = new RegExp(`[${CONTROL2}\r]|_(?=x[0-9A-Fa-f]{4}_)`, "g");
|
|
18995
|
-
function encodeEscapes(text3) {
|
|
18996
|
-
if (!NEEDS_ESCAPE.test(text3)) return text3;
|
|
18997
|
-
return text3.replace(
|
|
18998
|
-
ESCAPABLE,
|
|
18999
|
-
(ch) => `_x${ch.charCodeAt(0).toString(16).toUpperCase().padStart(4, "0")}_`
|
|
19000
|
-
);
|
|
19001
|
-
}
|
|
19002
|
-
var INVALID_XML = new RegExp(`[${CONTROL2}]`, "g");
|
|
19003
|
-
var escapeText2 = (text3) => text3.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
19004
|
-
var escapeAttr3 = (text3) => text3.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
19005
|
-
function attrs(values2) {
|
|
19006
|
-
let out = "";
|
|
19007
|
-
for (const [name, value2] of Object.entries(values2)) {
|
|
19008
|
-
if (value2 === void 0) continue;
|
|
19009
|
-
const text3 = typeof value2 === "boolean" ? value2 ? "1" : "0" : typeof value2 === "number" ? num2(value2) : value2;
|
|
19010
|
-
out += ` ${name}="${escapeAttr3(text3)}"`;
|
|
19011
|
-
}
|
|
19012
|
-
return out;
|
|
19013
|
-
}
|
|
19014
|
-
var el = (name, values2 = {}, content2 = "") => content2 ? `<${name}${attrs(values2)}>${content2}</${name}>` : `<${name}${attrs(values2)}/>`;
|
|
19015
|
-
var num2 = (value2) => Object.is(value2, -0) ? "0" : String(value2);
|
|
19016
|
-
function tElement(text3, name = "t") {
|
|
19017
|
-
const encoded = escapeText2(encodeEscapes(text3));
|
|
19018
|
-
const preserve = /^\s|\s$|\n|\t/.test(text3) ? ' xml:space="preserve"' : "";
|
|
19019
|
-
return `<${name}${preserve}>${encoded}</${name}>`;
|
|
19020
|
-
}
|
|
19021
|
-
var MAIN_NS = ' xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"';
|
|
19022
|
-
function inlineFragment(xml) {
|
|
19023
|
-
const end = xml.indexOf(">");
|
|
19024
|
-
if (end < 0) return xml;
|
|
19025
|
-
const head = xml.slice(0, end);
|
|
19026
|
-
return head.includes(MAIN_NS) ? head.replace(MAIN_NS, "") + xml.slice(end) : xml;
|
|
19027
|
-
}
|
|
19028
|
-
|
|
19029
19665
|
// xlsx/conditional-extensions.ts
|
|
19030
19666
|
var XM = "http://schemas.microsoft.com/office/excel/2006/main";
|
|
19031
19667
|
var URI = "{78C0D931-6437-407d-A8EE-F0AAD7539E65}";
|
|
@@ -19035,8 +19671,8 @@ function writeSettings(node, rule) {
|
|
|
19035
19671
|
if (rule.minLength !== void 0) bar.setAttribute("minLength", String(rule.minLength));
|
|
19036
19672
|
if (rule.maxLength !== void 0) bar.setAttribute("maxLength", String(rule.maxLength));
|
|
19037
19673
|
const thresholds = children(bar, "cfvo", NS.x14);
|
|
19038
|
-
for (const [
|
|
19039
|
-
const target = thresholds[
|
|
19674
|
+
for (const [index3, threshold] of [rule.min, rule.max].entries()) {
|
|
19675
|
+
const target = thresholds[index3];
|
|
19040
19676
|
if (!target) continue;
|
|
19041
19677
|
const oldType = target.getAttribute("type");
|
|
19042
19678
|
if (oldType === "autoMin" && threshold.type === "min" || oldType === "autoMax" && threshold.type === "max")
|
|
@@ -19346,7 +19982,7 @@ function chartCacheValues(cache3) {
|
|
|
19346
19982
|
out[point.index ?? out.length] = numeric2 && text3.trim() !== "" && Number.isFinite(Number(text3)) ? Number(text3) : text3;
|
|
19347
19983
|
}
|
|
19348
19984
|
const size = Math.max(cache3.pointCount ?? 0, out.length);
|
|
19349
|
-
for (let
|
|
19985
|
+
for (let index3 = 0; index3 < size; index3++) if (out[index3] === void 0) out[index3] = "";
|
|
19350
19986
|
return out;
|
|
19351
19987
|
}
|
|
19352
19988
|
var chartSourceValues = (source2) => chartCacheValues(source2?.cache ?? source2?.levels?.[0]);
|
|
@@ -19481,8 +20117,8 @@ function parseCache(node) {
|
|
|
19481
20117
|
type: node.localName === "numCache" || node.localName === "numLit" ? "number" : "string",
|
|
19482
20118
|
points: children(node, "pt", NS.c).map((pt) => {
|
|
19483
20119
|
const point = { value: cChild(pt, "v")?.textContent ?? "" };
|
|
19484
|
-
const
|
|
19485
|
-
if (Number.isInteger(
|
|
20120
|
+
const index3 = Number(attribute(pt, "idx") ?? Number.NaN);
|
|
20121
|
+
if (Number.isInteger(index3) && index3 >= 0) point.index = index3;
|
|
19486
20122
|
const formatCode2 = attribute(pt, "formatCode");
|
|
19487
20123
|
if (formatCode2 !== void 0) point.formatCode = formatCode2;
|
|
19488
20124
|
return point;
|
|
@@ -19708,11 +20344,11 @@ var POINT = /* @__PURE__ */ new Set([
|
|
|
19708
20344
|
]);
|
|
19709
20345
|
function parseDataPoint(context, element2) {
|
|
19710
20346
|
reportUnmodelled(context, element2, POINT);
|
|
19711
|
-
const
|
|
20347
|
+
const index3 = cNumber(context, element2, "idx");
|
|
19712
20348
|
return assignDefined(
|
|
19713
20349
|
{},
|
|
19714
20350
|
{
|
|
19715
|
-
index:
|
|
20351
|
+
index: index3 !== void 0 && Number.isInteger(index3) && index3 >= 0 ? index3 : void 0,
|
|
19716
20352
|
invertIfNegative: cBool(context, element2, "invertIfNegative"),
|
|
19717
20353
|
bubble3D: cBool(context, element2, "bubble3D"),
|
|
19718
20354
|
explosion: cNumber(context, element2, "explosion"),
|
|
@@ -20249,8 +20885,8 @@ var SCHEME_INDEX = {
|
|
|
20249
20885
|
function legacyColor(color) {
|
|
20250
20886
|
if (color?.kind === "srgb") return color.value ? { rgb: color.value.toUpperCase() } : void 0;
|
|
20251
20887
|
if (color?.kind === "scheme") {
|
|
20252
|
-
const
|
|
20253
|
-
return
|
|
20888
|
+
const index3 = SCHEME_INDEX[color.value];
|
|
20889
|
+
return index3 === void 0 ? void 0 : { theme: index3 };
|
|
20254
20890
|
}
|
|
20255
20891
|
return void 0;
|
|
20256
20892
|
}
|
|
@@ -21187,14 +21823,14 @@ var PersonRegistry = class {
|
|
|
21187
21823
|
return `${XML_HEADER}<personList xmlns="${NS.tc}" xmlns:x="${NS.x}">${people}</personList>`;
|
|
21188
21824
|
}
|
|
21189
21825
|
};
|
|
21190
|
-
function vmlShape(comment,
|
|
21826
|
+
function vmlShape(comment, index3, id) {
|
|
21191
21827
|
const { row: row2, col } = comment.address;
|
|
21192
21828
|
const anchor = `${col + 1}, 15, ${Math.max(0, row2 - 1)}, 10, ${col + 3}, 15, ${row2 + 3}, 4`;
|
|
21193
|
-
return `<v:shape id="_x0000_s${id}" type="#_x0000_t202" style="position:absolute;margin-left:59.25pt;margin-top:1.5pt;width:108pt;height:59.25pt;z-index:${
|
|
21829
|
+
return `<v:shape id="_x0000_s${id}" type="#_x0000_t202" style="position:absolute;margin-left:59.25pt;margin-top:1.5pt;width:108pt;height:59.25pt;z-index:${index3 + 1};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto"><v:fill color2="#ffffe1"/><v:shadow on="t" color="black" obscured="t"/><v:path o:connecttype="none"/><v:textbox style="mso-direction-alt:auto"><div style="text-align:left"></div></v:textbox><x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${anchor}</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${row2}</x:Row><x:Column>${col}</x:Column></x:ClientData></v:shape>`;
|
|
21194
21830
|
}
|
|
21195
21831
|
var NOTE_SHAPETYPE = '<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>';
|
|
21196
21832
|
function vmlXml(comments, layout2) {
|
|
21197
|
-
const shapes = comments.map((comment,
|
|
21833
|
+
const shapes = comments.map((comment, index3) => vmlShape(comment, index3, layout2.ids[index3] ?? 0)).join("");
|
|
21198
21834
|
const data = layout2.blocks.join(",");
|
|
21199
21835
|
const base = layout2.base;
|
|
21200
21836
|
if (base && /<\/xml>\s*$/.test(base)) {
|
|
@@ -21225,8 +21861,8 @@ function commentParts(comments, sheetNumber, persons, sheetName, layout2) {
|
|
|
21225
21861
|
const id = guidFrom(`${sheetName}!${ref}:${comment.text}`);
|
|
21226
21862
|
const personId = persons.id(comment.author);
|
|
21227
21863
|
threaded += `<threadedComment ref="${ref}" personId="${personId}" id="${id}"><text>${escapeText2(comment.text)}</text></threadedComment>`;
|
|
21228
|
-
comment.replies.forEach((reply,
|
|
21229
|
-
const replyId = guidFrom(`${id}:reply:${
|
|
21864
|
+
comment.replies.forEach((reply, index3) => {
|
|
21865
|
+
const replyId = guidFrom(`${id}:reply:${index3}:${reply.text}`);
|
|
21230
21866
|
const dT = reply.date ? ` dT="${escapeAttr3(reply.date)}"` : "";
|
|
21231
21867
|
threaded += `<threadedComment ref="${ref}"${dT} personId="${persons.id(reply.author)}" id="${replyId}" parentId="${id}"><text>${escapeText2(reply.text)}</text></threadedComment>`;
|
|
21232
21868
|
});
|
|
@@ -21243,7 +21879,7 @@ Reply:
|
|
|
21243
21879
|
sorted2,
|
|
21244
21880
|
layout2 ?? {
|
|
21245
21881
|
blocks: [sheetNumber],
|
|
21246
|
-
ids: sorted2.map((_,
|
|
21882
|
+
ids: sorted2.map((_, index3) => 1024 * sheetNumber + index3 + 1)
|
|
21247
21883
|
}
|
|
21248
21884
|
);
|
|
21249
21885
|
const parts = { comments: commentsXml, vml };
|
|
@@ -21955,11 +22591,11 @@ var GRAY_VARIATIONS = [
|
|
|
21955
22591
|
{ tint: 8e4 }
|
|
21956
22592
|
];
|
|
21957
22593
|
var ACCENTS2 = ["accent1", "accent2", "accent3", "accent4", "accent5", "accent6"];
|
|
21958
|
-
function colorful(id,
|
|
21959
|
-
return { id, group: "colorful", index:
|
|
22594
|
+
function colorful(id, index3, base) {
|
|
22595
|
+
return { id, group: "colorful", index: index3, meth: "cycle", base, variations: COLORFUL_VARIATIONS };
|
|
21960
22596
|
}
|
|
21961
|
-
function mono(id,
|
|
21962
|
-
return { id, group: "monochromatic", index:
|
|
22597
|
+
function mono(id, index3, accent, meth) {
|
|
22598
|
+
return { id, group: "monochromatic", index: index3, meth, base: [accent], variations: [] };
|
|
21963
22599
|
}
|
|
21964
22600
|
var CHART_COLOR_PALETTES = [
|
|
21965
22601
|
colorful(10, 1, ACCENTS2),
|
|
@@ -22003,9 +22639,9 @@ function chartPaletteSeriesColorChoice(palette, i2, n2) {
|
|
|
22003
22639
|
const round3 = Math.floor(i2 / palette.base.length);
|
|
22004
22640
|
transform6 = (palette.variations.length ? palette.variations[round3 % palette.variations.length] : {}) ?? {};
|
|
22005
22641
|
} else {
|
|
22006
|
-
const
|
|
22642
|
+
const index3 = palette.meth === "withinLinearReversed" ? n2 - 1 - i2 : i2;
|
|
22007
22643
|
base = palette.base[0];
|
|
22008
|
-
transform6 = withinLinearTransform(
|
|
22644
|
+
transform6 = withinLinearTransform(index3, n2);
|
|
22009
22645
|
}
|
|
22010
22646
|
if (!base) throw new RangeError("A chart palette must have a base color");
|
|
22011
22647
|
return {
|
|
@@ -22054,18 +22690,18 @@ function chartColorPalettePatch(chart, id) {
|
|
|
22054
22690
|
const previous = findChartColorPalette(chart.colorPalette ?? 10);
|
|
22055
22691
|
if (!next) return void 0;
|
|
22056
22692
|
const radial = chart.chartType === "pie" || chart.chartType === "doughnut";
|
|
22057
|
-
const series = chart.series.map((series2,
|
|
22693
|
+
const series = chart.series.map((series2, index3) => {
|
|
22058
22694
|
const copy = structuredClone(series2);
|
|
22059
22695
|
if (!previous) return copy;
|
|
22060
|
-
const previousChoice = chartPaletteSeriesColorChoice(previous,
|
|
22061
|
-
const nextChoice = chartPaletteSeriesColorChoice(next,
|
|
22696
|
+
const previousChoice = chartPaletteSeriesColorChoice(previous, index3, chart.series.length);
|
|
22697
|
+
const nextChoice = chartPaletteSeriesColorChoice(next, index3, chart.series.length);
|
|
22062
22698
|
const fill = recolorGradient(copy.fill, previousChoice, nextChoice);
|
|
22063
22699
|
if (fill) copy.fill = fill;
|
|
22064
22700
|
if (sameChartColor(
|
|
22065
22701
|
series2.drawingColor,
|
|
22066
|
-
chartPaletteSeriesColorChoice(previous,
|
|
22702
|
+
chartPaletteSeriesColorChoice(previous, index3, chart.series.length)
|
|
22067
22703
|
)) {
|
|
22068
|
-
copy.drawingColor = chartPaletteSeriesColorChoice(next,
|
|
22704
|
+
copy.drawingColor = chartPaletteSeriesColorChoice(next, index3, chart.series.length);
|
|
22069
22705
|
delete copy.color;
|
|
22070
22706
|
}
|
|
22071
22707
|
if (radial && copy.pointColors) {
|
|
@@ -22173,8 +22809,8 @@ var DEFAULT_THEME_COLORS = [
|
|
|
22173
22809
|
"0563C1",
|
|
22174
22810
|
"954F72"
|
|
22175
22811
|
];
|
|
22176
|
-
function themeColor(theme2,
|
|
22177
|
-
const hex = theme2.colors[
|
|
22812
|
+
function themeColor(theme2, index3) {
|
|
22813
|
+
const hex = theme2.colors[index3] ?? DEFAULT_THEME_COLORS[index3];
|
|
22178
22814
|
return hex && parseArgbHex(hex) ? hex.replace(/^#/, "") : void 0;
|
|
22179
22815
|
}
|
|
22180
22816
|
|
|
@@ -22270,18 +22906,18 @@ function mixColors(a2, b, t, rounding = "nearest") {
|
|
|
22270
22906
|
}
|
|
22271
22907
|
|
|
22272
22908
|
// xlsx/edit/chart-series-target.ts
|
|
22273
|
-
function chartSeriesAt(chart,
|
|
22274
|
-
const target = isSeriesPosition(chart,
|
|
22275
|
-
if (!target) throw new RangeError(`No chart series at index ${String(
|
|
22909
|
+
function chartSeriesAt(chart, index3) {
|
|
22910
|
+
const target = isSeriesPosition(chart, index3) ? chart.series.find((_, position) => position === index3) : void 0;
|
|
22911
|
+
if (!target) throw new RangeError(`No chart series at index ${String(index3)}`);
|
|
22276
22912
|
return target;
|
|
22277
22913
|
}
|
|
22278
|
-
function cloneChartSeriesForEdit(chart,
|
|
22279
|
-
chartSeriesAt(chart,
|
|
22914
|
+
function cloneChartSeriesForEdit(chart, index3) {
|
|
22915
|
+
chartSeriesAt(chart, index3);
|
|
22280
22916
|
const series = structuredClone(chart.series);
|
|
22281
|
-
return { series, target: series.find((_, position) => position ===
|
|
22917
|
+
return { series, target: series.find((_, position) => position === index3) };
|
|
22282
22918
|
}
|
|
22283
|
-
function isSeriesPosition(chart,
|
|
22284
|
-
return typeof
|
|
22919
|
+
function isSeriesPosition(chart, index3) {
|
|
22920
|
+
return typeof index3 === "number" && Number.isSafeInteger(index3) && index3 >= 0 && index3 < chart.series.length;
|
|
22285
22921
|
}
|
|
22286
22922
|
|
|
22287
22923
|
// xlsx/edit/chart-series-fill.ts
|
|
@@ -22297,8 +22933,8 @@ function chartDrawingColor(color) {
|
|
|
22297
22933
|
if (!Number.isFinite(tint) || tint < -1 || tint > 1) return void 0;
|
|
22298
22934
|
return tint !== 0 ? withDrawingColorBrightness(choice, tint * 100) : choice;
|
|
22299
22935
|
}
|
|
22300
|
-
function chartSeriesFillPatch(chart,
|
|
22301
|
-
const current = chartSeriesAt(chart,
|
|
22936
|
+
function chartSeriesFillPatch(chart, index3, color) {
|
|
22937
|
+
const current = chartSeriesAt(chart, index3);
|
|
22302
22938
|
const choice = color === null ? void 0 : chartDrawingColor(color);
|
|
22303
22939
|
if (color !== null && !choice) throw new RangeError("Invalid chart fill color");
|
|
22304
22940
|
const previous = current.fill?.kind === "solid" ? current.fill.color : current.drawingColor;
|
|
@@ -22310,27 +22946,27 @@ function chartSeriesFillPatch(chart, index2, color) {
|
|
|
22310
22946
|
) ?? []
|
|
22311
22947
|
)
|
|
22312
22948
|
);
|
|
22313
|
-
return replaceSeriesPaint(chart,
|
|
22949
|
+
return replaceSeriesPaint(chart, index3, choice);
|
|
22314
22950
|
}
|
|
22315
|
-
function chartSeriesSolidFillPatch(chart,
|
|
22316
|
-
const current = chartSeriesAt(chart,
|
|
22951
|
+
function chartSeriesSolidFillPatch(chart, index3) {
|
|
22952
|
+
const current = chartSeriesAt(chart, index3);
|
|
22317
22953
|
if (!current.fill || current.fill.kind === "solid") return void 0;
|
|
22318
22954
|
const choice = current.fill.kind === "gradient" ? current.fill.stops[0]?.color : void 0;
|
|
22319
22955
|
return replaceSeriesPaint(
|
|
22320
22956
|
chart,
|
|
22321
|
-
|
|
22957
|
+
index3,
|
|
22322
22958
|
choice ?? current.drawingColor ?? chartDrawingColor(current.color) ?? chartPaletteSeriesColorChoice(
|
|
22323
22959
|
findChartColorPalette(chart.colorPalette ?? 10) ?? findChartColorPalette(10),
|
|
22324
|
-
|
|
22960
|
+
index3,
|
|
22325
22961
|
chart.series.length
|
|
22326
22962
|
)
|
|
22327
22963
|
);
|
|
22328
22964
|
}
|
|
22329
|
-
function replaceSeriesPaint(chart,
|
|
22330
|
-
const current = chartSeriesAt(chart,
|
|
22965
|
+
function replaceSeriesPaint(chart, index3, choice) {
|
|
22966
|
+
const current = chartSeriesAt(chart, index3);
|
|
22331
22967
|
if (!Object.keys(current.pointColors ?? {}).length && !Object.keys(current.pointFills ?? {}).length && (!choice ? current.fill?.kind === "none" : !current.fill && sameChartColor(current.drawingColor, choice)))
|
|
22332
22968
|
return void 0;
|
|
22333
|
-
const { series, target: next } = cloneChartSeriesForEdit(chart,
|
|
22969
|
+
const { series, target: next } = cloneChartSeriesForEdit(chart, index3);
|
|
22334
22970
|
delete next.fill;
|
|
22335
22971
|
delete next.color;
|
|
22336
22972
|
delete next.drawingColor;
|
|
@@ -22474,18 +23110,18 @@ var PackageWriter = class {
|
|
|
22474
23110
|
var rank2 = (name) => name === "_rels/.rels" ? 0 : name.startsWith("docProps/") ? 1 : name === "xl/workbook.xml" ? 2 : 3;
|
|
22475
23111
|
|
|
22476
23112
|
// xlsx/write/chart-colors.ts
|
|
22477
|
-
function chartSeriesFill(chart, series,
|
|
23113
|
+
function chartSeriesFill(chart, series, index3) {
|
|
22478
23114
|
const imported = series.fill && drawingFillXml(series.fill);
|
|
22479
23115
|
if (imported) return imported;
|
|
22480
|
-
return `<a:solidFill>${drawingColorXml(chartSeriesColor(chart, series,
|
|
23116
|
+
return `<a:solidFill>${drawingColorXml(chartSeriesColor(chart, series, index3))}</a:solidFill>`;
|
|
22481
23117
|
}
|
|
22482
|
-
function chartSeriesDrawingFill(chart, series,
|
|
23118
|
+
function chartSeriesDrawingFill(chart, series, index3) {
|
|
22483
23119
|
if (series.fill && drawingFillXml(series.fill)) return series.fill;
|
|
22484
|
-
return { kind: "solid", color: chartSeriesColor(chart, series,
|
|
23120
|
+
return { kind: "solid", color: chartSeriesColor(chart, series, index3) };
|
|
22485
23121
|
}
|
|
22486
|
-
function chartSeriesColor(chart, series,
|
|
23122
|
+
function chartSeriesColor(chart, series, index3) {
|
|
22487
23123
|
const palette = findChartColorPalette(chart.colorPalette ?? 10);
|
|
22488
|
-
return series.drawingColor ?? chartDrawingColor(series.color) ?? chartPaletteSeriesColorChoice(palette ?? findChartColorPalette(10),
|
|
23124
|
+
return series.drawingColor ?? chartDrawingColor(series.color) ?? chartPaletteSeriesColorChoice(palette ?? findChartColorPalette(10), index3, chart.series.length);
|
|
22489
23125
|
}
|
|
22490
23126
|
function recolorMarker(marker3, previous, next) {
|
|
22491
23127
|
for (const paint of [marker3, first(marker3, "ln", NS.a)]) {
|
|
@@ -22503,10 +23139,10 @@ function patchChartColors(doc, chartNode, model, before) {
|
|
|
22503
23139
|
const palette = findChartColorPalette(model.colorPalette ?? 10);
|
|
22504
23140
|
const lineLike = ["line", "scatter", "radar"].includes(model.chartType);
|
|
22505
23141
|
const markerOnly = model.chartType === "scatter" && first(plot2, "scatterStyle", NS.c)?.getAttribute("val") === "marker";
|
|
22506
|
-
children(plot2, "ser", NS.c).forEach((ser,
|
|
22507
|
-
const series = model.series[
|
|
23142
|
+
children(plot2, "ser", NS.c).forEach((ser, index3) => {
|
|
23143
|
+
const series = model.series[index3];
|
|
22508
23144
|
if (!series) return;
|
|
22509
|
-
const old = before.series[
|
|
23145
|
+
const old = before.series[index3];
|
|
22510
23146
|
if (old?.effectsXml !== series.effectsXml) {
|
|
22511
23147
|
let shape2 = first(ser, "spPr", NS.c);
|
|
22512
23148
|
if (!shape2 && series.effectsXml) {
|
|
@@ -22552,12 +23188,12 @@ function patchChartColors(doc, chartNode, model, before) {
|
|
|
22552
23188
|
paint = doc.createElementNS(NS.a, "a:ln");
|
|
22553
23189
|
spPr.appendChild(paint);
|
|
22554
23190
|
}
|
|
22555
|
-
setDrawingFillXml(paint, chartSeriesFill(model, series,
|
|
23191
|
+
setDrawingFillXml(paint, chartSeriesFill(model, series, index3));
|
|
22556
23192
|
}
|
|
22557
23193
|
if (previousPalette && palette && before.colorPalette !== model.colorPalette) {
|
|
22558
23194
|
const marker3 = first(first(ser, "marker", NS.c), "spPr", NS.c);
|
|
22559
|
-
const previous = chartPaletteSeriesColorChoice(previousPalette,
|
|
22560
|
-
const next = chartPaletteSeriesColorChoice(palette,
|
|
23195
|
+
const previous = chartPaletteSeriesColorChoice(previousPalette, index3, model.series.length);
|
|
23196
|
+
const next = chartPaletteSeriesColorChoice(palette, index3, model.series.length);
|
|
22561
23197
|
recolorMarker(marker3, previous, next);
|
|
22562
23198
|
for (const point of children(ser, "dPt", NS.c))
|
|
22563
23199
|
recolorMarker(first(first(point, "marker", NS.c), "spPr", NS.c), previous, next);
|
|
@@ -22652,7 +23288,7 @@ var FIRST_AXIS = 500000001;
|
|
|
22652
23288
|
var SECOND_AXIS = 500000002;
|
|
22653
23289
|
function source(kind, formula, values2) {
|
|
22654
23290
|
const points = values2.flatMap(
|
|
22655
|
-
(value2,
|
|
23291
|
+
(value2, index3) => value2 === null || value2 === "" ? [] : [{ index: index3, value: String(value2) }]
|
|
22656
23292
|
);
|
|
22657
23293
|
return {
|
|
22658
23294
|
kind: formula ? kind === "str" ? "strRef" : "numRef" : kind === "str" ? "strLit" : "numLit",
|
|
@@ -22685,9 +23321,9 @@ function dataPoints(series) {
|
|
|
22685
23321
|
return /^\d+$/.test(key) && paint ? [{ index: Number(key), spPr: { fill: paint } }] : [];
|
|
22686
23322
|
});
|
|
22687
23323
|
}
|
|
22688
|
-
function seriesModel(chart, series,
|
|
23324
|
+
function seriesModel(chart, series, index3) {
|
|
22689
23325
|
const type = chart.chartType;
|
|
22690
|
-
const out = { index:
|
|
23326
|
+
const out = { index: index3, order: index3, dataPoints: dataPoints(series) };
|
|
22691
23327
|
if (series.nameRef)
|
|
22692
23328
|
out.tx = {
|
|
22693
23329
|
reference: source("str", series.nameRef, series.name === void 0 ? [] : [series.name])
|
|
@@ -22696,7 +23332,7 @@ function seriesModel(chart, series, index2) {
|
|
|
22696
23332
|
const lineLike = type === "line" || type === "scatter" || type === "radar";
|
|
22697
23333
|
const effectsXml = effects(series);
|
|
22698
23334
|
if (type !== "pie" && type !== "doughnut" || series.fill || series.color || series.drawingColor || effectsXml) {
|
|
22699
|
-
const fill = chartSeriesDrawingFill(chart, series,
|
|
23335
|
+
const fill = chartSeriesDrawingFill(chart, series, index3);
|
|
22700
23336
|
const shape2 = lineLike ? { line: { widthEmu: 28575, cap: "rnd", fill } } : { fill };
|
|
22701
23337
|
if (effectsXml) shape2.effectsXml = effectsXml;
|
|
22702
23338
|
out.spPr = shape2;
|
|
@@ -22820,7 +23456,7 @@ function style(chart) {
|
|
|
22820
23456
|
return id > 100 ? { c14Style: id, style: id - 100 } : { style: id };
|
|
22821
23457
|
}
|
|
22822
23458
|
function chartSpaceFromObject(chart) {
|
|
22823
|
-
const series = chart.series.map((entry3,
|
|
23459
|
+
const series = chart.series.map((entry3, index3) => seriesModel(chart, entry3, index3));
|
|
22824
23460
|
const [group, chartAxes] = plot(chart, series);
|
|
22825
23461
|
const space = {
|
|
22826
23462
|
roundedCorners: false,
|
|
@@ -22861,8 +23497,8 @@ function patchChartReferences(xml, chart) {
|
|
|
22861
23497
|
changed = true;
|
|
22862
23498
|
}
|
|
22863
23499
|
};
|
|
22864
|
-
children(plot2, "ser", NS.c).forEach((ser,
|
|
22865
|
-
const model = chart.series[
|
|
23500
|
+
children(plot2, "ser", NS.c).forEach((ser, index3) => {
|
|
23501
|
+
const model = chart.series[index3];
|
|
22866
23502
|
if (!model) return;
|
|
22867
23503
|
setRef(first(ser, "tx", NS.c), model.nameRef);
|
|
22868
23504
|
setRef(first(ser, "cat", NS.c) ?? first(ser, "xVal", NS.c), model.categoriesRef);
|
|
@@ -23169,14 +23805,14 @@ function shiftSpan(start, end, shift2) {
|
|
|
23169
23805
|
const e = end >= max ? max : end < at ? end : end > last ? end - n2 : at - 1;
|
|
23170
23806
|
return s > e ? void 0 : { start: s, end: e };
|
|
23171
23807
|
}
|
|
23172
|
-
function shiftIndex(
|
|
23808
|
+
function shiftIndex(index3, shift2) {
|
|
23173
23809
|
const { at, count: count2 } = shift2;
|
|
23174
|
-
if (
|
|
23175
|
-
if (count2 > 0) return
|
|
23176
|
-
return
|
|
23810
|
+
if (index3 < at) return index3;
|
|
23811
|
+
if (count2 > 0) return index3 + count2 > axisMax(shift2.axis) ? void 0 : index3 + count2;
|
|
23812
|
+
return index3 < at - count2 ? void 0 : index3 + count2;
|
|
23177
23813
|
}
|
|
23178
|
-
function shiftIndexClamped(
|
|
23179
|
-
const moved = shiftIndex(
|
|
23814
|
+
function shiftIndexClamped(index3, shift2) {
|
|
23815
|
+
const moved = shiftIndex(index3, shift2);
|
|
23180
23816
|
if (moved !== void 0) return moved;
|
|
23181
23817
|
return shift2.count > 0 ? axisMax(shift2.axis) : shift2.at;
|
|
23182
23818
|
}
|
|
@@ -23667,9 +24303,9 @@ function readSourceStyles(xml) {
|
|
|
23667
24303
|
(node) => inlineFragment(outerXml(node))
|
|
23668
24304
|
);
|
|
23669
24305
|
const dxfKeys = /* @__PURE__ */ new Map();
|
|
23670
|
-
parseStyles(xml, []).dxfs.forEach((dxf,
|
|
24306
|
+
parseStyles(xml, []).dxfs.forEach((dxf, index3) => {
|
|
23671
24307
|
const key = styleKey(dxf);
|
|
23672
|
-
if (!dxfKeys.has(key)) dxfKeys.set(key,
|
|
24308
|
+
if (!dxfKeys.has(key)) dxfKeys.set(key, index3);
|
|
23673
24309
|
});
|
|
23674
24310
|
const result2 = { numFmts, dxfXml, dxfKeys };
|
|
23675
24311
|
const tableStyles = xFirst(root, "tableStyles");
|
|
@@ -23777,7 +24413,7 @@ var StyleWriter = class {
|
|
|
23777
24413
|
});
|
|
23778
24414
|
const seen = /* @__PURE__ */ new Set();
|
|
23779
24415
|
const unique2 = named2.filter((entry3) => !seen.has(entry3.name) && seen.add(entry3.name));
|
|
23780
|
-
const xfIdOf = new Map(unique2.map((entry3,
|
|
24416
|
+
const xfIdOf = new Map(unique2.map((entry3, index3) => [entry3.name, index3]));
|
|
23781
24417
|
const base = this.workbook.styles[0] ?? defaultCellStyle();
|
|
23782
24418
|
this.fonts.id(fontXml(base.font));
|
|
23783
24419
|
this.borders.id(borderXml({}));
|
|
@@ -23786,7 +24422,7 @@ var StyleWriter = class {
|
|
|
23786
24422
|
(style2) => this.xf(style2, xfIdOf.get(style2.cellStyleName ?? "Normal") ?? 0)
|
|
23787
24423
|
);
|
|
23788
24424
|
const cellStyles = unique2.map(
|
|
23789
|
-
(entry3,
|
|
24425
|
+
(entry3, index3) => el("cellStyle", { name: entry3.name, xfId: index3, builtinId: entry3.builtinId })
|
|
23790
24426
|
);
|
|
23791
24427
|
const custom = [...this.numFmts].filter(([code]) => builtinFormatIdOf(code) === void 0).sort((a2, b) => a2[1] - b[1]);
|
|
23792
24428
|
let out = `${XML_HEADER}<styleSheet xmlns="${NS.x}" xmlns:mc="${NS.mc}" mc:Ignorable="x14ac" xmlns:x14ac="${NS.x14ac}">`;
|
|
@@ -23951,13 +24587,13 @@ function definedNamesOf(workbook) {
|
|
|
23951
24587
|
const names = workbook.definedNames.filter(
|
|
23952
24588
|
(name) => name.name && (name.localSheet === void 0 || name.localSheet >= 0 && name.localSheet < workbook.sheets.length)
|
|
23953
24589
|
);
|
|
23954
|
-
workbook.sheets.forEach((sheet,
|
|
24590
|
+
workbook.sheets.forEach((sheet, index3) => {
|
|
23955
24591
|
const area = sheet.pageSetup?.printArea;
|
|
23956
|
-
if (!area || names.some((n2) => n2.name === "_xlnm.Print_Area" && n2.localSheet ===
|
|
24592
|
+
if (!area || names.some((n2) => n2.name === "_xlnm.Print_Area" && n2.localSheet === index3)) return;
|
|
23957
24593
|
names.push({
|
|
23958
24594
|
name: "_xlnm.Print_Area",
|
|
23959
24595
|
formula: `${quoteSheetName(sheet.name)}!${absoluteRange(area)}`,
|
|
23960
|
-
localSheet:
|
|
24596
|
+
localSheet: index3
|
|
23961
24597
|
});
|
|
23962
24598
|
});
|
|
23963
24599
|
return names;
|
|
@@ -24402,8 +25038,8 @@ function extent(values2) {
|
|
|
24402
25038
|
function sparklineValues(group, values2) {
|
|
24403
25039
|
return group.displayEmptyCellsAs === "zero" ? values2.map((v) => v ?? 0) : [...values2];
|
|
24404
25040
|
}
|
|
24405
|
-
function sparklineScale(group, all2,
|
|
24406
|
-
const own = extent(sparklineValues(group, all2[
|
|
25041
|
+
function sparklineScale(group, all2, index3) {
|
|
25042
|
+
const own = extent(sparklineValues(group, all2[index3]?.values ?? []));
|
|
24407
25043
|
const needsGroup = group.minAxisType === "group" || group.maxAxisType === "group";
|
|
24408
25044
|
const shared = needsGroup ? extent(all2.flatMap((data) => sparklineValues(group, data.values))) : void 0;
|
|
24409
25045
|
const end = (type, manual, key) => {
|
|
@@ -24521,17 +25157,17 @@ var MAX_POINTS = 1e4;
|
|
|
24521
25157
|
var hostIndex = /* @__PURE__ */ new WeakMap();
|
|
24522
25158
|
function hosts(sheet) {
|
|
24523
25159
|
const groups = sheetSparklineGroups(sheet);
|
|
24524
|
-
let
|
|
24525
|
-
if (!
|
|
24526
|
-
|
|
25160
|
+
let index3 = hostIndex.get(groups);
|
|
25161
|
+
if (!index3) {
|
|
25162
|
+
index3 = /* @__PURE__ */ new Map();
|
|
24527
25163
|
for (const group of groups)
|
|
24528
25164
|
group.sparklines.forEach((line3, i2) => {
|
|
24529
25165
|
const key = cellKey(line3.host.start.row, line3.host.start.col);
|
|
24530
|
-
if (!
|
|
25166
|
+
if (!index3.has(key)) index3.set(key, { group, index: i2 });
|
|
24531
25167
|
});
|
|
24532
|
-
hostIndex.set(groups,
|
|
25168
|
+
hostIndex.set(groups, index3);
|
|
24533
25169
|
}
|
|
24534
|
-
return
|
|
25170
|
+
return index3;
|
|
24535
25171
|
}
|
|
24536
25172
|
function hasSparklineAt(sheet, row2, col) {
|
|
24537
25173
|
return hosts(sheet).has(cellKey(row2, col));
|
|
@@ -24597,10 +25233,10 @@ function sparklineViewAt(workbook, sheetIndex2, row2, col) {
|
|
|
24597
25233
|
if (!sheet) return void 0;
|
|
24598
25234
|
const entry3 = hosts(sheet).get(cellKey(row2, col));
|
|
24599
25235
|
if (!entry3) return void 0;
|
|
24600
|
-
const { group, index:
|
|
25236
|
+
const { group, index: index3 } = entry3;
|
|
24601
25237
|
const needsGroup = group.minAxisType === "group" || group.maxAxisType === "group";
|
|
24602
|
-
const data = needsGroup ? groupData(workbook, sheet, group) : groupData(workbook, sheet, { ...group, sparklines: [group.sparklines[
|
|
24603
|
-
const at = needsGroup ?
|
|
25238
|
+
const data = needsGroup ? groupData(workbook, sheet, group) : groupData(workbook, sheet, { ...group, sparklines: [group.sparklines[index3]] });
|
|
25239
|
+
const at = needsGroup ? index3 : 0;
|
|
24604
25240
|
return sparklineView(
|
|
24605
25241
|
group,
|
|
24606
25242
|
data[at] ?? { values: [] },
|
|
@@ -24765,9 +25401,9 @@ function sourceColumnsForPatch(root, table2, names) {
|
|
|
24765
25401
|
const byName = new Map(source2.map((c2) => [(c2.getAttribute("name") ?? "").toLowerCase(), c2]));
|
|
24766
25402
|
const tracked = table2.partName !== void 0 || table2.columns.some((c2) => c2.sourceId !== void 0);
|
|
24767
25403
|
const used = /* @__PURE__ */ new Set();
|
|
24768
|
-
return names.map((name,
|
|
24769
|
-
const id = table2.columns[
|
|
24770
|
-
const match2 = id !== void 0 ? byId2.get(id) : tracked ? void 0 : source2.length === names.length ? source2[
|
|
25404
|
+
return names.map((name, index3) => {
|
|
25405
|
+
const id = table2.columns[index3]?.sourceId;
|
|
25406
|
+
const match2 = id !== void 0 ? byId2.get(id) : tracked ? void 0 : source2.length === names.length ? source2[index3] : byName.get(name.toLowerCase());
|
|
24771
25407
|
if (!match2 || used.has(match2)) return void 0;
|
|
24772
25408
|
used.add(match2);
|
|
24773
25409
|
return match2;
|
|
@@ -24784,12 +25420,12 @@ function patchAutoFilter(doc, root, table2, before, names) {
|
|
|
24784
25420
|
filter2.setAttribute("ref", formatRange(range));
|
|
24785
25421
|
const list = xKid(root, "tableColumns");
|
|
24786
25422
|
const original = list ? xKids(list, "tableColumn") : [];
|
|
24787
|
-
const current = new Map(sourceColumnsForPatch(root, table2, names).map((c2,
|
|
25423
|
+
const current = new Map(sourceColumnsForPatch(root, table2, names).map((c2, index3) => [c2, index3]));
|
|
24788
25424
|
for (const column of xKids(filter2, "filterColumn")) {
|
|
24789
25425
|
const old = original[Number(column.getAttribute("colId") ?? "0")];
|
|
24790
|
-
const
|
|
24791
|
-
if (
|
|
24792
|
-
else column.setAttribute("colId", num2(
|
|
25426
|
+
const index3 = old ? current.get(old) : void 0;
|
|
25427
|
+
if (index3 === void 0) filter2.removeChild(column);
|
|
25428
|
+
else column.setAttribute("colId", num2(index3));
|
|
24793
25429
|
}
|
|
24794
25430
|
if (!existing) insertBefore(root, filter2, ["sortState", "tableColumns"]);
|
|
24795
25431
|
const sort2 = xKid(filter2, "sortState") ?? xKid(root, "sortState");
|
|
@@ -24834,11 +25470,11 @@ function patchColumns(doc, root, sheet, table2, names) {
|
|
|
24834
25470
|
for (const column of sourceColumns) list.removeChild(column);
|
|
24835
25471
|
let nextId = Math.max(0, ...ids) + 1;
|
|
24836
25472
|
const totalsRow = table2.range.end.row;
|
|
24837
|
-
names.forEach((name,
|
|
24838
|
-
const column = picked[
|
|
25473
|
+
names.forEach((name, index3) => {
|
|
25474
|
+
const column = picked[index3] ?? doc.createElementNS(NS.x, "tableColumn");
|
|
24839
25475
|
if (!column.getAttribute("id")) column.setAttribute("id", num2(nextId++));
|
|
24840
25476
|
column.setAttribute("name", name);
|
|
24841
|
-
const model = table2.columns[
|
|
25477
|
+
const model = table2.columns[index3];
|
|
24842
25478
|
const fn = table2.totalsRow ? model?.totalsRowFunction : void 0;
|
|
24843
25479
|
setOrRemove(column, "totalsRowFunction", fn);
|
|
24844
25480
|
setOrRemove(column, "totalsRowLabel", table2.totalsRow ? model?.totalsRowLabel : void 0);
|
|
@@ -24852,7 +25488,7 @@ function patchColumns(doc, root, sheet, table2, names) {
|
|
|
24852
25488
|
);
|
|
24853
25489
|
if (fn !== "custom") setChildText(doc, column, "totalsRowFormula", void 0, []);
|
|
24854
25490
|
else {
|
|
24855
|
-
const cellFormula = sheet.rows.get(totalsRow)?.get(table2.range.start.col +
|
|
25491
|
+
const cellFormula = sheet.rows.get(totalsRow)?.get(table2.range.start.col + index3)?.formula;
|
|
24856
25492
|
if (cellFormula)
|
|
24857
25493
|
setChildText(
|
|
24858
25494
|
doc,
|
|
@@ -24933,11 +25569,11 @@ function tableXml(table2, id, names) {
|
|
|
24933
25569
|
const range = formatRange(table2.range);
|
|
24934
25570
|
const filterEnd = { ...table2.range.end, row: table2.range.end.row - (table2.totalsRow ? 1 : 0) };
|
|
24935
25571
|
const filter2 = table2.headerRow && !table2.totalsRow ? `<autoFilter ref="${range}"/>` : table2.headerRow ? `<autoFilter ref="${formatRange({ start: table2.range.start, end: filterEnd })}"/>` : "";
|
|
24936
|
-
const columns = names.map((name,
|
|
24937
|
-
const column = table2.columns[
|
|
25572
|
+
const columns = names.map((name, index3) => {
|
|
25573
|
+
const column = table2.columns[index3];
|
|
24938
25574
|
const calculated = column?.calculatedColumnFormula ? `<calculatedColumnFormula>${escapeText2(addFuturePrefixes(column.calculatedColumnFormula))}</calculatedColumnFormula>` : "";
|
|
24939
25575
|
const values2 = attrs({
|
|
24940
|
-
id:
|
|
25576
|
+
id: index3 + 1,
|
|
24941
25577
|
name,
|
|
24942
25578
|
totalsRowFunction: table2.totalsRow ? column?.totalsRowFunction : void 0,
|
|
24943
25579
|
totalsRowLabel: table2.totalsRow ? column?.totalsRowLabel : void 0
|
|
@@ -24976,27 +25612,27 @@ function totalsRowFormulas(sheet, table2, names) {
|
|
|
24976
25612
|
const out = /* @__PURE__ */ new Map();
|
|
24977
25613
|
if (!table2.totalsRow) return out;
|
|
24978
25614
|
const row2 = table2.range.end.row;
|
|
24979
|
-
names.forEach((name,
|
|
24980
|
-
const code = SUBTOTAL_CODES[table2.columns[
|
|
25615
|
+
names.forEach((name, index3) => {
|
|
25616
|
+
const code = SUBTOTAL_CODES[table2.columns[index3]?.totalsRowFunction ?? ""];
|
|
24981
25617
|
if (code === void 0) return;
|
|
24982
|
-
const col = table2.range.start.col +
|
|
25618
|
+
const col = table2.range.start.col + index3;
|
|
24983
25619
|
const escaped = name.replace(/['#[\]]/g, "'$&");
|
|
24984
25620
|
const formula = `SUBTOTAL(${code},${table2.displayName || table2.name}[${escaped}])`;
|
|
24985
25621
|
if (sheet.rows.get(row2)?.get(col)?.formula !== formula) out.set(`${row2}:${col}`, formula);
|
|
24986
25622
|
});
|
|
24987
25623
|
return out;
|
|
24988
25624
|
}
|
|
24989
|
-
function resolveTableNames(table2, before,
|
|
25625
|
+
function resolveTableNames(table2, before, index3) {
|
|
24990
25626
|
const display = table2.displayName || table2.name;
|
|
24991
|
-
const displayName = before && before.displayName === display ? display : safeTableName(display,
|
|
24992
|
-
const name = before && before.name === table2.name ? table2.name : table2.name === display ? displayName : safeTableName(table2.name,
|
|
25627
|
+
const displayName = before && before.displayName === display ? display : safeTableName(display, index3);
|
|
25628
|
+
const name = before && before.name === table2.name ? table2.name : table2.name === display ? displayName : safeTableName(table2.name, index3);
|
|
24993
25629
|
return { name, displayName };
|
|
24994
25630
|
}
|
|
24995
|
-
function safeTableName(name,
|
|
25631
|
+
function safeTableName(name, index3) {
|
|
24996
25632
|
const valid = /^[A-Za-z_\\][A-Za-z0-9_.\\]*$/.test(name) && !/^[A-Za-z]{1,3}\d+$/.test(name) && !/^[RrCc]$/.test(name) && !/^[Rr]\d*[Cc]\d*$/.test(name) && name.length <= 255;
|
|
24997
25633
|
if (valid) return name;
|
|
24998
25634
|
const cleaned = name.replace(/[^A-Za-z0-9_.]/g, "_");
|
|
24999
|
-
return `Table_${cleaned ||
|
|
25635
|
+
return `Table_${cleaned || index3}`;
|
|
25000
25636
|
}
|
|
25001
25637
|
|
|
25002
25638
|
// xlsx/write/sheet-parts.ts
|
|
@@ -25009,7 +25645,7 @@ function sourceRelIds(source2, partName) {
|
|
|
25009
25645
|
if (legacy) out.legacy = legacy;
|
|
25010
25646
|
return out;
|
|
25011
25647
|
}
|
|
25012
|
-
function writeComments(ctx, sheet,
|
|
25648
|
+
function writeComments(ctx, sheet, index3, partName, rels) {
|
|
25013
25649
|
const { writer, source: source2 } = ctx;
|
|
25014
25650
|
const name = (pattern) => writer.uniqueName(pattern, ctx.reserved);
|
|
25015
25651
|
const fromSource = source2 && sheet.partName && source2.has(sheet.partName);
|
|
@@ -25054,8 +25690,8 @@ function writeComments(ctx, sheet, index2, partName, rels) {
|
|
|
25054
25690
|
}
|
|
25055
25691
|
}
|
|
25056
25692
|
const own = base ? vmlIdmapBlocks(base) : [];
|
|
25057
|
-
const layout2 = vmlAllocatorFor(ctx, source2).allocate(sheet.comments.length,
|
|
25058
|
-
const parts = commentParts(sheet.comments,
|
|
25693
|
+
const layout2 = vmlAllocatorFor(ctx, source2).allocate(sheet.comments.length, index3 + 1, own);
|
|
25694
|
+
const parts = commentParts(sheet.comments, index3 + 1, ctx.persons, sheet.name, {
|
|
25059
25695
|
...layout2,
|
|
25060
25696
|
...base ? { base } : {}
|
|
25061
25697
|
});
|
|
@@ -25077,11 +25713,11 @@ function sourceVmlPart(source2, sheetPart) {
|
|
|
25077
25713
|
}
|
|
25078
25714
|
function writeTables(ctx, sheet, partName, rels, headerText, formulas) {
|
|
25079
25715
|
const ids = [];
|
|
25080
|
-
for (const [
|
|
25716
|
+
for (const [index3, original] of sheet.tables.entries()) {
|
|
25081
25717
|
const { writer, source: source2 } = ctx;
|
|
25082
25718
|
const sourceXml = original.partName ? source2?.text(original.partName) : void 0;
|
|
25083
25719
|
const before = sourceXml && original.partName ? parseTable(sourceXml, original.partName) : void 0;
|
|
25084
|
-
const { name, displayName } = resolveTableNames(original, before,
|
|
25720
|
+
const { name, displayName } = resolveTableNames(original, before, index3 + 1);
|
|
25085
25721
|
const table2 = name === original.name && displayName === original.displayName ? original : { ...original, name, displayName };
|
|
25086
25722
|
const { names, headerText: forced } = resolveTableColumns(sheet, table2);
|
|
25087
25723
|
for (const [key, text3] of forced) headerText.set(key, text3);
|
|
@@ -25363,7 +25999,7 @@ var REGENERATED = /* @__PURE__ */ new Set([
|
|
|
25363
25999
|
]);
|
|
25364
26000
|
var NS_XR2 = "http://schemas.microsoft.com/office/spreadsheetml/2015/revision2";
|
|
25365
26001
|
var NS_XR3 = "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3";
|
|
25366
|
-
function writeWorksheet(ctx, sheet,
|
|
26002
|
+
function writeWorksheet(ctx, sheet, index3, partName) {
|
|
25367
26003
|
const { writer, source: source2 } = ctx;
|
|
25368
26004
|
const rels = new RelationshipSet();
|
|
25369
26005
|
let sourceDrawing;
|
|
@@ -25386,7 +26022,7 @@ function writeWorksheet(ctx, sheet, index2, partName) {
|
|
|
25386
26022
|
const tableParts = writeTables(ctx, sheet, partName, rels, headerText, formulas);
|
|
25387
26023
|
blocks.set("sheetPr", sheetPrXml(sheet));
|
|
25388
26024
|
blocks.set("dimension", dimensionXml(sheet));
|
|
25389
|
-
blocks.set("sheetViews", sheetViewsXml(sheet,
|
|
26025
|
+
blocks.set("sheetViews", sheetViewsXml(sheet, index3 === ctx.workbook.activeSheet));
|
|
25390
26026
|
blocks.set("sheetFormatPr", sheetFormatXml(sheet));
|
|
25391
26027
|
blocks.set("cols", colsXml(sheet, ctx.workbook.styles.length));
|
|
25392
26028
|
blocks.set(
|
|
@@ -25425,7 +26061,7 @@ function writeWorksheet(ctx, sheet, index2, partName) {
|
|
|
25425
26061
|
);
|
|
25426
26062
|
blocks.set("headerFooter", page.headerFooter);
|
|
25427
26063
|
blocks.set("drawing", writeSheetDrawing(ctx, sheet, partName, rels, sourceDrawing));
|
|
25428
|
-
blocks.set("legacyDrawing", writeComments(ctx, sheet,
|
|
26064
|
+
blocks.set("legacyDrawing", writeComments(ctx, sheet, index3, partName, rels));
|
|
25429
26065
|
blocks.set("tableParts", tableParts);
|
|
25430
26066
|
ctx.pivots?.writeSheet(writer, sheet, partName, rels);
|
|
25431
26067
|
blocks.set("extLst", conditionalExtensionsXml(sheet));
|
|
@@ -25450,12 +26086,12 @@ function pivotCacheData(pivot) {
|
|
|
25450
26086
|
const items = pivot.fields.map(() => []);
|
|
25451
26087
|
const indices = pivot.fields.map(() => /* @__PURE__ */ new Map());
|
|
25452
26088
|
for (const record of pivot.records)
|
|
25453
|
-
pivot.fields.forEach((_field,
|
|
25454
|
-
const value2 = record[
|
|
26089
|
+
pivot.fields.forEach((_field, index3) => {
|
|
26090
|
+
const value2 = record[index3] ?? null;
|
|
25455
26091
|
const key = pivotValueKey(value2);
|
|
25456
|
-
if (!indices[
|
|
25457
|
-
indices[
|
|
25458
|
-
items[
|
|
26092
|
+
if (!indices[index3].has(key)) {
|
|
26093
|
+
indices[index3].set(key, items[index3].length);
|
|
26094
|
+
items[index3].push(value2);
|
|
25459
26095
|
}
|
|
25460
26096
|
});
|
|
25461
26097
|
return { items, indices };
|
|
@@ -25470,8 +26106,8 @@ function valueXml(value2) {
|
|
|
25470
26106
|
}
|
|
25471
26107
|
function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
|
|
25472
26108
|
const source2 = sparklineDataRange(workbook, 0, pivot.source);
|
|
25473
|
-
const fields = pivot.fields.map((name,
|
|
25474
|
-
const items = data.items[
|
|
26109
|
+
const fields = pivot.fields.map((name, index3) => {
|
|
26110
|
+
const items = data.items[index3];
|
|
25475
26111
|
const types = new Set(
|
|
25476
26112
|
items.map((value2) => value2 === null || value2 === "" ? "blank" : typeof value2)
|
|
25477
26113
|
);
|
|
@@ -25483,7 +26119,7 @@ function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
|
|
|
25483
26119
|
}
|
|
25484
26120
|
function pivotCacheRecordsXml(pivot, data) {
|
|
25485
26121
|
const records = pivot.records.map(
|
|
25486
|
-
(record) => `<r>${pivot.fields.map((_field,
|
|
26122
|
+
(record) => `<r>${pivot.fields.map((_field, index3) => `<x v="${data.indices[index3].get(pivotValueKey(record[index3] ?? null))}"/>`).join("")}</r>`
|
|
25487
26123
|
).join("");
|
|
25488
26124
|
return `${XML_HEADER}<pivotCacheRecords xmlns="${NS.x}" count="${pivot.records.length}">${records}</pivotCacheRecords>`;
|
|
25489
26125
|
}
|
|
@@ -25493,45 +26129,87 @@ function pivotTableXml(pivot, cacheId, cache3) {
|
|
|
25493
26129
|
const grid = pivotGrid(pivot);
|
|
25494
26130
|
const row2 = pivot.fields.indexOf(pivot.rowField);
|
|
25495
26131
|
const second = pivot.secondRowField ? pivot.fields.indexOf(pivot.secondRowField) : -1;
|
|
26132
|
+
const page = pivot.pageFilter ? pivot.fields.indexOf(pivot.pageFilter.field) : -1;
|
|
26133
|
+
const pageItems = page >= 0 ? pivotItems(pivot, pivot.pageFilter.field) : [];
|
|
26134
|
+
const axisItems = (field, visible) => page >= 0 ? pivotItems(pivot, field) : visible;
|
|
26135
|
+
const rowItemsFull = axisItems(pivot.rowField, grid.rowItems);
|
|
26136
|
+
const secondRowItemsFull = pivot.secondRowField ? axisItems(pivot.secondRowField, grid.secondRowItems) : [];
|
|
26137
|
+
const columnItemsFull = pivot.columnField ? axisItems(pivot.columnField, grid.columnItems) : [];
|
|
26138
|
+
const itemIndices = (visible, full) => {
|
|
26139
|
+
const indices = new Map(full.map((item, index3) => [pivotValueKey(item), index3]));
|
|
26140
|
+
return visible.map((v) => indices.get(pivotValueKey(v)));
|
|
26141
|
+
};
|
|
26142
|
+
const rowIndicesFull = itemIndices(grid.rowItems, rowItemsFull), secondRowIndicesFull = itemIndices(grid.secondRowItems ?? [], secondRowItemsFull), columnIndicesFull = itemIndices(grid.columnItems, columnItemsFull);
|
|
26143
|
+
const rowEntries = page >= 0 && grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, [rowIndicesFull, secondRowIndicesFull]) : grid.rowEntries;
|
|
26144
|
+
const pageOffset = page >= 0 ? 2 : 0;
|
|
25496
26145
|
const col = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
25497
|
-
const
|
|
26146
|
+
const measures = pivotMeasures(pivot);
|
|
26147
|
+
const multiple = measures.length > 1;
|
|
26148
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
25498
26149
|
const compact3 = pivot.layout === "compact";
|
|
25499
26150
|
const outline = pivot.layout === "compact" || pivot.layout === "outline";
|
|
25500
26151
|
const top = (pivot.subtotalPosition ?? (outline ? "top" : "bottom")) === "top";
|
|
25501
|
-
const fields = pivot.fields.map((_field,
|
|
25502
|
-
const items2 =
|
|
25503
|
-
const subtotal = !(
|
|
25504
|
-
const repeated = pivot.repeatLabels && (
|
|
25505
|
-
return `<pivotField${attrs({ axis:
|
|
26152
|
+
const fields = pivot.fields.map((_field, index3) => {
|
|
26153
|
+
const items2 = index3 === page ? pageItems : index3 === row2 ? rowItemsFull : index3 === second ? secondRowItemsFull : index3 === col ? columnItemsFull : void 0;
|
|
26154
|
+
const subtotal = !(index3 === row2 && pivot.subtotals === false);
|
|
26155
|
+
const repeated = pivot.repeatLabels && (index3 === row2 || index3 === second) ? '<extLst><ext uri="{2946ED86-A175-432a-8AC1-64E0C546D7DE}"><x14:pivotField xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" fillDownLabels="1"/></ext></extLst>' : "";
|
|
26156
|
+
return `<pivotField${attrs({ axis: index3 === page ? "axisPage" : index3 === row2 || index3 === second ? "axisRow" : index3 === col ? "axisCol" : void 0, dataField: measures.some((measure) => pivot.fields.indexOf(measure.field) === index3) ? true : void 0, compact: compact3, outline, showAll: false, subtotalTop: index3 === row2 ? top : void 0, defaultSubtotal: subtotal ? void 0 : false })}>${items2 ? `<items count="${items2.length + Number(subtotal)}">${items2.map((item) => `<item x="${cache3.indices[index3].get(pivotValueKey(item))}"/>`).join("")}${subtotal ? '<item t="default"/>' : ""}</items>` : ""}${repeated}</pivotField>`;
|
|
25506
26157
|
}).join("");
|
|
25507
|
-
const items = (count2) => Array.from({ length: count2 }, (_v, i2) => `<i><x v="${i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
25508
|
-
const header = grid.firstDataRow - 1;
|
|
25509
|
-
const rowIndices = [row2, ...second >= 0 ? [second] : []];
|
|
26158
|
+
const items = (count2, indices) => Array.from({ length: count2 }, (_v, i2) => `<i><x v="${indices?.[i2] ?? i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
26159
|
+
const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : multiple && col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
|
|
26160
|
+
const rowIndices = rowsAxis && pivot.valuesPosition === "first" ? [-2, row2, second] : rowsAxis && pivot.valuesPosition === "between" ? [row2, -2, second] : [row2, ...second >= 0 ? [second] : [], ...rowsAxis ? [-2] : []];
|
|
25510
26161
|
let previous = [];
|
|
25511
|
-
const rowItems =
|
|
26162
|
+
const rowItems = rowEntries?.map((entry3) => {
|
|
25512
26163
|
let prefix = 0;
|
|
25513
|
-
if (
|
|
26164
|
+
if (entry3.type === "default" && rowsAxis && pivot.valuesPosition === "first") prefix = 1;
|
|
26165
|
+
else if (!entry3.type)
|
|
25514
26166
|
while (prefix < entry3.indices.length - 1 && entry3.indices[prefix] === previous[prefix])
|
|
25515
26167
|
prefix++;
|
|
25516
|
-
previous = entry3.type ? [] : entry3.indices;
|
|
25517
|
-
return `<i${attrs({ t: entry3.type, r: prefix || void 0 })}>${entry3.indices.slice(prefix).map((
|
|
25518
|
-
}).join("") ?? items(grid.rowItems.length);
|
|
25519
|
-
let body = `<location${attrs({ ref: formatRange(pivot.location), firstHeaderRow: header, firstDataRow: grid.firstDataRow, firstDataCol: grid.rowLabelColumns ?? 1 })}/><pivotFields count="${pivot.fields.length}">${fields}</pivotFields><rowFields count="${rowIndices.length}">${rowIndices.map((
|
|
25520
|
-
if (
|
|
25521
|
-
body += `<colFields count="1"
|
|
25522
|
-
else
|
|
25523
|
-
|
|
26168
|
+
previous = entry3.type && !(entry3.type === "default" && pivot.valuesPosition === "first") ? [] : entry3.indices;
|
|
26169
|
+
return `<i${attrs({ t: entry3.type, r: prefix || void 0, i: entry3.measure || void 0 })}>${entry3.indices.slice(prefix).map((index3) => `<x${attrs({ v: index3 || void 0 })}/>`).join("")}</i>`;
|
|
26170
|
+
}).join("") ?? items(grid.rowItems.length, rowIndicesFull);
|
|
26171
|
+
let body = `<location${attrs({ ref: formatRange({ ...pivot.location, start: { ...pivot.location.start, row: pivot.location.start.row + pageOffset } }), firstHeaderRow: header, firstDataRow: grid.firstDataRow - pageOffset, rowPageCount: page >= 0 ? 1 : void 0, colPageCount: page >= 0 ? 1 : void 0, firstDataCol: grid.rowLabelColumns ?? 1 })}/><pivotFields count="${pivot.fields.length}">${fields}</pivotFields><rowFields count="${rowIndices.length}">${rowIndices.map((index3) => `<field x="${index3}"/>`).join("")}</rowFields><rowItems count="${grid.rowEntries?.length ?? grid.rowItems.length + 1}">${rowItems}</rowItems>`;
|
|
26172
|
+
if (multiple && !rowsAxis)
|
|
26173
|
+
body += `<colFields count="${col >= 0 ? 2 : 1}">${col >= 0 ? `<field x="${col}"/>` : ""}<field x="-2"/></colFields>${pivotValueAxisItems(measures.length, col >= 0 ? grid.columnItems.length : void 0, columnIndicesFull)}`;
|
|
26174
|
+
else if (col >= 0)
|
|
26175
|
+
body += `<colFields count="1"><field x="${col}"/></colFields><colItems count="${grid.columnItems.length + 1}">${items(grid.columnItems.length, columnIndicesFull)}</colItems>`;
|
|
26176
|
+
else
|
|
26177
|
+
body += rowsAxis ? '<colItems count="1"><i/></colItems>' : page >= 0 ? '<colItems count="1"><i/></colItems>' : '<colItems count="1"><i><x/></i></colItems>';
|
|
26178
|
+
if (page >= 0)
|
|
26179
|
+
body += `<pageFields count="1"><pageField${attrs({ fld: page, hier: -1, item: pivot.pageFilter.item !== void 0 ? pageItems.findIndex((item) => pivotValueKey(item) === pivotValueKey(pivot.pageFilter.item)) : void 0 })}/></pageFields>`;
|
|
26180
|
+
body += `<dataFields count="${measures.length}">${measures.map((measure) => `<dataField${attrs({ name: encodeEscapes(measure.caption), fld: pivot.fields.indexOf(measure.field), subtotal: measure.aggregate, baseField: 0, baseItem: 0 })}/>`).join("")}</dataFields>`;
|
|
25524
26181
|
const doc = parseXml(
|
|
25525
26182
|
pivot.sourceXml ?? `<pivotTableDefinition xmlns="${NS.x}" dataCaption="Values" updatedVersion="6" minRefreshableVersion="3" createdVersion="6"><pivotTableStyleInfo name="PivotStyleLight16" showRowHeaders="1" showColHeaders="1" showRowStripes="0" showColStripes="0" showLastColumn="1"/></pivotTableDefinition>`
|
|
25526
26183
|
);
|
|
25527
26184
|
const root = doc.documentElement;
|
|
25528
26185
|
root.setAttribute("name", pivot.name);
|
|
25529
26186
|
root.setAttribute("cacheId", String(cacheId));
|
|
26187
|
+
root.setAttribute("dataOnRows", rowsAxis ? "1" : "0");
|
|
26188
|
+
if (rowsAxis && (pivot.valuesPosition === "between" || pivot.valuesPosition === "first"))
|
|
26189
|
+
root.setAttribute("dataPosition", pivot.valuesPosition === "first" ? "0" : "1");
|
|
26190
|
+
else root.removeAttribute("dataPosition");
|
|
25530
26191
|
root.setAttribute("compact", compact3 ? "1" : "0");
|
|
25531
26192
|
root.setAttribute("compactData", compact3 ? "1" : "0");
|
|
25532
26193
|
root.setAttribute("outline", outline ? "1" : "0");
|
|
25533
26194
|
root.setAttribute("outlineData", outline ? "1" : "0");
|
|
25534
26195
|
if (compact3) root.setAttribute("indent", "0");
|
|
26196
|
+
if (multiple && !elements(first(root, "extLst", NS.x) ?? parseXml("<root/>").documentElement).some(
|
|
26197
|
+
(extension) => first(
|
|
26198
|
+
extension,
|
|
26199
|
+
"pivotTableDefinition",
|
|
26200
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
26201
|
+
)
|
|
26202
|
+
)) {
|
|
26203
|
+
let list = first(root, "extLst", NS.x);
|
|
26204
|
+
if (!list) {
|
|
26205
|
+
list = doc.createElementNS(NS.x, "extLst");
|
|
26206
|
+
root.appendChild(list);
|
|
26207
|
+
}
|
|
26208
|
+
const extension = parseXml(
|
|
26209
|
+
`<ext xmlns="${NS.x}" uri="{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}"><x14:pivotTableDefinition xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" hideValuesRow="1"/></ext>`
|
|
26210
|
+
).documentElement;
|
|
26211
|
+
list.appendChild(doc.importNode(extension, true));
|
|
26212
|
+
}
|
|
25535
26213
|
root.setAttribute("rowGrandTotals", "1");
|
|
25536
26214
|
root.setAttribute("colGrandTotals", "1");
|
|
25537
26215
|
for (const extension of elements(
|
|
@@ -25542,6 +26220,7 @@ function pivotTableXml(pivot, cacheId, cache3) {
|
|
|
25542
26220
|
"pivotTableDefinition",
|
|
25543
26221
|
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
25544
26222
|
);
|
|
26223
|
+
if (multiple && definition) definition.setAttribute("hideValuesRow", "1");
|
|
25545
26224
|
if (definition?.hasAttribute("fillDownLabelsDefault"))
|
|
25546
26225
|
definition.setAttribute("fillDownLabelsDefault", pivot.repeatLabels ? "1" : "0");
|
|
25547
26226
|
}
|
|
@@ -25552,7 +26231,8 @@ function pivotTableXml(pivot, cacheId, cache3) {
|
|
|
25552
26231
|
"rowItems",
|
|
25553
26232
|
"colFields",
|
|
25554
26233
|
"colItems",
|
|
25555
|
-
"dataFields"
|
|
26234
|
+
"dataFields",
|
|
26235
|
+
"pageFields"
|
|
25556
26236
|
]);
|
|
25557
26237
|
for (const child3 of elements(root)) if (replaced.has(child3.localName)) root.removeChild(child3);
|
|
25558
26238
|
const replacement = parseXml(`<root xmlns="${NS.x}">${body}</root>`).documentElement;
|
|
@@ -25737,8 +26417,8 @@ async function saveXlsx(workbook) {
|
|
|
25737
26417
|
return void 0;
|
|
25738
26418
|
});
|
|
25739
26419
|
const sheetRefs = [];
|
|
25740
|
-
workbook.sheets.forEach((sheet,
|
|
25741
|
-
let partName = partNames[
|
|
26420
|
+
workbook.sheets.forEach((sheet, index3) => {
|
|
26421
|
+
let partName = partNames[index3];
|
|
25742
26422
|
const sourceType = partName && source2?.has(partName) ? source2.contentType(partName) : void 0;
|
|
25743
26423
|
const special = sourceType ? SHEET_TYPES[sourceType] : void 0;
|
|
25744
26424
|
if (!partName) {
|
|
@@ -25749,11 +26429,11 @@ async function saveXlsx(workbook) {
|
|
|
25749
26429
|
claimed.add(partName);
|
|
25750
26430
|
}
|
|
25751
26431
|
if (special) writer.carry(partName);
|
|
25752
|
-
else writeWorksheet(ctx, sheet,
|
|
26432
|
+
else writeWorksheet(ctx, sheet, index3, partName);
|
|
25753
26433
|
sheetRefs.push({
|
|
25754
26434
|
name: sheet.name,
|
|
25755
26435
|
sheetId: sheet.sheetId,
|
|
25756
|
-
state: states[
|
|
26436
|
+
state: states[index3] ?? "visible",
|
|
25757
26437
|
relId: rels.add(special ?? RELATIONSHIP_TYPES.worksheet, relativeTarget(bookPart, partName))
|
|
25758
26438
|
});
|
|
25759
26439
|
});
|
|
@@ -25815,9 +26495,9 @@ async function saveXlsx(workbook) {
|
|
|
25815
26495
|
}
|
|
25816
26496
|
|
|
25817
26497
|
// xlsx/edit/context.ts
|
|
25818
|
-
function sheetAt(workbook,
|
|
25819
|
-
const sheet = Number.isInteger(
|
|
25820
|
-
if (!sheet) throw new RangeError(`No sheet at index ${
|
|
26498
|
+
function sheetAt(workbook, index3) {
|
|
26499
|
+
const sheet = Number.isInteger(index3) ? workbook.sheets[index3] : void 0;
|
|
26500
|
+
if (!sheet) throw new RangeError(`No sheet at index ${index3}`);
|
|
25821
26501
|
return sheet;
|
|
25822
26502
|
}
|
|
25823
26503
|
function baseStyleId(sheet, row2, col) {
|
|
@@ -26051,7 +26731,7 @@ function rewriteFormulas(workbook, rewrite2, formulaCells) {
|
|
|
26051
26731
|
else bySheet.set(cell.sheet, [cell]);
|
|
26052
26732
|
}
|
|
26053
26733
|
workbook.sheets.forEach(
|
|
26054
|
-
(sheet,
|
|
26734
|
+
(sheet, index3) => rewriteSheetFormulas(sheet, rewrite2, bySheet ? bySheet.get(index3) ?? [] : void 0)
|
|
26055
26735
|
);
|
|
26056
26736
|
for (const definedName of workbook.definedNames) {
|
|
26057
26737
|
const local = definedName.localSheet === void 0 ? void 0 : workbook.sheets[definedName.localSheet];
|
|
@@ -26070,11 +26750,11 @@ function rewriteSheetFormulas(sheet, rewrite2, formulaCells) {
|
|
|
26070
26750
|
{
|
|
26071
26751
|
const name = sheet.name;
|
|
26072
26752
|
for (const table2 of sheet.tables)
|
|
26073
|
-
for (const [
|
|
26753
|
+
for (const [index3, column] of table2.columns.entries())
|
|
26074
26754
|
if (column.calculatedColumnFormula !== void 0)
|
|
26075
26755
|
column.calculatedColumnFormula = safe(rewrite2, column.calculatedColumnFormula, name, {
|
|
26076
26756
|
row: table2.range.start.row + (table2.headerRow ? 1 : 0),
|
|
26077
|
-
col: table2.range.start.col +
|
|
26757
|
+
col: table2.range.start.col + index3
|
|
26078
26758
|
});
|
|
26079
26759
|
if (formulaCells) {
|
|
26080
26760
|
for (const at of formulaCells) {
|
|
@@ -26150,8 +26830,8 @@ function syncTableHeader(ctx, sheet, row2, col, formulaCells) {
|
|
|
26150
26830
|
const newName = uniqueHeaders([...others, text3]).at(-1);
|
|
26151
26831
|
column.name = newName;
|
|
26152
26832
|
if (newName !== text3) writeValue(sheet, row2, col, newName);
|
|
26153
|
-
const
|
|
26154
|
-
const cells = formulaCells && (formulaCells.some((cell) => cell.sheet ===
|
|
26833
|
+
const index3 = ctx.workbook.sheets.indexOf(sheet);
|
|
26834
|
+
const cells = formulaCells && (formulaCells.some((cell) => cell.sheet === index3 && cell.row === row2 && cell.col === col) ? formulaCells : [...formulaCells, { sheet: index3, row: row2, col }]);
|
|
26155
26835
|
rewriteFormulas(
|
|
26156
26836
|
ctx.workbook,
|
|
26157
26837
|
(formula, formulaSheet, at) => renameTableColumnInFormula(
|
|
@@ -26164,7 +26844,7 @@ function syncTableHeader(ctx, sheet, row2, col, formulaCells) {
|
|
|
26164
26844
|
cells
|
|
26165
26845
|
);
|
|
26166
26846
|
}
|
|
26167
|
-
function writeScopes(sheet,
|
|
26847
|
+
function writeScopes(sheet, index3, range, parts = []) {
|
|
26168
26848
|
const r = normalizeRange(range);
|
|
26169
26849
|
const touchesHeader = sheet.tables.some(
|
|
26170
26850
|
(t) => t.headerRow && rangesIntersect(
|
|
@@ -26172,9 +26852,9 @@ function writeScopes(sheet, index2, range, parts = []) {
|
|
|
26172
26852
|
cellRange(t.range.start.row, t.range.start.col, t.range.start.row, t.range.end.col)
|
|
26173
26853
|
)
|
|
26174
26854
|
);
|
|
26175
|
-
if (touchesHeader) return [{ kind: "refs" }, { kind: "cells", sheet:
|
|
26176
|
-
const scopes = [{ kind: "cells", sheet:
|
|
26177
|
-
if (parts.length) scopes.push({ kind: "parts", sheet:
|
|
26855
|
+
if (touchesHeader) return [{ kind: "refs" }, { kind: "cells", sheet: index3, ranges: [r] }];
|
|
26856
|
+
const scopes = [{ kind: "cells", sheet: index3, ranges: [r] }];
|
|
26857
|
+
if (parts.length) scopes.push({ kind: "parts", sheet: index3, parts });
|
|
26178
26858
|
return scopes;
|
|
26179
26859
|
}
|
|
26180
26860
|
function writeInput(ctx, sheet, row2, col, text3) {
|
|
@@ -26472,10 +27152,10 @@ function patchRangeWith(sheet, range, patcher) {
|
|
|
26472
27152
|
pruneCell(sheet, row2, col);
|
|
26473
27153
|
});
|
|
26474
27154
|
}
|
|
26475
|
-
function formatScopes(
|
|
26476
|
-
const cells = { kind: "cells", sheet:
|
|
27155
|
+
function formatScopes(index3, ranges) {
|
|
27156
|
+
const cells = { kind: "cells", sheet: index3, ranges };
|
|
26477
27157
|
const whole = ranges.some((r) => isWholeColumns(r) || isWholeRows(r));
|
|
26478
|
-
return whole ? [cells, { kind: "parts", sheet:
|
|
27158
|
+
return whole ? [cells, { kind: "parts", sheet: index3, parts: ["columns", "rowInfo"] }] : [cells];
|
|
26479
27159
|
}
|
|
26480
27160
|
function applyStyle(ctx, s, ranges, patch3) {
|
|
26481
27161
|
const sheet = sheetAt(ctx.workbook, s);
|
|
@@ -26518,8 +27198,8 @@ var LISTS = [
|
|
|
26518
27198
|
function listMatch(text3) {
|
|
26519
27199
|
const lower2 = text3.toLowerCase();
|
|
26520
27200
|
for (const list of LISTS) {
|
|
26521
|
-
const
|
|
26522
|
-
if (
|
|
27201
|
+
const index3 = list.findIndex((item) => item.toLowerCase() === lower2);
|
|
27202
|
+
if (index3 >= 0) return { list, index: index3 };
|
|
26523
27203
|
}
|
|
26524
27204
|
return void 0;
|
|
26525
27205
|
}
|
|
@@ -26731,9 +27411,9 @@ function removeValidationArea(rules, area) {
|
|
|
26731
27411
|
}
|
|
26732
27412
|
|
|
26733
27413
|
// xlsx/edit/conditional-formats.ts
|
|
26734
|
-
function formatAt(sheet,
|
|
26735
|
-
const format = sheet.conditionalFormats[
|
|
26736
|
-
if (!format) throw new RangeError(`No conditional format at index ${
|
|
27414
|
+
function formatAt(sheet, index3) {
|
|
27415
|
+
const format = sheet.conditionalFormats[index3];
|
|
27416
|
+
if (!format) throw new RangeError(`No conditional format at index ${index3}`);
|
|
26737
27417
|
return format;
|
|
26738
27418
|
}
|
|
26739
27419
|
function rulesByPriority(sheet) {
|
|
@@ -26744,9 +27424,9 @@ function renumber(rules) {
|
|
|
26744
27424
|
rule.priority = i2 + 1;
|
|
26745
27425
|
});
|
|
26746
27426
|
}
|
|
26747
|
-
function replaceConditionalFormat(ctx, s,
|
|
27427
|
+
function replaceConditionalFormat(ctx, s, index3, format) {
|
|
26748
27428
|
const sheet = sheetAt(ctx.workbook, s);
|
|
26749
|
-
formatAt(sheet,
|
|
27429
|
+
formatAt(sheet, index3);
|
|
26750
27430
|
if (!format.ranges.length || !format.rules.length)
|
|
26751
27431
|
throw new Error("A conditional format needs at least one range and one rule.");
|
|
26752
27432
|
ctx.run(
|
|
@@ -26756,21 +27436,21 @@ function replaceConditionalFormat(ctx, s, index2, format) {
|
|
|
26756
27436
|
() => {
|
|
26757
27437
|
const next = structuredClone(format);
|
|
26758
27438
|
next.ranges = next.ranges.map(normalizeRange);
|
|
26759
|
-
sheet.conditionalFormats[
|
|
27439
|
+
sheet.conditionalFormats[index3] = next;
|
|
26760
27440
|
renumber(rulesByPriority(sheet));
|
|
26761
27441
|
},
|
|
26762
27442
|
{ sheet: s, ranges: format.ranges }
|
|
26763
27443
|
);
|
|
26764
27444
|
}
|
|
26765
|
-
function removeConditionalFormat(ctx, s,
|
|
27445
|
+
function removeConditionalFormat(ctx, s, index3) {
|
|
26766
27446
|
const sheet = sheetAt(ctx.workbook, s);
|
|
26767
|
-
const format = formatAt(sheet,
|
|
27447
|
+
const format = formatAt(sheet, index3);
|
|
26768
27448
|
ctx.run(
|
|
26769
27449
|
"Delete rule",
|
|
26770
27450
|
"format",
|
|
26771
27451
|
[{ kind: "sheet", sheet: s }],
|
|
26772
27452
|
() => {
|
|
26773
|
-
sheet.conditionalFormats.splice(
|
|
27453
|
+
sheet.conditionalFormats.splice(index3, 1);
|
|
26774
27454
|
renumber(rulesByPriority(sheet));
|
|
26775
27455
|
},
|
|
26776
27456
|
{ sheet: s, ranges: format.ranges }
|
|
@@ -26934,20 +27614,20 @@ function pasteConditionalFormats(sheet, dest, cells, transpose2, skipBlanks, cut
|
|
|
26934
27614
|
// xlsx/edit/annotations.ts
|
|
26935
27615
|
function setComment(ctx, s, at, text3, author) {
|
|
26936
27616
|
const sheet = sheetAt(ctx.workbook, s);
|
|
26937
|
-
const
|
|
27617
|
+
const index3 = sheet.comments.findIndex(
|
|
26938
27618
|
(c2) => c2.address.row === at.row && c2.address.col === at.col
|
|
26939
27619
|
);
|
|
26940
|
-
if (
|
|
27620
|
+
if (index3 < 0 && text3 === void 0) return;
|
|
26941
27621
|
ctx.run(
|
|
26942
|
-
text3 === void 0 ? "Delete comment" :
|
|
27622
|
+
text3 === void 0 ? "Delete comment" : index3 < 0 ? "New comment" : "Edit comment",
|
|
26943
27623
|
"annotations",
|
|
26944
27624
|
[{ kind: "sheet", sheet: s }],
|
|
26945
27625
|
() => {
|
|
26946
27626
|
if (text3 === void 0) {
|
|
26947
|
-
sheet.comments.splice(
|
|
27627
|
+
sheet.comments.splice(index3, 1);
|
|
26948
27628
|
return;
|
|
26949
27629
|
}
|
|
26950
|
-
const existing = sheet.comments[
|
|
27630
|
+
const existing = sheet.comments[index3];
|
|
26951
27631
|
if (existing) {
|
|
26952
27632
|
existing.text = text3;
|
|
26953
27633
|
existing.author = author;
|
|
@@ -28865,7 +29545,7 @@ function replaceAll(ctx, query, replacement) {
|
|
|
28865
29545
|
)
|
|
28866
29546
|
);
|
|
28867
29547
|
const uniqueScopes = scopes.filter(
|
|
28868
|
-
(scope,
|
|
29548
|
+
(scope, index3) => scope.kind !== "refs" || scopes.findIndex((entry3) => entry3.kind === "refs") === index3
|
|
28869
29549
|
);
|
|
28870
29550
|
return ctx.run(
|
|
28871
29551
|
"Replace",
|
|
@@ -29394,9 +30074,9 @@ function setDocumentProperties(ctx, patch3) {
|
|
|
29394
30074
|
}
|
|
29395
30075
|
|
|
29396
30076
|
// xlsx/edit/drawings.ts
|
|
29397
|
-
function drawingAt(ctx, s,
|
|
29398
|
-
const drawing = sheetAt(ctx.workbook, s).drawings[
|
|
29399
|
-
if (!drawing) throw new RangeError(`No drawing at index ${
|
|
30077
|
+
function drawingAt(ctx, s, index3) {
|
|
30078
|
+
const drawing = sheetAt(ctx.workbook, s).drawings[index3];
|
|
30079
|
+
if (!drawing) throw new RangeError(`No drawing at index ${index3} on sheet ${s}`);
|
|
29400
30080
|
return drawing;
|
|
29401
30081
|
}
|
|
29402
30082
|
function checkAnchor(anchor) {
|
|
@@ -29407,8 +30087,8 @@ function checkAnchor(anchor) {
|
|
|
29407
30087
|
if (anchor.ext && !(anchor.ext.cx >= 0 && anchor.ext.cy >= 0))
|
|
29408
30088
|
throw new RangeError("A drawing extent cannot be negative.");
|
|
29409
30089
|
}
|
|
29410
|
-
function setDrawingAnchor(ctx, s,
|
|
29411
|
-
const drawing = drawingAt(ctx, s,
|
|
30090
|
+
function setDrawingAnchor(ctx, s, index3, anchor) {
|
|
30091
|
+
const drawing = drawingAt(ctx, s, index3);
|
|
29412
30092
|
checkAnchor(anchor);
|
|
29413
30093
|
ctx.run(
|
|
29414
30094
|
"Move object",
|
|
@@ -29420,15 +30100,15 @@ function setDrawingAnchor(ctx, s, index2, anchor) {
|
|
|
29420
30100
|
{ sheet: s }
|
|
29421
30101
|
);
|
|
29422
30102
|
}
|
|
29423
|
-
function deleteDrawing(ctx, s,
|
|
29424
|
-
drawingAt(ctx, s,
|
|
30103
|
+
function deleteDrawing(ctx, s, index3) {
|
|
30104
|
+
drawingAt(ctx, s, index3);
|
|
29425
30105
|
const sheet = sheetAt(ctx.workbook, s);
|
|
29426
30106
|
ctx.run(
|
|
29427
30107
|
"Delete object",
|
|
29428
30108
|
"annotations",
|
|
29429
30109
|
[{ kind: "sheet", sheet: s }],
|
|
29430
30110
|
() => {
|
|
29431
|
-
sheet.drawings.splice(
|
|
30111
|
+
sheet.drawings.splice(index3, 1);
|
|
29432
30112
|
},
|
|
29433
30113
|
{ sheet: s }
|
|
29434
30114
|
);
|
|
@@ -29489,8 +30169,8 @@ function patchSparklineNode(node, patch3) {
|
|
|
29489
30169
|
if (old) node.replaceChild(replacement, old);
|
|
29490
30170
|
else {
|
|
29491
30171
|
const before = elements(node).find((child3) => {
|
|
29492
|
-
const
|
|
29493
|
-
return
|
|
30172
|
+
const index3 = COLORS2.indexOf(child3.localName);
|
|
30173
|
+
return index3 > COLORS2.indexOf(key) || child3.localName === "f" || child3.localName === "sparklines";
|
|
29494
30174
|
});
|
|
29495
30175
|
node.insertBefore(replacement, before ?? null);
|
|
29496
30176
|
}
|
|
@@ -29518,8 +30198,8 @@ function editSparklineXml(sheet, edit) {
|
|
|
29518
30198
|
function appendSparklineXml(sheet, groupXml2) {
|
|
29519
30199
|
const source2 = [...sheet.preserved.get("extLst") ?? []];
|
|
29520
30200
|
const found = source2.findIndex((xml) => xml.includes("sparklineGroups"));
|
|
29521
|
-
const
|
|
29522
|
-
const doc = parseXml(source2[
|
|
30201
|
+
const index3 = found >= 0 ? found : 0;
|
|
30202
|
+
const doc = parseXml(source2[index3] ?? `<extLst xmlns="${NS.x}"/>`);
|
|
29523
30203
|
const root = doc.documentElement;
|
|
29524
30204
|
let ext = children(root, "ext", NS.x).find(
|
|
29525
30205
|
(node) => node.getAttribute("uri")?.toUpperCase() === URI2.toUpperCase()
|
|
@@ -29546,7 +30226,7 @@ function appendSparklineXml(sheet, groupXml2) {
|
|
|
29546
30226
|
fresh.setAttributeNS(revision, "xr2:uid", `{${globalThis.crypto.randomUUID().toUpperCase()}}`);
|
|
29547
30227
|
}
|
|
29548
30228
|
groups.appendChild(fresh);
|
|
29549
|
-
source2[
|
|
30229
|
+
source2[index3] = buildXml(root);
|
|
29550
30230
|
return source2;
|
|
29551
30231
|
}
|
|
29552
30232
|
|
|
@@ -29765,12 +30445,16 @@ function write(ctx, s, pivot, old) {
|
|
|
29765
30445
|
],
|
|
29766
30446
|
() => {
|
|
29767
30447
|
const compact3 = pivot.layout === "compact";
|
|
29768
|
-
const indents =
|
|
29769
|
-
|
|
29770
|
-
|
|
29771
|
-
|
|
29772
|
-
|
|
29773
|
-
|
|
30448
|
+
const indents = new Map(
|
|
30449
|
+
[.../* @__PURE__ */ new Set([0, ...grid.indents ?? []])].map(
|
|
30450
|
+
(indent) => [
|
|
30451
|
+
indent,
|
|
30452
|
+
stylePatcher(ctx.workbook, {
|
|
30453
|
+
alignment: { indent, ...compact3 || indent > 0 ? { horizontal: "left" } : {} }
|
|
30454
|
+
})
|
|
30455
|
+
]
|
|
30456
|
+
)
|
|
30457
|
+
);
|
|
29774
30458
|
const styles = /* @__PURE__ */ new Map();
|
|
29775
30459
|
forEachCellInRange(sheet, location, (cell, row2, col) => {
|
|
29776
30460
|
if (cell.styleId !== void 0) styles.set(`${row2}:${col}`, cell.styleId);
|
|
@@ -29793,7 +30477,7 @@ function write(ctx, s, pivot, old) {
|
|
|
29793
30477
|
const indent = col === 0 ? grid.indents?.[row2] ?? 0 : 0;
|
|
29794
30478
|
const alignment = styleAt(ctx.workbook, styleId).alignment;
|
|
29795
30479
|
if ((alignment?.indent ?? 0) !== indent || compact3 && alignment?.horizontal !== "left")
|
|
29796
|
-
styleId = indents
|
|
30480
|
+
styleId = indents.get(indent)(styleId);
|
|
29797
30481
|
}
|
|
29798
30482
|
putCell(sheet, r, c2, { value: value2, ...styleId !== void 0 ? { styleId } : {} });
|
|
29799
30483
|
})
|
|
@@ -29820,6 +30504,10 @@ function createPivotTable(ctx, s, destination, options) {
|
|
|
29820
30504
|
valueField: options.valueField,
|
|
29821
30505
|
aggregate: aggregate3,
|
|
29822
30506
|
valueCaption: pivotCaption(aggregate3, options.valueField),
|
|
30507
|
+
...options.pageFilter !== void 0 ? { pageFilter: structuredClone(options.pageFilter) } : {},
|
|
30508
|
+
...options.valuesAxis !== void 0 ? { valuesAxis: options.valuesAxis } : {},
|
|
30509
|
+
...options.valuesPosition !== void 0 ? { valuesPosition: options.valuesPosition } : {},
|
|
30510
|
+
...options.additionalValues ? { additionalValues: normalizedPivotMeasures(options.additionalValues) } : {},
|
|
29823
30511
|
location: { start: { ...destination }, end: { ...destination } },
|
|
29824
30512
|
...options.columnField ? { columnField: options.columnField } : {}
|
|
29825
30513
|
};
|
|
@@ -29851,6 +30539,19 @@ function refreshPivotTable(ctx, s, name, patch3 = {}) {
|
|
|
29851
30539
|
if (patch3.repeatLabels !== void 0) next.repeatLabels = patch3.repeatLabels;
|
|
29852
30540
|
if (patch3.layout !== void 0) next.layout = patch3.layout;
|
|
29853
30541
|
if (patch3.subtotalPosition !== void 0) next.subtotalPosition = patch3.subtotalPosition;
|
|
30542
|
+
if (patch3.valuesAxis !== void 0) next.valuesAxis = patch3.valuesAxis;
|
|
30543
|
+
if (patch3.pageFilter !== void 0) {
|
|
30544
|
+
if (patch3.pageFilter === null) delete next.pageFilter;
|
|
30545
|
+
else next.pageFilter = structuredClone(patch3.pageFilter);
|
|
30546
|
+
}
|
|
30547
|
+
if (patch3.valuesPosition !== void 0) next.valuesPosition = patch3.valuesPosition;
|
|
30548
|
+
else if (patch3.valuesAxis === "columns" || patch3.secondRowField === "")
|
|
30549
|
+
delete next.valuesPosition;
|
|
30550
|
+
if (patch3.additionalValues !== void 0) {
|
|
30551
|
+
const measures = normalizedPivotMeasures(patch3.additionalValues);
|
|
30552
|
+
if (measures.length) next.additionalValues = measures;
|
|
30553
|
+
else delete next.additionalValues;
|
|
30554
|
+
}
|
|
29854
30555
|
validatePivotFields(next);
|
|
29855
30556
|
write(ctx, s, next, old);
|
|
29856
30557
|
}
|
|
@@ -29937,22 +30638,22 @@ function applyCellStyle(ctx, s, ranges, name) {
|
|
|
29937
30638
|
function sortGradientStops(stops) {
|
|
29938
30639
|
return stops.slice().sort((a2, b) => a2.position - b.position);
|
|
29939
30640
|
}
|
|
29940
|
-
function removeGradientStop(stops,
|
|
29941
|
-
return stops.length <= 2 ? void 0 : stops.filter((_, i2) => i2 !==
|
|
30641
|
+
function removeGradientStop(stops, index3) {
|
|
30642
|
+
return stops.length <= 2 ? void 0 : stops.filter((_, i2) => i2 !== index3);
|
|
29942
30643
|
}
|
|
29943
30644
|
|
|
29944
30645
|
// xlsx/edit/chart-series-transparency.ts
|
|
29945
|
-
function chartSeriesSolidColor(chart,
|
|
29946
|
-
const series = chart.series[
|
|
30646
|
+
function chartSeriesSolidColor(chart, index3) {
|
|
30647
|
+
const series = chart.series[index3];
|
|
29947
30648
|
if (!series || series.fill && series.fill.kind !== "solid") return void 0;
|
|
29948
30649
|
return series.fill?.kind === "solid" ? series.fill.color : series.drawingColor ?? chartDrawingColor(series.color) ?? chartPaletteSeriesColorChoice(
|
|
29949
30650
|
findChartColorPalette(chart.colorPalette ?? 10) ?? findChartColorPalette(10),
|
|
29950
|
-
|
|
30651
|
+
index3,
|
|
29951
30652
|
chart.series.length
|
|
29952
30653
|
);
|
|
29953
30654
|
}
|
|
29954
|
-
function chartSeriesTransparency(chart,
|
|
29955
|
-
const color = chartSeriesSolidColor(chart,
|
|
30655
|
+
function chartSeriesTransparency(chart, index3) {
|
|
30656
|
+
const color = chartSeriesSolidColor(chart, index3);
|
|
29956
30657
|
if (!color) return void 0;
|
|
29957
30658
|
const resolved = resolveDrawingColor(
|
|
29958
30659
|
color,
|
|
@@ -29961,11 +30662,11 @@ function chartSeriesTransparency(chart, index2) {
|
|
|
29961
30662
|
);
|
|
29962
30663
|
return resolved ? Math.round((1 - resolved.alpha) * 1e5) / 1e3 : void 0;
|
|
29963
30664
|
}
|
|
29964
|
-
function chartSeriesTransparencyPatch(chart,
|
|
30665
|
+
function chartSeriesTransparencyPatch(chart, index3, percent2) {
|
|
29965
30666
|
if (!Number.isFinite(percent2) || percent2 < 0 || percent2 > 100)
|
|
29966
30667
|
throw new RangeError("Chart transparency must be from 0 to 100");
|
|
29967
|
-
const current = chartSeriesAt(chart,
|
|
29968
|
-
const color = chartSeriesSolidColor(chart,
|
|
30668
|
+
const current = chartSeriesAt(chart, index3);
|
|
30669
|
+
const color = chartSeriesSolidColor(chart, index3);
|
|
29969
30670
|
if (!color) return void 0;
|
|
29970
30671
|
const choice = structuredClone(color);
|
|
29971
30672
|
choice.transforms = choice.transforms.filter(
|
|
@@ -29975,7 +30676,7 @@ function chartSeriesTransparencyPatch(chart, index2, percent2) {
|
|
|
29975
30676
|
choice.transforms.push({ name: "alpha", value: String(Math.round((100 - percent2) * 1e3)) });
|
|
29976
30677
|
if (sameChartColor(choice, color) && !Object.keys(current.pointColors ?? {}).length && !Object.keys(current.pointFills ?? {}).length)
|
|
29977
30678
|
return void 0;
|
|
29978
|
-
const { series, target: next } = cloneChartSeriesForEdit(chart,
|
|
30679
|
+
const { series, target: next } = cloneChartSeriesForEdit(chart, index3);
|
|
29979
30680
|
delete next.fill;
|
|
29980
30681
|
delete next.color;
|
|
29981
30682
|
delete next.pointColors;
|
|
@@ -29985,8 +30686,8 @@ function chartSeriesTransparencyPatch(chart, index2, percent2) {
|
|
|
29985
30686
|
}
|
|
29986
30687
|
|
|
29987
30688
|
// xlsx/edit/chart-series-gradient.ts
|
|
29988
|
-
function chartGradientStopTransparency(fill,
|
|
29989
|
-
const color = fill.stops[
|
|
30689
|
+
function chartGradientStopTransparency(fill, index3) {
|
|
30690
|
+
const color = fill.stops[index3]?.color;
|
|
29990
30691
|
const value2 = color && resolveDrawingColor(color, { scheme: () => "#000000" }, { transformOrder: "document" });
|
|
29991
30692
|
return value2 ? Math.round((1 - value2.alpha) * 1e5) / 1e3 : 0;
|
|
29992
30693
|
}
|
|
@@ -29994,19 +30695,19 @@ function percent(value2) {
|
|
|
29994
30695
|
if (!Number.isFinite(value2) || value2 < 0 || value2 > 100)
|
|
29995
30696
|
throw new RangeError("Gradient value must be from 0 to 100");
|
|
29996
30697
|
}
|
|
29997
|
-
function chartSeriesGradientPatch(chart,
|
|
29998
|
-
const current = chartSeriesAt(chart,
|
|
30698
|
+
function chartSeriesGradientPatch(chart, index3, edit) {
|
|
30699
|
+
const current = chartSeriesAt(chart, index3);
|
|
29999
30700
|
const result2 = chartGradientFillEdit(
|
|
30000
30701
|
current.fill,
|
|
30001
30702
|
edit,
|
|
30002
|
-
chartSeriesSolidColor(chart,
|
|
30703
|
+
chartSeriesSolidColor(chart, index3) ?? chartPaletteSeriesColorChoice(
|
|
30003
30704
|
findChartColorPalette(chart.colorPalette ?? 10) ?? findChartColorPalette(10),
|
|
30004
|
-
|
|
30705
|
+
index3,
|
|
30005
30706
|
chart.series.length
|
|
30006
30707
|
)
|
|
30007
30708
|
);
|
|
30008
30709
|
if (!result2) return void 0;
|
|
30009
|
-
const { series, target: next } = cloneChartSeriesForEdit(chart,
|
|
30710
|
+
const { series, target: next } = cloneChartSeriesForEdit(chart, index3);
|
|
30010
30711
|
next.fill = result2.fill;
|
|
30011
30712
|
delete next.color;
|
|
30012
30713
|
delete next.drawingColor;
|
|
@@ -30202,18 +30903,18 @@ function addChart(ctx, s, chart) {
|
|
|
30202
30903
|
{ sheet: s }
|
|
30203
30904
|
);
|
|
30204
30905
|
}
|
|
30205
|
-
function updateChart(ctx, s,
|
|
30906
|
+
function updateChart(ctx, s, index3, patch3) {
|
|
30206
30907
|
assertBarClusterOptions(patch3);
|
|
30207
30908
|
const sheet = sheetAt(ctx.workbook, s);
|
|
30208
|
-
const chart = sheet.drawings[
|
|
30209
|
-
if (!chart || chart.kind !== "chart") throw new RangeError(`No chart at index ${
|
|
30909
|
+
const chart = sheet.drawings[index3];
|
|
30910
|
+
if (!chart || chart.kind !== "chart") throw new RangeError(`No chart at index ${index3}`);
|
|
30210
30911
|
const formatting = patch3.elementFills ? chartWithElementFills(chart, patch3.elementFills).formatting : void 0;
|
|
30211
30912
|
ctx.run(
|
|
30212
30913
|
"Edit chart",
|
|
30213
30914
|
"annotations",
|
|
30214
30915
|
[{ kind: "sheet", sheet: s }],
|
|
30215
30916
|
() => {
|
|
30216
|
-
const live = sheet.drawings[
|
|
30917
|
+
const live = sheet.drawings[index3];
|
|
30217
30918
|
const changes = structuredClone(patch3);
|
|
30218
30919
|
delete changes.elementFills;
|
|
30219
30920
|
if (formatting) live.formatting = formatting;
|
|
@@ -30331,9 +31032,9 @@ function applyTotalsRow(sheet, table2) {
|
|
|
30331
31032
|
|
|
30332
31033
|
// xlsx/edit/table-edits.ts
|
|
30333
31034
|
function tableIndex(sheet, ref) {
|
|
30334
|
-
const
|
|
30335
|
-
if (!sheet.tables[
|
|
30336
|
-
return
|
|
31035
|
+
const index3 = typeof ref === "number" ? ref : sheet.tables.findIndex((t) => t.name.toLowerCase() === ref.toLowerCase());
|
|
31036
|
+
if (!sheet.tables[index3]) throw new RangeError(`No table ${String(ref)} on ${sheet.name}`);
|
|
31037
|
+
return index3;
|
|
30337
31038
|
}
|
|
30338
31039
|
var TABLE_NAME = /^[A-Za-z_\\][A-Za-z0-9_.\\]*$/;
|
|
30339
31040
|
function validateTableName(workbook, name, self) {
|
|
@@ -30495,8 +31196,8 @@ function updateTable(ctx, s, ref, patch3) {
|
|
|
30495
31196
|
if (patch3.columns.length !== width) throw new Error("Give one column per table column.");
|
|
30496
31197
|
const before = table2.columns;
|
|
30497
31198
|
table2.columns = structuredClone(patch3.columns);
|
|
30498
|
-
for (const [
|
|
30499
|
-
const sourceId = before[
|
|
31199
|
+
for (const [index3, column] of table2.columns.entries()) {
|
|
31200
|
+
const sourceId = before[index3]?.sourceId;
|
|
30500
31201
|
if (column.sourceId === void 0 && sourceId !== void 0) column.sourceId = sourceId;
|
|
30501
31202
|
}
|
|
30502
31203
|
}
|
|
@@ -30753,8 +31454,8 @@ function setPageBreak(ctx, s, axis, before, present = true) {
|
|
|
30753
31454
|
const sheet = sheetAt(ctx.workbook, s);
|
|
30754
31455
|
const key = axis === "row" ? "rowBreaks" : "colBreaks";
|
|
30755
31456
|
const source2 = sheet.preserved.get(key) ?? [`<${key} xmlns="${NS.x}"/>`];
|
|
30756
|
-
const result2 = source2.flatMap((xml,
|
|
30757
|
-
const next = patch2(xml, before, present &&
|
|
31457
|
+
const result2 = source2.flatMap((xml, index3) => {
|
|
31458
|
+
const next = patch2(xml, before, present && index3 === 0, axis);
|
|
30758
31459
|
return next ? [next] : [];
|
|
30759
31460
|
});
|
|
30760
31461
|
ctx.run(
|
|
@@ -30897,16 +31598,16 @@ function setDefinedName(ctx, name) {
|
|
|
30897
31598
|
entry3.formula = entry3.formula.replace(/^=/, "");
|
|
30898
31599
|
ctx.run("Define name", "names", [{ kind: "meta" }], () => {
|
|
30899
31600
|
const { definedNames } = ctx.workbook;
|
|
30900
|
-
const
|
|
30901
|
-
if (
|
|
31601
|
+
const index3 = definedNames.findIndex((n2) => sameName(n2, name.name, name.localSheet));
|
|
31602
|
+
if (index3 >= 0) definedNames[index3] = entry3;
|
|
30902
31603
|
else definedNames.push(entry3);
|
|
30903
31604
|
});
|
|
30904
31605
|
}
|
|
30905
31606
|
function deleteDefinedName(ctx, name, localSheet) {
|
|
30906
|
-
const
|
|
30907
|
-
if (
|
|
31607
|
+
const index3 = ctx.workbook.definedNames.findIndex((n2) => sameName(n2, name, localSheet));
|
|
31608
|
+
if (index3 < 0) return;
|
|
30908
31609
|
ctx.run("Delete name", "names", [{ kind: "meta" }], () => {
|
|
30909
|
-
ctx.workbook.definedNames.splice(
|
|
31610
|
+
ctx.workbook.definedNames.splice(index3, 1);
|
|
30910
31611
|
});
|
|
30911
31612
|
}
|
|
30912
31613
|
|
|
@@ -30944,7 +31645,7 @@ function normalizeDigestAlgorithmName(name) {
|
|
|
30944
31645
|
|
|
30945
31646
|
// digest/base64.ts
|
|
30946
31647
|
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
30947
|
-
var VALUES = new Map([...ALPHABET].map((char,
|
|
31648
|
+
var VALUES = new Map([...ALPHABET].map((char, index3) => [char, index3]));
|
|
30948
31649
|
function encodeBase64(bytes) {
|
|
30949
31650
|
let out = "";
|
|
30950
31651
|
for (let i2 = 0; i2 < bytes.length; i2 += 3) {
|
|
@@ -30966,7 +31667,7 @@ function decodeBase64(text3) {
|
|
|
30966
31667
|
const out = new Uint8Array(Math.floor(body.length * 3 / 4));
|
|
30967
31668
|
let bits = 0;
|
|
30968
31669
|
let buffer = 0;
|
|
30969
|
-
let
|
|
31670
|
+
let index3 = 0;
|
|
30970
31671
|
for (const char of body) {
|
|
30971
31672
|
const value2 = VALUES.get(char);
|
|
30972
31673
|
if (value2 === void 0) return void 0;
|
|
@@ -30974,7 +31675,7 @@ function decodeBase64(text3) {
|
|
|
30974
31675
|
bits += 6;
|
|
30975
31676
|
if (bits >= 8) {
|
|
30976
31677
|
bits -= 8;
|
|
30977
|
-
out[
|
|
31678
|
+
out[index3++] = buffer >> bits & 255;
|
|
30978
31679
|
}
|
|
30979
31680
|
}
|
|
30980
31681
|
return out;
|
|
@@ -31363,7 +32064,7 @@ function i(x, y, z) {
|
|
|
31363
32064
|
}
|
|
31364
32065
|
var T = Array.from(
|
|
31365
32066
|
{ length: 64 },
|
|
31366
|
-
(_,
|
|
32067
|
+
(_, index3) => Math.floor(Math.abs(Math.sin(index3 + 1)) * 2 ** 32)
|
|
31367
32068
|
);
|
|
31368
32069
|
var SHIFTS = [
|
|
31369
32070
|
[7, 12, 17, 22],
|
|
@@ -33121,14 +33822,14 @@ var AxisMetrics = class {
|
|
|
33121
33822
|
constructor(defaultSize, count2, overrides) {
|
|
33122
33823
|
this.defaultSize = defaultSize;
|
|
33123
33824
|
this.count = count2;
|
|
33124
|
-
const sorted2 = [...overrides].filter(([
|
|
33825
|
+
const sorted2 = [...overrides].filter(([index3, size]) => index3 >= 0 && index3 < count2 && size !== defaultSize).sort((a2, b) => a2[0] - b[0]);
|
|
33125
33826
|
this.indices = [];
|
|
33126
33827
|
this.sizes = [];
|
|
33127
33828
|
this.prefix = [];
|
|
33128
33829
|
let delta = 0;
|
|
33129
|
-
for (const [
|
|
33130
|
-
if (this.indices.at(-1) ===
|
|
33131
|
-
this.indices.push(
|
|
33830
|
+
for (const [index3, size] of sorted2) {
|
|
33831
|
+
if (this.indices.at(-1) === index3) continue;
|
|
33832
|
+
this.indices.push(index3);
|
|
33132
33833
|
this.sizes.push(Math.max(0, size));
|
|
33133
33834
|
this.prefix.push(delta);
|
|
33134
33835
|
delta += Math.max(0, size) - defaultSize;
|
|
@@ -33145,24 +33846,24 @@ var AxisMetrics = class {
|
|
|
33145
33846
|
prefix;
|
|
33146
33847
|
totalDelta;
|
|
33147
33848
|
/** Number of custom entries strictly before `index` (binary search). */
|
|
33148
|
-
rank(
|
|
33849
|
+
rank(index3) {
|
|
33149
33850
|
let lo = 0;
|
|
33150
33851
|
let hi = this.indices.length;
|
|
33151
33852
|
while (lo < hi) {
|
|
33152
33853
|
const mid = lo + hi >> 1;
|
|
33153
|
-
if ((this.indices[mid] ?? 0) <
|
|
33854
|
+
if ((this.indices[mid] ?? 0) < index3) lo = mid + 1;
|
|
33154
33855
|
else hi = mid;
|
|
33155
33856
|
}
|
|
33156
33857
|
return lo;
|
|
33157
33858
|
}
|
|
33158
|
-
size(
|
|
33159
|
-
if (
|
|
33160
|
-
const k = this.rank(
|
|
33161
|
-
return this.indices[k] ===
|
|
33859
|
+
size(index3) {
|
|
33860
|
+
if (index3 < 0 || index3 >= this.count) return 0;
|
|
33861
|
+
const k = this.rank(index3);
|
|
33862
|
+
return this.indices[k] === index3 ? this.sizes[k] ?? 0 : this.defaultSize;
|
|
33162
33863
|
}
|
|
33163
33864
|
/** Offset of the leading edge of `index` (`index` may equal `count` for the axis end). */
|
|
33164
|
-
start(
|
|
33165
|
-
const i2 = Math.max(0, Math.min(
|
|
33865
|
+
start(index3) {
|
|
33866
|
+
const i2 = Math.max(0, Math.min(index3, this.count));
|
|
33166
33867
|
const k = this.rank(i2);
|
|
33167
33868
|
const before = k < this.indices.length ? this.prefix[k] ?? 0 : this.totalDelta;
|
|
33168
33869
|
return i2 * this.defaultSize + before;
|
|
@@ -33197,13 +33898,13 @@ var AxisMetrics = class {
|
|
|
33197
33898
|
return Math.min(line3, this.count - 1);
|
|
33198
33899
|
}
|
|
33199
33900
|
/** The first line at or after `index` with a non-zero size (or `count - 1`). */
|
|
33200
|
-
firstVisible(
|
|
33201
|
-
for (let i2 = Math.max(0,
|
|
33901
|
+
firstVisible(index3) {
|
|
33902
|
+
for (let i2 = Math.max(0, index3); i2 < this.count; i2++) if (this.size(i2) > 0) return i2;
|
|
33202
33903
|
return this.count - 1;
|
|
33203
33904
|
}
|
|
33204
33905
|
/** The last line at or before `index` with a non-zero size (or 0). */
|
|
33205
|
-
lastVisible(
|
|
33206
|
-
for (let i2 = Math.min(
|
|
33906
|
+
lastVisible(index3) {
|
|
33907
|
+
for (let i2 = Math.min(index3, this.count - 1); i2 >= 0; i2--) if (this.size(i2) > 0) return i2;
|
|
33207
33908
|
return 0;
|
|
33208
33909
|
}
|
|
33209
33910
|
/** Largest custom-entry index, or -1. */
|
|
@@ -33420,10 +34121,10 @@ function remapSheets(workbook, map) {
|
|
|
33420
34121
|
});
|
|
33421
34122
|
}
|
|
33422
34123
|
var visibleCount = (workbook) => workbook.sheets.filter((s) => s.state === "visible").length;
|
|
33423
|
-
function nearestVisible(workbook,
|
|
33424
|
-
for (let i2 =
|
|
34124
|
+
function nearestVisible(workbook, index3) {
|
|
34125
|
+
for (let i2 = index3; i2 < workbook.sheets.length; i2++)
|
|
33425
34126
|
if (workbook.sheets[i2]?.state === "visible") return i2;
|
|
33426
|
-
for (let i2 =
|
|
34127
|
+
for (let i2 = index3 - 1; i2 >= 0; i2--) if (workbook.sheets[i2]?.state === "visible") return i2;
|
|
33427
34128
|
return 0;
|
|
33428
34129
|
}
|
|
33429
34130
|
function addSheet(ctx, name, at) {
|
|
@@ -33432,24 +34133,24 @@ function addSheet(ctx, name, at) {
|
|
|
33432
34133
|
const sheetName = name ?? nextSheetName(workbook, ctx.defaultSheetBase);
|
|
33433
34134
|
const problem = validateSheetName(workbook, sheetName);
|
|
33434
34135
|
if (problem) throw new Error(problem);
|
|
33435
|
-
const
|
|
34136
|
+
const index3 = Math.max(0, Math.min(at ?? workbook.sheets.length, workbook.sheets.length));
|
|
33436
34137
|
return ctx.run(
|
|
33437
34138
|
"Insert sheet",
|
|
33438
34139
|
"sheets",
|
|
33439
34140
|
[{ kind: "workbook" }],
|
|
33440
34141
|
() => {
|
|
33441
|
-
workbook.sheets.splice(
|
|
33442
|
-
remapSheets(workbook, (i2) => i2 >=
|
|
33443
|
-
workbook.activeSheet =
|
|
33444
|
-
return
|
|
34142
|
+
workbook.sheets.splice(index3, 0, createWorksheet(sheetName, nextSheetId(workbook)));
|
|
34143
|
+
remapSheets(workbook, (i2) => i2 >= index3 ? i2 + 1 : i2);
|
|
34144
|
+
workbook.activeSheet = index3;
|
|
34145
|
+
return index3;
|
|
33445
34146
|
},
|
|
33446
|
-
{ sheet:
|
|
34147
|
+
{ sheet: index3, structural: true }
|
|
33447
34148
|
);
|
|
33448
34149
|
}
|
|
33449
|
-
function deleteSheet(ctx,
|
|
34150
|
+
function deleteSheet(ctx, index3) {
|
|
33450
34151
|
const { workbook } = ctx;
|
|
33451
34152
|
assertUnlocked(workbook);
|
|
33452
|
-
const sheet = sheetAt(workbook,
|
|
34153
|
+
const sheet = sheetAt(workbook, index3);
|
|
33453
34154
|
if (sheet.state === "visible" && visibleCount(workbook) <= 1)
|
|
33454
34155
|
throw new Error("A workbook must contain at least one visible sheet.");
|
|
33455
34156
|
if (workbook.sheets.some(
|
|
@@ -33464,26 +34165,26 @@ function deleteSheet(ctx, index2) {
|
|
|
33464
34165
|
[{ kind: "workbook" }],
|
|
33465
34166
|
() => {
|
|
33466
34167
|
const tables = sheet.tables.map((t) => t.name);
|
|
33467
|
-
workbook.sheets.splice(
|
|
33468
|
-
remapSheets(workbook, (i2) => i2 ===
|
|
34168
|
+
workbook.sheets.splice(index3, 1);
|
|
34169
|
+
remapSheets(workbook, (i2) => i2 === index3 ? void 0 : i2 > index3 ? i2 - 1 : i2);
|
|
33469
34170
|
rewriteFormulas(workbook, (formula) => deleteSheetInFormula(formula, sheet.name, tables));
|
|
33470
|
-
if (workbook.activeSheet >
|
|
33471
|
-
else if (workbook.activeSheet ===
|
|
34171
|
+
if (workbook.activeSheet > index3) workbook.activeSheet--;
|
|
34172
|
+
else if (workbook.activeSheet === index3)
|
|
33472
34173
|
workbook.activeSheet = nearestVisible(
|
|
33473
34174
|
workbook,
|
|
33474
|
-
Math.min(
|
|
34175
|
+
Math.min(index3, workbook.sheets.length - 1)
|
|
33475
34176
|
);
|
|
33476
34177
|
},
|
|
33477
34178
|
{ structural: true }
|
|
33478
34179
|
);
|
|
33479
34180
|
}
|
|
33480
|
-
function renameSheet(ctx,
|
|
34181
|
+
function renameSheet(ctx, index3, name) {
|
|
33481
34182
|
const { workbook } = ctx;
|
|
33482
34183
|
assertUnlocked(workbook);
|
|
33483
|
-
const sheet = sheetAt(workbook,
|
|
34184
|
+
const sheet = sheetAt(workbook, index3);
|
|
33484
34185
|
const old = sheet.name;
|
|
33485
34186
|
if (old === name) return;
|
|
33486
|
-
const problem = validateSheetName(workbook, name,
|
|
34187
|
+
const problem = validateSheetName(workbook, name, index3);
|
|
33487
34188
|
if (problem) throw new Error(problem);
|
|
33488
34189
|
ctx.run(
|
|
33489
34190
|
"Rename sheet",
|
|
@@ -33493,7 +34194,7 @@ function renameSheet(ctx, index2, name) {
|
|
|
33493
34194
|
rewriteFormulas(workbook, (formula) => renameSheetInFormula(formula, old, name));
|
|
33494
34195
|
sheet.name = name;
|
|
33495
34196
|
},
|
|
33496
|
-
{ sheet:
|
|
34197
|
+
{ sheet: index3, structural: true, calc: { kind: "rename", from: old, to: name } }
|
|
33497
34198
|
);
|
|
33498
34199
|
}
|
|
33499
34200
|
function moveSheet(ctx, from, to) {
|
|
@@ -33536,8 +34237,8 @@ function uniqueTableName(workbook, base, extra) {
|
|
|
33536
34237
|
const stem = base.replace(/_\d+$/, "") || "Table";
|
|
33537
34238
|
for (let n2 = 2; ; n2++) if (!taken.has(`${stem}_${n2}`.toLowerCase())) return `${stem}_${n2}`;
|
|
33538
34239
|
}
|
|
33539
|
-
function namesForCopy(workbook,
|
|
33540
|
-
const local = workbook.definedNames.filter((n2) => n2.localSheet ===
|
|
34240
|
+
function namesForCopy(workbook, index3, from, to) {
|
|
34241
|
+
const local = workbook.definedNames.filter((n2) => n2.localSheet === index3);
|
|
33541
34242
|
const taken = new Set(local.map((n2) => n2.name.toLowerCase()));
|
|
33542
34243
|
const global = workbook.definedNames.filter(
|
|
33543
34244
|
(n2) => n2.localSheet === void 0 && !taken.has(n2.name.toLowerCase()) && renameSheetInFormula(n2.formula, from, to) !== n2.formula
|
|
@@ -33547,11 +34248,11 @@ function namesForCopy(workbook, index2, from, to) {
|
|
|
33547
34248
|
formula: renameSheetInFormula(n2.formula, from, to)
|
|
33548
34249
|
}));
|
|
33549
34250
|
}
|
|
33550
|
-
function duplicateSheet(ctx,
|
|
34251
|
+
function duplicateSheet(ctx, index3) {
|
|
33551
34252
|
const { workbook } = ctx;
|
|
33552
34253
|
assertUnlocked(workbook);
|
|
33553
|
-
const sheet = sheetAt(workbook,
|
|
33554
|
-
const at =
|
|
34254
|
+
const sheet = sheetAt(workbook, index3);
|
|
34255
|
+
const at = index3 + 1;
|
|
33555
34256
|
return ctx.run(
|
|
33556
34257
|
"Duplicate sheet",
|
|
33557
34258
|
"sheets",
|
|
@@ -33589,7 +34290,7 @@ function duplicateSheet(ctx, index2) {
|
|
|
33589
34290
|
);
|
|
33590
34291
|
rewriteSheetFormulas(copy, rewrite2);
|
|
33591
34292
|
for (const drawing of copy.drawings) if (drawing.kind === "chart") delete drawing.partName;
|
|
33592
|
-
const copiedNames = namesForCopy(workbook,
|
|
34293
|
+
const copiedNames = namesForCopy(workbook, index3, sheet.name, copy.name);
|
|
33593
34294
|
for (const name of copiedNames) name.formula = rewrite2(name.formula);
|
|
33594
34295
|
workbook.sheets.splice(at, 0, copy);
|
|
33595
34296
|
remapSheets(workbook, (i2) => i2 >= at ? i2 + 1 : i2);
|
|
@@ -33600,9 +34301,9 @@ function duplicateSheet(ctx, index2) {
|
|
|
33600
34301
|
{ sheet: at, structural: true }
|
|
33601
34302
|
);
|
|
33602
34303
|
}
|
|
33603
|
-
function setSheetState(ctx,
|
|
34304
|
+
function setSheetState(ctx, index3, state) {
|
|
33604
34305
|
const { workbook } = ctx;
|
|
33605
|
-
const sheet = sheetAt(workbook,
|
|
34306
|
+
const sheet = sheetAt(workbook, index3);
|
|
33606
34307
|
if (sheet.state === state) return;
|
|
33607
34308
|
assertUnlocked(workbook);
|
|
33608
34309
|
if (state !== "visible") {
|
|
@@ -33612,26 +34313,26 @@ function setSheetState(ctx, index2, state) {
|
|
|
33612
34313
|
ctx.run(
|
|
33613
34314
|
state === "visible" ? "Unhide sheet" : "Hide sheet",
|
|
33614
34315
|
"sheets",
|
|
33615
|
-
[{ kind: "sheet", sheet:
|
|
34316
|
+
[{ kind: "sheet", sheet: index3 }, { kind: "meta" }],
|
|
33616
34317
|
() => {
|
|
33617
34318
|
sheet.state = state;
|
|
33618
|
-
if (state !== "visible" && workbook.activeSheet ===
|
|
33619
|
-
workbook.activeSheet = nearestVisible(workbook,
|
|
34319
|
+
if (state !== "visible" && workbook.activeSheet === index3)
|
|
34320
|
+
workbook.activeSheet = nearestVisible(workbook, index3);
|
|
33620
34321
|
},
|
|
33621
|
-
{ sheet:
|
|
34322
|
+
{ sheet: index3, structural: true }
|
|
33622
34323
|
);
|
|
33623
34324
|
}
|
|
33624
|
-
function setTabColor(ctx,
|
|
33625
|
-
const sheet = sheetAt(ctx.workbook,
|
|
34325
|
+
function setTabColor(ctx, index3, color) {
|
|
34326
|
+
const sheet = sheetAt(ctx.workbook, index3);
|
|
33626
34327
|
ctx.run(
|
|
33627
34328
|
"Tab color",
|
|
33628
34329
|
"sheets",
|
|
33629
|
-
[{ kind: "sheet", sheet:
|
|
34330
|
+
[{ kind: "sheet", sheet: index3 }],
|
|
33630
34331
|
() => {
|
|
33631
34332
|
if (color) sheet.tabColor = { ...color };
|
|
33632
34333
|
else Reflect.deleteProperty(sheet, "tabColor");
|
|
33633
34334
|
},
|
|
33634
|
-
{ sheet:
|
|
34335
|
+
{ sheet: index3 }
|
|
33635
34336
|
);
|
|
33636
34337
|
}
|
|
33637
34338
|
|
|
@@ -34045,20 +34746,20 @@ function createEditSession(workbook, options = {}) {
|
|
|
34045
34746
|
setSheetView: (s, patch3) => setSheetView(ctx, s, patch3),
|
|
34046
34747
|
setDefinedName: (name) => setDefinedName(ctx, name),
|
|
34047
34748
|
deleteDefinedName: (name, localSheet) => deleteDefinedName(ctx, name, localSheet),
|
|
34048
|
-
setDrawingAnchor: (s,
|
|
34749
|
+
setDrawingAnchor: (s, index3, anchor) => setDrawingAnchor(ctx, s, index3, anchor),
|
|
34049
34750
|
createPivotTable: (s, destination, options2) => createPivotTable(ctx, s, destination, options2),
|
|
34050
34751
|
refreshPivotTable: (s, name, patch3) => refreshPivotTable(ctx, s, name, patch3),
|
|
34051
34752
|
deletePivotTable: (s, name) => deletePivotTable(ctx, s, name),
|
|
34052
|
-
deleteDrawing: (s,
|
|
34753
|
+
deleteDrawing: (s, index3) => deleteDrawing(ctx, s, index3),
|
|
34053
34754
|
createSparklineGroup: (s, source2, locations, patch3) => createSparklineGroup(ctx, s, source2, locations, patch3),
|
|
34054
34755
|
setSparklineGroups: (s, ranges, patch3) => setSparklineGroups(ctx, s, ranges, patch3),
|
|
34055
34756
|
setSparklineDateRange: (s, ranges, source2) => setSparklineDateRange(ctx, s, ranges, source2),
|
|
34056
34757
|
deleteSparklines: (s, ranges, wholeGroups) => deleteSparklines(ctx, s, ranges, wholeGroups),
|
|
34057
34758
|
addChart: (s, chart) => addChart(ctx, s, chart),
|
|
34058
|
-
updateChart: (s,
|
|
34759
|
+
updateChart: (s, index3, patch3) => updateChart(ctx, s, index3, patch3),
|
|
34059
34760
|
addImage: (s, bytes, type, anchor, name) => addImage(ctx, s, bytes, type, anchor, name),
|
|
34060
|
-
replaceConditionalFormat: (s,
|
|
34061
|
-
removeConditionalFormat: (s,
|
|
34761
|
+
replaceConditionalFormat: (s, index3, cf) => replaceConditionalFormat(ctx, s, index3, cf),
|
|
34762
|
+
removeConditionalFormat: (s, index3) => removeConditionalFormat(ctx, s, index3),
|
|
34062
34763
|
setConditionalRulePriority: (s, f6, r, priority) => setConditionalRulePriority(ctx, s, f6, r, priority),
|
|
34063
34764
|
moveConditionalRule: (s, f6, r, direction) => moveConditionalRule(ctx, s, f6, r, direction),
|
|
34064
34765
|
updateTable: (s, table2, patch3) => updateTable(ctx, s, table2, patch3),
|
|
@@ -34302,12 +35003,12 @@ function mergeDxf(acc, next) {
|
|
|
34302
35003
|
return out;
|
|
34303
35004
|
}
|
|
34304
35005
|
function iconIndex(value2, cuts, list) {
|
|
34305
|
-
let
|
|
35006
|
+
let index3 = 0;
|
|
34306
35007
|
for (let i2 = 1; i2 < cuts.length; i2++) {
|
|
34307
35008
|
const cut = cuts[i2] ?? Infinity;
|
|
34308
|
-
if (list[i2]?.gte === false ? value2 > cut : value2 >= cut)
|
|
35009
|
+
if (list[i2]?.gte === false ? value2 > cut : value2 >= cut) index3 = i2;
|
|
34309
35010
|
}
|
|
34310
|
-
return
|
|
35011
|
+
return index3;
|
|
34311
35012
|
}
|
|
34312
35013
|
function scaleColor(value2, cuts, colors) {
|
|
34313
35014
|
if (!cuts.length || cuts.length !== colors.length) return void 0;
|
|
@@ -34686,10 +35387,10 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
|
|
|
34686
35387
|
}
|
|
34687
35388
|
if (rule.type === "iconSet") {
|
|
34688
35389
|
if (result2.icon || typeof value2 !== "number") return false;
|
|
34689
|
-
const
|
|
35390
|
+
const index3 = iconIndex(value2, thresholds(entry3, rule.thresholds), rule.thresholds);
|
|
34690
35391
|
result2.icon = {
|
|
34691
35392
|
set: rule.iconSet,
|
|
34692
|
-
index: rule.reverse ? rule.thresholds.length - 1 -
|
|
35393
|
+
index: rule.reverse ? rule.thresholds.length - 1 - index3 : index3
|
|
34693
35394
|
};
|
|
34694
35395
|
if (rule.showValue === false) result2.hideValue = true;
|
|
34695
35396
|
return true;
|
|
@@ -34821,19 +35522,19 @@ var filled = (sheet, row2, col) => {
|
|
|
34821
35522
|
const cell = sheet.rows.get(row2)?.get(col);
|
|
34822
35523
|
return cell !== void 0 && (cell.value !== null && cell.value !== "" || cell.formula !== void 0);
|
|
34823
35524
|
};
|
|
34824
|
-
function step(
|
|
34825
|
-
for (let i2 =
|
|
34826
|
-
return
|
|
35525
|
+
function step(index3, dir, max, hidden) {
|
|
35526
|
+
for (let i2 = index3 + dir; i2 >= 0 && i2 <= max; i2 += dir) if (!hidden(i2)) return i2;
|
|
35527
|
+
return index3;
|
|
34827
35528
|
}
|
|
34828
35529
|
function edge(dir, max, hidden) {
|
|
34829
35530
|
const start = dir > 0 ? max : 0;
|
|
34830
35531
|
if (!hidden(start)) return start;
|
|
34831
35532
|
return step(start, dir > 0 ? -1 : 1, max, hidden);
|
|
34832
35533
|
}
|
|
34833
|
-
function jump(
|
|
34834
|
-
const next = step(
|
|
34835
|
-
if (next ===
|
|
34836
|
-
if (filledSet.has(
|
|
35534
|
+
function jump(index3, dir, max, hidden, filledSet) {
|
|
35535
|
+
const next = step(index3, dir, max, hidden);
|
|
35536
|
+
if (next === index3) return index3;
|
|
35537
|
+
if (filledSet.has(index3) && filledSet.has(next)) {
|
|
34837
35538
|
let at = next;
|
|
34838
35539
|
for (; ; ) {
|
|
34839
35540
|
const after = step(at, dir, max, hidden);
|
|
@@ -34841,7 +35542,7 @@ function jump(index2, dir, max, hidden, filledSet) {
|
|
|
34841
35542
|
at = after;
|
|
34842
35543
|
}
|
|
34843
35544
|
}
|
|
34844
|
-
const candidates = [...filledSet].filter((i2) => (dir > 0 ? i2 >
|
|
35545
|
+
const candidates = [...filledSet].filter((i2) => (dir > 0 ? i2 > index3 : i2 < index3) && !hidden(i2));
|
|
34845
35546
|
if (!candidates.length) return edge(dir, max, hidden);
|
|
34846
35547
|
return dir > 0 ? Math.min(...candidates) : Math.max(...candidates);
|
|
34847
35548
|
}
|
|
@@ -34946,7 +35647,7 @@ function autoFitColumnWidth(sheet, workbook, col, measure, mdw = DEFAULT_MAX_DIG
|
|
|
34946
35647
|
// chart/render/chart-colors.ts
|
|
34947
35648
|
function chartColorScheme(theme2) {
|
|
34948
35649
|
const slots = Object.fromEntries(
|
|
34949
|
-
THEME_SLOTS.map((slot2,
|
|
35650
|
+
THEME_SLOTS.map((slot2, index3) => [slot2, `#${themeColor(theme2, index3) ?? "000000"}`])
|
|
34950
35651
|
);
|
|
34951
35652
|
return {
|
|
34952
35653
|
...slots,
|
|
@@ -34965,8 +35666,8 @@ function modulateLuminance(hex, lumMod, lumOff = 0) {
|
|
|
34965
35666
|
const out = hslToRgb(hsl.h, hsl.s, l);
|
|
34966
35667
|
return rgbToUpperHex([out.r, out.g, out.b]);
|
|
34967
35668
|
}
|
|
34968
|
-
function autoSeriesColor(theme2,
|
|
34969
|
-
const i2 = Math.max(0, Math.floor(
|
|
35669
|
+
function autoSeriesColor(theme2, index3) {
|
|
35670
|
+
const i2 = Math.max(0, Math.floor(index3));
|
|
34970
35671
|
return chartPaletteSeriesColor(findChartColorPalette(10), i2, i2 + 1, chartColorScheme(theme2));
|
|
34971
35672
|
}
|
|
34972
35673
|
|
|
@@ -35118,10 +35819,10 @@ function resolveChartStyleDefinition(style2, resolve2) {
|
|
|
35118
35819
|
var NATIVE_COINCIDENT_STOP_RAMP = 1 / 256;
|
|
35119
35820
|
function spreadCoincidentStops(stops) {
|
|
35120
35821
|
const out = [];
|
|
35121
|
-
for (const [
|
|
35122
|
-
const source2 = stops[
|
|
35822
|
+
for (const [index3, stop] of stops.entries()) {
|
|
35823
|
+
const source2 = stops[index3 - 1];
|
|
35123
35824
|
const previous = out.at(-1);
|
|
35124
|
-
const next = stops[
|
|
35825
|
+
const next = stops[index3 + 1];
|
|
35125
35826
|
if (!source2 || !previous || stop.offset !== source2.offset || stop.color === source2.color && (stop.opacity ?? 1) === (source2.opacity ?? 1)) {
|
|
35126
35827
|
out.push(stop);
|
|
35127
35828
|
continue;
|
|
@@ -35371,9 +36072,9 @@ function resolveRef(ref, evaluateRef) {
|
|
|
35371
36072
|
return void 0;
|
|
35372
36073
|
}
|
|
35373
36074
|
}
|
|
35374
|
-
function seriesName(series,
|
|
36075
|
+
function seriesName(series, index3, evaluateRef) {
|
|
35375
36076
|
const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText2).filter((t) => t !== "").join(" ");
|
|
35376
|
-
return fromRef || series.name || `Series${
|
|
36077
|
+
return fromRef || series.name || `Series${index3 + 1}`;
|
|
35377
36078
|
}
|
|
35378
36079
|
function chartSummaryView(chart, theme2, options = {}) {
|
|
35379
36080
|
const evaluateRef = options.evaluateRef ?? (() => []);
|
|
@@ -35443,8 +36144,8 @@ function chartSummaryView(chart, theme2, options = {}) {
|
|
|
35443
36144
|
const points = chart.series[seriesIndex]?.pointColors;
|
|
35444
36145
|
if (points) s.pointColors = s.values.map((_, i2) => drawingColor(points[i2]) ?? s.color);
|
|
35445
36146
|
});
|
|
35446
|
-
series.forEach((s,
|
|
35447
|
-
const source2 = chart.series[
|
|
36147
|
+
series.forEach((s, index3) => {
|
|
36148
|
+
const source2 = chart.series[index3];
|
|
35448
36149
|
if (s.gradient && !radial && s.pointColors) {
|
|
35449
36150
|
for (let i2 = 0; i2 < s.pointColors.length; i2++)
|
|
35450
36151
|
if (!source2.pointColors?.[i2]) delete s.pointColors[i2];
|
|
@@ -35598,15 +36299,15 @@ function chartGradientPaint(model, width = 1024, height = 768) {
|
|
|
35598
36299
|
fillColor: paint(entry3.gradient, part, { width, height, shape: "rect" })
|
|
35599
36300
|
};
|
|
35600
36301
|
}
|
|
35601
|
-
const series = model.series.map((source2,
|
|
36302
|
+
const series = model.series.map((source2, index3) => {
|
|
35602
36303
|
const view = { ...source2 };
|
|
35603
|
-
if (source2.shadow) view.shadowFilter = shadowPaint(source2.shadow, `s${
|
|
36304
|
+
if (source2.shadow) view.shadowFilter = shadowPaint(source2.shadow, `s${index3}-shadow`);
|
|
35604
36305
|
const bounds = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
|
|
35605
|
-
if (source2.gradient) view.color = paint(source2.gradient, `s${
|
|
36306
|
+
if (source2.gradient) view.color = paint(source2.gradient, `s${index3}`, bounds);
|
|
35606
36307
|
if (source2.pointGradients) {
|
|
35607
36308
|
view.pointColors = [...source2.pointColors ?? []];
|
|
35608
36309
|
for (const [key, gradient] of Object.entries(source2.pointGradients))
|
|
35609
|
-
view.pointColors[Number(key)] = paint(gradient, `s${
|
|
36310
|
+
view.pointColors[Number(key)] = paint(gradient, `s${index3}-p${key}`, bounds);
|
|
35610
36311
|
}
|
|
35611
36312
|
return view;
|
|
35612
36313
|
});
|
|
@@ -36258,8 +36959,8 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
|
36258
36959
|
hardLines.push(line3);
|
|
36259
36960
|
for (const run2 of paragraph2.runs) {
|
|
36260
36961
|
const pieces = run2.text.split("\n");
|
|
36261
|
-
for (const [
|
|
36262
|
-
if (
|
|
36962
|
+
for (const [index3, piece] of pieces.entries()) {
|
|
36963
|
+
if (index3) {
|
|
36263
36964
|
line3 = { ...paragraph2, runs: [] };
|
|
36264
36965
|
hardLines.push(line3);
|
|
36265
36966
|
}
|
|
@@ -36283,11 +36984,11 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
|
36283
36984
|
{ breakWords: true }
|
|
36284
36985
|
);
|
|
36285
36986
|
const { spaceBefore, spaceAfter, ...properties2 } = line3;
|
|
36286
|
-
return wrapped.map((runs,
|
|
36987
|
+
return wrapped.map((runs, index3) => ({
|
|
36287
36988
|
...properties2,
|
|
36288
36989
|
runs,
|
|
36289
|
-
...
|
|
36290
|
-
...
|
|
36990
|
+
...index3 === 0 && spaceBefore ? { spaceBefore } : {},
|
|
36991
|
+
...index3 === wrapped.length - 1 && spaceAfter ? { spaceAfter } : {}
|
|
36291
36992
|
}));
|
|
36292
36993
|
});
|
|
36293
36994
|
const metrics = lines.map((line3) => {
|
|
@@ -36332,9 +37033,9 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
|
|
|
36332
37033
|
);
|
|
36333
37034
|
let baseline = 8 + (metrics[0]?.size ?? base.size ?? 14) + (vertical[0]?.before ?? 0) + (vertical[0]?.leading ?? 0);
|
|
36334
37035
|
const spans2 = [];
|
|
36335
|
-
for (const [
|
|
36336
|
-
if (
|
|
36337
|
-
baseline += vertical[
|
|
37036
|
+
for (const [index3, line3] of metrics.entries()) {
|
|
37037
|
+
if (index3)
|
|
37038
|
+
baseline += vertical[index3 - 1].descent + vertical[index3 - 1].after + vertical[index3].before + vertical[index3].ascent;
|
|
36338
37039
|
let x = line3.align === "l" ? (width - boxWidth) / 2 + 4 : line3.align === "r" ? (width + boxWidth) / 2 - 4 - line3.width : (width - line3.width) / 2;
|
|
36339
37040
|
for (const run2 of line3.runs) {
|
|
36340
37041
|
spans2.push(
|
|
@@ -36725,19 +37426,19 @@ function chunks(indices, size, capacity, breaks) {
|
|
|
36725
37426
|
const out = [];
|
|
36726
37427
|
let line3 = [];
|
|
36727
37428
|
let extent2 = 0;
|
|
36728
|
-
for (const
|
|
37429
|
+
for (const index3 of indices) {
|
|
36729
37430
|
let manual = false;
|
|
36730
|
-
while (cursor < sorted2.length && sorted2[cursor] <=
|
|
37431
|
+
while (cursor < sorted2.length && sorted2[cursor] <= index3) {
|
|
36731
37432
|
cursor++;
|
|
36732
37433
|
manual = true;
|
|
36733
37434
|
}
|
|
36734
|
-
if (line3.length && (manual || extent2 + size(
|
|
37435
|
+
if (line3.length && (manual || extent2 + size(index3) > capacity + 1e-3)) {
|
|
36735
37436
|
out.push(line3);
|
|
36736
37437
|
line3 = [];
|
|
36737
37438
|
extent2 = 0;
|
|
36738
37439
|
}
|
|
36739
|
-
line3.push(
|
|
36740
|
-
extent2 += size(
|
|
37440
|
+
line3.push(index3);
|
|
37441
|
+
extent2 += size(index3);
|
|
36741
37442
|
}
|
|
36742
37443
|
if (line3.length) out.push(line3);
|
|
36743
37444
|
return out;
|
|
@@ -36939,4 +37640,4 @@ function createPrintMergeIndex(merges, rows, columns) {
|
|
|
36939
37640
|
};
|
|
36940
37641
|
}
|
|
36941
37642
|
|
|
36942
|
-
export { AxisMetrics, BORDER_STYLES, BUILTIN_CELL_STYLES, BUILTIN_NUMBER_FORMATS, CHART_FILL_PARTS, CIRCULAR_REFERENCE_WARNING, COLUMN_PADDING_PX, DEFAULT_ANCHOR_EXTENT_EMU, DEFAULT_BASE_COL_WIDTH, DEFAULT_COL_WIDTH, DEFAULT_MAX_DIGIT_WIDTH, DEFAULT_ROW_HEIGHT, DEFAULT_THEME, DEFAULT_VALIDATION_MESSAGE, ERROR_CODES, FORMAT_PRESETS, FUNCTION_CATALOG, FormulaError, IMAGE_EXTENSIONS, INDENT_PX_PER_LEVEL, INDEXED_COLORS, MAX_COL, MAX_DATE_SERIAL, MAX_OUTLINE_LEVEL, MAX_ROW, MIN_TWO_CELL_PIXELS, OVERFLOW_TEXT, PERCENT_SCALE, PIVOT_AGGREGATES, PRINT_MARGINS, PRINT_PAPER_INCHES, PRINT_TITLES_NAME, REFERENCE_COLORS, THEME_SLOTS, TIME_PERIODS, acceptsReference, activeParam, addFuturePrefixes, anchorKind, anchorToPixelBox, applyBuiltinStyle, applyStylePatch, applyTint, approximateMeasure, autoFitColumnWidth, autoFitRowHeight, autoGrowRows, autoSeriesColor, bordersView, builtinCellStyle, builtinFormatId, calcModeOf, callAtCaret, categoryTotals, cellError, cellInputText, cellKey, cellView, cellsFromText, charactersToColumnWidth, charactersToPixels, chartBarSpacing, chartColorPalettePatch, chartColorScheme, chartDrawingColor, chartElementFill, chartElementFillPatch, chartElementGradientPatch, chartElementSolidFillPatch, chartElementTransparency, chartElementTransparencyPatch, chartGradientStopTransparency, chartSeriesFillPatch, chartSeriesGradientPatch, chartSeriesSolidColor, chartSeriesSolidFillPatch, chartSeriesTransparency, chartSeriesTransparencyPatch, chartView, chartWithElementFills, closeParens, coloredReferences, columnIndex, columnLabel, columnWidthToPixels, compareCellValues, compareValues, createCalcEngine, createConditionalFormatEvaluator, createEditSession, createGridMetrics, createPrintMergeIndex, createRefEvaluator, createWorkbook, createWorksheet, currentRegion, dateToSerial, defaultCellStyle, defaultColumnPixels, deleteCell, deleteSheetInFormula, detectSeries, edgeView, effectiveStyleId, fillView, fontView, forEachCell, forEachCellInRange, formatAddress, formatAxisValue, formatGeneral, formatPrintTitleSpan, formatRange, formatRefSpec, formatSelectionStat, formatValue, formulaBarText, functionMatches, generalAlignment, getCell, getCellAt, getValue, hasSparklineAt, hls240ToRgb, inTimePeriod, insideString, internStyle, isCellError, isDateFormat, isEmptyCell, isErrorCode, isFormulaText, isOverflowTarget, isSpilledCell, keyToAddress, layoutRemoteSelections, legacyPasswordHash, lineHeightPoints, listValidationOptions, loadXlsx, mergeAt, mergeFont, mergeView, mergeWouldDiscard, mixColors, modernPasswordHash, modulateLuminance, moveReferencesInFormula, nameAtCaret, navigate, needsArrayEvaluation, newMediaPart, nextSheetId, nextSheetName, niceScale, normalizeRange, numberInputText, numberToText, overflowExtent, pageHeaderFooter, paginateWorksheet, parseAddress, parseCellInput, parseFormula, parseHeaderFooter, parseHex, parseHtmlTable, parseNumberText, parsePrintTitleSpan, parseR1C1Range, parseRange, parseTsv, patchStyle, percentile, pictureAnchorAt, pivotGrid, pivotSourceData, pivotTableAt, pixelBoxToAnchor, pixelSizeToExtent, pixelsToCharacters, pixelsToColumnWidth, pixelsToPoints, pointsToPixels, presetEdges, printRange, printTitles, printTitlesFormula, putCell, queryPattern, quoteSheetName, rangeContains, rangeSize, rangesIntersect, readSparklineGroup, readSparklineGroups, readSparklineValues, referenceSpans, referenceTarget, referencedRanges, renameSheetInFormula, renameTableInFormula, renderChartSvg, renderHeaderFooter, renderHeaderFooterRuns, replaceText, resolveColor, resolvePasteOptions, resolveSparklineRange, rgbToHls240, rotationDegrees, rowsToRefit, sameChartColor, saveXlsx, scaleColor, selectedSparklineGroups, selectionStats, serialToDate, sheetByName, sheetPageBreaks, sheetSparklineGroups, shiftFormula, shiftRange, shiftSpan, sparklineScale, sparklineValues, sparklineView, sparklineViewAt, spillAnchorOf, splice, stepDecimals, stripFuturePrefixes, structuredToA1, styleAt, styleKey, subtractRange, syntaxParams, themeColor, timePeriodFormula, toHexColor, toHtml, toTsv, toggleAbsolute, tokenize, translateFormula, translateReferences, uniqueHeaders, usedRange, validateCellInput, validateDefinedName, validateSheetName, validateTableName, validationAt, verifySheetPassword, verifySheetPasswordAsync, verifyWorkbookPassword, visibleCells, wrappedLineCount, zoomPercent };
|
|
37643
|
+
export { AxisMetrics, BORDER_STYLES, BUILTIN_CELL_STYLES, BUILTIN_NUMBER_FORMATS, CHART_FILL_PARTS, CIRCULAR_REFERENCE_WARNING, COLUMN_PADDING_PX, DEFAULT_ANCHOR_EXTENT_EMU, DEFAULT_BASE_COL_WIDTH, DEFAULT_COL_WIDTH, DEFAULT_MAX_DIGIT_WIDTH, DEFAULT_ROW_HEIGHT, DEFAULT_THEME, DEFAULT_VALIDATION_MESSAGE, ERROR_CODES, FORMAT_PRESETS, FUNCTION_CATALOG, FormulaError, IMAGE_EXTENSIONS, INDENT_PX_PER_LEVEL, INDEXED_COLORS, MAX_COL, MAX_DATE_SERIAL, MAX_OUTLINE_LEVEL, MAX_ROW, MIN_TWO_CELL_PIXELS, OVERFLOW_TEXT, PERCENT_SCALE, PIVOT_AGGREGATES, PRINT_MARGINS, PRINT_PAPER_INCHES, PRINT_TITLES_NAME, REFERENCE_COLORS, THEME_SLOTS, TIME_PERIODS, acceptsReference, activeParam, addFuturePrefixes, anchorKind, anchorToPixelBox, applyBuiltinStyle, applyStylePatch, applyTint, approximateMeasure, autoFitColumnWidth, autoFitRowHeight, autoGrowRows, autoSeriesColor, bordersView, builtinCellStyle, builtinFormatId, calcModeOf, callAtCaret, categoryTotals, cellError, cellInputText, cellKey, cellView, cellsFromText, charactersToColumnWidth, charactersToPixels, chartBarSpacing, chartColorPalettePatch, chartColorScheme, chartDrawingColor, chartElementFill, chartElementFillPatch, chartElementGradientPatch, chartElementSolidFillPatch, chartElementTransparency, chartElementTransparencyPatch, chartGradientStopTransparency, chartSeriesFillPatch, chartSeriesGradientPatch, chartSeriesSolidColor, chartSeriesSolidFillPatch, chartSeriesTransparency, chartSeriesTransparencyPatch, chartView, chartWithElementFills, closeParens, coloredReferences, columnIndex, columnLabel, columnWidthToPixels, compareCellValues, compareValues, createCalcEngine, createConditionalFormatEvaluator, createEditSession, createGridMetrics, createPrintMergeIndex, createRefEvaluator, createWorkbook, createWorksheet, currentRegion, dateToSerial, defaultCellStyle, defaultColumnPixels, deleteCell, deleteSheetInFormula, detectSeries, edgeView, effectiveStyleId, fillView, fontView, forEachCell, forEachCellInRange, formatAddress, formatAxisValue, formatGeneral, formatPrintTitleSpan, formatRange, formatRefSpec, formatSelectionStat, formatValue, formulaBarText, functionMatches, generalAlignment, getCell, getCellAt, getValue, hasSparklineAt, hls240ToRgb, inTimePeriod, insideString, internStyle, isCellError, isDateFormat, isEmptyCell, isErrorCode, isFormulaText, isOverflowTarget, isSpilledCell, keyToAddress, layoutRemoteSelections, legacyPasswordHash, lineHeightPoints, listValidationOptions, loadXlsx, mergeAt, mergeFont, mergeView, mergeWouldDiscard, mixColors, modernPasswordHash, modulateLuminance, moveReferencesInFormula, nameAtCaret, navigate, needsArrayEvaluation, newMediaPart, nextSheetId, nextSheetName, niceScale, normalizeRange, numberInputText, numberToText, overflowExtent, pageHeaderFooter, paginateWorksheet, parseAddress, parseCellInput, parseFormula, parseHeaderFooter, parseHex, parseHtmlTable, parseNumberText, parsePrintTitleSpan, parseR1C1Range, parseRange, parseTsv, patchStyle, percentile, pictureAnchorAt, pivotGrid, pivotItemLabel as pivotPageItemLabel, pivotPageItems, pivotSourceData, pivotTableAt, pixelBoxToAnchor, pixelSizeToExtent, pixelsToCharacters, pixelsToColumnWidth, pixelsToPoints, pointsToPixels, presetEdges, printRange, printTitles, printTitlesFormula, putCell, queryPattern, quoteSheetName, rangeContains, rangeSize, rangesIntersect, readSparklineGroup, readSparklineGroups, readSparklineValues, referenceSpans, referenceTarget, referencedRanges, renameSheetInFormula, renameTableInFormula, renderChartSvg, renderHeaderFooter, renderHeaderFooterRuns, replaceText, resolveColor, resolvePasteOptions, resolveSparklineRange, rgbToHls240, rotationDegrees, rowsToRefit, sameChartColor, saveXlsx, scaleColor, selectedSparklineGroups, selectionStats, serialToDate, sheetByName, sheetPageBreaks, sheetSparklineGroups, shiftFormula, shiftRange, shiftSpan, sparklineScale, sparklineValues, sparklineView, sparklineViewAt, spillAnchorOf, splice, stepDecimals, stripFuturePrefixes, structuredToA1, styleAt, styleKey, subtractRange, syntaxParams, themeColor, timePeriodFormula, toHexColor, toHtml, toTsv, toggleAbsolute, tokenize, translateFormula, translateReferences, uniqueHeaders, usedRange, validateCellInput, validateDefinedName, validateSheetName, validateTableName, validationAt, verifySheetPassword, verifySheetPasswordAsync, verifyWorkbookPassword, visibleCells, wrappedLineCount, zoomPercent };
|