@contrail/document-generation 2.0.6 → 2.0.9
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,6 +11,12 @@ class ComponentUtil {
|
|
|
11
11
|
if (data.projectItem) {
|
|
12
12
|
model.projectItem = `project-item:${data.projectItem.id}`;
|
|
13
13
|
}
|
|
14
|
+
if (data.assortmentItem) {
|
|
15
|
+
model.assortmentItem = `assortment-item:${data.assortmentItem.id}`;
|
|
16
|
+
}
|
|
17
|
+
if (data.assortment) {
|
|
18
|
+
model.assortment = `assortment:${data.assortment.id}`;
|
|
19
|
+
}
|
|
14
20
|
return model;
|
|
15
21
|
}
|
|
16
22
|
static getComponentSize(element) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./frame"), exports);
|
|
18
|
+
__exportStar(require("./frame-generator"), exports);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./document-generator"), exports);
|
|
|
18
18
|
__exportStar(require("./board-document-generator"), exports);
|
|
19
19
|
__exportStar(require("./showcase-frame-generator"), exports);
|
|
20
20
|
__exportStar(require("./interfaces"), exports);
|
|
21
|
+
__exportStar(require("./frames"), exports);
|
|
21
22
|
__exportStar(require("./util"), exports);
|
|
@@ -13,6 +13,12 @@ class InfoPanelGenerator {
|
|
|
13
13
|
if (data.projectItem) {
|
|
14
14
|
model.projectItem = `project-item:${data.projectItem.id}`;
|
|
15
15
|
}
|
|
16
|
+
if (data.assortmentItem) {
|
|
17
|
+
model.assortmentItem = `assortment-item:${data.assortmentItem.id}`;
|
|
18
|
+
}
|
|
19
|
+
if (data.assortment) {
|
|
20
|
+
model.assortment = `assortment:${data.assortment.id}`;
|
|
21
|
+
}
|
|
16
22
|
return model;
|
|
17
23
|
}
|
|
18
24
|
static generatePanelFromTemplate(data, template, position, panelSize) {
|
|
@@ -17,11 +17,12 @@ const nanoid_1 = require("nanoid");
|
|
|
17
17
|
const data_grouping_1 = require("@contrail/data-grouping");
|
|
18
18
|
function run() {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const orgSlug = '
|
|
20
|
+
const orgSlug = 'nb-legacy-prod';
|
|
21
21
|
yield loginSDK(orgSlug);
|
|
22
|
-
const assortmentId = '
|
|
22
|
+
const assortmentId = 'ejNEwWTgDPAtPoSY';
|
|
23
23
|
const itemType = yield new sdk_1.Types().getType({ path: 'item' });
|
|
24
24
|
const projectItemType = yield new sdk_1.Types().getType({ path: 'project-item' });
|
|
25
|
+
const assortmentItemType = yield new sdk_1.Types().getType({ path: 'assortment-item' });
|
|
25
26
|
const PROPERTY_COMPONENT_TEMPLATE = {
|
|
26
27
|
imageDimension: { width: 600 },
|
|
27
28
|
imageLocation: 'top',
|
|
@@ -49,23 +50,9 @@ function run() {
|
|
|
49
50
|
color: 'green',
|
|
50
51
|
}
|
|
51
52
|
}, {
|
|
52
|
-
propertyDefinition:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
includeLabel: true,
|
|
56
|
-
}, {
|
|
57
|
-
propertyDefinition: itemType.typeProperties.find(p => p.slug === 'designTheme'),
|
|
58
|
-
typeRootSlug: 'item',
|
|
59
|
-
slug: "designTheme",
|
|
60
|
-
includeLabel: true,
|
|
61
|
-
}, {
|
|
62
|
-
propertyDefinition: itemType.typeProperties.find(p => p.slug === 'baseStyleNumber'),
|
|
63
|
-
typeRootSlug: 'item',
|
|
64
|
-
slug: "baseStyleNumber",
|
|
65
|
-
}, {
|
|
66
|
-
propertyDefinition: projectItemType.typeProperties.find(p => p.slug === 'colorwayStatus'),
|
|
67
|
-
slug: "colorwayStatus",
|
|
68
|
-
typeRootSlug: 'project-item',
|
|
53
|
+
propertyDefinition: assortmentItemType.typeProperties.find(p => p.slug === 'targetVolume'),
|
|
54
|
+
slug: "targetVolume",
|
|
55
|
+
typeRootSlug: 'assortment-item',
|
|
69
56
|
includeLabel: true,
|
|
70
57
|
}]
|
|
71
58
|
};
|
|
@@ -82,50 +69,6 @@ function run() {
|
|
|
82
69
|
},
|
|
83
70
|
color: 'white',
|
|
84
71
|
}
|
|
85
|
-
}, {
|
|
86
|
-
propertyDefinition: itemType.typeProperties.find(p => p.slug === 'segment'),
|
|
87
|
-
typeRootSlug: 'item',
|
|
88
|
-
slug: "segment",
|
|
89
|
-
includeLabel: true,
|
|
90
|
-
style: {
|
|
91
|
-
font: {
|
|
92
|
-
size: 14,
|
|
93
|
-
},
|
|
94
|
-
color: 'white',
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
propertyDefinition: itemType.typeProperties.find(p => p.slug === 'familyName'),
|
|
98
|
-
typeRootSlug: 'item',
|
|
99
|
-
slug: "familyName",
|
|
100
|
-
includeLabel: true,
|
|
101
|
-
style: {
|
|
102
|
-
font: {
|
|
103
|
-
size: 14,
|
|
104
|
-
},
|
|
105
|
-
color: 'white',
|
|
106
|
-
}
|
|
107
|
-
}, {
|
|
108
|
-
propertyDefinition: itemType.typeProperties.find(p => p.slug === 'ageGroup'),
|
|
109
|
-
typeRootSlug: 'item',
|
|
110
|
-
slug: "ageGroup",
|
|
111
|
-
includeLabel: true,
|
|
112
|
-
style: {
|
|
113
|
-
font: {
|
|
114
|
-
size: 14,
|
|
115
|
-
},
|
|
116
|
-
color: 'white',
|
|
117
|
-
}
|
|
118
|
-
}, {
|
|
119
|
-
propertyDefinition: itemType.typeProperties.find(p => p.slug === 'planningLevel1'),
|
|
120
|
-
typeRootSlug: 'item',
|
|
121
|
-
slug: "planningLevel1",
|
|
122
|
-
includeLabel: true,
|
|
123
|
-
style: {
|
|
124
|
-
font: {
|
|
125
|
-
size: 14,
|
|
126
|
-
},
|
|
127
|
-
color: 'white',
|
|
128
|
-
}
|
|
129
72
|
}]
|
|
130
73
|
};
|
|
131
74
|
const documentTemplateDefinition = {
|
|
@@ -247,6 +190,7 @@ function fromAssortmentModelToItemModel(data) {
|
|
|
247
190
|
projectItem: ai.projectItem,
|
|
248
191
|
viewable: ai.item,
|
|
249
192
|
assortmentItem: ai,
|
|
193
|
+
assortment: { id: ai.assortmentId }
|
|
250
194
|
});
|
|
251
195
|
});
|
|
252
196
|
return results;
|