abstract-document 6.12.6 → 6.12.8

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 (131) hide show
  1. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.d.ts +2 -5
  2. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.d.ts.map +1 -1
  3. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js +15 -25
  4. package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js.map +1 -1
  5. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts +21 -11
  6. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts.map +1 -1
  7. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js +12 -12
  8. package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js.map +1 -1
  9. package/lib/abstract-document-xml/xsd-template/custom-elements.d.ts +5 -5
  10. package/lib/abstract-document-xml/xsd-template/custom-elements.d.ts.map +1 -1
  11. package/lib/abstract-document-xml/xsd-template/custom-elements.js +7 -7
  12. package/package.json +2 -2
  13. package/src/abstract-document-exporters/__tests__/docx2/tmp/Group.docx +0 -0
  14. 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
  15. 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
  16. 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
  17. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple images.docx +0 -0
  18. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple tables.docx +0 -0
  19. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Center alignment.docx +0 -0
  20. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with End alignment.docx +0 -0
  21. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment that linebreaks.docx +0 -0
  22. package/src/abstract-document-exporters/__tests__/docx2/tmp/Multiple textrun with Start alignment.docx +0 -0
  23. package/src/abstract-document-exporters/__tests__/docx2/tmp/Page numbering.docx +0 -0
  24. 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
  25. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table without rows.docx +0 -0
  26. package/src/abstract-document-exporters/__tests__/docx2/tmp/Simple table.docx +0 -0
  27. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single hyperlink.docx +0 -0
  28. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single image.docx +0 -0
  29. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment that linebreaks.docx +0 -0
  30. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Center alignment.docx +0 -0
  31. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment that linebreaks.docx +0 -0
  32. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with End alignment.docx +0 -0
  33. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment that linebreaks.docx +0 -0
  34. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun with Start alignment.docx +0 -0
  35. package/src/abstract-document-exporters/__tests__/docx2/tmp/Single textrun.docx +0 -0
  36. package/src/abstract-document-exporters/__tests__/docx2/tmp/hello with Arial font.docx +0 -0
  37. package/src/abstract-document-exporters/__tests__/docx2/tmp/hello.docx +0 -0
  38. package/src/abstract-document-exporters/__tests__/docx2/tmp/letter-dimensions.docx +0 -0
  39. package/src/abstract-document-exporters/__tests__/docx2/tmp/page-orientation-landscape.docx +0 -0
  40. package/src/abstract-document-exporters/__tests__/docx2/tmp/page-orientation-portrait.docx +0 -0
  41. package/src/abstract-document-exporters/__tests__/docx2/tmp/tocSeparator.docx +0 -0
  42. package/src/abstract-document-exporters/__tests__/docx2/tmp/world.docx +0 -0
  43. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position group.pdf +2 -2
  44. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position header and footer.pdf +2 -2
  45. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position paragraph.pdf +2 -2
  46. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in group.pdf +2 -2
  47. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position section in table.pdf +2 -2
  48. package/src/abstract-document-exporters/__tests__/pdf/tmp/Absolute position table.pdf +2 -2
  49. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Paragraphs.pdf +2 -2
  50. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group Tables.pdf +2 -2
  51. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group no keeptogether.pdf +2 -2
  52. package/src/abstract-document-exporters/__tests__/pdf/tmp/Group too big for one page.pdf +2 -2
  53. package/src/abstract-document-exporters/__tests__/pdf/tmp/Header and footer.pdf +2 -2
  54. package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal linktarget.pdf +2 -2
  55. package/src/abstract-document-exporters/__tests__/pdf/tmp/Hyperlink internal.pdf +2 -2
  56. package/src/abstract-document-exporters/__tests__/pdf/tmp/Manual line break.pdf +2 -2
  57. package/src/abstract-document-exporters/__tests__/pdf/tmp/Manual line breaks empty lines.pdf +2 -2
  58. package/src/abstract-document-exporters/__tests__/pdf/tmp/Margins header body footer.pdf +2 -2
  59. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun no underline.pdf +2 -2
  60. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun with underline.pdf +2 -2
  61. package/src/abstract-document-exporters/__tests__/pdf/tmp/Mixed hyperlink and textrun.pdf +2 -2
  62. 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
  63. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images overflow.pdf +0 -0
  64. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple images.pdf +0 -0
  65. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Center alignment.pdf +2 -2
  66. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with End alignment.pdf +2 -2
  67. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment that linebreaks.pdf +2 -2
  68. package/src/abstract-document-exporters/__tests__/pdf/tmp/Multiple textrun with Start alignment.pdf +2 -2
  69. package/src/abstract-document-exporters/__tests__/pdf/tmp/Page numbering.pdf +2 -2
  70. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table row that doesnt fit page.pdf +2 -2
  71. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table single row.pdf +2 -2
  72. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with group.pdf +2 -2
  73. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header 2.pdf +2 -2
  74. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with header.pdf +2 -2
  75. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin bottom.pdf +2 -2
  76. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top single table.pdf +2 -2
  77. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with margin top.pdf +2 -2
  78. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan multipages.pdf +2 -2
  79. package/src/abstract-document-exporters/__tests__/pdf/tmp/Pagebreak table with rowSpan.pdf +2 -2
  80. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all auto.pdf +2 -2
  81. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table all fix.pdf +2 -2
  82. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table background.pdf +2 -2
  83. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of image.pdf +0 -0
  84. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table cell padding of text.pdf +2 -2
  85. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table center alignment.pdf +2 -2
  86. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table colSpan and rowSpan.pdf +2 -2
  87. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table minimal row height.pdf +2 -2
  88. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table mix auto fix.pdf +2 -2
  89. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table padding.pdf +2 -2
  90. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table right alignment.pdf +2 -2
  91. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table row alignment.pdf +2 -2
  92. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell with wrapping.pdf +2 -2
  93. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table text alignment in cell.pdf +2 -2
  94. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with default colored borders.pdf +2 -2
  95. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with header.pdf +2 -2
  96. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with multi colored borders.pdf +2 -2
  97. package/src/abstract-document-exporters/__tests__/pdf/tmp/Simple table with single colored borders.pdf +2 -2
  98. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single date.pdf +2 -2
  99. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single figure.pdf +2 -2
  100. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink centered.pdf +2 -2
  101. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink no underline.pdf +2 -2
  102. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink right aligned.pdf +2 -2
  103. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single hyperlink.pdf +2 -2
  104. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image from URL.pdf +0 -0
  105. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color hex.pdf +2 -2
  106. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color name.pdf +2 -2
  107. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg color url.pdf +2 -2
  108. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image svg dasharray.pdf +2 -2
  109. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single image.pdf +0 -0
  110. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline alphabetic.pdf +2 -2
  111. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline bottom.pdf +2 -2
  112. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline hanging.pdf +2 -2
  113. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline middle.pdf +2 -2
  114. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun baseline top.pdf +2 -2
  115. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment that linebreaks.pdf +2 -2
  116. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Center alignment.pdf +2 -2
  117. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment that linebreaks.pdf +2 -2
  118. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with End alignment.pdf +2 -2
  119. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Justify alignment.pdf +2 -2
  120. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment that linebreaks.pdf +2 -2
  121. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with Start alignment.pdf +2 -2
  122. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun with super and subscripts.pdf +2 -2
  123. package/src/abstract-document-exporters/__tests__/pdf/tmp/Single textrun.pdf +2 -2
  124. package/src/abstract-document-exporters/__tests__/pdf/tmp/Table of content separator.pdf +2 -2
  125. package/src/abstract-document-exporters/__tests__/pdf/tmp/hello with roman font.pdf +2 -2
  126. package/src/abstract-document-exporters/__tests__/pdf/tmp/hello.pdf +2 -2
  127. package/src/abstract-document-exporters/__tests__/pdf/tmp/pagebreak.pdf +2 -2
  128. package/src/abstract-document-exporters/__tests__/pdf/tmp/world.pdf +2 -2
  129. package/src/abstract-document-xml/abstract-doc-of-xml/creator.ts +17 -28
  130. package/src/abstract-document-xml/abstract-doc-of-xml/custom-elements.tsx +28 -24
  131. package/src/abstract-document-xml/xsd-template/custom-elements.ts +7 -7
