@elisra-devops/docgen-skins 0.10.8 → 0.10.9
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.
- package/bin/index.js +3 -3
- package/bin/index.js.map +1 -1
- package/bin/models/json/JSONRun.js +39 -35
- package/bin/models/json/JSONRun.js.map +1 -1
- package/bin/models/json/default.js +12 -9
- package/bin/models/json/default.js.map +1 -1
- package/bin/models/json/paragraph/JSONRichTextParagraph.d.ts +134 -2
- package/bin/models/json/paragraph/JSONRichTextParagraph.js +402 -53
- package/bin/models/json/paragraph/JSONRichTextParagraph.js.map +1 -1
- package/bin/models/json/wordJsonModels.d.ts +41 -4
- package/package.json +1 -1
- package/src/index.ts +3 -9
- package/src/models/json/JSONRun.ts +36 -32
- package/src/models/json/default.ts +12 -9
- package/src/models/json/paragraph/JSONRichTextParagraph.ts +428 -405
- package/src/models/json/wordJsonModels.ts +49 -4
|
@@ -3,69 +3,418 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const JSONHtml_1 = __importDefault(require("../html/JSONHtml"));
|
|
7
|
-
const JSONParagraph_1 = __importDefault(require("./JSONParagraph"));
|
|
8
|
-
const JSONTable_1 = __importDefault(require("../table/JSONTable"));
|
|
9
6
|
const logger_1 = __importDefault(require("../../../services/logger"));
|
|
10
7
|
class JSONRichTextParagraph {
|
|
11
8
|
constructor(field, paragraphStyles, wiId, headingLevel, skipImageFormat = false) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.paragraphTemplate = this.generateJsonRichTextParagraphs(field, this.paragraphStyles, skipImageFormat);
|
|
15
|
-
if (headingLevel && field.name === 'Title: ') {
|
|
16
|
-
this.paragraphTemplate.headingLevel = headingLevel;
|
|
9
|
+
if (!field || !field.richTextNodes) {
|
|
10
|
+
throw new Error('Invalid field or missing richTextNodes');
|
|
17
11
|
}
|
|
12
|
+
this.paragraphStyles = paragraphStyles || {
|
|
13
|
+
isBold: false,
|
|
14
|
+
IsItalic: false,
|
|
15
|
+
IsUnderline: false,
|
|
16
|
+
Size: 12,
|
|
17
|
+
Uri: null,
|
|
18
|
+
Font: 'Arial',
|
|
19
|
+
InsertLineBreak: false,
|
|
20
|
+
InsertSpace: false,
|
|
21
|
+
};
|
|
22
|
+
this.wiId = wiId;
|
|
23
|
+
this.paragraphTemplate = this.buildDocFromNodes(field.richTextNodes);
|
|
18
24
|
} //constructor
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
25
|
+
getJSONRichTextParagraph() {
|
|
26
|
+
return this.paragraphTemplate;
|
|
27
|
+
} //getJSONTable
|
|
28
|
+
/**
|
|
29
|
+
* Parses a given RichNode and returns a corresponding Paragraph, Table, List,
|
|
30
|
+
* an array of these types, or null if the node type is not recognized.
|
|
31
|
+
*
|
|
32
|
+
* @param node - The RichNode to be parsed.
|
|
33
|
+
* @returns A Paragraph, Table, List, an array of these types, or null.
|
|
34
|
+
*
|
|
35
|
+
* The function handles different node types as follows:
|
|
36
|
+
* - 'paragraph': Parses the node as a paragraph.
|
|
37
|
+
* - 'table': Parses the node as a table.
|
|
38
|
+
* - 'list': Parses the node as a list.
|
|
39
|
+
* - 'text', 'image', 'break': Converts the node to a paragraph with a single run.
|
|
40
|
+
* - 'other': Recursively parses child nodes and returns an array of results.
|
|
41
|
+
* - Default: Returns null for unrecognized node types.
|
|
42
|
+
*/
|
|
43
|
+
parseNode(node) {
|
|
44
|
+
if (!node)
|
|
45
|
+
return null;
|
|
46
|
+
// Ensure node has valid type
|
|
47
|
+
if (typeof node.type !== 'string') {
|
|
48
|
+
logger_1.default.warn(`Invalid node type encountered: ${JSON.stringify(node)}`);
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
switch (node.type) {
|
|
52
|
+
case 'paragraph':
|
|
53
|
+
return this.parseParagraphNode(node);
|
|
54
|
+
case 'table':
|
|
55
|
+
return this.parseTableNode(node);
|
|
56
|
+
case 'list':
|
|
57
|
+
return this.parseList(node);
|
|
58
|
+
case 'text':
|
|
59
|
+
case 'image':
|
|
60
|
+
case 'break':
|
|
61
|
+
return { type: 'paragraph', runs: [this.nodeToRun(node)] };
|
|
62
|
+
case 'other':
|
|
63
|
+
let childrenResults = [];
|
|
64
|
+
for (const child of node.children) {
|
|
65
|
+
const childResult = this.parseNode(child);
|
|
66
|
+
if (Array.isArray(childResult)) {
|
|
67
|
+
childrenResults.push(...childResult);
|
|
68
|
+
}
|
|
69
|
+
else if (childResult) {
|
|
70
|
+
childrenResults.push(childResult);
|
|
71
|
+
}
|
|
57
72
|
}
|
|
73
|
+
return childrenResults.length > 0 ? childrenResults : null;
|
|
74
|
+
default:
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Parses a paragraph node and converts it into a Paragraph object.
|
|
80
|
+
*
|
|
81
|
+
* @param node - The node to parse, expected to have a `children` property.
|
|
82
|
+
* @returns A Paragraph object containing the parsed runs.
|
|
83
|
+
*/
|
|
84
|
+
parseParagraphNode(node) {
|
|
85
|
+
if (!node || !Array.isArray(node.children)) {
|
|
86
|
+
return { type: 'paragraph', runs: [] };
|
|
87
|
+
}
|
|
88
|
+
const runs = this.gatherRuns(node.children);
|
|
89
|
+
// Ensure at least one run exists
|
|
90
|
+
if (runs.length === 0) {
|
|
91
|
+
runs.push({
|
|
92
|
+
type: 'text',
|
|
93
|
+
value: '',
|
|
94
|
+
textStyling: {
|
|
95
|
+
Bold: this.paragraphStyles.isBold,
|
|
96
|
+
Italic: this.paragraphStyles.IsItalic,
|
|
97
|
+
Size: this.paragraphStyles.Size,
|
|
98
|
+
Font: this.paragraphStyles.Font,
|
|
99
|
+
Uri: this.paragraphStyles.Uri,
|
|
100
|
+
InsertLineBreak: this.paragraphStyles.InsertLineBreak,
|
|
101
|
+
InsertSpace: this.paragraphStyles.InsertSpace,
|
|
102
|
+
Underline: this.paragraphStyles.IsUnderline,
|
|
103
|
+
},
|
|
58
104
|
});
|
|
59
|
-
return richTextSkin;
|
|
60
105
|
}
|
|
61
|
-
|
|
62
|
-
|
|
106
|
+
return { type: 'paragraph', runs };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Gathers runs from the provided children nodes.
|
|
110
|
+
*
|
|
111
|
+
* This method processes an array of child nodes and converts them into an array of `Run` objects.
|
|
112
|
+
* It handles different types of nodes such as text, image, break, paragraph, table, list, and other.
|
|
113
|
+
*
|
|
114
|
+
* - For `text`, `image`, and `break` nodes, it directly converts them to `Run` objects.
|
|
115
|
+
* - For `paragraph` nodes, it recursively gathers runs from the child paragraphs.
|
|
116
|
+
* - For `table` and `list` nodes, it adds a placeholder `Run` object indicating the embedded type.
|
|
117
|
+
* - For `other` nodes, it recursively gathers runs from the child nodes.
|
|
118
|
+
*
|
|
119
|
+
* @param children - An array of child nodes to process.
|
|
120
|
+
* @returns An array of `Run` objects representing the gathered runs.
|
|
121
|
+
*/
|
|
122
|
+
gatherRuns(children) {
|
|
123
|
+
if (!Array.isArray(children))
|
|
63
124
|
return [];
|
|
125
|
+
const runs = [];
|
|
126
|
+
for (const child of children) {
|
|
127
|
+
if (!child || typeof child.type !== 'string') {
|
|
128
|
+
logger_1.default.warn('Invalid child node:', child);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
try {
|
|
132
|
+
if (child.type === 'text' || child.type === 'image' || child.type === 'break') {
|
|
133
|
+
runs.push(this.nodeToRun(child));
|
|
134
|
+
}
|
|
135
|
+
else if (child.type === 'paragraph') {
|
|
136
|
+
// Recursively gather runs from child paragraphs
|
|
137
|
+
runs.push(...this.gatherRuns(child.children));
|
|
138
|
+
}
|
|
139
|
+
else if (child.type === 'table' || child.type === 'list') {
|
|
140
|
+
// Not supported in this context, so we'll just add a placeholder
|
|
141
|
+
runs.push({ type: 'other', value: `[Embedded ${child.type}]` });
|
|
142
|
+
}
|
|
143
|
+
else if (child.type === 'other') {
|
|
144
|
+
// Recursively gather runs from inside <span> or <b>, etc.
|
|
145
|
+
runs.push(...this.gatherRuns(child.children));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
logger_1.default.error('Error gathering runs:', error);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
64
152
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
153
|
+
return runs;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Converts a node object to a Run object based on its type and text styling.
|
|
157
|
+
*
|
|
158
|
+
* @param node - The node object to be converted. It can be of type 'text', 'image', or 'break'.
|
|
159
|
+
* @returns A Run object with the appropriate type and properties based on the input node.
|
|
160
|
+
*
|
|
161
|
+
* The Run object can have the following structure:
|
|
162
|
+
* - For 'text' nodes: { type: 'text', value: string, textStyling: object }
|
|
163
|
+
* - For 'image' nodes: { type: 'image', value: '', src: string }
|
|
164
|
+
* - For 'break' nodes: { type: 'break' }
|
|
165
|
+
* - For other types: { type: 'other', value: '' }
|
|
166
|
+
*
|
|
167
|
+
* The textStyling object includes:
|
|
168
|
+
* - Bold: boolean
|
|
169
|
+
* - Italic: boolean
|
|
170
|
+
* - Underline: boolean
|
|
171
|
+
* - Size: number
|
|
172
|
+
* - Uri: string | null
|
|
173
|
+
* - Font: string
|
|
174
|
+
* - InsertLineBreak: boolean
|
|
175
|
+
* - InsertSpace: boolean
|
|
176
|
+
*/
|
|
177
|
+
nodeToRun(node) {
|
|
178
|
+
var _a, _b, _c, _d;
|
|
179
|
+
const textStyling = {
|
|
180
|
+
Bold: ((_a = node.textStyling) === null || _a === void 0 ? void 0 : _a.Bold) || this.paragraphStyles.isBold,
|
|
181
|
+
Italic: ((_b = node.textStyling) === null || _b === void 0 ? void 0 : _b.Italic) || this.paragraphStyles.IsItalic,
|
|
182
|
+
Underline: ((_c = node.textStyling) === null || _c === void 0 ? void 0 : _c.Underline) || this.paragraphStyles.IsUnderline,
|
|
183
|
+
Size: this.paragraphStyles.Size || 12,
|
|
184
|
+
Uri: this.paragraphStyles.Uri || null,
|
|
185
|
+
Font: this.paragraphStyles.Font || 'Arial',
|
|
186
|
+
InsertLineBreak: this.paragraphStyles.InsertLineBreak || false,
|
|
187
|
+
InsertSpace: ((_d = node.textStyling) === null || _d === void 0 ? void 0 : _d.InsertSpace) || this.paragraphStyles.InsertSpace,
|
|
188
|
+
};
|
|
189
|
+
if (node.type === 'text') {
|
|
190
|
+
return { type: 'text', value: node.value, textStyling: textStyling };
|
|
191
|
+
}
|
|
192
|
+
else if (node.type === 'image') {
|
|
193
|
+
return { type: 'image', value: '', src: node.src || '' };
|
|
194
|
+
}
|
|
195
|
+
else if (node.type === 'break') {
|
|
196
|
+
return { type: 'break' };
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
return { type: 'other', value: '' };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Converts a given node object into a Table structure.
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* This function processes the children of the specified node and
|
|
207
|
+
* transforms them into a table representation, adding default properties
|
|
208
|
+
* such as heading level, page break insertion, and an empty rows array.
|
|
209
|
+
*
|
|
210
|
+
* @param node - The node object containing the structural details needed
|
|
211
|
+
* to create a table.
|
|
212
|
+
* @returns A fully constructed Table object with the parsed node data.
|
|
213
|
+
*/
|
|
214
|
+
parseTableNode(node) {
|
|
215
|
+
const table = {
|
|
216
|
+
type: 'table',
|
|
217
|
+
headingLevel: 0,
|
|
218
|
+
insertPageBreak: false,
|
|
219
|
+
Rows: [],
|
|
220
|
+
};
|
|
221
|
+
if (!node || !Array.isArray(node.children)) {
|
|
222
|
+
logger_1.default.warn('Invalid table node structure');
|
|
223
|
+
return table;
|
|
224
|
+
}
|
|
225
|
+
this.parseTableChildren(node.children, table);
|
|
226
|
+
if (!this.validateTableStructure(table)) {
|
|
227
|
+
logger_1.default.warn('Inconsistent table structure detected');
|
|
228
|
+
}
|
|
229
|
+
return table;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Parses child elements of a table structure and updates the provided Table instance accordingly.
|
|
233
|
+
*
|
|
234
|
+
* @param children - An array of child nodes to be evaluated for table content.
|
|
235
|
+
* @param table - The Table object to which parsed rows and nested structures will be appended.
|
|
236
|
+
*
|
|
237
|
+
* @remarks
|
|
238
|
+
* This method recursively traverses and identifies relevant table elements (e.g., <tr>, <thead>, <tbody>, etc.)
|
|
239
|
+
* to generate the final row data for the given Table instance.
|
|
240
|
+
*/
|
|
241
|
+
parseTableChildren(children, table) {
|
|
242
|
+
for (const child of children || []) {
|
|
243
|
+
if (child.type === 'other') {
|
|
244
|
+
const tn = (child.tagName || '').toLowerCase();
|
|
245
|
+
if (tn === 'tr') {
|
|
246
|
+
// Parse a table row
|
|
247
|
+
const row = this.parseTableRow(child);
|
|
248
|
+
table.Rows.push(row);
|
|
249
|
+
}
|
|
250
|
+
else if (tn === 'thead' || tn === 'tbody' || tn === 'tfoot') {
|
|
251
|
+
// Recurse into thead/tbody/tfoot
|
|
252
|
+
this.parseTableChildren(child.children, table);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
// Recurse into other nodes
|
|
256
|
+
this.parseTableChildren(child.children, table);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else if (child.type === 'table') {
|
|
260
|
+
this.parseTableChildren(child.children, table);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
//skip
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Parses the given table row node and extracts its cells by iterating through its child elements.
|
|
270
|
+
* Each child element that is recognized as a table cell (td or th) is converted into a corresponding cell object.
|
|
271
|
+
*
|
|
272
|
+
* @param trNode - An AST node representing the table row, containing possible table cell or header elements.
|
|
273
|
+
* @returns A TableRow object containing an array of processed cells.
|
|
274
|
+
*/
|
|
275
|
+
parseTableRow(trNode) {
|
|
276
|
+
const row = { Cells: [] };
|
|
277
|
+
// parse <td> or <th> inside this <tr>
|
|
278
|
+
for (const child of trNode.children || []) {
|
|
279
|
+
if (child.type === 'other' && (child.tagName === 'td' || child.tagName === 'th')) {
|
|
280
|
+
row.Cells.push(this.parseTableCell(child));
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
// skip or recurse
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return row;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Build one TableCell from <td> node
|
|
290
|
+
*/
|
|
291
|
+
parseTableCell(tdNode) {
|
|
292
|
+
// We'll collect everything in one paragraph
|
|
293
|
+
const cellParagraphRuns = this.gatherRunsFromAllParagraphs(tdNode.children);
|
|
294
|
+
return {
|
|
295
|
+
Paragraphs: [
|
|
296
|
+
{
|
|
297
|
+
Runs: cellParagraphRuns,
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Gather runs from any text/image/paragraph in <td>
|
|
304
|
+
* (including nested <other> tags).
|
|
305
|
+
*/
|
|
306
|
+
gatherRunsFromAllParagraphs(children) {
|
|
307
|
+
const runs = [];
|
|
308
|
+
for (const child of children || []) {
|
|
309
|
+
if (child.type === 'text' || child.type === 'image') {
|
|
310
|
+
runs.push(this.nodeToRun(child));
|
|
311
|
+
}
|
|
312
|
+
else if (child.type === 'paragraph') {
|
|
313
|
+
runs.push(...this.gatherRuns(child.children));
|
|
314
|
+
}
|
|
315
|
+
else if (child.type === 'other' || child.type === 'table' || child.type === 'list') {
|
|
316
|
+
// recursively gather
|
|
317
|
+
runs.push(...this.gatherRunsFromAllParagraphs(child.children));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return runs;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Parses a given node to create a List object.
|
|
324
|
+
*
|
|
325
|
+
* @param node - The node to parse, expected to have properties `isOrdered` and `children`.
|
|
326
|
+
* @returns A List object with the parsed data.
|
|
327
|
+
*/
|
|
328
|
+
parseList(node) {
|
|
329
|
+
const list = {
|
|
330
|
+
type: 'list',
|
|
331
|
+
isOrdered: node.isOrdered,
|
|
332
|
+
listItems: [],
|
|
333
|
+
};
|
|
334
|
+
this.parseListChildren(node.children, list);
|
|
335
|
+
return list;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Parses the children of a list and adds them to the provided list object.
|
|
339
|
+
*
|
|
340
|
+
* @param children - An array of child nodes to be parsed.
|
|
341
|
+
* @param list - The list object to which parsed items will be added.
|
|
342
|
+
* @param level - The current depth level of the list (default is 0).
|
|
343
|
+
*/
|
|
344
|
+
parseListChildren(children, list, level = 0) {
|
|
345
|
+
for (const child of children || []) {
|
|
346
|
+
if (child.type === 'other') {
|
|
347
|
+
const tn = (child.tagName || '').toLowerCase();
|
|
348
|
+
if (tn === 'li') {
|
|
349
|
+
// Parse a list item
|
|
350
|
+
const item = this.parseListItem(child, level);
|
|
351
|
+
list.listItems.push(item);
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
// Recurse into other nodes
|
|
355
|
+
this.parseListChildren(child.children, list, level + 1);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
//skip
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Parses a list item node and converts it into a `ListItem` object.
|
|
366
|
+
*
|
|
367
|
+
* @param liNode - The list item node to parse.
|
|
368
|
+
* @param level - The nesting level of the list item.
|
|
369
|
+
* @returns A `ListItem` object containing the parsed list item data.
|
|
370
|
+
*/
|
|
371
|
+
parseListItem(liNode, level) {
|
|
372
|
+
const items = this.gatherRunsFromAllParagraphs(liNode.children);
|
|
373
|
+
return {
|
|
374
|
+
Runs: items,
|
|
375
|
+
level: level,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Builds an array of document elements (Paragraph, Table, or List) from an array of RichNode objects.
|
|
380
|
+
*
|
|
381
|
+
* @param nodes - An array of RichNode objects to be parsed into document elements.
|
|
382
|
+
* @returns An array of Paragraph, Table, or List elements.
|
|
383
|
+
*/
|
|
384
|
+
buildDocFromNodes(nodes) {
|
|
385
|
+
if (!Array.isArray(nodes)) {
|
|
386
|
+
logger_1.default.error('Invalid nodes array');
|
|
387
|
+
return [];
|
|
388
|
+
}
|
|
389
|
+
const results = [];
|
|
390
|
+
for (const node of nodes) {
|
|
391
|
+
try {
|
|
392
|
+
const items = this.parseNode(node);
|
|
393
|
+
if (Array.isArray(items)) {
|
|
394
|
+
results.push(...items.filter(Boolean));
|
|
395
|
+
}
|
|
396
|
+
else if (items) {
|
|
397
|
+
results.push(items);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
logger_1.default.error('Error processing node:', error);
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
// Ensure there's at least one paragraph
|
|
406
|
+
if (results.length === 0) {
|
|
407
|
+
results.push({ type: 'paragraph', runs: [] });
|
|
408
|
+
}
|
|
409
|
+
return results;
|
|
410
|
+
}
|
|
411
|
+
validateTableStructure(table) {
|
|
412
|
+
var _a, _b;
|
|
413
|
+
if (!table.Rows)
|
|
414
|
+
return false;
|
|
415
|
+
const firstRowCellCount = ((_b = (_a = table.Rows[0]) === null || _a === void 0 ? void 0 : _a.Cells) === null || _b === void 0 ? void 0 : _b.length) || 0;
|
|
416
|
+
return table.Rows.every((row) => row.Cells.length === firstRowCellCount);
|
|
417
|
+
}
|
|
69
418
|
} //class
|
|
70
419
|
exports.default = JSONRichTextParagraph;
|
|
71
420
|
//# sourceMappingURL=JSONRichTextParagraph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSONRichTextParagraph.js","sourceRoot":"","sources":["../../../../src/models/json/paragraph/JSONRichTextParagraph.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"JSONRichTextParagraph.js","sourceRoot":"","sources":["../../../../src/models/json/paragraph/JSONRichTextParagraph.ts"],"names":[],"mappings":";;;;;AAAA,sEAA8C;AAc9C,MAAqB,qBAAqB;IAIxC,YACE,KAAiB,EACjB,eAA6B,EAC7B,IAAY,EACZ,YAAoB,EACpB,eAAe,GAAG,KAAK;QAEvB,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;SAC3D;QAED,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI;YACxC,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,KAAK;YAClB,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,OAAO;YACb,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE,KAAK;SACnB,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACvE,CAAC,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O,CAAC;IACjB,CAAC;IAEO,sBAAsB,CAAC,KAAY;;QACzC,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAE9B,MAAM,iBAAiB,GAAG,CAAA,MAAA,MAAA,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,0CAAE,KAAK,0CAAE,MAAM,KAAI,CAAC,CAAC;QAC5D,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,iBAAiB,CAAC,CAAC;IAC3E,CAAC;CACF,CAAC,OAAO;AAnbT,wCAmbC"}
|
|
@@ -53,8 +53,7 @@ export interface Attachment {
|
|
|
53
53
|
isLinkedFile?: boolean;
|
|
54
54
|
IsFlattened?: boolean;
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
text: string;
|
|
56
|
+
interface TextStyle {
|
|
58
57
|
Bold: boolean;
|
|
59
58
|
Italic: boolean;
|
|
60
59
|
Underline: boolean;
|
|
@@ -65,6 +64,12 @@ export interface Run {
|
|
|
65
64
|
InsertSpace: boolean;
|
|
66
65
|
src?: string;
|
|
67
66
|
}
|
|
67
|
+
export interface Run {
|
|
68
|
+
type: 'text' | 'image' | 'break' | 'other';
|
|
69
|
+
value?: string;
|
|
70
|
+
src?: string;
|
|
71
|
+
textStyling?: TextStyle;
|
|
72
|
+
}
|
|
68
73
|
export interface WorkItemData {
|
|
69
74
|
}
|
|
70
75
|
export interface Table {
|
|
@@ -105,7 +110,7 @@ export interface WIProperty {
|
|
|
105
110
|
attachmentLink?: string;
|
|
106
111
|
attachmentType?: string;
|
|
107
112
|
relativeAttachmentLink?: string;
|
|
108
|
-
|
|
113
|
+
richTextNodes?: any[];
|
|
109
114
|
}
|
|
110
115
|
export interface MultipeValuesWIProperty {
|
|
111
116
|
name: string;
|
|
@@ -117,10 +122,42 @@ export interface MultipeValuesWIProperty {
|
|
|
117
122
|
attachmentLink?: string;
|
|
118
123
|
attachmentType?: string;
|
|
119
124
|
relativeAttachmentLink?: string;
|
|
120
|
-
|
|
125
|
+
richTextNodes?: any[];
|
|
121
126
|
}
|
|
122
127
|
export interface WIColumns {
|
|
123
128
|
name: string;
|
|
124
129
|
referenceName: string;
|
|
125
130
|
url: string;
|
|
126
131
|
}
|
|
132
|
+
export type RichNode = ParagraphNode | TextNode | ImageNode | TableNode | ListNode | BreakNode | OtherNode;
|
|
133
|
+
export interface ParagraphNode {
|
|
134
|
+
type: 'paragraph';
|
|
135
|
+
children: RichNode[];
|
|
136
|
+
}
|
|
137
|
+
export interface TextNode {
|
|
138
|
+
type: 'text';
|
|
139
|
+
value: string;
|
|
140
|
+
}
|
|
141
|
+
export interface ImageNode {
|
|
142
|
+
type: 'image';
|
|
143
|
+
src: string;
|
|
144
|
+
alt?: string;
|
|
145
|
+
}
|
|
146
|
+
export interface BreakNode {
|
|
147
|
+
type: 'break';
|
|
148
|
+
}
|
|
149
|
+
export interface TableNode {
|
|
150
|
+
type: 'table';
|
|
151
|
+
children: RichNode[];
|
|
152
|
+
}
|
|
153
|
+
export interface ListNode {
|
|
154
|
+
type: 'list';
|
|
155
|
+
isOrdered: boolean;
|
|
156
|
+
children: RichNode[];
|
|
157
|
+
}
|
|
158
|
+
export interface OtherNode {
|
|
159
|
+
type: 'other';
|
|
160
|
+
tagName: string;
|
|
161
|
+
children: RichNode[];
|
|
162
|
+
}
|
|
163
|
+
export {};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -287,13 +287,7 @@ export default class Skins {
|
|
|
287
287
|
let wiSkin = new JSONHeaderParagraph(wiHeaderFields, headerStyle, element.id || 0, element.level);
|
|
288
288
|
testSkins.push(wiSkin.getJSONParagraph());
|
|
289
289
|
|
|
290
|
-
let wiDescriptionParagraph = new JSONRichTextParagraph(
|
|
291
|
-
element.fields[2],
|
|
292
|
-
styles,
|
|
293
|
-
element.id || 0,
|
|
294
|
-
0,
|
|
295
|
-
true
|
|
296
|
-
);
|
|
290
|
+
let wiDescriptionParagraph = new JSONRichTextParagraph(element.fields[2], styles, element.id || 0, 0);
|
|
297
291
|
let richTextDecsSkin: any[] = wiDescriptionParagraph.getJSONRichTextParagraph();
|
|
298
292
|
testSkins.push(...richTextDecsSkin);
|
|
299
293
|
}
|
|
@@ -436,7 +430,7 @@ export default class Skins {
|
|
|
436
430
|
|
|
437
431
|
let testDescriptionParagraph = new JSONRichTextParagraph(
|
|
438
432
|
testcase.testCaseHeaderSkinData.fields[2],
|
|
439
|
-
styles,
|
|
433
|
+
{ ...styles, Size: 12, Font: 'Arial' },
|
|
440
434
|
testcase.id || 0,
|
|
441
435
|
0
|
|
442
436
|
);
|
|
@@ -497,7 +491,7 @@ export default class Skins {
|
|
|
497
491
|
let tableSkin = new JSONTable(
|
|
498
492
|
testcase.testCaseStepsSkinData,
|
|
499
493
|
headerStyles,
|
|
500
|
-
styles,
|
|
494
|
+
{ ...styles, Font: 'Arial' },
|
|
501
495
|
headingLvl,
|
|
502
496
|
undefined,
|
|
503
497
|
undefined,
|