@office-open/xlsx 0.10.12 → 0.10.14

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.
@@ -0,0 +1 @@
1
+ export * from "@office-open/core/chart";
package/dist/chart.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export * from "@office-open/core/chart";
2
+ export {};
@@ -87,12 +87,12 @@ var SharedStrings = class {
87
87
  toDescriptorOptions() {
88
88
  return {
89
89
  entries: this.entries,
90
- uniqueCount: this.indexMap.size
90
+ uniqueCount: this.entries.length
91
91
  };
92
92
  }
93
93
  /** Serialize to xl/sharedStrings.xml content (without XML declaration). */
94
94
  serialize() {
95
- const p = ["<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"", ` count="${this.entries.length}" uniqueCount="${this.indexMap.size}">`];
95
+ const p = ["<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"", ` count="${this.entries.length}" uniqueCount="${this.entries.length}">`];
96
96
  for (const entry of this.entries) if (typeof entry === "string") p.push(`<si><t>${escapeXml(entry)}</t></si>`);
97
97
  else p.push(`<si>${buildRstXml$1(entry)}</si>`);
98
98
  p.push("</sst>");
@@ -418,8 +418,8 @@ const worksheetDesc = {
418
418
  if (mEl.name !== "mergeCell") continue;
419
419
  const parts = (attr(mEl, "ref") ?? "").split(":");
420
420
  if (parts.length === 2) {
421
- const from = parseCellRef(parts[0]);
422
- const to = parseCellRef(parts[1]);
421
+ const from = parseCellRef(parts[0] ?? "");
422
+ const to = parseCellRef(parts[1] ?? "");
423
423
  if (from && to) merges.push({
424
424
  from,
425
425
  to
@@ -717,7 +717,7 @@ const worksheetDesc = {
717
717
  * Build the complete worksheet XML string.
718
718
  *
719
719
  * Zero-allocation fast path: directly concatenates XML string,
720
- * bypassing the IXmlableObject intermediate tree entirely.
720
+ * bypassing the intermediate object tree entirely.
721
721
  */
722
722
  function stringifyWorksheet(opts, ctx) {
723
723
  const sharedStrings = ctx.sharedStrings;
@@ -837,8 +837,7 @@ function stringifyWorksheet(opts, ctx) {
837
837
  p.push("</cols>");
838
838
  }
839
839
  p.push("<sheetData>");
840
- for (let i = 0; i < rows.length; i++) {
841
- const rowOpts = rows[i];
840
+ for (const [i, rowOpts] of rows.entries()) {
842
841
  const rowNumber = rowOpts.rowNumber ?? i + 1;
843
842
  const rowAttrs = { r: rowNumber };
844
843
  if (rowOpts.height !== void 0) {
@@ -853,8 +852,7 @@ function stringifyWorksheet(opts, ctx) {
853
852
  if (rowOpts.ph) rowAttrs.ph = 1;
854
853
  if (rowOpts.cells) {
855
854
  p.push(`<row${attrsRaw(rowAttrs)}>`);
856
- for (let j = 0; j < rowOpts.cells.length; j++) {
857
- const cell = rowOpts.cells[j];
855
+ for (const [j, cell] of rowOpts.cells.entries()) {
858
856
  const cellStr = buildCellString(cell.reference ?? defaultCellRef(rowNumber, j + 1), cell, sharedStrings, styles);
859
857
  if (cellStr) p.push(cellStr);
860
858
  }
@@ -868,26 +866,34 @@ function stringifyWorksheet(opts, ctx) {
868
866
  p.push(`<sheetCalcPr${scAttrs.length ? " " + scAttrs.join(" ") : ""}/>`);
869
867
  }
870
868
  if (rowBreaks.length > 0) {
869
+ let manualCount = 0;
871
870
  const brkParts = rowBreaks.map((b) => {
872
871
  const bAttrs = { id: b.id };
873
872
  if (b.min !== void 0) bAttrs.min = b.min;
874
873
  if (b.max !== void 0) bAttrs.max = b.max;
875
- if (b.manual) bAttrs.man = 1;
874
+ if (b.manual) {
875
+ bAttrs.man = 1;
876
+ manualCount++;
877
+ }
876
878
  if (b.pivot) bAttrs.pt = 1;
877
879
  return `<brk${attrs(bAttrs)}/>`;
878
880
  });
879
- p.push(`<rowBreaks count="${rowBreaks.length}" manualBreakCount="${rowBreaks.filter((b) => b.manual).length}">${brkParts.join("")}</rowBreaks>`);
881
+ p.push(`<rowBreaks count="${rowBreaks.length}" manualBreakCount="${manualCount}">${brkParts.join("")}</rowBreaks>`);
880
882
  }
881
883
  if (colBreaks.length > 0) {
884
+ let manualCount = 0;
882
885
  const brkParts = colBreaks.map((b) => {
883
886
  const bAttrs = { id: b.id };
884
887
  if (b.min !== void 0) bAttrs.min = b.min;
885
888
  if (b.max !== void 0) bAttrs.max = b.max;
886
- if (b.manual) bAttrs.man = 1;
889
+ if (b.manual) {
890
+ bAttrs.man = 1;
891
+ manualCount++;
892
+ }
887
893
  if (b.pivot) bAttrs.pt = 1;
888
894
  return `<brk${attrs(bAttrs)}/>`;
889
895
  });
890
- p.push(`<colBreaks count="${colBreaks.length}" manualBreakCount="${colBreaks.filter((b) => b.manual).length}">${brkParts.join("")}</colBreaks>`);
896
+ p.push(`<colBreaks count="${colBreaks.length}" manualBreakCount="${manualCount}">${brkParts.join("")}</colBreaks>`);
891
897
  }
892
898
  if (customProperties.length > 0) {
893
899
  const cpParts = ["<customProperties>"];
@@ -1120,8 +1126,7 @@ function stringifyWorksheet(opts, ctx) {
1120
1126
  const conditionalFormats = opts.conditionalFormats ?? [];
1121
1127
  if (conditionalFormats.length > 0) for (const cf of conditionalFormats) {
1122
1128
  p.push(`<conditionalFormatting sqref="${cf.sqref}">`);
1123
- for (let ri = 0; ri < cf.rules.length; ri++) {
1124
- const rule = cf.rules[ri];
1129
+ for (const [ri, rule] of cf.rules.entries()) {
1125
1130
  const ruleAttrs = {
1126
1131
  type: rule.type,
1127
1132
  priority: rule.priority ?? ri + 1
@@ -1522,8 +1527,8 @@ function parseCfvo(el) {
1522
1527
  function parseCellRef(ref) {
1523
1528
  const match = ref.match(/^([A-Z]+)(\d+)$/);
1524
1529
  if (!match) return void 0;
1525
- const colStr = match[1];
1526
- const row = parseInt(match[2], 10);
1530
+ const colStr = match[1] ?? "";
1531
+ const row = parseInt(match[2] ?? "0", 10);
1527
1532
  let col = 0;
1528
1533
  for (let i = 0; i < colStr.length; i++) col = col * 26 + (colStr.charCodeAt(i) - 64);
1529
1534
  return {
@@ -1588,8 +1593,7 @@ const vmlNotesDesc = {
1588
1593
  "<v:path gradientshapeok=\"t\" o:connecttype=\"rect\"/>",
1589
1594
  "</v:shapetype>"
1590
1595
  ];
1591
- for (let i = 0; i < opts.comments.length; i++) {
1592
- const c = opts.comments[i];
1596
+ for (const [i, c] of opts.comments.entries()) {
1593
1597
  const { col, row } = cellRefToVmlCoords(c.cell);
1594
1598
  const anchor = `${col}, 0, ${row}, 0, ${col + 2}, 0, ${row + 2}, 0`;
1595
1599
  p.push(`<v:shape id="_x0000_s${1025 + i}" type="#_x0000_t202" style="position:absolute;margin-left:59.25pt;margin-top:1.5pt;width:108pt;height:59.25pt;z-index:1;visibility:hidden" fillcolor="infoBackground [80]" strokecolor="none [81]" o:insetmode="auto">`, `<v:fill color2="infoBackground [80]"/>`, `<v:shadow color="none [81]" obscured="t"/>`, `<v:path o:connecttype="none"/>`, `<v:textbox style="mso-direction-alt:auto"><div style="text-align:left"></div></v:textbox>`, `<x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/>`, `<x:Anchor>${anchor}</x:Anchor>`, `<x:AutoFill>False</x:AutoFill>`, `<x:Row>${row}</x:Row>`, `<x:Column>${col}</x:Column>`, `</x:ClientData>`, `</v:shape>`);
@@ -1737,4 +1741,4 @@ function parseRst(textEl) {
1737
1741
  //#endregion
1738
1742
  export { SharedStrings as a, worksheetDesc as i, vmlNotesDesc as n, sharedStringsDesc as o, stringifyWorksheet as r, commentsDesc as t };
1739
1743
 
1740
- //# sourceMappingURL=comments-BTMAAMY4.mjs.map
1744
+ //# sourceMappingURL=comments-Bvfeh76o.mjs.map