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