abstract-document 6.11.0 → 6.12.1

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 (155) hide show
  1. package/lib/abstract-document/styles/group-style.d.ts.map +1 -1
  2. package/lib/abstract-document/styles/group-style.js +1 -5
  3. package/lib/abstract-document/styles/group-style.js.map +1 -1
  4. package/lib/abstract-document-xml/__tests__/layer/export-test-def.d.ts +13 -0
  5. package/lib/abstract-document-xml/__tests__/layer/export-test-def.d.ts.map +1 -0
  6. package/lib/abstract-document-xml/__tests__/layer/export-test-def.js +3 -0
  7. package/lib/abstract-document-xml/__tests__/layer/export-test-def.js.map +1 -0
  8. package/lib/abstract-document-xml/__tests__/layer/export.test.d.ts +3 -0
  9. package/lib/abstract-document-xml/__tests__/layer/export.test.d.ts.map +1 -0
  10. package/lib/abstract-document-xml/__tests__/layer/export.test.js +41 -0
  11. package/lib/abstract-document-xml/__tests__/layer/export.test.js.map +1 -0
  12. package/lib/abstract-document-xml/__tests__/layer/test-defs/simple-document.d.ts +3 -0
  13. package/lib/abstract-document-xml/__tests__/layer/test-defs/simple-document.d.ts.map +1 -0
  14. package/lib/abstract-document-xml/__tests__/layer/test-defs/simple-document.js +361 -0
  15. package/lib/abstract-document-xml/__tests__/layer/test-defs/simple-document.js.map +1 -0
  16. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.d.ts.map +1 -1
  17. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js +2 -0
  18. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js.map +1 -1
  19. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts +17 -12
  20. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts.map +1 -1
  21. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js +20 -15
  22. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js.map +1 -1
  23. package/lib/abstract-document-xml/xsd-template/custom-elements.d.ts +10 -4
  24. package/lib/abstract-document-xml/xsd-template/custom-elements.d.ts.map +1 -1
  25. package/lib/abstract-document-xml/xsd-template/custom-elements.js +41 -9
  26. package/lib/abstract-document-xml/xsd-template/custom-elements.js.map +1 -1
  27. package/lib/abstract-document-xml/xsd-template/elements.d.ts.map +1 -1
  28. package/lib/abstract-document-xml/xsd-template/elements.js +34 -8
  29. package/lib/abstract-document-xml/xsd-template/elements.js.map +1 -1
  30. package/lib/abstract-document-xml/xsd-template/xsd-template.d.ts.map +1 -1
  31. package/lib/abstract-document-xml/xsd-template/xsd-template.js +5 -2
  32. package/lib/abstract-document-xml/xsd-template/xsd-template.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/abstract-document/styles/group-style.ts +1 -5
  35. package/src/abstract-document-exporters/__tests__/docx2/tmp/Group.docx +0 -0
  36. package/src/abstract-document-exporters/__tests__/docx2/tmp/Header and footer.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Header → footer.docx +0 -0
  37. package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink and textrun.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed hyperlink → textrun.docx +0 -0
  38. package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun and images.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Mixed textrun → images.docx +0 -0
  39. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple images.docx +0 -0
  40. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple tables.docx +0 -0
  41. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Center alignment.docx +0 -0
  42. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with End alignment.docx +0 -0
  43. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment that linebreaks.docx +0 -0
  44. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment.docx +0 -0
  45. package/src/abstract-document-exporters/__tests__/docx2/tmp/Page numbering.docx +0 -0
  46. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan and rowSpan.docx and b/package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table colSpan → rowSpan.docx +0 -0
  47. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table without rows.docx +0 -0
  48. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table.docx +0 -0
  49. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single hyperlink.docx +0 -0
  50. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single image.docx +0 -0
  51. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment that linebreaks.docx +0 -0
  52. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment.docx +0 -0
  53. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment that linebreaks.docx +0 -0
  54. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment.docx +0 -0
  55. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment that linebreaks.docx +0 -0
  56. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment.docx +0 -0
  57. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun.docx +0 -0
  58. package/src/abstract-document-exporters/__tests__/docx2/tmp/hello with Arial font.docx +0 -0
  59. package/src/abstract-document-exporters/__tests__/docx2/tmp/hello.docx +0 -0
  60. package/src/abstract-document-exporters/__tests__/docx2/tmp/letter-dimensions.docx +0 -0
  61. package/src/abstract-document-exporters/__tests__/docx2/tmp/page-orientation-landscape.docx +0 -0
  62. package/src/abstract-document-exporters/__tests__/docx2/tmp/page-orientation-portrait.docx +0 -0
  63. package/src/abstract-document-exporters/__tests__/docx2/tmp/tocSeparator.docx +0 -0
  64. package/src/abstract-document-exporters/__tests__/docx2/tmp/world.docx +0 -0
  65. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position group.pdf +2 -2
  66. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position header and footer.pdf +2 -2
  67. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position paragraph.pdf +2 -2
  68. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in group.pdf +2 -2
  69. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in table.pdf +2 -2
  70. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position table.pdf +2 -2
  71. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Paragraphs.pdf +2 -2
  72. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Tables.pdf +2 -2
  73. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group no keeptogether.pdf +2 -2
  74. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group too big for one page.pdf +2 -2
  75. package/src/abstract-document-exporters/__tests__/pdf/tmp/Header and footer.pdf +2 -2
  76. package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal linktarget.pdf +2 -2
  77. package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal.pdf +2 -2
  78. package/src/abstract-document-exporters/__tests__/pdf/tmp/Manual line break.pdf +2 -2
  79. package/src/abstract-document-exporters/__tests__/pdf/tmp/Manual line breaks empty lines.pdf +2 -2
  80. package/src/abstract-document-exporters/__tests__/pdf/tmp/Margins header body footer.pdf +2 -2
  81. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun no underline.pdf +2 -2
  82. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun with underline.pdf +2 -2
  83. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun.pdf +2 -2
  84. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun and images.pdf and b/package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed textrun → images.pdf +0 -0
  85. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images overflow.pdf +0 -0
  86. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images.pdf +0 -0
  87. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Center alignment.pdf +2 -2
  88. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with End alignment.pdf +2 -2
  89. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment that linebreaks.pdf +2 -2
  90. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment.pdf +2 -2
  91. package/src/abstract-document-exporters/__tests__/pdf/tmp/Page numbering.pdf +2 -2
  92. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table row that doesnt fit page.pdf +2 -2
  93. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table single row.pdf +2 -2
  94. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with group.pdf +2 -2
  95. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header 2.pdf +2 -2
  96. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header.pdf +2 -2
  97. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin bottom.pdf +2 -2
  98. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top single table.pdf +2 -2
  99. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top.pdf +2 -2
  100. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan multipages.pdf +2 -2
  101. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan.pdf +2 -2
  102. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all auto.pdf +2 -2
  103. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all fix.pdf +2 -2
  104. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table background.pdf +2 -2
  105. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of image.pdf +0 -0
  106. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of text.pdf +2 -2
  107. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table center alignment.pdf +2 -2
  108. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table colSpan and rowSpan.pdf +2 -2
  109. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table minimal row height.pdf +2 -2
  110. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table mix auto fix.pdf +2 -2
  111. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table padding.pdf +2 -2
  112. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table right alignment.pdf +2 -2
  113. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table row alignment.pdf +2 -2
  114. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell with wrapping.pdf +2 -2
  115. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell.pdf +2 -2
  116. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with default colored borders.pdf +2 -2
  117. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with header.pdf +2 -2
  118. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with multi colored borders.pdf +2 -2
  119. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with single colored borders.pdf +2 -2
  120. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single date.pdf +14 -14
  121. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single figure.pdf +2 -2
  122. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink centered.pdf +2 -2
  123. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink no underline.pdf +2 -2
  124. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink right aligned.pdf +2 -2
  125. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink.pdf +2 -2
  126. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image from URL.pdf +0 -0
  127. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color hex.pdf +2 -2
  128. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color name.pdf +2 -2
  129. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color url.pdf +2 -2
  130. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg dasharray.pdf +2 -2
  131. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image.pdf +0 -0
  132. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline alphabetic.pdf +2 -2
  133. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline bottom.pdf +2 -2
  134. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline hanging.pdf +2 -2
  135. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline middle.pdf +2 -2
  136. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline top.pdf +2 -2
  137. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment that linebreaks.pdf +2 -2
  138. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment.pdf +2 -2
  139. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment that linebreaks.pdf +2 -2
  140. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment.pdf +2 -2
  141. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Justify alignment.pdf +2 -2
  142. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment that linebreaks.pdf +2 -2
  143. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment.pdf +2 -2
  144. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with super and subscripts.pdf +2 -2
  145. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun.pdf +2 -2
  146. package/src/abstract-document-exporters/__tests__/pdf/tmp/Table of content separator.pdf +2 -2
  147. package/src/abstract-document-exporters/__tests__/pdf/tmp/hello with roman font.pdf +2 -2
  148. package/src/abstract-document-exporters/__tests__/pdf/tmp/hello.pdf +2 -2
  149. package/src/abstract-document-exporters/__tests__/pdf/tmp/pagebreak.pdf +2 -2
  150. package/src/abstract-document-exporters/__tests__/pdf/tmp/world.pdf +2 -2
  151. package/src/abstract-document-xml/abstract-doc-of-xml/creator.ts +6 -0
  152. package/src/abstract-document-xml/abstract-doc-of-xml/custom-elements.tsx +39 -25
  153. package/src/abstract-document-xml/xsd-template/custom-elements.ts +42 -8
  154. package/src/abstract-document-xml/xsd-template/elements.ts +15 -8
  155. package/src/abstract-document-xml/xsd-template/xsd-template.ts +5 -2
