ooxml-core 1.9.0 → 1.10.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-5UURGJEV.mjs +2 -0
- package/dist/{PptxHandler-EX4WBIQQ.mjs → PptxHandler-ADEFY476.mjs} +2 -2
- package/dist/PptxHandler-U5XB2HUE.cjs +11 -0
- package/dist/automation/index.cjs +744 -192
- package/dist/automation/index.mjs +744 -192
- package/dist/{chunk-SWF7KVL5.cjs → chunk-3N6XMMTT.cjs} +1365 -1062
- package/dist/{chunk-FIELY5PI.mjs → chunk-5NVJN4E6.mjs} +30 -2
- package/dist/{chunk-IGOA57LE.mjs → chunk-A6P7G3UK.mjs} +1 -1
- package/dist/{chunk-CPKNMQLX.cjs → chunk-AWIDASUW.cjs} +25 -2
- package/dist/{chunk-SVQZXP3F.mjs → chunk-CBNKBVX5.mjs} +25 -2
- package/dist/{chunk-OXHMZS7B.mjs → chunk-CCHYFCPD.mjs} +649 -172
- package/dist/{chunk-OB277ZGE.mjs → chunk-R6KSBNKX.mjs} +27 -1
- package/dist/{chunk-AT66SA5M.cjs → chunk-S6DOCMQC.cjs} +28 -0
- package/dist/{chunk-WSO4T2LJ.mjs → chunk-WUE5ZHU3.mjs} +26 -3
- package/dist/{chunk-LCS3J3QI.mjs → chunk-ZE53K7DH.mjs} +474 -171
- package/dist/{chunk-M76PHYRR.mjs → chunk-ZOUGMAZG.mjs} +1 -1
- 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 +477 -75
- package/dist/docx/layout/index.mjs +477 -76
- 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 +13 -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 +2 -1
- 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 +535 -182
- package/dist/pptx/automation/index.d.ts +4 -4
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-BZh-IMkN.d.ts → index-Cuxtr76Y.d.ts} +17 -3
- package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-B4cnSPNz.d.ts → index-DUCGeZh7.d.ts} +65 -5
- package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +1 -0
- package/dist/pptx/chunks/{smart-art-Q2kZQtHh.d.ts → smart-art-D-sXa_Nb.d.ts} +11 -1
- package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-BLodkuXE.d.ts → text-operations-BqHmLaLA.d.ts} +26 -2
- package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +535 -182
- 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 +18 -18
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -2
- 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 +8 -8
- package/dist/pptx/editor/render/slide-operations.mjs +2 -2
- package/dist/pptx/index.cjs +762 -182
- package/dist/pptx/index.d.ts +5 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +486 -114
- package/dist/teams/index.mjs +486 -114
- package/dist/visio/date-cache.d.ts +3 -0
- package/dist/visio/date-cache.d.ts.map +1 -0
- package/dist/visio/edit-text-field.d.ts.map +1 -1
- package/dist/visio/index.cjs +131 -22
- package/dist/visio/index.mjs +131 -22
- package/dist/visio/shape-metadata.d.ts.map +1 -1
- package/dist/visio/text-field-display.d.ts.map +1 -1
- 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-numeric.d.ts +1 -1
- package/dist/visio/text-field-numeric.d.ts.map +1 -1
- 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/index.cjs +132 -22
- package/dist/visio/ui/index.mjs +132 -22
- 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 +614 -170
- package/dist/xlsx/index.mjs +614 -170
- package/dist/xlsx/load/index.cjs +575 -163
- package/dist/xlsx/load/index.mjs +575 -163
- package/dist/xlsx/model-pivots.d.ts +23 -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 +1 -1
- 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/measures.d.ts +13 -0
- package/dist/xlsx/pivot/measures.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 +9 -0
- package/dist/xlsx/pivot/values-axis.d.ts.map +1 -0
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +547 -127
- package/dist/xlsx/ui/index.mjs +547 -127
- package/package.json +1 -1
- 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.map +0 -1
- package/dist/pptx/chunks/text-operations-BLodkuXE.d.ts.map +0 -1
package/dist/xlsx/ui/index.mjs
CHANGED
|
@@ -13835,6 +13835,25 @@ function validatePivotFields(pivot) {
|
|
|
13835
13835
|
...pivot.columnField ? [pivot.columnField] : [],
|
|
13836
13836
|
pivot.valueField
|
|
13837
13837
|
];
|
|
13838
|
+
const extras = pivot.additionalValues ?? [];
|
|
13839
|
+
if (pivot.valuesAxis !== void 0 && !["columns", "rows"].includes(pivot.valuesAxis))
|
|
13840
|
+
throw new Error("Choose a valid Values axis.");
|
|
13841
|
+
if (pivot.valuesPosition !== void 0 && !["last", "between", "first"].includes(pivot.valuesPosition))
|
|
13842
|
+
throw new Error("Choose a valid Values position.");
|
|
13843
|
+
if ((pivot.valuesPosition === "between" || pivot.valuesPosition === "first") && (pivot.valuesAxis !== "rows" || !pivot.secondRowField))
|
|
13844
|
+
throw new Error("Values before or between fields require two row fields and Values on rows.");
|
|
13845
|
+
if (pivot.valuesAxis === "rows" && (!Array.isArray(extras) || !extras.length))
|
|
13846
|
+
throw new Error("Values on rows require multiple measures.");
|
|
13847
|
+
if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== "Values")
|
|
13848
|
+
throw new Error("This PivotTable uses unsupported Values header captions.");
|
|
13849
|
+
if (!Array.isArray(extras) || extras.length > 15 || extras.some(
|
|
13850
|
+
(measure2) => !measure2 || !pivot.fields.includes(measure2.field) || !PIVOT_AGGREGATES.includes(measure2.aggregate) || typeof measure2.caption !== "string" || !measure2.caption.trim() || measure2.caption.length > 255 || pivot.fields.some((field) => field.toLowerCase() === measure2.caption.toLowerCase())
|
|
13851
|
+
) || new Set(
|
|
13852
|
+
[pivot.valueCaption, ...extras.map((measure2) => measure2.caption)].map(
|
|
13853
|
+
(caption) => caption?.toLowerCase()
|
|
13854
|
+
)
|
|
13855
|
+
).size !== extras.length + 1)
|
|
13856
|
+
throw new Error("Choose PivotTable value fields with valid aggregates and unique captions.");
|
|
13838
13857
|
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")
|
|
13839
13858
|
throw new Error("Choose valid PivotTable fields; row and column fields must differ.");
|
|
13840
13859
|
}
|
|
@@ -13842,21 +13861,191 @@ function pivotCaption(aggregate3, field) {
|
|
|
13842
13861
|
return `${aggregate3[0].toUpperCase()}${aggregate3.slice(1)} of ${field}`;
|
|
13843
13862
|
}
|
|
13844
13863
|
|
|
13864
|
+
// xlsx/pivot/measures.ts
|
|
13865
|
+
var pivotMeasures = (pivot) => [
|
|
13866
|
+
{ field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
|
|
13867
|
+
...pivot.additionalValues ?? []
|
|
13868
|
+
];
|
|
13869
|
+
function normalizedPivotMeasures(values2) {
|
|
13870
|
+
if (!Array.isArray(values2) || values2.length > 15)
|
|
13871
|
+
throw new Error("Choose between one and sixteen PivotTable value fields.");
|
|
13872
|
+
return values2.map((value2) => {
|
|
13873
|
+
if (!value2 || typeof value2.field !== "string")
|
|
13874
|
+
throw new Error("Choose valid PivotTable value fields.");
|
|
13875
|
+
const aggregate3 = value2.aggregate ?? "sum";
|
|
13876
|
+
if (!PIVOT_AGGREGATES.includes(aggregate3))
|
|
13877
|
+
throw new Error("Choose a valid PivotTable aggregate.");
|
|
13878
|
+
return {
|
|
13879
|
+
field: value2.field,
|
|
13880
|
+
aggregate: aggregate3,
|
|
13881
|
+
caption: value2.caption ?? `${aggregate3[0].toUpperCase()}${aggregate3.slice(1)} of ${value2.field}`
|
|
13882
|
+
};
|
|
13883
|
+
});
|
|
13884
|
+
}
|
|
13885
|
+
function aggregate2(records, field, type) {
|
|
13886
|
+
if (!records.length) return null;
|
|
13887
|
+
const values2 = records.map((record) => record[field] ?? null);
|
|
13888
|
+
if (type === "count") return values2.filter((value2) => value2 !== null && value2 !== "").length;
|
|
13889
|
+
const error = values2.find(isCellError);
|
|
13890
|
+
if (error) return error;
|
|
13891
|
+
const numbers3 = values2.filter((value2) => typeof value2 === "number");
|
|
13892
|
+
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
13893
|
+
if (type === "min") return numbers3.reduce((a, b) => Math.min(a, b));
|
|
13894
|
+
if (type === "max") return numbers3.reduce((a, b) => Math.max(a, b));
|
|
13895
|
+
const sum2 = numbers3.reduce((total2, value2) => total2 + value2, 0);
|
|
13896
|
+
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
13897
|
+
}
|
|
13898
|
+
var pivotMeasureNumber = (pivot, records, measure2) => aggregate2(records, pivot.fields.indexOf(measure2.field), measure2.aggregate);
|
|
13899
|
+
var pivotNumbers = (pivot, records) => pivotMeasures(pivot).map((measure2) => pivotMeasureNumber(pivot, records, measure2));
|
|
13900
|
+
function pivotHeaderDimensions(pivot, columnItems, rowLabels) {
|
|
13901
|
+
const measures = 1 + (pivot.additionalValues?.length ?? 0);
|
|
13902
|
+
if (pivot.valuesAxis === "rows")
|
|
13903
|
+
return {
|
|
13904
|
+
rows: pivot.columnField ? 2 : 1,
|
|
13905
|
+
width: rowLabels + (pivot.columnField ? columnItems + 1 : 1)
|
|
13906
|
+
};
|
|
13907
|
+
return {
|
|
13908
|
+
rows: pivot.columnField ? measures > 1 ? 3 : 2 : 1,
|
|
13909
|
+
width: rowLabels + (pivot.columnField ? measures === 1 ? Math.max(1, columnItems) + 1 : (columnItems + 1) * measures : measures)
|
|
13910
|
+
};
|
|
13911
|
+
}
|
|
13912
|
+
function pivotHeaders(pivot, columns, labels, label3) {
|
|
13913
|
+
const measures = pivotMeasures(pivot);
|
|
13914
|
+
if (pivot.valuesAxis === "rows") {
|
|
13915
|
+
const rowLabels = pivot.layout === "compact" ? ["Row Labels"] : pivot.valuesPosition === "first" ? ["Values", ...labels] : pivot.valuesPosition === "between" ? [labels[0], "Values", labels[1]] : [...labels, "Values"];
|
|
13916
|
+
return pivot.columnField ? [
|
|
13917
|
+
[
|
|
13918
|
+
...rowLabels.map(() => null),
|
|
13919
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
13920
|
+
...columns.map(() => null)
|
|
13921
|
+
],
|
|
13922
|
+
[...rowLabels, ...columns.map(label3), "Grand Total"]
|
|
13923
|
+
] : [[...rowLabels, null]];
|
|
13924
|
+
}
|
|
13925
|
+
if (!pivot.columnField) return [[...labels, ...measures.map((measure2) => measure2.caption)]];
|
|
13926
|
+
if (measures.length === 1)
|
|
13927
|
+
return [
|
|
13928
|
+
[
|
|
13929
|
+
pivot.valueCaption,
|
|
13930
|
+
...labels.slice(1).map(() => null),
|
|
13931
|
+
pivot.layout === "compact" ? "Column Labels" : pivot.columnField,
|
|
13932
|
+
...columns.slice(1).map(() => null),
|
|
13933
|
+
null
|
|
13934
|
+
],
|
|
13935
|
+
[...labels, ...columns.map(label3), "Grand Total"]
|
|
13936
|
+
];
|
|
13937
|
+
const { width } = pivotHeaderDimensions(pivot, columns.length, labels.length);
|
|
13938
|
+
const first2 = Array(width).fill(null);
|
|
13939
|
+
first2[labels.length] = pivot.layout === "compact" ? "Column Labels" : pivot.columnField;
|
|
13940
|
+
if (pivot.layout !== "compact") first2[labels.length + 1] = "Values";
|
|
13941
|
+
return [
|
|
13942
|
+
first2,
|
|
13943
|
+
[
|
|
13944
|
+
...labels.map(() => null),
|
|
13945
|
+
...columns.flatMap((column) => [label3(column), ...measures.slice(1).map(() => null)]),
|
|
13946
|
+
...measures.map((measure2) => `Total ${measure2.caption}`)
|
|
13947
|
+
],
|
|
13948
|
+
[
|
|
13949
|
+
...labels,
|
|
13950
|
+
...columns.flatMap(() => measures.map((measure2) => measure2.caption)),
|
|
13951
|
+
...measures.map(() => null)
|
|
13952
|
+
]
|
|
13953
|
+
];
|
|
13954
|
+
}
|
|
13955
|
+
|
|
13956
|
+
// xlsx/pivot/hierarchy-first.ts
|
|
13957
|
+
function appendFirstPivotValues(pivot, context) {
|
|
13958
|
+
const {
|
|
13959
|
+
rowItems,
|
|
13960
|
+
secondRowItems,
|
|
13961
|
+
columnItems,
|
|
13962
|
+
children: children2,
|
|
13963
|
+
innerIndices,
|
|
13964
|
+
groups,
|
|
13965
|
+
details,
|
|
13966
|
+
buckets,
|
|
13967
|
+
width,
|
|
13968
|
+
rowLabels,
|
|
13969
|
+
top,
|
|
13970
|
+
bottom,
|
|
13971
|
+
append
|
|
13972
|
+
} = context;
|
|
13973
|
+
const compact3 = pivot.layout === "compact";
|
|
13974
|
+
const tabular = !pivot.layout || pivot.layout === "tabular";
|
|
13975
|
+
const blank = () => Array(width - rowLabels).fill(null);
|
|
13976
|
+
pivotMeasures(pivot).forEach((measure2, m) => {
|
|
13977
|
+
const numbers3 = (keys, records) => [
|
|
13978
|
+
...columnItems.map(
|
|
13979
|
+
(column) => pivotMeasureNumber(
|
|
13980
|
+
pivot,
|
|
13981
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
13982
|
+
measure2
|
|
13983
|
+
)
|
|
13984
|
+
),
|
|
13985
|
+
pivotMeasureNumber(pivot, records, measure2)
|
|
13986
|
+
];
|
|
13987
|
+
if (!tabular)
|
|
13988
|
+
append([measure2.caption, ...Array(rowLabels - 1).fill(null)], blank(), {
|
|
13989
|
+
indices: [m],
|
|
13990
|
+
measure: m
|
|
13991
|
+
});
|
|
13992
|
+
let first2 = true;
|
|
13993
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
13994
|
+
const key = pivotValueKey(outer);
|
|
13995
|
+
const group = groups.get(key) ?? [];
|
|
13996
|
+
if (!tabular)
|
|
13997
|
+
append(
|
|
13998
|
+
compact3 ? [pivotItemLabel(outer)] : [null, pivotItemLabel(outer), null],
|
|
13999
|
+
top ? numbers3([key], group) : blank(),
|
|
14000
|
+
{ indices: [m, outerIndex], measure: m },
|
|
14001
|
+
compact3 ? 1 : 0
|
|
14002
|
+
);
|
|
14003
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
14004
|
+
(a, b) => innerIndices.get(a) - innerIndices.get(b)
|
|
14005
|
+
);
|
|
14006
|
+
innerKeys.forEach((innerKey, child) => {
|
|
14007
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
14008
|
+
append(
|
|
14009
|
+
compact3 ? [pivotItemLabel(secondRowItems[innerIndex])] : [
|
|
14010
|
+
tabular && first2 ? measure2.caption : null,
|
|
14011
|
+
pivot.repeatLabels || tabular && child === 0 ? pivotItemLabel(outer) : null,
|
|
14012
|
+
pivotItemLabel(secondRowItems[innerIndex])
|
|
14013
|
+
],
|
|
14014
|
+
numbers3([key, innerKey], details.get(JSON.stringify([key, innerKey]))),
|
|
14015
|
+
{ indices: [m, outerIndex, innerIndex], measure: m },
|
|
14016
|
+
compact3 ? 2 : 0
|
|
14017
|
+
);
|
|
14018
|
+
first2 = false;
|
|
14019
|
+
});
|
|
14020
|
+
if (bottom)
|
|
14021
|
+
append(
|
|
14022
|
+
compact3 ? [`${String(pivotItemLabel(outer))} Total`] : [null, `${String(pivotItemLabel(outer))} Total`, null],
|
|
14023
|
+
numbers3([key], group),
|
|
14024
|
+
{ indices: [m, outerIndex], measure: m, type: "default" },
|
|
14025
|
+
compact3 ? 1 : 0
|
|
14026
|
+
);
|
|
14027
|
+
});
|
|
14028
|
+
});
|
|
14029
|
+
}
|
|
14030
|
+
|
|
13845
14031
|
// xlsx/pivot/hierarchy.ts
|
|
13846
14032
|
var label2 = pivotItemLabel;
|
|
13847
|
-
function hierarchicalPivotGrid(pivot
|
|
14033
|
+
function hierarchicalPivotGrid(pivot) {
|
|
13848
14034
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
13849
14035
|
const secondRowItems = pivotItems(pivot, pivot.secondRowField);
|
|
13850
14036
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
13851
14037
|
const outerField = pivot.fields.indexOf(pivot.rowField);
|
|
13852
14038
|
const innerField = pivot.fields.indexOf(pivot.secondRowField);
|
|
13853
14039
|
const columnField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
13854
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
13855
14040
|
const layout2 = pivot.layout ?? "tabular";
|
|
13856
14041
|
const compact3 = layout2 === "compact";
|
|
13857
|
-
const
|
|
14042
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
14043
|
+
const firstValues = rowsAxis && pivot.valuesPosition === "first";
|
|
14044
|
+
const between = rowsAxis && pivot.valuesPosition === "between";
|
|
14045
|
+
const measures = pivotMeasures(pivot);
|
|
14046
|
+
const top = (!rowsAxis || firstValues) && layout2 !== "tabular" && pivot.subtotals !== false && (pivot.subtotalPosition ?? "top") === "top";
|
|
13858
14047
|
const bottom = pivot.subtotals !== false && !top;
|
|
13859
|
-
const rowLabelColumns = compact3 ? 1 : 2;
|
|
14048
|
+
const rowLabelColumns = compact3 ? 1 : rowsAxis ? 3 : 2;
|
|
13860
14049
|
const groups = /* @__PURE__ */ new Map();
|
|
13861
14050
|
const details = /* @__PURE__ */ new Map();
|
|
13862
14051
|
const children2 = /* @__PURE__ */ new Map();
|
|
@@ -13880,20 +14069,12 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
13880
14069
|
collect(buckets, JSON.stringify([...key, column]), record);
|
|
13881
14070
|
}
|
|
13882
14071
|
}
|
|
13883
|
-
const
|
|
13884
|
-
|
|
13885
|
-
|
|
14072
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowLabelColumns);
|
|
14073
|
+
const rows2 = (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;
|
|
14074
|
+
if (rows2 * dimensions.width > 1e6) throw new Error("The PivotTable result is too large.");
|
|
13886
14075
|
const labels = compact3 ? ["Row Labels"] : [pivot.rowField, pivot.secondRowField];
|
|
13887
|
-
const values2 = pivot
|
|
13888
|
-
|
|
13889
|
-
pivot.valueCaption,
|
|
13890
|
-
...compact3 ? [] : [null],
|
|
13891
|
-
compact3 ? "Column Labels" : pivot.columnField,
|
|
13892
|
-
...columnItems.slice(1).map(() => null),
|
|
13893
|
-
null
|
|
13894
|
-
],
|
|
13895
|
-
[...labels, ...columnItems.map(label2), "Grand Total"]
|
|
13896
|
-
] : [[...labels, pivot.valueCaption]];
|
|
14076
|
+
const values2 = pivotHeaders(pivot, columnItems, labels, label2);
|
|
14077
|
+
const firstDataRow = values2.length;
|
|
13897
14078
|
const indents = values2.map(() => 0);
|
|
13898
14079
|
const rowEntries = [];
|
|
13899
14080
|
const append = (labels2, numbers4, entry, indent = 0) => {
|
|
@@ -13901,91 +14082,184 @@ function hierarchicalPivotGrid(pivot, aggregate3) {
|
|
|
13901
14082
|
rowEntries.push(entry);
|
|
13902
14083
|
indents.push(indent);
|
|
13903
14084
|
};
|
|
13904
|
-
const
|
|
14085
|
+
const bands = (keys, records) => [
|
|
13905
14086
|
...columnItems.map(
|
|
13906
|
-
(column) =>
|
|
13907
|
-
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
13908
|
-
valueField,
|
|
13909
|
-
pivot.aggregate
|
|
13910
|
-
)
|
|
14087
|
+
(column) => pivotNumbers(pivot, buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [])
|
|
13911
14088
|
),
|
|
13912
|
-
|
|
14089
|
+
pivotNumbers(pivot, records)
|
|
13913
14090
|
];
|
|
13914
|
-
|
|
13915
|
-
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
const records = details.get(JSON.stringify(keys));
|
|
13928
|
-
if (!records) return;
|
|
13929
|
-
append(
|
|
13930
|
-
compact3 ? [label2(inner2)] : [
|
|
13931
|
-
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
13932
|
-
label2(inner2)
|
|
14091
|
+
const numbers3 = (keys, records) => bands(keys, records).flat();
|
|
14092
|
+
const appendMeasures = (labels2, keys, records, indices, type) => {
|
|
14093
|
+
const values3 = bands(keys, records);
|
|
14094
|
+
measures.forEach(
|
|
14095
|
+
(measure2, m) => append(
|
|
14096
|
+
type ? [
|
|
14097
|
+
`${type === "grand" ? "Total" : String(labels2[0])} ${measure2.caption}`,
|
|
14098
|
+
...Array(rowLabelColumns - 1).fill(null)
|
|
14099
|
+
] : compact3 ? [measure2.caption] : [
|
|
14100
|
+
...labels2.map(
|
|
14101
|
+
(label3) => layout2 === "tabular" && m === 0 || pivot.repeatLabels ? label3 : null
|
|
14102
|
+
),
|
|
14103
|
+
measure2.caption
|
|
13933
14104
|
],
|
|
13934
|
-
|
|
13935
|
-
{ indices: [
|
|
13936
|
-
compact3 ?
|
|
13937
|
-
)
|
|
13938
|
-
|
|
14105
|
+
values3.map((band) => band[m] ?? null),
|
|
14106
|
+
{ indices: type ? indices : [...indices, m], measure: m, ...type ? { type } : {} },
|
|
14107
|
+
compact3 && !type ? 2 : 0
|
|
14108
|
+
)
|
|
14109
|
+
);
|
|
14110
|
+
};
|
|
14111
|
+
if (firstValues)
|
|
14112
|
+
appendFirstPivotValues(pivot, {
|
|
14113
|
+
rowItems,
|
|
14114
|
+
secondRowItems,
|
|
14115
|
+
columnItems,
|
|
14116
|
+
children: children2,
|
|
14117
|
+
innerIndices,
|
|
14118
|
+
groups,
|
|
14119
|
+
details,
|
|
14120
|
+
buckets,
|
|
14121
|
+
width: dimensions.width,
|
|
14122
|
+
rowLabels: rowLabelColumns,
|
|
14123
|
+
top,
|
|
14124
|
+
bottom,
|
|
14125
|
+
append
|
|
13939
14126
|
});
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
|
|
13944
|
-
|
|
13945
|
-
|
|
14127
|
+
else
|
|
14128
|
+
rowItems.forEach((outer, outerIndex) => {
|
|
14129
|
+
const key = pivotValueKey(outer);
|
|
14130
|
+
if (layout2 !== "tabular")
|
|
14131
|
+
append(
|
|
14132
|
+
[label2(outer), ...Array(rowLabelColumns - 1).fill(null)],
|
|
14133
|
+
top ? numbers3([key], groups.get(key) ?? []) : Array(dimensions.width - rowLabelColumns).fill(null),
|
|
14134
|
+
{ indices: [outerIndex] }
|
|
14135
|
+
);
|
|
14136
|
+
let first2 = true;
|
|
14137
|
+
const innerKeys = [...children2.get(key)].sort(
|
|
14138
|
+
(a, b) => innerIndices.get(a) - innerIndices.get(b)
|
|
13946
14139
|
);
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
14140
|
+
if (between)
|
|
14141
|
+
measures.forEach((measure2, m) => {
|
|
14142
|
+
if (layout2 !== "tabular")
|
|
14143
|
+
append(
|
|
14144
|
+
compact3 ? [measure2.caption] : [pivot.repeatLabels ? label2(outer) : null, measure2.caption, null],
|
|
14145
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
14146
|
+
{ indices: [outerIndex, m], measure: m },
|
|
14147
|
+
compact3 ? 1 : 0
|
|
14148
|
+
);
|
|
14149
|
+
innerKeys.forEach((innerKey, child) => {
|
|
14150
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
14151
|
+
const keys = [key, innerKey];
|
|
14152
|
+
const records = details.get(JSON.stringify(keys));
|
|
14153
|
+
append(
|
|
14154
|
+
compact3 ? [label2(secondRowItems[innerIndex])] : [
|
|
14155
|
+
pivot.repeatLabels || layout2 === "tabular" && m === 0 && child === 0 ? label2(outer) : null,
|
|
14156
|
+
layout2 === "tabular" && child === 0 ? measure2.caption : null,
|
|
14157
|
+
label2(secondRowItems[innerIndex])
|
|
14158
|
+
],
|
|
14159
|
+
[
|
|
14160
|
+
...columnItems.map(
|
|
14161
|
+
(column) => pivotMeasureNumber(
|
|
14162
|
+
pivot,
|
|
14163
|
+
buckets.get(JSON.stringify([...keys, pivotValueKey(column)])) ?? [],
|
|
14164
|
+
measure2
|
|
14165
|
+
)
|
|
14166
|
+
),
|
|
14167
|
+
pivotMeasureNumber(pivot, records, measure2)
|
|
14168
|
+
],
|
|
14169
|
+
{ indices: [outerIndex, m, innerIndex], measure: m },
|
|
14170
|
+
compact3 ? 2 : 0
|
|
14171
|
+
);
|
|
14172
|
+
});
|
|
14173
|
+
});
|
|
14174
|
+
else
|
|
14175
|
+
innerKeys.forEach((innerKey) => {
|
|
14176
|
+
const innerIndex = innerIndices.get(innerKey);
|
|
14177
|
+
const inner2 = secondRowItems[innerIndex];
|
|
14178
|
+
const keys = [key, innerKey];
|
|
14179
|
+
const records = details.get(JSON.stringify(keys));
|
|
14180
|
+
if (!records) return;
|
|
14181
|
+
if (rowsAxis) {
|
|
14182
|
+
if (layout2 !== "tabular")
|
|
14183
|
+
append(
|
|
14184
|
+
compact3 ? [label2(inner2)] : [pivot.repeatLabels ? label2(outer) : null, label2(inner2), null],
|
|
14185
|
+
Array(dimensions.width - rowLabelColumns).fill(null),
|
|
14186
|
+
{ indices: [outerIndex, innerIndex] },
|
|
14187
|
+
compact3 ? 1 : 0
|
|
14188
|
+
);
|
|
14189
|
+
appendMeasures(
|
|
14190
|
+
[pivot.repeatLabels || first2 ? label2(outer) : null, label2(inner2)],
|
|
14191
|
+
keys,
|
|
14192
|
+
records,
|
|
14193
|
+
[outerIndex, innerIndex]
|
|
14194
|
+
);
|
|
14195
|
+
first2 = false;
|
|
14196
|
+
return;
|
|
14197
|
+
}
|
|
14198
|
+
append(
|
|
14199
|
+
compact3 ? [label2(inner2)] : [
|
|
14200
|
+
pivot.repeatLabels || layout2 === "tabular" && first2 ? label2(outer) : null,
|
|
14201
|
+
label2(inner2)
|
|
14202
|
+
],
|
|
14203
|
+
numbers3(keys, records),
|
|
14204
|
+
{ indices: [outerIndex, innerIndex] },
|
|
14205
|
+
compact3 ? 1 : 0
|
|
14206
|
+
);
|
|
14207
|
+
first2 = false;
|
|
14208
|
+
});
|
|
14209
|
+
if (bottom) {
|
|
14210
|
+
if (rowsAxis) {
|
|
14211
|
+
appendMeasures([label2(outer)], [key], groups.get(key) ?? [], [outerIndex], "default");
|
|
14212
|
+
return;
|
|
14213
|
+
}
|
|
14214
|
+
const caption = String(label2(outer));
|
|
14215
|
+
append(
|
|
14216
|
+
[`${caption} Total`, ...compact3 ? [] : [null]],
|
|
14217
|
+
numbers3([key], groups.get(key) ?? []),
|
|
14218
|
+
{ indices: [outerIndex], type: "default" }
|
|
14219
|
+
);
|
|
14220
|
+
}
|
|
14221
|
+
});
|
|
14222
|
+
if (rowsAxis) appendMeasures([], [], pivot.records, [0], "grand");
|
|
14223
|
+
else
|
|
14224
|
+
append(["Grand Total", ...compact3 ? [] : [null]], numbers3([], pivot.records), {
|
|
14225
|
+
indices: [0],
|
|
14226
|
+
type: "grand"
|
|
14227
|
+
});
|
|
13953
14228
|
return {
|
|
13954
14229
|
values: values2,
|
|
13955
14230
|
rowItems,
|
|
13956
14231
|
secondRowItems,
|
|
13957
14232
|
columnItems,
|
|
13958
14233
|
rowEntries,
|
|
13959
|
-
firstDataRow
|
|
14234
|
+
firstDataRow,
|
|
13960
14235
|
rowLabelColumns,
|
|
13961
|
-
indents
|
|
14236
|
+
indents,
|
|
14237
|
+
...rowsAxis ? { firstHeaderRow: 1 } : {}
|
|
13962
14238
|
};
|
|
13963
14239
|
}
|
|
13964
14240
|
|
|
13965
14241
|
// xlsx/pivot/aggregate.ts
|
|
13966
|
-
function aggregate2(records, field, type) {
|
|
13967
|
-
if (!records.length) return null;
|
|
13968
|
-
const values2 = records.map((record) => record[field] ?? null);
|
|
13969
|
-
if (type === "count") return values2.filter((value2) => value2 !== null && value2 !== "").length;
|
|
13970
|
-
const error = values2.find(isCellError);
|
|
13971
|
-
if (error) return error;
|
|
13972
|
-
const numbers3 = values2.filter((value2) => typeof value2 === "number");
|
|
13973
|
-
if (!numbers3.length) return type === "average" ? { error: "#DIV/0!" } : 0;
|
|
13974
|
-
if (type === "min") return numbers3.reduce((a, b) => Math.min(a, b));
|
|
13975
|
-
if (type === "max") return numbers3.reduce((a, b) => Math.max(a, b));
|
|
13976
|
-
const sum2 = numbers3.reduce((total2, value2) => total2 + value2, 0);
|
|
13977
|
-
return type === "average" ? sum2 / numbers3.length : sum2;
|
|
13978
|
-
}
|
|
13979
14242
|
function pivotGrid(pivot) {
|
|
13980
14243
|
validatePivotFields(pivot);
|
|
13981
|
-
if (pivot.secondRowField) return hierarchicalPivotGrid(pivot
|
|
14244
|
+
if (pivot.secondRowField) return hierarchicalPivotGrid(pivot);
|
|
13982
14245
|
const rowItems = pivotItems(pivot, pivot.rowField);
|
|
13983
14246
|
const columnItems = pivot.columnField ? pivotItems(pivot, pivot.columnField) : [];
|
|
13984
|
-
|
|
14247
|
+
const rowsAxis = pivot.valuesAxis === "rows";
|
|
14248
|
+
const compact3 = pivot.layout === "compact";
|
|
14249
|
+
const headings = rowsAxis && pivot.layout !== void 0 && pivot.layout !== "tabular";
|
|
14250
|
+
const dimensions = pivotHeaderDimensions(pivot, columnItems.length, rowsAxis && !compact3 ? 2 : 1);
|
|
14251
|
+
const dataRows = (rowItems.length + 1) * (rowsAxis ? 1 + (pivot.additionalValues?.length ?? 0) : 1) + (headings ? rowItems.length : 0);
|
|
14252
|
+
if ((dataRows + dimensions.rows) * dimensions.width > 1e6)
|
|
13985
14253
|
throw new Error("The PivotTable result is too large.");
|
|
14254
|
+
const label3 = pivotItemLabel;
|
|
14255
|
+
const values2 = pivotHeaders(
|
|
14256
|
+
pivot,
|
|
14257
|
+
columnItems,
|
|
14258
|
+
[pivot.layout === "compact" ? "Row Labels" : pivot.rowField],
|
|
14259
|
+
label3
|
|
14260
|
+
);
|
|
13986
14261
|
const rowField = pivot.fields.indexOf(pivot.rowField);
|
|
13987
14262
|
const colField = pivot.columnField ? pivot.fields.indexOf(pivot.columnField) : -1;
|
|
13988
|
-
const valueField = pivot.fields.indexOf(pivot.valueField);
|
|
13989
14263
|
const groups = /* @__PURE__ */ new Map();
|
|
13990
14264
|
const cells = /* @__PURE__ */ new Map();
|
|
13991
14265
|
const columns = /* @__PURE__ */ new Map();
|
|
@@ -14003,44 +14277,104 @@ function pivotGrid(pivot) {
|
|
|
14003
14277
|
collect(cells, JSON.stringify([key, col]), record);
|
|
14004
14278
|
}
|
|
14005
14279
|
}
|
|
14006
|
-
const
|
|
14007
|
-
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14280
|
+
const firstDataRow = values2.length;
|
|
14281
|
+
if (rowsAxis) {
|
|
14282
|
+
const measures = pivotMeasures(pivot);
|
|
14283
|
+
const rowEntries = [];
|
|
14284
|
+
const indents = values2.map(() => 0);
|
|
14285
|
+
const append = (caption, bands, index2, grand = false) => {
|
|
14286
|
+
measures.forEach((measure2, m) => {
|
|
14287
|
+
values2.push([
|
|
14288
|
+
...compact3 ? [grand ? `Total ${measure2.caption}` : measure2.caption] : [
|
|
14289
|
+
grand ? `Total ${measure2.caption}` : pivot.repeatLabels || !headings && m === 0 ? caption : null,
|
|
14290
|
+
grand ? null : measure2.caption
|
|
14291
|
+
],
|
|
14292
|
+
...bands.map((band) => band[m] ?? null)
|
|
14293
|
+
]);
|
|
14294
|
+
indents.push(compact3 && !grand ? 1 : 0);
|
|
14295
|
+
rowEntries.push({
|
|
14296
|
+
indices: grand ? [0] : [index2, m],
|
|
14297
|
+
measure: m,
|
|
14298
|
+
...grand ? { type: "grand" } : {}
|
|
14299
|
+
});
|
|
14300
|
+
});
|
|
14301
|
+
};
|
|
14302
|
+
rowItems.forEach((item, index2) => {
|
|
14303
|
+
const key = pivotValueKey(item);
|
|
14304
|
+
if (headings) {
|
|
14305
|
+
values2.push([label3(item), ...Array(dimensions.width - 1).fill(null)]);
|
|
14306
|
+
rowEntries.push({ indices: [index2] });
|
|
14307
|
+
indents.push(0);
|
|
14308
|
+
}
|
|
14309
|
+
append(
|
|
14310
|
+
label3(item),
|
|
14311
|
+
[
|
|
14312
|
+
...columnItems.map(
|
|
14313
|
+
(col) => pivotNumbers(pivot, cells.get(JSON.stringify([key, pivotValueKey(col)])) ?? [])
|
|
14314
|
+
),
|
|
14315
|
+
pivotNumbers(pivot, groups.get(key) ?? [])
|
|
14316
|
+
],
|
|
14317
|
+
index2
|
|
14318
|
+
);
|
|
14319
|
+
});
|
|
14320
|
+
append(
|
|
14321
|
+
"Grand Total",
|
|
14322
|
+
[
|
|
14323
|
+
...columnItems.map((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
14324
|
+
pivotNumbers(pivot, pivot.records)
|
|
14325
|
+
],
|
|
14326
|
+
0,
|
|
14327
|
+
true
|
|
14328
|
+
);
|
|
14329
|
+
return {
|
|
14330
|
+
values: values2,
|
|
14331
|
+
rowItems,
|
|
14332
|
+
columnItems,
|
|
14333
|
+
firstDataRow,
|
|
14334
|
+
rowLabelColumns: compact3 ? 1 : 2,
|
|
14335
|
+
indents,
|
|
14336
|
+
firstHeaderRow: 1,
|
|
14337
|
+
rowEntries
|
|
14338
|
+
};
|
|
14339
|
+
}
|
|
14020
14340
|
for (const row2 of rowItems) {
|
|
14021
14341
|
const records = groups.get(pivotValueKey(row2)) ?? [];
|
|
14022
14342
|
values2.push([
|
|
14023
14343
|
label3(row2),
|
|
14024
|
-
...columnItems.
|
|
14025
|
-
(col) =>
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
pivot.aggregate
|
|
14344
|
+
...columnItems.flatMap(
|
|
14345
|
+
(col) => pivotNumbers(
|
|
14346
|
+
pivot,
|
|
14347
|
+
cells.get(JSON.stringify([pivotValueKey(row2), pivotValueKey(col)])) ?? []
|
|
14029
14348
|
)
|
|
14030
14349
|
),
|
|
14031
|
-
|
|
14350
|
+
...pivotNumbers(pivot, records)
|
|
14032
14351
|
]);
|
|
14033
14352
|
}
|
|
14034
14353
|
values2.push([
|
|
14035
14354
|
"Grand Total",
|
|
14036
|
-
...columnItems.
|
|
14037
|
-
|
|
14038
|
-
),
|
|
14039
|
-
aggregate2(pivot.records, valueField, pivot.aggregate)
|
|
14355
|
+
...columnItems.flatMap((col) => pivotNumbers(pivot, columns.get(pivotValueKey(col)) ?? [])),
|
|
14356
|
+
...pivotNumbers(pivot, pivot.records)
|
|
14040
14357
|
]);
|
|
14041
|
-
return { values: values2, rowItems, columnItems, firstDataRow
|
|
14358
|
+
return { values: values2, rowItems, columnItems, firstDataRow };
|
|
14042
14359
|
}
|
|
14043
14360
|
|
|
14361
|
+
// xlsx/write/xml-out.ts
|
|
14362
|
+
var CONTROL2 = "\0-\b\v\f-" + String.fromCharCode(65534, 65535);
|
|
14363
|
+
var INVALID_XML = new RegExp(`[${CONTROL2}]`, "g");
|
|
14364
|
+
var escapeText = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
14365
|
+
var escapeAttr = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
14366
|
+
function attrs(values2) {
|
|
14367
|
+
let out = "";
|
|
14368
|
+
for (const [name, value2] of Object.entries(values2)) {
|
|
14369
|
+
if (value2 === void 0) continue;
|
|
14370
|
+
const text2 = typeof value2 === "boolean" ? value2 ? "1" : "0" : typeof value2 === "number" ? num2(value2) : value2;
|
|
14371
|
+
out += ` ${name}="${escapeAttr(text2)}"`;
|
|
14372
|
+
}
|
|
14373
|
+
return out;
|
|
14374
|
+
}
|
|
14375
|
+
var el = (name, values2 = {}, content = "") => content ? `<${name}${attrs(values2)}>${content}</${name}>` : `<${name}${attrs(values2)}/>`;
|
|
14376
|
+
var num2 = (value2) => Object.is(value2, -0) ? "0" : String(value2);
|
|
14377
|
+
|
|
14044
14378
|
// xlsx/read/style-parts.ts
|
|
14045
14379
|
function parseColor(element2, palette) {
|
|
14046
14380
|
if (!element2) return void 0;
|
|
@@ -14074,23 +14408,6 @@ function parseSqref(sqref) {
|
|
|
14074
14408
|
return sqref.split(/\s+/).filter(Boolean).map((part) => parseRange(part)).filter((range2) => range2 !== void 0);
|
|
14075
14409
|
}
|
|
14076
14410
|
|
|
14077
|
-
// xlsx/write/xml-out.ts
|
|
14078
|
-
var CONTROL2 = "\0-\b\v\f-" + String.fromCharCode(65534, 65535);
|
|
14079
|
-
var INVALID_XML = new RegExp(`[${CONTROL2}]`, "g");
|
|
14080
|
-
var escapeText = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
14081
|
-
var escapeAttr = (text2) => text2.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
14082
|
-
function attrs(values2) {
|
|
14083
|
-
let out = "";
|
|
14084
|
-
for (const [name, value2] of Object.entries(values2)) {
|
|
14085
|
-
if (value2 === void 0) continue;
|
|
14086
|
-
const text2 = typeof value2 === "boolean" ? value2 ? "1" : "0" : typeof value2 === "number" ? num2(value2) : value2;
|
|
14087
|
-
out += ` ${name}="${escapeAttr(text2)}"`;
|
|
14088
|
-
}
|
|
14089
|
-
return out;
|
|
14090
|
-
}
|
|
14091
|
-
var el = (name, values2 = {}, content = "") => content ? `<${name}${attrs(values2)}>${content}</${name}>` : `<${name}${attrs(values2)}/>`;
|
|
14092
|
-
var num2 = (value2) => Object.is(value2, -0) ? "0" : String(value2);
|
|
14093
|
-
|
|
14094
14411
|
// xlsx/conditional-extensions.ts
|
|
14095
14412
|
var XM = "http://schemas.microsoft.com/office/excel/2006/main";
|
|
14096
14413
|
function dataBarLengths(rule, node) {
|
|
@@ -18863,12 +19180,16 @@ function write(ctx, s, pivot, old) {
|
|
|
18863
19180
|
],
|
|
18864
19181
|
() => {
|
|
18865
19182
|
const compact3 = pivot.layout === "compact";
|
|
18866
|
-
const indents =
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
19183
|
+
const indents = new Map(
|
|
19184
|
+
[.../* @__PURE__ */ new Set([0, ...grid6.indents ?? []])].map(
|
|
19185
|
+
(indent) => [
|
|
19186
|
+
indent,
|
|
19187
|
+
stylePatcher(ctx.workbook, {
|
|
19188
|
+
alignment: { indent, ...compact3 || indent > 0 ? { horizontal: "left" } : {} }
|
|
19189
|
+
})
|
|
19190
|
+
]
|
|
19191
|
+
)
|
|
19192
|
+
);
|
|
18872
19193
|
const styles = /* @__PURE__ */ new Map();
|
|
18873
19194
|
forEachCellInRange(sheet, location, (cell, row2, col) => {
|
|
18874
19195
|
if (cell.styleId !== void 0) styles.set(`${row2}:${col}`, cell.styleId);
|
|
@@ -18891,7 +19212,7 @@ function write(ctx, s, pivot, old) {
|
|
|
18891
19212
|
const indent = col === 0 ? grid6.indents?.[row2] ?? 0 : 0;
|
|
18892
19213
|
const alignment = styleAt(ctx.workbook, styleId).alignment;
|
|
18893
19214
|
if ((alignment?.indent ?? 0) !== indent || compact3 && alignment?.horizontal !== "left")
|
|
18894
|
-
styleId = indents
|
|
19215
|
+
styleId = indents.get(indent)(styleId);
|
|
18895
19216
|
}
|
|
18896
19217
|
putCell(sheet, r, c, { value: value2, ...styleId !== void 0 ? { styleId } : {} });
|
|
18897
19218
|
})
|
|
@@ -18918,6 +19239,9 @@ function createPivotTable(ctx, s, destination, options) {
|
|
|
18918
19239
|
valueField: options.valueField,
|
|
18919
19240
|
aggregate: aggregate3,
|
|
18920
19241
|
valueCaption: pivotCaption(aggregate3, options.valueField),
|
|
19242
|
+
...options.valuesAxis !== void 0 ? { valuesAxis: options.valuesAxis } : {},
|
|
19243
|
+
...options.valuesPosition !== void 0 ? { valuesPosition: options.valuesPosition } : {},
|
|
19244
|
+
...options.additionalValues ? { additionalValues: normalizedPivotMeasures(options.additionalValues) } : {},
|
|
18921
19245
|
location: { start: { ...destination }, end: { ...destination } },
|
|
18922
19246
|
...options.columnField ? { columnField: options.columnField } : {}
|
|
18923
19247
|
};
|
|
@@ -18949,6 +19273,15 @@ function refreshPivotTable(ctx, s, name, patch2 = {}) {
|
|
|
18949
19273
|
if (patch2.repeatLabels !== void 0) next.repeatLabels = patch2.repeatLabels;
|
|
18950
19274
|
if (patch2.layout !== void 0) next.layout = patch2.layout;
|
|
18951
19275
|
if (patch2.subtotalPosition !== void 0) next.subtotalPosition = patch2.subtotalPosition;
|
|
19276
|
+
if (patch2.valuesAxis !== void 0) next.valuesAxis = patch2.valuesAxis;
|
|
19277
|
+
if (patch2.valuesPosition !== void 0) next.valuesPosition = patch2.valuesPosition;
|
|
19278
|
+
else if (patch2.valuesAxis === "columns" || patch2.secondRowField === "")
|
|
19279
|
+
delete next.valuesPosition;
|
|
19280
|
+
if (patch2.additionalValues !== void 0) {
|
|
19281
|
+
const measures = normalizedPivotMeasures(patch2.additionalValues);
|
|
19282
|
+
if (measures.length) next.additionalValues = measures;
|
|
19283
|
+
else delete next.additionalValues;
|
|
19284
|
+
}
|
|
18952
19285
|
validatePivotFields(next);
|
|
18953
19286
|
write(ctx, s, next, old);
|
|
18954
19287
|
}
|
|
@@ -28444,6 +28777,93 @@ var SPARKLINE_STRINGS = {
|
|
|
28444
28777
|
|
|
28445
28778
|
// xlsx/ui/commands/i18n/pivots.ts
|
|
28446
28779
|
var PIVOT_STRINGS = {
|
|
28780
|
+
"Before row fields": [
|
|
28781
|
+
"Avant les champs de ligne",
|
|
28782
|
+
"Vor den Zeilenfeldern",
|
|
28783
|
+
"Antes de los campos de fila",
|
|
28784
|
+
"\u884C\u5B57\u6BB5\u4E4B\u524D"
|
|
28785
|
+
],
|
|
28786
|
+
"Values are listed before the row fields.": [
|
|
28787
|
+
"Les valeurs sont affich\xE9es avant les champs de ligne.",
|
|
28788
|
+
"Werte werden vor den Zeilenfeldern aufgef\xFChrt.",
|
|
28789
|
+
"Los valores aparecen antes de los campos de fila.",
|
|
28790
|
+
"\u503C\u5217\u5728\u884C\u5B57\u6BB5\u4E4B\u524D\u3002"
|
|
28791
|
+
],
|
|
28792
|
+
"Values Placement:": [
|
|
28793
|
+
"Position des valeurs :",
|
|
28794
|
+
"Anordnung der Werte:",
|
|
28795
|
+
"Posici\xF3n de los valores:",
|
|
28796
|
+
"\u503C\u4F4D\u7F6E\uFF1A"
|
|
28797
|
+
],
|
|
28798
|
+
"After row fields": [
|
|
28799
|
+
"Apr\xE8s les champs de ligne",
|
|
28800
|
+
"Nach den Zeilenfeldern",
|
|
28801
|
+
"Despu\xE9s de los campos de fila",
|
|
28802
|
+
"\u884C\u5B57\u6BB5\u4E4B\u540E"
|
|
28803
|
+
],
|
|
28804
|
+
"Between row fields": [
|
|
28805
|
+
"Entre les champs de ligne",
|
|
28806
|
+
"Zwischen den Zeilenfeldern",
|
|
28807
|
+
"Entre los campos de fila",
|
|
28808
|
+
"\u884C\u5B57\u6BB5\u4E4B\u95F4"
|
|
28809
|
+
],
|
|
28810
|
+
"Values are listed between the row fields.": [
|
|
28811
|
+
"Les valeurs sont affich\xE9es entre les champs de ligne.",
|
|
28812
|
+
"Werte werden zwischen den Zeilenfeldern aufgef\xFChrt.",
|
|
28813
|
+
"Los valores aparecen entre los campos de fila.",
|
|
28814
|
+
"\u503C\u5217\u5728\u884C\u5B57\u6BB5\u4E4B\u95F4\u3002"
|
|
28815
|
+
],
|
|
28816
|
+
"Values Axis:": ["Axe des valeurs :", "Werteachse:", "Eje de valores:", "\u503C\u8F74\uFF1A"],
|
|
28817
|
+
"Values on Columns": [
|
|
28818
|
+
"Valeurs en colonnes",
|
|
28819
|
+
"Werte in Spalten",
|
|
28820
|
+
"Valores en columnas",
|
|
28821
|
+
"\u503C\u663E\u793A\u5728\u5217\u4E0A"
|
|
28822
|
+
],
|
|
28823
|
+
"Values on Rows": ["Valeurs en lignes", "Werte in Zeilen", "Valores en filas", "\u503C\u663E\u793A\u5728\u884C\u4E0A"],
|
|
28824
|
+
"Values are listed after the row fields.": [
|
|
28825
|
+
"Les valeurs sont affich\xE9es apr\xE8s les champs de ligne.",
|
|
28826
|
+
"Werte werden nach den Zeilenfeldern aufgef\xFChrt.",
|
|
28827
|
+
"Los valores aparecen despu\xE9s de los campos de fila.",
|
|
28828
|
+
"\u503C\u5217\u5728\u884C\u5B57\u6BB5\u4E4B\u540E\u3002"
|
|
28829
|
+
],
|
|
28830
|
+
"Values on rows display subtotals below groups.": [
|
|
28831
|
+
"Les valeurs en lignes affichent les sous-totaux sous les groupes.",
|
|
28832
|
+
"Werte in Zeilen zeigen Teilergebnisse unter den Gruppen an.",
|
|
28833
|
+
"Los valores en filas muestran los subtotales debajo de los grupos.",
|
|
28834
|
+
"\u884C\u4E0A\u7684\u503C\u5C06\u5206\u7C7B\u6C47\u603B\u663E\u793A\u5728\u7EC4\u4E0B\u65B9\u3002"
|
|
28835
|
+
],
|
|
28836
|
+
"Multiple value fields use Values on columns.": [
|
|
28837
|
+
"Plusieurs champs de valeur utilisent les valeurs en colonnes.",
|
|
28838
|
+
"Mehrere Wertfelder verwenden Werte in Spalten.",
|
|
28839
|
+
"Varios campos de valor usan Valores en columnas.",
|
|
28840
|
+
"\u591A\u4E2A\u503C\u5B57\u6BB5\u7684\u503C\u4F4D\u4E8E\u5217\u8F74\u4E0A\u3002"
|
|
28841
|
+
],
|
|
28842
|
+
"Add Value Field": [
|
|
28843
|
+
"Ajouter un champ de valeur",
|
|
28844
|
+
"Wertfeld hinzuf\xFCgen",
|
|
28845
|
+
"A\xF1adir campo de valor",
|
|
28846
|
+
"\u6DFB\u52A0\u503C\u5B57\u6BB5"
|
|
28847
|
+
],
|
|
28848
|
+
"Remove Value Field": [
|
|
28849
|
+
"Supprimer le champ de valeur",
|
|
28850
|
+
"Wertfeld entfernen",
|
|
28851
|
+
"Quitar campo de valor",
|
|
28852
|
+
"\u5220\u9664\u503C\u5B57\u6BB5"
|
|
28853
|
+
],
|
|
28854
|
+
"Additional Value Field": [
|
|
28855
|
+
"Champ de valeur suppl\xE9mentaire",
|
|
28856
|
+
"Zus\xE4tzliches Wertfeld",
|
|
28857
|
+
"Campo de valor adicional",
|
|
28858
|
+
"\u9644\u52A0\u503C\u5B57\u6BB5"
|
|
28859
|
+
],
|
|
28860
|
+
"Value Caption:": ["Libell\xE9 de valeur :", "Wertbeschriftung:", "T\xEDtulo del valor:", "\u503C\u6807\u9898\uFF1A"],
|
|
28861
|
+
"Multiple value fields use tabular layout with Values on columns.": [
|
|
28862
|
+
"Plusieurs champs de valeur utilisent la forme tabulaire avec les valeurs en colonnes.",
|
|
28863
|
+
"Mehrere Wertfelder verwenden das Tabellenformat mit Werten in Spalten.",
|
|
28864
|
+
"Varios campos de valor usan el formato tabular con Valores en columnas.",
|
|
28865
|
+
"\u591A\u4E2A\u503C\u5B57\u6BB5\u4F7F\u7528\u8868\u683C\u5E03\u5C40\uFF0C\u503C\u4F4D\u4E8E\u5217\u8F74\u4E0A\u3002"
|
|
28866
|
+
],
|
|
28447
28867
|
"Compact Form": ["Forme compacte", "Kompaktformat", "Formato compacto", "\u538B\u7F29\u5F62\u5F0F"],
|
|
28448
28868
|
"Outline Form": ["Forme de plan", "Gliederungsformat", "Formato de esquema", "\u5927\u7EB2\u5F62\u5F0F"],
|
|
28449
28869
|
"Tabular Form": ["Forme tabulaire", "Tabellenformat", "Formato tabular", "\u8868\u683C\u5F62\u5F0F"],
|