@contrail/documents 1.2.7 → 1.2.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.
|
@@ -12,4 +12,5 @@ export declare class DocumentElementPropertyBindingHandler {
|
|
|
12
12
|
static bindPropertiesToElement(element: DocumentElement, model: DocumentElementModel): void;
|
|
13
13
|
static isContentTypeWebViewable(contentType: string): boolean;
|
|
14
14
|
static adjustPropertyElements(element: DocumentElement, elements: DocumentElement[], model: any): void;
|
|
15
|
+
static clearOrSetColorBindingsOnStyleChange(element: DocumentElement, changes: DocumentElement): void;
|
|
15
16
|
}
|
|
@@ -6,7 +6,7 @@ const common_1 = require("./types/common");
|
|
|
6
6
|
const util_1 = require("@contrail/util");
|
|
7
7
|
class DocumentElementPropertyBindingHandler {
|
|
8
8
|
static bindPropertiesToElements(elements, model) {
|
|
9
|
-
elements.map(
|
|
9
|
+
elements.map(el => {
|
|
10
10
|
this.bindPropertiesToElement(el, model);
|
|
11
11
|
});
|
|
12
12
|
}
|
|
@@ -39,7 +39,7 @@ class DocumentElementPropertyBindingHandler {
|
|
|
39
39
|
let viewableObject;
|
|
40
40
|
const content = (_e = model === null || model === void 0 ? void 0 : model.viewable) === null || _e === void 0 ? void 0 : _e.content;
|
|
41
41
|
if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
|
|
42
|
-
const primaryContent = content.find(
|
|
42
|
+
const primaryContent = content.find(c => { var _a; return (c === null || c === void 0 ? void 0 : c.id) === ((_a = model === null || model === void 0 ? void 0 : model.viewable) === null || _a === void 0 ? void 0 : _a.primaryViewableId); });
|
|
43
43
|
viewableObject = primaryContent;
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
@@ -106,5 +106,22 @@ class DocumentElementPropertyBindingHandler {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
+
static clearOrSetColorBindingsOnStyleChange(element, changes) {
|
|
110
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
111
|
+
if (((_a = changes === null || changes === void 0 ? void 0 : changes.style) === null || _a === void 0 ? void 0 : _a.backgroundColor) && ((_b = element === null || element === void 0 ? void 0 : element.propertyBindings) === null || _b === void 0 ? void 0 : _b['style.backgroundColor'])) {
|
|
112
|
+
delete element.propertyBindings['style.backgroundColor'];
|
|
113
|
+
(_c = element.propertyBindings) === null || _c === void 0 ? true : delete _c['style.color'];
|
|
114
|
+
}
|
|
115
|
+
else if (((_d = changes === null || changes === void 0 ? void 0 : changes.style) === null || _d === void 0 ? void 0 : _d.backgroundColor) === '' && ((_e = element === null || element === void 0 ? void 0 : element.propertyBindings) === null || _e === void 0 ? void 0 : _e.text)) {
|
|
116
|
+
element.propertyBindings['style.backgroundColor'] = `${element.propertyBindings.text}.hexCode`;
|
|
117
|
+
element.propertyBindings['style.color'] = `${element.propertyBindings.text}.textColorHexCode`;
|
|
118
|
+
}
|
|
119
|
+
if (((_f = changes === null || changes === void 0 ? void 0 : changes.style) === null || _f === void 0 ? void 0 : _f.color) && ((_g = element === null || element === void 0 ? void 0 : element.propertyBindings) === null || _g === void 0 ? void 0 : _g['style.color'])) {
|
|
120
|
+
delete element.propertyBindings['style.color'];
|
|
121
|
+
}
|
|
122
|
+
else if (((_h = changes === null || changes === void 0 ? void 0 : changes.style) === null || _h === void 0 ? void 0 : _h.color) === '' && ((_j = element === null || element === void 0 ? void 0 : element.propertyBindings) === null || _j === void 0 ? void 0 : _j.text)) {
|
|
123
|
+
element.propertyBindings['style.color'] = `${element.propertyBindings.text}.textColorHexCode`;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
109
126
|
}
|
|
110
127
|
exports.DocumentElementPropertyBindingHandler = DocumentElementPropertyBindingHandler;
|