@@ -71,7 +71,7 @@ endobj
71
71
  (PDFKit)
72
72
  endobj
73
73
  14 0 obj
74
- (D:20230608065812Z)
74
+ (D:20231008070042Z)
75
75
  endobj
76
76
  11 0 obj
77
77
  <<
@@ -136,7 +136,7 @@ trailer
136
136
  /Size 15
137
137
  /Root 3 0 R
138
138
  /Info 11 0 R
139
- /ID [<3e87d7be7742d4546833e51d430b2636> <3e87d7be7742d4546833e51d430b2636>]
139
+ /ID [<a986116c151e9e75a029ef15cf8e3023> <a986116c151e9e75a029ef15cf8e3023>]
140
140
  >>
141
141
  startxref
142
142
  1232
@@ -43,7 +43,7 @@ endobj
43
43
  (PDFKit)
44
44
  endobj
45
45
  12 0 obj
46
- (D:20230608065810Z)
46
+ (D:20231008070041Z)
47
47
  endobj
48
48
  9 0 obj
49
49
  <<
@@ -106,7 +106,7 @@ trailer
106
106
  /Size 13
107
107
  /Root 3 0 R
108
108
  /Info 9 0 R
109
- /ID [<934112d90e67c46dbc73bdd5306c4e9d> <934112d90e67c46dbc73bdd5306c4e9d>]
109
+ /ID [<3c4978e92cbf06a3744d252fed770832> <3c4978e92cbf06a3744d252fed770832>]
110
110
  >>
