@contrail/documents 1.5.1 → 1.5.2
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.
|
@@ -3,8 +3,6 @@ export declare class ColorComponentService {
|
|
|
3
3
|
static isColorComponent(element: DocumentElement): boolean;
|
|
4
4
|
static isColorHexComponent(element: DocumentElement): boolean;
|
|
5
5
|
static isColorImageComponent(element: DocumentElement): boolean;
|
|
6
|
-
static isThumbnailOnlyComponent(element: DocumentElement): boolean;
|
|
7
|
-
static setThumbnailOnlyProperties(elements: any): void;
|
|
8
6
|
static getColorRectangle(elements: DocumentElement[]): DocumentElement;
|
|
9
7
|
static getColorContainer(elements: DocumentElement[]): DocumentElement;
|
|
10
8
|
static updateSizeAndPosition(elements: any, size?: SizeDefinition): any;
|
|
@@ -17,29 +17,6 @@ class ColorComponentService {
|
|
|
17
17
|
return (ColorComponentService.isColorComponent(element) &&
|
|
18
18
|
((_a = ColorComponentService.getColorRectangle(element.elements)) === null || _a === void 0 ? void 0 : _a.type) === 'image');
|
|
19
19
|
}
|
|
20
|
-
static isThumbnailOnlyComponent(element) {
|
|
21
|
-
var _a;
|
|
22
|
-
const hasTextProperties = (_a = element.elements) === null || _a === void 0 ? void 0 : _a.some((e) => e.type === 'text');
|
|
23
|
-
return !hasTextProperties;
|
|
24
|
-
}
|
|
25
|
-
static setThumbnailOnlyProperties(elements) {
|
|
26
|
-
const isThumbnailOnlyComponent = this.isThumbnailOnlyComponent({ elements });
|
|
27
|
-
const container = elements === null || elements === void 0 ? void 0 : elements.find((e) => e.type === 'rectangle' && (!e.propertyBindings || Object.keys(e.propertyBindings).length === 0));
|
|
28
|
-
if (isThumbnailOnlyComponent && elements) {
|
|
29
|
-
const colorRect = elements.find((e) => (e.type === 'rectangle' || e.type === 'image') &&
|
|
30
|
-
e.propertyBindings &&
|
|
31
|
-
Object.keys(e.propertyBindings).length > 0);
|
|
32
|
-
if (colorRect && container) {
|
|
33
|
-
colorRect.position = { x: 0, y: 0 };
|
|
34
|
-
container.size = Object.assign({}, colorRect.size);
|
|
35
|
-
container.position = { x: 0, y: 0 };
|
|
36
|
-
container.style = Object.assign(Object.assign({}, container.style), { backgroundColor: 'transparent' });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else if (!isThumbnailOnlyComponent && container) {
|
|
40
|
-
container.style = Object.assign(Object.assign({}, container.style), { backgroundColor: '#FFFFFF' });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
20
|
static getColorRectangle(elements) {
|
|
44
21
|
return elements === null || elements === void 0 ? void 0 : elements.find((e) => ['rectangle', 'image'].indexOf(e.type) !== -1 && e.propertyBindings);
|
|
45
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/documents",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Documents library for contrail platform",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"ts-jest": "^29.1.1",
|
|
22
22
|
"tslint": "^5.11.0",
|
|
23
23
|
"tslint-config-prettier": "^1.18.0",
|
|
24
|
-
"typescript": "^5.8.3"
|
|
24
|
+
"typescript": "^5.8.3",
|
|
25
|
+
"@contrail/telemetry": "^2.0.0"
|
|
25
26
|
},
|
|
26
27
|
"jest": {
|
|
27
28
|
"moduleFileExtensions": [
|
|
@@ -41,8 +42,10 @@
|
|
|
41
42
|
"@contrail/actions": "^1.0.18",
|
|
42
43
|
"@contrail/document-table": "^1.1.0",
|
|
43
44
|
"@contrail/document-util": "^1.2.0",
|
|
44
|
-
"@contrail/telemetry": "^2.0.0",
|
|
45
45
|
"@contrail/types": "^3.4.0",
|
|
46
46
|
"reflect-metadata": "^0.1.13"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@contrail/telemetry": "^2.0.0"
|
|
47
50
|
}
|
|
48
51
|
}
|