@evotecit/officeimo 0.1.19 → 0.1.21

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.
Files changed (42) hide show
  1. package/README.md +6 -3
  2. package/bundles/officeimo-canopyx-adapter.js +121 -59
  3. package/bundles/officeimo-canopyx-adapter.min.js +1 -1
  4. package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
  5. package/bundles/officeimo-canopyx-adapter.mjs +108 -47
  6. package/bundles/officeimo-canopyx.js +177 -100
  7. package/bundles/officeimo-canopyx.min.js +1 -1
  8. package/bundles/officeimo-canopyx.min.mjs +1 -1
  9. package/bundles/officeimo-canopyx.mjs +144 -68
  10. package/bundles/officeimo-datatables-adapter.js +7 -7
  11. package/bundles/officeimo-datatables-adapter.min.js +1 -1
  12. package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
  13. package/bundles/officeimo-datatables-adapter.mjs +3 -3
  14. package/bundles/officeimo-datatables.js +63 -48
  15. package/bundles/officeimo-datatables.min.js +1 -1
  16. package/bundles/officeimo-datatables.min.mjs +1 -1
  17. package/bundles/officeimo-datatables.mjs +39 -24
  18. package/bundles/officeimo-xlsx.js +59 -44
  19. package/bundles/officeimo-xlsx.min.js +1 -1
  20. package/bundles/officeimo-xlsx.min.mjs +1 -1
  21. package/bundles/officeimo-xlsx.mjs +39 -24
  22. package/bundles/officeimo.js +61 -46
  23. package/bundles/officeimo.min.js +1 -1
  24. package/bundles/officeimo.min.mjs +1 -1
  25. package/bundles/officeimo.mjs +40 -25
  26. package/dist/integrations/canopyx/index.js +4 -2
  27. package/dist/integrations/canopyx/pdf-number.js +9 -6
  28. package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
  29. package/dist/integrations/canopyx/rule-predicates.js +2 -1
  30. package/dist/integrations/canopyx/rules.d.ts +1 -1
  31. package/dist/integrations/canopyx/rules.js +11 -13
  32. package/dist/integrations/canopyx/source.js +44 -7
  33. package/dist/integrations/canopyx/tones.d.ts +10 -0
  34. package/dist/integrations/canopyx/tones.js +12 -0
  35. package/dist/integrations/canopyx/types.d.ts +8 -1
  36. package/dist/xlsx/options.js +1 -1
  37. package/dist/xlsx/portable.js +1 -1
  38. package/dist/xlsx/styles.js +28 -18
  39. package/dist/xlsx/types.d.ts +5 -1
  40. package/dist/xlsx/workbook.js +3 -1
  41. package/dist/xlsx/worksheet.js +5 -2
  42. package/package.json +1 -1
@@ -6,7 +6,7 @@ import type { Compression } from "../zip/index.js";
6
6
  import type { PackagePart, Relationship } from "../opc/index.js";
7
7
  import type { CoreProperties, AppProperties } from "../opc/index.js";
8
8
  import type { Cell } from "./values.js";
9
- import type { CellStyle } from "./styles.js";
9
+ import type { Border, CellStyle } from "./styles.js";
10
10
  import type { Hyperlink } from "./attachments.js";
11
11
  import type { ExportValue } from "../core/presentation.js";
12
12
  import type { ConditionalFormat } from "./conditional-types.js";
@@ -118,6 +118,10 @@ export interface SheetOptions<T = never> {
118
118
  readonly autoFilter?: boolean;
119
119
  readonly boldHeader?: boolean;
120
120
  readonly headerFill?: string;
121
+ /** Header-row border edges, for example a thin bottom rule under the headings. Ignored when headerStyle is set. */
122
+ readonly headerBorder?: Border;
123
+ /** Wrap every header cell; omitted, a header wraps only when its column does. Ignored when headerStyle is set. */
124
+ readonly headerWrap?: boolean;
121
125
  readonly headerStyle?: number;
122
126
  /** Presentation patches retain column number/date formats. The second data row gets this patch first. */
123
127
  readonly alternatingRowStyle?: CellStyle;
@@ -5,7 +5,7 @@ import { ChunkedTextSink } from "../core/sinks.js";
5
5
  import { ExportBudget } from "../core/limits.js";
6
6
  import { OpcPackage, officeRelationshipsNamespace, relationshipTypes, corePropertiesXml } from "../opc/index.js";
7
7
  import { escapeOoxmlAttribute, cleanXml, xmlDeclaration } from "../xml/index.js";
8
- import { StyleRegistry, spreadsheetNamespace } from "./styles.js";
8
+ import { StyleRegistry, spreadsheetNamespace, normalizeBorder } from "./styles.js";
9
9
  import { sheetName, assertXlsxValue, copyValue } from "./values.js";
10
10
  import { copyColumns } from "../internal/rows.js";
11
11
  import { captureFields } from "../internal/capture.js";
@@ -31,6 +31,8 @@ function captureSheet(options, policy) {
31
31
  return { ...captured, columns,
32
32
  ...(captured.columnOutlines === undefined ? {} : { columnOutlines: captureColumnOutlines(captured.columnOutlines, columns.length) }),
33
33
  ...(captured.headerRows === undefined ? {} : { headerRows: captureTableSpans(captured.headerRows, columns.length) }),
34
+ // Preflight and every header style read this one snapshot of the edges.
35
+ ...(captured.headerBorder === undefined ? {} : { headerBorder: normalizeBorder(captured.headerBorder) }),
34
36
  ...(footer ? { footer: { ...footer,
35
37
  ...(footer.rows === undefined ? {} : { rows: captureTableSpans(footer.rows, columns.length) }),
36
38
  ...(footer.values === undefined ? {} : { values: footer.values.map(copyValue) }) } } : {}),
@@ -87,8 +87,9 @@ export class Worksheet {
87
87
  book.checkLinks(this.links.length);
88
88
  this.declared = this.columns.map((column, i) => ({ column, letter: columnName(i + 1),
89
89
  style: book.styles.forColumn(column), dateStyle: book.styles.forColumn(column, false, undefined, true),
90
- headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header, ...(column.wrapText === undefined ? {} : { wrapText: column.wrapText }),
91
- ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill) : 0
90
+ headerStyle: this.headerRows ? options.headerStyle ?? book.styles.forColumn({ header: column.header,
91
+ ...((options.headerWrap ?? column.wrapText) === undefined ? {} : { wrapText: options.headerWrap ?? column.wrapText }),
92
+ ...(column.alignment === undefined ? {} : { alignment: column.alignment }) }, options.boldHeader !== false, options.headerFill, false, options.headerBorder) : 0
92
93
  }));
93
94
  // Register conditional styles only after worksheet construction can no longer reject its options.
94
95
  this.conditional = new ConditionalFormats(conditional, book.styles);
@@ -140,6 +141,8 @@ export class Worksheet {
140
141
  throw new TypeError("A frozen header or autofilter requires a header row.");
141
142
  if (options.headerFill !== undefined)
142
143
  colorArgb(options.headerFill);
144
+ if (options.headerWrap !== undefined && typeof options.headerWrap !== "boolean")
145
+ throw new TypeError("headerWrap must be boolean.");
143
146
  if (options.headerStyle !== undefined)
144
147
  book.styles.validateStyle(options.headerStyle);
145
148
  if (options.alternatingRowStyle !== undefined)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evotecit/officeimo",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "Dependency-free OfficeIMO document libraries for browsers, workers and Node.",
5
5
  "type": "module",
6
6
  "license": "MIT",