111
111
  startxref
112
112
  894
@@ -79,7 +79,7 @@ endobj
79
79
  (PDFKit)
80
80
  endobj
81
81
  15 0 obj
82
- (D:20230608065811Z)
82
+ (D:20231008070041Z)
83
83
  endobj
84
84
  12 0 obj
85
85
  <<
@@ -145,7 +145,7 @@ trailer
145
145
  /Size 16
146
146
  /Root 3 0 R
147
147
  /Info 12 0 R
148
- /ID [<f9cc22232a65c37d0c256468909cf644> <f9cc22232a65c37d0c256468909cf644>]
148
+ /ID [<149dc659d928aec55d86cfeef376379e> <149dc659d928aec55d86cfeef376379e>]
149
149
  >>
150
150
  startxref
151
151
  1212
@@ -43,7 +43,7 @@ endobj
43
43
  (PDFKit)
44
44
  endobj
45
45
  12 0 obj
46
- (D:20230608065810Z)
46
+ (D:20231008070041Z)
47
47
  endobj
48
48
  9 0 obj
49
49
  <<
@@ -106,7 +106,7 @@ trailer
106
106
  /Size 13
107
107
  /Root 3 0 R
108
108
  /Info 9 0 R
109
- /ID [<04e05e7e8ee47a45ab26c110b7d0e49b> <04e05e7e8ee47a45ab26c110b7d0e49b>]
109
+ /ID [<7768afa1bfb669e8f25caad1033a0361> <7768afa1bfb669e8f25caad1033a0361>]
110
110
  >>