@@ -71,7 +71,7 @@ endobj
71
71
  (PDFKit)
72
72
  endobj
73
73
  14 0 obj
74
- (D:20231008113501Z)
74
+ (D:20231008115808Z)
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 [<5b415ba7db17530738cce406c9ec035a> <5b415ba7db17530738cce406c9ec035a>]
139
+ /ID [<41e71d861a1a625d5078d9dc5408f12f> <41e71d861a1a625d5078d9dc5408f12f>]
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:20231008113500Z)
46
+ (D:20231008115806Z)
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 [<7faae0f942a678feb6189237691c5ce4> <7faae0f942a678feb6189237691c5ce4>]
109
+ /ID [<810f3941d064af38ff82e0c2405d678e> <810f3941d064af38ff82e0c2405d678e>]
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:20231008113501Z)
82
+ (D:20231008115807Z)
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 [<67fe9ec65a3bd599a3b1d201491ee442> <67fe9ec65a3bd599a3b1d201491ee442>]
148
+ /ID [<6ca4670ddedcc61748157cf907154719> <6ca4670ddedcc61748157cf907154719>]
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:20231008113500Z)
46
+ (D:20231008115806Z)
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 [<bd69f3024b3ae1b84a0886e4b9baf804> <bd69f3024b3ae1b84a0886e4b9baf804>]
109
+ /ID [<0401ed786b4941c90f6f899b18612b9f> <0401ed786b4941c90f6f899b18612b9f>]
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:20231008113501Z)
46
+ (D:20231008115808Z)
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 [<117951b01a6d19130be86a44631daba9> <117951b01a6d19130be86a44631daba9>]
109
+ /ID [<811e2c0578472193d0ded3101de72ed9> <811e2c0578472193d0ded3101de72ed9>]
110
110
  >>
