@contrail/documents 1.2.8 → 1.3.0

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,5 +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
+ static setBackgroundColorBindings(element: DocumentElement): void;
16
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(el => {
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(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); });
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,20 +106,20 @@ class DocumentElementPropertyBindingHandler {
106
106
  }
107
107
  }
108
108
  }
109
- static clearOrSetColorBindingsOnStyleChange(element, changes) {
109
+ static setBackgroundColorBindings(element) {
110
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'])) {
111
+ if (((_a = element === null || element === void 0 ? void 0 : element.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
112
  delete element.propertyBindings['style.backgroundColor'];
113
113
  (_c = element.propertyBindings) === null || _c === void 0 ? true : delete _c['style.color'];
114
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)) {
115
+ else if (((_d = element === null || element === void 0 ? void 0 : element.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
116
  element.propertyBindings['style.backgroundColor'] = `${element.propertyBindings.text}.hexCode`;
117
117
  element.propertyBindings['style.color'] = `${element.propertyBindings.text}.textColorHexCode`;
118
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'])) {
119
+ if (((_f = element === null || element === void 0 ? void 0 : element.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
120
  delete element.propertyBindings['style.color'];
121
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)) {
122
+ else if (((_h = element === null || element === void 0 ? void 0 : element.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
123
  element.propertyBindings['style.color'] = `${element.propertyBindings.text}.textColorHexCode`;
124
124
  }
125
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",