111
111
  startxref
112
112
  824
@@ -43,7 +43,7 @@ endobj
43
43
  (PDFKit)
44
44
  endobj
45
45
  12 0 obj
46
- (D:20230608065812Z)
46
+ (D:20231008070042Z)
47
47
  endobj
48
48
  9 0 obj
49
49
  <<
@@ -106,7 +106,7 @@ trailer
106
106
  /Size 13
107
107
  /Root 3 0 R
108
108
  /Info 9 0 R
109
- /ID [<2d39a98aa94d3e77acb70ef84bf204f7> <2d39a98aa94d3e77acb70ef84bf204f7>]
109
+ /ID [<b540321f3bdf2098e2ba84c05061dbd3> <b540321f3bdf2098e2ba84c05061dbd3>]
110
110
  >>
111
111
  startxref
112
112
  837
@@ -29,6 +29,10 @@ import {
29
29
  TextParagraph,
30
30
  ImageCellProps,
31
31
  ImageCell,
32
+ ImageParagraphProps,
33
+ ImageRowProps,
34
+ ImageParagraph,
35
+ ImageRow,
32
36
  } from "./custom-elements";
33
37
 
34
38
  export type ADCreatorFn = (props?: Record<string, unknown>, children?: ReadonlyArray<unknown>) => unknown;
