ooxml-core 1.15.0 → 1.16.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-3A7VEXVK.cjs +13 -0
- package/dist/PptxHandler-7POULDRL.mjs +4 -0
- package/dist/{PptxHandler-R5BVKEBW.mjs → PptxHandler-M35YFCUC.mjs} +2 -2
- package/dist/PresentationBuilder-C7NPM7OQ.mjs +4 -0
- package/dist/{PresentationBuilder-4AF3PZHG.cjs → PresentationBuilder-XVRTITYR.cjs} +6 -5
- package/dist/{PresentationBuilder-W67DIJBV.mjs → PresentationBuilder-Y6DJK6H2.mjs} +2 -2
- package/dist/automation/index.cjs +935 -535
- package/dist/automation/index.mjs +935 -535
- package/dist/chunk-5W2QL4SB.cjs +244 -0
- package/dist/{chunk-ZWI7MTLF.cjs → chunk-AHRFBMLK.cjs} +2846 -1546
- package/dist/{chunk-NWAQEXBK.mjs → chunk-B37EVUMG.mjs} +1 -1
- package/dist/{chunk-HU36GIYM.mjs → chunk-C2Y6SZDN.mjs} +421 -129
- package/dist/chunk-CA7KCNL3.mjs +236 -0
- package/dist/{chunk-BSUIDT6K.cjs → chunk-DWRJ62KP.cjs} +1 -0
- package/dist/{chunk-OPBZBSJF.mjs → chunk-KOX5Y5E5.mjs} +1 -1
- package/dist/{chunk-JFMIPOPV.mjs → chunk-LM6VBPQJ.mjs} +416 -15
- package/dist/{chunk-PC4MTLG4.cjs → chunk-OA5V3JJC.cjs} +8 -8
- package/dist/{chunk-7ZIZFJXT.mjs → chunk-OKGQ2X7D.mjs} +1848 -548
- package/dist/{chunk-X7MGZQ6C.cjs → chunk-UGWY72WC.cjs} +396 -254
- package/dist/{chunk-EMZIHAOH.mjs → chunk-WBCV52YV.mjs} +1846 -565
- package/dist/{chunk-2EBMHIGJ.mjs → chunk-WEFFRYXN.mjs} +379 -242
- package/dist/{chunk-AXF2FC4D.mjs → chunk-WSRCLCMB.mjs} +1 -0
- package/dist/{chunk-LMMP67YN.mjs → chunk-XCJRUBGJ.mjs} +1 -1
- package/dist/pptx/automation/index.cjs +2662 -884
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-Cadkqht8.d.ts → elements-iUzpAeqR.d.ts} +114 -25
- package/dist/pptx/chunks/elements-iUzpAeqR.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CJI2EugA.d.ts → index-BWHNCVNC.d.ts} +1671 -1534
- package/dist/pptx/chunks/index-BWHNCVNC.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CozqpSPL.d.ts → index-CiyTR6mm.d.ts} +99 -10
- package/dist/pptx/chunks/index-CiyTR6mm.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-C3L9xrqx.d.ts → text-operations-CfLVZ7DK.d.ts} +81 -3
- package/dist/pptx/chunks/text-operations-CfLVZ7DK.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +2652 -874
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +45 -1
- 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 +4 -4
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-reconcile.cjs +7 -7
- package/dist/pptx/editor/render/collaboration-reconcile.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-sync.cjs +14 -14
- package/dist/pptx/editor/render/collaboration-sync.d.ts.map +1 -1
- package/dist/pptx/editor/render/collaboration-sync.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +15 -14
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -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/slide-size-rescale.cjs +3 -3
- package/dist/pptx/editor/render/slide-size-rescale.d.ts +1 -1
- package/dist/pptx/editor/render/slide-size-rescale.d.ts.map +1 -1
- package/dist/pptx/editor/render/slide-size-rescale.mjs +3 -3
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +3208 -1106
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +156 -65
- package/dist/teams/index.mjs +156 -65
- package/dist/xlsx/edit/pivots.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +867 -467
- package/dist/xlsx/index.mjs +867 -467
- package/dist/xlsx/load/index.cjs +345 -99
- package/dist/xlsx/load/index.mjs +345 -99
- package/dist/xlsx/model-pivots.d.ts +47 -0
- package/dist/xlsx/model-pivots.d.ts.map +1 -1
- package/dist/xlsx/pivot/captions-locales.d.ts +3 -0
- package/dist/xlsx/pivot/captions-locales.d.ts.map +1 -0
- package/dist/xlsx/pivot/captions-read.d.ts +14 -0
- package/dist/xlsx/pivot/captions-read.d.ts.map +1 -0
- package/dist/xlsx/pivot/captions.d.ts +26 -0
- package/dist/xlsx/pivot/captions.d.ts.map +1 -0
- package/dist/xlsx/pivot/columns.d.ts.map +1 -1
- package/dist/xlsx/pivot/data.d.ts +3 -2
- package/dist/xlsx/pivot/data.d.ts.map +1 -1
- package/dist/xlsx/pivot/item-labels.d.ts +12 -0
- package/dist/xlsx/pivot/item-labels.d.ts.map +1 -0
- package/dist/xlsx/pivot/item-names-read.d.ts +8 -0
- package/dist/xlsx/pivot/item-names-read.d.ts.map +1 -0
- package/dist/xlsx/pivot/measures.d.ts +2 -1
- package/dist/xlsx/pivot/measures.d.ts.map +1 -1
- package/dist/xlsx/pivot/nested.d.ts.map +1 -1
- package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -1
- package/dist/xlsx/pivot/page-filter.d.ts +1 -1
- package/dist/xlsx/pivot/page-filter.d.ts.map +1 -1
- package/dist/xlsx/pivot/read.d.ts.map +1 -1
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +800 -621
- package/dist/xlsx/ui/index.mjs +800 -621
- package/package.json +1 -1
- package/dist/PptxHandler-OGLITB3F.cjs +0 -12
- package/dist/PptxHandler-UKAA5T5U.mjs +0 -3
- package/dist/PresentationBuilder-54QGEZ2F.mjs +0 -3
- package/dist/pptx/chunks/elements-Cadkqht8.d.ts.map +0 -1
- package/dist/pptx/chunks/index-CJI2EugA.d.ts.map +0 -1
- package/dist/pptx/chunks/index-CozqpSPL.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-C3L9xrqx.d.ts.map +0 -1
package/dist/xlsx/load/index.cjs
CHANGED
|
@@ -315,7 +315,7 @@ function parseOle2(buffer, options = {}) {
|
|
|
315
315
|
fatEntries.push(fatView.getUint32(i2 * 4, true));
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
function followChain(table2, start,
|
|
318
|
+
function followChain(table2, start, label2, needed) {
|
|
319
319
|
const ids = [];
|
|
320
320
|
const visited = /* @__PURE__ */ new Set();
|
|
321
321
|
let current = start;
|
|
@@ -323,26 +323,26 @@ function parseOle2(buffer, options = {}) {
|
|
|
323
323
|
if (!strict && needed !== void 0 && ids.length >= needed)
|
|
324
324
|
return ids;
|
|
325
325
|
if (visited.has(current)) {
|
|
326
|
-
throw new Ole2ParseError(`Circular reference in ${
|
|
326
|
+
throw new Ole2ParseError(`Circular reference in ${label2} chain at sector ${current}`);
|
|
327
327
|
}
|
|
328
328
|
visited.add(current);
|
|
329
329
|
ids.push(current);
|
|
330
330
|
if (table2[current] === void 0)
|
|
331
|
-
throw new Ole2ParseError(`Missing ${
|
|
331
|
+
throw new Ole2ParseError(`Missing ${label2} chain entry`);
|
|
332
332
|
current = table2[current];
|
|
333
333
|
}
|
|
334
334
|
if (current !== ENDOFCHAIN) {
|
|
335
335
|
if (strict || needed === void 0 || ids.length < needed) {
|
|
336
|
-
throw new Ole2ParseError(`Invalid ${
|
|
336
|
+
throw new Ole2ParseError(`Invalid ${label2} chain terminator`);
|
|
337
337
|
}
|
|
338
|
-
warnings.push({ code: "chain-terminator", message: `Accepted ${
|
|
338
|
+
warnings.push({ code: "chain-terminator", message: `Accepted ${label2} chain ending in 0x${current.toString(16)}` });
|
|
339
339
|
}
|
|
340
340
|
return ids;
|
|
341
341
|
}
|
|
342
|
-
function readMetadataChain(startSector,
|
|
342
|
+
function readMetadataChain(startSector, label2) {
|
|
343
343
|
if (startSector > MAXREGSECT)
|
|
344
344
|
return new Uint8Array(0);
|
|
345
|
-
const ids = followChain(fatEntries, startSector,
|
|
345
|
+
const ids = followChain(fatEntries, startSector, label2 === "directory" ? "FAT" : label2);
|
|
346
346
|
const result2 = new Uint8Array(ids.length * sectorSize);
|
|
347
347
|
ids.forEach((id, i2) => result2.set(readSector(id), i2 * sectorSize));
|
|
348
348
|
return result2;
|
|
@@ -3255,7 +3255,7 @@ var DEFAULT_XML_LIMITS = {
|
|
|
3255
3255
|
maxNodes: 5e6
|
|
3256
3256
|
};
|
|
3257
3257
|
var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
|
|
3258
|
-
function checkXmlLimits(xml,
|
|
3258
|
+
function checkXmlLimits(xml, label2, limits = {}) {
|
|
3259
3259
|
const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
|
|
3260
3260
|
const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
|
|
3261
3261
|
let depth = 0;
|
|
@@ -3268,16 +3268,16 @@ function checkXmlLimits(xml, label4, limits = {}) {
|
|
|
3268
3268
|
continue;
|
|
3269
3269
|
}
|
|
3270
3270
|
nodes++;
|
|
3271
|
-
if (nodes > maxNodes) throw new Error(`${
|
|
3271
|
+
if (nodes > maxNodes) throw new Error(`${label2} XML exceeds the limit of ${maxNodes} elements`);
|
|
3272
3272
|
if (!selfClosing && ++depth > maxDepth)
|
|
3273
|
-
throw new Error(`${
|
|
3273
|
+
throw new Error(`${label2} XML exceeds the nesting depth limit of ${maxDepth}`);
|
|
3274
3274
|
}
|
|
3275
3275
|
}
|
|
3276
3276
|
function parseXml(xml, options = {}) {
|
|
3277
|
-
const
|
|
3277
|
+
const label2 = options.label ?? "OOXML";
|
|
3278
3278
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
3279
|
-
throw new Error(`${
|
|
3280
|
-
checkXmlLimits(xml,
|
|
3279
|
+
throw new Error(`${label2} XML with DTD or entity declarations is not supported`);
|
|
3280
|
+
checkXmlLimits(xml, label2, options.limits);
|
|
3281
3281
|
let parseError = "";
|
|
3282
3282
|
let parsed;
|
|
3283
3283
|
try {
|
|
@@ -3288,12 +3288,12 @@ function parseXml(xml, options = {}) {
|
|
|
3288
3288
|
}).parseFromString(xml, "application/xml");
|
|
3289
3289
|
} catch (error) {
|
|
3290
3290
|
throw new Error(
|
|
3291
|
-
`Invalid ${
|
|
3291
|
+
`Invalid ${label2} XML: ${error instanceof Error ? error.message : String(error)}`,
|
|
3292
3292
|
{ cause: error }
|
|
3293
3293
|
);
|
|
3294
3294
|
}
|
|
3295
3295
|
if (parseError || !parsed.documentElement)
|
|
3296
|
-
throw new Error(`Invalid ${
|
|
3296
|
+
throw new Error(`Invalid ${label2} XML: ${parseError || "missing root element"}`);
|
|
3297
3297
|
return parsed;
|
|
3298
3298
|
}
|
|
3299
3299
|
var buildXml = (node2) => new xmldom.XMLSerializer().serializeToString(node2);
|
|
@@ -4403,19 +4403,19 @@ var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/packa
|
|
|
4403
4403
|
var MAX_ROW = 1048575;
|
|
4404
4404
|
var MAX_COL = 16383;
|
|
4405
4405
|
function columnLabel(col) {
|
|
4406
|
-
let
|
|
4406
|
+
let label2 = "";
|
|
4407
4407
|
let n = col + 1;
|
|
4408
4408
|
while (n > 0) {
|
|
4409
4409
|
const rem = (n - 1) % 26;
|
|
4410
|
-
|
|
4410
|
+
label2 = String.fromCharCode(65 + rem) + label2;
|
|
4411
4411
|
n = Math.floor((n - 1) / 26);
|
|
4412
4412
|
}
|
|
4413
|
-
return
|
|
4413
|
+
return label2;
|
|
4414
4414
|
}
|
|
4415
|
-
function columnIndex(
|
|
4416
|
-
if (!/^[A-Za-z]{1,3}$/.test(
|
|
4415
|
+
function columnIndex(label2) {
|
|
4416
|
+
if (!/^[A-Za-z]{1,3}$/.test(label2)) return -1;
|
|
4417
4417
|
let n = 0;
|
|
4418
|
-
for (const ch of
|
|
4418
|
+
for (const ch of label2.toUpperCase()) n = n * 26 + (ch.charCodeAt(0) - 64);
|
|
4419
4419
|
return n - 1;
|
|
4420
4420
|
}
|
|
4421
4421
|
var formatAddress = (address2) => `${columnLabel(address2.col)}${address2.row + 1}`;
|
|
@@ -6737,6 +6737,71 @@ var pivotColumnFields = (pivot) => [
|
|
|
6737
6737
|
...pivot.columnField ? pivot.moreColumnFields ?? [] : []
|
|
6738
6738
|
];
|
|
6739
6739
|
|
|
6740
|
+
// xlsx/pivot/captions.ts
|
|
6741
|
+
var FUNCTIONS = {
|
|
6742
|
+
sum: "Sum",
|
|
6743
|
+
count: "Count",
|
|
6744
|
+
average: "Average",
|
|
6745
|
+
max: "Max",
|
|
6746
|
+
min: "Min",
|
|
6747
|
+
product: "Product",
|
|
6748
|
+
countNums: "Count",
|
|
6749
|
+
stdDev: "StdDev",
|
|
6750
|
+
stdDevp: "StdDevp",
|
|
6751
|
+
var: "Var",
|
|
6752
|
+
varp: "Varp"
|
|
6753
|
+
};
|
|
6754
|
+
var aggregateNames = () => Object.fromEntries(
|
|
6755
|
+
Object.keys(FUNCTIONS).map((fn) => [
|
|
6756
|
+
fn,
|
|
6757
|
+
`${fn[0].toUpperCase()}${fn.slice(1)} of {0}`
|
|
6758
|
+
])
|
|
6759
|
+
);
|
|
6760
|
+
var ENGLISH_PIVOT_CAPTIONS = {
|
|
6761
|
+
rowLabels: "Row Labels",
|
|
6762
|
+
columnLabels: "Column Labels",
|
|
6763
|
+
grandTotal: "Grand Total",
|
|
6764
|
+
values: "Values",
|
|
6765
|
+
all: "(All)",
|
|
6766
|
+
blank: "(blank)",
|
|
6767
|
+
subtotal: "{0} Total",
|
|
6768
|
+
measureTotal: "Total {0}",
|
|
6769
|
+
functions: FUNCTIONS,
|
|
6770
|
+
aggregates: aggregateNames()
|
|
6771
|
+
};
|
|
6772
|
+
var fillCaption = (template, ...args) => template.replace(/\{(\d)\}/g, (_match, at) => args[Number(at)] ?? "");
|
|
6773
|
+
function pivotCaptions(pivot) {
|
|
6774
|
+
const own = pivot.captions;
|
|
6775
|
+
if (!own) return ENGLISH_PIVOT_CAPTIONS;
|
|
6776
|
+
return {
|
|
6777
|
+
...ENGLISH_PIVOT_CAPTIONS,
|
|
6778
|
+
...Object.fromEntries(Object.entries(own).filter(([, value2]) => typeof value2 === "string")),
|
|
6779
|
+
functions: { ...ENGLISH_PIVOT_CAPTIONS.functions, ...own.functions },
|
|
6780
|
+
aggregates: { ...ENGLISH_PIVOT_CAPTIONS.aggregates, ...own.aggregates }
|
|
6781
|
+
};
|
|
6782
|
+
}
|
|
6783
|
+
function trimmedCaptions(caps) {
|
|
6784
|
+
const out = {};
|
|
6785
|
+
for (const key of [
|
|
6786
|
+
"rowLabels",
|
|
6787
|
+
"columnLabels",
|
|
6788
|
+
"grandTotal",
|
|
6789
|
+
"values",
|
|
6790
|
+
"all",
|
|
6791
|
+
"blank",
|
|
6792
|
+
"subtotal",
|
|
6793
|
+
"measureTotal"
|
|
6794
|
+
])
|
|
6795
|
+
if (caps[key] !== ENGLISH_PIVOT_CAPTIONS[key]) out[key] = caps[key];
|
|
6796
|
+
for (const key of ["functions", "aggregates"]) {
|
|
6797
|
+
const changed = Object.keys(caps[key]).filter(
|
|
6798
|
+
(fn) => caps[key][fn] !== ENGLISH_PIVOT_CAPTIONS[key][fn]
|
|
6799
|
+
);
|
|
6800
|
+
if (changed.length) out[key] = Object.fromEntries(changed.map((fn) => [fn, caps[key][fn]]));
|
|
6801
|
+
}
|
|
6802
|
+
return Object.keys(out).length ? out : void 0;
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6740
6805
|
// xlsx/formula/date-serial.ts
|
|
6741
6806
|
var DAY_MS = 864e5;
|
|
6742
6807
|
var EPOCH_19002 = Date.UTC(1899, 11, 30);
|
|
@@ -7171,6 +7236,17 @@ function validatePivotItemFilters(pivot) {
|
|
|
7171
7236
|
}
|
|
7172
7237
|
}
|
|
7173
7238
|
|
|
7239
|
+
// xlsx/pivot/item-labels.ts
|
|
7240
|
+
var keyOf = (field, item) => `${field}\0${pivotValueKey(item)}`;
|
|
7241
|
+
function pivotItemLabeler(pivot) {
|
|
7242
|
+
const blank = pivotCaptions(pivot).blank;
|
|
7243
|
+
const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry3) => [keyOf(entry3.field, entry3.item), entry3.name])) : void 0;
|
|
7244
|
+
return (field, value2) => names?.get(keyOf(field, value2)) ?? (value2 === null || value2 === "" ? blank : pivotItemLabel(value2));
|
|
7245
|
+
}
|
|
7246
|
+
var pivotItemName = (pivot, field, item) => pivot.itemNames?.find(
|
|
7247
|
+
(entry3) => entry3.field === field && pivotValueKey(entry3.item) === pivotValueKey(item)
|
|
7248
|
+
)?.name;
|
|
7249
|
+
|
|
7174
7250
|
// xlsx/pivot/page-filter.ts
|
|
7175
7251
|
function validatePivotPageFilter(pivot) {
|
|
7176
7252
|
const filter2 = pivot.pageFilter;
|
|
@@ -7182,8 +7258,8 @@ function validatePivotPageFilter(pivot) {
|
|
|
7182
7258
|
pivot.columnField,
|
|
7183
7259
|
pivot.valueField,
|
|
7184
7260
|
...extras.map((v) => v?.field)
|
|
7185
|
-
].includes(filter2.field)
|
|
7186
|
-
throw new Error("Report filters require
|
|
7261
|
+
].includes(filter2.field))
|
|
7262
|
+
throw new Error("Report filters require a separate source field.");
|
|
7187
7263
|
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))
|
|
7188
7264
|
throw new Error("Choose a cached literal report filter item.");
|
|
7189
7265
|
}
|
|
@@ -7196,10 +7272,10 @@ function pagedProjection(pivot) {
|
|
|
7196
7272
|
if (!filter2) return pivot;
|
|
7197
7273
|
const labels = /* @__PURE__ */ new Map();
|
|
7198
7274
|
for (const item of pivotItems(pivot, filter2.field)) {
|
|
7199
|
-
const
|
|
7200
|
-
if (
|
|
7275
|
+
const label2 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
|
|
7276
|
+
if (label2 === "(all)" || labels.has(label2) && labels.get(label2) !== key2)
|
|
7201
7277
|
throw new Error("Ambiguous report filter item captions are preserved.");
|
|
7202
|
-
labels.set(
|
|
7278
|
+
labels.set(label2, key2);
|
|
7203
7279
|
}
|
|
7204
7280
|
if (filter2.item === void 0) return pivot;
|
|
7205
7281
|
const index3 = pivot.fields.indexOf(filter2.field), key = pivotValueKey(filter2.item);
|
|
@@ -7217,7 +7293,7 @@ function prependPivotPage(grid, pivot) {
|
|
|
7217
7293
|
values: [
|
|
7218
7294
|
[
|
|
7219
7295
|
pivot.pageFilter.field,
|
|
7220
|
-
pivot.pageFilter.item === void 0 ?
|
|
7296
|
+
pivot.pageFilter.item === void 0 ? pivotCaptions(pivot).all : pivotItemLabeler(pivot)(pivot.pageFilter.field, pivot.pageFilter.item),
|
|
7221
7297
|
...Array(width - 2).fill(null)
|
|
7222
7298
|
],
|
|
7223
7299
|
Array(width).fill(null),
|
|
@@ -7332,7 +7408,7 @@ function validatePivotFields(pivot) {
|
|
|
7332
7408
|
throw new Error("Values before or between fields require two row fields and Values on rows.");
|
|
7333
7409
|
if (pivot.valuesAxis === "rows" && (!Array.isArray(extras) || !extras.length))
|
|
7334
7410
|
throw new Error("Values on rows require multiple measures.");
|
|
7335
|
-
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !==
|
|
7411
|
+
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== pivotCaptions(pivot).values)
|
|
7336
7412
|
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
7337
7413
|
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
7338
7414
|
(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())
|
|
@@ -7421,7 +7497,6 @@ var pivotMeasureNumber = (pivot, records, measure) => aggregateValues(records, p
|
|
|
7421
7497
|
|
|
7422
7498
|
// xlsx/pivot/columns.ts
|
|
7423
7499
|
var SEPARATOR = "";
|
|
7424
|
-
var label = pivotItemLabel;
|
|
7425
7500
|
var columnKey = (keys, depth) => keys.slice(0, depth).join(SEPARATOR);
|
|
7426
7501
|
var recordColumnKeys = (record, indices) => indices.map((index3) => pivotValueKey(record[index3] ?? null));
|
|
7427
7502
|
function pivotColumnEntries(pivot) {
|
|
@@ -7496,7 +7571,9 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
7496
7571
|
const rows = levels + 1 + Number(count2 > 1);
|
|
7497
7572
|
const grid = Array.from({ length: rows }, () => Array(width).fill(null));
|
|
7498
7573
|
if (count2 === 1 && !valuesOnRows) grid[0][0] = pivot.valueCaption;
|
|
7499
|
-
const
|
|
7574
|
+
const caps = pivotCaptions(pivot);
|
|
7575
|
+
const labelOf = pivotItemLabeler(pivot);
|
|
7576
|
+
const titles = compact ? [caps.columnLabels] : [...columns.names, ...count2 > 1 ? [caps.values] : []];
|
|
7500
7577
|
titles.forEach((title, i2) => {
|
|
7501
7578
|
grid[0][labelColumns + i2] = title;
|
|
7502
7579
|
});
|
|
@@ -7509,17 +7586,17 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
7509
7586
|
if (entry3.kind === "leaf") {
|
|
7510
7587
|
entry3.path.forEach((_index, level) => {
|
|
7511
7588
|
const continued = entry3.path.slice(0, level + 1).every((p, i2) => p === previous[i2]);
|
|
7512
|
-
if (!continued) grid[1 + level][at] =
|
|
7589
|
+
if (!continued) grid[1 + level][at] = labelOf(columns.names[level], entry3.values[level]);
|
|
7513
7590
|
});
|
|
7514
7591
|
previous = entry3.path;
|
|
7515
7592
|
if (count2 > 1) measures.forEach((measure, m) => grid[rows - 1][at + m] = measure.caption);
|
|
7516
7593
|
return;
|
|
7517
7594
|
}
|
|
7518
7595
|
const row2 = entry3.kind === "grand" ? 1 : entry3.path.length;
|
|
7519
|
-
const name = entry3.kind === "grand" ? "" : String(
|
|
7596
|
+
const name = entry3.kind === "grand" ? "" : String(labelOf(columns.names[entry3.path.length - 1], entry3.values.at(-1)));
|
|
7520
7597
|
measures.forEach((measure, m) => {
|
|
7521
|
-
const custom = entry3.fn ?
|
|
7522
|
-
grid[row2][at + m] = custom ? count2 === 1 ? `${name} ${custom}` : `${name} ${custom} of ${measure.field}` : count2 === 1 ? entry3.kind === "grand" ?
|
|
7598
|
+
const custom = entry3.fn ? caps.functions[entry3.fn] : void 0;
|
|
7599
|
+
grid[row2][at + m] = custom ? count2 === 1 ? `${name} ${custom}` : `${name} ${custom} of ${measure.field}` : count2 === 1 ? entry3.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name) : entry3.kind === "grand" ? fillCaption(caps.measureTotal, measure.caption) : `${name} ${measure.caption}`;
|
|
7523
7600
|
});
|
|
7524
7601
|
});
|
|
7525
7602
|
return grid;
|
|
@@ -7552,7 +7629,6 @@ function pivotColumnItemsXml(entries, measures, remap) {
|
|
|
7552
7629
|
}
|
|
7553
7630
|
|
|
7554
7631
|
// xlsx/pivot/nested.ts
|
|
7555
|
-
var label2 = pivotItemLabel;
|
|
7556
7632
|
var MAX_CELLS = 1e6;
|
|
7557
7633
|
var node = (index3, value2) => ({
|
|
7558
7634
|
index: index3,
|
|
@@ -7582,6 +7658,8 @@ function nestedPivotGrid(pivot) {
|
|
|
7582
7658
|
const labelColumns = compact ? 1 : levels;
|
|
7583
7659
|
const measures = pivotMeasures(pivot);
|
|
7584
7660
|
const functions = names.map((name) => fieldSubtotalFunctions(pivot, name));
|
|
7661
|
+
const caps = pivotCaptions(pivot);
|
|
7662
|
+
const labelOf = pivotItemLabeler(pivot);
|
|
7585
7663
|
const root = node(0, null);
|
|
7586
7664
|
for (const record of pivot.records) {
|
|
7587
7665
|
const keys = recordColumnKeys(record, columnFields);
|
|
@@ -7608,7 +7686,7 @@ function nestedPivotGrid(pivot) {
|
|
|
7608
7686
|
}
|
|
7609
7687
|
const dimensions = pivotColumnDimensions(pivot, columns, labelColumns, onRows);
|
|
7610
7688
|
const rowTitles = names.map((name) => name);
|
|
7611
|
-
if (onRows) rowTitles.splice(valuesAt, 0,
|
|
7689
|
+
if (onRows) rowTitles.splice(valuesAt, 0, caps.values);
|
|
7612
7690
|
let values2 = [];
|
|
7613
7691
|
let indents = [];
|
|
7614
7692
|
const rowEntries = [];
|
|
@@ -7687,11 +7765,11 @@ function nestedPivotGrid(pivot) {
|
|
|
7687
7765
|
const children2 = [...group.children.values()].sort((a2, b) => a2.index - b.index);
|
|
7688
7766
|
children2.forEach((child4, position) => {
|
|
7689
7767
|
const here = {
|
|
7690
|
-
labels: [...path2.labels,
|
|
7768
|
+
labels: [...path2.labels, labelOf(names[field], child4.value)],
|
|
7691
7769
|
indices: [...path2.indices, child4.index],
|
|
7692
7770
|
firsts: [...path2.firsts, position === 0]
|
|
7693
7771
|
};
|
|
7694
|
-
const text2 =
|
|
7772
|
+
const text2 = labelOf(names[field], child4.value);
|
|
7695
7773
|
if (last)
|
|
7696
7774
|
return push(level, () => [
|
|
7697
7775
|
labelCells(path2, leafShown(here.firsts), level, text2),
|
|
@@ -7714,14 +7792,14 @@ function nestedPivotGrid(pivot) {
|
|
|
7714
7792
|
]);
|
|
7715
7793
|
if (own === "auto") {
|
|
7716
7794
|
if (showsValue) return;
|
|
7717
|
-
if (valuesAbove) subtotal(
|
|
7795
|
+
if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure);
|
|
7718
7796
|
else measures.forEach((one2, m) => subtotal(`${caption} ${one2.caption}`, void 0, m));
|
|
7719
7797
|
} else
|
|
7720
7798
|
for (const fn of own)
|
|
7721
|
-
if (valuesAbove) subtotal(`${caption} ${
|
|
7799
|
+
if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure);
|
|
7722
7800
|
else
|
|
7723
7801
|
measures.forEach(
|
|
7724
|
-
(one2, m) => subtotal(`${caption} ${
|
|
7802
|
+
(one2, m) => subtotal(`${caption} ${caps.functions[fn]} of ${one2.field}`, fn, m)
|
|
7725
7803
|
);
|
|
7726
7804
|
});
|
|
7727
7805
|
};
|
|
@@ -7732,12 +7810,12 @@ function nestedPivotGrid(pivot) {
|
|
|
7732
7810
|
]);
|
|
7733
7811
|
const build = () => {
|
|
7734
7812
|
walk(0, root, void 0, { labels: [], indices: [], firsts: [] });
|
|
7735
|
-
if (onRows) measures.forEach((one2, m) => grand(
|
|
7736
|
-
else grand(
|
|
7813
|
+
if (onRows) measures.forEach((one2, m) => grand(fillCaption(caps.measureTotal, one2.caption), m));
|
|
7814
|
+
else grand(caps.grandTotal);
|
|
7737
7815
|
};
|
|
7738
7816
|
build();
|
|
7739
7817
|
counting = false;
|
|
7740
|
-
values2 = pivotColumnHeaders(pivot, columns, compact ? [
|
|
7818
|
+
values2 = pivotColumnHeaders(pivot, columns, compact ? [caps.rowLabels] : rowTitles, onRows);
|
|
7741
7819
|
const firstDataRow = values2.length;
|
|
7742
7820
|
indents = values2.map(() => 0);
|
|
7743
7821
|
build();
|
|
@@ -7770,14 +7848,14 @@ function pivotTableAt(sheet, at) {
|
|
|
7770
7848
|
var X14 = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
|
|
7771
7849
|
var LAYOUT = "http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout";
|
|
7772
7850
|
var TABLE = {
|
|
7773
|
-
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",
|
|
7851
|
+
pivotTableDefinition: "name cacheId dataCaption grandTotalCaption rowHeaderCaption colHeaderCaption dataOnRows dataPosition updatedVersion minRefreshableVersion createdVersion applyNumberFormats applyBorderFormats applyFontFormats applyPatternFormats applyAlignmentFormats applyWidthHeightFormats useAutoFormatting itemPrintTitles indent compact compactData outline outlineData multipleFieldFilters rowGrandTotals colGrandTotals",
|
|
7774
7852
|
location: "ref firstHeaderRow firstDataRow firstDataCol rowPageCount colPageCount",
|
|
7775
7853
|
pageFields: "count",
|
|
7776
7854
|
pageField: "fld item hier",
|
|
7777
7855
|
pivotFields: "count",
|
|
7778
7856
|
pivotField: "axis dataField compact outline showAll subtotalTop defaultSubtotal numFmtId sumSubtotal countASubtotal avgSubtotal maxSubtotal minSubtotal productSubtotal countSubtotal stdDevSubtotal stdDevPSubtotal varSubtotal varPSubtotal",
|
|
7779
7857
|
items: "count",
|
|
7780
|
-
item: "x t h",
|
|
7858
|
+
item: "x t h n",
|
|
7781
7859
|
rowFields: "count",
|
|
7782
7860
|
colFields: "count",
|
|
7783
7861
|
field: "x",
|
|
@@ -7890,6 +7968,121 @@ function assertPivotRecords(records) {
|
|
|
7890
7968
|
);
|
|
7891
7969
|
}
|
|
7892
7970
|
|
|
7971
|
+
// xlsx/pivot/captions-read.ts
|
|
7972
|
+
var ATTRIBUTES = {
|
|
7973
|
+
rowHeaderCaption: "rowLabels",
|
|
7974
|
+
colHeaderCaption: "columnLabels",
|
|
7975
|
+
grandTotalCaption: "grandTotal",
|
|
7976
|
+
dataCaption: "values"
|
|
7977
|
+
};
|
|
7978
|
+
function readPivotCaptionAttributes(root) {
|
|
7979
|
+
const out = {};
|
|
7980
|
+
for (const [attribute2, key] of Object.entries(ATTRIBUTES)) {
|
|
7981
|
+
const text2 = att(root, attribute2);
|
|
7982
|
+
if (text2 !== void 0)
|
|
7983
|
+
out[key] = decodeEscapes(text2);
|
|
7984
|
+
}
|
|
7985
|
+
return out;
|
|
7986
|
+
}
|
|
7987
|
+
function aggregateCaptionsOf(pivot) {
|
|
7988
|
+
const out = {};
|
|
7989
|
+
for (const measure of [
|
|
7990
|
+
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
7991
|
+
...pivot.additionalValues ?? []
|
|
7992
|
+
]) {
|
|
7993
|
+
const at = measure.caption.indexOf(measure.field);
|
|
7994
|
+
if (at < 0 || measure.caption === measure.field) continue;
|
|
7995
|
+
const template = `${measure.caption.slice(0, at)}{0}${measure.caption.slice(at + measure.field.length)}`;
|
|
7996
|
+
if (template !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure.aggregate])
|
|
7997
|
+
out[measure.aggregate] = template;
|
|
7998
|
+
}
|
|
7999
|
+
return Object.keys(out).length ? out : void 0;
|
|
8000
|
+
}
|
|
8001
|
+
var MARK = "";
|
|
8002
|
+
var SENTINELS = {
|
|
8003
|
+
rowLabels: `${MARK}R`,
|
|
8004
|
+
columnLabels: `${MARK}C`,
|
|
8005
|
+
grandTotal: `${MARK}G`,
|
|
8006
|
+
values: `${MARK}V`,
|
|
8007
|
+
all: `${MARK}A`,
|
|
8008
|
+
blank: `${MARK}B`,
|
|
8009
|
+
subtotal: `{0}${MARK}S`,
|
|
8010
|
+
measureTotal: `${MARK}M{0}`,
|
|
8011
|
+
functions: Object.fromEntries(
|
|
8012
|
+
Object.keys(ENGLISH_PIVOT_CAPTIONS.functions).map((fn) => [fn, `${MARK}F${fn}`])
|
|
8013
|
+
),
|
|
8014
|
+
aggregates: ENGLISH_PIVOT_CAPTIONS.aggregates
|
|
8015
|
+
};
|
|
8016
|
+
function templateOf(cached, arg) {
|
|
8017
|
+
if (!arg || !cached.includes(arg)) return void 0;
|
|
8018
|
+
if (cached.startsWith(arg)) return `{0}${cached.slice(arg.length)}`;
|
|
8019
|
+
if (cached.endsWith(arg)) return `${cached.slice(0, -arg.length)}{0}`;
|
|
8020
|
+
const at = cached.indexOf(arg);
|
|
8021
|
+
return `${cached.slice(0, at)}{0}${cached.slice(at + arg.length)}`;
|
|
8022
|
+
}
|
|
8023
|
+
function inferPivotCaptions(pivot, sheet, named2) {
|
|
8024
|
+
const known = pivotCaptions({ captions: named2 });
|
|
8025
|
+
const probe = { ...SENTINELS };
|
|
8026
|
+
for (const key of Object.keys(named2))
|
|
8027
|
+
if (typeof named2[key] === "string")
|
|
8028
|
+
probe[key] = known[key];
|
|
8029
|
+
const grid = pivotGrid({ ...pivot, captions: probe });
|
|
8030
|
+
const found = /* @__PURE__ */ new Map();
|
|
8031
|
+
const set = (key, value2) => {
|
|
8032
|
+
if (value2 === void 0) return;
|
|
8033
|
+
const before = found.get(key);
|
|
8034
|
+
found.set(key, before === void 0 || before === value2 ? value2 : null);
|
|
8035
|
+
};
|
|
8036
|
+
grid.values.forEach(
|
|
8037
|
+
(line2, r) => line2.forEach((expected, c2) => {
|
|
8038
|
+
if (typeof expected !== "string" || !expected.includes(MARK)) return;
|
|
8039
|
+
const cached = getCell(
|
|
8040
|
+
sheet,
|
|
8041
|
+
pivot.location.start.row + r,
|
|
8042
|
+
pivot.location.start.col + c2
|
|
8043
|
+
)?.value;
|
|
8044
|
+
if (typeof cached !== "string") return;
|
|
8045
|
+
const kind = /\u0001([RCGVASMFB])(\w*)/.exec(expected);
|
|
8046
|
+
if (!kind) return;
|
|
8047
|
+
const at = kind.index;
|
|
8048
|
+
switch (kind[1]) {
|
|
8049
|
+
case "R":
|
|
8050
|
+
return set("rowLabels", cached);
|
|
8051
|
+
case "C":
|
|
8052
|
+
return set("columnLabels", cached);
|
|
8053
|
+
case "G":
|
|
8054
|
+
return set("grandTotal", cached);
|
|
8055
|
+
case "V":
|
|
8056
|
+
return set("values", cached);
|
|
8057
|
+
case "A":
|
|
8058
|
+
return set("all", cached);
|
|
8059
|
+
case "B":
|
|
8060
|
+
return set("blank", cached);
|
|
8061
|
+
case "S":
|
|
8062
|
+
return set("subtotal", templateOf(cached, expected.slice(0, at)));
|
|
8063
|
+
case "M":
|
|
8064
|
+
return set("measureTotal", templateOf(cached, expected.slice(at + 2)));
|
|
8065
|
+
case "F": {
|
|
8066
|
+
const item = expected.slice(0, at - 1);
|
|
8067
|
+
const of = / of (.*)$/.exec(expected.slice(at));
|
|
8068
|
+
const word = cached.slice(item.length + 1, of ? cached.length - of[0].length : void 0);
|
|
8069
|
+
if (cached.startsWith(`${item} `) && (!of || cached.endsWith(of[0])))
|
|
8070
|
+
set(`function:${kind[2]}`, word);
|
|
8071
|
+
}
|
|
8072
|
+
}
|
|
8073
|
+
})
|
|
8074
|
+
);
|
|
8075
|
+
const out = pivotCaptions({ captions: named2 });
|
|
8076
|
+
const functions = { ...out.functions };
|
|
8077
|
+
for (const [key, value2] of found) {
|
|
8078
|
+
if (value2 === null) continue;
|
|
8079
|
+
if (key.startsWith("function:")) functions[key.slice(9)] = value2;
|
|
8080
|
+
else out[key] = value2;
|
|
8081
|
+
}
|
|
8082
|
+
out.functions = functions;
|
|
8083
|
+
return trimmedCaptions(out);
|
|
8084
|
+
}
|
|
8085
|
+
|
|
7893
8086
|
// xlsx/slicer/read-slicers.ts
|
|
7894
8087
|
var TABLE_SLICER_URI = "{2F2917AC-EB37-4324-AD4E-5DD8C200BD13}";
|
|
7895
8088
|
var X152 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
|
|
@@ -8329,7 +8522,7 @@ function readFieldGroups(fields, names) {
|
|
|
8329
8522
|
throw new Error("Unsupported pivot field group");
|
|
8330
8523
|
const labels = children(list, "s", NS.x).map((node2) => decodeEscapes(att(node2, "v") ?? ""));
|
|
8331
8524
|
const expected = numberGroupLabels({ start, end, by });
|
|
8332
|
-
if (elements(list).length !== labels.length || labels.length !== expected.length || labels.some((
|
|
8525
|
+
if (elements(list).length !== labels.length || labels.length !== expected.length || labels.some((label2, i2) => label2 !== expected[i2]))
|
|
8333
8526
|
throw new Error("Unsupported pivot group items");
|
|
8334
8527
|
groups.push({ field: names[index3] ?? "", start, end, by });
|
|
8335
8528
|
});
|
|
@@ -8413,7 +8606,7 @@ function readDateGroups(fields, count2, names, dateFields, records, date1904) {
|
|
|
8413
8606
|
const node2 = first(first(entry3.node, "fieldGroup", NS.x), "groupItems", NS.x);
|
|
8414
8607
|
const actual = children(node2, "s", NS.x).map((item) => decodeEscapes(att(item, "v") ?? ""));
|
|
8415
8608
|
const name = decodeEscapes(att(entry3.node, "name") ?? "");
|
|
8416
|
-
if (!name || elements(node2).length !== actual.length || actual.length !== labels.length || actual.some((
|
|
8609
|
+
if (!name || elements(node2).length !== actual.length || actual.length !== labels.length || actual.some((label2) => !label2) || new Set(actual).size !== actual.length)
|
|
8417
8610
|
throw unsupported("group items");
|
|
8418
8611
|
if (name !== dateGroupFieldName(entry3.unit, field) || actual.some((l, i2) => l !== labels[i2]))
|
|
8419
8612
|
localized[entry3.unit] = { name, labels: actual };
|
|
@@ -8471,6 +8664,25 @@ function readItemFilters(fields, names, shared) {
|
|
|
8471
8664
|
return filters.length ? filters : void 0;
|
|
8472
8665
|
}
|
|
8473
8666
|
|
|
8667
|
+
// xlsx/pivot/item-names-read.ts
|
|
8668
|
+
function readItemNames(tableFields, names, shared) {
|
|
8669
|
+
const out = [];
|
|
8670
|
+
tableFields.forEach((field, index3) => {
|
|
8671
|
+
const list = first(field, "items", NS.x);
|
|
8672
|
+
if (!list || index3 >= names.length) return;
|
|
8673
|
+
for (const item of children(list, "item", NS.x)) {
|
|
8674
|
+
const name = att(item, "n");
|
|
8675
|
+
if (name === void 0) continue;
|
|
8676
|
+
const at = Number(att(item, "x"));
|
|
8677
|
+
const value2 = shared[index3]?.[at];
|
|
8678
|
+
if (att(item, "t") !== void 0 || !Number.isInteger(at) || value2 === void 0)
|
|
8679
|
+
throw new Error("Unsupported pivot item name");
|
|
8680
|
+
out.push({ field: names[index3], item: value2, name: decodeEscapes(name) });
|
|
8681
|
+
}
|
|
8682
|
+
});
|
|
8683
|
+
return out;
|
|
8684
|
+
}
|
|
8685
|
+
|
|
8474
8686
|
// xlsx/pivot/values-axis.ts
|
|
8475
8687
|
function remapPivotRowEntries(entries, axes2) {
|
|
8476
8688
|
return entries.map(
|
|
@@ -8634,7 +8846,10 @@ function assertPageAxisItems(root, pivot, shared, cache2, recordRoot) {
|
|
|
8634
8846
|
};
|
|
8635
8847
|
const rowAxes = pivotRowFields(pivot).map((name) => axisValues(name, "axisRow")), rowItems = read("rowItems");
|
|
8636
8848
|
const grid = pivotGrid(pivot);
|
|
8637
|
-
const
|
|
8849
|
+
const valuesAt = pivotValuesIndex(pivot);
|
|
8850
|
+
const levelAxes = [...rowAxes];
|
|
8851
|
+
if (valuesAt >= 0) levelAxes.splice(valuesAt, 0, null);
|
|
8852
|
+
const entries = grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, levelAxes) : [
|
|
8638
8853
|
...rowAxes[0].map((index3) => ({ indices: [index3] })),
|
|
8639
8854
|
{ indices: [0], type: "grand" }
|
|
8640
8855
|
];
|
|
@@ -8644,11 +8859,11 @@ function assertPageAxisItems(root, pivot, shared, cache2, recordRoot) {
|
|
|
8644
8859
|
const expected2 = entries[i2];
|
|
8645
8860
|
const xs = children(item, "x", NS.x).map((x) => integer(x.getAttribute("v"), 0)), prefix = integer(item.getAttribute("r"), 0);
|
|
8646
8861
|
const type = expected2.type === void 0 || expected2.type === "default" || expected2.type === "grand" ? expected2.type : PIVOT_SUBTOTALS[expected2.type].item;
|
|
8647
|
-
if (item.getAttribute("t") !== (type ?? null) || !Number.isInteger(prefix) || prefix < 0 || prefix > previousRow.length || prefix >= expected2.indices.length || expected2.type === "grand" && prefix !== 0 || integer(item.getAttribute("i"), 0) !== 0 || JSON.stringify([...previousRow.slice(0, prefix), ...xs]) !== JSON.stringify(expected2.indices))
|
|
8862
|
+
if (item.getAttribute("t") !== (type ?? null) || !Number.isInteger(prefix) || prefix < 0 || prefix > previousRow.length || prefix >= expected2.indices.length || expected2.type === "grand" && prefix !== 0 || integer(item.getAttribute("i"), 0) !== (expected2.measure ?? 0) || JSON.stringify([...previousRow.slice(0, prefix), ...xs]) !== JSON.stringify(expected2.indices))
|
|
8648
8863
|
throw new Error("Unmodeled page row item");
|
|
8649
8864
|
previousRow = expected2.type === "grand" ? [] : expected2.indices;
|
|
8650
8865
|
});
|
|
8651
|
-
const measures = 1 + (pivot.additionalValues?.length ?? 0), columns = pivot.columnField ? axisValues(pivot.columnField, "axisCol") : void 0, expected = [];
|
|
8866
|
+
const measures = valuesAt >= 0 ? 1 : 1 + (pivot.additionalValues?.length ?? 0), columns = pivot.columnField ? axisValues(pivot.columnField, "axisCol") : void 0, expected = [];
|
|
8652
8867
|
if (columns)
|
|
8653
8868
|
for (const col of columns)
|
|
8654
8869
|
for (let m = 0; m < measures; m++) expected.push(measures > 1 ? [col, m] : [col]);
|
|
@@ -8690,6 +8905,10 @@ function value(node2, date1904 = false) {
|
|
|
8690
8905
|
if (node2.localName === "e" && isErrorCode(v)) return { error: v };
|
|
8691
8906
|
throw new Error("Unsupported pivot cache item");
|
|
8692
8907
|
}
|
|
8908
|
+
var namedAggregates = (pivot) => {
|
|
8909
|
+
const aggregates = aggregateCaptionsOf(pivot);
|
|
8910
|
+
return aggregates ? { aggregates } : {};
|
|
8911
|
+
};
|
|
8693
8912
|
function readOne(workbook, source2, part) {
|
|
8694
8913
|
const xml = source2.text(part);
|
|
8695
8914
|
const root = parseXml(xml).documentElement;
|
|
@@ -8836,6 +9055,7 @@ function readOne(workbook, source2, part) {
|
|
|
8836
9055
|
location.start.row -= 2;
|
|
8837
9056
|
}
|
|
8838
9057
|
const itemFilters = readItemFilters(tableFields, names, shared);
|
|
9058
|
+
const itemNames = readItemNames(tableFields, names, shared);
|
|
8839
9059
|
const slicerCacheId = readSlicerCacheId(cache2);
|
|
8840
9060
|
const fieldGroups = readFieldGroups(fields, names);
|
|
8841
9061
|
const dateFields = readDateFields(fields, names);
|
|
@@ -8874,6 +9094,7 @@ function readOne(workbook, source2, part) {
|
|
|
8874
9094
|
const pivot = {
|
|
8875
9095
|
...pageFilter ? { pageFilter } : {},
|
|
8876
9096
|
...itemFilters ? { itemFilters } : {},
|
|
9097
|
+
...itemNames.length ? { itemNames } : {},
|
|
8877
9098
|
...fieldGroups.length ? { fieldGroups } : {},
|
|
8878
9099
|
...dateFields.length ? { dateFields } : {},
|
|
8879
9100
|
...dateGroups.length ? { dateGroups } : {},
|
|
@@ -8916,6 +9137,12 @@ function readOne(workbook, source2, part) {
|
|
|
8916
9137
|
...col ? { columnField: col } : {},
|
|
8917
9138
|
...moreColumns.length ? { moreColumnFields: moreColumns } : {}
|
|
8918
9139
|
};
|
|
9140
|
+
const captions = trimmedCaptions(
|
|
9141
|
+
pivotCaptions({
|
|
9142
|
+
captions: { ...readPivotCaptionAttributes(root), ...namedAggregates(pivot) }
|
|
9143
|
+
})
|
|
9144
|
+
);
|
|
9145
|
+
if (captions) pivot.captions = captions;
|
|
8919
9146
|
if (pageFilter && moreColumns.length) throw new Error("Report filters support one column field");
|
|
8920
9147
|
assertPageAxisItems(root, pivot, shared, cache2, recordRoot);
|
|
8921
9148
|
return pivot;
|
|
@@ -8943,6 +9170,12 @@ function readPivotTables(workbook, source2, warn, slicers) {
|
|
|
8943
9170
|
if (slicers.blocked.has(pivotKey(sheet.sheetId, name)) || cache2 && (caches2.get(cache2) ?? 0) > 1)
|
|
8944
9171
|
throw new Error("Shared pivot cache or unsupported slicer connection");
|
|
8945
9172
|
const pivot = readOne(workbook, source2, part);
|
|
9173
|
+
const inferred = inferPivotCaptions(pivot, sheet, {
|
|
9174
|
+
...readPivotCaptionAttributes(parseXml(pivot.sourceXml).documentElement),
|
|
9175
|
+
...namedAggregates(pivot)
|
|
9176
|
+
});
|
|
9177
|
+
if (inferred) pivot.captions = inferred;
|
|
9178
|
+
else delete pivot.captions;
|
|
8946
9179
|
const grid = pivotGrid(pivot);
|
|
8947
9180
|
if (grid.values.length !== pivot.location.end.row - pivot.location.start.row + 1 || grid.values[0].length !== pivot.location.end.col - pivot.location.start.col + 1 || grid.values.some(
|
|
8948
9181
|
(line2, r) => line2.some(
|
|
@@ -9703,7 +9936,7 @@ function mergeSpacedAreas(tokens2) {
|
|
|
9703
9936
|
}
|
|
9704
9937
|
return out;
|
|
9705
9938
|
}
|
|
9706
|
-
function
|
|
9939
|
+
function templateOf2(formula) {
|
|
9707
9940
|
const cached = templates.get(formula);
|
|
9708
9941
|
if (cached !== void 0) return cached;
|
|
9709
9942
|
const raw2 = safeTokens(formula);
|
|
@@ -9733,7 +9966,7 @@ function templateOf(formula) {
|
|
|
9733
9966
|
return template;
|
|
9734
9967
|
}
|
|
9735
9968
|
function rewriteTemplate(formula, rewrite2) {
|
|
9736
|
-
const template =
|
|
9969
|
+
const template = templateOf2(formula);
|
|
9737
9970
|
if (!template) return formula;
|
|
9738
9971
|
let next;
|
|
9739
9972
|
for (let i2 = 0; i2 < template.length; i2++) {
|
|
@@ -10315,8 +10548,8 @@ function parseDiagramDataModel(source2, part) {
|
|
|
10315
10548
|
"CONNECTION_ENDPOINT_MISSING",
|
|
10316
10549
|
`dgm:cxn ${attribute2} references missing point: ${id}.`
|
|
10317
10550
|
);
|
|
10318
|
-
const
|
|
10319
|
-
connections.push(
|
|
10551
|
+
const label2 = connectionLabel(connection, transitionText);
|
|
10552
|
+
connections.push(label2 ? { ...connection, label: label2 } : connection);
|
|
10320
10553
|
if ((!connection.type || connection.type === "parOf") && !parentById.has(connection.destId))
|
|
10321
10554
|
parentById.set(connection.destId, connection.sourceId);
|
|
10322
10555
|
}
|
|
@@ -10355,14 +10588,14 @@ function colorList(container2) {
|
|
|
10355
10588
|
}
|
|
10356
10589
|
function parseDiagramColors(source2) {
|
|
10357
10590
|
const root = rootOf2(source2);
|
|
10358
|
-
const labels = children(root, "styleLbl", NS.dgm).map((
|
|
10359
|
-
name: stringAttribute(
|
|
10360
|
-
fill: colorList(first(
|
|
10361
|
-
line: colorList(first(
|
|
10362
|
-
effect: colorList(first(
|
|
10363
|
-
textLine: colorList(first(
|
|
10364
|
-
textFill: colorList(first(
|
|
10365
|
-
textEffect: colorList(first(
|
|
10591
|
+
const labels = children(root, "styleLbl", NS.dgm).map((label2) => ({
|
|
10592
|
+
name: stringAttribute(label2, "name") ?? "",
|
|
10593
|
+
fill: colorList(first(label2, "fillClrLst", NS.dgm)),
|
|
10594
|
+
line: colorList(first(label2, "linClrLst", NS.dgm)),
|
|
10595
|
+
effect: colorList(first(label2, "effectClrLst", NS.dgm)),
|
|
10596
|
+
textLine: colorList(first(label2, "txLinClrLst", NS.dgm)),
|
|
10597
|
+
textFill: colorList(first(label2, "txFillClrLst", NS.dgm)),
|
|
10598
|
+
textEffect: colorList(first(label2, "txEffectClrLst", NS.dgm))
|
|
10366
10599
|
}));
|
|
10367
10600
|
return { ...parseDefinitionHeader(root), labels };
|
|
10368
10601
|
}
|
|
@@ -10395,16 +10628,16 @@ function parseStyleReferences(style2) {
|
|
|
10395
10628
|
var hasContent = (element2) => Boolean(element2 && (element2.attributes.length > 0 || elements(element2).length > 0));
|
|
10396
10629
|
function parseDiagramQuickStyle(source2) {
|
|
10397
10630
|
const root = rootOf2(source2);
|
|
10398
|
-
const labels = children(root, "styleLbl", NS.dgm).map((
|
|
10399
|
-
name: stringAttribute(
|
|
10400
|
-
...parseStyleReferences(first(
|
|
10401
|
-
hasScene3d: Boolean(first(
|
|
10402
|
-
hasShape3d: hasContent(first(
|
|
10631
|
+
const labels = children(root, "styleLbl", NS.dgm).map((label2) => ({
|
|
10632
|
+
name: stringAttribute(label2, "name") ?? "",
|
|
10633
|
+
...parseStyleReferences(first(label2, "style", NS.dgm)),
|
|
10634
|
+
hasScene3d: Boolean(first(label2, "scene3d", NS.dgm)),
|
|
10635
|
+
hasShape3d: hasContent(first(label2, "sp3d", NS.dgm))
|
|
10403
10636
|
}));
|
|
10404
10637
|
return {
|
|
10405
10638
|
...parseDefinitionHeader(root),
|
|
10406
10639
|
labels,
|
|
10407
|
-
has3d: labels.some((
|
|
10640
|
+
has3d: labels.some((label2) => label2.hasShape3d)
|
|
10408
10641
|
};
|
|
10409
10642
|
}
|
|
10410
10643
|
function parseDiagramLayoutSummary(source2) {
|
|
@@ -12081,10 +12314,10 @@ function parseDisplayUnits(context, element2) {
|
|
|
12081
12314
|
if (!element2) return void 0;
|
|
12082
12315
|
reportUnmodelled(context, element2, DISPLAY_UNITS);
|
|
12083
12316
|
const labelElement = cChild(element2, "dispUnitsLbl");
|
|
12084
|
-
let
|
|
12317
|
+
let label2;
|
|
12085
12318
|
if (labelElement) {
|
|
12086
12319
|
reportUnmodelled(context, labelElement, DISPLAY_UNITS_LABEL);
|
|
12087
|
-
|
|
12320
|
+
label2 = assignDefined(
|
|
12088
12321
|
{},
|
|
12089
12322
|
{
|
|
12090
12323
|
layout: manualLayout(labelElement),
|
|
@@ -12099,7 +12332,7 @@ function parseDisplayUnits(context, element2) {
|
|
|
12099
12332
|
{
|
|
12100
12333
|
builtInUnit: cVal(element2, "builtInUnit"),
|
|
12101
12334
|
customUnit: cNumber(context, element2, "custUnit"),
|
|
12102
|
-
label:
|
|
12335
|
+
label: label2,
|
|
12103
12336
|
extLst: extensionList(element2)
|
|
12104
12337
|
}
|
|
12105
12338
|
);
|
|
@@ -13695,8 +13928,8 @@ function parseTable(xml, partName) {
|
|
|
13695
13928
|
if (id !== void 0 && Number.isInteger(id) && id >= 0) column2.sourceId = id;
|
|
13696
13929
|
const fn = att(node2, "totalsRowFunction");
|
|
13697
13930
|
if (fn && fn !== "none") column2.totalsRowFunction = fn;
|
|
13698
|
-
const
|
|
13699
|
-
if (
|
|
13931
|
+
const label2 = att(node2, "totalsRowLabel");
|
|
13932
|
+
if (label2 !== void 0) column2.totalsRowLabel = label2;
|
|
13700
13933
|
const calculated = xFirst(node2, "calculatedColumnFormula");
|
|
13701
13934
|
if (calculated) column2.calculatedColumnFormula = stripFuturePrefixes(xText(calculated));
|
|
13702
13935
|
return column2;
|
|
@@ -14580,10 +14813,10 @@ function titleXml(context, title) {
|
|
|
14580
14813
|
function labelOptionsXml(context, options) {
|
|
14581
14814
|
return numberFormatXml(options.numberFormat) + shapePropertiesXml(context, options.spPr) + textBodyXml(context, options.txPr) + valXml("dLblPos", options.position) + valXml("showLegendKey", options.showLegendKey) + valXml("showVal", options.showValue) + valXml("showCatName", options.showCategoryName) + valXml("showSerName", options.showSeriesName) + valXml("showPercent", options.showPercent) + valXml("showBubbleSize", options.showBubbleSize) + (options.separator === void 0 ? "" : textElement("separator", options.separator));
|
|
14582
14815
|
}
|
|
14583
|
-
function labelXml(context,
|
|
14816
|
+
function labelXml(context, label2) {
|
|
14584
14817
|
return elementXml(
|
|
14585
14818
|
"dLbl",
|
|
14586
|
-
valXml("idx",
|
|
14819
|
+
valXml("idx", label2.index) + valXml("delete", label2.deleted) + layoutXml(context, label2.layout) + chartTextXml(context, label2.tx, false) + labelOptionsXml(context, label2) + raw(context, label2.extLst)
|
|
14587
14820
|
);
|
|
14588
14821
|
}
|
|
14589
14822
|
function dataLabelsXml(context, labels) {
|
|
@@ -14591,7 +14824,7 @@ function dataLabelsXml(context, labels) {
|
|
|
14591
14824
|
const leaderLines = labels.leaderLines ? elementXml("leaderLines", shapePropertiesXml(context, labels.leaderLines.spPr)) : "";
|
|
14592
14825
|
return elementXml(
|
|
14593
14826
|
"dLbls",
|
|
14594
|
-
labels.labels.map((
|
|
14827
|
+
labels.labels.map((label2) => labelXml(context, label2)).join("") + valXml("delete", labels.deleted) + labelOptionsXml(context, labels) + valXml("showLeaderLines", labels.showLeaderLines) + leaderLines + raw(context, labels.extLst)
|
|
14595
14828
|
);
|
|
14596
14829
|
}
|
|
14597
14830
|
|
|
@@ -14612,12 +14845,12 @@ function dataTableXml(context, table2) {
|
|
|
14612
14845
|
}
|
|
14613
14846
|
function displayUnitsXml(context, units) {
|
|
14614
14847
|
if (!units) return "";
|
|
14615
|
-
const
|
|
14848
|
+
const label2 = units.label;
|
|
14616
14849
|
return elementXml(
|
|
14617
14850
|
"dispUnits",
|
|
14618
|
-
valXml("custUnit", units.customUnit) + (units.customUnit === void 0 ? valXml("builtInUnit", units.builtInUnit) : "") + (
|
|
14851
|
+
valXml("custUnit", units.customUnit) + (units.customUnit === void 0 ? valXml("builtInUnit", units.builtInUnit) : "") + (label2 ? elementXml(
|
|
14619
14852
|
"dispUnitsLbl",
|
|
14620
|
-
layoutXml(context,
|
|
14853
|
+
layoutXml(context, label2.layout) + chartTextXml(context, label2.tx, false) + shapePropertiesXml(context, label2.spPr) + textBodyXml(context, label2.txPr)
|
|
14621
14854
|
) : "") + raw(context, units.extLst)
|
|
14622
14855
|
);
|
|
14623
14856
|
}
|
|
@@ -14642,11 +14875,11 @@ function axisXml(context, axis) {
|
|
|
14642
14875
|
}
|
|
14643
14876
|
|
|
14644
14877
|
// chart/write-analysis.ts
|
|
14645
|
-
function trendlineLabelXml(context,
|
|
14646
|
-
if (!
|
|
14878
|
+
function trendlineLabelXml(context, label2) {
|
|
14879
|
+
if (!label2) return "";
|
|
14647
14880
|
return elementXml(
|
|
14648
14881
|
"trendlineLbl",
|
|
14649
|
-
layoutXml(context,
|
|
14882
|
+
layoutXml(context, label2.layout) + chartTextXml(context, label2.tx, false) + numberFormatXml(label2.numberFormat) + shapePropertiesXml(context, label2.spPr) + textBodyXml(context, label2.txPr) + raw(context, label2.extLst)
|
|
14650
14883
|
);
|
|
14651
14884
|
}
|
|
14652
14885
|
function trendlineXml(context, trendline) {
|
|
@@ -16663,14 +16896,14 @@ function unique(args, ctx) {
|
|
|
16663
16896
|
const byCol = args.length > 1 && args[1] !== null && toBool(ctx.toScalar(args[1] ?? null));
|
|
16664
16897
|
const once = args.length > 2 && args[2] !== null && toBool(ctx.toScalar(args[2] ?? null));
|
|
16665
16898
|
if (byCol) m = transpose(m);
|
|
16666
|
-
const
|
|
16899
|
+
const keyOf3 = (row2) => JSON.stringify(
|
|
16667
16900
|
row2.map(
|
|
16668
16901
|
(v) => isError(v) ? `#${v.error}` : typeof v === "string" ? `s${v.toLowerCase()}` : v
|
|
16669
16902
|
)
|
|
16670
16903
|
);
|
|
16671
16904
|
const counts = /* @__PURE__ */ new Map();
|
|
16672
16905
|
for (const row2 of m.data) {
|
|
16673
|
-
const key =
|
|
16906
|
+
const key = keyOf3(row2);
|
|
16674
16907
|
const entry3 = counts.get(key);
|
|
16675
16908
|
if (entry3) entry3.count++;
|
|
16676
16909
|
else counts.set(key, { row: row2, count: 1 });
|
|
@@ -16955,11 +17188,11 @@ function gammaLn(z) {
|
|
|
16955
17188
|
|
|
16956
17189
|
// xlsx/formula/functions/database.ts
|
|
16957
17190
|
var C3 = "Database";
|
|
16958
|
-
var
|
|
17191
|
+
var label = (value2) => value2 === null ? "" : typeof value2 === "string" ? value2 : String(value2);
|
|
16959
17192
|
function tableOf(ctx, value2) {
|
|
16960
17193
|
const [head, ...records] = ctx.toMatrix(value2 ?? null).data;
|
|
16961
17194
|
if (!head || records.length === 0) fail(ERR.VALUE);
|
|
16962
|
-
return { headers: head.map((v) =>
|
|
17195
|
+
return { headers: head.map((v) => label(v).toLowerCase()), records };
|
|
16963
17196
|
}
|
|
16964
17197
|
function fieldIndex(table2, field) {
|
|
16965
17198
|
const value2 = scalar2(field);
|
|
@@ -16969,7 +17202,7 @@ function fieldIndex(table2, field) {
|
|
|
16969
17202
|
if (index4 < 0 || index4 >= table2.headers.length) fail(ERR.VALUE);
|
|
16970
17203
|
return index4;
|
|
16971
17204
|
}
|
|
16972
|
-
const index3 = table2.headers.indexOf(
|
|
17205
|
+
const index3 = table2.headers.indexOf(label(value2).toLowerCase());
|
|
16973
17206
|
if (index3 < 0) fail(ERR.VALUE);
|
|
16974
17207
|
return index3;
|
|
16975
17208
|
}
|
|
@@ -16978,7 +17211,7 @@ function recordFilter(table2, criteria) {
|
|
|
16978
17211
|
if (!head || rows.length === 0) fail(ERR.VALUE);
|
|
16979
17212
|
const columns = head.map((name) => {
|
|
16980
17213
|
if (name === null || name === "") return -1;
|
|
16981
|
-
return table2.headers.indexOf(
|
|
17214
|
+
return table2.headers.indexOf(label(name).toLowerCase());
|
|
16982
17215
|
});
|
|
16983
17216
|
const alternatives = rows.map(
|
|
16984
17217
|
(row2) => row2.flatMap((cell, c2) => {
|
|
@@ -24193,7 +24426,7 @@ function headerMode(args, i2, ctx, firstRow) {
|
|
|
24193
24426
|
if (mode === 1 || mode === 3) return true;
|
|
24194
24427
|
return fail(ERR.VALUE);
|
|
24195
24428
|
}
|
|
24196
|
-
var
|
|
24429
|
+
var keyOf2 = (values2) => JSON.stringify(values2);
|
|
24197
24430
|
var plain2 = (v) => v === void 0 || isError(v) ? null : v;
|
|
24198
24431
|
function compareBy(keys, rows) {
|
|
24199
24432
|
return (a2, b) => {
|
|
@@ -24233,7 +24466,7 @@ function groupby(args, ctx) {
|
|
|
24233
24466
|
if (rows.length === 0) fail(ERR.CALC);
|
|
24234
24467
|
const groups = /* @__PURE__ */ new Map();
|
|
24235
24468
|
for (const r of rows) {
|
|
24236
|
-
const key =
|
|
24469
|
+
const key = keyOf2(keysM.data[r]);
|
|
24237
24470
|
const found = groups.get(key);
|
|
24238
24471
|
if (found) found.push(r);
|
|
24239
24472
|
else groups.set(key, [r]);
|
|
@@ -24300,8 +24533,8 @@ function pivotby(args, ctx) {
|
|
|
24300
24533
|
const colKeys = /* @__PURE__ */ new Map();
|
|
24301
24534
|
for (const r of used) {
|
|
24302
24535
|
for (const [map, key] of [
|
|
24303
|
-
[rowKeys,
|
|
24304
|
-
[colKeys,
|
|
24536
|
+
[rowKeys, keyOf2(rowsM.data[r])],
|
|
24537
|
+
[colKeys, keyOf2(colsM.data[r])]
|
|
24305
24538
|
]) {
|
|
24306
24539
|
const found = map.get(key);
|
|
24307
24540
|
if (found) found.push(r);
|
|
@@ -27101,13 +27334,13 @@ function derivedFieldXml(pivot, entry3, date1904) {
|
|
|
27101
27334
|
const days = dateGroupDays(entry3.group);
|
|
27102
27335
|
const labels = dateUnitLabels(entry3.unit, range, days, date1904, entry3.group);
|
|
27103
27336
|
const base = pivot.fields.indexOf(entry3.group.field);
|
|
27104
|
-
return `<cacheField${attrs({ name: encodeEscapes(entry3.name), numFmtId: 0, databaseField: false })}><fieldGroup base="${base}"><rangePr${attrs({ autoStart: entry3.autoStart ? void 0 : false, autoEnd: entry3.autoEnd ? void 0 : false, groupBy: entry3.unit, startDate: serialToIso(range.start, date1904), endDate: serialToIso(range.end, date1904), groupInterval: days > 1 ? days : void 0 })}/><groupItems count="${labels.length}">${labels.map((
|
|
27337
|
+
return `<cacheField${attrs({ name: encodeEscapes(entry3.name), numFmtId: 0, databaseField: false })}><fieldGroup base="${base}"><rangePr${attrs({ autoStart: entry3.autoStart ? void 0 : false, autoEnd: entry3.autoEnd ? void 0 : false, groupBy: entry3.unit, startDate: serialToIso(range.start, date1904), endDate: serialToIso(range.end, date1904), groupInterval: days > 1 ? days : void 0 })}/><groupItems count="${labels.length}">${labels.map((label2) => `<s v="${escapeAttr3(label2)}"/>`).join("")}</groupItems></fieldGroup></cacheField>`;
|
|
27105
27338
|
}
|
|
27106
27339
|
function groupXml2(pivot, name, index3) {
|
|
27107
27340
|
const group = groupOf(pivot, name);
|
|
27108
27341
|
if (!group) return "";
|
|
27109
27342
|
const labels = numberGroupLabels(group);
|
|
27110
|
-
return `<fieldGroup base="${index3}"><rangePr autoStart="0" autoEnd="0" startNum="${group.start}" endNum="${group.end}" groupInterval="${group.by}"/><groupItems count="${labels.length}">${labels.map((
|
|
27343
|
+
return `<fieldGroup base="${index3}"><rangePr autoStart="0" autoEnd="0" startNum="${group.start}" endNum="${group.end}" groupInterval="${group.by}"/><groupItems count="${labels.length}">${labels.map((label2) => `<s v="${escapeAttr3(label2)}"/>`).join("")}</groupItems></fieldGroup>`;
|
|
27111
27344
|
}
|
|
27112
27345
|
function slicerExt(pivot) {
|
|
27113
27346
|
if (pivot.slicerCacheId === void 0) return "";
|
|
@@ -27167,6 +27400,10 @@ function pivotTableXml(source2, cacheId, cache2) {
|
|
|
27167
27400
|
const compact = pivot.layout === "compact";
|
|
27168
27401
|
const outline = pivot.layout === "compact" || pivot.layout === "outline";
|
|
27169
27402
|
const top = (pivot.subtotalPosition ?? (outline ? "top" : "bottom")) === "top";
|
|
27403
|
+
const named2 = (field, item) => {
|
|
27404
|
+
const text2 = pivotItemName(pivot, field, item);
|
|
27405
|
+
return text2 === void 0 ? "" : attrs({ n: encodeEscapes(text2) });
|
|
27406
|
+
};
|
|
27170
27407
|
const fields = pivot.fields.map((name, index3) => {
|
|
27171
27408
|
const isDate = pivot.dateFields?.includes(name) ?? false;
|
|
27172
27409
|
const at = rowIdx.indexOf(index3);
|
|
@@ -27181,7 +27418,7 @@ function pivotTableXml(source2, cacheId, cache2) {
|
|
|
27181
27418
|
custom.map((fn) => [PIVOT_SUBTOTALS[fn].attr, true])
|
|
27182
27419
|
);
|
|
27183
27420
|
const entries = automatic ? '<item t="default"/>' : custom.map((fn) => `<item t="${PIVOT_SUBTOTALS[fn].item}"/>`).join("");
|
|
27184
|
-
return `<pivotField${attrs({ axis: index3 === page ? "axisPage" : at >= 0 ? "axisRow" : colAt >= 0 ? "axisCol" : void 0, dataField: measures.some((measure) => pivot.fields.indexOf(measure.field) === index3) ? true : void 0, compact, outline, showAll: false, subtotalTop: at >= 0 ? top : void 0, numFmtId: isDate ? 14 : void 0, defaultSubtotal: automatic ? void 0 : false, ...flags })}>${items2 ? `<items count="${items2.length + (automatic ? 1 : custom.length)}">${items2.map((item) => `<item${hidden.has(pivotValueKey(item)) ? ' h="1"' : ""} x="${itemX(index3, item)}"/>`).join("")}${entries}</items>` : ""}${repeated}</pivotField>`;
|
|
27421
|
+
return `<pivotField${attrs({ axis: index3 === page ? "axisPage" : at >= 0 ? "axisRow" : colAt >= 0 ? "axisCol" : void 0, dataField: measures.some((measure) => pivot.fields.indexOf(measure.field) === index3) ? true : void 0, compact, outline, showAll: false, subtotalTop: at >= 0 ? top : void 0, numFmtId: isDate ? 14 : void 0, defaultSubtotal: automatic ? void 0 : false, ...flags })}>${items2 ? `<items count="${items2.length + (automatic ? 1 : custom.length)}">${items2.map((item) => `<item${hidden.has(pivotValueKey(item)) ? ' h="1"' : ""}${named2(name, item)} x="${itemX(index3, item)}"/>`).join("")}${entries}</items>` : ""}${repeated}</pivotField>`;
|
|
27185
27422
|
}).join("");
|
|
27186
27423
|
const items = (count2, indices) => Array.from({ length: count2 }, (_v, i2) => `<i><x v="${indices?.[i2] ?? i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
27187
27424
|
const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
|
|
@@ -27211,6 +27448,15 @@ function pivotTableXml(source2, cacheId, cache2) {
|
|
|
27211
27448
|
const root = doc.documentElement;
|
|
27212
27449
|
root.setAttribute("name", pivot.name);
|
|
27213
27450
|
root.setAttribute("cacheId", String(cacheId));
|
|
27451
|
+
const caps = pivotCaptions(pivot);
|
|
27452
|
+
root.setAttribute("dataCaption", caps.values);
|
|
27453
|
+
for (const [attribute2, key] of [
|
|
27454
|
+
["rowHeaderCaption", "rowLabels"],
|
|
27455
|
+
["colHeaderCaption", "columnLabels"],
|
|
27456
|
+
["grandTotalCaption", "grandTotal"]
|
|
27457
|
+
])
|
|
27458
|
+
if (caps[key] !== ENGLISH_PIVOT_CAPTIONS[key] || root.hasAttribute(attribute2))
|
|
27459
|
+
root.setAttribute(attribute2, caps[key]);
|
|
27214
27460
|
root.setAttribute("dataOnRows", rowsAxis ? "1" : "0");
|
|
27215
27461
|
if (rowsAxis && valuesAt < rowIdx.length) root.setAttribute("dataPosition", String(valuesAt));
|
|
27216
27462
|
else root.removeAttribute("dataPosition");
|
|
@@ -30017,9 +30263,9 @@ function parseSheet(bound, records, start, globals) {
|
|
|
30017
30263
|
default: {
|
|
30018
30264
|
if (opcode === 157)
|
|
30019
30265
|
hasAutoFilter = true;
|
|
30020
|
-
const
|
|
30021
|
-
if (
|
|
30022
|
-
addUnique(sheet.unsupported,
|
|
30266
|
+
const label2 = UNSUPPORTED[opcode];
|
|
30267
|
+
if (label2)
|
|
30268
|
+
addUnique(sheet.unsupported, label2);
|
|
30023
30269
|
}
|
|
30024
30270
|
}
|
|
30025
30271
|
}
|