documents.js 1.63.0 → 1.65.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.
Files changed (187) hide show
  1. package/README.md +124 -25
  2. package/dist/convert/convert.cjs +3 -3
  3. package/dist/convert/convert.d.cts +5 -2
  4. package/dist/convert/convert.d.ts +4 -1
  5. package/dist/convert/convert.js +3 -3
  6. package/dist/edit/docx/content.d.cts +1 -1
  7. package/dist/edit/docx/content.d.ts +1 -1
  8. package/dist/edit/docx/paragraph.d.cts +3 -3
  9. package/dist/edit/docx/paragraph.d.ts +3 -3
  10. package/dist/edit/ods/address.cjs +42 -24
  11. package/dist/edit/ods/address.d.cts +12 -2
  12. package/dist/edit/ods/address.d.ts +12 -2
  13. package/dist/edit/ods/address.js +39 -25
  14. package/dist/edit/ods/column-row.cjs +68 -6
  15. package/dist/edit/ods/column-row.d.cts +5 -1
  16. package/dist/edit/ods/column-row.d.ts +5 -1
  17. package/dist/edit/ods/column-row.js +68 -10
  18. package/dist/edit/ods/content.cjs +10 -2
  19. package/dist/edit/ods/content.js +10 -2
  20. package/dist/edit/ods/floating.cjs +90 -0
  21. package/dist/edit/ods/floating.d.cts +7 -0
  22. package/dist/edit/ods/floating.d.ts +7 -0
  23. package/dist/edit/ods/floating.js +88 -0
  24. package/dist/edit/ods/print-settings.cjs +158 -2
  25. package/dist/edit/ods/print-settings.js +159 -3
  26. package/dist/edit/ods/sheet.cjs +13 -0
  27. package/dist/edit/ods/sheet.d.cts +5 -1
  28. package/dist/edit/ods/sheet.d.ts +5 -1
  29. package/dist/edit/ods/sheet.js +14 -1
  30. package/dist/edit/odt/content.cjs +8 -4
  31. package/dist/edit/odt/content.js +8 -4
  32. package/dist/edit/odt/editor.cjs +7 -0
  33. package/dist/edit/odt/editor.d.cts +3 -0
  34. package/dist/edit/odt/editor.d.ts +3 -0
  35. package/dist/edit/odt/editor.js +7 -0
  36. package/dist/edit/odt/formula.cjs +19 -0
  37. package/dist/edit/odt/formula.d.cts +8 -0
  38. package/dist/edit/odt/formula.d.ts +8 -0
  39. package/dist/edit/odt/formula.js +17 -0
  40. package/dist/evaluate-BU5N1Jk1.d.ts +11 -0
  41. package/dist/evaluate-BhMXY6DM.d.cts +11 -0
  42. package/dist/firebird/backup.d.cts +1 -1
  43. package/dist/firebird/backup.d.ts +1 -1
  44. package/dist/firebird/data.cjs +30 -16
  45. package/dist/firebird/data.d.cts +3 -2
  46. package/dist/firebird/data.d.ts +3 -2
  47. package/dist/firebird/data.js +30 -17
  48. package/dist/fonts/ooxml.d.cts +1 -1
  49. package/dist/fonts/registry.d.cts +1 -1
  50. package/dist/formula-CgydMiTt.d.ts +10 -0
  51. package/dist/formula-CiwPw8nY.d.cts +10 -0
  52. package/dist/hsqldb/binary-script.d.cts +1 -1
  53. package/dist/hsqldb/binary-script.d.ts +1 -1
  54. package/dist/hsqldb/cache.d.cts +1 -1
  55. package/dist/hsqldb/cache.d.ts +1 -1
  56. package/dist/hsqldb/rowformat.cjs +22 -13
  57. package/dist/hsqldb/rowformat.js +22 -13
  58. package/dist/hsqldb/script.d.cts +1 -18
  59. package/dist/hsqldb/script.d.ts +1 -18
  60. package/dist/index.cjs +56 -0
  61. package/dist/index.d.cts +24 -10
  62. package/dist/index.d.ts +23 -9
  63. package/dist/index.js +15 -2
  64. package/dist/layout/sheets.cjs +30 -24
  65. package/dist/layout/sheets.js +31 -25
  66. package/dist/layout/slides.cjs +6 -4
  67. package/dist/layout/slides.js +7 -5
  68. package/dist/lexer-DGPWx_f2.d.cts +42 -0
  69. package/dist/lexer-DGPWx_f2.d.ts +42 -0
  70. package/dist/mathml/compose.cjs +8 -0
  71. package/dist/mathml/compose.js +8 -0
  72. package/dist/mathml/layout-types.d.cts +14 -2
  73. package/dist/mathml/layout-types.d.ts +14 -2
  74. package/dist/mathml/layout.cjs +62 -3
  75. package/dist/mathml/layout.d.cts +1 -1
  76. package/dist/mathml/layout.d.ts +1 -1
  77. package/dist/mathml/layout.js +62 -3
  78. package/dist/mathml/metrics.d.cts +17 -1
  79. package/dist/mathml/metrics.d.ts +17 -1
  80. package/dist/mathml/operators.cjs +1 -1
  81. package/dist/mathml/operators.js +1 -1
  82. package/dist/mathml/variant.d.cts +1 -6
  83. package/dist/mathml/variant.d.ts +1 -6
  84. package/dist/odb/csv.d.cts +1 -1
  85. package/dist/odb/csv.d.ts +1 -1
  86. package/dist/odb/formula/definition.cjs +49 -0
  87. package/dist/odb/formula/definition.d.cts +8 -0
  88. package/dist/odb/formula/definition.d.ts +8 -0
  89. package/dist/odb/formula/definition.js +46 -0
  90. package/dist/odb/formula/errors.cjs +47 -0
  91. package/dist/odb/formula/errors.d.cts +21 -0
  92. package/dist/odb/formula/errors.d.ts +21 -0
  93. package/dist/odb/formula/errors.js +43 -0
  94. package/dist/odb/formula/evaluate.cjs +283 -0
  95. package/dist/odb/formula/evaluate.d.cts +43 -0
  96. package/dist/odb/formula/evaluate.d.ts +43 -0
  97. package/dist/odb/formula/evaluate.js +281 -0
  98. package/dist/odb/formula/parser.cjs +198 -0
  99. package/dist/odb/formula/parser.d.cts +29 -0
  100. package/dist/odb/formula/parser.d.ts +29 -0
  101. package/dist/odb/formula/parser.js +197 -0
  102. package/dist/odb/read.d.cts +1 -1
  103. package/dist/odb/read.d.ts +1 -1
  104. package/dist/odb/report/content.cjs +27 -0
  105. package/dist/odb/report/content.d.cts +14 -0
  106. package/dist/odb/report/content.d.ts +14 -0
  107. package/dist/odb/report/content.js +25 -0
  108. package/dist/odb/report/render.cjs +106 -0
  109. package/dist/odb/report/render.d.cts +7 -0
  110. package/dist/odb/report/render.d.ts +7 -0
  111. package/dist/odb/report/render.js +106 -0
  112. package/dist/odb/report/source.cjs +45 -0
  113. package/dist/odb/report/source.d.cts +14 -0
  114. package/dist/odb/report/source.d.ts +14 -0
  115. package/dist/odb/report/source.js +42 -0
  116. package/dist/odb/spreadsheet.d.cts +1 -1
  117. package/dist/odb/spreadsheet.d.ts +1 -1
  118. package/dist/odb/sql/errors.cjs +38 -0
  119. package/dist/odb/sql/errors.d.cts +17 -0
  120. package/dist/odb/sql/errors.d.ts +17 -0
  121. package/dist/odb/sql/errors.js +35 -0
  122. package/dist/odb/sql/evaluate.cjs +312 -0
  123. package/dist/odb/sql/evaluate.d.cts +2 -0
  124. package/dist/odb/sql/evaluate.d.ts +2 -0
  125. package/dist/odb/sql/evaluate.js +311 -0
  126. package/dist/odb/sql/lexer.cjs +282 -0
  127. package/dist/odb/sql/lexer.d.cts +2 -0
  128. package/dist/odb/sql/lexer.d.ts +2 -0
  129. package/dist/odb/sql/lexer.js +281 -0
  130. package/dist/odb/sql/parser.cjs +479 -0
  131. package/dist/odb/sql/parser.d.cts +2 -0
  132. package/dist/odb/sql/parser.d.ts +2 -0
  133. package/dist/odb/sql/parser.js +478 -0
  134. package/dist/odb/values.cjs +75 -0
  135. package/dist/odb/values.d.cts +2 -0
  136. package/dist/odb/values.d.ts +2 -0
  137. package/dist/odb/values.js +69 -0
  138. package/dist/odf/odt/read.cjs +43 -21
  139. package/dist/odf/odt/read.js +43 -21
  140. package/dist/odf-package/formula.cjs +59 -0
  141. package/dist/odf-package/formula.d.cts +11 -0
  142. package/dist/odf-package/formula.d.ts +11 -0
  143. package/dist/odf-package/formula.js +58 -0
  144. package/dist/odf-package/manifest.cjs +29 -0
  145. package/dist/odf-package/manifest.d.cts +5 -2
  146. package/dist/odf-package/manifest.d.ts +5 -2
  147. package/dist/odf-package/manifest.js +30 -2
  148. package/dist/odf-package/media.cjs +2 -1
  149. package/dist/odf-package/media.js +2 -2
  150. package/dist/omml/read.cjs +265 -0
  151. package/dist/omml/read.d.cts +12 -0
  152. package/dist/omml/read.d.ts +12 -0
  153. package/dist/omml/read.js +263 -0
  154. package/dist/omml/shared.cjs +67 -0
  155. package/dist/omml/shared.d.cts +2 -0
  156. package/dist/omml/shared.d.ts +2 -0
  157. package/dist/omml/shared.js +64 -0
  158. package/dist/omml/write.cjs +3 -51
  159. package/dist/omml/write.d.cts +2 -2
  160. package/dist/omml/write.d.ts +2 -2
  161. package/dist/omml/write.js +1 -49
  162. package/dist/ooxml/docx/extras.cjs +15 -0
  163. package/dist/ooxml/docx/extras.d.cts +12 -0
  164. package/dist/ooxml/docx/extras.d.ts +12 -0
  165. package/dist/ooxml/docx/extras.js +14 -0
  166. package/dist/ooxml/docx/formula.cjs +109 -0
  167. package/dist/ooxml/docx/formula.d.cts +2 -0
  168. package/dist/ooxml/docx/formula.d.ts +2 -0
  169. package/dist/ooxml/docx/formula.js +108 -0
  170. package/dist/ooxml/docx/read.cjs +10 -2
  171. package/dist/ooxml/docx/read.d.cts +6 -2
  172. package/dist/ooxml/docx/read.d.ts +6 -2
  173. package/dist/ooxml/docx/read.js +11 -3
  174. package/dist/parser-B9vC1T6T.d.cts +101 -0
  175. package/dist/parser-DQSgYJzQ.d.ts +101 -0
  176. package/dist/{registry-CtPhMD0f.d.cts → registry-lqJej0Jr.d.cts} +1 -1
  177. package/dist/script-DsGGIzGU.d.cts +19 -0
  178. package/dist/script-DsGGIzGU.d.ts +19 -0
  179. package/dist/shared-DLZ3IQUl.d.cts +15 -0
  180. package/dist/shared-DUOzjwcL.d.ts +15 -0
  181. package/dist/values-BetetbaH.d.cts +23 -0
  182. package/dist/values-BetetbaH.d.ts +23 -0
  183. package/dist/variant-BMrebjMw.d.cts +7 -0
  184. package/dist/variant-BMrebjMw.d.ts +7 -0
  185. package/dist/{write-DuyfnbL_.d.cts → write-BQ6SK8r8.d.cts} +2 -6
  186. package/dist/{write-Zqwx6pka.d.ts → write-THs7ipBq.d.ts} +2 -6
  187. package/package.json +2 -2