@@ -59,7 +63,9 @@ export const creators: (
59
63
  TextRow: (props: TextRowProps) => TextRow(props, styleNames),
60
64
  TextCell: (props: TextCellProps) => TextCell(props, styleNames),
61
65
  TextParagraph: (props: TextParagraphProps) => TextParagraph(props, styleNames),
66
+ ImageCRow: (props: ImageRowProps) => ImageRow(props, styleNames),
62
67
  ImageCell: (props: ImageCellProps) => ImageCell(props, styleNames),
68
+ ImageCParagraph: (props: ImageParagraphProps) => ImageParagraph(props, styleNames),
63
69
  Table: (props, children: ReadonlyArray<TableRow.TableRow>) =>
64
70
  Table.create(props as unknown as Table.TableProps, children),
65
71
  TableRow: (props, children: ReadonlyArray<TableCell.TableCell>) => TableRow.create(props, children),
@@ -44,18 +44,10 @@ export function extractStyleNames(
44
44
  return styleNameProps;
45
45
  }
46
46
 
47
- export type TextParagraphProps = {
48
- readonly text: string;
49
- readonly textStyle?: TextStyle.TextStyle;
50
- readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
51
- readonly styleNames?: string;
52
- };
47
+ export type TextRowProps = TextCellProps & {};
53
48
 
54
- export function TextParagraph(props: TextParagraphProps, styleNameTypes: Record<string, string>): Paragraph.Paragraph {
55
- const { text, textStyle, paragraphStyle } = props;
56
- const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
57
- const textRun = TextRun.create({ text, style: textStyle, styleName: styleNames.TextStyle });
58
- return Paragraph.create({ style: paragraphStyle, styleName: styleNames.ParagraphStyle }, [textRun]);
49
+ export function TextRow(props: TextRowProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
50
+ return TableRow.create({}, [TextCell(props, styleNameTypes)]);
59
51
  }
60
52
 
61
53
  export type TextCellProps = TextParagraphProps & {
@@ -73,29 +65,31 @@ export function TextCell(props: TextCellProps, styleNameTypes: Record<string, st
73
65
  return TableCell.create({ columnSpan, rowSpan, style: cellStyle, styleName: styleNames.TableCellStyle }, [paragraph]);
74
66
  }
75
67
 
76
- export type TextRowProps = TextCellProps & {};
68
+ export type TextParagraphProps = {
69
+ readonly text: string;
70
+ readonly textStyle?: TextStyle.TextStyle;
71
+ readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
72
+ readonly styleNames?: string;
73
+ };
77
74
 
78
- export function TextRow(props: TextRowProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
79
- const { text, textStyle, paragraphStyle, cellStyle, columnSpan, rowSpan } = props;
75
+ export function TextParagraph(props: TextParagraphProps, styleNameTypes: Record<string, string>): Paragraph.Paragraph {
76
+ const { text, textStyle, paragraphStyle } = props;
80
77
  const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
81
78
  const textRun = TextRun.create({ text, style: textStyle, styleName: styleNames.TextStyle });
82
- const paragraph = Paragraph.create({ style: paragraphStyle, styleName: styleNames.ParagraphStyle }, [textRun]);
83
- const tableCell = TableCell.create({ columnSpan, rowSpan, style: cellStyle, styleName: styleNames.TableCellStyle }, [
84
- paragraph,
85
- ]);
86
- return TableRow.create({}, [tableCell]);
79
+ return Paragraph.create({ style: paragraphStyle, styleName: styleNames.ParagraphStyle }, [textRun]);
80
+ }
81
+
82
+ export type ImageRowProps = ImageCellProps & {};
83
+
84
+ export function ImageRow(props: ImageCellProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
85
+ return TableRow.create({}, [ImageCell(props, styleNameTypes)]);
87
86
  }
88
87
 
89
88
  export type ImageCellProps = {
90
- readonly image: ImageResource.ImageResource | undefined;
91
- readonly width: number;
92
- readonly height: number;
93
- readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
94
89
  readonly cellStyle?: TableCellStyle.TableCellStyle;
95
90
  readonly columnSpan?: number;
96
91
  readonly rowSpan?: number;
97
- readonly styleNames?: string;
98
- };
92
+ } & ImageParagraphProps;
99
93
 
100
94
  export function ImageCell(props: ImageCellProps, styleNameTypes: Record<string, string>): TableCell.TableCell {
101
95
  const { image, width, height, paragraphStyle, cellStyle, columnSpan, rowSpan } = props;
@@ -108,3 +102,23 @@ export function ImageCell(props: ImageCellProps, styleNameTypes: Record<string,
108
102
  paragraph && [paragraph]
109
103
  );
110
104
  }
105
+
106
+ export type ImageParagraphProps = {
107
+ readonly image: ImageResource.ImageResource | undefined;
108
+ readonly width: number;
109
+ readonly height: number;
110
+ readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
111
+ readonly styleNames?: string;
112
+ };
113
+
114
+ export function ImageParagraph(
115
+ props: ImageParagraphProps,
116
+ styleNameTypes: Record<string, string>
117
+ ): Paragraph.Paragraph | undefined {
118
+ const { image, width, height, paragraphStyle } = props;
119
+ const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
120
+ const imageElement = image && Image.create({ imageResource: image, width, height });
121
+ const paragraph =
122
+ imageElement && Paragraph.create({ style: paragraphStyle, styleName: styleNames.ParagraphStyle }, [imageElement]);
123
+ return paragraph;
124
+ }
@@ -1,20 +1,22 @@
1
1
  /* eslint-disable no-useless-escape */
2
- export const textParagraph = `<xs:complexType name="TextParagraph">
2
+ export const textRow = `<xs:complexType name="TextRow">
3
3
  <xs:annotation>
4
- <xs:documentation>Shortcut to create \\<Paragraph> \\<TextRun text="..." /> \\</Paragraph></xs:documentation>
4
+ <xs:documentation>Shortcut to create a \\<TableRow> \\<TableCell> \\<Paragraph> \\<TextRun text="..." /> \\</Paragraph> \\</TableCell> \\</TableRow></xs:documentation>
5
5
  </xs:annotation>
6
6
  <xs:choice minOccurs="0" maxOccurs="1">
7
7
  <xs:element name="style" type="TextStyle" />
8
8
  </xs:choice>
9
9
  <xs:attribute name="styleNames" type="xs:string" >
10
10
  <xs:annotation>
11
- <xs:documentation>Refrence to a TextStyle that is defined in \\<AbstractDoc> \\<StyleNames> \\<StyleName name="..." /> \\</StyleNames> \\</AbstractDoc></xs:documentation>
11
+ <xs:documentation>Refrence to a TextStyle that is defined in \\<AbstractDoc> \\<StyleNames> \\<StyleName name="..." /> \\</StyleNames> \\</AbstractDoc></xs:documentation>
12
12
  </xs:annotation>
13
13
  </xs:attribute>
14
14
  <xs:attribute name="target" type="xs:string" />
15
+ <xs:attribute name="columnSpan" type="xs:string" />
16
+ <xs:attribute name="rowSpan" type="xs:string" />
15
17
  <xs:attribute name="text" type="xs:string" use="required" />
16
18
  </xs:complexType>`;
17
- export const textParagraphElement = `<xs:element name="TextParagraph" type="TextParagraph" maxOccurs="unbounded" />`;
19
+ export const textRowElement = `<xs:element name="TextRow" type="TextRow" maxOccurs="unbounded" />`;
18
20
 
19
21
  export const textCell = `<xs:complexType name="TextCell">
20
22
  <xs:annotation>
@@ -35,22 +37,54 @@ export const textCell = `<xs:complexType name="TextCell">
35
37
  </xs:complexType>`;
36
38
  export const textCellElement = `<xs:element name="TextCell" type="TextCell" minOccurs="0" maxOccurs="unbounded" />`;
37
39
 
38
- export const textRow = `<xs:complexType name="TextRow">
40
+ export const textParagraph = `<xs:complexType name="TextParagraph">
39
41
  <xs:annotation>
40
- <xs:documentation>Shortcut to create a \\<TableRow> \\<TableCell> \\<Paragraph> \\<TextRun text="..." /> \\</Paragraph> \\</TableCell> \\</TableRow></xs:documentation>
42
+ <xs:documentation>Shortcut to create \\<Paragraph> \\<TextRun text="..." /> \\</Paragraph></xs:documentation>
41
43
  </xs:annotation>
42
44
  <xs:choice minOccurs="0" maxOccurs="1">
43
45
  <xs:element name="style" type="TextStyle" />
44
46
  </xs:choice>
45
47
  <xs:attribute name="styleNames" type="xs:string" >
46
48
  <xs:annotation>
47
- <xs:documentation>Refrence to a TextStyle that is defined in \\<AbstractDoc> \\<StyleNames> \\<StyleName name="..." /> \\</StyleNames> \\</AbstractDoc></xs:documentation>
49
+ <xs:documentation>Refrence to a TextStyle that is defined in \\<AbstractDoc> \\<StyleNames> \\<StyleName name="..." /> \\</StyleNames> \\</AbstractDoc></xs:documentation>
48
50
  </xs:annotation>
49
51
  </xs:attribute>
50
52
  <xs:attribute name="target" type="xs:string" />
53
+ <xs:attribute name="text" type="xs:string" use="required" />
54
+ </xs:complexType>`;
55
+ export const textParagraphElement = `<xs:element name="TextParagraph" type="TextParagraph" maxOccurs="unbounded" />`;
56
+
57
+ export const imageRow = `<xs:complexType name="ImageRow">
58
+ <xs:annotation>
59
+ <xs:documentation>Shortcut to create a \\<TableRow> \\<TableCell> \\<Paragraph> \\<Image src text="..." /> \\</Paragraph> \\</TableCell> \\</TableRow></xs:documentation>
60
+ </xs:annotation>
61
+ <xs:attribute name="styleNames" type="xs:string" />
62
+ <xs:attribute name="target" type="xs:string" />
51
63
  <xs:attribute name="columnSpan" type="xs:string" />
52
64
  <xs:attribute name="rowSpan" type="xs:string" />
53
65
  <xs:attribute name="text" type="xs:string" use="required" />
54
66
  </xs:complexType>`;
67
+ export const imageRowElement = `<xs:element name="ImageRow" type="ImageRow" maxOccurs="unbounded" />`;
55
68
 
56
- export const textRowElement = `<xs:element name="TextRow" type="TextRow" maxOccurs="unbounded" />`;
69
+ export const imageCell = `<xs:complexType name="ImageCell">
70
+ <xs:annotation>
71
+ <xs:documentation>Shortcut to create a \\<ImageCell> \\<Paragraph> \\<Image src="..." /> \\</Paragraph> \\</TableCell></xs:documentation>
72
+ </xs:annotation>
73
+ <xs:attribute name="styleNames" type="xs:string" />
74
+ <xs:attribute name="target" type="xs:string" />
75
+ <xs:attribute name="columnSpan" type="xs:string" />
76
+ <xs:attribute name="rowSpan" type="xs:string" />
77
+ <xs:attribute name="text" type="xs:string" use="required" />
78
+ </xs:complexType>`;
79
+ export const imageCellElement = `<xs:element name="ImageCell" type="ImageCell" minOccurs="0" maxOccurs="unbounded" />`;
80
+
81
+ export const imageParagraph = `<xs:complexType name="ImageParagraph">
82
+ <xs:annotation>
83
+ <xs:documentation>Shortcut to create \\<Paragraph> \\<Image src="..." /> \\</Paragraph></xs:documentation>
84
+ </xs:annotation>
85
+ <xs:attribute name="styleNames" type="xs:string" />
86
+ <xs:attribute name="src" type="xs:string" use="required" />
87
+ <xs:attribute name="width" type="xs:decimal" use="required" />
88
+ <xs:attribute name="height" type="xs:decimal" use="required" />
89
+ </xs:complexType>`;
90
+ export const imageParagraphElement = `<xs:element name="ImageParagraph" type="ImageParagraph" maxOccurs="unbounded" />`;
@@ -1,4 +1,4 @@
1
- import { textCellElement, textParagraphElement, textRowElement } from "./custom-elements";
1
+ import * as Custom from "./custom-elements";
2
2
 
3
3
  export const abstractDoc = `<xs:element name="AbstractDoc">
4
4
  <xs:complexType>
@@ -15,7 +15,8 @@ export const section = `<xs:complexType name="Section">
15
15
  <xs:element name="Group" type="Group" minOccurs="0" />
16
16
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" />
17
17
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" />
18
- ${textParagraphElement}
18
+ ${Custom.textParagraphElement}
19
+ ${Custom.imageParagraphElement}
19
20
  <xs:element name="Markdown" type="Markdown" minOccurs="0" />
20
21
  <xs:element name="page" type="page" minOccurs="0" maxOccurs="1"></xs:element>
21
22
  </xs:choice>
@@ -38,7 +39,8 @@ export const sectionElement = `<xs:complexType name="SectionElement">
38
39
  <xs:element name="Group" type="Group" minOccurs="0" />
39
40
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" />
40
41
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" />
41
- ${textParagraphElement}
42
+ ${Custom.textParagraphElement}
43
+ ${Custom.imageParagraphElement}
42
44
  <xs:element name="Markdown" type="Markdown" minOccurs="0" />
43
45
  </xs:choice>
44
46
  </xs:complexType>`;
@@ -49,7 +51,8 @@ export const group = `<xs:complexType name="Group">
49
51
  <xs:element name="Group" type="Group" minOccurs="0" />
50
52
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" />
51
53
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" />
52
- ${textParagraphElement}
54
+ ${Custom.textParagraphElement}
55
+ ${Custom.imageParagraphElement}
53
56
  <xs:element name="style" type="GroupStyle" minOccurs="0" />
54
57
  </xs:choice>
55
58
  <xs:attribute name="keepTogether" type="xs:boolean" />
@@ -62,7 +65,8 @@ export const table = `<xs:complexType name="Table">
62
65
  <xs:sequence>
63
66
  <xs:choice minOccurs="1">
64
67
  <xs:element name="TableRow" type="TableRow" maxOccurs="unbounded" />
65
- ${textRowElement}
68
+ ${Custom.textRowElement}
69
+ ${Custom.imageRowElement}
66
70
  </xs:choice>
67
71
  </xs:sequence>
68
72
  </xs:choice>
@@ -82,7 +86,8 @@ export const headerRows = `<xs:complexType name="headerRows">
82
86
  <xs:sequence>
83
87
  <xs:choice minOccurs="1" maxOccurs="unbounded">
84
88
  <xs:element name="TableRow" type="TableRow"/>
85
- ${textRowElement}
89
+ ${Custom.textRowElement}
90
+ ${Custom.imageRowElement}
86
91
  </xs:choice>
87
92
  </xs:sequence>
88
93
  </xs:complexType>`;
@@ -90,7 +95,8 @@ export const headerRows = `<xs:complexType name="headerRows">
90
95
  export const tableRow = `<xs:complexType name="TableRow">
91
96
  <xs:choice maxOccurs="unbounded">
92
97
  <xs:element name="TableCell" type="TableCell" minOccurs="0" maxOccurs="unbounded" />
93
- ${textCellElement}
98
+ ${Custom.textCellElement}
99
+ ${Custom.imageCellElement}
94
100
  </xs:choice>
95
101
  </xs:complexType>`;
96
102
 
@@ -101,7 +107,8 @@ export const tableCell = `<xs:complexType name="TableCell">
101
107
  <xs:element name="Group" type="Group" minOccurs="0" maxOccurs="unbounded" />
102
108
  <xs:element name="PageBreak" type="PageBreak" minOccurs="0" maxOccurs="unbounded" />
103
109
  <xs:element name="Paragraph" type="Paragraph" minOccurs="0" maxOccurs="unbounded" />
104
- ${textParagraphElement}
110
+ ${Custom.textParagraphElement}
111
+ ${Custom.imageParagraphElement}
105
112
  <xs:element name="Markdown" type="Markdown" minOccurs="0" maxOccurs="unbounded" />
106
113
  </xs:choice>
107
114
  <xs:attribute name="rowSpan" type="xs:integer" />
@@ -27,9 +27,12 @@ ${Elements.tableRow}
27
27
  ${Elements.headerRows}
28
28
  ${Elements.table}
29
29
  ${Elements.tableCell}
30
- ${CustomElements.textParagraph}
30
+ ${CustomElements.textRow}
31
31
  ${CustomElements.textCell}
32
- ${CustomElements.textRow}`;
32
+ ${CustomElements.textParagraph}
33
+ ${CustomElements.imageRow}
34
+ ${CustomElements.imageCell}
35
+ ${CustomElements.imageParagraph}`;
33
36
 
34
37
  export const xsd = `<?xml version="1.0" encoding="UTF-8"?>
35
38
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">