@contrail/documents 1.0.91 → 1.0.93
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.
- package/README.md +1 -1
- package/lib/components/components.js +30 -24
- package/lib/document-element-component-size-handler.js +2 -2
- package/lib/document-element-factory.js +1 -1
- package/lib/document-element-property-binding-handler.js +2 -2
- package/lib/types/document-change.d.ts +2 -1
- package/lib/types/document-change.js +1 -0
- package/lib/types/document-element-event.d.ts +2 -2
- package/lib/types/document-element.d.ts +2 -0
- package/lib/types/document.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Supplies common data structures and logic for managing document definitions.
|
|
1
|
+
Supplies common data structures and logic for managing document definitions.
|
|
@@ -3,23 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ComponentRegistry = exports.ITEM_VIEW_V2 = exports.ITEM_VIEW = exports.ITEM_VIEW_TEMPLATE_V2 = exports.ITEM_VIEW_TEMPLATE = void 0;
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
exports.ITEM_VIEW_TEMPLATE = {
|
|
6
|
-
elements: [
|
|
7
|
-
|
|
6
|
+
elements: [
|
|
7
|
+
{
|
|
8
|
+
type: 'image',
|
|
8
9
|
size: { width: 125, height: 125 },
|
|
9
10
|
style: { background: { size: types_1.BackgroundSizeType.CONTAIN } },
|
|
10
|
-
propertyBindings: { url: 'thumbnail.downloadUrl' }
|
|
11
|
-
},
|
|
12
|
-
|
|
11
|
+
propertyBindings: { url: 'thumbnail.downloadUrl' },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'text',
|
|
13
15
|
position: { x: 0, y: 126 },
|
|
14
16
|
size: { height: 25, width: 125 },
|
|
15
17
|
style: {
|
|
16
18
|
font: {
|
|
17
19
|
size: 8,
|
|
18
|
-
}
|
|
20
|
+
},
|
|
19
21
|
},
|
|
20
|
-
propertyBindings: { text: 'item.name' }
|
|
21
|
-
},
|
|
22
|
-
|
|
22
|
+
propertyBindings: { text: 'item.name' },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'text',
|
|
23
26
|
position: { x: 0, y: 151 },
|
|
24
27
|
size: { height: 25, width: 125 },
|
|
25
28
|
style: {
|
|
@@ -28,28 +31,31 @@ exports.ITEM_VIEW_TEMPLATE = {
|
|
|
28
31
|
},
|
|
29
32
|
color: 'rgba(0,0,0,.5)',
|
|
30
33
|
},
|
|
31
|
-
propertyBindings: { text: 'item.optionName' }
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
+
propertyBindings: { text: 'item.optionName' },
|
|
35
|
+
},
|
|
36
|
+
],
|
|
34
37
|
};
|
|
35
38
|
exports.ITEM_VIEW_TEMPLATE_V2 = {
|
|
36
|
-
elements: [
|
|
37
|
-
|
|
39
|
+
elements: [
|
|
40
|
+
{
|
|
41
|
+
type: 'image',
|
|
38
42
|
size: { width: 125, height: 125 },
|
|
39
43
|
style: { background: { size: types_1.BackgroundSizeType.CONTAIN } },
|
|
40
|
-
propertyBindings: { url: 'viewable.mediumViewableDownloadUrl' }
|
|
41
|
-
},
|
|
42
|
-
|
|
44
|
+
propertyBindings: { url: 'viewable.mediumViewableDownloadUrl' },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
43
48
|
position: { x: 0, y: 126 },
|
|
44
49
|
size: { height: 25, width: 125 },
|
|
45
50
|
style: {
|
|
46
51
|
font: {
|
|
47
52
|
size: 8,
|
|
48
|
-
}
|
|
53
|
+
},
|
|
49
54
|
},
|
|
50
|
-
propertyBindings: { text: 'item.name' }
|
|
51
|
-
},
|
|
52
|
-
|
|
55
|
+
propertyBindings: { text: 'item.name' },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
type: 'text',
|
|
53
59
|
position: { x: 0, y: 151 },
|
|
54
60
|
size: { height: 25, width: 125 },
|
|
55
61
|
style: {
|
|
@@ -58,9 +64,9 @@ exports.ITEM_VIEW_TEMPLATE_V2 = {
|
|
|
58
64
|
},
|
|
59
65
|
color: 'rgba(0,0,0,.5)',
|
|
60
66
|
},
|
|
61
|
-
propertyBindings: { text: 'item.optionName' }
|
|
62
|
-
}
|
|
63
|
-
]
|
|
67
|
+
propertyBindings: { text: 'item.optionName' },
|
|
68
|
+
},
|
|
69
|
+
],
|
|
64
70
|
};
|
|
65
71
|
exports.ITEM_VIEW = {
|
|
66
72
|
slug: 'item-view',
|
|
@@ -6,7 +6,7 @@ class DocumentElementComponentSizeHandler {
|
|
|
6
6
|
const newElements = [];
|
|
7
7
|
let lastYPosition = 0;
|
|
8
8
|
let width = 200;
|
|
9
|
-
const imageElements = propertyElements.filter(element => {
|
|
9
|
+
const imageElements = propertyElements.filter((element) => {
|
|
10
10
|
return element.type === 'image';
|
|
11
11
|
});
|
|
12
12
|
if (imageElements.length > 0) {
|
|
@@ -19,7 +19,7 @@ class DocumentElementComponentSizeHandler {
|
|
|
19
19
|
}
|
|
20
20
|
element.position = {
|
|
21
21
|
x: 0,
|
|
22
|
-
y: lastYPosition
|
|
22
|
+
y: lastYPosition,
|
|
23
23
|
};
|
|
24
24
|
lastYPosition = lastYPosition + this.getYMargin(element);
|
|
25
25
|
if (element.type === 'text') {
|
|
@@ -4,7 +4,7 @@ exports.DocumentElementPropertyBindingHandler = void 0;
|
|
|
4
4
|
const util_1 = require("@contrail/util");
|
|
5
5
|
class DocumentElementPropertyBindingHandler {
|
|
6
6
|
static bindPropertiesToElements(elements, model) {
|
|
7
|
-
elements.map(el => {
|
|
7
|
+
elements.map((el) => {
|
|
8
8
|
this.bindPropertiesToElement(el, model);
|
|
9
9
|
});
|
|
10
10
|
}
|
|
@@ -25,7 +25,7 @@ class DocumentElementPropertyBindingHandler {
|
|
|
25
25
|
util_1.ObjectUtil.setByPath(element, propertyKey, propertyValue);
|
|
26
26
|
}
|
|
27
27
|
const isImage = ['image', 'svg'].includes(element.type);
|
|
28
|
-
if (((_b = (_a = element.propertyBindings) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.indexOf(
|
|
28
|
+
if (((_b = (_a = element.propertyBindings) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.indexOf('viewable')) !== -1 && isImage) {
|
|
29
29
|
element.alternateUrls = {};
|
|
30
30
|
let highResUrl = ((_c = model === null || model === void 0 ? void 0 : model.viewable) === null || _c === void 0 ? void 0 : _c.largeViewableDownloadUrl) || ((_d = model === null || model === void 0 ? void 0 : model.viewable) === null || _d === void 0 ? void 0 : _d.largeViewableUrl);
|
|
31
31
|
let originalFile;
|
|
@@ -4,7 +4,8 @@ export declare enum DocumentChangeType {
|
|
|
4
4
|
DELETE_ELEMENT = "DELETE_ELEMENT",
|
|
5
5
|
MODIFY_ELEMENT = "MODIFY_ELEMENT",
|
|
6
6
|
REORDER_ELEMENT = "REORDER_ELEMENT",
|
|
7
|
-
REGENERATE_LINEBOARD = "REGENERATE_LINEBOARD"
|
|
7
|
+
REGENERATE_LINEBOARD = "REGENERATE_LINEBOARD",
|
|
8
|
+
REBIND_MODEL = "REBIND_MODEL"
|
|
8
9
|
}
|
|
9
10
|
export interface DocumentChange {
|
|
10
11
|
changeType: DocumentChangeType;
|
|
@@ -8,4 +8,5 @@ var DocumentChangeType;
|
|
|
8
8
|
DocumentChangeType["MODIFY_ELEMENT"] = "MODIFY_ELEMENT";
|
|
9
9
|
DocumentChangeType["REORDER_ELEMENT"] = "REORDER_ELEMENT";
|
|
10
10
|
DocumentChangeType["REGENERATE_LINEBOARD"] = "REGENERATE_LINEBOARD";
|
|
11
|
+
DocumentChangeType["REBIND_MODEL"] = "REBIND_MODEL";
|
|
11
12
|
})(DocumentChangeType = exports.DocumentChangeType || (exports.DocumentChangeType = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PositionDefinition, SizeDefinition } from
|
|
2
|
-
import { DocumentElement } from
|
|
1
|
+
import { PositionDefinition, SizeDefinition } from './common';
|
|
2
|
+
import { DocumentElement } from './document-element';
|
|
3
3
|
export interface DocumentElementEvent {
|
|
4
4
|
element: DocumentElement;
|
|
5
5
|
selectedElements?: Array<DocumentElement>;
|
package/lib/types/document.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PositionDefinition, SizeDefinition, StyleDefinition, ViewBox } from
|
|
2
|
-
import { DocumentElement } from
|
|
1
|
+
import { PositionDefinition, SizeDefinition, StyleDefinition, ViewBox } from './common';
|
|
2
|
+
import { DocumentElement } from './document-element';
|
|
3
3
|
export interface ImportReferenceDetail {
|
|
4
4
|
importedSlideReference?: string;
|
|
5
5
|
importedFileReference?: string;
|