@contrail/documents 1.3.16 → 1.3.18

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.
@@ -55,8 +55,10 @@ class DocumentElementFactory {
55
55
  return element;
56
56
  }
57
57
  static createColorComponent(model, modelBindings, options) {
58
- var _a;
59
- return DocumentElementFactory.createComponent(((_a = model === null || model === void 0 ? void 0 : model.color) === null || _a === void 0 ? void 0 : _a.primaryViewableId) ? 'pattern-view' : 'color-view', model, modelBindings, Object.assign({
58
+ var _a, _b, _c;
59
+ return DocumentElementFactory.createComponent(((_a = model === null || model === void 0 ? void 0 : model.color) === null || _a === void 0 ? void 0 : _a.primaryViewableId) || (!((_b = model === null || model === void 0 ? void 0 : model.color) === null || _b === void 0 ? void 0 : _b.primaryViewableId) && !((_c = model === null || model === void 0 ? void 0 : model.color) === null || _c === void 0 ? void 0 : _c.hexCode))
60
+ ? 'pattern-view'
61
+ : 'color-view', model, modelBindings, Object.assign({
60
62
  size: {
61
63
  width: document_element_constants_1.COLOR_WIDTH + document_element_constants_1.COLOR_PADDING * 2,
62
64
  height: document_element_constants_1.COLOR_WIDTH + document_element_constants_1.COLOR_FONT_SIZE + document_element_constants_1.COLOR_PADDING * 4,
@@ -87,6 +87,7 @@ class DocumentElementPropertyBindingHandler {
87
87
  return (contentType === null || contentType === void 0 ? void 0 : contentType.indexOf('image')) > -1 && (contentType === null || contentType === void 0 ? void 0 : contentType.toLowerCase().indexOf('tiff')) < 0;
88
88
  }
89
89
  static adjustPropertyElements(element, elements, model) {
90
+ var _a;
90
91
  if (color_component_service_1.ColorComponentService.isColorComponent(element) && (elements === null || elements === void 0 ? void 0 : elements.length) > 0 && (model === null || model === void 0 ? void 0 : model.color)) {
91
92
  const colorRect = color_component_service_1.ColorComponentService.getColorRectangle(elements);
92
93
  if (colorRect) {
@@ -97,7 +98,7 @@ class DocumentElementPropertyBindingHandler {
97
98
  colorRect.style = { background: { size: common_1.BackgroundSizeType.CONTAIN } };
98
99
  colorRect.propertyBindings = { url: 'viewable.mediumViewableDownloadUrl' };
99
100
  }
100
- else if (!model.color.primaryViewableId && colorRect.type === 'image') {
101
+ else if (!model.color.primaryViewableId && colorRect.type === 'image' && ((_a = model === null || model === void 0 ? void 0 : model.color) === null || _a === void 0 ? void 0 : _a.hexCode)) {
101
102
  colorRect.type = 'rectangle';
102
103
  colorRect.size.height = colorRect.size.width;
103
104
  colorRect.style = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.3.16",
3
+ "version": "1.3.18",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "@contrail/actions": "^1.0.17",
42
42
  "@contrail/document-table": "^1.0.5",
43
- "@contrail/types": "^3.1.3",
43
+ "@contrail/types": "^3.1.4",
44
44
  "@contrail/document-util": "^1.0.9",
45
45
  "reflect-metadata": "^0.1.13"
46
46
  }