@contrail/document-generation 2.1.23 → 2.1.25
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.
|
@@ -69,6 +69,11 @@ class DocumentPropertyUtil {
|
|
|
69
69
|
element.label = (_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label;
|
|
70
70
|
}
|
|
71
71
|
element.propertyBindings = { text: modelKey };
|
|
72
|
+
const isColorObjectReference = Boolean(property.propertyDefinition.propertyType === types_1.PropertyType.ObjectReference &&
|
|
73
|
+
property.propertyDefinition.referencedTypeRootSlug === 'color');
|
|
74
|
+
if (isColorObjectReference) {
|
|
75
|
+
documents_1.DocumentElementPropertyBindingHandler.clearOrSetColorBindingsOnStyleChange(element, element);
|
|
76
|
+
}
|
|
72
77
|
return element;
|
|
73
78
|
}
|
|
74
79
|
static generatePropertyAnnotationElement(data, property, size, position) {
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DocumentTextElementUtil = void 0;
|
|
4
4
|
const documents_1 = require("@contrail/documents");
|
|
5
5
|
const util_1 = require("@contrail/util");
|
|
6
|
-
const document_util_1 = require("
|
|
6
|
+
const document_util_1 = require("@contrail/document-util");
|
|
7
|
+
const document_util_2 = require("./document-util");
|
|
7
8
|
class DocumentTextElementUtil {
|
|
8
9
|
static generateTextElement(textValue, options, applyInlineFormatting = true, sanitizeHTML = true) {
|
|
9
10
|
var _a;
|
|
@@ -24,7 +25,7 @@ class DocumentTextElementUtil {
|
|
|
24
25
|
size.height = size.height || 25;
|
|
25
26
|
size.width = size.width || 125;
|
|
26
27
|
const defaultedOptions = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(options), { position, size, style });
|
|
27
|
-
let textVal = sanitizeHTML ?
|
|
28
|
+
let textVal = sanitizeHTML ? document_util_2.DocumentUtil.sanitizeHTML(textValue) : textValue;
|
|
28
29
|
if (textVal === undefined || textVal === null) {
|
|
29
30
|
textVal = '';
|
|
30
31
|
}
|
|
@@ -103,7 +104,7 @@ class DocumentTextElementUtil {
|
|
|
103
104
|
if (font) {
|
|
104
105
|
style.font.family = font;
|
|
105
106
|
}
|
|
106
|
-
const textAlign =
|
|
107
|
+
const textAlign = document_util_1.DocumentStyleUtil.getFirstInlineStyleValue(text, 'text-align');
|
|
107
108
|
if (textAlign && ['left', 'right', 'center'].includes(textAlign)) {
|
|
108
109
|
style.text.align = textAlign;
|
|
109
110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/document-generation",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.25",
|
|
4
4
|
"description": "Utilities for automatic generation of documents.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"license": "ISC",
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@contrail/aggregates": "^1.2.3",
|
|
18
|
+
"@contrail/document-util": "^1.0.7",
|
|
18
19
|
"@contrail/sdk": "^1.4.3",
|
|
19
20
|
"@types/jest": "^29.5.2",
|
|
20
21
|
"@types/node": "^18.16.0",
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"@contrail/data-grouping": "^1.0.24",
|
|
46
47
|
"@contrail/document-table": "^1.0.4",
|
|
47
|
-
"@contrail/documents": "^1.2.
|
|
48
|
+
"@contrail/documents": "^1.2.8",
|
|
48
49
|
"@contrail/types": "^3.0.95",
|
|
49
50
|
"@contrail/util": "^1.1.0"
|
|
50
51
|
}
|