@@ -36,7 +36,7 @@ let pdf_codec = require("pdf-codec");
36
36
  //#region src/convert/convert.ts
37
37
  function docxToPdf(bytes, options) {
38
38
  const pkg = require_edit_docx_editor.openDocx(bytes).toPackage();
39
- const content = require_ooxml_docx_read.readDocxContent(pkg);
39
+ const content = require_ooxml_docx_read.readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
40
40
  if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
41
41
  const fonts = require_fonts_registry.createDocumentFontRegistry({
42
42
  kind: "docx",
@@ -335,7 +335,7 @@ function odtToDocx(bytes, options) {
335
335
  function docxToOdt(bytes, options) {
336
336
  require_ports_abort.throwIfAborted(options?.signal);
337
337
  const pkg = (0, ooxml_js.decodePackage)(bytes);
338
- const content = require_ooxml_docx_read.readDocxContent(pkg);
338
+ const content = require_ooxml_docx_read.readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
339
339
  if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
340
340
  require_ports_abort.throwIfAborted(options?.signal);
341
341
  options?.onDocument?.({
@@ -407,7 +407,7 @@ function markdownToDocx(bytes, options) {
407
407
  function docxToMarkdown(bytes, options) {
408
408
  require_ports_abort.throwIfAborted(options?.signal);
409
409
  const pkg = (0, ooxml_js.decodePackage)(bytes);
410
- const content = require_ooxml_docx_read.readDocxContent(pkg);
410
+ const content = require_ooxml_docx_read.readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
411
411
  if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
412
412
  require_ports_abort.throwIfAborted(options?.signal);
413
413
  options?.onDocument?.({
@@ -1,6 +1,6 @@
1
1
  import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
2
- import { t as OmmlDiagnostic } from "../write-DuyfnbL_.cjs";
3
- import { t as DocumentFontRegistryOptions } from "../registry-CtPhMD0f.cjs";
2
+ import { t as OmmlDiagnostic } from "../shared-DLZ3IQUl.cjs";
3
+ import { t as DocumentFontRegistryOptions } from "../registry-lqJej0Jr.cjs";
4
4
  import { ContentSection, DocumentPackage } from "document-schema.js";
5
5
  import { OdmSection, Package } from "odf.js";
6
6
  import { PdfDiagnosticSink, WinAnsiSubstitution } from "pdf-codec";
@@ -11,6 +11,9 @@ interface DocumentToPdfOptions extends DocumentFontRegistryOptions {
11
11
  readonly pageIndex: number;
12
12
  }) => void;
13
13
  readonly onDocument?: (pkg: DocumentPackage) => void;
14
+ readonly onMathDiagnostic?: (diagnostic: OmmlDiagnostic, context: {
15
+ readonly sourcePath?: string;
16
+ }) => void;
14
17
  }
15
18
  declare function docxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
16
19
  declare function odtToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
@@ -1,5 +1,5 @@
1
1
  import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
2
- import { t as OmmlDiagnostic } from "../write-Zqwx6pka.js";
2
+ import { t as OmmlDiagnostic } from "../shared-DUOzjwcL.js";
3
3
  import { t as DocumentFontRegistryOptions } from "../registry-CrSqLIcn.js";
4
4
  import { ContentSection, DocumentPackage } from "document-schema.js";
5
5
  import { OdmSection, Package } from "odf.js";
@@ -11,6 +11,9 @@ interface DocumentToPdfOptions extends DocumentFontRegistryOptions {
11
11
  readonly pageIndex: number;
12
12
  }) => void;
13
13
  readonly onDocument?: (pkg: DocumentPackage) => void;
14
+ readonly onMathDiagnostic?: (diagnostic: OmmlDiagnostic, context: {
15
+ readonly sourcePath?: string;
16
+ }) => void;
14
17
  }
15
18
  declare function docxToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
16
19
  declare function odtToPdf(bytes: Uint8Array<ArrayBuffer>, options?: DocumentToPdfOptions): Uint8Array<ArrayBuffer>;
@@ -35,7 +35,7 @@ import { createFontMeasurer, createFontRegistry, loadMathFont, readPdf, writePdf
35
35
  //#region src/convert/convert.ts
36
36
  function docxToPdf(bytes, options) {
37
37
  const pkg = openDocx(bytes).toPackage();
38
- const content = readDocxContent(pkg);
38
+ const content = readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
39
39
  if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
40
40
  const fonts = createDocumentFontRegistry({
41
41
  kind: "docx",
@@ -334,7 +334,7 @@ function odtToDocx(bytes, options) {
334
334
  function docxToOdt(bytes, options) {
335
335
  throwIfAborted(options?.signal);
336
336
  const pkg = decodePackage(bytes);
337
- const content = readDocxContent(pkg);
337
+ const content = readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
338
338
  if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
339
339
  throwIfAborted(options?.signal);
340
340
  options?.onDocument?.({
@@ -406,7 +406,7 @@ function markdownToDocx(bytes, options) {
406
406
  function docxToMarkdown(bytes, options) {
407
407
  throwIfAborted(options?.signal);
408
408
  const pkg = decodePackage(bytes);
409
- const content = readDocxContent(pkg);
409
+ const content = readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic });
410
410
  if (content.kind !== "wordprocessing") throw new Error("readDocxContent returned a non-wordprocessing ContentDocument");
411
411
  throwIfAborted(options?.signal);
412
412
  options?.onDocument?.({
@@ -1,4 +1,4 @@
1
- import { t as OmmlDiagnostic } from "../../write-DuyfnbL_.cjs";
1
+ import { t as OmmlDiagnostic } from "../../shared-DLZ3IQUl.cjs";
2
2
  import { ContentDocument } from "document-schema.js";
3
3
  import { Package } from "ooxml.js";
4
4
  //#region src/edit/docx/content.d.ts
@@ -1,4 +1,4 @@
1
- import { t as OmmlDiagnostic } from "../../write-Zqwx6pka.js";
1
+ import { t as OmmlDiagnostic } from "../../shared-DUOzjwcL.js";
2
2
  import { Package } from "ooxml.js";
3
3
  import { ContentDocument } from "document-schema.js";
4
4
  //#region src/edit/docx/content.d.ts
@@ -1,5 +1,5 @@
1
- import { r as MathMlNode } from "../../nodes-pArN9ilm.cjs";
2
- import { r as OmmlWriteResult } from "../../write-DuyfnbL_.cjs";
1
+ import { r as MathMlNode$1 } from "../../nodes-pArN9ilm.cjs";
2
+ import { t as OmmlWriteResult } from "../../write-BQ6SK8r8.cjs";
3
3
  import { n as MediaContext, t as ImageInit } from "../../image-BfRLAD9B.cjs";
4
4
  import { n as RunInit, t as DocxRun } from "../../run-B3GNScJH.cjs";
5
5
  import { ContentListMembership } from "document-schema.js";
@@ -34,7 +34,7 @@ declare class DocxParagraph {
34
34
  set alignment(value: 'left' | 'center' | 'right' | 'justify' | undefined);
35
35
  get list(): ContentListMembership | undefined;
36
36
  set list(value: ContentListMembership | undefined);
37
- appendOfficeMath(mathml: readonly MathMlNode[]): OmmlWriteResult & {
37
+ appendOfficeMath(mathml: readonly MathMlNode$1[]): OmmlWriteResult & {
38
38
  readonly written: boolean;
39
39
  };
40
40
  insertImageAfter(image: ImageInit): void;
@@ -1,5 +1,5 @@
1
- import { r as MathMlNode } from "../../nodes-pArN9ilm.js";
2
- import { r as OmmlWriteResult } from "../../write-Zqwx6pka.js";
1
+ import { r as MathMlNode$1 } from "../../nodes-pArN9ilm.js";
2
+ import { t as OmmlWriteResult } from "../../write-THs7ipBq.js";
3
3
  import { n as MediaContext, t as ImageInit } from "../../image-BfRLAD9B.js";
4
4
  import { n as RunInit, t as DocxRun } from "../../run-D2rTWHbt.js";
5
5
  import { Package, XmlElement, XmlNode } from "ooxml.js";
@@ -34,7 +34,7 @@ declare class DocxParagraph {
34
34
  set alignment(value: 'left' | 'center' | 'right' | 'justify' | undefined);
35
35
  get list(): ContentListMembership | undefined;
36
36
  set list(value: ContentListMembership | undefined);
37
- appendOfficeMath(mathml: readonly MathMlNode[]): OmmlWriteResult & {
37
+ appendOfficeMath(mathml: readonly MathMlNode$1[]): OmmlWriteResult & {
38
38
  readonly written: boolean;
39
39
  };
40
40
  insertImageAfter(image: ImageInit): void;
@@ -7,6 +7,8 @@ const CELL_TAG = "table:table-cell";
7
7
  const COVERED_CELL_TAG = "table:covered-table-cell";
8
8
  const ROW_REPEAT_ATTR = "table:number-rows-repeated";
9
9
  const COLUMN_REPEAT_ATTR = "table:number-columns-repeated";
10
+ const HEADER_ROWS_TAG = "table:table-header-rows";
11
+ const HEADER_COLUMNS_TAG = "table:table-header-columns";
10
12
  function isElementWithTag(tag) {
11
13
  return (node) => node.type === "element" && node.tag === tag;
12
14
  }
@@ -16,12 +18,36 @@ function isCellOrCoveredCell(node) {
16
18
  function validateIndex(value, label) {
17
19
  if (!Number.isInteger(value) || value < 0) throw new Error(`${label} must be a non-negative integer, got ${value}`);
18
20
  }
19
- function readRepeatCount(node, attrName) {
21
+ function readRunRepeatCount(node, attrName) {
20
22
  const raw = node.attributes.find((attribute) => attribute.name === attrName)?.value;
21
23
  if (raw === void 0) return 1;
22
24
  const parsed = Number.parseInt(raw, 10);
23
25
  return Number.isInteger(parsed) && parsed > 0 ? parsed : 1;
24
26
  }
27
+ function collectRunMembers(children, isMember, headerWrapperTag) {
28
+ const members = [];
29
+ children.forEach((node, outerPosition) => {
30
+ if (node.type !== "element") return;
31
+ if (headerWrapperTag !== void 0 && node.tag === headerWrapperTag) {
32
+ node.children.forEach((inner, innerPosition) => {
33
+ if (isMember(inner)) members.push({
34
+ node: inner,
35
+ container: node.children,
36
+ containerPosition: innerPosition,
37
+ outerPosition
38
+ });
39
+ });
40
+ return;
41
+ }
42
+ if (isMember(node)) members.push({
43
+ node,
44
+ container: children,
45
+ containerPosition: outerPosition,
46
+ outerPosition
47
+ });
48
+ });
49
+ return members;
50
+ }
25
51
  function withRepeatCount(node, attrName, count) {
26
52
  const clone = structuredClone(node);
27
53
  clone.attributes = clone.attributes.filter((attribute) => attribute.name !== attrName);
@@ -31,18 +57,12 @@ function withRepeatCount(node, attrName, count) {
31
57
  });
32
58
  return clone;
33
59
  }
34
- function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty) {
60
+ function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty, headerWrapperTag) {
35
61
  validateIndex(targetIndex, "targetIndex");
36
- const members = [];
37
- children.forEach((node, position) => {
38
- if (isMember(node)) members.push({
39
- node,
40
- position
41
- });
42
- });
62
+ const members = collectRunMembers(children, isMember, headerWrapperTag);
43
63
  let cursor = 0;
44
64
  for (const member of members) {
45
- const count = readRepeatCount(member.node, repeatAttr);
65
+ const count = readRunRepeatCount(member.node, repeatAttr);
46
66
  if (targetIndex < cursor + count) {
47
67
  const offset = targetIndex - cursor;
48
68
  if (count === 1) return member.node;
@@ -53,14 +73,14 @@ function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty) {
53
73
  target,
54
74
  count - offset - 1 > 0 ? withRepeatCount(member.node, repeatAttr, count - offset - 1) : void 0
55
75
  ].filter((candidate) => candidate !== void 0);
56
- children.splice(member.position, 1, ...replacement);
76
+ member.container.splice(member.containerPosition, 1, ...replacement);
57
77
  return target;
58
78
  }
59
79
  cursor += count;
60
80
  }
61
81
  const gap = targetIndex - cursor;
62
82
  const lastMember = members[members.length - 1];
63
- const insertAt = lastMember === void 0 ? children.length : lastMember.position + 1;
83
+ const insertAt = lastMember === void 0 ? children.length : lastMember.outerPosition + 1;
64
84
  const toInsert = [];
65
85
  if (gap > 0) toInsert.push(withRepeatCount(buildEmpty(), repeatAttr, gap));
66
86
  const target = buildEmpty();
@@ -70,39 +90,37 @@ function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty) {
70
90
  }
71
91
  function ensureColumnCoverage(tableElement, minCount) {
72
92
  if (minCount <= 0) return;
73
- const columnMembers = [];
74
- tableElement.children.forEach((node, position) => {
75
- if (isElementWithTag("table:table-column")(node)) columnMembers.push({
76
- node,
77
- position
78
- });
79
- });
80
- const covered = columnMembers.reduce((sum, member) => sum + readRepeatCount(member.node, COLUMN_REPEAT_ATTR), 0);
93
+ const columnMembers = collectRunMembers(tableElement.children, isElementWithTag(COLUMN_TAG), HEADER_COLUMNS_TAG);
94
+ const covered = columnMembers.reduce((sum, member) => sum + readRunRepeatCount(member.node, COLUMN_REPEAT_ATTR), 0);
81
95
  if (covered >= minCount) return;
82
96
  const additional = minCount - covered;
83
97
  const newColumn = withRepeatCount(require_xml_fragment.el(COLUMN_TAG), COLUMN_REPEAT_ATTR, additional);
84
98
  const lastColumn = columnMembers[columnMembers.length - 1];
85
99
  if (lastColumn === void 0) {
86
- const firstRowPosition = tableElement.children.findIndex(isElementWithTag(ROW_TAG));
87
- const insertAt = firstRowPosition === -1 ? tableElement.children.length : firstRowPosition;
100
+ const firstRowOrHeaderPosition = tableElement.children.findIndex((node) => isElementWithTag("table:table-row")(node) || isElementWithTag("table:table-header-rows")(node));
101
+ const insertAt = firstRowOrHeaderPosition === -1 ? tableElement.children.length : firstRowOrHeaderPosition;
88
102
  tableElement.children.splice(insertAt, 0, newColumn);
89
- } else tableElement.children.splice(lastColumn.position + 1, 0, newColumn);
103
+ } else tableElement.children.splice(lastColumn.outerPosition + 1, 0, newColumn);
90
104
  }
91
105
  function resolveCellNode(tableElement, row, column) {
92
106
  validateIndex(row, "row");
93
107
  validateIndex(column, "column");
94
108
  ensureColumnCoverage(tableElement, column + 1);
95
- return replaceRun(replaceRun(tableElement.children, isElementWithTag(ROW_TAG), row, ROW_REPEAT_ATTR, () => require_xml_fragment.el(ROW_TAG)).children, isCellOrCoveredCell, column, COLUMN_REPEAT_ATTR, () => require_xml_fragment.el(CELL_TAG));
109
+ return replaceRun(replaceRun(tableElement.children, isElementWithTag(ROW_TAG), row, ROW_REPEAT_ATTR, () => require_xml_fragment.el(ROW_TAG), HEADER_ROWS_TAG).children, isCellOrCoveredCell, column, COLUMN_REPEAT_ATTR, () => require_xml_fragment.el(CELL_TAG));
96
110
  }
97
111
  //#endregion
98
112
  exports.CELL_TAG = CELL_TAG;
99
113
  exports.COLUMN_REPEAT_ATTR = COLUMN_REPEAT_ATTR;
100
114
  exports.COLUMN_TAG = COLUMN_TAG;
101
115
  exports.COVERED_CELL_TAG = COVERED_CELL_TAG;
116
+ exports.HEADER_COLUMNS_TAG = HEADER_COLUMNS_TAG;
117
+ exports.HEADER_ROWS_TAG = HEADER_ROWS_TAG;
102
118
  exports.ROW_REPEAT_ATTR = ROW_REPEAT_ATTR;
103
119
  exports.ROW_TAG = ROW_TAG;
120
+ exports.collectRunMembers = collectRunMembers;
104
121
  exports.ensureColumnCoverage = ensureColumnCoverage;
105
122
  exports.isCellOrCoveredCell = isCellOrCoveredCell;
106
123
  exports.isElementWithTag = isElementWithTag;
124
+ exports.readRunRepeatCount = readRunRepeatCount;
107
125
  exports.replaceRun = replaceRun;
108
126
  exports.resolveCellNode = resolveCellNode;
@@ -6,10 +6,20 @@ declare const CELL_TAG = "table:table-cell";
6
6
  declare const COVERED_CELL_TAG = "table:covered-table-cell";
7
7
  declare const ROW_REPEAT_ATTR = "table:number-rows-repeated";
8
8
  declare const COLUMN_REPEAT_ATTR = "table:number-columns-repeated";
9
+ declare const HEADER_ROWS_TAG = "table:table-header-rows";
10
+ declare const HEADER_COLUMNS_TAG = "table:table-header-columns";
9
11
  declare function isElementWithTag(tag: string): (node: XmlNode) => node is XmlElement;
10
12
  declare function isCellOrCoveredCell(node: XmlNode): node is XmlElement;
11
- declare function replaceRun(children: XmlNode[], isMember: (node: XmlNode) => node is XmlElement, targetIndex: number, repeatAttr: string, buildEmpty: () => XmlElement): XmlElement;
13
+ declare function readRunRepeatCount(node: XmlElement, attrName: string): number;
14
+ interface RunMember {
15
+ readonly node: XmlElement;
16
+ readonly container: XmlNode[];
17
+ readonly containerPosition: number;
18
+ readonly outerPosition: number;
19
+ }
20
+ declare function collectRunMembers(children: XmlNode[], isMember: (node: XmlNode) => node is XmlElement, headerWrapperTag: string | undefined): RunMember[];
21
+ declare function replaceRun(children: XmlNode[], isMember: (node: XmlNode) => node is XmlElement, targetIndex: number, repeatAttr: string, buildEmpty: () => XmlElement, headerWrapperTag?: string): XmlElement;
12
22
  declare function ensureColumnCoverage(tableElement: XmlElement, minCount: number): void;
13
23
  declare function resolveCellNode(tableElement: XmlElement, row: number, column: number): XmlElement;
14
24
  //#endregion
15
- export { CELL_TAG, COLUMN_REPEAT_ATTR, COLUMN_TAG, COVERED_CELL_TAG, ROW_REPEAT_ATTR, ROW_TAG, ensureColumnCoverage, isCellOrCoveredCell, isElementWithTag, replaceRun, resolveCellNode };
25
+ export { CELL_TAG, COLUMN_REPEAT_ATTR, COLUMN_TAG, COVERED_CELL_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG, ROW_REPEAT_ATTR, ROW_TAG, RunMember, collectRunMembers, ensureColumnCoverage, isCellOrCoveredCell, isElementWithTag, readRunRepeatCount, replaceRun, resolveCellNode };
@@ -6,10 +6,20 @@ declare const CELL_TAG = "table:table-cell";
6
6
  declare const COVERED_CELL_TAG = "table:covered-table-cell";
7
7
  declare const ROW_REPEAT_ATTR = "table:number-rows-repeated";
8
8
  declare const COLUMN_REPEAT_ATTR = "table:number-columns-repeated";
9
+ declare const HEADER_ROWS_TAG = "table:table-header-rows";
10
+ declare const HEADER_COLUMNS_TAG = "table:table-header-columns";
9
11
  declare function isElementWithTag(tag: string): (node: XmlNode) => node is XmlElement;
10
12
  declare function isCellOrCoveredCell(node: XmlNode): node is XmlElement;
11
- declare function replaceRun(children: XmlNode[], isMember: (node: XmlNode) => node is XmlElement, targetIndex: number, repeatAttr: string, buildEmpty: () => XmlElement): XmlElement;
13
+ declare function readRunRepeatCount(node: XmlElement, attrName: string): number;
14
+ interface RunMember {
15
+ readonly node: XmlElement;
16
+ readonly container: XmlNode[];
17
+ readonly containerPosition: number;
18
+ readonly outerPosition: number;
19
+ }
20
+ declare function collectRunMembers(children: XmlNode[], isMember: (node: XmlNode) => node is XmlElement, headerWrapperTag: string | undefined): RunMember[];
21
+ declare function replaceRun(children: XmlNode[], isMember: (node: XmlNode) => node is XmlElement, targetIndex: number, repeatAttr: string, buildEmpty: () => XmlElement, headerWrapperTag?: string): XmlElement;
12
22
  declare function ensureColumnCoverage(tableElement: XmlElement, minCount: number): void;
13
23
  declare function resolveCellNode(tableElement: XmlElement, row: number, column: number): XmlElement;
14
24
  //#endregion
15
- export { CELL_TAG, COLUMN_REPEAT_ATTR, COLUMN_TAG, COVERED_CELL_TAG, ROW_REPEAT_ATTR, ROW_TAG, ensureColumnCoverage, isCellOrCoveredCell, isElementWithTag, replaceRun, resolveCellNode };
25
+ export { CELL_TAG, COLUMN_REPEAT_ATTR, COLUMN_TAG, COVERED_CELL_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG, ROW_REPEAT_ATTR, ROW_TAG, RunMember, collectRunMembers, ensureColumnCoverage, isCellOrCoveredCell, isElementWithTag, readRunRepeatCount, replaceRun, resolveCellNode };
@@ -6,6 +6,8 @@ const CELL_TAG = "table:table-cell";
6
6
  const COVERED_CELL_TAG = "table:covered-table-cell";
7
7
  const ROW_REPEAT_ATTR = "table:number-rows-repeated";
8
8
  const COLUMN_REPEAT_ATTR = "table:number-columns-repeated";
9
+ const HEADER_ROWS_TAG = "table:table-header-rows";
10
+ const HEADER_COLUMNS_TAG = "table:table-header-columns";
9
11
  function isElementWithTag(tag) {
10
12
  return (node) => node.type === "element" && node.tag === tag;
11
13
  }
@@ -15,12 +17,36 @@ function isCellOrCoveredCell(node) {
15
17
  function validateIndex(value, label) {
16
18
  if (!Number.isInteger(value) || value < 0) throw new Error(`${label} must be a non-negative integer, got ${value}`);
17
19
  }
18
- function readRepeatCount(node, attrName) {
20
+ function readRunRepeatCount(node, attrName) {
19
21
  const raw = node.attributes.find((attribute) => attribute.name === attrName)?.value;
20
22
  if (raw === void 0) return 1;
21
23
  const parsed = Number.parseInt(raw, 10);
22
24
  return Number.isInteger(parsed) && parsed > 0 ? parsed : 1;
23
25
  }
26
+ function collectRunMembers(children, isMember, headerWrapperTag) {
27
+ const members = [];
28
+ children.forEach((node, outerPosition) => {
29
+ if (node.type !== "element") return;
30
+ if (headerWrapperTag !== void 0 && node.tag === headerWrapperTag) {
31
+ node.children.forEach((inner, innerPosition) => {
32
+ if (isMember(inner)) members.push({
33
+ node: inner,
34
+ container: node.children,
35
+ containerPosition: innerPosition,
36
+ outerPosition
37
+ });
38
+ });
39
+ return;
40
+ }
41
+ if (isMember(node)) members.push({
42
+ node,
43
+ container: children,
44
+ containerPosition: outerPosition,
45
+ outerPosition
46
+ });
47
+ });
48
+ return members;
49
+ }
24
50
  function withRepeatCount(node, attrName, count) {
25
51
  const clone = structuredClone(node);
26
52
  clone.attributes = clone.attributes.filter((attribute) => attribute.name !== attrName);
@@ -30,18 +56,12 @@ function withRepeatCount(node, attrName, count) {
30
56
  });
31
57
  return clone;
32
58
  }
33
- function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty) {
59
+ function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty, headerWrapperTag) {
34
60
  validateIndex(targetIndex, "targetIndex");
35
- const members = [];
36
- children.forEach((node, position) => {
37
- if (isMember(node)) members.push({
38
- node,
39
- position
40
- });
41
- });
61
+ const members = collectRunMembers(children, isMember, headerWrapperTag);
42
62
  let cursor = 0;
43
63
  for (const member of members) {
44
- const count = readRepeatCount(member.node, repeatAttr);
64
+ const count = readRunRepeatCount(member.node, repeatAttr);
45
65
  if (targetIndex < cursor + count) {
46
66
  const offset = targetIndex - cursor;
47
67
  if (count === 1) return member.node;
@@ -52,14 +72,14 @@ function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty) {
52
72
  target,
53
73
  count - offset - 1 > 0 ? withRepeatCount(member.node, repeatAttr, count - offset - 1) : void 0
54
74
  ].filter((candidate) => candidate !== void 0);
55
- children.splice(member.position, 1, ...replacement);
75
+ member.container.splice(member.containerPosition, 1, ...replacement);
56
76
  return target;
57
77
  }
58
78
  cursor += count;
59
79
  }
60
80
  const gap = targetIndex - cursor;
61
81
  const lastMember = members[members.length - 1];
62
- const insertAt = lastMember === void 0 ? children.length : lastMember.position + 1;
82
+ const insertAt = lastMember === void 0 ? children.length : lastMember.outerPosition + 1;
63
83
  const toInsert = [];
64
84
  if (gap > 0) toInsert.push(withRepeatCount(buildEmpty(), repeatAttr, gap));
65
85
  const target = buildEmpty();
@@ -69,29 +89,23 @@ function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty) {
69
89
  }
70
90
  function ensureColumnCoverage(tableElement, minCount) {
71
91
  if (minCount <= 0) return;
72
- const columnMembers = [];
73
- tableElement.children.forEach((node, position) => {
74
- if (isElementWithTag("table:table-column")(node)) columnMembers.push({
75
- node,
76
- position
77
- });
78
- });
79
- const covered = columnMembers.reduce((sum, member) => sum + readRepeatCount(member.node, COLUMN_REPEAT_ATTR), 0);
92
+ const columnMembers = collectRunMembers(tableElement.children, isElementWithTag(COLUMN_TAG), HEADER_COLUMNS_TAG);
93
+ const covered = columnMembers.reduce((sum, member) => sum + readRunRepeatCount(member.node, COLUMN_REPEAT_ATTR), 0);
80
94
  if (covered >= minCount) return;
81
95
  const additional = minCount - covered;
82
96
  const newColumn = withRepeatCount(el(COLUMN_TAG), COLUMN_REPEAT_ATTR, additional);
83
97
  const lastColumn = columnMembers[columnMembers.length - 1];
84
98
  if (lastColumn === void 0) {
85
- const firstRowPosition = tableElement.children.findIndex(isElementWithTag(ROW_TAG));
86
- const insertAt = firstRowPosition === -1 ? tableElement.children.length : firstRowPosition;
99
+ const firstRowOrHeaderPosition = tableElement.children.findIndex((node) => isElementWithTag("table:table-row")(node) || isElementWithTag("table:table-header-rows")(node));
100
+ const insertAt = firstRowOrHeaderPosition === -1 ? tableElement.children.length : firstRowOrHeaderPosition;
87
101
  tableElement.children.splice(insertAt, 0, newColumn);
88
- } else tableElement.children.splice(lastColumn.position + 1, 0, newColumn);
102
+ } else tableElement.children.splice(lastColumn.outerPosition + 1, 0, newColumn);
89
103
  }
90
104
  function resolveCellNode(tableElement, row, column) {
91
105
  validateIndex(row, "row");
92
106
  validateIndex(column, "column");
93
107
  ensureColumnCoverage(tableElement, column + 1);
94
- return replaceRun(replaceRun(tableElement.children, isElementWithTag(ROW_TAG), row, ROW_REPEAT_ATTR, () => el(ROW_TAG)).children, isCellOrCoveredCell, column, COLUMN_REPEAT_ATTR, () => el(CELL_TAG));
108
+ return replaceRun(replaceRun(tableElement.children, isElementWithTag(ROW_TAG), row, ROW_REPEAT_ATTR, () => el(ROW_TAG), HEADER_ROWS_TAG).children, isCellOrCoveredCell, column, COLUMN_REPEAT_ATTR, () => el(CELL_TAG));
95
109
  }
96
110
  //#endregion
97
- export { CELL_TAG, COLUMN_REPEAT_ATTR, COLUMN_TAG, COVERED_CELL_TAG, ROW_REPEAT_ATTR, ROW_TAG, ensureColumnCoverage, isCellOrCoveredCell, isElementWithTag, replaceRun, resolveCellNode };
111
+ export { CELL_TAG, COLUMN_REPEAT_ATTR, COLUMN_TAG, COVERED_CELL_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG, ROW_REPEAT_ATTR, ROW_TAG, collectRunMembers, ensureColumnCoverage, isCellOrCoveredCell, isElementWithTag, readRunRepeatCount, replaceRun, resolveCellNode };
@@ -3,29 +3,91 @@ const require_xml_fragment = require("../../xml/fragment.cjs");
3
3
  const require_xml_edit = require("../../xml/edit.cjs");
4
4
  const require_edit_odt_automatic_styles = require("../odt/automatic-styles.cjs");
5
5
  const require_edit_ods_address = require("./address.cjs");
6
+ let ooxml_js = require("ooxml.js");
6
7
  let odf_js = require("odf.js");
7
8
  //#region src/edit/ods/column-row.ts
8
- function writeColumnWidth(pkg, tableElement, index, widthPt) {
9
+ const VISIBILITY_ATTR = "table:visibility";
10
+ const VISIBILITY_COLLAPSE = "collapse";
11
+ function currentColumnStyleProperties(pkg, columnElement) {
12
+ const styleName = (0, ooxml_js.attr)(columnElement, "table:style-name");
13
+ const styleElement = styleName === void 0 ? void 0 : (0, odf_js.findStyleElement)(styleName, "table-column", pkg);
14
+ const properties = styleElement === void 0 ? void 0 : require_xml_edit.directChildElement(styleElement, "style:table-column-properties");
15
+ const widthValue = properties === void 0 ? void 0 : (0, ooxml_js.attr)(properties, "style:column-width");
16
+ return {
17
+ widthPt: widthValue === void 0 ? void 0 : (0, odf_js.parseOdfLength)(widthValue),
18
+ manualBreak: (properties === void 0 ? void 0 : (0, ooxml_js.attr)(properties, "fo:break-before")) === "page"
19
+ };
20
+ }
21
+ function currentRowStyleProperties(pkg, rowElement) {
22
+ const styleName = (0, ooxml_js.attr)(rowElement, "table:style-name");
23
+ const styleElement = styleName === void 0 ? void 0 : (0, odf_js.findStyleElement)(styleName, "table-row", pkg);
24
+ const properties = styleElement === void 0 ? void 0 : require_xml_edit.directChildElement(styleElement, "style:table-row-properties");
25
+ const heightValue = properties === void 0 ? void 0 : (0, ooxml_js.attr)(properties, "style:row-height");
26
+ return {
27
+ heightPt: heightValue === void 0 ? void 0 : (0, odf_js.parseOdfLength)(heightValue),
28
+ manualBreak: (properties === void 0 ? void 0 : (0, ooxml_js.attr)(properties, "fo:break-before")) === "page"
29
+ };
30
+ }
31
+ function applyColumnStyleProperties(pkg, tableElement, index, changes) {
9
32
  require_edit_ods_address.ensureColumnCoverage(tableElement, index + 1);
10
- const columnElement = require_edit_ods_address.replaceRun(tableElement.children, require_edit_ods_address.isElementWithTag(require_edit_ods_address.COLUMN_TAG), index, require_edit_ods_address.COLUMN_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.COLUMN_TAG));
33
+ const columnElement = require_edit_ods_address.replaceRun(tableElement.children, require_edit_ods_address.isElementWithTag(require_edit_ods_address.COLUMN_TAG), index, require_edit_ods_address.COLUMN_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.COLUMN_TAG), require_edit_ods_address.HEADER_COLUMNS_TAG);
34
+ const current = currentColumnStyleProperties(pkg, columnElement);
35
+ const widthPt = changes.widthPt ?? current.widthPt;
36
+ const manualBreak = changes.manualBreak ?? current.manualBreak;
11
37
  const automaticStyles = require_edit_odt_automatic_styles.ensureAutomaticStyles(pkg);
12
38
  const styleName = require_edit_odt_automatic_styles.nextStyleName(automaticStyles, "style:style", "OdsColumn");
13
39
  automaticStyles.children.push(require_xml_fragment.el("style:style", {
14
40
  "style:name": styleName,
15
41
  "style:family": "table-column"
16
- }, [require_xml_fragment.el("style:table-column-properties", { "style:column-width": (0, odf_js.formatOdfLength)(widthPt) })]));
42
+ }, [require_xml_fragment.el("style:table-column-properties", {
43
+ ...widthPt !== void 0 ? { "style:column-width": (0, odf_js.formatOdfLength)(widthPt) } : {},
44
+ ...manualBreak ? { "fo:break-before": "page" } : {}
45
+ })]));
17
46
  require_xml_edit.setAttr(columnElement, "table:style-name", styleName);
18
47
  }
19
- function writeRowHeight(pkg, tableElement, index, heightPt) {
20
- const rowElement = require_edit_ods_address.replaceRun(tableElement.children, require_edit_ods_address.isElementWithTag(require_edit_ods_address.ROW_TAG), index, require_edit_ods_address.ROW_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.ROW_TAG));
48
+ function applyRowStyleProperties(pkg, tableElement, index, changes) {
49
+ const rowElement = require_edit_ods_address.replaceRun(tableElement.children, require_edit_ods_address.isElementWithTag(require_edit_ods_address.ROW_TAG), index, require_edit_ods_address.ROW_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.ROW_TAG), require_edit_ods_address.HEADER_ROWS_TAG);
50
+ const current = currentRowStyleProperties(pkg, rowElement);
51
+ const heightPt = changes.heightPt ?? current.heightPt;
52
+ const manualBreak = changes.manualBreak ?? current.manualBreak;
21
53
  const automaticStyles = require_edit_odt_automatic_styles.ensureAutomaticStyles(pkg);
22
54
  const styleName = require_edit_odt_automatic_styles.nextStyleName(automaticStyles, "style:style", "OdsRow");
23
55
  automaticStyles.children.push(require_xml_fragment.el("style:style", {
24
56
  "style:name": styleName,
25
57
  "style:family": "table-row"
26
- }, [require_xml_fragment.el("style:table-row-properties", { "style:row-height": (0, odf_js.formatOdfLength)(heightPt) })]));
58
+ }, [require_xml_fragment.el("style:table-row-properties", {
59
+ ...heightPt !== void 0 ? { "style:row-height": (0, odf_js.formatOdfLength)(heightPt) } : {},
60
+ ...manualBreak ? { "fo:break-before": "page" } : {}
61
+ })]));
27
62
  require_xml_edit.setAttr(rowElement, "table:style-name", styleName);
28
63
  }
64
+ function writeColumnWidth(pkg, tableElement, index, widthPt) {
65
+ applyColumnStyleProperties(pkg, tableElement, index, { widthPt });
66
+ }
67
+ function writeRowHeight(pkg, tableElement, index, heightPt) {
68
+ applyRowStyleProperties(pkg, tableElement, index, { heightPt });
69
+ }
70
+ function writeColumnManualBreak(pkg, tableElement, index) {
71
+ applyColumnStyleProperties(pkg, tableElement, index, { manualBreak: true });
72
+ }
73
+ function writeRowManualBreak(pkg, tableElement, index) {
74
+ applyRowStyleProperties(pkg, tableElement, index, { manualBreak: true });
75
+ }
76
+ function writeColumnHidden(tableElement, index, hidden) {
77
+ require_edit_ods_address.ensureColumnCoverage(tableElement, index + 1);
78
+ const columnElement = require_edit_ods_address.replaceRun(tableElement.children, require_edit_ods_address.isElementWithTag(require_edit_ods_address.COLUMN_TAG), index, require_edit_ods_address.COLUMN_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.COLUMN_TAG), require_edit_ods_address.HEADER_COLUMNS_TAG);
79
+ if (hidden) require_xml_edit.setAttr(columnElement, VISIBILITY_ATTR, VISIBILITY_COLLAPSE);
80
+ else require_xml_edit.removeAttr(columnElement, VISIBILITY_ATTR);
81
+ }
82
+ function writeRowHidden(tableElement, index, hidden) {
83
+ const rowElement = require_edit_ods_address.replaceRun(tableElement.children, require_edit_ods_address.isElementWithTag(require_edit_ods_address.ROW_TAG), index, require_edit_ods_address.ROW_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.ROW_TAG), require_edit_ods_address.HEADER_ROWS_TAG);
84
+ if (hidden) require_xml_edit.setAttr(rowElement, VISIBILITY_ATTR, VISIBILITY_COLLAPSE);
85
+ else require_xml_edit.removeAttr(rowElement, VISIBILITY_ATTR);
86
+ }
29
87
  //#endregion
88
+ exports.writeColumnHidden = writeColumnHidden;
89
+ exports.writeColumnManualBreak = writeColumnManualBreak;
30
90
  exports.writeColumnWidth = writeColumnWidth;
31
91
  exports.writeRowHeight = writeRowHeight;
92
+ exports.writeRowHidden = writeRowHidden;
93
+ exports.writeRowManualBreak = writeRowManualBreak;
@@ -2,5 +2,9 @@ import { Package, XmlElement } from "odf.js";
2
2
  //#region src/edit/ods/column-row.d.ts
3
3
  declare function writeColumnWidth(pkg: Package, tableElement: XmlElement, index: number, widthPt: number): void;
4
4
  declare function writeRowHeight(pkg: Package, tableElement: XmlElement, index: number, heightPt: number): void;
5
+ declare function writeColumnManualBreak(pkg: Package, tableElement: XmlElement, index: number): void;
6
+ declare function writeRowManualBreak(pkg: Package, tableElement: XmlElement, index: number): void;
7
+ declare function writeColumnHidden(tableElement: XmlElement, index: number, hidden: boolean): void;
8
+ declare function writeRowHidden(tableElement: XmlElement, index: number, hidden: boolean): void;
5
9
  //#endregion
6
- export { writeColumnWidth, writeRowHeight };
10
+ export { writeColumnHidden, writeColumnManualBreak, writeColumnWidth, writeRowHeight, writeRowHidden, writeRowManualBreak };
@@ -2,5 +2,9 @@ import { Package, XmlElement } from "odf.js";
2
2
  //#region src/edit/ods/column-row.d.ts
3
3
  declare function writeColumnWidth(pkg: Package, tableElement: XmlElement, index: number, widthPt: number): void;
4
4
  declare function writeRowHeight(pkg: Package, tableElement: XmlElement, index: number, heightPt: number): void;
5
+ declare function writeColumnManualBreak(pkg: Package, tableElement: XmlElement, index: number): void;
6
+ declare function writeRowManualBreak(pkg: Package, tableElement: XmlElement, index: number): void;
7
+ declare function writeColumnHidden(tableElement: XmlElement, index: number, hidden: boolean): void;
8
+ declare function writeRowHidden(tableElement: XmlElement, index: number, hidden: boolean): void;
5
9
  //#endregion
6
- export { writeColumnWidth, writeRowHeight };
10
+ export { writeColumnHidden, writeColumnManualBreak, writeColumnWidth, writeRowHeight, writeRowHidden, writeRowManualBreak };