ooxml-core 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PptxHandler-DNZHAHUY.cjs +12 -0
- package/dist/PptxHandler-E44KDHMQ.mjs +3 -0
- package/dist/{PptxHandler-EX4WBIQQ.mjs → PptxHandler-NROFYT2N.mjs} +2 -2
- package/dist/automation/index.cjs +3236 -2258
- package/dist/automation/index.mjs +3236 -2258
- package/dist/{chunk-SWF7KVL5.cjs → chunk-2UVH6RHI.cjs} +1608 -1163
- package/dist/{chunk-M76PHYRR.mjs → chunk-7DSZI7S6.mjs} +1 -1
- package/dist/{chunk-AT66SA5M.cjs → chunk-7QZGRB3T.cjs} +28 -10
- package/dist/chunk-ANZ4Q6I3.cjs +21 -0
- package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
- package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
- package/dist/{chunk-FIELY5PI.mjs → chunk-EC2W2MDY.mjs} +30 -2
- package/dist/chunk-EGTRL3QJ.mjs +19 -0
- package/dist/chunk-GXHKNSZX.mjs +9 -0
- package/dist/{chunk-OXHMZS7B.mjs → chunk-HCXUI5UC.mjs} +943 -273
- package/dist/chunk-HDQXPSHY.cjs +17 -0
- package/dist/chunk-KTYBFGEY.mjs +14 -0
- package/dist/chunk-QOO36KG4.cjs +42 -0
- package/dist/chunk-R2KZXD6U.mjs +39 -0
- package/dist/{chunk-IGOA57LE.mjs → chunk-U2DF3EGK.mjs} +1 -1
- package/dist/{chunk-OB277ZGE.mjs → chunk-UAY26XOI.mjs} +27 -9
- package/dist/{chunk-WSO4T2LJ.mjs → chunk-W5ARCUJB.mjs} +26 -3
- package/dist/chunk-XZPZHXV4.cjs +12 -0
- package/dist/{chunk-LCS3J3QI.mjs → chunk-YB5SRNFS.mjs} +717 -272
- package/dist/docx/layout/adapt-table.d.ts +2 -2
- package/dist/docx/layout/adapt-table.d.ts.map +1 -1
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +554 -83
- package/dist/docx/layout/index.mjs +554 -84
- package/dist/docx/layout/nested-fragment-edges.d.ts +9 -0
- package/dist/docx/layout/nested-fragment-edges.d.ts.map +1 -0
- package/dist/docx/layout/nested-frame-profile.d.ts +9 -0
- package/dist/docx/layout/nested-frame-profile.d.ts.map +1 -0
- package/dist/docx/layout/page-cursor.d.ts +2 -0
- package/dist/docx/layout/page-cursor.d.ts.map +1 -1
- package/dist/docx/layout/result.d.ts +20 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/table-border-layout.d.ts +16 -0
- package/dist/docx/layout/table-border-layout.d.ts.map +1 -0
- package/dist/docx/layout/table-cell-layout.d.ts +3 -2
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-content.d.ts +4 -0
- package/dist/docx/layout/table-content.d.ts.map +1 -0
- package/dist/docx/layout/table-footnotes.d.ts +5 -0
- package/dist/docx/layout/table-footnotes.d.ts.map +1 -1
- package/dist/docx/layout/table-frames.d.ts +4 -0
- package/dist/docx/layout/table-frames.d.ts.map +1 -0
- package/dist/docx/layout/table-layout.d.ts +8 -3
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-note-completion.d.ts +5 -0
- package/dist/docx/layout/table-note-completion.d.ts.map +1 -0
- package/dist/docx/layout/table-note-stories.d.ts +6 -0
- package/dist/docx/layout/table-note-stories.d.ts.map +1 -0
- package/dist/pptx/automation/index.cjs +801 -296
- package/dist/pptx/automation/index.d.ts +5 -4
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{text-operations-BLodkuXE.d.ts → elements-DD3UGOMd.d.ts} +27 -3248
- package/dist/pptx/chunks/elements-DD3UGOMd.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B4cnSPNz.d.ts → index-BZrFyNtU.d.ts} +113 -5
- package/dist/pptx/chunks/index-BZrFyNtU.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-BZh-IMkN.d.ts → index-DdX02BSm.d.ts} +19 -3
- package/dist/pptx/chunks/index-DdX02BSm.d.ts.map +1 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts +1512 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts.map +1 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts +1473 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +1 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts +3261 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +801 -296
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.cjs +1 -0
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.cjs +2 -2
- package/dist/pptx/editor/render/collaboration-live-patch-target.mjs +1 -1
- package/dist/pptx/editor/render/find-replace.cjs +19 -18
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +3 -2
- package/dist/pptx/editor/render/font-family-update.cjs +14 -0
- package/dist/pptx/editor/render/font-family-update.d.ts +17 -0
- package/dist/pptx/editor/render/font-family-update.d.ts.map +1 -0
- package/dist/pptx/editor/render/font-family-update.mjs +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.cjs +14 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +17 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts.map +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.mjs +12 -0
- package/dist/pptx/editor/render/remap-text.cjs +2 -2
- package/dist/pptx/editor/render/remap-text.d.ts.map +1 -1
- package/dist/pptx/editor/render/remap-text.mjs +1 -1
- package/dist/pptx/editor/render/slide-operations.cjs +9 -8
- package/dist/pptx/editor/render/slide-operations.mjs +3 -2
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.cjs +18 -0
- package/dist/pptx/editor/render/text-content-style.d.ts +9 -0
- package/dist/pptx/editor/render/text-content-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-content-style.mjs +5 -0
- package/dist/pptx/editor/render/text-runs-style-patch.cjs +17 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +7 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-runs-style-patch.mjs +15 -0
- package/dist/pptx/editor/render/text-style-scope.cjs +173 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts +76 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-style-scope.mjs +164 -0
- package/dist/pptx/editor/render/theme-editor-model.cjs +1 -1
- package/dist/pptx/editor/render/theme-editor-model.mjs +1 -1
- package/dist/pptx/editor/render/update-text-segment-style.cjs +11 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +14 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/update-text-segment-style.mjs +2 -0
- package/dist/pptx/index.cjs +1091 -296
- package/dist/pptx/index.d.ts +7 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +590 -122
- package/dist/teams/index.mjs +590 -122
- package/dist/visio/date-cache.d.ts +3 -0
- package/dist/visio/date-cache.d.ts.map +1 -0
- package/dist/visio/edit-commands.d.ts +3 -3
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-text-field-commands.d.ts +15 -0
- package/dist/visio/edit-text-field-commands.d.ts.map +1 -1
- package/dist/visio/edit-text-field.d.ts +2 -2
- package/dist/visio/edit-text-field.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +501 -220
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +501 -220
- package/dist/visio/model.d.ts +6 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/style.d.ts +1 -1
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/text-field-display.d.ts +3 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-editability.d.ts +6 -0
- package/dist/visio/text-field-editability.d.ts.map +1 -0
- package/dist/visio/text-field-fraction.d.ts +3 -0
- package/dist/visio/text-field-fraction.d.ts.map +1 -0
- package/dist/visio/text-field-independent.d.ts +4 -0
- package/dist/visio/text-field-independent.d.ts.map +1 -0
- package/dist/visio/text-field-numeric.d.ts +1 -1
- package/dist/visio/text-field-numeric.d.ts.map +1 -1
- package/dist/visio/text-field-source.d.ts +6 -0
- package/dist/visio/text-field-source.d.ts.map +1 -0
- package/dist/visio/text-field-system-date.d.ts +4 -0
- package/dist/visio/text-field-system-date.d.ts.map +1 -0
- package/dist/visio/text-fields.d.ts +1 -0
- package/dist/visio/text-fields.d.ts.map +1 -1
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +514 -221
- package/dist/visio/ui/index.mjs +514 -221
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/visio/ui/text-field-catalog.d.ts.map +1 -1
- package/dist/xlsx/edit/pivots.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +1362 -659
- package/dist/xlsx/index.mjs +1361 -660
- package/dist/xlsx/load/index.cjs +1091 -430
- package/dist/xlsx/load/index.mjs +1091 -430
- package/dist/xlsx/model-pivots.d.ts +31 -2
- package/dist/xlsx/model-pivots.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts.map +1 -1
- package/dist/xlsx/pivot/aggregate.d.ts +3 -1
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
- package/dist/xlsx/pivot/data.d.ts +2 -2
- package/dist/xlsx/pivot/data.d.ts.map +1 -1
- package/dist/xlsx/pivot/hierarchy-first.d.ts +21 -0
- package/dist/xlsx/pivot/hierarchy-first.d.ts.map +1 -0
- package/dist/xlsx/pivot/hierarchy.d.ts +2 -4
- package/dist/xlsx/pivot/hierarchy.d.ts.map +1 -1
- package/dist/xlsx/pivot/index.d.ts +2 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -1
- package/dist/xlsx/pivot/measures.d.ts +13 -0
- package/dist/xlsx/pivot/measures.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts +5 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter.d.ts +11 -0
- package/dist/xlsx/pivot/page-filter.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -1
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/values-axis.d.ts +12 -0
- package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +640 -137
- package/dist/xlsx/ui/index.mjs +640 -137
- package/package.json +2 -2
- package/dist/PptxHandler-AT7FVG5Q.mjs +0 -2
- package/dist/PptxHandler-VFSCECPL.cjs +0 -11
- package/dist/pptx/chunks/index-B4cnSPNz.d.ts.map +0 -1
- package/dist/pptx/chunks/index-BZh-IMkN.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts +0 -2970
- package/dist/pptx/chunks/smart-art-Q2kZQtHh.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +0 -1
package/dist/teams/index.cjs
CHANGED
|
@@ -4981,7 +4981,7 @@ var init_ast = __esm({
|
|
|
4981
4981
|
});
|
|
4982
4982
|
|
|
4983
4983
|
// xlsx/model.ts
|
|
4984
|
-
var ERROR_CODES, isCellError;
|
|
4984
|
+
var ERROR_CODES, isErrorCode, isCellError;
|
|
4985
4985
|
var init_model = __esm({
|
|
4986
4986
|
"xlsx/model.ts"() {
|
|
4987
4987
|
ERROR_CODES = [
|
|
@@ -4996,6 +4996,7 @@ var init_model = __esm({
|
|
|
4996
4996
|
"#SPILL!",
|
|
4997
4997
|
"#CALC!"
|
|
4998
4998
|
];
|
|
4999
|
+
isErrorCode = (value) => ERROR_CODES.includes(value);
|
|
4999
5000
|
isCellError = (value) => typeof value === "object" && value !== null && "error" in value;
|
|
5000
5001
|
}
|
|
5001
5002
|
});
|
|
@@ -19976,6 +19977,66 @@ var init_sparkline_ranges = __esm({
|
|
|
19976
19977
|
}
|
|
19977
19978
|
});
|
|
19978
19979
|
|
|
19980
|
+
// xlsx/pivot/page-filter.ts
|
|
19981
|
+
function validatePivotPageFilter(pivot) {
|
|
19982
|
+
const filter2 = pivot.pageFilter;
|
|
19983
|
+
const extras = Array.isArray(pivot.additionalValues) ? pivot.additionalValues : [];
|
|
19984
|
+
if (filter2 === void 0) return;
|
|
19985
|
+
if (!filter2 || typeof filter2 !== "object" || Array.isArray(filter2) || Object.keys(filter2).some((key) => key !== "field" && key !== "item") || typeof filter2.field !== "string" || !pivot.fields.includes(filter2.field) || [
|
|
19986
|
+
pivot.rowField,
|
|
19987
|
+
pivot.secondRowField,
|
|
19988
|
+
pivot.columnField,
|
|
19989
|
+
pivot.valueField,
|
|
19990
|
+
...extras.map((v) => v?.field)
|
|
19991
|
+
].includes(filter2.field) || pivot.valuesAxis === "rows")
|
|
19992
|
+
throw new Error("Report filters require Values on columns and a separate source field.");
|
|
19993
|
+
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))
|
|
19994
|
+
throw new Error("Choose a cached literal report filter item.");
|
|
19995
|
+
}
|
|
19996
|
+
function pivotPageProjection(pivot) {
|
|
19997
|
+
const filter2 = pivot.pageFilter;
|
|
19998
|
+
if (!filter2) return pivot;
|
|
19999
|
+
const labels = /* @__PURE__ */ new Map();
|
|
20000
|
+
for (const item of pivotItems(pivot, filter2.field)) {
|
|
20001
|
+
const label3 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
|
|
20002
|
+
if (label3 === "(all)" || labels.has(label3) && labels.get(label3) !== key2)
|
|
20003
|
+
throw new Error("Ambiguous report filter item captions are preserved.");
|
|
20004
|
+
labels.set(label3, key2);
|
|
20005
|
+
}
|
|
20006
|
+
if (filter2.item === void 0) return pivot;
|
|
20007
|
+
const index2 = pivot.fields.indexOf(filter2.field), key = pivotValueKey(filter2.item);
|
|
20008
|
+
const records = pivot.records.filter((record) => pivotValueKey(record[index2] ?? null) === key);
|
|
20009
|
+
if (!records.length) throw new Error("The report filter item is missing from the source.");
|
|
20010
|
+
if (JSON.stringify(records[0][index2] ?? null) !== JSON.stringify(filter2.item))
|
|
20011
|
+
throw new Error("Choose an exact cached literal report filter item.");
|
|
20012
|
+
return { ...pivot, records };
|
|
20013
|
+
}
|
|
20014
|
+
function prependPivotPage(grid, pivot) {
|
|
20015
|
+
if (!pivot.pageFilter) return grid;
|
|
20016
|
+
const width = grid.values[0].length;
|
|
20017
|
+
return {
|
|
20018
|
+
...grid,
|
|
20019
|
+
values: [
|
|
20020
|
+
[
|
|
20021
|
+
pivot.pageFilter.field,
|
|
20022
|
+
pivot.pageFilter.item === void 0 ? "(All)" : pivotItemLabel(pivot.pageFilter.item),
|
|
20023
|
+
...Array(width - 2).fill(null)
|
|
20024
|
+
],
|
|
20025
|
+
Array(width).fill(null),
|
|
20026
|
+
...grid.values
|
|
20027
|
+
],
|
|
20028
|
+
firstDataRow: grid.firstDataRow + 2,
|
|
20029
|
+
...grid.firstHeaderRow !== void 0 ? { firstHeaderRow: grid.firstHeaderRow + 2 } : {},
|
|
20030
|
+
...grid.indents ? { indents: [0, 0, ...grid.indents] } : {}
|
|
20031
|
+
};
|
|
20032
|
+
}
|
|
20033
|
+
var init_page_filter = __esm({
|
|
20034
|
+
"xlsx/pivot/page-filter.ts"() {
|
|
20035
|
+
init_model();
|
|
20036
|
+
init_data();
|
|
20037
|
+
}
|
|
20038
|
+
});
|
|
20039
|
+
|
|
19979
20040
|
// xlsx/pivot/data.ts
|
|
19980
20041
|
function pivotValueKey(value) {
|
|
19981
20042
|
return value === null || value === "" ? "blank" : isCellError(value) ? `error:${value.error}` : `${typeof value}:${String(value).toLowerCase()}`;
|
|
@@ -20002,12 +20063,32 @@ function pivotItemLabel(value) {
|
|
|
20002
20063
|
return isCellError(value) ? value.error : value;
|
|
20003
20064
|
}
|
|
20004
20065
|
function validatePivotFields(pivot) {
|
|
20066
|
+
validatePivotPageFilter(pivot);
|
|
20005
20067
|
const used = [
|
|
20006
20068
|
pivot.rowField,
|
|
20007
20069
|
...pivot.secondRowField ? [pivot.secondRowField] : [],
|
|
20008
20070
|
...pivot.columnField ? [pivot.columnField] : [],
|
|
20009
20071
|
pivot.valueField
|
|
20010
20072
|
];
|
|
20073
|
+
const extras = pivot.additionalValues ?? [];
|
|
20074
|
+
if (pivot.valuesAxis !== void 0 && !["columns", "rows"].includes(pivot.valuesAxis))
|
|
20075
|
+
throw new Error("Choose a valid Values axis.");
|
|
20076
|
+
if (pivot.valuesPosition !== void 0 && !["last", "between", "first"].includes(pivot.valuesPosition))
|
|
20077
|
+
throw new Error("Choose a valid Values position.");
|
|
20078
|
+
if ((pivot.valuesPosition === "between" || pivot.valuesPosition === "first") && (pivot.valuesAxis !== "rows" || !pivot.secondRowField))
|
|
20079
|
+
throw new Error("Values before or between fields require two row fields and Values on rows.");
|
|
20080
|
+
if (pivot.valuesAxis === "rows" && (!Array.isArray(extras) || !extras.length))
|
|
20081
|
+
throw new Error("Values on rows require multiple measures.");
|
|
20082
|
+
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== "Values")
|
|
20083
|
+
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
20084
|
+
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
20085
|
+
(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())
|
|
20086
|
+
) || new Set(
|
|
20087
|
+
[pivot.valueCaption, ...extras.map((measure) => measure.caption)].map(
|
|
20088
|
+
(caption) => caption?.toLowerCase()
|
|
20089
|
+
)
|
|
20090
|
+
).size !== extras.length + 1)
|
|
20091
|
+
throw new Error("Choose PivotTable value fields with valid aggregates and unique captions.");
|
|
20011
20092
|
if (pivot.layout !== void 0 && !["tabular", "compact", "outline"].includes(pivot.layout) || pivot.subtotalPosition !== void 0 && !["top", "bottom"].includes(pivot.subtotalPosition) || !PIVOT_AGGREGATES.includes(pivot.aggregate) || used.some((field) => !pivot.fields.includes(field)) || new Set([pivot.rowField, pivot.secondRowField, pivot.columnField].filter(Boolean)).size !== [pivot.rowField, pivot.secondRowField, pivot.columnField].filter(Boolean).length || pivot.subtotals !== void 0 && typeof pivot.subtotals !== "boolean" || pivot.repeatLabels !== void 0 && typeof pivot.repeatLabels !== "boolean")
|
|
20012
20093
|
throw new Error("Choose valid PivotTable fields; row and column fields must differ.");
|
|
20013
20094
|
}
|
|
@@ -20015,6 +20096,8 @@ var PIVOT_AGGREGATES;
|
|
|
20015
20096
|
var init_data = __esm({
|
|
20016
20097
|
"xlsx/pivot/data.ts"() {
|
|
20017
20098
|
init_model();
|
|
20099
|
+
init_xml2();
|
|
20100
|
+
init_page_filter();
|
|
20018
20101
|
PIVOT_AGGREGATES = ["sum", "count", "average", "min", "max"];
|
|
20019
20102
|
}
|
|
20020
20103
|
});
|
|
@@ -20072,20 +20155,186 @@ var init_cache_xml = __esm({
|
|
|
20072
20155
|
}
|
|
20073
20156
|
});
|
|
20074
20157
|
|
|
20158
|
+
// xlsx/pivot/measures.ts
|
|
20159
|
+
function aggregate2(records, field, type) {
|
|
20160
|
+
if (!records.length) return null;
|
|
20161
|
+
const values2 = records.map((record) => record[field] ?? null);
|
|
20162
|
+
if (type === "count") return values2.filter((value) => value !== null && value !== "").length;
|
|
20163
|
+
const error = values2.find(isCellError);
|
|
20164
|
+
if (error) return error;
|
|
20165
|
+
const numbers3 = values2.filter((value) => typeof value === "number");
|
|
20166
|
+
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
20167
|
+
if (type === "min") return numbers3.reduce((a2, b) => Math.min(a2, b));
|
|
20168
|
+
if (type === "max") return numbers3.reduce((a2, b) => Math.max(a2, b));
|
|
20169
|
+
const sum2 = numbers3.reduce((total2, value) => total2 + value, 0);
|
|
20170
|
+
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
20171
|
+
}
|
|
20172
|
+
function pivotHeaderDimensions(pivot, columnItems, rowLabels) {
|
|
20173
|
+
const measures = 1 + (pivot.additionalValues?.length ?? 0);
|
|
20174
|
+
if (pivot.valuesAxis === "rows")
|
|
20175
|
+
return {
|
|
20176
|
+
rows: (pivot.columnField ? 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
20177
|
+
width: rowLabels + (pivot.columnField ? columnItems + 1 : 1)
|
|
20178
|
+
};
|
|
20179
|
+
return {
|
|
20180
|
+
rows: (pivot.columnField ? measures > 1 ? 3 : 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
20181
|
+
width: rowLabels + (pivot.columnField ? measures === 1 ? Math.max(1, columnItems) + 1 : (columnItems + 1) * measures : measures)
|
|
20182
|
+
};
|
|
20183
|
+
}
|
|
20184
|
+
function pivotHeaders(pivot, columns, labels, label3) {
|
|
20185
|
+
const measures = pivotMeasures(pivot);
|
|
20186
|
+
if (pivot.valuesAxis === "rows") {
|
|
20187
|
+
const rowLabels = pivot.layout === "compact" ? ["Row Labels"] : pivot.valuesPosition === "first" ? ["Values", ...labels] : pivot.valuesPosition === "between" ? [labels[0], "Values", labels[1]] : [...labels, "Values"];
|
|
20188
|
+
return pivot.columnField ? [
|
|
20189
|
+
[
|
|
20190
|
+
...rowLabels.map(() => null),
|
|
20191
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
20192
|
+
...columns.map(() => null)
|
|
20193
|
+
],
|
|
20194
|
+
[...rowLabels, ...columns.map(label3), "Grand Total"]
|
|
20195
|
+
] : [[...rowLabels, null]];
|
|
20196
|
+
}
|
|
20197
|
+
if (!pivot.columnField) return [[...labels, ...measures.map((measure) => measure.caption)]];
|
|
20198
|
+
if (measures.length === 1)
|
|
20199
|
+
return [
|
|
20200
|
+
[
|
|
20201
|
+
pivot.valueCaption,
|
|
20202
|
+
...labels.slice(1).map(() => null),
|
|
20203
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
20204
|
+
...columns.slice(1).map(() => null),
|
|
20205
|
+
null
|
|
20206
|
+
],
|
|
20207
|
+
[...labels, ...columns.map(label3), "Grand Total"]
|
|
20208
|
+
];
|
|
20209
|
+
const { width } = pivotHeaderDimensions(pivot, columns.length, labels.length);
|
|
20210
|
+
const first2 = Array(width).fill(null);
|
|
20211
|
+
first2[labels.length] = pivot.layout === "compact" ? "Column Labels" : pivot.columnField;
|
|
20212
|
+
if (pivot.layout !== "compact") first2[labels.length + 1] = "Values";
|
|
20213
|
+
return [
|
|
20214
|
+
first2,
|
|
20215
|
+
[
|
|
20216
|
+
...labels.map(() => null),
|
|
20217
|
+
...columns.flatMap((column) => [label3(column), ...measures.slice(1).map(() => null)]),
|
|
20218
|
+
...measures.map((measure) => `Total ${measure.caption}`)
|
|
20219
|
+
],
|
|
20220
|
+
[
|
|
20221
|
+
...labels,
|
|
20222
|
+
...columns.flatMap(() => measures.map((measure) => measure.caption)),
|
|
20223
|
+
...measures.map(() => null)
|
|
20224
|
+
]
|
|
20225
|
+
];
|
|
20226
|
+
}
|
|
20227
|
+
var pivotMeasures, pivotMeasureNumber, pivotNumbers;
|
|
20228
|
+
var init_measures = __esm({
|
|
20229
|
+
"xlsx/pivot/measures.ts"() {
|
|
20230
|
+
init_model();
|
|
20231
|
+
pivotMeasures = (pivot) => [
|
|
20232
|
+
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
20233
|
+
...pivot.additionalValues ?? []
|
|
20234
|
+
];
|
|
20235
|
+
pivotMeasureNumber = (pivot, records, measure) => aggregate2(records, pivot.fields.indexOf(measure.field), measure.aggregate);
|
|
20236
|
+
pivotNumbers = (pivot, records) => pivotMeasures(pivot).map((measure) => pivotMeasureNumber(pivot, records, measure));
|
|
20237
|
+
}
|
|
20238
|
+
});
|
|
20239
|
+
|
|
20240
|
+
// xlsx/pivot/hierarchy-first.ts
|
|
20241
|
+
function appendFirstPivotValues(pivot, context) {
|
|
20242
|
+
const {
|
|
20243
|
+
rowItems,
|
|
20244
|
+
secondRowItems,
|
|
20245
|
+
columnItems,
|
|
20246
|
+
children: children2,
|
|
20247
|
+
innerIndices,
|
|
20248
|
+
groups,
|
|
20249
|
+
details,
|
|
20250
|
+
buckets,
|
|
20251
|
+
width,
|
|
20252
|
+
rowLabels,
|
|
20253
|
+
top,
|
|
20254
|
+
bottom,
|
|
20255
|
+
append
|
|
20256
|
+
} = context;
|
|
20257
|
+
const compact = pivot.layout === "compact";
|
|
20258
|
+
const tabular = !pivot.layout || pivot.layout === "tabular";
|
|
20259
|
+
const blank = () => Array(width - rowLabels).fill(null);
|
|
20260
|
+
pivotMeasures(pivot).forEach((measure, m) => {
|
|
20261
|
+
const numbers3 = (keys, records) => [
|
|
20262
|
+
...columnItems.map(
|
|
20263
|
+
(column) => pivotMeasureNumber(
|
|
20264
|
+
pivot,
|
|
20265
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
20266
|
+
measure
|
|
20267
|
+
)
|
|
20268
|
+
),
|
|
20269
|
+
pivotMeasureNumber(pivot, records, measure)
|
|
20270
|
+
];
|
|
20271
|
+
if (!tabular)
|
|
20272
|
+
append([measure.caption, ...Array(rowLabels - 1).fill(null)], blank(), {
|
|
20273
|
+
indices: [m],
|
|
20274
|
+
measure: m
|
|
20275
|
+
});
|
|
20276
|
+
let first2 = true;
|
|
20277
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
20278
|
+
const key = pivotValueKey(outer);
|
|
20279
|
+
const group = groups.get(key) ?? [];
|
|
20280
|
+
if (!tabular)
|
|
20281
|
+
append(
|
|
20282
|
+
compact ? [pivotItemLabel(outer)] : [null, pivotItemLabel(outer), null],
|
|
20283
|
+
top ? numbers3([key], group) : blank(),
|
|
20284
|
+
{ indices: [m, outerIndex], measure: m },
|
|
20285
|
+
compact ? 1 : 0
|
|
20286
|
+
);
|
|
20287
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
20288
|
+
(a2, b) => innerIndices.get(a2) - innerIndices.get(b)
|
|
20289
|
+
);
|
|
20290
|
+
innerKeys.forEach((innerKey, child3) => {
|
|
20291
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
20292
|
+
append(
|
|
20293
|
+
compact ? [pivotItemLabel(secondRowItems[innerIndex])] : [
|
|
20294
|
+
tabular && first2 ? measure.caption : null,
|
|
20295
|
+
pivot.repeatLabels || tabular && child3 === 0 ? pivotItemLabel(outer) : null,
|
|
20296
|
+
pivotItemLabel(secondRowItems[innerIndex])
|
|
20297
|
+
],
|
|
20298
|
+
numbers3([key, innerKey], details.get(JSON.stringify([key, innerKey]))),
|
|
20299
|
+
{ indices: [m, outerIndex, innerIndex], measure: m },
|
|
20300
|
+
compact ? 2 : 0
|
|
20301
|
+
);
|
|
20302
|
+
first2 = false;
|
|
20303
|
+
});
|
|
20304
|
+
if (bottom)
|
|
20305
|
+
append(
|
|
20306
|
+
compact ? [`${String(pivotItemLabel(outer))} Total`] : [null, `${String(pivotItemLabel(outer))} Total`, null],
|
|
20307
|
+
numbers3([key], group),
|
|
20308
|
+
{ indices: [m, outerIndex], measure: m, type: "default" },
|
|
20309
|
+
compact ? 1 : 0
|
|
20310
|
+
);
|
|
20311
|
+
});
|
|
20312
|
+
});
|
|
20313
|
+
}
|
|
20314
|
+
var init_hierarchy_first = __esm({
|
|
20315
|
+
"xlsx/pivot/hierarchy-first.ts"() {
|
|
20316
|
+
init_data();
|
|
20317
|
+
init_measures();
|
|
20318
|
+
}
|
|
20319
|
+
});
|
|
20320
|
+
|
|
20075
20321
|
// xlsx/pivot/hierarchy.ts
|
|
20076
|
-
function hierarchicalPivotGrid(pivot
|
|
20322
|
+
function hierarchicalPivotGrid(pivot) {
|
|
20077
20323
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
20078
20324
|
const secondRowItems = pivotItems(pivot, pivot.secondRowField);
|
|
20079
20325
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
20080
20326
|
const outerField = pivot.fields.indexOf(pivot.rowField);
|
|
20081
20327
|
const innerField = pivot.fields.indexOf(pivot.secondRowField);
|
|
20082
20328
|
const columnField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
20083
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
20084
20329
|
const layout2 = pivot.layout ?? "tabular";
|
|
20085
20330
|
const compact = layout2 === "compact";
|
|
20086
|
-
const
|
|
20331
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
20332
|
+
const firstValues = rowsAxis && pivot.valuesPosition === "first";
|
|
20333
|
+
const between = rowsAxis && pivot.valuesPosition === "between";
|
|
20334
|
+
const measures = pivotMeasures(pivot);
|
|
20335
|
+
const top = (!rowsAxis || firstValues) && layout2 !== "tabular" && pivot.subtotals !== false && (pivot.subtotalPosition ?? "top") === "top";
|
|
20087
20336
|
const bottom = pivot.subtotals !== false && !top;
|
|
20088
|
-
const rowLabelColumns = compact ? 1 : 2;
|
|
20337
|
+
const rowLabelColumns = compact ? 1 : rowsAxis ? 3 : 2;
|
|
20089
20338
|
const groups = /* @__PURE__ */ new Map();
|
|
20090
20339
|
const details = /* @__PURE__ */ new Map();
|
|
20091
20340
|
const children2 = /* @__PURE__ */ new Map();
|
|
@@ -20109,20 +20358,12 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
20109
20358
|
collect(buckets, JSON.stringify([...key, column]), record);
|
|
20110
20359
|
}
|
|
20111
20360
|
}
|
|
20112
|
-
const
|
|
20113
|
-
|
|
20114
|
-
|
|
20361
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowLabelColumns);
|
|
20362
|
+
const rows = (details.size + rowItems.length * Number(bottom) + 1) * (rowsAxis ? measures.length : 1) + rowItems.length * Number(layout2 !== "tabular") * (firstValues ? measures.length : 1) + (firstValues ? measures.length : between ? rowItems.length * measures.length : details.size) * Number(rowsAxis && layout2 !== "tabular") + dimensions.rows;
|
|
20363
|
+
if (rows * dimensions.width > 1e6) throw new Error("The PivotTable result is too large.");
|
|
20115
20364
|
const labels = compact ? ["Row Labels"] : [pivot.rowField, pivot.secondRowField];
|
|
20116
|
-
const values2 = pivot
|
|
20117
|
-
|
|
20118
|
-
pivot.valueCaption,
|
|
20119
|
-
...compact ? [] : [null],
|
|
20120
|
-
compact ? "Column Labels" : pivot.columnField,
|
|
20121
|
-
...columnItems.slice(1).map(() => null),
|
|
20122
|
-
null
|
|
20123
|
-
],
|
|
20124
|
-
[...labels, ...columnItems.map(label2), "Grand Total"]
|
|
20125
|
-
] : [[...labels, pivot.valueCaption]];
|
|
20365
|
+
const values2 = pivotHeaders(pivot, columnItems, labels, label2);
|
|
20366
|
+
const firstDataRow = values2.length;
|
|
20126
20367
|
const indents = values2.map(() => 0);
|
|
20127
20368
|
const rowEntries = [];
|
|
20128
20369
|
const append = (labels2, numbers4, entry3, indent = 0) => {
|
|
@@ -20130,98 +20371,196 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
20130
20371
|
rowEntries.push(entry3);
|
|
20131
20372
|
indents.push(indent);
|
|
20132
20373
|
};
|
|
20133
|
-
const
|
|
20374
|
+
const bands = (keys, records) => [
|
|
20134
20375
|
...columnItems.map(
|
|
20135
|
-
(column) =>
|
|
20136
|
-
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
20137
|
-
valueField,
|
|
20138
|
-
pivot.aggregate
|
|
20139
|
-
)
|
|
20376
|
+
(column) => pivotNumbers(pivot, buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [])
|
|
20140
20377
|
),
|
|
20141
|
-
|
|
20378
|
+
pivotNumbers(pivot, records)
|
|
20142
20379
|
];
|
|
20143
|
-
|
|
20144
|
-
|
|
20145
|
-
|
|
20146
|
-
|
|
20147
|
-
|
|
20148
|
-
|
|
20149
|
-
|
|
20150
|
-
|
|
20151
|
-
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
const records = details.get(JSON.stringify(keys));
|
|
20157
|
-
if (!records) return;
|
|
20158
|
-
append(
|
|
20159
|
-
compact ? [label2(inner)] : [
|
|
20160
|
-
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
20161
|
-
label2(inner)
|
|
20380
|
+
const numbers3 = (keys, records) => bands(keys, records).flat();
|
|
20381
|
+
const appendMeasures = (labels2, keys, records, indices, type) => {
|
|
20382
|
+
const values3 = bands(keys, records);
|
|
20383
|
+
measures.forEach(
|
|
20384
|
+
(measure, m) => append(
|
|
20385
|
+
type ? [
|
|
20386
|
+
`${type === "grand" ? "Total" : String(labels2[0])} ${measure.caption}`,
|
|
20387
|
+
...Array(rowLabelColumns - 1).fill(null)
|
|
20388
|
+
] : compact ? [measure.caption] : [
|
|
20389
|
+
...labels2.map(
|
|
20390
|
+
(label3) => layout2 === "tabular" && m === 0 || pivot.repeatLabels ? label3 : null
|
|
20391
|
+
),
|
|
20392
|
+
measure.caption
|
|
20162
20393
|
],
|
|
20163
|
-
|
|
20164
|
-
{ indices: [
|
|
20165
|
-
compact ?
|
|
20166
|
-
)
|
|
20167
|
-
|
|
20394
|
+
values3.map((band) => band[m] ?? null),
|
|
20395
|
+
{ indices: type ? indices : [...indices, m], measure: m, ...type ? { type } : {} },
|
|
20396
|
+
compact && !type ? 2 : 0
|
|
20397
|
+
)
|
|
20398
|
+
);
|
|
20399
|
+
};
|
|
20400
|
+
if (firstValues)
|
|
20401
|
+
appendFirstPivotValues(pivot, {
|
|
20402
|
+
rowItems,
|
|
20403
|
+
secondRowItems,
|
|
20404
|
+
columnItems,
|
|
20405
|
+
children: children2,
|
|
20406
|
+
innerIndices,
|
|
20407
|
+
groups,
|
|
20408
|
+
details,
|
|
20409
|
+
buckets,
|
|
20410
|
+
width: dimensions.width,
|
|
20411
|
+
rowLabels: rowLabelColumns,
|
|
20412
|
+
top,
|
|
20413
|
+
bottom,
|
|
20414
|
+
append
|
|
20168
20415
|
});
|
|
20169
|
-
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20416
|
+
else
|
|
20417
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
20418
|
+
const key = pivotValueKey(outer);
|
|
20419
|
+
if (layout2 !== "tabular")
|
|
20420
|
+
append(
|
|
20421
|
+
[label2(outer), ...Array(rowLabelColumns - 1).fill(null)],
|
|
20422
|
+
top ? numbers3([key], groups.get(key) ?? []) : Array(dimensions.width - rowLabelColumns).fill(null),
|
|
20423
|
+
{ indices: [outerIndex] }
|
|
20424
|
+
);
|
|
20425
|
+
let first2 = true;
|
|
20426
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
20427
|
+
(a2, b) => innerIndices.get(a2) - innerIndices.get(b)
|
|
20175
20428
|
);
|
|
20176
|
-
|
|
20177
|
-
|
|
20178
|
-
|
|
20179
|
-
|
|
20180
|
-
|
|
20181
|
-
|
|
20429
|
+
if (between)
|
|
20430
|
+
measures.forEach((measure, m) => {
|
|
20431
|
+
if (layout2 !== "tabular")
|
|
20432
|
+
append(
|
|
20433
|
+
compact ? [measure.caption] : [pivot.repeatLabels ? label2(outer) : null, measure.caption, null],
|
|
20434
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
20435
|
+
{ indices: [outerIndex, m], measure: m },
|
|
20436
|
+
compact ? 1 : 0
|
|
20437
|
+
);
|
|
20438
|
+
innerKeys.forEach((innerKey, child3) => {
|
|
20439
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
20440
|
+
const keys = [key, innerKey];
|
|
20441
|
+
const records = details.get(JSON.stringify(keys));
|
|
20442
|
+
append(
|
|
20443
|
+
compact ? [label2(secondRowItems[innerIndex])] : [
|
|
20444
|
+
pivot.repeatLabels || layout2 === "tabular" && m === 0 && child3 === 0 ? label2(outer) : null,
|
|
20445
|
+
layout2 === "tabular" && child3 === 0 ? measure.caption : null,
|
|
20446
|
+
label2(secondRowItems[innerIndex])
|
|
20447
|
+
],
|
|
20448
|
+
[
|
|
20449
|
+
...columnItems.map(
|
|
20450
|
+
(column) => pivotMeasureNumber(
|
|
20451
|
+
pivot,
|
|
20452
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
20453
|
+
measure
|
|
20454
|
+
)
|
|
20455
|
+
),
|
|
20456
|
+
pivotMeasureNumber(pivot, records, measure)
|
|
20457
|
+
],
|
|
20458
|
+
{ indices: [outerIndex, m, innerIndex], measure: m },
|
|
20459
|
+
compact ? 2 : 0
|
|
20460
|
+
);
|
|
20461
|
+
});
|
|
20462
|
+
});
|
|
20463
|
+
else
|
|
20464
|
+
innerKeys.forEach((innerKey) => {
|
|
20465
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
20466
|
+
const inner = secondRowItems[innerIndex];
|
|
20467
|
+
const keys = [key, innerKey];
|
|
20468
|
+
const records = details.get(JSON.stringify(keys));
|
|
20469
|
+
if (!records) return;
|
|
20470
|
+
if (rowsAxis) {
|
|
20471
|
+
if (layout2 !== "tabular")
|
|
20472
|
+
append(
|
|
20473
|
+
compact ? [label2(inner)] : [pivot.repeatLabels ? label2(outer) : null, label2(inner), null],
|
|
20474
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
20475
|
+
{ indices: [outerIndex, innerIndex] },
|
|
20476
|
+
compact ? 1 : 0
|
|
20477
|
+
);
|
|
20478
|
+
appendMeasures(
|
|
20479
|
+
[pivot.repeatLabels || first2 ? label2(outer) : null, label2(inner)],
|
|
20480
|
+
keys,
|
|
20481
|
+
records,
|
|
20482
|
+
[outerIndex, innerIndex]
|
|
20483
|
+
);
|
|
20484
|
+
first2 = false;
|
|
20485
|
+
return;
|
|
20486
|
+
}
|
|
20487
|
+
append(
|
|
20488
|
+
compact ? [label2(inner)] : [
|
|
20489
|
+
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
20490
|
+
label2(inner)
|
|
20491
|
+
],
|
|
20492
|
+
numbers3(keys, records),
|
|
20493
|
+
{ indices: [outerIndex, innerIndex] },
|
|
20494
|
+
compact ? 1 : 0
|
|
20495
|
+
);
|
|
20496
|
+
first2 = false;
|
|
20497
|
+
});
|
|
20498
|
+
if (bottom) {
|
|
20499
|
+
if (rowsAxis) {
|
|
20500
|
+
appendMeasures([label2(outer)], [key], groups.get(key) ?? [], [outerIndex], "default");
|
|
20501
|
+
return;
|
|
20502
|
+
}
|
|
20503
|
+
const caption = String(label2(outer));
|
|
20504
|
+
append(
|
|
20505
|
+
[`${caption} Total`, ...compact ? [] : [null]],
|
|
20506
|
+
numbers3([key], groups.get(key) ?? []),
|
|
20507
|
+
{ indices: [outerIndex], type: "default" }
|
|
20508
|
+
);
|
|
20509
|
+
}
|
|
20510
|
+
});
|
|
20511
|
+
if (rowsAxis) appendMeasures([], [], pivot.records, [0], "grand");
|
|
20512
|
+
else
|
|
20513
|
+
append(["Grand Total", ...compact ? [] : [null]], numbers3([], pivot.records), {
|
|
20514
|
+
indices: [0],
|
|
20515
|
+
type: "grand"
|
|
20516
|
+
});
|
|
20182
20517
|
return {
|
|
20183
20518
|
values: values2,
|
|
20184
20519
|
rowItems,
|
|
20185
20520
|
secondRowItems,
|
|
20186
20521
|
columnItems,
|
|
20187
20522
|
rowEntries,
|
|
20188
|
-
firstDataRow
|
|
20523
|
+
firstDataRow,
|
|
20189
20524
|
rowLabelColumns,
|
|
20190
|
-
indents
|
|
20525
|
+
indents,
|
|
20526
|
+
...rowsAxis ? { firstHeaderRow: 1 } : {}
|
|
20191
20527
|
};
|
|
20192
20528
|
}
|
|
20193
20529
|
var label2;
|
|
20194
20530
|
var init_hierarchy2 = __esm({
|
|
20195
20531
|
"xlsx/pivot/hierarchy.ts"() {
|
|
20196
20532
|
init_data();
|
|
20533
|
+
init_hierarchy_first();
|
|
20534
|
+
init_measures();
|
|
20197
20535
|
label2 = pivotItemLabel;
|
|
20198
20536
|
}
|
|
20199
20537
|
});
|
|
20200
20538
|
|
|
20201
20539
|
// xlsx/pivot/aggregate.ts
|
|
20202
|
-
function aggregate2(records, field, type) {
|
|
20203
|
-
if (!records.length) return null;
|
|
20204
|
-
const values2 = records.map((record) => record[field] ?? null);
|
|
20205
|
-
if (type === "count") return values2.filter((value) => value !== null && value !== "").length;
|
|
20206
|
-
const error = values2.find(isCellError);
|
|
20207
|
-
if (error) return error;
|
|
20208
|
-
const numbers3 = values2.filter((value) => typeof value === "number");
|
|
20209
|
-
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
20210
|
-
if (type === "min") return numbers3.reduce((a2, b) => Math.min(a2, b));
|
|
20211
|
-
if (type === "max") return numbers3.reduce((a2, b) => Math.max(a2, b));
|
|
20212
|
-
const sum2 = numbers3.reduce((total2, value) => total2 + value, 0);
|
|
20213
|
-
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
20214
|
-
}
|
|
20215
20540
|
function pivotGrid(pivot) {
|
|
20216
20541
|
validatePivotFields(pivot);
|
|
20217
|
-
|
|
20542
|
+
return prependPivotPage(pivotDataGrid(pivotPageProjection(pivot)), pivot);
|
|
20543
|
+
}
|
|
20544
|
+
function pivotDataGrid(pivot) {
|
|
20545
|
+
if (pivot.secondRowField) return hierarchicalPivotGrid(pivot);
|
|
20218
20546
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
20219
20547
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
20220
|
-
|
|
20548
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
20549
|
+
const compact = pivot.layout === "compact";
|
|
20550
|
+
const headings = rowsAxis && pivot.layout !== void 0 && pivot.layout !== "tabular";
|
|
20551
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowsAxis && !compact ? 2 : 1);
|
|
20552
|
+
const dataRows = (rowItems.length + 1) * (rowsAxis ? 1 + (pivot.additionalValues?.length ?? 0) : 1) + (headings ? rowItems.length : 0);
|
|
20553
|
+
if ((dataRows + dimensions.rows) * dimensions.width > 1e6)
|
|
20221
20554
|
throw new Error("The PivotTable result is too large.");
|
|
20555
|
+
const label3 = pivotItemLabel;
|
|
20556
|
+
const values2 = pivotHeaders(
|
|
20557
|
+
pivot,
|
|
20558
|
+
columnItems,
|
|
20559
|
+
[pivot.layout === "compact" ? "Row Labels" : pivot.rowField],
|
|
20560
|
+
label3
|
|
20561
|
+
);
|
|
20222
20562
|
const rowField = pivot.fields.indexOf(pivot.rowField);
|
|
20223
20563
|
const colField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
20224
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
20225
20564
|
const groups = /* @__PURE__ */ new Map();
|
|
20226
20565
|
const cells2 = /* @__PURE__ */ new Map();
|
|
20227
20566
|
const columns = /* @__PURE__ */ new Map();
|
|
@@ -20239,48 +20578,130 @@ function pivotGrid(pivot) {
|
|
|
20239
20578
|
collect(cells2, JSON.stringify([key, col]), record);
|
|
20240
20579
|
}
|
|
20241
20580
|
}
|
|
20242
|
-
const
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
20249
|
-
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
20581
|
+
const firstDataRow = values2.length;
|
|
20582
|
+
if (rowsAxis) {
|
|
20583
|
+
const measures = pivotMeasures(pivot);
|
|
20584
|
+
const rowEntries = [];
|
|
20585
|
+
const indents = values2.map(() => 0);
|
|
20586
|
+
const append = (caption, bands, index2, grand = false) => {
|
|
20587
|
+
measures.forEach((measure, m) => {
|
|
20588
|
+
values2.push([
|
|
20589
|
+
...compact ? [grand ? `Total ${measure.caption}` : measure.caption] : [
|
|
20590
|
+
grand ? `Total ${measure.caption}` : pivot.repeatLabels || !headings && m === 0 ? caption : null,
|
|
20591
|
+
grand ? null : measure.caption
|
|
20592
|
+
],
|
|
20593
|
+
...bands.map((band) => band[m] ?? null)
|
|
20594
|
+
]);
|
|
20595
|
+
indents.push(compact && !grand ? 1 : 0);
|
|
20596
|
+
rowEntries.push({
|
|
20597
|
+
indices: grand ? [0] : [index2, m],
|
|
20598
|
+
measure: m,
|
|
20599
|
+
...grand ? { type: "grand" } : {}
|
|
20600
|
+
});
|
|
20601
|
+
});
|
|
20602
|
+
};
|
|
20603
|
+
rowItems.forEach((item, index2) => {
|
|
20604
|
+
const key = pivotValueKey(item);
|
|
20605
|
+
if (headings) {
|
|
20606
|
+
values2.push([label3(item), ...Array(dimensions.width - 1).fill(null)]);
|
|
20607
|
+
rowEntries.push({ indices: [index2] });
|
|
20608
|
+
indents.push(0);
|
|
20609
|
+
}
|
|
20610
|
+
append(
|
|
20611
|
+
label3(item),
|
|
20612
|
+
[
|
|
20613
|
+
...columnItems.map(
|
|
20614
|
+
(col) => pivotNumbers(pivot, cells2.get(JSON.stringify([key, pivotValueKey(col)])) ?? [])
|
|
20615
|
+
),
|
|
20616
|
+
pivotNumbers(pivot, groups.get(key) ?? [])
|
|
20617
|
+
],
|
|
20618
|
+
index2
|
|
20619
|
+
);
|
|
20620
|
+
});
|
|
20621
|
+
append(
|
|
20622
|
+
"Grand Total",
|
|
20623
|
+
[
|
|
20624
|
+
...columnItems.map((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
20625
|
+
pivotNumbers(pivot, pivot.records)
|
|
20626
|
+
],
|
|
20627
|
+
0,
|
|
20628
|
+
true
|
|
20629
|
+
);
|
|
20630
|
+
return {
|
|
20631
|
+
values: values2,
|
|
20632
|
+
rowItems,
|
|
20633
|
+
columnItems,
|
|
20634
|
+
firstDataRow,
|
|
20635
|
+
rowLabelColumns: compact ? 1 : 2,
|
|
20636
|
+
indents,
|
|
20637
|
+
firstHeaderRow: 1,
|
|
20638
|
+
rowEntries
|
|
20639
|
+
};
|
|
20640
|
+
}
|
|
20256
20641
|
for (const row2 of rowItems) {
|
|
20257
20642
|
const records = groups.get(pivotValueKey(row2)) ?? [];
|
|
20258
20643
|
values2.push([
|
|
20259
20644
|
label3(row2),
|
|
20260
|
-
...columnItems.
|
|
20261
|
-
(col) =>
|
|
20262
|
-
|
|
20263
|
-
|
|
20264
|
-
pivot.aggregate
|
|
20645
|
+
...columnItems.flatMap(
|
|
20646
|
+
(col) => pivotNumbers(
|
|
20647
|
+
pivot,
|
|
20648
|
+
cells2.get(JSON.stringify([pivotValueKey(row2), pivotValueKey(col)])) ?? []
|
|
20265
20649
|
)
|
|
20266
20650
|
),
|
|
20267
|
-
|
|
20651
|
+
...pivotNumbers(pivot, records)
|
|
20268
20652
|
]);
|
|
20269
20653
|
}
|
|
20270
20654
|
values2.push([
|
|
20271
20655
|
"Grand Total",
|
|
20272
|
-
...columnItems.
|
|
20273
|
-
|
|
20274
|
-
),
|
|
20275
|
-
aggregate2(pivot.records, valueField, pivot.aggregate)
|
|
20656
|
+
...columnItems.flatMap((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
20657
|
+
...pivotNumbers(pivot, pivot.records)
|
|
20276
20658
|
]);
|
|
20277
|
-
return { values: values2, rowItems, columnItems, firstDataRow
|
|
20659
|
+
return { values: values2, rowItems, columnItems, firstDataRow };
|
|
20278
20660
|
}
|
|
20279
20661
|
var init_aggregate = __esm({
|
|
20280
20662
|
"xlsx/pivot/aggregate.ts"() {
|
|
20281
|
-
init_model();
|
|
20282
20663
|
init_data();
|
|
20664
|
+
init_page_filter();
|
|
20283
20665
|
init_hierarchy2();
|
|
20666
|
+
init_measures();
|
|
20667
|
+
}
|
|
20668
|
+
});
|
|
20669
|
+
|
|
20670
|
+
// xlsx/pivot/values-axis.ts
|
|
20671
|
+
function remapPivotRowEntries(entries, axes2) {
|
|
20672
|
+
return entries.map(
|
|
20673
|
+
(entry3) => entry3.type === "grand" ? entry3 : {
|
|
20674
|
+
...entry3,
|
|
20675
|
+
indices: entry3.indices.map((item, axis) => {
|
|
20676
|
+
const index2 = axes2[axis]?.[item];
|
|
20677
|
+
if (index2 === void 0) throw new Error("Invalid report row axis item");
|
|
20678
|
+
return index2;
|
|
20679
|
+
})
|
|
20680
|
+
}
|
|
20681
|
+
);
|
|
20682
|
+
}
|
|
20683
|
+
function pivotValueAxisItems(measures, columns, columnIndices) {
|
|
20684
|
+
const entries = [];
|
|
20685
|
+
if (columns === void 0) {
|
|
20686
|
+
for (let measure = 0; measure < measures; measure++)
|
|
20687
|
+
entries.push(
|
|
20688
|
+
`<i${attrs({ i: measure || void 0 })}><x${attrs({ v: measure || void 0 })}/></i>`
|
|
20689
|
+
);
|
|
20690
|
+
} else {
|
|
20691
|
+
for (let column = 0; column < columns; column++)
|
|
20692
|
+
for (let measure = 0; measure < measures; measure++) {
|
|
20693
|
+
entries.push(
|
|
20694
|
+
`<i${attrs({ r: measure ? 1 : void 0, i: measure || void 0 })}>${measure ? "" : `<x${attrs({ v: (columnIndices?.[column] ?? column) || void 0 })}/>`}<x${attrs({ v: measure || void 0 })}/></i>`
|
|
20695
|
+
);
|
|
20696
|
+
}
|
|
20697
|
+
for (let measure = 0; measure < measures; measure++)
|
|
20698
|
+
entries.push(`<i${attrs({ t: "grand", i: measure || void 0 })}><x/></i>`);
|
|
20699
|
+
}
|
|
20700
|
+
return `<colItems count="${entries.length}">${entries.join("")}</colItems>`;
|
|
20701
|
+
}
|
|
20702
|
+
var init_values_axis = __esm({
|
|
20703
|
+
"xlsx/pivot/values-axis.ts"() {
|
|
20704
|
+
init_xml_out();
|
|
20284
20705
|
}
|
|
20285
20706
|
});
|
|
20286
20707
|
|
|
@@ -20289,45 +20710,87 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20289
20710
|
const grid = pivotGrid(pivot);
|
|
20290
20711
|
const row2 = pivot.fields.indexOf(pivot.rowField);
|
|
20291
20712
|
const second = pivot.secondRowField ? pivot.fields.indexOf(pivot.secondRowField) : -1;
|
|
20713
|
+
const page = pivot.pageFilter ? pivot.fields.indexOf(pivot.pageFilter.field) : -1;
|
|
20714
|
+
const pageItems = page >= 0 ? pivotItems(pivot, pivot.pageFilter.field) : [];
|
|
20715
|
+
const axisItems = (field, visible) => page >= 0 ? pivotItems(pivot, field) : visible;
|
|
20716
|
+
const rowItemsFull = axisItems(pivot.rowField, grid.rowItems);
|
|
20717
|
+
const secondRowItemsFull = pivot.secondRowField ? axisItems(pivot.secondRowField, grid.secondRowItems) : [];
|
|
20718
|
+
const columnItemsFull = pivot.columnField ? axisItems(pivot.columnField, grid.columnItems) : [];
|
|
20719
|
+
const itemIndices = (visible, full) => {
|
|
20720
|
+
const indices = new Map(full.map((item, index2) => [pivotValueKey(item), index2]));
|
|
20721
|
+
return visible.map((v) => indices.get(pivotValueKey(v)));
|
|
20722
|
+
};
|
|
20723
|
+
const rowIndicesFull = itemIndices(grid.rowItems, rowItemsFull), secondRowIndicesFull = itemIndices(grid.secondRowItems ?? [], secondRowItemsFull), columnIndicesFull = itemIndices(grid.columnItems, columnItemsFull);
|
|
20724
|
+
const rowEntries = page >= 0 && grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, [rowIndicesFull, secondRowIndicesFull]) : grid.rowEntries;
|
|
20725
|
+
const pageOffset = page >= 0 ? 2 : 0;
|
|
20292
20726
|
const col = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
20293
|
-
const
|
|
20727
|
+
const measures = pivotMeasures(pivot);
|
|
20728
|
+
const multiple = measures.length > 1;
|
|
20729
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
20294
20730
|
const compact = pivot.layout === "compact";
|
|
20295
20731
|
const outline = pivot.layout === "compact" || pivot.layout === "outline";
|
|
20296
20732
|
const top = (pivot.subtotalPosition ?? (outline ? "top" : "bottom")) === "top";
|
|
20297
20733
|
const fields = pivot.fields.map((_field, index2) => {
|
|
20298
|
-
const items2 = index2 === row2 ?
|
|
20734
|
+
const items2 = index2 === page ? pageItems : index2 === row2 ? rowItemsFull : index2 === second ? secondRowItemsFull : index2 === col ? columnItemsFull : void 0;
|
|
20299
20735
|
const subtotal = !(index2 === row2 && pivot.subtotals === false);
|
|
20300
20736
|
const repeated = pivot.repeatLabels && (index2 === row2 || index2 === second) ? '<extLst><ext uri="{2946ED86-A175-432a-8AC1-64E0C546D7DE}"><x14:pivotField xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" fillDownLabels="1"/></ext></extLst>' : "";
|
|
20301
|
-
return `<pivotField${attrs({ axis: index2 === row2 || index2 === second ? "axisRow" : index2 === col ? "axisCol" : void 0, dataField:
|
|
20737
|
+
return `<pivotField${attrs({ axis: index2 === page ? "axisPage" : index2 === row2 || index2 === second ? "axisRow" : index2 === col ? "axisCol" : void 0, dataField: measures.some((measure) => pivot.fields.indexOf(measure.field) === index2) ? true : void 0, compact, outline, showAll: false, subtotalTop: index2 === row2 ? top : void 0, defaultSubtotal: subtotal ? void 0 : false })}>${items2 ? `<items count="${items2.length + Number(subtotal)}">${items2.map((item) => `<item x="${cache2.indices[index2].get(pivotValueKey(item))}"/>`).join("")}${subtotal ? '<item t="default"/>' : ""}</items>` : ""}${repeated}</pivotField>`;
|
|
20302
20738
|
}).join("");
|
|
20303
|
-
const items = (count2) => Array.from({ length: count2 }, (_v, i) => `<i><x v="${i}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
20304
|
-
const header = grid.firstDataRow - 1;
|
|
20305
|
-
const rowIndices = [row2, ...second >= 0 ? [second] : []];
|
|
20739
|
+
const items = (count2, indices) => Array.from({ length: count2 }, (_v, i) => `<i><x v="${indices?.[i] ?? i}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
20740
|
+
const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : multiple && col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
|
|
20741
|
+
const rowIndices = rowsAxis && pivot.valuesPosition === "first" ? [-2, row2, second] : rowsAxis && pivot.valuesPosition === "between" ? [row2, -2, second] : [row2, ...second >= 0 ? [second] : [], ...rowsAxis ? [-2] : []];
|
|
20306
20742
|
let previous = [];
|
|
20307
|
-
const rowItems =
|
|
20743
|
+
const rowItems = rowEntries?.map((entry3) => {
|
|
20308
20744
|
let prefix = 0;
|
|
20309
|
-
if (
|
|
20745
|
+
if (entry3.type === "default" && rowsAxis && pivot.valuesPosition === "first") prefix = 1;
|
|
20746
|
+
else if (!entry3.type)
|
|
20310
20747
|
while (prefix < entry3.indices.length - 1 && entry3.indices[prefix] === previous[prefix])
|
|
20311
20748
|
prefix++;
|
|
20312
|
-
previous = entry3.type ? [] : entry3.indices;
|
|
20313
|
-
return `<i${attrs({ t: entry3.type, r: prefix || void 0 })}>${entry3.indices.slice(prefix).map((index2) => `<x${attrs({ v: index2 || void 0 })}/>`).join("")}</i>`;
|
|
20314
|
-
}).join("") ?? items(grid.rowItems.length);
|
|
20315
|
-
let body = `<location${attrs({ ref: formatRange(pivot.location), firstHeaderRow: header, firstDataRow: grid.firstDataRow, firstDataCol: grid.rowLabelColumns ?? 1 })}/><pivotFields count="${pivot.fields.length}">${fields}</pivotFields><rowFields count="${rowIndices.length}">${rowIndices.map((index2) => `<field x="${index2}"/>`).join("")}</rowFields><rowItems count="${grid.rowEntries?.length ?? grid.rowItems.length + 1}">${rowItems}</rowItems>`;
|
|
20316
|
-
if (
|
|
20317
|
-
body += `<colFields count="1"
|
|
20318
|
-
else
|
|
20319
|
-
|
|
20749
|
+
previous = entry3.type && !(entry3.type === "default" && pivot.valuesPosition === "first") ? [] : entry3.indices;
|
|
20750
|
+
return `<i${attrs({ t: entry3.type, r: prefix || void 0, i: entry3.measure || void 0 })}>${entry3.indices.slice(prefix).map((index2) => `<x${attrs({ v: index2 || void 0 })}/>`).join("")}</i>`;
|
|
20751
|
+
}).join("") ?? items(grid.rowItems.length, rowIndicesFull);
|
|
20752
|
+
let body = `<location${attrs({ ref: formatRange({ ...pivot.location, start: { ...pivot.location.start, row: pivot.location.start.row + pageOffset } }), firstHeaderRow: header, firstDataRow: grid.firstDataRow - pageOffset, rowPageCount: page >= 0 ? 1 : void 0, colPageCount: page >= 0 ? 1 : void 0, firstDataCol: grid.rowLabelColumns ?? 1 })}/><pivotFields count="${pivot.fields.length}">${fields}</pivotFields><rowFields count="${rowIndices.length}">${rowIndices.map((index2) => `<field x="${index2}"/>`).join("")}</rowFields><rowItems count="${grid.rowEntries?.length ?? grid.rowItems.length + 1}">${rowItems}</rowItems>`;
|
|
20753
|
+
if (multiple && !rowsAxis)
|
|
20754
|
+
body += `<colFields count="${col >= 0 ? 2 : 1}">${col >= 0 ? `<field x="${col}"/>` : ""}<field x="-2"/></colFields>${pivotValueAxisItems(measures.length, col >= 0 ? grid.columnItems.length : void 0, columnIndicesFull)}`;
|
|
20755
|
+
else if (col >= 0)
|
|
20756
|
+
body += `<colFields count="1"><field x="${col}"/></colFields><colItems count="${grid.columnItems.length + 1}">${items(grid.columnItems.length, columnIndicesFull)}</colItems>`;
|
|
20757
|
+
else
|
|
20758
|
+
body += rowsAxis ? '<colItems count="1"><i/></colItems>' : page >= 0 ? '<colItems count="1"><i/></colItems>' : '<colItems count="1"><i><x/></i></colItems>';
|
|
20759
|
+
if (page >= 0)
|
|
20760
|
+
body += `<pageFields count="1"><pageField${attrs({ fld: page, hier: -1, item: pivot.pageFilter.item !== void 0 ? pageItems.findIndex((item) => pivotValueKey(item) === pivotValueKey(pivot.pageFilter.item)) : void 0 })}/></pageFields>`;
|
|
20761
|
+
body += `<dataFields count="${measures.length}">${measures.map((measure) => `<dataField${attrs({ name: encodeEscapes(measure.caption), fld: pivot.fields.indexOf(measure.field), subtotal: measure.aggregate, baseField: 0, baseItem: 0 })}/>`).join("")}</dataFields>`;
|
|
20320
20762
|
const doc = parseXml(
|
|
20321
20763
|
pivot.sourceXml ?? `<pivotTableDefinition xmlns="${NS.x}" dataCaption="Values" updatedVersion="6" minRefreshableVersion="3" createdVersion="6"><pivotTableStyleInfo name="PivotStyleLight16" showRowHeaders="1" showColHeaders="1" showRowStripes="0" showColStripes="0" showLastColumn="1"/></pivotTableDefinition>`
|
|
20322
20764
|
);
|
|
20323
20765
|
const root = doc.documentElement;
|
|
20324
20766
|
root.setAttribute("name", pivot.name);
|
|
20325
20767
|
root.setAttribute("cacheId", String(cacheId));
|
|
20768
|
+
root.setAttribute("dataOnRows", rowsAxis ? "1" : "0");
|
|
20769
|
+
if (rowsAxis && (pivot.valuesPosition === "between" || pivot.valuesPosition === "first"))
|
|
20770
|
+
root.setAttribute("dataPosition", pivot.valuesPosition === "first" ? "0" : "1");
|
|
20771
|
+
else root.removeAttribute("dataPosition");
|
|
20326
20772
|
root.setAttribute("compact", compact ? "1" : "0");
|
|
20327
20773
|
root.setAttribute("compactData", compact ? "1" : "0");
|
|
20328
20774
|
root.setAttribute("outline", outline ? "1" : "0");
|
|
20329
20775
|
root.setAttribute("outlineData", outline ? "1" : "0");
|
|
20330
20776
|
if (compact) root.setAttribute("indent", "0");
|
|
20777
|
+
if (multiple && !elements(first(root, "extLst", NS.x) ?? parseXml("<root/>").documentElement).some(
|
|
20778
|
+
(extension) => first(
|
|
20779
|
+
extension,
|
|
20780
|
+
"pivotTableDefinition",
|
|
20781
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
20782
|
+
)
|
|
20783
|
+
)) {
|
|
20784
|
+
let list = first(root, "extLst", NS.x);
|
|
20785
|
+
if (!list) {
|
|
20786
|
+
list = doc.createElementNS(NS.x, "extLst");
|
|
20787
|
+
root.appendChild(list);
|
|
20788
|
+
}
|
|
20789
|
+
const extension = parseXml(
|
|
20790
|
+
`<ext xmlns="${NS.x}" uri="{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}"><x14:pivotTableDefinition xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" hideValuesRow="1"/></ext>`
|
|
20791
|
+
).documentElement;
|
|
20792
|
+
list.appendChild(doc.importNode(extension, true));
|
|
20793
|
+
}
|
|
20331
20794
|
root.setAttribute("rowGrandTotals", "1");
|
|
20332
20795
|
root.setAttribute("colGrandTotals", "1");
|
|
20333
20796
|
for (const extension of elements(
|
|
@@ -20338,6 +20801,7 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20338
20801
|
"pivotTableDefinition",
|
|
20339
20802
|
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
20340
20803
|
);
|
|
20804
|
+
if (multiple && definition) definition.setAttribute("hideValuesRow", "1");
|
|
20341
20805
|
if (definition?.hasAttribute("fillDownLabelsDefault"))
|
|
20342
20806
|
definition.setAttribute("fillDownLabelsDefault", pivot.repeatLabels ? "1" : "0");
|
|
20343
20807
|
}
|
|
@@ -20348,7 +20812,8 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20348
20812
|
"rowItems",
|
|
20349
20813
|
"colFields",
|
|
20350
20814
|
"colItems",
|
|
20351
|
-
"dataFields"
|
|
20815
|
+
"dataFields",
|
|
20816
|
+
"pageFields"
|
|
20352
20817
|
]);
|
|
20353
20818
|
for (const child3 of elements(root)) if (replaced.has(child3.localName)) root.removeChild(child3);
|
|
20354
20819
|
const replacement = parseXml(`<root xmlns="${NS.x}">${body}</root>`).documentElement;
|
|
@@ -20359,10 +20824,13 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20359
20824
|
var init_table_xml = __esm({
|
|
20360
20825
|
"xlsx/pivot/table-xml.ts"() {
|
|
20361
20826
|
init_xml2();
|
|
20827
|
+
init_data();
|
|
20362
20828
|
init_address();
|
|
20363
20829
|
init_xml_out();
|
|
20364
20830
|
init_aggregate();
|
|
20365
20831
|
init_data();
|
|
20832
|
+
init_measures();
|
|
20833
|
+
init_values_axis();
|
|
20366
20834
|
}
|
|
20367
20835
|
});
|
|
20368
20836
|
|