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.mjs
CHANGED
|
@@ -4954,7 +4954,7 @@ var init_ast = __esm({
|
|
|
4954
4954
|
});
|
|
4955
4955
|
|
|
4956
4956
|
// xlsx/model.ts
|
|
4957
|
-
var ERROR_CODES, isCellError;
|
|
4957
|
+
var ERROR_CODES, isErrorCode, isCellError;
|
|
4958
4958
|
var init_model = __esm({
|
|
4959
4959
|
"xlsx/model.ts"() {
|
|
4960
4960
|
ERROR_CODES = [
|
|
@@ -4969,6 +4969,7 @@ var init_model = __esm({
|
|
|
4969
4969
|
"#SPILL!",
|
|
4970
4970
|
"#CALC!"
|
|
4971
4971
|
];
|
|
4972
|
+
isErrorCode = (value) => ERROR_CODES.includes(value);
|
|
4972
4973
|
isCellError = (value) => typeof value === "object" && value !== null && "error" in value;
|
|
4973
4974
|
}
|
|
4974
4975
|
});
|
|
@@ -19949,6 +19950,66 @@ var init_sparkline_ranges = __esm({
|
|
|
19949
19950
|
}
|
|
19950
19951
|
});
|
|
19951
19952
|
|
|
19953
|
+
// xlsx/pivot/page-filter.ts
|
|
19954
|
+
function validatePivotPageFilter(pivot) {
|
|
19955
|
+
const filter2 = pivot.pageFilter;
|
|
19956
|
+
const extras = Array.isArray(pivot.additionalValues) ? pivot.additionalValues : [];
|
|
19957
|
+
if (filter2 === void 0) return;
|
|
19958
|
+
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) || [
|
|
19959
|
+
pivot.rowField,
|
|
19960
|
+
pivot.secondRowField,
|
|
19961
|
+
pivot.columnField,
|
|
19962
|
+
pivot.valueField,
|
|
19963
|
+
...extras.map((v) => v?.field)
|
|
19964
|
+
].includes(filter2.field) || pivot.valuesAxis === "rows")
|
|
19965
|
+
throw new Error("Report filters require Values on columns and a separate source field.");
|
|
19966
|
+
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))
|
|
19967
|
+
throw new Error("Choose a cached literal report filter item.");
|
|
19968
|
+
}
|
|
19969
|
+
function pivotPageProjection(pivot) {
|
|
19970
|
+
const filter2 = pivot.pageFilter;
|
|
19971
|
+
if (!filter2) return pivot;
|
|
19972
|
+
const labels = /* @__PURE__ */ new Map();
|
|
19973
|
+
for (const item of pivotItems(pivot, filter2.field)) {
|
|
19974
|
+
const label3 = String(pivotItemLabel(item)).toLowerCase(), key2 = pivotValueKey(item);
|
|
19975
|
+
if (label3 === "(all)" || labels.has(label3) && labels.get(label3) !== key2)
|
|
19976
|
+
throw new Error("Ambiguous report filter item captions are preserved.");
|
|
19977
|
+
labels.set(label3, key2);
|
|
19978
|
+
}
|
|
19979
|
+
if (filter2.item === void 0) return pivot;
|
|
19980
|
+
const index2 = pivot.fields.indexOf(filter2.field), key = pivotValueKey(filter2.item);
|
|
19981
|
+
const records = pivot.records.filter((record) => pivotValueKey(record[index2] ?? null) === key);
|
|
19982
|
+
if (!records.length) throw new Error("The report filter item is missing from the source.");
|
|
19983
|
+
if (JSON.stringify(records[0][index2] ?? null) !== JSON.stringify(filter2.item))
|
|
19984
|
+
throw new Error("Choose an exact cached literal report filter item.");
|
|
19985
|
+
return { ...pivot, records };
|
|
19986
|
+
}
|
|
19987
|
+
function prependPivotPage(grid, pivot) {
|
|
19988
|
+
if (!pivot.pageFilter) return grid;
|
|
19989
|
+
const width = grid.values[0].length;
|
|
19990
|
+
return {
|
|
19991
|
+
...grid,
|
|
19992
|
+
values: [
|
|
19993
|
+
[
|
|
19994
|
+
pivot.pageFilter.field,
|
|
19995
|
+
pivot.pageFilter.item === void 0 ? "(All)" : pivotItemLabel(pivot.pageFilter.item),
|
|
19996
|
+
...Array(width - 2).fill(null)
|
|
19997
|
+
],
|
|
19998
|
+
Array(width).fill(null),
|
|
19999
|
+
...grid.values
|
|
20000
|
+
],
|
|
20001
|
+
firstDataRow: grid.firstDataRow + 2,
|
|
20002
|
+
...grid.firstHeaderRow !== void 0 ? { firstHeaderRow: grid.firstHeaderRow + 2 } : {},
|
|
20003
|
+
...grid.indents ? { indents: [0, 0, ...grid.indents] } : {}
|
|
20004
|
+
};
|
|
20005
|
+
}
|
|
20006
|
+
var init_page_filter = __esm({
|
|
20007
|
+
"xlsx/pivot/page-filter.ts"() {
|
|
20008
|
+
init_model();
|
|
20009
|
+
init_data();
|
|
20010
|
+
}
|
|
20011
|
+
});
|
|
20012
|
+
|
|
19952
20013
|
// xlsx/pivot/data.ts
|
|
19953
20014
|
function pivotValueKey(value) {
|
|
19954
20015
|
return value === null || value === "" ? "blank" : isCellError(value) ? `error:${value.error}` : `${typeof value}:${String(value).toLowerCase()}`;
|
|
@@ -19975,12 +20036,32 @@ function pivotItemLabel(value) {
|
|
|
19975
20036
|
return isCellError(value) ? value.error : value;
|
|
19976
20037
|
}
|
|
19977
20038
|
function validatePivotFields(pivot) {
|
|
20039
|
+
validatePivotPageFilter(pivot);
|
|
19978
20040
|
const used = [
|
|
19979
20041
|
pivot.rowField,
|
|
19980
20042
|
...pivot.secondRowField ? [pivot.secondRowField] : [],
|
|
19981
20043
|
...pivot.columnField ? [pivot.columnField] : [],
|
|
19982
20044
|
pivot.valueField
|
|
19983
20045
|
];
|
|
20046
|
+
const extras = pivot.additionalValues ?? [];
|
|
20047
|
+
if (pivot.valuesAxis !== void 0 && !["columns", "rows"].includes(pivot.valuesAxis))
|
|
20048
|
+
throw new Error("Choose a valid Values axis.");
|
|
20049
|
+
if (pivot.valuesPosition !== void 0 && !["last", "between", "first"].includes(pivot.valuesPosition))
|
|
20050
|
+
throw new Error("Choose a valid Values position.");
|
|
20051
|
+
if ((pivot.valuesPosition === "between" || pivot.valuesPosition === "first") && (pivot.valuesAxis !== "rows" || !pivot.secondRowField))
|
|
20052
|
+
throw new Error("Values before or between fields require two row fields and Values on rows.");
|
|
20053
|
+
if (pivot.valuesAxis === "rows" && (!Array.isArray(extras) || !extras.length))
|
|
20054
|
+
throw new Error("Values on rows require multiple measures.");
|
|
20055
|
+
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== "Values")
|
|
20056
|
+
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
20057
|
+
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
20058
|
+
(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())
|
|
20059
|
+
) || new Set(
|
|
20060
|
+
[pivot.valueCaption, ...extras.map((measure) => measure.caption)].map(
|
|
20061
|
+
(caption) => caption?.toLowerCase()
|
|
20062
|
+
)
|
|
20063
|
+
).size !== extras.length + 1)
|
|
20064
|
+
throw new Error("Choose PivotTable value fields with valid aggregates and unique captions.");
|
|
19984
20065
|
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")
|
|
19985
20066
|
throw new Error("Choose valid PivotTable fields; row and column fields must differ.");
|
|
19986
20067
|
}
|
|
@@ -19988,6 +20069,8 @@ var PIVOT_AGGREGATES;
|
|
|
19988
20069
|
var init_data = __esm({
|
|
19989
20070
|
"xlsx/pivot/data.ts"() {
|
|
19990
20071
|
init_model();
|
|
20072
|
+
init_xml2();
|
|
20073
|
+
init_page_filter();
|
|
19991
20074
|
PIVOT_AGGREGATES = ["sum", "count", "average", "min", "max"];
|
|
19992
20075
|
}
|
|
19993
20076
|
});
|
|
@@ -20045,20 +20128,186 @@ var init_cache_xml = __esm({
|
|
|
20045
20128
|
}
|
|
20046
20129
|
});
|
|
20047
20130
|
|
|
20131
|
+
// xlsx/pivot/measures.ts
|
|
20132
|
+
function aggregate2(records, field, type) {
|
|
20133
|
+
if (!records.length) return null;
|
|
20134
|
+
const values2 = records.map((record) => record[field] ?? null);
|
|
20135
|
+
if (type === "count") return values2.filter((value) => value !== null && value !== "").length;
|
|
20136
|
+
const error = values2.find(isCellError);
|
|
20137
|
+
if (error) return error;
|
|
20138
|
+
const numbers3 = values2.filter((value) => typeof value === "number");
|
|
20139
|
+
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
20140
|
+
if (type === "min") return numbers3.reduce((a2, b) => Math.min(a2, b));
|
|
20141
|
+
if (type === "max") return numbers3.reduce((a2, b) => Math.max(a2, b));
|
|
20142
|
+
const sum2 = numbers3.reduce((total2, value) => total2 + value, 0);
|
|
20143
|
+
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
20144
|
+
}
|
|
20145
|
+
function pivotHeaderDimensions(pivot, columnItems, rowLabels) {
|
|
20146
|
+
const measures = 1 + (pivot.additionalValues?.length ?? 0);
|
|
20147
|
+
if (pivot.valuesAxis === "rows")
|
|
20148
|
+
return {
|
|
20149
|
+
rows: (pivot.columnField ? 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
20150
|
+
width: rowLabels + (pivot.columnField ? columnItems + 1 : 1)
|
|
20151
|
+
};
|
|
20152
|
+
return {
|
|
20153
|
+
rows: (pivot.columnField ? measures > 1 ? 3 : 2 : 1) + (pivot.pageFilter ? 2 : 0),
|
|
20154
|
+
width: rowLabels + (pivot.columnField ? measures === 1 ? Math.max(1, columnItems) + 1 : (columnItems + 1) * measures : measures)
|
|
20155
|
+
};
|
|
20156
|
+
}
|
|
20157
|
+
function pivotHeaders(pivot, columns, labels, label3) {
|
|
20158
|
+
const measures = pivotMeasures(pivot);
|
|
20159
|
+
if (pivot.valuesAxis === "rows") {
|
|
20160
|
+
const rowLabels = pivot.layout === "compact" ? ["Row Labels"] : pivot.valuesPosition === "first" ? ["Values", ...labels] : pivot.valuesPosition === "between" ? [labels[0], "Values", labels[1]] : [...labels, "Values"];
|
|
20161
|
+
return pivot.columnField ? [
|
|
20162
|
+
[
|
|
20163
|
+
...rowLabels.map(() => null),
|
|
20164
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
20165
|
+
...columns.map(() => null)
|
|
20166
|
+
],
|
|
20167
|
+
[...rowLabels, ...columns.map(label3), "Grand Total"]
|
|
20168
|
+
] : [[...rowLabels, null]];
|
|
20169
|
+
}
|
|
20170
|
+
if (!pivot.columnField) return [[...labels, ...measures.map((measure) => measure.caption)]];
|
|
20171
|
+
if (measures.length === 1)
|
|
20172
|
+
return [
|
|
20173
|
+
[
|
|
20174
|
+
pivot.valueCaption,
|
|
20175
|
+
...labels.slice(1).map(() => null),
|
|
20176
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
20177
|
+
...columns.slice(1).map(() => null),
|
|
20178
|
+
null
|
|
20179
|
+
],
|
|
20180
|
+
[...labels, ...columns.map(label3), "Grand Total"]
|
|
20181
|
+
];
|
|
20182
|
+
const { width } = pivotHeaderDimensions(pivot, columns.length, labels.length);
|
|
20183
|
+
const first2 = Array(width).fill(null);
|
|
20184
|
+
first2[labels.length] = pivot.layout === "compact" ? "Column Labels" : pivot.columnField;
|
|
20185
|
+
if (pivot.layout !== "compact") first2[labels.length + 1] = "Values";
|
|
20186
|
+
return [
|
|
20187
|
+
first2,
|
|
20188
|
+
[
|
|
20189
|
+
...labels.map(() => null),
|
|
20190
|
+
...columns.flatMap((column) => [label3(column), ...measures.slice(1).map(() => null)]),
|
|
20191
|
+
...measures.map((measure) => `Total ${measure.caption}`)
|
|
20192
|
+
],
|
|
20193
|
+
[
|
|
20194
|
+
...labels,
|
|
20195
|
+
...columns.flatMap(() => measures.map((measure) => measure.caption)),
|
|
20196
|
+
...measures.map(() => null)
|
|
20197
|
+
]
|
|
20198
|
+
];
|
|
20199
|
+
}
|
|
20200
|
+
var pivotMeasures, pivotMeasureNumber, pivotNumbers;
|
|
20201
|
+
var init_measures = __esm({
|
|
20202
|
+
"xlsx/pivot/measures.ts"() {
|
|
20203
|
+
init_model();
|
|
20204
|
+
pivotMeasures = (pivot) => [
|
|
20205
|
+
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
20206
|
+
...pivot.additionalValues ?? []
|
|
20207
|
+
];
|
|
20208
|
+
pivotMeasureNumber = (pivot, records, measure) => aggregate2(records, pivot.fields.indexOf(measure.field), measure.aggregate);
|
|
20209
|
+
pivotNumbers = (pivot, records) => pivotMeasures(pivot).map((measure) => pivotMeasureNumber(pivot, records, measure));
|
|
20210
|
+
}
|
|
20211
|
+
});
|
|
20212
|
+
|
|
20213
|
+
// xlsx/pivot/hierarchy-first.ts
|
|
20214
|
+
function appendFirstPivotValues(pivot, context) {
|
|
20215
|
+
const {
|
|
20216
|
+
rowItems,
|
|
20217
|
+
secondRowItems,
|
|
20218
|
+
columnItems,
|
|
20219
|
+
children: children2,
|
|
20220
|
+
innerIndices,
|
|
20221
|
+
groups,
|
|
20222
|
+
details,
|
|
20223
|
+
buckets,
|
|
20224
|
+
width,
|
|
20225
|
+
rowLabels,
|
|
20226
|
+
top,
|
|
20227
|
+
bottom,
|
|
20228
|
+
append
|
|
20229
|
+
} = context;
|
|
20230
|
+
const compact = pivot.layout === "compact";
|
|
20231
|
+
const tabular = !pivot.layout || pivot.layout === "tabular";
|
|
20232
|
+
const blank = () => Array(width - rowLabels).fill(null);
|
|
20233
|
+
pivotMeasures(pivot).forEach((measure, m) => {
|
|
20234
|
+
const numbers3 = (keys, records) => [
|
|
20235
|
+
...columnItems.map(
|
|
20236
|
+
(column) => pivotMeasureNumber(
|
|
20237
|
+
pivot,
|
|
20238
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
20239
|
+
measure
|
|
20240
|
+
)
|
|
20241
|
+
),
|
|
20242
|
+
pivotMeasureNumber(pivot, records, measure)
|
|
20243
|
+
];
|
|
20244
|
+
if (!tabular)
|
|
20245
|
+
append([measure.caption, ...Array(rowLabels - 1).fill(null)], blank(), {
|
|
20246
|
+
indices: [m],
|
|
20247
|
+
measure: m
|
|
20248
|
+
});
|
|
20249
|
+
let first2 = true;
|
|
20250
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
20251
|
+
const key = pivotValueKey(outer);
|
|
20252
|
+
const group = groups.get(key) ?? [];
|
|
20253
|
+
if (!tabular)
|
|
20254
|
+
append(
|
|
20255
|
+
compact ? [pivotItemLabel(outer)] : [null, pivotItemLabel(outer), null],
|
|
20256
|
+
top ? numbers3([key], group) : blank(),
|
|
20257
|
+
{ indices: [m, outerIndex], measure: m },
|
|
20258
|
+
compact ? 1 : 0
|
|
20259
|
+
);
|
|
20260
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
20261
|
+
(a2, b) => innerIndices.get(a2) - innerIndices.get(b)
|
|
20262
|
+
);
|
|
20263
|
+
innerKeys.forEach((innerKey, child3) => {
|
|
20264
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
20265
|
+
append(
|
|
20266
|
+
compact ? [pivotItemLabel(secondRowItems[innerIndex])] : [
|
|
20267
|
+
tabular && first2 ? measure.caption : null,
|
|
20268
|
+
pivot.repeatLabels || tabular && child3 === 0 ? pivotItemLabel(outer) : null,
|
|
20269
|
+
pivotItemLabel(secondRowItems[innerIndex])
|
|
20270
|
+
],
|
|
20271
|
+
numbers3([key, innerKey], details.get(JSON.stringify([key, innerKey]))),
|
|
20272
|
+
{ indices: [m, outerIndex, innerIndex], measure: m },
|
|
20273
|
+
compact ? 2 : 0
|
|
20274
|
+
);
|
|
20275
|
+
first2 = false;
|
|
20276
|
+
});
|
|
20277
|
+
if (bottom)
|
|
20278
|
+
append(
|
|
20279
|
+
compact ? [`${String(pivotItemLabel(outer))} Total`] : [null, `${String(pivotItemLabel(outer))} Total`, null],
|
|
20280
|
+
numbers3([key], group),
|
|
20281
|
+
{ indices: [m, outerIndex], measure: m, type: "default" },
|
|
20282
|
+
compact ? 1 : 0
|
|
20283
|
+
);
|
|
20284
|
+
});
|
|
20285
|
+
});
|
|
20286
|
+
}
|
|
20287
|
+
var init_hierarchy_first = __esm({
|
|
20288
|
+
"xlsx/pivot/hierarchy-first.ts"() {
|
|
20289
|
+
init_data();
|
|
20290
|
+
init_measures();
|
|
20291
|
+
}
|
|
20292
|
+
});
|
|
20293
|
+
|
|
20048
20294
|
// xlsx/pivot/hierarchy.ts
|
|
20049
|
-
function hierarchicalPivotGrid(pivot
|
|
20295
|
+
function hierarchicalPivotGrid(pivot) {
|
|
20050
20296
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
20051
20297
|
const secondRowItems = pivotItems(pivot, pivot.secondRowField);
|
|
20052
20298
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
20053
20299
|
const outerField = pivot.fields.indexOf(pivot.rowField);
|
|
20054
20300
|
const innerField = pivot.fields.indexOf(pivot.secondRowField);
|
|
20055
20301
|
const columnField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
20056
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
20057
20302
|
const layout2 = pivot.layout ?? "tabular";
|
|
20058
20303
|
const compact = layout2 === "compact";
|
|
20059
|
-
const
|
|
20304
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
20305
|
+
const firstValues = rowsAxis && pivot.valuesPosition === "first";
|
|
20306
|
+
const between = rowsAxis && pivot.valuesPosition === "between";
|
|
20307
|
+
const measures = pivotMeasures(pivot);
|
|
20308
|
+
const top = (!rowsAxis || firstValues) && layout2 !== "tabular" && pivot.subtotals !== false && (pivot.subtotalPosition ?? "top") === "top";
|
|
20060
20309
|
const bottom = pivot.subtotals !== false && !top;
|
|
20061
|
-
const rowLabelColumns = compact ? 1 : 2;
|
|
20310
|
+
const rowLabelColumns = compact ? 1 : rowsAxis ? 3 : 2;
|
|
20062
20311
|
const groups = /* @__PURE__ */ new Map();
|
|
20063
20312
|
const details = /* @__PURE__ */ new Map();
|
|
20064
20313
|
const children2 = /* @__PURE__ */ new Map();
|
|
@@ -20082,20 +20331,12 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
20082
20331
|
collect(buckets, JSON.stringify([...key, column]), record);
|
|
20083
20332
|
}
|
|
20084
20333
|
}
|
|
20085
|
-
const
|
|
20086
|
-
|
|
20087
|
-
|
|
20334
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowLabelColumns);
|
|
20335
|
+
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;
|
|
20336
|
+
if (rows * dimensions.width > 1e6) throw new Error("The PivotTable result is too large.");
|
|
20088
20337
|
const labels = compact ? ["Row Labels"] : [pivot.rowField, pivot.secondRowField];
|
|
20089
|
-
const values2 = pivot
|
|
20090
|
-
|
|
20091
|
-
pivot.valueCaption,
|
|
20092
|
-
...compact ? [] : [null],
|
|
20093
|
-
compact ? "Column Labels" : pivot.columnField,
|
|
20094
|
-
...columnItems.slice(1).map(() => null),
|
|
20095
|
-
null
|
|
20096
|
-
],
|
|
20097
|
-
[...labels, ...columnItems.map(label2), "Grand Total"]
|
|
20098
|
-
] : [[...labels, pivot.valueCaption]];
|
|
20338
|
+
const values2 = pivotHeaders(pivot, columnItems, labels, label2);
|
|
20339
|
+
const firstDataRow = values2.length;
|
|
20099
20340
|
const indents = values2.map(() => 0);
|
|
20100
20341
|
const rowEntries = [];
|
|
20101
20342
|
const append = (labels2, numbers4, entry3, indent = 0) => {
|
|
@@ -20103,98 +20344,196 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
20103
20344
|
rowEntries.push(entry3);
|
|
20104
20345
|
indents.push(indent);
|
|
20105
20346
|
};
|
|
20106
|
-
const
|
|
20347
|
+
const bands = (keys, records) => [
|
|
20107
20348
|
...columnItems.map(
|
|
20108
|
-
(column) =>
|
|
20109
|
-
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
20110
|
-
valueField,
|
|
20111
|
-
pivot.aggregate
|
|
20112
|
-
)
|
|
20349
|
+
(column) => pivotNumbers(pivot, buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [])
|
|
20113
20350
|
),
|
|
20114
|
-
|
|
20351
|
+
pivotNumbers(pivot, records)
|
|
20115
20352
|
];
|
|
20116
|
-
|
|
20117
|
-
|
|
20118
|
-
|
|
20119
|
-
|
|
20120
|
-
|
|
20121
|
-
|
|
20122
|
-
|
|
20123
|
-
|
|
20124
|
-
|
|
20125
|
-
|
|
20126
|
-
|
|
20127
|
-
|
|
20128
|
-
|
|
20129
|
-
const records = details.get(JSON.stringify(keys));
|
|
20130
|
-
if (!records) return;
|
|
20131
|
-
append(
|
|
20132
|
-
compact ? [label2(inner)] : [
|
|
20133
|
-
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
20134
|
-
label2(inner)
|
|
20353
|
+
const numbers3 = (keys, records) => bands(keys, records).flat();
|
|
20354
|
+
const appendMeasures = (labels2, keys, records, indices, type) => {
|
|
20355
|
+
const values3 = bands(keys, records);
|
|
20356
|
+
measures.forEach(
|
|
20357
|
+
(measure, m) => append(
|
|
20358
|
+
type ? [
|
|
20359
|
+
`${type === "grand" ? "Total" : String(labels2[0])} ${measure.caption}`,
|
|
20360
|
+
...Array(rowLabelColumns - 1).fill(null)
|
|
20361
|
+
] : compact ? [measure.caption] : [
|
|
20362
|
+
...labels2.map(
|
|
20363
|
+
(label3) => layout2 === "tabular" && m === 0 || pivot.repeatLabels ? label3 : null
|
|
20364
|
+
),
|
|
20365
|
+
measure.caption
|
|
20135
20366
|
],
|
|
20136
|
-
|
|
20137
|
-
{ indices: [
|
|
20138
|
-
compact ?
|
|
20139
|
-
)
|
|
20140
|
-
|
|
20367
|
+
values3.map((band) => band[m] ?? null),
|
|
20368
|
+
{ indices: type ? indices : [...indices, m], measure: m, ...type ? { type } : {} },
|
|
20369
|
+
compact && !type ? 2 : 0
|
|
20370
|
+
)
|
|
20371
|
+
);
|
|
20372
|
+
};
|
|
20373
|
+
if (firstValues)
|
|
20374
|
+
appendFirstPivotValues(pivot, {
|
|
20375
|
+
rowItems,
|
|
20376
|
+
secondRowItems,
|
|
20377
|
+
columnItems,
|
|
20378
|
+
children: children2,
|
|
20379
|
+
innerIndices,
|
|
20380
|
+
groups,
|
|
20381
|
+
details,
|
|
20382
|
+
buckets,
|
|
20383
|
+
width: dimensions.width,
|
|
20384
|
+
rowLabels: rowLabelColumns,
|
|
20385
|
+
top,
|
|
20386
|
+
bottom,
|
|
20387
|
+
append
|
|
20141
20388
|
});
|
|
20142
|
-
|
|
20143
|
-
|
|
20144
|
-
|
|
20145
|
-
|
|
20146
|
-
|
|
20147
|
-
|
|
20389
|
+
else
|
|
20390
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
20391
|
+
const key = pivotValueKey(outer);
|
|
20392
|
+
if (layout2 !== "tabular")
|
|
20393
|
+
append(
|
|
20394
|
+
[label2(outer), ...Array(rowLabelColumns - 1).fill(null)],
|
|
20395
|
+
top ? numbers3([key], groups.get(key) ?? []) : Array(dimensions.width - rowLabelColumns).fill(null),
|
|
20396
|
+
{ indices: [outerIndex] }
|
|
20397
|
+
);
|
|
20398
|
+
let first2 = true;
|
|
20399
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
20400
|
+
(a2, b) => innerIndices.get(a2) - innerIndices.get(b)
|
|
20148
20401
|
);
|
|
20149
|
-
|
|
20150
|
-
|
|
20151
|
-
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
|
|
20402
|
+
if (between)
|
|
20403
|
+
measures.forEach((measure, m) => {
|
|
20404
|
+
if (layout2 !== "tabular")
|
|
20405
|
+
append(
|
|
20406
|
+
compact ? [measure.caption] : [pivot.repeatLabels ? label2(outer) : null, measure.caption, null],
|
|
20407
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
20408
|
+
{ indices: [outerIndex, m], measure: m },
|
|
20409
|
+
compact ? 1 : 0
|
|
20410
|
+
);
|
|
20411
|
+
innerKeys.forEach((innerKey, child3) => {
|
|
20412
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
20413
|
+
const keys = [key, innerKey];
|
|
20414
|
+
const records = details.get(JSON.stringify(keys));
|
|
20415
|
+
append(
|
|
20416
|
+
compact ? [label2(secondRowItems[innerIndex])] : [
|
|
20417
|
+
pivot.repeatLabels || layout2 === "tabular" && m === 0 && child3 === 0 ? label2(outer) : null,
|
|
20418
|
+
layout2 === "tabular" && child3 === 0 ? measure.caption : null,
|
|
20419
|
+
label2(secondRowItems[innerIndex])
|
|
20420
|
+
],
|
|
20421
|
+
[
|
|
20422
|
+
...columnItems.map(
|
|
20423
|
+
(column) => pivotMeasureNumber(
|
|
20424
|
+
pivot,
|
|
20425
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
20426
|
+
measure
|
|
20427
|
+
)
|
|
20428
|
+
),
|
|
20429
|
+
pivotMeasureNumber(pivot, records, measure)
|
|
20430
|
+
],
|
|
20431
|
+
{ indices: [outerIndex, m, innerIndex], measure: m },
|
|
20432
|
+
compact ? 2 : 0
|
|
20433
|
+
);
|
|
20434
|
+
});
|
|
20435
|
+
});
|
|
20436
|
+
else
|
|
20437
|
+
innerKeys.forEach((innerKey) => {
|
|
20438
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
20439
|
+
const inner = secondRowItems[innerIndex];
|
|
20440
|
+
const keys = [key, innerKey];
|
|
20441
|
+
const records = details.get(JSON.stringify(keys));
|
|
20442
|
+
if (!records) return;
|
|
20443
|
+
if (rowsAxis) {
|
|
20444
|
+
if (layout2 !== "tabular")
|
|
20445
|
+
append(
|
|
20446
|
+
compact ? [label2(inner)] : [pivot.repeatLabels ? label2(outer) : null, label2(inner), null],
|
|
20447
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
20448
|
+
{ indices: [outerIndex, innerIndex] },
|
|
20449
|
+
compact ? 1 : 0
|
|
20450
|
+
);
|
|
20451
|
+
appendMeasures(
|
|
20452
|
+
[pivot.repeatLabels || first2 ? label2(outer) : null, label2(inner)],
|
|
20453
|
+
keys,
|
|
20454
|
+
records,
|
|
20455
|
+
[outerIndex, innerIndex]
|
|
20456
|
+
);
|
|
20457
|
+
first2 = false;
|
|
20458
|
+
return;
|
|
20459
|
+
}
|
|
20460
|
+
append(
|
|
20461
|
+
compact ? [label2(inner)] : [
|
|
20462
|
+
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
20463
|
+
label2(inner)
|
|
20464
|
+
],
|
|
20465
|
+
numbers3(keys, records),
|
|
20466
|
+
{ indices: [outerIndex, innerIndex] },
|
|
20467
|
+
compact ? 1 : 0
|
|
20468
|
+
);
|
|
20469
|
+
first2 = false;
|
|
20470
|
+
});
|
|
20471
|
+
if (bottom) {
|
|
20472
|
+
if (rowsAxis) {
|
|
20473
|
+
appendMeasures([label2(outer)], [key], groups.get(key) ?? [], [outerIndex], "default");
|
|
20474
|
+
return;
|
|
20475
|
+
}
|
|
20476
|
+
const caption = String(label2(outer));
|
|
20477
|
+
append(
|
|
20478
|
+
[`${caption} Total`, ...compact ? [] : [null]],
|
|
20479
|
+
numbers3([key], groups.get(key) ?? []),
|
|
20480
|
+
{ indices: [outerIndex], type: "default" }
|
|
20481
|
+
);
|
|
20482
|
+
}
|
|
20483
|
+
});
|
|
20484
|
+
if (rowsAxis) appendMeasures([], [], pivot.records, [0], "grand");
|
|
20485
|
+
else
|
|
20486
|
+
append(["Grand Total", ...compact ? [] : [null]], numbers3([], pivot.records), {
|
|
20487
|
+
indices: [0],
|
|
20488
|
+
type: "grand"
|
|
20489
|
+
});
|
|
20155
20490
|
return {
|
|
20156
20491
|
values: values2,
|
|
20157
20492
|
rowItems,
|
|
20158
20493
|
secondRowItems,
|
|
20159
20494
|
columnItems,
|
|
20160
20495
|
rowEntries,
|
|
20161
|
-
firstDataRow
|
|
20496
|
+
firstDataRow,
|
|
20162
20497
|
rowLabelColumns,
|
|
20163
|
-
indents
|
|
20498
|
+
indents,
|
|
20499
|
+
...rowsAxis ? { firstHeaderRow: 1 } : {}
|
|
20164
20500
|
};
|
|
20165
20501
|
}
|
|
20166
20502
|
var label2;
|
|
20167
20503
|
var init_hierarchy2 = __esm({
|
|
20168
20504
|
"xlsx/pivot/hierarchy.ts"() {
|
|
20169
20505
|
init_data();
|
|
20506
|
+
init_hierarchy_first();
|
|
20507
|
+
init_measures();
|
|
20170
20508
|
label2 = pivotItemLabel;
|
|
20171
20509
|
}
|
|
20172
20510
|
});
|
|
20173
20511
|
|
|
20174
20512
|
// xlsx/pivot/aggregate.ts
|
|
20175
|
-
function aggregate2(records, field, type) {
|
|
20176
|
-
if (!records.length) return null;
|
|
20177
|
-
const values2 = records.map((record) => record[field] ?? null);
|
|
20178
|
-
if (type === "count") return values2.filter((value) => value !== null && value !== "").length;
|
|
20179
|
-
const error = values2.find(isCellError);
|
|
20180
|
-
if (error) return error;
|
|
20181
|
-
const numbers3 = values2.filter((value) => typeof value === "number");
|
|
20182
|
-
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
20183
|
-
if (type === "min") return numbers3.reduce((a2, b) => Math.min(a2, b));
|
|
20184
|
-
if (type === "max") return numbers3.reduce((a2, b) => Math.max(a2, b));
|
|
20185
|
-
const sum2 = numbers3.reduce((total2, value) => total2 + value, 0);
|
|
20186
|
-
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
20187
|
-
}
|
|
20188
20513
|
function pivotGrid(pivot) {
|
|
20189
20514
|
validatePivotFields(pivot);
|
|
20190
|
-
|
|
20515
|
+
return prependPivotPage(pivotDataGrid(pivotPageProjection(pivot)), pivot);
|
|
20516
|
+
}
|
|
20517
|
+
function pivotDataGrid(pivot) {
|
|
20518
|
+
if (pivot.secondRowField) return hierarchicalPivotGrid(pivot);
|
|
20191
20519
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
20192
20520
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
20193
|
-
|
|
20521
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
20522
|
+
const compact = pivot.layout === "compact";
|
|
20523
|
+
const headings = rowsAxis && pivot.layout !== void 0 && pivot.layout !== "tabular";
|
|
20524
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowsAxis && !compact ? 2 : 1);
|
|
20525
|
+
const dataRows = (rowItems.length + 1) * (rowsAxis ? 1 + (pivot.additionalValues?.length ?? 0) : 1) + (headings ? rowItems.length : 0);
|
|
20526
|
+
if ((dataRows + dimensions.rows) * dimensions.width > 1e6)
|
|
20194
20527
|
throw new Error("The PivotTable result is too large.");
|
|
20528
|
+
const label3 = pivotItemLabel;
|
|
20529
|
+
const values2 = pivotHeaders(
|
|
20530
|
+
pivot,
|
|
20531
|
+
columnItems,
|
|
20532
|
+
[pivot.layout === "compact" ? "Row Labels" : pivot.rowField],
|
|
20533
|
+
label3
|
|
20534
|
+
);
|
|
20195
20535
|
const rowField = pivot.fields.indexOf(pivot.rowField);
|
|
20196
20536
|
const colField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
20197
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
20198
20537
|
const groups = /* @__PURE__ */ new Map();
|
|
20199
20538
|
const cells2 = /* @__PURE__ */ new Map();
|
|
20200
20539
|
const columns = /* @__PURE__ */ new Map();
|
|
@@ -20212,48 +20551,130 @@ function pivotGrid(pivot) {
|
|
|
20212
20551
|
collect(cells2, JSON.stringify([key, col]), record);
|
|
20213
20552
|
}
|
|
20214
20553
|
}
|
|
20215
|
-
const
|
|
20216
|
-
|
|
20217
|
-
|
|
20218
|
-
|
|
20219
|
-
|
|
20220
|
-
|
|
20221
|
-
|
|
20222
|
-
|
|
20223
|
-
|
|
20224
|
-
|
|
20225
|
-
|
|
20226
|
-
|
|
20227
|
-
|
|
20228
|
-
|
|
20554
|
+
const firstDataRow = values2.length;
|
|
20555
|
+
if (rowsAxis) {
|
|
20556
|
+
const measures = pivotMeasures(pivot);
|
|
20557
|
+
const rowEntries = [];
|
|
20558
|
+
const indents = values2.map(() => 0);
|
|
20559
|
+
const append = (caption, bands, index2, grand = false) => {
|
|
20560
|
+
measures.forEach((measure, m) => {
|
|
20561
|
+
values2.push([
|
|
20562
|
+
...compact ? [grand ? `Total ${measure.caption}` : measure.caption] : [
|
|
20563
|
+
grand ? `Total ${measure.caption}` : pivot.repeatLabels || !headings && m === 0 ? caption : null,
|
|
20564
|
+
grand ? null : measure.caption
|
|
20565
|
+
],
|
|
20566
|
+
...bands.map((band) => band[m] ?? null)
|
|
20567
|
+
]);
|
|
20568
|
+
indents.push(compact && !grand ? 1 : 0);
|
|
20569
|
+
rowEntries.push({
|
|
20570
|
+
indices: grand ? [0] : [index2, m],
|
|
20571
|
+
measure: m,
|
|
20572
|
+
...grand ? { type: "grand" } : {}
|
|
20573
|
+
});
|
|
20574
|
+
});
|
|
20575
|
+
};
|
|
20576
|
+
rowItems.forEach((item, index2) => {
|
|
20577
|
+
const key = pivotValueKey(item);
|
|
20578
|
+
if (headings) {
|
|
20579
|
+
values2.push([label3(item), ...Array(dimensions.width - 1).fill(null)]);
|
|
20580
|
+
rowEntries.push({ indices: [index2] });
|
|
20581
|
+
indents.push(0);
|
|
20582
|
+
}
|
|
20583
|
+
append(
|
|
20584
|
+
label3(item),
|
|
20585
|
+
[
|
|
20586
|
+
...columnItems.map(
|
|
20587
|
+
(col) => pivotNumbers(pivot, cells2.get(JSON.stringify([key, pivotValueKey(col)])) ?? [])
|
|
20588
|
+
),
|
|
20589
|
+
pivotNumbers(pivot, groups.get(key) ?? [])
|
|
20590
|
+
],
|
|
20591
|
+
index2
|
|
20592
|
+
);
|
|
20593
|
+
});
|
|
20594
|
+
append(
|
|
20595
|
+
"Grand Total",
|
|
20596
|
+
[
|
|
20597
|
+
...columnItems.map((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
20598
|
+
pivotNumbers(pivot, pivot.records)
|
|
20599
|
+
],
|
|
20600
|
+
0,
|
|
20601
|
+
true
|
|
20602
|
+
);
|
|
20603
|
+
return {
|
|
20604
|
+
values: values2,
|
|
20605
|
+
rowItems,
|
|
20606
|
+
columnItems,
|
|
20607
|
+
firstDataRow,
|
|
20608
|
+
rowLabelColumns: compact ? 1 : 2,
|
|
20609
|
+
indents,
|
|
20610
|
+
firstHeaderRow: 1,
|
|
20611
|
+
rowEntries
|
|
20612
|
+
};
|
|
20613
|
+
}
|
|
20229
20614
|
for (const row2 of rowItems) {
|
|
20230
20615
|
const records = groups.get(pivotValueKey(row2)) ?? [];
|
|
20231
20616
|
values2.push([
|
|
20232
20617
|
label3(row2),
|
|
20233
|
-
...columnItems.
|
|
20234
|
-
(col) =>
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
pivot.aggregate
|
|
20618
|
+
...columnItems.flatMap(
|
|
20619
|
+
(col) => pivotNumbers(
|
|
20620
|
+
pivot,
|
|
20621
|
+
cells2.get(JSON.stringify([pivotValueKey(row2), pivotValueKey(col)])) ?? []
|
|
20238
20622
|
)
|
|
20239
20623
|
),
|
|
20240
|
-
|
|
20624
|
+
...pivotNumbers(pivot, records)
|
|
20241
20625
|
]);
|
|
20242
20626
|
}
|
|
20243
20627
|
values2.push([
|
|
20244
20628
|
"Grand Total",
|
|
20245
|
-
...columnItems.
|
|
20246
|
-
|
|
20247
|
-
),
|
|
20248
|
-
aggregate2(pivot.records, valueField, pivot.aggregate)
|
|
20629
|
+
...columnItems.flatMap((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
20630
|
+
...pivotNumbers(pivot, pivot.records)
|
|
20249
20631
|
]);
|
|
20250
|
-
return { values: values2, rowItems, columnItems, firstDataRow
|
|
20632
|
+
return { values: values2, rowItems, columnItems, firstDataRow };
|
|
20251
20633
|
}
|
|
20252
20634
|
var init_aggregate = __esm({
|
|
20253
20635
|
"xlsx/pivot/aggregate.ts"() {
|
|
20254
|
-
init_model();
|
|
20255
20636
|
init_data();
|
|
20637
|
+
init_page_filter();
|
|
20256
20638
|
init_hierarchy2();
|
|
20639
|
+
init_measures();
|
|
20640
|
+
}
|
|
20641
|
+
});
|
|
20642
|
+
|
|
20643
|
+
// xlsx/pivot/values-axis.ts
|
|
20644
|
+
function remapPivotRowEntries(entries, axes2) {
|
|
20645
|
+
return entries.map(
|
|
20646
|
+
(entry3) => entry3.type === "grand" ? entry3 : {
|
|
20647
|
+
...entry3,
|
|
20648
|
+
indices: entry3.indices.map((item, axis) => {
|
|
20649
|
+
const index2 = axes2[axis]?.[item];
|
|
20650
|
+
if (index2 === void 0) throw new Error("Invalid report row axis item");
|
|
20651
|
+
return index2;
|
|
20652
|
+
})
|
|
20653
|
+
}
|
|
20654
|
+
);
|
|
20655
|
+
}
|
|
20656
|
+
function pivotValueAxisItems(measures, columns, columnIndices) {
|
|
20657
|
+
const entries = [];
|
|
20658
|
+
if (columns === void 0) {
|
|
20659
|
+
for (let measure = 0; measure < measures; measure++)
|
|
20660
|
+
entries.push(
|
|
20661
|
+
`<i${attrs({ i: measure || void 0 })}><x${attrs({ v: measure || void 0 })}/></i>`
|
|
20662
|
+
);
|
|
20663
|
+
} else {
|
|
20664
|
+
for (let column = 0; column < columns; column++)
|
|
20665
|
+
for (let measure = 0; measure < measures; measure++) {
|
|
20666
|
+
entries.push(
|
|
20667
|
+
`<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>`
|
|
20668
|
+
);
|
|
20669
|
+
}
|
|
20670
|
+
for (let measure = 0; measure < measures; measure++)
|
|
20671
|
+
entries.push(`<i${attrs({ t: "grand", i: measure || void 0 })}><x/></i>`);
|
|
20672
|
+
}
|
|
20673
|
+
return `<colItems count="${entries.length}">${entries.join("")}</colItems>`;
|
|
20674
|
+
}
|
|
20675
|
+
var init_values_axis = __esm({
|
|
20676
|
+
"xlsx/pivot/values-axis.ts"() {
|
|
20677
|
+
init_xml_out();
|
|
20257
20678
|
}
|
|
20258
20679
|
});
|
|
20259
20680
|
|
|
@@ -20262,45 +20683,87 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20262
20683
|
const grid = pivotGrid(pivot);
|
|
20263
20684
|
const row2 = pivot.fields.indexOf(pivot.rowField);
|
|
20264
20685
|
const second = pivot.secondRowField ? pivot.fields.indexOf(pivot.secondRowField) : -1;
|
|
20686
|
+
const page = pivot.pageFilter ? pivot.fields.indexOf(pivot.pageFilter.field) : -1;
|
|
20687
|
+
const pageItems = page >= 0 ? pivotItems(pivot, pivot.pageFilter.field) : [];
|
|
20688
|
+
const axisItems = (field, visible) => page >= 0 ? pivotItems(pivot, field) : visible;
|
|
20689
|
+
const rowItemsFull = axisItems(pivot.rowField, grid.rowItems);
|
|
20690
|
+
const secondRowItemsFull = pivot.secondRowField ? axisItems(pivot.secondRowField, grid.secondRowItems) : [];
|
|
20691
|
+
const columnItemsFull = pivot.columnField ? axisItems(pivot.columnField, grid.columnItems) : [];
|
|
20692
|
+
const itemIndices = (visible, full) => {
|
|
20693
|
+
const indices = new Map(full.map((item, index2) => [pivotValueKey(item), index2]));
|
|
20694
|
+
return visible.map((v) => indices.get(pivotValueKey(v)));
|
|
20695
|
+
};
|
|
20696
|
+
const rowIndicesFull = itemIndices(grid.rowItems, rowItemsFull), secondRowIndicesFull = itemIndices(grid.secondRowItems ?? [], secondRowItemsFull), columnIndicesFull = itemIndices(grid.columnItems, columnItemsFull);
|
|
20697
|
+
const rowEntries = page >= 0 && grid.rowEntries ? remapPivotRowEntries(grid.rowEntries, [rowIndicesFull, secondRowIndicesFull]) : grid.rowEntries;
|
|
20698
|
+
const pageOffset = page >= 0 ? 2 : 0;
|
|
20265
20699
|
const col = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
20266
|
-
const
|
|
20700
|
+
const measures = pivotMeasures(pivot);
|
|
20701
|
+
const multiple = measures.length > 1;
|
|
20702
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
20267
20703
|
const compact = pivot.layout === "compact";
|
|
20268
20704
|
const outline = pivot.layout === "compact" || pivot.layout === "outline";
|
|
20269
20705
|
const top = (pivot.subtotalPosition ?? (outline ? "top" : "bottom")) === "top";
|
|
20270
20706
|
const fields = pivot.fields.map((_field, index2) => {
|
|
20271
|
-
const items2 = index2 === row2 ?
|
|
20707
|
+
const items2 = index2 === page ? pageItems : index2 === row2 ? rowItemsFull : index2 === second ? secondRowItemsFull : index2 === col ? columnItemsFull : void 0;
|
|
20272
20708
|
const subtotal = !(index2 === row2 && pivot.subtotals === false);
|
|
20273
20709
|
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>' : "";
|
|
20274
|
-
return `<pivotField${attrs({ axis: index2 === row2 || index2 === second ? "axisRow" : index2 === col ? "axisCol" : void 0, dataField:
|
|
20710
|
+
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>`;
|
|
20275
20711
|
}).join("");
|
|
20276
|
-
const items = (count2) => Array.from({ length: count2 }, (_v, i) => `<i><x v="${i}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
20277
|
-
const header = grid.firstDataRow - 1;
|
|
20278
|
-
const rowIndices = [row2, ...second >= 0 ? [second] : []];
|
|
20712
|
+
const items = (count2, indices) => Array.from({ length: count2 }, (_v, i) => `<i><x v="${indices?.[i] ?? i}"/></i>`).join("") + '<i t="grand"><x/></i>';
|
|
20713
|
+
const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : multiple && col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
|
|
20714
|
+
const rowIndices = rowsAxis && pivot.valuesPosition === "first" ? [-2, row2, second] : rowsAxis && pivot.valuesPosition === "between" ? [row2, -2, second] : [row2, ...second >= 0 ? [second] : [], ...rowsAxis ? [-2] : []];
|
|
20279
20715
|
let previous = [];
|
|
20280
|
-
const rowItems =
|
|
20716
|
+
const rowItems = rowEntries?.map((entry3) => {
|
|
20281
20717
|
let prefix = 0;
|
|
20282
|
-
if (
|
|
20718
|
+
if (entry3.type === "default" && rowsAxis && pivot.valuesPosition === "first") prefix = 1;
|
|
20719
|
+
else if (!entry3.type)
|
|
20283
20720
|
while (prefix < entry3.indices.length - 1 && entry3.indices[prefix] === previous[prefix])
|
|
20284
20721
|
prefix++;
|
|
20285
|
-
previous = entry3.type ? [] : entry3.indices;
|
|
20286
|
-
return `<i${attrs({ t: entry3.type, r: prefix || void 0 })}>${entry3.indices.slice(prefix).map((index2) => `<x${attrs({ v: index2 || void 0 })}/>`).join("")}</i>`;
|
|
20287
|
-
}).join("") ?? items(grid.rowItems.length);
|
|
20288
|
-
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>`;
|
|
20289
|
-
if (
|
|
20290
|
-
body += `<colFields count="1"
|
|
20291
|
-
else
|
|
20292
|
-
|
|
20722
|
+
previous = entry3.type && !(entry3.type === "default" && pivot.valuesPosition === "first") ? [] : entry3.indices;
|
|
20723
|
+
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>`;
|
|
20724
|
+
}).join("") ?? items(grid.rowItems.length, rowIndicesFull);
|
|
20725
|
+
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>`;
|
|
20726
|
+
if (multiple && !rowsAxis)
|
|
20727
|
+
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)}`;
|
|
20728
|
+
else if (col >= 0)
|
|
20729
|
+
body += `<colFields count="1"><field x="${col}"/></colFields><colItems count="${grid.columnItems.length + 1}">${items(grid.columnItems.length, columnIndicesFull)}</colItems>`;
|
|
20730
|
+
else
|
|
20731
|
+
body += rowsAxis ? '<colItems count="1"><i/></colItems>' : page >= 0 ? '<colItems count="1"><i/></colItems>' : '<colItems count="1"><i><x/></i></colItems>';
|
|
20732
|
+
if (page >= 0)
|
|
20733
|
+
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>`;
|
|
20734
|
+
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>`;
|
|
20293
20735
|
const doc = parseXml(
|
|
20294
20736
|
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>`
|
|
20295
20737
|
);
|
|
20296
20738
|
const root = doc.documentElement;
|
|
20297
20739
|
root.setAttribute("name", pivot.name);
|
|
20298
20740
|
root.setAttribute("cacheId", String(cacheId));
|
|
20741
|
+
root.setAttribute("dataOnRows", rowsAxis ? "1" : "0");
|
|
20742
|
+
if (rowsAxis && (pivot.valuesPosition === "between" || pivot.valuesPosition === "first"))
|
|
20743
|
+
root.setAttribute("dataPosition", pivot.valuesPosition === "first" ? "0" : "1");
|
|
20744
|
+
else root.removeAttribute("dataPosition");
|
|
20299
20745
|
root.setAttribute("compact", compact ? "1" : "0");
|
|
20300
20746
|
root.setAttribute("compactData", compact ? "1" : "0");
|
|
20301
20747
|
root.setAttribute("outline", outline ? "1" : "0");
|
|
20302
20748
|
root.setAttribute("outlineData", outline ? "1" : "0");
|
|
20303
20749
|
if (compact) root.setAttribute("indent", "0");
|
|
20750
|
+
if (multiple && !elements(first(root, "extLst", NS.x) ?? parseXml("<root/>").documentElement).some(
|
|
20751
|
+
(extension) => first(
|
|
20752
|
+
extension,
|
|
20753
|
+
"pivotTableDefinition",
|
|
20754
|
+
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
20755
|
+
)
|
|
20756
|
+
)) {
|
|
20757
|
+
let list = first(root, "extLst", NS.x);
|
|
20758
|
+
if (!list) {
|
|
20759
|
+
list = doc.createElementNS(NS.x, "extLst");
|
|
20760
|
+
root.appendChild(list);
|
|
20761
|
+
}
|
|
20762
|
+
const extension = parseXml(
|
|
20763
|
+
`<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>`
|
|
20764
|
+
).documentElement;
|
|
20765
|
+
list.appendChild(doc.importNode(extension, true));
|
|
20766
|
+
}
|
|
20304
20767
|
root.setAttribute("rowGrandTotals", "1");
|
|
20305
20768
|
root.setAttribute("colGrandTotals", "1");
|
|
20306
20769
|
for (const extension of elements(
|
|
@@ -20311,6 +20774,7 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20311
20774
|
"pivotTableDefinition",
|
|
20312
20775
|
"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
20313
20776
|
);
|
|
20777
|
+
if (multiple && definition) definition.setAttribute("hideValuesRow", "1");
|
|
20314
20778
|
if (definition?.hasAttribute("fillDownLabelsDefault"))
|
|
20315
20779
|
definition.setAttribute("fillDownLabelsDefault", pivot.repeatLabels ? "1" : "0");
|
|
20316
20780
|
}
|
|
@@ -20321,7 +20785,8 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20321
20785
|
"rowItems",
|
|
20322
20786
|
"colFields",
|
|
20323
20787
|
"colItems",
|
|
20324
|
-
"dataFields"
|
|
20788
|
+
"dataFields",
|
|
20789
|
+
"pageFields"
|
|
20325
20790
|
]);
|
|
20326
20791
|
for (const child3 of elements(root)) if (replaced.has(child3.localName)) root.removeChild(child3);
|
|
20327
20792
|
const replacement = parseXml(`<root xmlns="${NS.x}">${body}</root>`).documentElement;
|
|
@@ -20332,10 +20797,13 @@ function pivotTableXml(pivot, cacheId, cache2) {
|
|
|
20332
20797
|
var init_table_xml = __esm({
|
|
20333
20798
|
"xlsx/pivot/table-xml.ts"() {
|
|
20334
20799
|
init_xml2();
|
|
20800
|
+
init_data();
|
|
20335
20801
|
init_address();
|
|
20336
20802
|
init_xml_out();
|
|
20337
20803
|
init_aggregate();
|
|
20338
20804
|
init_data();
|
|
20805
|
+
init_measures();
|
|
20806
|
+
init_values_axis();
|
|
20339
20807
|
}
|
|
20340
20808
|
});
|
|
20341
20809
|
|