@elisra-devops/docgen-skins 0.10.12 → 0.10.14
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.d.ts +7 -7
- package/bin/index.js +150 -151
- package/bin/index.js.map +1 -1
- package/bin/models/json/table/JSONTableCell.js +55 -39
- package/bin/models/json/table/JSONTableCell.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +230 -212
- package/src/models/json/table/JSONTableCell.ts +50 -36
|
@@ -43,44 +43,58 @@ export default class JSONTableCell {
|
|
|
43
43
|
let attachments: Attachment[] = [];
|
|
44
44
|
let HtmlData: string = '';
|
|
45
45
|
//multiple values
|
|
46
|
-
|
|
47
|
-
data.value.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
let attachmentLink = retrieveOriginal ? runData.attachmentLink : runData.tableCellAttachmentLink;
|
|
51
|
-
if (this.isPictureUri(attachmentLink)) {
|
|
52
|
-
let attachment = {
|
|
53
|
-
type: 'Picture',
|
|
54
|
-
path: attachmentLink,
|
|
55
|
-
name: this.removeFileExtension(runData.attachmentFileName),
|
|
56
|
-
isFlattened,
|
|
57
|
-
};
|
|
58
|
-
attachments.push(attachment);
|
|
59
|
-
} else {
|
|
60
|
-
let attachment = {
|
|
61
|
-
type: 'File',
|
|
62
|
-
path: runData.attachmentLink,
|
|
63
|
-
name: this.removeFileExtension(runData.attachmentFileName),
|
|
64
|
-
isLinkedFile: data.attachmentType === 'asLink',
|
|
65
|
-
isFlattened,
|
|
66
|
-
};
|
|
67
|
-
attachments.push(attachment);
|
|
68
|
-
}
|
|
69
|
-
} else if (/<[^>]*>/.test(runData.value)) {
|
|
70
|
-
HtmlData = runData.value || '';
|
|
46
|
+
try {
|
|
47
|
+
if (typeof data.value !== 'string' && typeof data.value !== 'number' && data.value) {
|
|
48
|
+
if (!Array.isArray(data.value)) {
|
|
49
|
+
throw new Error(`Invalid data value for cell: ${JSON.stringify(data.value)}`);
|
|
71
50
|
} else {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
data.value.forEach((runData) => {
|
|
52
|
+
//check if photo type
|
|
53
|
+
if (runData.attachmentLink) {
|
|
54
|
+
let attachmentLink = retrieveOriginal
|
|
55
|
+
? runData.attachmentLink
|
|
56
|
+
: runData.tableCellAttachmentLink;
|
|
57
|
+
if (this.isPictureUri(attachmentLink)) {
|
|
58
|
+
let attachment = {
|
|
59
|
+
type: 'Picture',
|
|
60
|
+
path: attachmentLink,
|
|
61
|
+
name: this.removeFileExtension(runData.attachmentFileName),
|
|
62
|
+
isFlattened,
|
|
63
|
+
};
|
|
64
|
+
attachments.push(attachment);
|
|
65
|
+
} else {
|
|
66
|
+
let attachment = {
|
|
67
|
+
type: 'File',
|
|
68
|
+
path: runData.attachmentLink,
|
|
69
|
+
name: this.removeFileExtension(runData.attachmentFileName),
|
|
70
|
+
isLinkedFile: data.attachmentType === 'asLink',
|
|
71
|
+
isFlattened,
|
|
72
|
+
};
|
|
73
|
+
attachments.push(attachment);
|
|
74
|
+
}
|
|
75
|
+
} else if (/<[^>]*>/.test(runData.value)) {
|
|
76
|
+
HtmlData = runData.value || '';
|
|
77
|
+
} else {
|
|
78
|
+
styles.Uri = runData.relativeUrl ? runData.relativeUrl : runData.Uri ? runData.Uri : null;
|
|
79
|
+
styles.InsertLineBreak = false;
|
|
80
|
+
let jsonRun = new JSONRun(runData.value, styles);
|
|
81
|
+
runs = [...runs, ...jsonRun.getRun()];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
76
84
|
}
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
} else if (/<[^>]*>/.test(data.value)) {
|
|
86
|
+
HtmlData = data.value || '';
|
|
87
|
+
} else {
|
|
88
|
+
styles.Uri = data.relativeUrl ? data.relativeUrl : data.url ? data.url : null;
|
|
89
|
+
let text = data.value || '';
|
|
90
|
+
let jsonRun = new JSONRun(`${text}`, styles);
|
|
91
|
+
runs = [...runs, ...jsonRun.getRun()];
|
|
92
|
+
}
|
|
93
|
+
} catch (e) {
|
|
94
|
+
logger.error(`Error generating JSON cell: ${e.message}`);
|
|
95
|
+
logger.error(`Error data: ${JSON.stringify(data)}`);
|
|
96
|
+
logger.error(`Type Of Data: ${typeof data.value}`);
|
|
97
|
+
let jsonRun = new JSONRun('Docgen Error: Invalid data value', styles);
|
|
84
98
|
runs = [...runs, ...jsonRun.getRun()];
|
|
85
99
|
}
|
|
86
100
|
if (HtmlData != '') {
|