111
111
  startxref
112
112
  837
@@ -19,7 +19,6 @@ import {
19
19
  TextRun,
20
20
  TocSeparator,
21
21
  Types,
22
- ImageResource as ADImageResource,
23
22
  TextStyle,
24
23
  } from "../../abstract-document/index";
25
24
  import {
@@ -35,12 +34,11 @@ import {
35
34
  ImageRowProps,
36
35
  ImageParagraph,
37
36
  ImageRow,
37
+ ImageResource,
38
38
  } from "./custom-elements";
39
39
 
40
40
  export type ADCreatorFn = (props?: Record<string, unknown>, children?: ReadonlyArray<unknown>) => unknown;
41
41
 
42
- export type ImageResource = ADImageResource.ImageResource & { readonly width?: number; readonly height?: number };
43
-
44
42
  export type TextRunProps = {
45
43
  readonly text: string;
46
44
  readonly styleName?: string;
@@ -65,22 +63,11 @@ export const creators: (
65
63
  TextCell: (props: TextCellProps) => TextCell(props, styleNames),
66
64
  TextParagraph: (props: TextParagraphProps) => TextParagraph(props, styleNames),
67
65
  TextRun: (props) => TextRun.create(props as unknown as TextRun.TextRunProps),
68
- ImageRow: (props: ImageRowProps) => {
69
- mutateImageProps(images, props);
70
- return ImageRow(props, styleNames);
71
- },
72
- ImageCell: (props: ImageCellProps) => {
73
- mutateImageProps(images, props);
74
- return ImageCell(props, styleNames);
75
- },
76
- ImageParagraph: (props: ImageParagraphProps) => {
77
- mutateImageProps(images, props);
78
- return ImageParagraph(props, styleNames);
79
- },
80
- Image: (props: Record<string, unknown>) => {
81
- mutateImageProps(images, props);
82
- return Image.create(props as unknown as Image.ImageProps);
83
- },
66
+ ImageRow: (props: ImageRowProps) => ImageRow(imageProps(images, props) as unknown as ImageRowProps, styleNames),
67
+ ImageCell: (props: ImageCellProps) => ImageCell(imageProps(images, props) as unknown as ImageCellProps, styleNames),
68
+ ImageParagraph: (props: ImageParagraphProps) =>
69
+ ImageParagraph(imageProps(images, props) as unknown as ImageParagraphProps, styleNames),
70
+ Image: (props: Record<string, unknown>) => Image.create(imageProps(images, props) as unknown as Image.ImageProps),
84
71
  Table: (props, children: ReadonlyArray<TableRow.TableRow>) =>
85
72
  Table.create(props as unknown as Table.TableProps, children),
86
73
  TableRow: (props, children: ReadonlyArray<TableCell.TableCell>) => TableRow.create(props, children),
@@ -267,22 +254,24 @@ export const propsCreators: Record<string, ADCreatorFn> = {
267
254
  },
268
255
  };
269
256
 
270
- function mutateImageProps(images: Record<string, ImageResource>, props: Record<string, unknown>): void {
271
- const image = images[(props.src as string) ?? ""];
257
+ function imageProps(images: Record<string, ImageResource>, props: Record<string, unknown>): Record<string, unknown> {
258
+ const newProps = { ...props };
259
+ const image = images[(newProps.src as string) ?? ""];
272
260
  if (image) {
273
261
  if (image.width && image.height) {
274
- props.width = image.width;
275
- props.height = image.height;
262
+ newProps.width = image.width;
263
+ newProps.height = image.height;
276
264
  } else {
277
- const scaleX = (props.width as number) / image.abstractImage.size.width;
278
- const scaleY = (props.height as number) / image.abstractImage.size.height;
265
+ const scaleX = (newProps.width as number) / image.abstractImage.size.width;
266
+ const scaleY = (newProps.height as number) / image.abstractImage.size.height;
279
267
  if (scaleX < scaleY) {
280
- props.height = (props.height as number) * (scaleX / scaleY);
268
+ newProps.height = (newProps.height as number) * (scaleX / scaleY);
281
269
  } else {
282
- props.width = (props.width as number) * (scaleY / scaleX);
270
+ newProps.width = (newProps.width as number) * (scaleY / scaleX);
283
271
  }
284
272
  }
285
273
 
286
- props.imageResource = images[props.src as string];
274
+ newProps.imageResource = images[newProps.src as string];
287
275
  }
276
+ return newProps;
288
277
  }
@@ -2,12 +2,12 @@ import {
2
2
  TextStyle,
3
3
  ParagraphStyle,
4
4
  TableCellStyle,
5
- ImageResource,
6
5
  TextRun,
7
6
  Paragraph,
8
7
  TableCell,
9
8
  TableRow,
10
9
  Image,
10
+ ImageResource as ADImageResource,
11
11
  } from "../../abstract-document/index";
12
12
 
13
13
  type StyleProps = {
@@ -44,69 +44,73 @@ export function extractStyleNames(
44
44
  return styleNameProps;
45
45
  }
46
46
 
47
- export type TextRowProps = TextCellProps & {};
47
+ export type TextRowProps = Omit<TextCellProps, "style"> & { readonly cellStyle?: TableCellStyle.TableCellStyle };
48
48
 
49
49
  export function TextRow(props: TextRowProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
50
- return TableRow.create({}, [TextCell(props, styleNameTypes)]);
50
+ return TableRow.create({}, [TextCell({ ...props, style: props.cellStyle }, styleNameTypes)]);
51
51
  }
52
52
 
53
- export type TextCellProps = TextParagraphProps & {
53
+ export type TextCellProps = Omit<TextParagraphProps, "style"> & {
54
54
  readonly columnSpan?: number;
55
55
  readonly rowSpan?: number;
56
- readonly cellStyle?: TableCellStyle.TableCellStyle;
56
+ readonly style?: TableCellStyle.TableCellStyle;
57
+ readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
57
58
  readonly styleNames?: string;
58
59
  };
59
60
 
60
61
  export function TextCell(props: TextCellProps, styleNameTypes: Record<string, string>): TableCell.TableCell {
61
- const { text, textStyle, paragraphStyle, cellStyle, columnSpan, rowSpan } = props;
62
+ const { text, textStyle, paragraphStyle, style, columnSpan, rowSpan } = props;
62
63
  const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
63
64
  const textRun = TextRun.create({ text, style: textStyle, styleName: styleNames.TextStyle });
64
65
  const paragraph = Paragraph.create({ style: paragraphStyle, styleName: styleNames.ParagraphStyle }, [textRun]);
65
- return TableCell.create({ columnSpan, rowSpan, style: cellStyle, styleName: styleNames.TableCellStyle }, [paragraph]);
66
+ return TableCell.create({ columnSpan, rowSpan, style, styleName: styleNames.TableCellStyle }, [paragraph]);
66
67
  }
67
68
 
68
69
  export type TextParagraphProps = {
69
70
  readonly text: string;
71
+ readonly style?: ParagraphStyle.ParagraphStyle;
70
72
  readonly textStyle?: TextStyle.TextStyle;
71
- readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
72
73
  readonly styleNames?: string;
73
74
  };
74
75
 
75
76
  export function TextParagraph(props: TextParagraphProps, styleNameTypes: Record<string, string>): Paragraph.Paragraph {
76
- const { text, textStyle, paragraphStyle } = props;
77
+ const { text, textStyle, style } = props;
77
78
  const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
78
79
  const textRun = TextRun.create({ text, style: textStyle, styleName: styleNames.TextStyle });
79
- return Paragraph.create({ style: paragraphStyle, styleName: styleNames.ParagraphStyle }, [textRun]);
80
+ return Paragraph.create({ style, styleName: styleNames.ParagraphStyle }, [textRun]);
80
81
  }
81
82
 
82
- export type ImageRowProps = ImageCellProps & {};
83
+ export type ImageResource = ADImageResource.ImageResource & { readonly width?: number; readonly height?: number };
83
84
 
84
- export function ImageRow(props: ImageCellProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
85
- return TableRow.create({}, [ImageCell(props, styleNameTypes)]);
85
+ export type ImageRowProps = Omit<ImageCellProps, "style"> & { readonly cellStyle?: TableCellStyle.TableCellStyle };
86
+
87
+ export function ImageRow(props: ImageRowProps, styleNameTypes: Record<string, string>): TableRow.TableRow {
88
+ return TableRow.create({}, [ImageCell({ ...props, style: props.cellStyle }, styleNameTypes)]);
86
89
  }
87
90
 
88
- export type ImageCellProps = {
89
- readonly cellStyle?: TableCellStyle.TableCellStyle;
91
+ export type ImageCellProps = Omit<ImageParagraphProps, "style"> & {
92
+ readonly style?: TableCellStyle.TableCellStyle;
93
+ readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
90
94
  readonly columnSpan?: number;
91
95
  readonly rowSpan?: number;
92
- } & ImageParagraphProps;
96
+ };
93
97
 
94
98
  export function ImageCell(props: ImageCellProps, styleNameTypes: Record<string, string>): TableCell.TableCell {
95
- const { image, width, height, paragraphStyle, cellStyle, columnSpan, rowSpan } = props;
99
+ const { imageResource, width, height, paragraphStyle, style, columnSpan, rowSpan } = props;
96
100
  const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
97
- const imageElement = image && Image.create({ imageResource: image, width, height });
101
+ const imageElement = imageResource && Image.create({ imageResource, width, height });
98
102
  const pararaphProps = { style: paragraphStyle, styleName: styleNames.ParagraphStyle };
99
103
  const paragraph = imageElement
100
104
  ? Paragraph.create(pararaphProps, [imageElement])
101
105
  : Paragraph.create(pararaphProps, [ImageMissing]);
102
- return TableCell.create({ columnSpan, rowSpan, style: cellStyle, styleName: styleNames.TableCellStyle }, [paragraph]);
106
+ return TableCell.create({ columnSpan, rowSpan, style, styleName: styleNames.TableCellStyle }, [paragraph]);
103
107
  }
104
108
 
105
109
  export type ImageParagraphProps = {
106
- readonly image: ImageResource.ImageResource | undefined;
110
+ readonly imageResource: ImageResource;
107
111
  readonly width: number;
108
112
  readonly height: number;
109
- readonly paragraphStyle?: ParagraphStyle.ParagraphStyle;
113
+ readonly style?: ParagraphStyle.ParagraphStyle;
110
114
  readonly styleNames?: string;
111
115
  };
112
116
 
@@ -114,10 +118,10 @@ export function ImageParagraph(
114
118
  props: ImageParagraphProps,
115
119
  styleNameTypes: Record<string, string>
116
120
  ): Paragraph.Paragraph | undefined {
117
- const { image, width, height, paragraphStyle } = props;
121
+ const { imageResource, width, height, style } = props;
118
122
  const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
119
- const imageElement = image && Image.create({ imageResource: image, width, height });
120
- const pararaphProps = { style: paragraphStyle, styleName: styleNames.ParagraphStyle };
123
+ const imageElement = imageResource && Image.create({ imageResource, width, height });
124
+ const pararaphProps = { style, styleName: styleNames.ParagraphStyle };
121
125
  return imageElement
122
126
  ? Paragraph.create(pararaphProps, [imageElement])
123
127
  : Paragraph.create(pararaphProps, [ImageMissing]);
@@ -10,7 +10,7 @@ export const textRow = `<xs:complexType name="TextRow">
10
10
  <xs:element name="paragraphStyle" type="ParagraphStyle" />
11
11
  </xs:choice>
12
12
  <xs:choice minOccurs="0" maxOccurs="1">
13
- <xs:element name="style" type="TextStyle" />
13
+ <xs:element name="textStyle" type="TextStyle" />
14
14
  </xs:choice>
15
15
  <xs:attribute name="styleNames" type="xs:string" >
16
16
  <xs:annotation>
@@ -29,13 +29,13 @@ export const textCell = `<xs:complexType name="TextCell">
29
29
  <xs:documentation>Shortcut to create a \\<TableCell> \\<Paragraph> \\<TextRun text="..." /> \\</Paragraph> \\</TableCell></xs:documentation>
30
30
  </xs:annotation>
31
31
  <xs:choice minOccurs="0" maxOccurs="1">
32
- <xs:element name="cellStyle" type="TableCellStyle" />
32
+ <xs:element name="style" type="TableCellStyle" />
33
33
  </xs:choice>
34
34
  <xs:choice minOccurs="0" maxOccurs="1">
35
35
  <xs:element name="paragraphStyle" type="ParagraphStyle" />
36
36
  </xs:choice>
37
37
  <xs:choice minOccurs="0" maxOccurs="1">
38
- <xs:element name="style" type="TextStyle" />
38
+ <xs:element name="textStyle" type="TextStyle" />
39
39
  </xs:choice>
40
40
  <xs:attribute name="styleNames" type="xs:string" >
41
41
  <xs:annotation>
@@ -54,10 +54,10 @@ export const textParagraph = `<xs:complexType name="TextParagraph">
54
54
  <xs:documentation>Shortcut to create \\<Paragraph> \\<TextRun text="..." /> \\</Paragraph></xs:documentation>
55
55
  </xs:annotation>
56
56
  <xs:choice minOccurs="0" maxOccurs="1">
57
- <xs:element name="paragraphStyle" type="ParagraphStyle" />
57
+ <xs:element name="style" type="ParagraphStyle" />
58
58
  </xs:choice>
59
59
  <xs:choice minOccurs="0" maxOccurs="1">
60
- <xs:element name="style" type="TextStyle" />
60
+ <xs:element name="textStyle" type="TextStyle" />
61
61
  </xs:choice>
62
62
  <xs:attribute name="styleNames" type="xs:string" >
63
63
  <xs:annotation>
@@ -99,7 +99,7 @@ export const imageCell = `<xs:complexType name="ImageCell">
99
99
  <xs:attribute name="width" type="xs:decimal" />
100
100
  <xs:attribute name="height" type="xs:decimal" />
101
101
  <xs:choice minOccurs="0" maxOccurs="1">
102
- <xs:element name="cellStyle" type="TableCellStyle" />
102
+ <xs:element name="style" type="TableCellStyle" />
103
103
  </xs:choice>
104
104
  <xs:choice minOccurs="0" maxOccurs="1">
105
105
  <xs:element name="paragraphStyle" type="ParagraphStyle" />
@@ -116,7 +116,7 @@ export const imageParagraph = `<xs:complexType name="ImageParagraph">
116
116
  <xs:attribute name="width" type="xs:decimal" />
117
117
  <xs:attribute name="height" type="xs:decimal" />
118
118
  <xs:choice minOccurs="0" maxOccurs="1">
119
- <xs:element name="paragraphStyle" type="ParagraphStyle" />
119
+ <xs:element name="style" type="ParagraphStyle" />
120
120
  </xs:choice>
121
121
  </xs:complexType>`;
122
122
  export const imageParagraphElement = `<xs:element name="ImageParagraph" type="ImageParagraph" maxOccurs="unbounded" />`;