@contrail/documents 1.3.3 → 1.3.5
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.
|
@@ -11,7 +11,7 @@ class DocumentElementPropertyBindingHandler {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
static bindPropertiesToElement(element, model) {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
15
15
|
const localModel = Object.assign({}, model);
|
|
16
16
|
if (!element.propertyBindings) {
|
|
17
17
|
return;
|
|
@@ -24,7 +24,15 @@ class DocumentElementPropertyBindingHandler {
|
|
|
24
24
|
const isNestedPropertyAccess = pathParts.length > 2;
|
|
25
25
|
let propertyValue = util_1.ObjectUtil.getByPath(localModel, modelIndex);
|
|
26
26
|
if ((propertyValue === null || propertyValue === void 0 ? void 0 : propertyValue.name) && !isNestedPropertyAccess) {
|
|
27
|
-
|
|
27
|
+
const isItemObjectReference = (propertyValue === null || propertyValue === void 0 ? void 0 : propertyValue.entityType) === 'item';
|
|
28
|
+
const isItemOptionProperty = pathParts[1] === 'itemOption';
|
|
29
|
+
const isOptionReference = ((_a = propertyValue === null || propertyValue === void 0 ? void 0 : propertyValue.roles) === null || _a === void 0 ? void 0 : _a.indexOf('option')) !== -1;
|
|
30
|
+
if (isItemObjectReference && !isItemOptionProperty && isOptionReference) {
|
|
31
|
+
propertyValue = `${propertyValue.name} - ${propertyValue.optionName || propertyValue.name}`;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
propertyValue = propertyValue.name;
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
37
|
if (propertyValue === null || propertyValue === undefined) {
|
|
30
38
|
propertyValue = '';
|
|
@@ -32,12 +40,12 @@ class DocumentElementPropertyBindingHandler {
|
|
|
32
40
|
util_1.ObjectUtil.setByPath(element, propertyKey, propertyValue);
|
|
33
41
|
}
|
|
34
42
|
const isImage = ['image', 'svg'].includes(element.type);
|
|
35
|
-
if (((
|
|
43
|
+
if (((_c = (_b = element.propertyBindings) === null || _b === void 0 ? void 0 : _b.url) === null || _c === void 0 ? void 0 : _c.indexOf('viewable')) !== -1 && isImage) {
|
|
36
44
|
element.alternateUrls = {};
|
|
37
|
-
let highResUrl = ((
|
|
45
|
+
let highResUrl = ((_d = model === null || model === void 0 ? void 0 : model.viewable) === null || _d === void 0 ? void 0 : _d.largeViewableDownloadUrl) || ((_e = model === null || model === void 0 ? void 0 : model.viewable) === null || _e === void 0 ? void 0 : _e.largeViewableUrl);
|
|
38
46
|
let originalFile;
|
|
39
47
|
let viewableObject;
|
|
40
|
-
const content = (
|
|
48
|
+
const content = (_f = model === null || model === void 0 ? void 0 : model.viewable) === null || _f === void 0 ? void 0 : _f.content;
|
|
41
49
|
if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
|
|
42
50
|
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
51
|
viewableObject = primaryContent;
|
|
@@ -59,11 +67,11 @@ class DocumentElementPropertyBindingHandler {
|
|
|
59
67
|
if (originalFile) {
|
|
60
68
|
element.alternateUrls.originalFile = originalFile;
|
|
61
69
|
}
|
|
62
|
-
let lowResUrl = ((
|
|
70
|
+
let lowResUrl = ((_g = model === null || model === void 0 ? void 0 : model.viewable) === null || _g === void 0 ? void 0 : _g.mediumViewableDownloadUrl) || ((_h = model === null || model === void 0 ? void 0 : model.viewable) === null || _h === void 0 ? void 0 : _h.mediumViewableUrl);
|
|
63
71
|
if (lowResUrl) {
|
|
64
72
|
element.alternateUrls.lowResolution = lowResUrl;
|
|
65
73
|
}
|
|
66
|
-
let tinyResUrl = ((
|
|
74
|
+
let tinyResUrl = ((_j = model === null || model === void 0 ? void 0 : model.viewable) === null || _j === void 0 ? void 0 : _j.tinyViewableDownloadUrl) || ((_k = model === null || model === void 0 ? void 0 : model.viewable) === null || _k === void 0 ? void 0 : _k.tinyViewableUrl);
|
|
67
75
|
if (tinyResUrl) {
|
|
68
76
|
element.alternateUrls.tinyResolution = tinyResUrl;
|
|
69
77
|
}
|