@contrail/document-generation 1.0.31 → 1.0.32
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/component-generator.d.ts +11 -11
- package/lib/components/component-generator.js +67 -67
- package/lib/components/component-grid-generator.d.ts +7 -7
- package/lib/components/component-grid-generator.js +81 -81
- package/lib/components/component-util.d.ts +4 -4
- package/lib/components/component-util.js +26 -26
- package/lib/document-generator.d.ts +11 -11
- package/lib/document-generator.js +107 -106
- package/lib/frame-generator.d.ts +9 -9
- package/lib/frame-generator.js +77 -77
- package/lib/index.d.ts +2 -2
- package/lib/index.js +18 -18
- package/lib/info-panel/info-panel-generator.d.ts +5 -5
- package/lib/info-panel/info-panel-generator.js +34 -34
- package/lib/interfaces.d.ts +56 -56
- package/lib/interfaces.js +8 -8
- package/lib/scripts/test.d.ts +1 -1
- package/lib/scripts/test.js +275 -275
- package/lib/test-data.d.ts +72 -72
- package/lib/test-data.js +176 -176
- package/lib/util/document-property-util.d.ts +7 -7
- package/lib/util/document-property-util.js +47 -47
- package/lib/util/document-text-element-util.d.ts +10 -10
- package/lib/util/document-text-element-util.js +120 -119
- package/lib/util/document-util.d.ts +8 -7
- package/lib/util/document-util.js +23 -13
- package/package.json +50 -50
package/lib/test-data.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { DataGroupStructure } from "@contrail/data-grouping";
|
|
2
|
-
import { ComponentGridTemplate, DocumentTemplate } from "./interfaces";
|
|
3
|
-
export declare const TEST_ITEM_MODEL: {
|
|
4
|
-
item: {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
optionName: string;
|
|
8
|
-
gender: string;
|
|
9
|
-
mediumViewableDownloadUrl: string;
|
|
10
|
-
};
|
|
11
|
-
projectItem: {
|
|
12
|
-
id: string;
|
|
13
|
-
retailPrice: number;
|
|
14
|
-
};
|
|
15
|
-
assortmentItem: {
|
|
16
|
-
id: string;
|
|
17
|
-
targetVolume: number;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const TEST_GROUP: {
|
|
21
|
-
name: string;
|
|
22
|
-
data: {
|
|
23
|
-
item: {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
optionName: string;
|
|
27
|
-
gender: string;
|
|
28
|
-
mediumViewableDownloadUrl: string;
|
|
29
|
-
};
|
|
30
|
-
projectItem: {
|
|
31
|
-
id: string;
|
|
32
|
-
retailPrice: number;
|
|
33
|
-
};
|
|
34
|
-
assortmentItem: {
|
|
35
|
-
id: string;
|
|
36
|
-
targetVolume: number;
|
|
37
|
-
};
|
|
38
|
-
}[];
|
|
39
|
-
propertyValues: {
|
|
40
|
-
gender: string;
|
|
41
|
-
};
|
|
42
|
-
subGroups: any[];
|
|
43
|
-
};
|
|
44
|
-
export declare const TEST_GROUP_2: {
|
|
45
|
-
name: string;
|
|
46
|
-
data: {
|
|
47
|
-
item: {
|
|
48
|
-
id: string;
|
|
49
|
-
name: string;
|
|
50
|
-
optionName: string;
|
|
51
|
-
gender: string;
|
|
52
|
-
mediumViewableDownloadUrl: string;
|
|
53
|
-
};
|
|
54
|
-
projectItem: {
|
|
55
|
-
id: string;
|
|
56
|
-
retailPrice: number;
|
|
57
|
-
};
|
|
58
|
-
assortmentItem: {
|
|
59
|
-
id: string;
|
|
60
|
-
targetVolume: number;
|
|
61
|
-
};
|
|
62
|
-
}[];
|
|
63
|
-
propertyValues: {
|
|
64
|
-
gender: string;
|
|
65
|
-
};
|
|
66
|
-
subGroups: any[];
|
|
67
|
-
};
|
|
68
|
-
export declare const TEST_ROOT_GROUP: DataGroupStructure;
|
|
69
|
-
export declare const TEST_TWO_LEVEL_ROOT_GROUP: DataGroupStructure;
|
|
70
|
-
export declare const COMPONENT_GRID_TEMPLATE: ComponentGridTemplate;
|
|
71
|
-
export declare const HORIZONTAL_DOCUMENT_TEMPLATE: DocumentTemplate;
|
|
72
|
-
export declare const VERTICAL_DOCUMENT_TEMPLATE: DocumentTemplate;
|
|
1
|
+
import { DataGroupStructure } from "@contrail/data-grouping";
|
|
2
|
+
import { ComponentGridTemplate, DocumentTemplate } from "./interfaces";
|
|
3
|
+
export declare const TEST_ITEM_MODEL: {
|
|
4
|
+
item: {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
optionName: string;
|
|
8
|
+
gender: string;
|
|
9
|
+
mediumViewableDownloadUrl: string;
|
|
10
|
+
};
|
|
11
|
+
projectItem: {
|
|
12
|
+
id: string;
|
|
13
|
+
retailPrice: number;
|
|
14
|
+
};
|
|
15
|
+
assortmentItem: {
|
|
16
|
+
id: string;
|
|
17
|
+
targetVolume: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const TEST_GROUP: {
|
|
21
|
+
name: string;
|
|
22
|
+
data: {
|
|
23
|
+
item: {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
optionName: string;
|
|
27
|
+
gender: string;
|
|
28
|
+
mediumViewableDownloadUrl: string;
|
|
29
|
+
};
|
|
30
|
+
projectItem: {
|
|
31
|
+
id: string;
|
|
32
|
+
retailPrice: number;
|
|
33
|
+
};
|
|
34
|
+
assortmentItem: {
|
|
35
|
+
id: string;
|
|
36
|
+
targetVolume: number;
|
|
37
|
+
};
|
|
38
|
+
}[];
|
|
39
|
+
propertyValues: {
|
|
40
|
+
gender: string;
|
|
41
|
+
};
|
|
42
|
+
subGroups: any[];
|
|
43
|
+
};
|
|
44
|
+
export declare const TEST_GROUP_2: {
|
|
45
|
+
name: string;
|
|
46
|
+
data: {
|
|
47
|
+
item: {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
optionName: string;
|
|
51
|
+
gender: string;
|
|
52
|
+
mediumViewableDownloadUrl: string;
|
|
53
|
+
};
|
|
54
|
+
projectItem: {
|
|
55
|
+
id: string;
|
|
56
|
+
retailPrice: number;
|
|
57
|
+
};
|
|
58
|
+
assortmentItem: {
|
|
59
|
+
id: string;
|
|
60
|
+
targetVolume: number;
|
|
61
|
+
};
|
|
62
|
+
}[];
|
|
63
|
+
propertyValues: {
|
|
64
|
+
gender: string;
|
|
65
|
+
};
|
|
66
|
+
subGroups: any[];
|
|
67
|
+
};
|
|
68
|
+
export declare const TEST_ROOT_GROUP: DataGroupStructure;
|
|
69
|
+
export declare const TEST_TWO_LEVEL_ROOT_GROUP: DataGroupStructure;
|
|
70
|
+
export declare const COMPONENT_GRID_TEMPLATE: ComponentGridTemplate;
|
|
71
|
+
export declare const HORIZONTAL_DOCUMENT_TEMPLATE: DocumentTemplate;
|
|
72
|
+
export declare const VERTICAL_DOCUMENT_TEMPLATE: DocumentTemplate;
|
package/lib/test-data.js
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VERTICAL_DOCUMENT_TEMPLATE = exports.HORIZONTAL_DOCUMENT_TEMPLATE = exports.COMPONENT_GRID_TEMPLATE = exports.TEST_TWO_LEVEL_ROOT_GROUP = exports.TEST_ROOT_GROUP = exports.TEST_GROUP_2 = exports.TEST_GROUP = exports.TEST_ITEM_MODEL = void 0;
|
|
4
|
-
const types_1 = require("@contrail/types");
|
|
5
|
-
const interfaces_1 = require("./interfaces");
|
|
6
|
-
const sdk_1 = require("@contrail/sdk");
|
|
7
|
-
exports.TEST_ITEM_MODEL = {
|
|
8
|
-
item: {
|
|
9
|
-
id: 'item-1001',
|
|
10
|
-
name: 'Shirt 1',
|
|
11
|
-
optionName: 'Red',
|
|
12
|
-
gender: 'mens',
|
|
13
|
-
mediumViewableDownloadUrl: 'https://api.vibeiq.com/dev/api/files/downloadUrl/-VMrLJrt3clDKPi0%2Fcontent:m3Bd4u-QLci1XiOl%2F2b72d48a-6b19-4ba8-9d54-813745fb8dd4.png',
|
|
14
|
-
},
|
|
15
|
-
projectItem: {
|
|
16
|
-
id: 'projectItem-1001',
|
|
17
|
-
retailPrice: 45.00
|
|
18
|
-
},
|
|
19
|
-
assortmentItem: {
|
|
20
|
-
id: 'assortmentItem-1001',
|
|
21
|
-
targetVolume: 1000
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
exports.TEST_GROUP = {
|
|
25
|
-
name: "Mens",
|
|
26
|
-
data: [exports.TEST_ITEM_MODEL,
|
|
27
|
-
exports.TEST_ITEM_MODEL,
|
|
28
|
-
exports.TEST_ITEM_MODEL,
|
|
29
|
-
exports.TEST_ITEM_MODEL,
|
|
30
|
-
exports.TEST_ITEM_MODEL,
|
|
31
|
-
exports.TEST_ITEM_MODEL,
|
|
32
|
-
exports.TEST_ITEM_MODEL,
|
|
33
|
-
exports.TEST_ITEM_MODEL,
|
|
34
|
-
exports.TEST_ITEM_MODEL,
|
|
35
|
-
exports.TEST_ITEM_MODEL],
|
|
36
|
-
propertyValues: {
|
|
37
|
-
gender: 'mens'
|
|
38
|
-
},
|
|
39
|
-
subGroups: [],
|
|
40
|
-
};
|
|
41
|
-
exports.TEST_GROUP_2 = {
|
|
42
|
-
name: "Womens",
|
|
43
|
-
data: [exports.TEST_ITEM_MODEL,
|
|
44
|
-
exports.TEST_ITEM_MODEL,
|
|
45
|
-
exports.TEST_ITEM_MODEL,
|
|
46
|
-
exports.TEST_ITEM_MODEL,
|
|
47
|
-
exports.TEST_ITEM_MODEL,
|
|
48
|
-
exports.TEST_ITEM_MODEL,
|
|
49
|
-
exports.TEST_ITEM_MODEL],
|
|
50
|
-
propertyValues: {
|
|
51
|
-
gender: 'womens'
|
|
52
|
-
},
|
|
53
|
-
subGroups: [],
|
|
54
|
-
};
|
|
55
|
-
exports.TEST_ROOT_GROUP = {
|
|
56
|
-
depth: 1,
|
|
57
|
-
groupingProperties: [{
|
|
58
|
-
propertyDefinition: {
|
|
59
|
-
slug: 'gender',
|
|
60
|
-
propertyType: types_1.PropertyType.SingleSelect,
|
|
61
|
-
label: "Gender",
|
|
62
|
-
},
|
|
63
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
64
|
-
typeRootSlug: 'item',
|
|
65
|
-
values: null,
|
|
66
|
-
}],
|
|
67
|
-
rootGroup: {
|
|
68
|
-
data: [],
|
|
69
|
-
subGroups: [exports.TEST_GROUP, exports.TEST_GROUP, exports.TEST_GROUP],
|
|
70
|
-
name: "Root",
|
|
71
|
-
propertyValues: {},
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
exports.TEST_TWO_LEVEL_ROOT_GROUP = {
|
|
75
|
-
depth: 2,
|
|
76
|
-
groupingProperties: [{
|
|
77
|
-
propertyDefinition: {
|
|
78
|
-
slug: 'gender',
|
|
79
|
-
propertyType: types_1.PropertyType.SingleSelect,
|
|
80
|
-
label: "Gender",
|
|
81
|
-
},
|
|
82
|
-
sort: sdk_1.SortOrderOptions.ASC,
|
|
83
|
-
typeRootSlug: 'item',
|
|
84
|
-
values: null,
|
|
85
|
-
}],
|
|
86
|
-
rootGroup: {
|
|
87
|
-
data: [],
|
|
88
|
-
subGroups: [{
|
|
89
|
-
name: 'Mens',
|
|
90
|
-
subGroups: [exports.TEST_GROUP, exports.TEST_GROUP],
|
|
91
|
-
propertyValues: {
|
|
92
|
-
gender: 'mens'
|
|
93
|
-
},
|
|
94
|
-
data: [],
|
|
95
|
-
}, {
|
|
96
|
-
name: 'Womens',
|
|
97
|
-
subGroups: [exports.TEST_GROUP_2, exports.TEST_GROUP_2, exports.TEST_GROUP_2, exports.TEST_GROUP_2],
|
|
98
|
-
propertyValues: {
|
|
99
|
-
gender: 'mens'
|
|
100
|
-
},
|
|
101
|
-
data: [],
|
|
102
|
-
}],
|
|
103
|
-
name: "Root",
|
|
104
|
-
propertyValues: {},
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
exports.COMPONENT_GRID_TEMPLATE = {
|
|
108
|
-
gridDimensions: { cols: 7, rows: 3 },
|
|
109
|
-
componentTemplate: {
|
|
110
|
-
propertyTemplate: {
|
|
111
|
-
properties: [],
|
|
112
|
-
imageLocation: 'top',
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
componentPadding: 20
|
|
116
|
-
};
|
|
117
|
-
exports.HORIZONTAL_DOCUMENT_TEMPLATE = {
|
|
118
|
-
frameOrientation: interfaces_1.Orientation.HORIZONTAL,
|
|
119
|
-
frameSize: { width: 1200, height: 675 },
|
|
120
|
-
framePadding: 30,
|
|
121
|
-
frameHeaderTemplate: {
|
|
122
|
-
style: {
|
|
123
|
-
color: '#000000',
|
|
124
|
-
font: {
|
|
125
|
-
size: 20
|
|
126
|
-
},
|
|
127
|
-
backgroundColor: '#FFFFFF',
|
|
128
|
-
},
|
|
129
|
-
size: {
|
|
130
|
-
height: 60,
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
frameGroupHeaderTemplate: {
|
|
134
|
-
style: {
|
|
135
|
-
color: '#ffffff',
|
|
136
|
-
font: {
|
|
137
|
-
size: 20
|
|
138
|
-
},
|
|
139
|
-
backgroundColor: 'black',
|
|
140
|
-
},
|
|
141
|
-
size: {
|
|
142
|
-
height: 60,
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
componentGridTemplate: exports.COMPONENT_GRID_TEMPLATE,
|
|
146
|
-
};
|
|
147
|
-
exports.VERTICAL_DOCUMENT_TEMPLATE = {
|
|
148
|
-
frameOrientation: interfaces_1.Orientation.VERTICAL,
|
|
149
|
-
frameSize: { width: 1200, height: 675 },
|
|
150
|
-
framePadding: 30,
|
|
151
|
-
frameHeaderTemplate: {
|
|
152
|
-
style: {
|
|
153
|
-
color: '#000000',
|
|
154
|
-
font: {
|
|
155
|
-
size: 20
|
|
156
|
-
},
|
|
157
|
-
backgroundColor: '#FFFFFF',
|
|
158
|
-
},
|
|
159
|
-
size: {
|
|
160
|
-
height: 60,
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
frameGroupHeaderTemplate: {
|
|
164
|
-
style: {
|
|
165
|
-
color: '#ffffff',
|
|
166
|
-
font: {
|
|
167
|
-
size: 20
|
|
168
|
-
},
|
|
169
|
-
backgroundColor: 'black',
|
|
170
|
-
},
|
|
171
|
-
size: {
|
|
172
|
-
height: 60,
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
componentGridTemplate: exports.COMPONENT_GRID_TEMPLATE,
|
|
176
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERTICAL_DOCUMENT_TEMPLATE = exports.HORIZONTAL_DOCUMENT_TEMPLATE = exports.COMPONENT_GRID_TEMPLATE = exports.TEST_TWO_LEVEL_ROOT_GROUP = exports.TEST_ROOT_GROUP = exports.TEST_GROUP_2 = exports.TEST_GROUP = exports.TEST_ITEM_MODEL = void 0;
|
|
4
|
+
const types_1 = require("@contrail/types");
|
|
5
|
+
const interfaces_1 = require("./interfaces");
|
|
6
|
+
const sdk_1 = require("@contrail/sdk");
|
|
7
|
+
exports.TEST_ITEM_MODEL = {
|
|
8
|
+
item: {
|
|
9
|
+
id: 'item-1001',
|
|
10
|
+
name: 'Shirt 1',
|
|
11
|
+
optionName: 'Red',
|
|
12
|
+
gender: 'mens',
|
|
13
|
+
mediumViewableDownloadUrl: 'https://api.vibeiq.com/dev/api/files/downloadUrl/-VMrLJrt3clDKPi0%2Fcontent:m3Bd4u-QLci1XiOl%2F2b72d48a-6b19-4ba8-9d54-813745fb8dd4.png',
|
|
14
|
+
},
|
|
15
|
+
projectItem: {
|
|
16
|
+
id: 'projectItem-1001',
|
|
17
|
+
retailPrice: 45.00
|
|
18
|
+
},
|
|
19
|
+
assortmentItem: {
|
|
20
|
+
id: 'assortmentItem-1001',
|
|
21
|
+
targetVolume: 1000
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
exports.TEST_GROUP = {
|
|
25
|
+
name: "Mens",
|
|
26
|
+
data: [exports.TEST_ITEM_MODEL,
|
|
27
|
+
exports.TEST_ITEM_MODEL,
|
|
28
|
+
exports.TEST_ITEM_MODEL,
|
|
29
|
+
exports.TEST_ITEM_MODEL,
|
|
30
|
+
exports.TEST_ITEM_MODEL,
|
|
31
|
+
exports.TEST_ITEM_MODEL,
|
|
32
|
+
exports.TEST_ITEM_MODEL,
|
|
33
|
+
exports.TEST_ITEM_MODEL,
|
|
34
|
+
exports.TEST_ITEM_MODEL,
|
|
35
|
+
exports.TEST_ITEM_MODEL],
|
|
36
|
+
propertyValues: {
|
|
37
|
+
gender: 'mens'
|
|
38
|
+
},
|
|
39
|
+
subGroups: [],
|
|
40
|
+
};
|
|
41
|
+
exports.TEST_GROUP_2 = {
|
|
42
|
+
name: "Womens",
|
|
43
|
+
data: [exports.TEST_ITEM_MODEL,
|
|
44
|
+
exports.TEST_ITEM_MODEL,
|
|
45
|
+
exports.TEST_ITEM_MODEL,
|
|
46
|
+
exports.TEST_ITEM_MODEL,
|
|
47
|
+
exports.TEST_ITEM_MODEL,
|
|
48
|
+
exports.TEST_ITEM_MODEL,
|
|
49
|
+
exports.TEST_ITEM_MODEL],
|
|
50
|
+
propertyValues: {
|
|
51
|
+
gender: 'womens'
|
|
52
|
+
},
|
|
53
|
+
subGroups: [],
|
|
54
|
+
};
|
|
55
|
+
exports.TEST_ROOT_GROUP = {
|
|
56
|
+
depth: 1,
|
|
57
|
+
groupingProperties: [{
|
|
58
|
+
propertyDefinition: {
|
|
59
|
+
slug: 'gender',
|
|
60
|
+
propertyType: types_1.PropertyType.SingleSelect,
|
|
61
|
+
label: "Gender",
|
|
62
|
+
},
|
|
63
|
+
sort: sdk_1.SortOrderOptions.ASC,
|
|
64
|
+
typeRootSlug: 'item',
|
|
65
|
+
values: null,
|
|
66
|
+
}],
|
|
67
|
+
rootGroup: {
|
|
68
|
+
data: [],
|
|
69
|
+
subGroups: [exports.TEST_GROUP, exports.TEST_GROUP, exports.TEST_GROUP],
|
|
70
|
+
name: "Root",
|
|
71
|
+
propertyValues: {},
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.TEST_TWO_LEVEL_ROOT_GROUP = {
|
|
75
|
+
depth: 2,
|
|
76
|
+
groupingProperties: [{
|
|
77
|
+
propertyDefinition: {
|
|
78
|
+
slug: 'gender',
|
|
79
|
+
propertyType: types_1.PropertyType.SingleSelect,
|
|
80
|
+
label: "Gender",
|
|
81
|
+
},
|
|
82
|
+
sort: sdk_1.SortOrderOptions.ASC,
|
|
83
|
+
typeRootSlug: 'item',
|
|
84
|
+
values: null,
|
|
85
|
+
}],
|
|
86
|
+
rootGroup: {
|
|
87
|
+
data: [],
|
|
88
|
+
subGroups: [{
|
|
89
|
+
name: 'Mens',
|
|
90
|
+
subGroups: [exports.TEST_GROUP, exports.TEST_GROUP],
|
|
91
|
+
propertyValues: {
|
|
92
|
+
gender: 'mens'
|
|
93
|
+
},
|
|
94
|
+
data: [],
|
|
95
|
+
}, {
|
|
96
|
+
name: 'Womens',
|
|
97
|
+
subGroups: [exports.TEST_GROUP_2, exports.TEST_GROUP_2, exports.TEST_GROUP_2, exports.TEST_GROUP_2],
|
|
98
|
+
propertyValues: {
|
|
99
|
+
gender: 'mens'
|
|
100
|
+
},
|
|
101
|
+
data: [],
|
|
102
|
+
}],
|
|
103
|
+
name: "Root",
|
|
104
|
+
propertyValues: {},
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
exports.COMPONENT_GRID_TEMPLATE = {
|
|
108
|
+
gridDimensions: { cols: 7, rows: 3 },
|
|
109
|
+
componentTemplate: {
|
|
110
|
+
propertyTemplate: {
|
|
111
|
+
properties: [],
|
|
112
|
+
imageLocation: 'top',
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
componentPadding: 20
|
|
116
|
+
};
|
|
117
|
+
exports.HORIZONTAL_DOCUMENT_TEMPLATE = {
|
|
118
|
+
frameOrientation: interfaces_1.Orientation.HORIZONTAL,
|
|
119
|
+
frameSize: { width: 1200, height: 675 },
|
|
120
|
+
framePadding: 30,
|
|
121
|
+
frameHeaderTemplate: {
|
|
122
|
+
style: {
|
|
123
|
+
color: '#000000',
|
|
124
|
+
font: {
|
|
125
|
+
size: 20
|
|
126
|
+
},
|
|
127
|
+
backgroundColor: '#FFFFFF',
|
|
128
|
+
},
|
|
129
|
+
size: {
|
|
130
|
+
height: 60,
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
frameGroupHeaderTemplate: {
|
|
134
|
+
style: {
|
|
135
|
+
color: '#ffffff',
|
|
136
|
+
font: {
|
|
137
|
+
size: 20
|
|
138
|
+
},
|
|
139
|
+
backgroundColor: 'black',
|
|
140
|
+
},
|
|
141
|
+
size: {
|
|
142
|
+
height: 60,
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
componentGridTemplate: exports.COMPONENT_GRID_TEMPLATE,
|
|
146
|
+
};
|
|
147
|
+
exports.VERTICAL_DOCUMENT_TEMPLATE = {
|
|
148
|
+
frameOrientation: interfaces_1.Orientation.VERTICAL,
|
|
149
|
+
frameSize: { width: 1200, height: 675 },
|
|
150
|
+
framePadding: 30,
|
|
151
|
+
frameHeaderTemplate: {
|
|
152
|
+
style: {
|
|
153
|
+
color: '#000000',
|
|
154
|
+
font: {
|
|
155
|
+
size: 20
|
|
156
|
+
},
|
|
157
|
+
backgroundColor: '#FFFFFF',
|
|
158
|
+
},
|
|
159
|
+
size: {
|
|
160
|
+
height: 60,
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
frameGroupHeaderTemplate: {
|
|
164
|
+
style: {
|
|
165
|
+
color: '#ffffff',
|
|
166
|
+
font: {
|
|
167
|
+
size: 20
|
|
168
|
+
},
|
|
169
|
+
backgroundColor: 'black',
|
|
170
|
+
},
|
|
171
|
+
size: {
|
|
172
|
+
height: 60,
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
componentGridTemplate: exports.COMPONENT_GRID_TEMPLATE,
|
|
176
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DocumentPropertyDefinition } from "../interfaces";
|
|
2
|
-
import { DocumentElement, PositionDefinition } from "@contrail/documents";
|
|
3
|
-
import { PropertyValueFormatter } from "@contrail/types";
|
|
4
|
-
export declare class DocumentPropertyUtil {
|
|
5
|
-
static generatePropertyTextElements(data: any, properties: Array<DocumentPropertyDefinition>, options: DocumentElement, startingPosition: PositionDefinition, isComponent?: boolean): Array<DocumentElement>;
|
|
6
|
-
static generatePropertyTextElement(model: any, property: DocumentPropertyDefinition, options: DocumentElement, formatter: PropertyValueFormatter, position: PositionDefinition, isComponent?: boolean): DocumentElement;
|
|
7
|
-
}
|
|
1
|
+
import { DocumentPropertyDefinition } from "../interfaces";
|
|
2
|
+
import { DocumentElement, PositionDefinition } from "@contrail/documents";
|
|
3
|
+
import { PropertyValueFormatter } from "@contrail/types";
|
|
4
|
+
export declare class DocumentPropertyUtil {
|
|
5
|
+
static generatePropertyTextElements(data: any, properties: Array<DocumentPropertyDefinition>, options: DocumentElement, startingPosition: PositionDefinition, isComponent?: boolean): Array<DocumentElement>;
|
|
6
|
+
static generatePropertyTextElement(model: any, property: DocumentPropertyDefinition, options: DocumentElement, formatter: PropertyValueFormatter, position: PositionDefinition, isComponent?: boolean): DocumentElement;
|
|
7
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentPropertyUtil = void 0;
|
|
4
|
-
const util_1 = require("@contrail/util");
|
|
5
|
-
const types_1 = require("@contrail/types");
|
|
6
|
-
const document_text_element_util_1 = require("./document-text-element-util");
|
|
7
|
-
class DocumentPropertyUtil {
|
|
8
|
-
static generatePropertyTextElements(data, properties, options, startingPosition, isComponent = false) {
|
|
9
|
-
var _a, _b;
|
|
10
|
-
let yPosition = startingPosition.y || 0;
|
|
11
|
-
const xPosition = startingPosition.x || 0;
|
|
12
|
-
const elements = [];
|
|
13
|
-
const formatter = new types_1.PropertyValueFormatter();
|
|
14
|
-
for (let property of properties) {
|
|
15
|
-
const fontSize = ((_b = (_a = property.style) === null || _a === void 0 ? void 0 : _a.font) === null || _b === void 0 ? void 0 : _b.size) || 12;
|
|
16
|
-
const PT_TO_PX = 1.3;
|
|
17
|
-
const LINE_HEIGHT = 1.4;
|
|
18
|
-
const PADDING = 1.6;
|
|
19
|
-
let height = fontSize * PT_TO_PX * LINE_HEIGHT * PADDING;
|
|
20
|
-
options.size = options.size || {};
|
|
21
|
-
options.size.height = height;
|
|
22
|
-
let element = DocumentPropertyUtil.generatePropertyTextElement(data, property, options, formatter, { x: xPosition, y: yPosition }, isComponent);
|
|
23
|
-
yPosition += height;
|
|
24
|
-
elements.push(element);
|
|
25
|
-
}
|
|
26
|
-
return elements;
|
|
27
|
-
}
|
|
28
|
-
static generatePropertyTextElement(model, property, options, formatter, position, isComponent = false) {
|
|
29
|
-
var _a;
|
|
30
|
-
const modelKey = `${util_1.StringUtil.convertToCamelCase(property.typeRootSlug)}.${property.propertyDefinition.slug}`;
|
|
31
|
-
const value = util_1.ObjectUtil.getByPath(model, modelKey);
|
|
32
|
-
let display = formatter.formatValueForProperty(value, property.propertyDefinition);
|
|
33
|
-
if (!isComponent && property.includeLabel) {
|
|
34
|
-
display = property.propertyDefinition.label + ': ' + display;
|
|
35
|
-
}
|
|
36
|
-
const mergedOptions = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(options), { style: property.style || {} });
|
|
37
|
-
mergedOptions.position = position;
|
|
38
|
-
const useInlineFormatting = isComponent === false;
|
|
39
|
-
let element = document_text_element_util_1.DocumentTextElementUtil.generateTextElement(display, mergedOptions, useInlineFormatting);
|
|
40
|
-
if (isComponent && property.includeLabel) {
|
|
41
|
-
element.label = (_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label;
|
|
42
|
-
}
|
|
43
|
-
element.propertyBindings = { text: modelKey };
|
|
44
|
-
return element;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.DocumentPropertyUtil = DocumentPropertyUtil;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentPropertyUtil = void 0;
|
|
4
|
+
const util_1 = require("@contrail/util");
|
|
5
|
+
const types_1 = require("@contrail/types");
|
|
6
|
+
const document_text_element_util_1 = require("./document-text-element-util");
|
|
7
|
+
class DocumentPropertyUtil {
|
|
8
|
+
static generatePropertyTextElements(data, properties, options, startingPosition, isComponent = false) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
let yPosition = startingPosition.y || 0;
|
|
11
|
+
const xPosition = startingPosition.x || 0;
|
|
12
|
+
const elements = [];
|
|
13
|
+
const formatter = new types_1.PropertyValueFormatter();
|
|
14
|
+
for (let property of properties) {
|
|
15
|
+
const fontSize = ((_b = (_a = property.style) === null || _a === void 0 ? void 0 : _a.font) === null || _b === void 0 ? void 0 : _b.size) || 12;
|
|
16
|
+
const PT_TO_PX = 1.3;
|
|
17
|
+
const LINE_HEIGHT = 1.4;
|
|
18
|
+
const PADDING = 1.6;
|
|
19
|
+
let height = fontSize * PT_TO_PX * LINE_HEIGHT * PADDING;
|
|
20
|
+
options.size = options.size || {};
|
|
21
|
+
options.size.height = height;
|
|
22
|
+
let element = DocumentPropertyUtil.generatePropertyTextElement(data, property, options, formatter, { x: xPosition, y: yPosition }, isComponent);
|
|
23
|
+
yPosition += height;
|
|
24
|
+
elements.push(element);
|
|
25
|
+
}
|
|
26
|
+
return elements;
|
|
27
|
+
}
|
|
28
|
+
static generatePropertyTextElement(model, property, options, formatter, position, isComponent = false) {
|
|
29
|
+
var _a;
|
|
30
|
+
const modelKey = `${util_1.StringUtil.convertToCamelCase(property.typeRootSlug)}.${property.propertyDefinition.slug}`;
|
|
31
|
+
const value = util_1.ObjectUtil.getByPath(model, modelKey);
|
|
32
|
+
let display = formatter.formatValueForProperty(value, property.propertyDefinition);
|
|
33
|
+
if (!isComponent && property.includeLabel) {
|
|
34
|
+
display = property.propertyDefinition.label + ': ' + display;
|
|
35
|
+
}
|
|
36
|
+
const mergedOptions = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(options), { style: property.style || {} });
|
|
37
|
+
mergedOptions.position = position;
|
|
38
|
+
const useInlineFormatting = isComponent === false;
|
|
39
|
+
let element = document_text_element_util_1.DocumentTextElementUtil.generateTextElement(display, mergedOptions, useInlineFormatting);
|
|
40
|
+
if (isComponent && property.includeLabel) {
|
|
41
|
+
element.label = (_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label;
|
|
42
|
+
}
|
|
43
|
+
element.propertyBindings = { text: modelKey };
|
|
44
|
+
return element;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.DocumentPropertyUtil = DocumentPropertyUtil;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DocumentElement, StyleDefinition } from "@contrail/documents";
|
|
2
|
-
export declare class DocumentTextElementUtil {
|
|
3
|
-
static generateTextElement(textValue: any, options: any, applyInlineFormatting?: boolean): DocumentElement;
|
|
4
|
-
static applyInLineStyling(text: any, style: StyleDefinition): any;
|
|
5
|
-
static extractStyleFromInline(text: string): StyleDefinition;
|
|
6
|
-
static extractFontSizeFromHTML(text: any): number;
|
|
7
|
-
static extractColorFromHTML(text: any): string;
|
|
8
|
-
static extractTextDecorationFromHTML(text: any): string;
|
|
9
|
-
static extractFontFromHTML(text: any): any;
|
|
10
|
-
}
|
|
1
|
+
import { DocumentElement, StyleDefinition } from "@contrail/documents";
|
|
2
|
+
export declare class DocumentTextElementUtil {
|
|
3
|
+
static generateTextElement(textValue: any, options: any, applyInlineFormatting?: boolean): DocumentElement;
|
|
4
|
+
static applyInLineStyling(text: any, style: StyleDefinition): any;
|
|
5
|
+
static extractStyleFromInline(text: string): StyleDefinition;
|
|
6
|
+
static extractFontSizeFromHTML(text: any): number;
|
|
7
|
+
static extractColorFromHTML(text: any): string;
|
|
8
|
+
static extractTextDecorationFromHTML(text: any): string;
|
|
9
|
+
static extractFontFromHTML(text: any): any;
|
|
10
|
+
}
|