@office-open/xlsx 0.10.11 → 0.10.13
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/chart.d.mts +1 -0
- package/dist/chart.mjs +2 -0
- package/dist/{comments-BTMAAMY4.mjs → comments-HOkY82qH.mjs} +22 -18
- package/dist/comments-HOkY82qH.mjs.map +1 -0
- package/dist/{context-D_9UIEwJ.mjs → context-DqcvNJ7Y.mjs} +18 -17
- package/dist/context-DqcvNJ7Y.mjs.map +1 -0
- package/dist/drawingml.d.mts +1 -0
- package/dist/drawingml.mjs +2 -0
- package/dist/{generate-Dsk7XzIC.mjs → generate-qrZS3qhj.mjs} +48 -49
- package/dist/generate-qrZS3qhj.mjs.map +1 -0
- package/dist/generate.mjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/parse.mjs +5 -6
- package/dist/parse.mjs.map +1 -1
- package/dist/patch.mjs +3 -3
- package/dist/patch.mjs.map +1 -1
- package/dist/smartart.d.mts +1 -0
- package/dist/smartart.mjs +2 -0
- package/dist/worksheet-C9CP2B97.d.mts.map +1 -1
- package/package.json +16 -3
- package/dist/comments-BTMAAMY4.mjs.map +0 -1
- package/dist/context-D_9UIEwJ.mjs.map +0 -1
- package/dist/generate-Dsk7XzIC.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as SharedStrings } from "./comments-
|
|
1
|
+
import { a as SharedStrings } from "./comments-HOkY82qH.mjs";
|
|
2
2
|
import { attr, attrNum, attrs, children, escapeXml, findChild, stringify, textOf } from "@office-open/xml";
|
|
3
3
|
import { ChartCollection, Media, Relationships, convertToEmu, convertToInch, derivePasswordHash } from "@office-open/core";
|
|
4
4
|
//#region src/parts/styles.ts
|
|
@@ -188,7 +188,7 @@ var Styles = class {
|
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* Zero-allocation fast path: directly concatenate XML string.
|
|
191
|
-
* Bypasses the
|
|
191
|
+
* Bypasses the intermediate object tree entirely.
|
|
192
192
|
*/
|
|
193
193
|
/** Serialize to xl/styles.xml content (without XML declaration). */
|
|
194
194
|
serialize() {
|
|
@@ -1275,7 +1275,7 @@ function collectUniqueValues(records, fieldIdx) {
|
|
|
1275
1275
|
const key = val instanceof Date ? val.toISOString() : String(val);
|
|
1276
1276
|
if (!seen.has(key)) {
|
|
1277
1277
|
seen.add(key);
|
|
1278
|
-
result.push(val);
|
|
1278
|
+
result.push(val ?? null);
|
|
1279
1279
|
}
|
|
1280
1280
|
}
|
|
1281
1281
|
return result;
|
|
@@ -1856,7 +1856,7 @@ function buildRowItems(sd, rowIndices) {
|
|
|
1856
1856
|
const allUniqueCounts = [];
|
|
1857
1857
|
for (const idx of rowIndices) allUniqueCounts.push(collectUniqueValues(sd.records, idx).length);
|
|
1858
1858
|
if (rowIndices.length === 1) {
|
|
1859
|
-
const count = allUniqueCounts[0];
|
|
1859
|
+
const count = allUniqueCounts[0] ?? 0;
|
|
1860
1860
|
const parts = [`<rowItems count="${count + 1}">`];
|
|
1861
1861
|
for (let i = 0; i < count; i++) parts.push(`<i><x v="${i}"/></i>`);
|
|
1862
1862
|
parts.push(`<i t="grand"><x/></i>`);
|
|
@@ -1895,12 +1895,11 @@ function buildColItems(sd, colIndices, dataFields) {
|
|
|
1895
1895
|
function buildDataFields(dataFields, dataFieldIndices) {
|
|
1896
1896
|
if (dataFields.length === 0) return "<dataFields count=\"0\"/>";
|
|
1897
1897
|
const parts = [`<dataFields count="${dataFields.length}">`];
|
|
1898
|
-
for (
|
|
1899
|
-
const df = dataFields[i];
|
|
1898
|
+
for (const [i, df] of dataFields.entries()) {
|
|
1900
1899
|
const subtotal = df.summarize ?? "sum";
|
|
1901
1900
|
const dfAttrs = [
|
|
1902
1901
|
`name="${escapeXml(df.name ?? `${subtotal === "sum" ? "Sum" : subtotal} of ${df.field}`)}"`,
|
|
1903
|
-
`fld="${dataFieldIndices[i]}"`,
|
|
1902
|
+
`fld="${dataFieldIndices[i] ?? 0}"`,
|
|
1904
1903
|
`subtotal="${subtotal}"`
|
|
1905
1904
|
];
|
|
1906
1905
|
if (df.showDataAs) dfAttrs.push(`showDataAs="${df.showDataAs}"`);
|
|
@@ -1912,15 +1911,17 @@ function buildDataFields(dataFields, dataFieldIndices) {
|
|
|
1912
1911
|
return parts.join("");
|
|
1913
1912
|
}
|
|
1914
1913
|
function computeLocationRef(sd, location, rowFieldIndices, colFieldIndices, dataFields) {
|
|
1915
|
-
const match = location.split(":")[0].match(/^([A-Z]+)(\d+)$/);
|
|
1914
|
+
const match = (location.split(":")[0] ?? location).match(/^([A-Z]+)(\d+)$/);
|
|
1916
1915
|
if (!match) return location;
|
|
1917
|
-
const startCol = match[1];
|
|
1918
|
-
const startRow = parseInt(match[2], 10);
|
|
1916
|
+
const startCol = match[1] ?? "";
|
|
1917
|
+
const startRow = parseInt(match[2] ?? "0", 10);
|
|
1919
1918
|
let rowCount = 1;
|
|
1920
|
-
|
|
1919
|
+
const rowFieldIndex0 = rowFieldIndices[0];
|
|
1920
|
+
if (rowFieldIndex0 !== void 0) rowCount += collectUniqueValues(sd.records, rowFieldIndex0).length;
|
|
1921
1921
|
rowCount += 1;
|
|
1922
1922
|
let colCount = Math.max(rowFieldIndices.length, 1);
|
|
1923
|
-
|
|
1923
|
+
const colFieldIndex0 = colFieldIndices[0];
|
|
1924
|
+
if (colFieldIndex0 !== void 0) colCount += collectUniqueValues(sd.records, colFieldIndex0).length;
|
|
1924
1925
|
else if (dataFields.length > 1) colCount += dataFields.length - 1;
|
|
1925
1926
|
colCount += 1;
|
|
1926
1927
|
return `${startCol}${startRow}:${colIndexToLetter(letterToColIndex(startCol) + colCount - 1)}${startRow + rowCount - 1}`;
|
|
@@ -2214,7 +2215,7 @@ function stringifyPivotCacheDef(sourceRef, sourceSheet, sourceData, recordsRid,
|
|
|
2214
2215
|
const fieldNames = sourceData.fieldNames;
|
|
2215
2216
|
p.push(`<cacheFields count="${fieldNames.length}">`);
|
|
2216
2217
|
for (let i = 0; i < fieldNames.length; i++) {
|
|
2217
|
-
const fieldName = fieldNames[i];
|
|
2218
|
+
const fieldName = fieldNames[i] ?? "";
|
|
2218
2219
|
const numeric = isNumericField(sourceData.records, i);
|
|
2219
2220
|
const uniqueVals = collectUniqueValues(sourceData.records, i);
|
|
2220
2221
|
if (numeric) {
|
|
@@ -2513,7 +2514,7 @@ function stringifyPivotCacheRecords(sourceData) {
|
|
|
2513
2514
|
if (val === null) p.push("<m/>");
|
|
2514
2515
|
else if (val instanceof Date) p.push(`<d v="${val.toISOString().replace(/\.\d{3}Z$/, "Z")}"/>`);
|
|
2515
2516
|
else if (numericFields[i]) p.push(`<n v="${val}"/>`);
|
|
2516
|
-
else p.push(`<x v="${fieldIndexMaps[i]
|
|
2517
|
+
else p.push(`<x v="${fieldIndexMaps[i]?.get(String(val)) ?? 0}"/>`);
|
|
2517
2518
|
}
|
|
2518
2519
|
p.push("</r>");
|
|
2519
2520
|
}
|
|
@@ -2575,8 +2576,7 @@ const tableDesc = {
|
|
|
2575
2576
|
p.push(`<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="xr xr2" xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision" xmlns:xr2="http://schemas.microsoft.com/office/spreadsheetml/2015/revision2"${buildAttrs(rootAttrs)}>`);
|
|
2576
2577
|
if (o.autoFilter !== void 0) p.push(`<autoFilter ref="${escapeXml(o.autoFilter)}"/>`);
|
|
2577
2578
|
p.push(`<tableColumns count="${o.columns.length}">`);
|
|
2578
|
-
for (
|
|
2579
|
-
const col = o.columns[i];
|
|
2579
|
+
for (const [i, col] of o.columns.entries()) {
|
|
2580
2580
|
const colAttrs = {
|
|
2581
2581
|
id: i + 1,
|
|
2582
2582
|
name: col.name
|
|
@@ -4065,6 +4065,7 @@ var XlsxReadContext = class {
|
|
|
4065
4065
|
const { cellXfs, fonts, fills, borders, customNumFmtById } = ps;
|
|
4066
4066
|
if (!cellXfs || styleIndex >= cellXfs.length) return void 0;
|
|
4067
4067
|
const xf = cellXfs[styleIndex];
|
|
4068
|
+
if (!xf) return void 0;
|
|
4068
4069
|
const result = {};
|
|
4069
4070
|
const fontId = xf.fontId;
|
|
4070
4071
|
if (fontId !== void 0 && fonts && fontId < fonts.length) result.font = fonts[fontId];
|
|
@@ -4102,4 +4103,4 @@ function resolveWsTarget(wsPath, target) {
|
|
|
4102
4103
|
//#endregion
|
|
4103
4104
|
export { Styles as C, calcChainDesc as S, aggregate as _, usersDesc as a, drawingDesc as b, buildTablePartsXml as c, TotalsRowFunction as d, tableDesc as f, PivotFilterType as g, pivotTableDesc as h, revisionLogDesc as i, workbookDesc as l, pivotCacheRecordsDesc as m, XlsxWriteContext as n, Media as o, pivotCacheDefDesc as p, revisionHeadersDesc as r, buildExternalReferencesXml as s, XlsxReadContext as t, TableType as u, collectUniqueValues as v, stylesDesc as w, chartsheetDesc as x, externalLinkDesc as y };
|
|
4104
4105
|
|
|
4105
|
-
//# sourceMappingURL=context-
|
|
4106
|
+
//# sourceMappingURL=context-DqcvNJ7Y.mjs.map
|