ooxml-core 1.15.0 → 1.16.1
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-7RNEJ2IO.mjs +4 -0
- package/dist/PptxHandler-MK665E6Z.cjs +13 -0
- package/dist/{PptxHandler-R5BVKEBW.mjs → PptxHandler-ZF4G56V3.mjs} +2 -2
- package/dist/PresentationBuilder-HPHJTMIB.mjs +4 -0
- package/dist/{PresentationBuilder-W67DIJBV.mjs → PresentationBuilder-J7HAJGMB.mjs} +2 -2
- package/dist/{PresentationBuilder-4AF3PZHG.cjs → PresentationBuilder-JGYSF25G.cjs} +6 -5
- package/dist/automation/index.cjs +971 -544
- package/dist/automation/index.mjs +971 -544
- package/dist/chart/index.cjs +23 -4
- package/dist/chart/index.mjs +23 -4
- package/dist/{chunk-JFMIPOPV.mjs → chunk-5ROLXCIY.mjs} +439 -19
- package/dist/chunk-5W2QL4SB.cjs +244 -0
- package/dist/chunk-CA7KCNL3.mjs +236 -0
- package/dist/{chunk-BSUIDT6K.cjs → chunk-DWRJ62KP.cjs} +1 -0
- package/dist/{chunk-OPBZBSJF.mjs → chunk-HMZFUT65.mjs} +1 -1
- package/dist/{chunk-EMZIHAOH.mjs → chunk-IBFHMYJD.mjs} +1846 -565
- package/dist/{chunk-X7MGZQ6C.cjs → chunk-K7Z2EDI5.cjs} +419 -258
- package/dist/{chunk-NWAQEXBK.mjs → chunk-MVS2PT2Q.mjs} +1 -1
- package/dist/{chunk-PC4MTLG4.cjs → chunk-OA5V3JJC.cjs} +8 -8
- package/dist/{chunk-ZWI7MTLF.cjs → chunk-THEWZNWS.cjs} +2846 -1546
- package/dist/{chunk-2EBMHIGJ.mjs → chunk-TWXBU7RE.mjs} +402 -246
- package/dist/{chunk-AXF2FC4D.mjs → chunk-WSRCLCMB.mjs} +1 -0
- package/dist/{chunk-LMMP67YN.mjs → chunk-XCJRUBGJ.mjs} +1 -1
- package/dist/{chunk-7ZIZFJXT.mjs → chunk-YQ7HJOEZ.mjs} +1848 -548
- package/dist/{chunk-HU36GIYM.mjs → chunk-ZBCNC5RI.mjs} +421 -129
- package/dist/collab/broadcast-transport.d.ts.map +1 -1
- package/dist/collab/identity.d.ts +2 -0
- package/dist/collab/identity.d.ts.map +1 -1
- package/dist/collab/index.cjs +11 -2
- package/dist/collab/index.mjs +11 -3
- package/dist/crypto/index.cjs +23 -4
- package/dist/crypto/index.mjs +23 -4
- package/dist/diagram/index.cjs +23 -4
- package/dist/diagram/index.mjs +23 -4
- package/dist/docx/embedded.cjs +23 -4
- package/dist/docx/embedded.mjs +23 -4
- package/dist/docx/index.cjs +24 -5
- package/dist/docx/index.mjs +24 -5
- package/dist/docx/layout/index.cjs +24 -5
- package/dist/docx/layout/index.mjs +24 -5
- package/dist/docx/load/index.cjs +23 -4
- package/dist/docx/load/index.mjs +23 -4
- package/dist/docx/ui/index.cjs +32 -5
- package/dist/docx/ui/index.mjs +32 -5
- package/dist/drawingml/index.cjs +23 -4
- package/dist/drawingml/index.mjs +23 -4
- package/dist/index.cjs +23 -4
- package/dist/index.mjs +23 -4
- package/dist/math/index.cjs +23 -4
- package/dist/math/index.mjs +23 -4
- package/dist/opc/index.cjs +23 -4
- package/dist/opc/index.mjs +23 -4
- package/dist/pptx/automation/index.cjs +2690 -893
- 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 +2680 -883
- 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 +3236 -1115
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +194 -74
- package/dist/teams/index.mjs +194 -74
- package/dist/visio/index.cjs +23 -4
- package/dist/visio/index.mjs +23 -4
- package/dist/visio/ui/index.cjs +23 -4
- package/dist/visio/ui/index.mjs +23 -4
- package/dist/xlsx/edit/pivots.d.ts.map +1 -1
- package/dist/xlsx/edit/slicers.d.ts.map +1 -1
- package/dist/xlsx/edit/timelines.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +903 -476
- package/dist/xlsx/index.mjs +903 -476
- package/dist/xlsx/load/index.cjs +371 -104
- package/dist/xlsx/load/index.mjs +371 -104
- 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 +833 -629
- package/dist/xlsx/ui/index.mjs +833 -629
- package/dist/xml/index.cjs +23 -4
- package/dist/xml/index.mjs +23 -4
- package/dist/xml/xml.d.ts.map +1 -1
- 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.mjs
CHANGED
|
@@ -309,7 +309,7 @@ function parseOle2(buffer, options = {}) {
|
|
|
309
309
|
fatEntries.push(fatView.getUint32(i2 * 4, true));
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
function followChain(table2, start,
|
|
312
|
+
function followChain(table2, start, label2, needed) {
|
|
313
313
|
const ids = [];
|
|
314
314
|
const visited = /* @__PURE__ */ new Set();
|
|
315
315
|
let current = start;
|
|
@@ -317,26 +317,26 @@ function parseOle2(buffer, options = {}) {
|
|
|
317
317
|
if (!strict && needed !== void 0 && ids.length >= needed)
|
|
318
318
|
return ids;
|
|
319
319
|
if (visited.has(current)) {
|
|
320
|
-
throw new Ole2ParseError(`Circular reference in ${
|
|
320
|
+
throw new Ole2ParseError(`Circular reference in ${label2} chain at sector ${current}`);
|
|
321
321
|
}
|
|
322
322
|
visited.add(current);
|
|
323
323
|
ids.push(current);
|
|
324
324
|
if (table2[current] === void 0)
|
|
325
|
-
throw new Ole2ParseError(`Missing ${
|
|
325
|
+
throw new Ole2ParseError(`Missing ${label2} chain entry`);
|
|
326
326
|
current = table2[current];
|
|
327
327
|
}
|
|
328
328
|
if (current !== ENDOFCHAIN) {
|
|
329
329
|
if (strict || needed === void 0 || ids.length < needed) {
|
|
330
|
-
throw new Ole2ParseError(`Invalid ${
|
|
330
|
+
throw new Ole2ParseError(`Invalid ${label2} chain terminator`);
|
|
331
331
|
}
|
|
332
|
-
warnings.push({ code: "chain-terminator", message: `Accepted ${
|
|
332
|
+
warnings.push({ code: "chain-terminator", message: `Accepted ${label2} chain ending in 0x${current.toString(16)}` });
|
|
333
333
|
}
|
|
334
334
|
return ids;
|
|
335
335
|
}
|
|
336
|
-
function readMetadataChain(startSector,
|
|
336
|
+
function readMetadataChain(startSector, label2) {
|
|
337
337
|
if (startSector > MAXREGSECT)
|
|
338
338
|
return new Uint8Array(0);
|
|
339
|
-
const ids = followChain(fatEntries, startSector,
|
|
339
|
+
const ids = followChain(fatEntries, startSector, label2 === "directory" ? "FAT" : label2);
|
|
340
340
|
const result2 = new Uint8Array(ids.length * sectorSize);
|
|
341
341
|
ids.forEach((id, i2) => result2.set(readSector(id), i2 * sectorSize));
|
|
342
342
|
return result2;
|
|
@@ -3248,30 +3248,49 @@ var DEFAULT_XML_LIMITS = {
|
|
|
3248
3248
|
maxDepth: 512,
|
|
3249
3249
|
maxNodes: 5e6
|
|
3250
3250
|
};
|
|
3251
|
-
var
|
|
3252
|
-
|
|
3251
|
+
var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
|
|
3252
|
+
var MARKUP_SKIPS = [
|
|
3253
|
+
["<!--", "-->"],
|
|
3254
|
+
["<![CDATA[", "]]>"],
|
|
3255
|
+
["<?", "?>"]
|
|
3256
|
+
];
|
|
3257
|
+
function checkXmlLimits(xml, label2, limits = {}) {
|
|
3253
3258
|
const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
|
|
3254
3259
|
const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
|
|
3255
3260
|
let depth = 0;
|
|
3256
3261
|
let nodes = 0;
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3262
|
+
let at = xml.indexOf("<");
|
|
3263
|
+
while (at !== -1) {
|
|
3264
|
+
const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
|
|
3265
|
+
if (skip) {
|
|
3266
|
+
const end = xml.indexOf(skip[1], at + skip[0].length);
|
|
3267
|
+
if (end === -1) return;
|
|
3268
|
+
at = xml.indexOf("<", end + skip[1].length);
|
|
3269
|
+
continue;
|
|
3270
|
+
}
|
|
3271
|
+
TAG_RE.lastIndex = at;
|
|
3272
|
+
const match2 = TAG_RE.exec(xml);
|
|
3273
|
+
if (!match2) {
|
|
3274
|
+
at = xml.indexOf("<", at + 1);
|
|
3275
|
+
continue;
|
|
3276
|
+
}
|
|
3277
|
+
const [, closing, , selfClosing] = match2;
|
|
3278
|
+
at = xml.indexOf("<", at + match2[0].length);
|
|
3260
3279
|
if (closing) {
|
|
3261
3280
|
depth--;
|
|
3262
3281
|
continue;
|
|
3263
3282
|
}
|
|
3264
3283
|
nodes++;
|
|
3265
|
-
if (nodes > maxNodes) throw new Error(`${
|
|
3284
|
+
if (nodes > maxNodes) throw new Error(`${label2} XML exceeds the limit of ${maxNodes} elements`);
|
|
3266
3285
|
if (!selfClosing && ++depth > maxDepth)
|
|
3267
|
-
throw new Error(`${
|
|
3286
|
+
throw new Error(`${label2} XML exceeds the nesting depth limit of ${maxDepth}`);
|
|
3268
3287
|
}
|
|
3269
3288
|
}
|
|
3270
3289
|
function parseXml(xml, options = {}) {
|
|
3271
|
-
const
|
|
3290
|
+
const label2 = options.label ?? "OOXML";
|
|
3272
3291
|
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
3273
|
-
throw new Error(`${
|
|
3274
|
-
checkXmlLimits(xml,
|
|
3292
|
+
throw new Error(`${label2} XML with DTD or entity declarations is not supported`);
|
|
3293
|
+
checkXmlLimits(xml, label2, options.limits);
|
|
3275
3294
|
let parseError = "";
|
|
3276
3295
|
let parsed;
|
|
3277
3296
|
try {
|
|
@@ -3282,12 +3301,12 @@ function parseXml(xml, options = {}) {
|
|
|
3282
3301
|
}).parseFromString(xml, "application/xml");
|
|
3283
3302
|
} catch (error) {
|
|
3284
3303
|
throw new Error(
|
|
3285
|
-
`Invalid ${
|
|
3304
|
+
`Invalid ${label2} XML: ${error instanceof Error ? error.message : String(error)}`,
|
|
3286
3305
|
{ cause: error }
|
|
3287
3306
|
);
|
|
3288
3307
|
}
|
|
3289
3308
|
if (parseError || !parsed.documentElement)
|
|
3290
|
-
throw new Error(`Invalid ${
|
|
3309
|
+
throw new Error(`Invalid ${label2} XML: ${parseError || "missing root element"}`);
|
|
3291
3310
|
return parsed;
|
|
3292
3311
|
}
|
|
3293
3312
|
var buildXml = (node2) => new XMLSerializer().serializeToString(node2);
|
|
@@ -4397,19 +4416,19 @@ var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/packa
|
|
|
4397
4416
|
var MAX_ROW = 1048575;
|
|
4398
4417
|
var MAX_COL = 16383;
|
|
4399
4418
|
function columnLabel(col) {
|
|
4400
|
-
let
|
|
4419
|
+
let label2 = "";
|
|
4401
4420
|
let n = col + 1;
|
|
4402
4421
|
while (n > 0) {
|
|
4403
4422
|
const rem = (n - 1) % 26;
|
|
4404
|
-
|
|
4423
|
+
label2 = String.fromCharCode(65 + rem) + label2;
|
|
4405
4424
|
n = Math.floor((n - 1) / 26);
|
|
4406
4425
|
}
|
|
4407
|
-
return
|
|
4426
|
+
return label2;
|
|
4408
4427
|
}
|
|
4409
|
-
function columnIndex(
|
|
4410
|
-
if (!/^[A-Za-z]{1,3}$/.test(
|
|
4428
|
+
function columnIndex(label2) {
|
|
4429
|
+
if (!/^[A-Za-z]{1,3}$/.test(label2)) return -1;
|
|
4411
4430
|
let n = 0;
|
|
4412
|
-
for (const ch of
|
|
4431
|
+
for (const ch of label2.toUpperCase()) n = n * 26 + (ch.charCodeAt(0) - 64);
|
|
4413
4432
|
return n - 1;
|
|
4414
4433
|
}
|
|
4415
4434
|
var formatAddress = (address2) => `${columnLabel(address2.col)}${address2.row + 1}`;
|
|
@@ -6731,6 +6750,71 @@ var pivotColumnFields = (pivot) => [
|
|
|
6731
6750
|
...pivot.columnField ? pivot.moreColumnFields ?? [] : []
|
|
6732
6751
|
];
|
|
6733
6752
|
|
|
6753
|
+
// xlsx/pivot/captions.ts
|
|
6754
|
+
var FUNCTIONS = {
|
|
6755
|
+
sum: "Sum",
|
|
6756
|
+
count: "Count",
|
|
6757
|
+
average: "Average",
|
|
6758
|
+
max: "Max",
|
|
6759
|
+
min: "Min",
|
|
6760
|
+
product: "Product",
|
|
6761
|
+
countNums: "Count",
|
|
6762
|
+
stdDev: "StdDev",
|
|
6763
|
+
stdDevp: "StdDevp",
|
|
6764
|
+
var: "Var",
|
|
6765
|
+
varp: "Varp"
|
|
6766
|
+
};
|
|
6767
|
+
var aggregateNames = () => Object.fromEntries(
|
|
6768
|
+
Object.keys(FUNCTIONS).map((fn) => [
|
|
6769
|
+
fn,
|
|
6770
|
+
`${fn[0].toUpperCase()}${fn.slice(1)} of {0}`
|
|
6771
|
+
])
|
|
6772
|
+
);
|
|
6773
|
+
var ENGLISH_PIVOT_CAPTIONS = {
|
|
6774
|
+
rowLabels: "Row Labels",
|
|
6775
|
+
columnLabels: "Column Labels",
|
|
6776
|
+
grandTotal: "Grand Total",
|
|
6777
|
+
values: "Values",
|
|
6778
|
+
all: "(All)",
|
|
6779
|
+
blank: "(blank)",
|
|
6780
|
+
subtotal: "{0} Total",
|
|
6781
|
+
measureTotal: "Total {0}",
|
|
6782
|
+
functions: FUNCTIONS,
|
|
6783
|
+
aggregates: aggregateNames()
|
|
6784
|
+
};
|
|
6785
|
+
var fillCaption = (template, ...args) => template.replace(/\{(\d)\}/g, (_match, at) => args[Number(at)] ?? "");
|
|
6786
|
+
function pivotCaptions(pivot) {
|
|
6787
|
+
const own = pivot.captions;
|
|
6788
|
+
if (!own) return ENGLISH_PIVOT_CAPTIONS;
|
|
6789
|
+
return {
|
|
6790
|
+
...ENGLISH_PIVOT_CAPTIONS,
|
|
6791
|
+
...Object.fromEntries(Object.entries(own).filter(([, value2]) => typeof value2 === "string")),
|
|
6792
|
+
functions: { ...ENGLISH_PIVOT_CAPTIONS.functions, ...own.functions },
|
|
6793
|
+
aggregates: { ...ENGLISH_PIVOT_CAPTIONS.aggregates, ...own.aggregates }
|
|
6794
|
+
};
|
|
6795
|
+
}
|
|
6796
|
+
function trimmedCaptions(caps) {
|
|
6797
|
+
const out = {};
|
|
6798
|
+
for (const key of [
|
|
6799
|
+
"rowLabels",
|
|
6800
|
+
"columnLabels",
|
|
6801
|
+
"grandTotal",
|
|
6802
|
+
"values",
|
|
6803
|
+
"all",
|
|
6804
|
+
"blank",
|
|
6805
|
+
"subtotal",
|
|
6806
|
+
"measureTotal"
|
|
6807
|
+
])
|
|
6808
|
+
if (caps[key] !== ENGLISH_PIVOT_CAPTIONS[key]) out[key] = caps[key];
|
|
6809
|
+
for (const key of ["functions", "aggregates"]) {
|
|
6810
|
+
const changed = Object.keys(caps[key]).filter(
|
|
6811
|
+
(fn) => caps[key][fn] !== ENGLISH_PIVOT_CAPTIONS[key][fn]
|
|
6812
|
+
);
|
|
6813
|
+
if (changed.length) out[key] = Object.fromEntries(changed.map((fn) => [fn, caps[key][fn]]));
|
|
6814
|
+
}
|
|
6815
|
+
return Object.keys(out).length ? out : void 0;
|
|
6816
|
+
}
|
|
6817
|
+
|
|
6734
6818
|
// xlsx/formula/date-serial.ts
|
|
6735
6819
|
var DAY_MS = 864e5;
|
|
6736
6820
|
var EPOCH_19002 = Date.UTC(1899, 11, 30);
|
|
@@ -7165,6 +7249,17 @@ function validatePivotItemFilters(pivot) {
|
|
|
7165
7249
|
}
|
|
7166
7250
|
}
|
|
7167
7251
|
|
|
7252
|
+
// xlsx/pivot/item-labels.ts
|
|
7253
|
+
var keyOf = (field, item) => `${field}\0${pivotValueKey(item)}`;
|
|
7254
|
+
function pivotItemLabeler(pivot) {
|
|
7255
|
+
const blank = pivotCaptions(pivot).blank;
|
|
7256
|
+
const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry3) => [keyOf(entry3.field, entry3.item), entry3.name])) : void 0;
|
|
7257
|
+
return (field, value2) => names?.get(keyOf(field, value2)) ?? (value2 === null || value2 === "" ? blank : pivotItemLabel(value2));
|
|
7258
|
+
}
|
|
7259
|
+
var pivotItemName = (pivot, field, item) => pivot.itemNames?.find(
|
|
7260
|
+
(entry3) => entry3.field === field && pivotValueKey(entry3.item) === pivotValueKey(item)
|
|
7261
|
+
)?.name;
|
|
7262
|
+
|
|
7168
7263
|
// xlsx/pivot/page-filter.ts
|
|
7169
7264
|
function validatePivotPageFilter(pivot) {
|
|
7170
7265
|
const filter2 = pivot.pageFilter;
|
|
@@ -7176,8 +7271,8 @@ function validatePivotPageFilter(pivot) {
|
|
|
7176
7271
|
pivot.columnField,
|
|
7177
7272
|
pivot.valueField,
|
|
7178
7273
|
...extras.map((v) => v?.field)
|
|
7179
|
-
].includes(filter2.field)
|
|
7180
|
-
throw new Error("Report filters require
|
|
7274
|
+
].includes(filter2.field))
|
|
7275
|
+
throw new Error("Report filters require a separate source field.");
|
|
7181
7276
|
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))
|
|
7182
7277
|
throw new Error("Choose a cached literal report filter item.");
|
|
7183
7278
|
}
|
|
@@ -7190,10 +7285,10 @@ function pagedProjection(pivot) {
|
|
|
7190
7285
|
if (!filter2) return pivot;
|
|
7191
7286
|
const labels = /* @__PURE__ */ new Map();
|
|
7192
7287
|
for (const item of pivotItems(pivot, filter2.field)) {
|
|
7193
|
-
const
|
|
7194
|
-
if (
|
|
7288
|
+
const label2 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
|
|
7289
|
+
if (label2 === "(all)" || labels.has(label2) && labels.get(label2) !== key2)
|
|
7195
7290
|
throw new Error("Ambiguous report filter item captions are preserved.");
|
|
7196
|
-
labels.set(
|
|
7291
|
+
labels.set(label2, key2);
|
|
7197
7292
|
}
|
|
7198
7293
|
if (filter2.item === void 0) return pivot;
|
|
7199
7294
|
const index3 = pivot.fields.indexOf(filter2.field), key = pivotValueKey(filter2.item);
|
|
@@ -7211,7 +7306,7 @@ function prependPivotPage(grid, pivot) {
|
|
|
7211
7306
|
values: [
|
|
7212
7307
|
[
|
|
7213
7308
|
pivot.pageFilter.field,
|
|
7214
|
-
pivot.pageFilter.item === void 0 ?
|
|
7309
|
+
pivot.pageFilter.item === void 0 ? pivotCaptions(pivot).all : pivotItemLabeler(pivot)(pivot.pageFilter.field, pivot.pageFilter.item),
|
|
7215
7310
|
...Array(width - 2).fill(null)
|
|
7216
7311
|
],
|
|
7217
7312
|
Array(width).fill(null),
|
|
@@ -7326,7 +7421,7 @@ function validatePivotFields(pivot) {
|
|
|
7326
7421
|
throw new Error("Values before or between fields require two row fields and Values on rows.");
|
|
7327
7422
|
if (pivot.valuesAxis === "rows" && (!Array.isArray(extras) || !extras.length))
|
|
7328
7423
|
throw new Error("Values on rows require multiple measures.");
|
|
7329
|
-
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !==
|
|
7424
|
+
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== pivotCaptions(pivot).values)
|
|
7330
7425
|
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
7331
7426
|
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
7332
7427
|
(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())
|
|
@@ -7415,7 +7510,6 @@ var pivotMeasureNumber = (pivot, records, measure) => aggregateValues(records, p
|
|
|
7415
7510
|
|
|
7416
7511
|
// xlsx/pivot/columns.ts
|
|
7417
7512
|
var SEPARATOR = "";
|
|
7418
|
-
var label = pivotItemLabel;
|
|
7419
7513
|
var columnKey = (keys, depth) => keys.slice(0, depth).join(SEPARATOR);
|
|
7420
7514
|
var recordColumnKeys = (record, indices) => indices.map((index3) => pivotValueKey(record[index3] ?? null));
|
|
7421
7515
|
function pivotColumnEntries(pivot) {
|
|
@@ -7490,7 +7584,9 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
7490
7584
|
const rows = levels + 1 + Number(count2 > 1);
|
|
7491
7585
|
const grid = Array.from({ length: rows }, () => Array(width).fill(null));
|
|
7492
7586
|
if (count2 === 1 && !valuesOnRows) grid[0][0] = pivot.valueCaption;
|
|
7493
|
-
const
|
|
7587
|
+
const caps = pivotCaptions(pivot);
|
|
7588
|
+
const labelOf = pivotItemLabeler(pivot);
|
|
7589
|
+
const titles = compact ? [caps.columnLabels] : [...columns.names, ...count2 > 1 ? [caps.values] : []];
|
|
7494
7590
|
titles.forEach((title, i2) => {
|
|
7495
7591
|
grid[0][labelColumns + i2] = title;
|
|
7496
7592
|
});
|
|
@@ -7503,17 +7599,17 @@ function pivotColumnHeaders(pivot, columns, rowLabels, valuesOnRows = false) {
|
|
|
7503
7599
|
if (entry3.kind === "leaf") {
|
|
7504
7600
|
entry3.path.forEach((_index, level) => {
|
|
7505
7601
|
const continued = entry3.path.slice(0, level + 1).every((p, i2) => p === previous[i2]);
|
|
7506
|
-
if (!continued) grid[1 + level][at] =
|
|
7602
|
+
if (!continued) grid[1 + level][at] = labelOf(columns.names[level], entry3.values[level]);
|
|
7507
7603
|
});
|
|
7508
7604
|
previous = entry3.path;
|
|
7509
7605
|
if (count2 > 1) measures.forEach((measure, m) => grid[rows - 1][at + m] = measure.caption);
|
|
7510
7606
|
return;
|
|
7511
7607
|
}
|
|
7512
7608
|
const row2 = entry3.kind === "grand" ? 1 : entry3.path.length;
|
|
7513
|
-
const name = entry3.kind === "grand" ? "" : String(
|
|
7609
|
+
const name = entry3.kind === "grand" ? "" : String(labelOf(columns.names[entry3.path.length - 1], entry3.values.at(-1)));
|
|
7514
7610
|
measures.forEach((measure, m) => {
|
|
7515
|
-
const custom = entry3.fn ?
|
|
7516
|
-
grid[row2][at + m] = custom ? count2 === 1 ? `${name} ${custom}` : `${name} ${custom} of ${measure.field}` : count2 === 1 ? entry3.kind === "grand" ?
|
|
7611
|
+
const custom = entry3.fn ? caps.functions[entry3.fn] : void 0;
|
|
7612
|
+
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}`;
|
|
7517
7613
|
});
|
|
7518
7614
|
});
|
|
7519
7615
|
return grid;
|
|
@@ -7546,7 +7642,6 @@ function pivotColumnItemsXml(entries, measures, remap) {
|
|
|
7546
7642
|
}
|
|
7547
7643
|
|
|
7548
7644
|
// xlsx/pivot/nested.ts
|
|
7549
|
-
var label2 = pivotItemLabel;
|
|
7550
7645
|
var MAX_CELLS = 1e6;
|
|
7551
7646
|
var node = (index3, value2) => ({
|
|
7552
7647
|
index: index3,
|
|
@@ -7576,6 +7671,8 @@ function nestedPivotGrid(pivot) {
|
|
|
7576
7671
|
const labelColumns = compact ? 1 : levels;
|
|
7577
7672
|
const measures = pivotMeasures(pivot);
|
|
7578
7673
|
const functions = names.map((name) => fieldSubtotalFunctions(pivot, name));
|
|
7674
|
+
const caps = pivotCaptions(pivot);
|
|
7675
|
+
const labelOf = pivotItemLabeler(pivot);
|
|
7579
7676
|
const root = node(0, null);
|
|
7580
7677
|
for (const record of pivot.records) {
|
|
7581
7678
|
const keys = recordColumnKeys(record, columnFields);
|
|
@@ -7602,7 +7699,7 @@ function nestedPivotGrid(pivot) {
|
|
|
7602
7699
|
}
|
|
7603
7700
|
const dimensions = pivotColumnDimensions(pivot, columns, labelColumns, onRows);
|
|
7604
7701
|
const rowTitles = names.map((name) => name);
|
|
7605
|
-
if (onRows) rowTitles.splice(valuesAt, 0,
|
|
7702
|
+
if (onRows) rowTitles.splice(valuesAt, 0, caps.values);
|
|
7606
7703
|
let values2 = [];
|
|
7607
7704
|
let indents = [];
|
|
7608
7705
|
const rowEntries = [];
|
|
@@ -7681,11 +7778,11 @@ function nestedPivotGrid(pivot) {
|
|
|
7681
7778
|
const children2 = [...group.children.values()].sort((a2, b) => a2.index - b.index);
|
|
7682
7779
|
children2.forEach((child4, position) => {
|
|
7683
7780
|
const here = {
|
|
7684
|
-
labels: [...path2.labels,
|
|
7781
|
+
labels: [...path2.labels, labelOf(names[field], child4.value)],
|
|
7685
7782
|
indices: [...path2.indices, child4.index],
|
|
7686
7783
|
firsts: [...path2.firsts, position === 0]
|
|
7687
7784
|
};
|
|
7688
|
-
const text2 =
|
|
7785
|
+
const text2 = labelOf(names[field], child4.value);
|
|
7689
7786
|
if (last)
|
|
7690
7787
|
return push(level, () => [
|
|
7691
7788
|
labelCells(path2, leafShown(here.firsts), level, text2),
|
|
@@ -7708,14 +7805,14 @@ function nestedPivotGrid(pivot) {
|
|
|
7708
7805
|
]);
|
|
7709
7806
|
if (own === "auto") {
|
|
7710
7807
|
if (showsValue) return;
|
|
7711
|
-
if (valuesAbove) subtotal(
|
|
7808
|
+
if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure);
|
|
7712
7809
|
else measures.forEach((one2, m) => subtotal(`${caption} ${one2.caption}`, void 0, m));
|
|
7713
7810
|
} else
|
|
7714
7811
|
for (const fn of own)
|
|
7715
|
-
if (valuesAbove) subtotal(`${caption} ${
|
|
7812
|
+
if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure);
|
|
7716
7813
|
else
|
|
7717
7814
|
measures.forEach(
|
|
7718
|
-
(one2, m) => subtotal(`${caption} ${
|
|
7815
|
+
(one2, m) => subtotal(`${caption} ${caps.functions[fn]} of ${one2.field}`, fn, m)
|
|
7719
7816
|
);
|
|
7720
7817
|
});
|
|
7721
7818
|
};
|
|
@@ -7726,12 +7823,12 @@ function nestedPivotGrid(pivot) {
|
|
|
7726
7823
|
]);
|
|
7727
7824
|
const build = () => {
|
|
7728
7825
|
walk(0, root, void 0, { labels: [], indices: [], firsts: [] });
|
|
7729
|
-
if (onRows) measures.forEach((one2, m) => grand(
|
|
7730
|
-
else grand(
|
|
7826
|
+
if (onRows) measures.forEach((one2, m) => grand(fillCaption(caps.measureTotal, one2.caption), m));
|
|
7827
|
+
else grand(caps.grandTotal);
|
|
7731
7828
|
};
|
|
7732
7829
|
build();
|
|
7733
7830
|
counting = false;
|
|
7734
|
-
values2 = pivotColumnHeaders(pivot, columns, compact ? [
|
|
7831
|
+
values2 = pivotColumnHeaders(pivot, columns, compact ? [caps.rowLabels] : rowTitles, onRows);
|
|
7735
7832
|
const firstDataRow = values2.length;
|
|
7736
7833
|
indents = values2.map(() => 0);
|
|
7737
7834
|
build();
|
|
@@ -7764,14 +7861,14 @@ function pivotTableAt(sheet, at) {
|
|
|
7764
7861
|
var X14 = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
|
|
7765
7862
|
var LAYOUT = "http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout";
|
|
7766
7863
|
var TABLE = {
|
|
7767
|
-
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",
|
|
7864
|
+
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",
|
|
7768
7865
|
location: "ref firstHeaderRow firstDataRow firstDataCol rowPageCount colPageCount",
|
|
7769
7866
|
pageFields: "count",
|
|
7770
7867
|
pageField: "fld item hier",
|
|
7771
7868
|
pivotFields: "count",
|
|
7772
7869
|
pivotField: "axis dataField compact outline showAll subtotalTop defaultSubtotal numFmtId sumSubtotal countASubtotal avgSubtotal maxSubtotal minSubtotal productSubtotal countSubtotal stdDevSubtotal stdDevPSubtotal varSubtotal varPSubtotal",
|
|
7773
7870
|
items: "count",
|
|
7774
|
-
item: "x t h",
|
|
7871
|
+
item: "x t h n",
|
|
7775
7872
|
rowFields: "count",
|
|
7776
7873
|
colFields: "count",
|
|
7777
7874
|
field: "x",
|
|
@@ -7884,6 +7981,121 @@ function assertPivotRecords(records) {
|
|
|
7884
7981
|
);
|
|
7885
7982
|
}
|
|
7886
7983
|
|
|
7984
|
+
// xlsx/pivot/captions-read.ts
|
|
7985
|
+
var ATTRIBUTES = {
|
|
7986
|
+
rowHeaderCaption: "rowLabels",
|
|
7987
|
+
colHeaderCaption: "columnLabels",
|
|
7988
|
+
grandTotalCaption: "grandTotal",
|
|
7989
|
+
dataCaption: "values"
|
|
7990
|
+
};
|
|
7991
|
+
function readPivotCaptionAttributes(root) {
|
|
7992
|
+
const out = {};
|
|
7993
|
+
for (const [attribute2, key] of Object.entries(ATTRIBUTES)) {
|
|
7994
|
+
const text2 = att(root, attribute2);
|
|
7995
|
+
if (text2 !== void 0)
|
|
7996
|
+
out[key] = decodeEscapes(text2);
|
|
7997
|
+
}
|
|
7998
|
+
return out;
|
|
7999
|
+
}
|
|
8000
|
+
function aggregateCaptionsOf(pivot) {
|
|
8001
|
+
const out = {};
|
|
8002
|
+
for (const measure of [
|
|
8003
|
+
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
8004
|
+
...pivot.additionalValues ?? []
|
|
8005
|
+
]) {
|
|
8006
|
+
const at = measure.caption.indexOf(measure.field);
|
|
8007
|
+
if (at < 0 || measure.caption === measure.field) continue;
|
|
8008
|
+
const template = `${measure.caption.slice(0, at)}{0}${measure.caption.slice(at + measure.field.length)}`;
|
|
8009
|
+
if (template !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure.aggregate])
|
|
8010
|
+
out[measure.aggregate] = template;
|
|
8011
|
+
}
|
|
8012
|
+
return Object.keys(out).length ? out : void 0;
|
|
8013
|
+
}
|
|
8014
|
+
var MARK = "";
|
|
8015
|
+
var SENTINELS = {
|
|
8016
|
+
rowLabels: `${MARK}R`,
|
|
8017
|
+
columnLabels: `${MARK}C`,
|
|
8018
|
+
grandTotal: `${MARK}G`,
|
|
8019
|
+
values: `${MARK}V`,
|
|
8020
|
+
all: `${MARK}A`,
|
|
8021
|
+
blank: `${MARK}B`,
|
|
8022
|
+
subtotal: `{0}${MARK}S`,
|
|
8023
|
+
measureTotal: `${MARK}M{0}`,
|
|
8024
|
+
functions: Object.fromEntries(
|
|
8025
|
+
Object.keys(ENGLISH_PIVOT_CAPTIONS.functions).map((fn) => [fn, `${MARK}F${fn}`])
|
|
8026
|
+
),
|
|
8027
|
+
aggregates: ENGLISH_PIVOT_CAPTIONS.aggregates
|
|
8028
|
+
};
|
|
8029
|
+
function templateOf(cached, arg) {
|
|
8030
|
+
if (!arg || !cached.includes(arg)) return void 0;
|
|
8031
|
+
if (cached.startsWith(arg)) return `{0}${cached.slice(arg.length)}`;
|
|
8032
|
+
if (cached.endsWith(arg)) return `${cached.slice(0, -arg.length)}{0}`;
|
|
8033
|
+
const at = cached.indexOf(arg);
|
|
8034
|
+
return `${cached.slice(0, at)}{0}${cached.slice(at + arg.length)}`;
|
|
8035
|
+
}
|
|
8036
|
+
function inferPivotCaptions(pivot, sheet, named2) {
|
|
8037
|
+
const known = pivotCaptions({ captions: named2 });
|
|
8038
|
+
const probe = { ...SENTINELS };
|
|
8039
|
+
for (const key of Object.keys(named2))
|
|
8040
|
+
if (typeof named2[key] === "string")
|
|
8041
|
+
probe[key] = known[key];
|
|
8042
|
+
const grid = pivotGrid({ ...pivot, captions: probe });
|
|
8043
|
+
const found = /* @__PURE__ */ new Map();
|
|
8044
|
+
const set = (key, value2) => {
|
|
8045
|
+
if (value2 === void 0) return;
|
|
8046
|
+
const before = found.get(key);
|
|
8047
|
+
found.set(key, before === void 0 || before === value2 ? value2 : null);
|
|
8048
|
+
};
|
|
8049
|
+
grid.values.forEach(
|
|
8050
|
+
(line2, r) => line2.forEach((expected, c2) => {
|
|
8051
|
+
if (typeof expected !== "string" || !expected.includes(MARK)) return;
|
|
8052
|
+
const cached = getCell(
|
|
8053
|
+
sheet,
|
|
8054
|
+
pivot.location.start.row + r,
|
|
8055
|
+
pivot.location.start.col + c2
|
|
8056
|
+
)?.value;
|
|
8057
|
+
if (typeof cached !== "string") return;
|
|
8058
|
+
const kind = /\u0001([RCGVASMFB])(\w*)/.exec(expected);
|
|
8059
|
+
if (!kind) return;
|
|
8060
|
+
const at = kind.index;
|
|
8061
|
+
switch (kind[1]) {
|
|
8062
|
+
case "R":
|
|
8063
|
+
return set("rowLabels", cached);
|
|
8064
|
+
case "C":
|
|
8065
|
+
return set("columnLabels", cached);
|
|
8066
|
+
case "G":
|
|
8067
|
+
return set("grandTotal", cached);
|
|
8068
|
+
case "V":
|
|
8069
|
+
return set("values", cached);
|
|
8070
|
+
case "A":
|
|
8071
|
+
return set("all", cached);
|
|
8072
|
+
case "B":
|
|
8073
|
+
return set("blank", cached);
|
|
8074
|
+
case "S":
|
|
8075
|
+
return set("subtotal", templateOf(cached, expected.slice(0, at)));
|
|
8076
|
+
case "M":
|
|
8077
|
+
return set("measureTotal", templateOf(cached, expected.slice(at + 2)));
|
|
8078
|
+
case "F": {
|
|
8079
|
+
const item = expected.slice(0, at - 1);
|
|
8080
|
+
const of = / of (.*)$/.exec(expected.slice(at));
|
|
8081
|
+
const word = cached.slice(item.length + 1, of ? cached.length - of[0].length : void 0);
|
|
8082
|
+
if (cached.startsWith(`${item} `) && (!of || cached.endsWith(of[0])))
|
|
8083
|
+
set(`function:${kind[2]}`, word);
|
|
8084
|
+
}
|
|
8085
|
+
}
|
|
8086
|
+
})
|
|
8087
|
+
);
|
|
8088
|
+
const out = pivotCaptions({ captions: named2 });
|
|
8089
|
+
const functions = { ...out.functions };
|
|
8090
|
+
for (const [key, value2] of found) {
|
|
8091
|
+
if (value2 === null) continue;
|
|
8092
|
+
if (key.startsWith("function:")) functions[key.slice(9)] = value2;
|
|
8093
|
+
else out[key] = value2;
|
|
8094
|
+
}
|
|
8095
|
+
out.functions = functions;
|
|
8096
|
+
return trimmedCaptions(out);
|
|
8097
|
+
}
|
|
8098
|
+
|
|
7887
8099
|
// xlsx/slicer/read-slicers.ts
|
|
7888
8100
|
var TABLE_SLICER_URI = "{2F2917AC-EB37-4324-AD4E-5DD8C200BD13}";
|
|
7889
8101
|
var X152 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
|
|
@@ -8323,7 +8535,7 @@ function readFieldGroups(fields, names) {
|
|
|
8323
8535
|
throw new Error("Unsupported pivot field group");
|
|
8324
8536
|
const labels = children(list, "s", NS.x).map((node2) => decodeEscapes(att(node2, "v") ?? ""));
|
|
8325
8537
|
const expected = numberGroupLabels({ start, end, by });
|
|
8326
|
-
if (elements(list).length !== labels.length || labels.length !== expected.length || labels.some((
|
|
8538
|
+
if (elements(list).length !== labels.length || labels.length !== expected.length || labels.some((label2, i2) => label2 !== expected[i2]))
|
|
8327
8539
|
throw new Error("Unsupported pivot group items");
|
|
8328
8540
|
groups.push({ field: names[index3] ?? "", start, end, by });
|
|
8329
8541
|
});
|
|
@@ -8407,7 +8619,7 @@ function readDateGroups(fields, count2, names, dateFields, records, date1904) {
|
|
|
8407
8619
|
const node2 = first(first(entry3.node, "fieldGroup", NS.x), "groupItems", NS.x);
|
|
8408
8620
|
const actual = children(node2, "s", NS.x).map((item) => decodeEscapes(att(item, "v") ?? ""));
|
|
8409
8621
|
const name = decodeEscapes(att(entry3.node, "name") ?? "");
|
|
8410
|
-
if (!name || elements(node2).length !== actual.length || actual.length !== labels.length || actual.some((
|
|
8622
|
+
if (!name || elements(node2).length !== actual.length || actual.length !== labels.length || actual.some((label2) => !label2) || new Set(actual).size !== actual.length)
|
|
8411
8623
|
throw unsupported("group items");
|
|
8412
8624
|
if (name !== dateGroupFieldName(entry3.unit, field) || actual.some((l, i2) => l !== labels[i2]))
|
|
8413
8625
|
localized[entry3.unit] = { name, labels: actual };
|
|
@@ -8465,6 +8677,25 @@ function readItemFilters(fields, names, shared) {
|
|
|
8465
8677
|
return filters.length ? filters : void 0;
|
|
8466
8678
|
}
|
|
8467
8679
|
|
|
8680
|
+
// xlsx/pivot/item-names-read.ts
|
|
8681
|
+
function readItemNames(tableFields, names, shared) {
|
|
8682
|
+
const out = [];
|
|
8683
|
+
tableFields.forEach((field, index3) => {
|
|
8684
|
+
const list = first(field, "items", NS.x);
|
|
8685
|
+
if (!list || index3 >= names.length) return;
|
|
8686
|
+
for (const item of children(list, "item", NS.x)) {
|
|
8687
|
+
const name = att(item, "n");
|
|
8688
|
+
if (name === void 0) continue;
|
|
8689
|
+
const at = Number(att(item, "x"));
|
|
8690
|
+
const value2 = shared[index3]?.[at];
|
|
8691
|
+
if (att(item, "t") !== void 0 || !Number.isInteger(at) || value2 === void 0)
|
|
8692
|
+
throw new Error("Unsupported pivot item name");
|
|
8693
|
+
out.push({ field: names[index3], item: value2, name: decodeEscapes(name) });
|
|
8694
|
+
}
|
|
8695
|
+
});
|
|
8696
|
+
return out;
|
|
8697
|
+
}
|
|
8698
|
+
|
|
8468
8699
|
// xlsx/pivot/values-axis.ts
|
|
8469
8700
|
function remapPivotRowEntries(entries, axes2) {
|
|
8470
8701
|
return entries.map(
|
|
@@ -8628,7 +8859,10 @@ function assertPageAxisItems(root, pivot, shared, cache2, recordRoot) {
|
|
|
8628
8859
|
};
|
|
8629
8860
|
const rowAxes = pivotRowFields(pivot).map((name) => axisValues(name, "axisRow")), rowItems = read("rowItems");
|
|
8630
8861
|
const grid = pivotGrid(pivot);
|
|
8631
|
-
const
|
|
8862
|
+
const valuesAt = pivotValuesIndex(pivot);
|
|
8863
|
+
const levelAxes = [...rowAxes];
|
|
8864
|
+
if (valuesAt >= 0) levelAxes.splice(valuesAt, 0, null);
|
|
8865
|
+
const entries = grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, levelAxes) : [
|
|
8632
8866
|
...rowAxes[0].map((index3) => ({ indices: [index3] })),
|
|
8633
8867
|
{ indices: [0], type: "grand" }
|
|
8634
8868
|
];
|
|
@@ -8638,11 +8872,11 @@ function assertPageAxisItems(root, pivot, shared, cache2, recordRoot) {
|
|
|
8638
8872
|
const expected2 = entries[i2];
|
|
8639
8873
|
const xs = children(item, "x", NS.x).map((x) => integer(x.getAttribute("v"), 0)), prefix = integer(item.getAttribute("r"), 0);
|
|
8640
8874
|
const type = expected2.type === void 0 || expected2.type === "default" || expected2.type === "grand" ? expected2.type : PIVOT_SUBTOTALS[expected2.type].item;
|
|
8641
|
-
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))
|
|
8875
|
+
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))
|
|
8642
8876
|
throw new Error("Unmodeled page row item");
|
|
8643
8877
|
previousRow = expected2.type === "grand" ? [] : expected2.indices;
|
|
8644
8878
|
});
|
|
8645
|
-
const measures = 1 + (pivot.additionalValues?.length ?? 0), columns = pivot.columnField ? axisValues(pivot.columnField, "axisCol") : void 0, expected = [];
|
|
8879
|
+
const measures = valuesAt >= 0 ? 1 : 1 + (pivot.additionalValues?.length ?? 0), columns = pivot.columnField ? axisValues(pivot.columnField, "axisCol") : void 0, expected = [];
|
|
8646
8880
|
if (columns)
|
|
8647
8881
|
for (const col of columns)
|
|
8648
8882
|
for (let m = 0; m < measures; m++) expected.push(measures > 1 ? [col, m] : [col]);
|
|
@@ -8684,6 +8918,10 @@ function value(node2, date1904 = false) {
|
|
|
8684
8918
|
if (node2.localName === "e" && isErrorCode(v)) return { error: v };
|
|
8685
8919
|
throw new Error("Unsupported pivot cache item");
|
|
8686
8920
|
}
|
|
8921
|
+
var namedAggregates = (pivot) => {
|
|
8922
|
+
const aggregates = aggregateCaptionsOf(pivot);
|
|
8923
|
+
return aggregates ? { aggregates } : {};
|
|
8924
|
+
};
|
|
8687
8925
|
function readOne(workbook, source2, part) {
|
|
8688
8926
|
const xml = source2.text(part);
|
|
8689
8927
|
const root = parseXml(xml).documentElement;
|
|
@@ -8830,6 +9068,7 @@ function readOne(workbook, source2, part) {
|
|
|
8830
9068
|
location.start.row -= 2;
|
|
8831
9069
|
}
|
|
8832
9070
|
const itemFilters = readItemFilters(tableFields, names, shared);
|
|
9071
|
+
const itemNames = readItemNames(tableFields, names, shared);
|
|
8833
9072
|
const slicerCacheId = readSlicerCacheId(cache2);
|
|
8834
9073
|
const fieldGroups = readFieldGroups(fields, names);
|
|
8835
9074
|
const dateFields = readDateFields(fields, names);
|
|
@@ -8868,6 +9107,7 @@ function readOne(workbook, source2, part) {
|
|
|
8868
9107
|
const pivot = {
|
|
8869
9108
|
...pageFilter ? { pageFilter } : {},
|
|
8870
9109
|
...itemFilters ? { itemFilters } : {},
|
|
9110
|
+
...itemNames.length ? { itemNames } : {},
|
|
8871
9111
|
...fieldGroups.length ? { fieldGroups } : {},
|
|
8872
9112
|
...dateFields.length ? { dateFields } : {},
|
|
8873
9113
|
...dateGroups.length ? { dateGroups } : {},
|
|
@@ -8910,6 +9150,12 @@ function readOne(workbook, source2, part) {
|
|
|
8910
9150
|
...col ? { columnField: col } : {},
|
|
8911
9151
|
...moreColumns.length ? { moreColumnFields: moreColumns } : {}
|
|
8912
9152
|
};
|
|
9153
|
+
const captions = trimmedCaptions(
|
|
9154
|
+
pivotCaptions({
|
|
9155
|
+
captions: { ...readPivotCaptionAttributes(root), ...namedAggregates(pivot) }
|
|
9156
|
+
})
|
|
9157
|
+
);
|
|
9158
|
+
if (captions) pivot.captions = captions;
|
|
8913
9159
|
if (pageFilter && moreColumns.length) throw new Error("Report filters support one column field");
|
|
8914
9160
|
assertPageAxisItems(root, pivot, shared, cache2, recordRoot);
|
|
8915
9161
|
return pivot;
|
|
@@ -8937,6 +9183,12 @@ function readPivotTables(workbook, source2, warn, slicers) {
|
|
|
8937
9183
|
if (slicers.blocked.has(pivotKey(sheet.sheetId, name)) || cache2 && (caches2.get(cache2) ?? 0) > 1)
|
|
8938
9184
|
throw new Error("Shared pivot cache or unsupported slicer connection");
|
|
8939
9185
|
const pivot = readOne(workbook, source2, part);
|
|
9186
|
+
const inferred = inferPivotCaptions(pivot, sheet, {
|
|
9187
|
+
...readPivotCaptionAttributes(parseXml(pivot.sourceXml).documentElement),
|
|
9188
|
+
...namedAggregates(pivot)
|
|
9189
|
+
});
|
|
9190
|
+
if (inferred) pivot.captions = inferred;
|
|
9191
|
+
else delete pivot.captions;
|
|
8940
9192
|
const grid = pivotGrid(pivot);
|
|
8941
9193
|
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(
|
|
8942
9194
|
(line2, r) => line2.some(
|
|
@@ -9697,7 +9949,7 @@ function mergeSpacedAreas(tokens2) {
|
|
|
9697
9949
|
}
|
|
9698
9950
|
return out;
|
|
9699
9951
|
}
|
|
9700
|
-
function
|
|
9952
|
+
function templateOf2(formula) {
|
|
9701
9953
|
const cached = templates.get(formula);
|
|
9702
9954
|
if (cached !== void 0) return cached;
|
|
9703
9955
|
const raw2 = safeTokens(formula);
|
|
@@ -9727,7 +9979,7 @@ function templateOf(formula) {
|
|
|
9727
9979
|
return template;
|
|
9728
9980
|
}
|
|
9729
9981
|
function rewriteTemplate(formula, rewrite2) {
|
|
9730
|
-
const template =
|
|
9982
|
+
const template = templateOf2(formula);
|
|
9731
9983
|
if (!template) return formula;
|
|
9732
9984
|
let next;
|
|
9733
9985
|
for (let i2 = 0; i2 < template.length; i2++) {
|
|
@@ -10309,8 +10561,8 @@ function parseDiagramDataModel(source2, part) {
|
|
|
10309
10561
|
"CONNECTION_ENDPOINT_MISSING",
|
|
10310
10562
|
`dgm:cxn ${attribute2} references missing point: ${id}.`
|
|
10311
10563
|
);
|
|
10312
|
-
const
|
|
10313
|
-
connections.push(
|
|
10564
|
+
const label2 = connectionLabel(connection, transitionText);
|
|
10565
|
+
connections.push(label2 ? { ...connection, label: label2 } : connection);
|
|
10314
10566
|
if ((!connection.type || connection.type === "parOf") && !parentById.has(connection.destId))
|
|
10315
10567
|
parentById.set(connection.destId, connection.sourceId);
|
|
10316
10568
|
}
|
|
@@ -10349,14 +10601,14 @@ function colorList(container2) {
|
|
|
10349
10601
|
}
|
|
10350
10602
|
function parseDiagramColors(source2) {
|
|
10351
10603
|
const root = rootOf2(source2);
|
|
10352
|
-
const labels = children(root, "styleLbl", NS.dgm).map((
|
|
10353
|
-
name: stringAttribute(
|
|
10354
|
-
fill: colorList(first(
|
|
10355
|
-
line: colorList(first(
|
|
10356
|
-
effect: colorList(first(
|
|
10357
|
-
textLine: colorList(first(
|
|
10358
|
-
textFill: colorList(first(
|
|
10359
|
-
textEffect: colorList(first(
|
|
10604
|
+
const labels = children(root, "styleLbl", NS.dgm).map((label2) => ({
|
|
10605
|
+
name: stringAttribute(label2, "name") ?? "",
|
|
10606
|
+
fill: colorList(first(label2, "fillClrLst", NS.dgm)),
|
|
10607
|
+
line: colorList(first(label2, "linClrLst", NS.dgm)),
|
|
10608
|
+
effect: colorList(first(label2, "effectClrLst", NS.dgm)),
|
|
10609
|
+
textLine: colorList(first(label2, "txLinClrLst", NS.dgm)),
|
|
10610
|
+
textFill: colorList(first(label2, "txFillClrLst", NS.dgm)),
|
|
10611
|
+
textEffect: colorList(first(label2, "txEffectClrLst", NS.dgm))
|
|
10360
10612
|
}));
|
|
10361
10613
|
return { ...parseDefinitionHeader(root), labels };
|
|
10362
10614
|
}
|
|
@@ -10389,16 +10641,16 @@ function parseStyleReferences(style2) {
|
|
|
10389
10641
|
var hasContent = (element2) => Boolean(element2 && (element2.attributes.length > 0 || elements(element2).length > 0));
|
|
10390
10642
|
function parseDiagramQuickStyle(source2) {
|
|
10391
10643
|
const root = rootOf2(source2);
|
|
10392
|
-
const labels = children(root, "styleLbl", NS.dgm).map((
|
|
10393
|
-
name: stringAttribute(
|
|
10394
|
-
...parseStyleReferences(first(
|
|
10395
|
-
hasScene3d: Boolean(first(
|
|
10396
|
-
hasShape3d: hasContent(first(
|
|
10644
|
+
const labels = children(root, "styleLbl", NS.dgm).map((label2) => ({
|
|
10645
|
+
name: stringAttribute(label2, "name") ?? "",
|
|
10646
|
+
...parseStyleReferences(first(label2, "style", NS.dgm)),
|
|
10647
|
+
hasScene3d: Boolean(first(label2, "scene3d", NS.dgm)),
|
|
10648
|
+
hasShape3d: hasContent(first(label2, "sp3d", NS.dgm))
|
|
10397
10649
|
}));
|
|
10398
10650
|
return {
|
|
10399
10651
|
...parseDefinitionHeader(root),
|
|
10400
10652
|
labels,
|
|
10401
|
-
has3d: labels.some((
|
|
10653
|
+
has3d: labels.some((label2) => label2.hasShape3d)
|
|
10402
10654
|
};
|
|
10403
10655
|
}
|
|
10404
10656
|
function parseDiagramLayoutSummary(source2) {
|
|
@@ -12075,10 +12327,10 @@ function parseDisplayUnits(context, element2) {
|
|
|
12075
12327
|
if (!element2) return void 0;
|
|
12076
12328
|
reportUnmodelled(context, element2, DISPLAY_UNITS);
|
|
12077
12329
|
const labelElement = cChild(element2, "dispUnitsLbl");
|
|
12078
|
-
let
|
|
12330
|
+
let label2;
|
|
12079
12331
|
if (labelElement) {
|
|
12080
12332
|
reportUnmodelled(context, labelElement, DISPLAY_UNITS_LABEL);
|
|
12081
|
-
|
|
12333
|
+
label2 = assignDefined(
|
|
12082
12334
|
{},
|
|
12083
12335
|
{
|
|
12084
12336
|
layout: manualLayout(labelElement),
|
|
@@ -12093,7 +12345,7 @@ function parseDisplayUnits(context, element2) {
|
|
|
12093
12345
|
{
|
|
12094
12346
|
builtInUnit: cVal(element2, "builtInUnit"),
|
|
12095
12347
|
customUnit: cNumber(context, element2, "custUnit"),
|
|
12096
|
-
label:
|
|
12348
|
+
label: label2,
|
|
12097
12349
|
extLst: extensionList(element2)
|
|
12098
12350
|
}
|
|
12099
12351
|
);
|
|
@@ -13689,8 +13941,8 @@ function parseTable(xml, partName) {
|
|
|
13689
13941
|
if (id !== void 0 && Number.isInteger(id) && id >= 0) column2.sourceId = id;
|
|
13690
13942
|
const fn = att(node2, "totalsRowFunction");
|
|
13691
13943
|
if (fn && fn !== "none") column2.totalsRowFunction = fn;
|
|
13692
|
-
const
|
|
13693
|
-
if (
|
|
13944
|
+
const label2 = att(node2, "totalsRowLabel");
|
|
13945
|
+
if (label2 !== void 0) column2.totalsRowLabel = label2;
|
|
13694
13946
|
const calculated = xFirst(node2, "calculatedColumnFormula");
|
|
13695
13947
|
if (calculated) column2.calculatedColumnFormula = stripFuturePrefixes(xText(calculated));
|
|
13696
13948
|
return column2;
|
|
@@ -14574,10 +14826,10 @@ function titleXml(context, title) {
|
|
|
14574
14826
|
function labelOptionsXml(context, options) {
|
|
14575
14827
|
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));
|
|
14576
14828
|
}
|
|
14577
|
-
function labelXml(context,
|
|
14829
|
+
function labelXml(context, label2) {
|
|
14578
14830
|
return elementXml(
|
|
14579
14831
|
"dLbl",
|
|
14580
|
-
valXml("idx",
|
|
14832
|
+
valXml("idx", label2.index) + valXml("delete", label2.deleted) + layoutXml(context, label2.layout) + chartTextXml(context, label2.tx, false) + labelOptionsXml(context, label2) + raw(context, label2.extLst)
|
|
14581
14833
|
);
|
|
14582
14834
|
}
|
|
14583
14835
|
function dataLabelsXml(context, labels) {
|
|
@@ -14585,7 +14837,7 @@ function dataLabelsXml(context, labels) {
|
|
|
14585
14837
|
const leaderLines = labels.leaderLines ? elementXml("leaderLines", shapePropertiesXml(context, labels.leaderLines.spPr)) : "";
|
|
14586
14838
|
return elementXml(
|
|
14587
14839
|
"dLbls",
|
|
14588
|
-
labels.labels.map((
|
|
14840
|
+
labels.labels.map((label2) => labelXml(context, label2)).join("") + valXml("delete", labels.deleted) + labelOptionsXml(context, labels) + valXml("showLeaderLines", labels.showLeaderLines) + leaderLines + raw(context, labels.extLst)
|
|
14589
14841
|
);
|
|
14590
14842
|
}
|
|
14591
14843
|
|
|
@@ -14606,12 +14858,12 @@ function dataTableXml(context, table2) {
|
|
|
14606
14858
|
}
|
|
14607
14859
|
function displayUnitsXml(context, units) {
|
|
14608
14860
|
if (!units) return "";
|
|
14609
|
-
const
|
|
14861
|
+
const label2 = units.label;
|
|
14610
14862
|
return elementXml(
|
|
14611
14863
|
"dispUnits",
|
|
14612
|
-
valXml("custUnit", units.customUnit) + (units.customUnit === void 0 ? valXml("builtInUnit", units.builtInUnit) : "") + (
|
|
14864
|
+
valXml("custUnit", units.customUnit) + (units.customUnit === void 0 ? valXml("builtInUnit", units.builtInUnit) : "") + (label2 ? elementXml(
|
|
14613
14865
|
"dispUnitsLbl",
|
|
14614
|
-
layoutXml(context,
|
|
14866
|
+
layoutXml(context, label2.layout) + chartTextXml(context, label2.tx, false) + shapePropertiesXml(context, label2.spPr) + textBodyXml(context, label2.txPr)
|
|
14615
14867
|
) : "") + raw(context, units.extLst)
|
|
14616
14868
|
);
|
|
14617
14869
|
}
|
|
@@ -14636,11 +14888,11 @@ function axisXml(context, axis) {
|
|
|
14636
14888
|
}
|
|
14637
14889
|
|
|
14638
14890
|
// chart/write-analysis.ts
|
|
14639
|
-
function trendlineLabelXml(context,
|
|
14640
|
-
if (!
|
|
14891
|
+
function trendlineLabelXml(context, label2) {
|
|
14892
|
+
if (!label2) return "";
|
|
14641
14893
|
return elementXml(
|
|
14642
14894
|
"trendlineLbl",
|
|
14643
|
-
layoutXml(context,
|
|
14895
|
+
layoutXml(context, label2.layout) + chartTextXml(context, label2.tx, false) + numberFormatXml(label2.numberFormat) + shapePropertiesXml(context, label2.spPr) + textBodyXml(context, label2.txPr) + raw(context, label2.extLst)
|
|
14644
14896
|
);
|
|
14645
14897
|
}
|
|
14646
14898
|
function trendlineXml(context, trendline) {
|
|
@@ -16657,14 +16909,14 @@ function unique(args, ctx) {
|
|
|
16657
16909
|
const byCol = args.length > 1 && args[1] !== null && toBool(ctx.toScalar(args[1] ?? null));
|
|
16658
16910
|
const once = args.length > 2 && args[2] !== null && toBool(ctx.toScalar(args[2] ?? null));
|
|
16659
16911
|
if (byCol) m = transpose(m);
|
|
16660
|
-
const
|
|
16912
|
+
const keyOf3 = (row2) => JSON.stringify(
|
|
16661
16913
|
row2.map(
|
|
16662
16914
|
(v) => isError(v) ? `#${v.error}` : typeof v === "string" ? `s${v.toLowerCase()}` : v
|
|
16663
16915
|
)
|
|
16664
16916
|
);
|
|
16665
16917
|
const counts = /* @__PURE__ */ new Map();
|
|
16666
16918
|
for (const row2 of m.data) {
|
|
16667
|
-
const key =
|
|
16919
|
+
const key = keyOf3(row2);
|
|
16668
16920
|
const entry3 = counts.get(key);
|
|
16669
16921
|
if (entry3) entry3.count++;
|
|
16670
16922
|
else counts.set(key, { row: row2, count: 1 });
|
|
@@ -16949,11 +17201,11 @@ function gammaLn(z) {
|
|
|
16949
17201
|
|
|
16950
17202
|
// xlsx/formula/functions/database.ts
|
|
16951
17203
|
var C3 = "Database";
|
|
16952
|
-
var
|
|
17204
|
+
var label = (value2) => value2 === null ? "" : typeof value2 === "string" ? value2 : String(value2);
|
|
16953
17205
|
function tableOf(ctx, value2) {
|
|
16954
17206
|
const [head, ...records] = ctx.toMatrix(value2 ?? null).data;
|
|
16955
17207
|
if (!head || records.length === 0) fail(ERR.VALUE);
|
|
16956
|
-
return { headers: head.map((v) =>
|
|
17208
|
+
return { headers: head.map((v) => label(v).toLowerCase()), records };
|
|
16957
17209
|
}
|
|
16958
17210
|
function fieldIndex(table2, field) {
|
|
16959
17211
|
const value2 = scalar2(field);
|
|
@@ -16963,7 +17215,7 @@ function fieldIndex(table2, field) {
|
|
|
16963
17215
|
if (index4 < 0 || index4 >= table2.headers.length) fail(ERR.VALUE);
|
|
16964
17216
|
return index4;
|
|
16965
17217
|
}
|
|
16966
|
-
const index3 = table2.headers.indexOf(
|
|
17218
|
+
const index3 = table2.headers.indexOf(label(value2).toLowerCase());
|
|
16967
17219
|
if (index3 < 0) fail(ERR.VALUE);
|
|
16968
17220
|
return index3;
|
|
16969
17221
|
}
|
|
@@ -16972,7 +17224,7 @@ function recordFilter(table2, criteria) {
|
|
|
16972
17224
|
if (!head || rows.length === 0) fail(ERR.VALUE);
|
|
16973
17225
|
const columns = head.map((name) => {
|
|
16974
17226
|
if (name === null || name === "") return -1;
|
|
16975
|
-
return table2.headers.indexOf(
|
|
17227
|
+
return table2.headers.indexOf(label(name).toLowerCase());
|
|
16976
17228
|
});
|
|
16977
17229
|
const alternatives = rows.map(
|
|
16978
17230
|
(row2) => row2.flatMap((cell, c2) => {
|
|
@@ -24187,7 +24439,7 @@ function headerMode(args, i2, ctx, firstRow) {
|
|
|
24187
24439
|
if (mode === 1 || mode === 3) return true;
|
|
24188
24440
|
return fail(ERR.VALUE);
|
|
24189
24441
|
}
|
|
24190
|
-
var
|
|
24442
|
+
var keyOf2 = (values2) => JSON.stringify(values2);
|
|
24191
24443
|
var plain2 = (v) => v === void 0 || isError(v) ? null : v;
|
|
24192
24444
|
function compareBy(keys, rows) {
|
|
24193
24445
|
return (a2, b) => {
|
|
@@ -24227,7 +24479,7 @@ function groupby(args, ctx) {
|
|
|
24227
24479
|
if (rows.length === 0) fail(ERR.CALC);
|
|
24228
24480
|
const groups = /* @__PURE__ */ new Map();
|
|
24229
24481
|
for (const r of rows) {
|
|
24230
|
-
const key =
|
|
24482
|
+
const key = keyOf2(keysM.data[r]);
|
|
24231
24483
|
const found = groups.get(key);
|
|
24232
24484
|
if (found) found.push(r);
|
|
24233
24485
|
else groups.set(key, [r]);
|
|
@@ -24294,8 +24546,8 @@ function pivotby(args, ctx) {
|
|
|
24294
24546
|
const colKeys = /* @__PURE__ */ new Map();
|
|
24295
24547
|
for (const r of used) {
|
|
24296
24548
|
for (const [map, key] of [
|
|
24297
|
-
[rowKeys,
|
|
24298
|
-
[colKeys,
|
|
24549
|
+
[rowKeys, keyOf2(rowsM.data[r])],
|
|
24550
|
+
[colKeys, keyOf2(colsM.data[r])]
|
|
24299
24551
|
]) {
|
|
24300
24552
|
const found = map.get(key);
|
|
24301
24553
|
if (found) found.push(r);
|
|
@@ -27095,13 +27347,13 @@ function derivedFieldXml(pivot, entry3, date1904) {
|
|
|
27095
27347
|
const days = dateGroupDays(entry3.group);
|
|
27096
27348
|
const labels = dateUnitLabels(entry3.unit, range, days, date1904, entry3.group);
|
|
27097
27349
|
const base = pivot.fields.indexOf(entry3.group.field);
|
|
27098
|
-
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((
|
|
27350
|
+
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>`;
|
|
27099
27351
|
}
|
|
27100
27352
|
function groupXml2(pivot, name, index3) {
|
|
27101
27353
|
const group = groupOf(pivot, name);
|
|
27102
27354
|
if (!group) return "";
|
|
27103
27355
|
const labels = numberGroupLabels(group);
|
|
27104
|
-
return `<fieldGroup base="${index3}"><rangePr autoStart="0" autoEnd="0" startNum="${group.start}" endNum="${group.end}" groupInterval="${group.by}"/><groupItems count="${labels.length}">${labels.map((
|
|
27356
|
+
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>`;
|
|
27105
27357
|
}
|
|
27106
27358
|
function slicerExt(pivot) {
|
|
27107
27359
|
if (pivot.slicerCacheId === void 0) return "";
|
|
@@ -27161,6 +27413,10 @@ function pivotTableXml(source2, cacheId, cache2) {
|
|
|
27161
27413
|
const compact = pivot.layout === "compact";
|
|
27162
27414
|
const outline = pivot.layout === "compact" || pivot.layout === "outline";
|
|
27163
27415
|
const top = (pivot.subtotalPosition ?? (outline ? "top" : "bottom")) === "top";
|
|
27416
|
+
const named2 = (field, item) => {
|
|
27417
|
+
const text2 = pivotItemName(pivot, field, item);
|
|
27418
|
+
return text2 === void 0 ? "" : attrs({ n: encodeEscapes(text2) });
|
|
27419
|
+
};
|
|
27164
27420
|
const fields = pivot.fields.map((name, index3) => {
|
|
27165
27421
|
const isDate = pivot.dateFields?.includes(name) ?? false;
|
|
27166
27422
|
const at = rowIdx.indexOf(index3);
|
|
@@ -27175,7 +27431,7 @@ function pivotTableXml(source2, cacheId, cache2) {
|
|
|
27175
27431
|
custom.map((fn) => [PIVOT_SUBTOTALS[fn].attr, true])
|
|
27176
27432
|
);
|
|
27177
27433
|
const entries = automatic ? '<item t="default"/>' : custom.map((fn) => `<item t="${PIVOT_SUBTOTALS[fn].item}"/>`).join("");
|
|
27178
|
-
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>`;
|
|
27434
|
+
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>`;
|
|
27179
27435
|
}).join("");
|
|
27180
27436
|
const items = (count2, indices) => Array.from({ length: count2 }, (_v, i2) => `<i><x v="${indices?.[i2] ?? i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
27181
27437
|
const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
|
|
@@ -27205,6 +27461,15 @@ function pivotTableXml(source2, cacheId, cache2) {
|
|
|
27205
27461
|
const root = doc.documentElement;
|
|
27206
27462
|
root.setAttribute("name", pivot.name);
|
|
27207
27463
|
root.setAttribute("cacheId", String(cacheId));
|
|
27464
|
+
const caps = pivotCaptions(pivot);
|
|
27465
|
+
root.setAttribute("dataCaption", caps.values);
|
|
27466
|
+
for (const [attribute2, key] of [
|
|
27467
|
+
["rowHeaderCaption", "rowLabels"],
|
|
27468
|
+
["colHeaderCaption", "columnLabels"],
|
|
27469
|
+
["grandTotalCaption", "grandTotal"]
|
|
27470
|
+
])
|
|
27471
|
+
if (caps[key] !== ENGLISH_PIVOT_CAPTIONS[key] || root.hasAttribute(attribute2))
|
|
27472
|
+
root.setAttribute(attribute2, caps[key]);
|
|
27208
27473
|
root.setAttribute("dataOnRows", rowsAxis ? "1" : "0");
|
|
27209
27474
|
if (rowsAxis && valuesAt < rowIdx.length) root.setAttribute("dataPosition", String(valuesAt));
|
|
27210
27475
|
else root.removeAttribute("dataPosition");
|
|
@@ -27272,7 +27537,9 @@ function pivotTableXml(source2, cacheId, cache2) {
|
|
|
27272
27537
|
}
|
|
27273
27538
|
function dateFilterXml(pivot, filter2) {
|
|
27274
27539
|
const x15 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
|
|
27275
|
-
const id = Number(
|
|
27540
|
+
const id = Number(
|
|
27541
|
+
/\bid="(\d+)"/.exec(/<filter\s[^>]*>/.exec(pivot.sourceXml ?? "")?.[0] ?? "")?.[1] ?? 1
|
|
27542
|
+
);
|
|
27276
27543
|
return `<filters count="1"><filter${attrs({ fld: pivot.fields.indexOf(filter2.field), type: "dateBetween", evalOrder: -1, id, name: filter2.field })}><autoFilter ref="A1"><filterColumn colId="0"><customFilters and="1"><customFilter operator="greaterThanOrEqual" val="${Math.floor(filter2.start)}"/><customFilter operator="lessThanOrEqual" val="${Math.floor(filter2.end)}"/></customFilters></filterColumn></autoFilter><extLst><ext uri="{0605FD5F-26C8-4aeb-8148-2DB25E43C511}" xmlns:x15="${x15}"><x15:pivotFilter useWholeDay="1"/></ext></extLst></filter></filters>`;
|
|
27277
27544
|
}
|
|
27278
27545
|
|
|
@@ -30011,9 +30278,9 @@ function parseSheet(bound, records, start, globals) {
|
|
|
30011
30278
|
default: {
|
|
30012
30279
|
if (opcode === 157)
|
|
30013
30280
|
hasAutoFilter = true;
|
|
30014
|
-
const
|
|
30015
|
-
if (
|
|
30016
|
-
addUnique(sheet.unsupported,
|
|
30281
|
+
const label2 = UNSUPPORTED[opcode];
|
|
30282
|
+
if (label2)
|
|
30283
|
+
addUnique(sheet.unsupported, label2);
|
|
30017
30284
|
}
|
|
30018
30285
|
}
|
|
30019
30286
|
}
|