@contrail/documents 1.0.28 → 1.0.30

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.
@@ -58,6 +58,61 @@ export declare const ITEM_VIEW_TEMPLATE: {
58
58
  };
59
59
  })[];
60
60
  };
61
+ export declare const ITEM_VIEW_TEMPLATE_V2: {
62
+ elements: ({
63
+ type: string;
64
+ size: {
65
+ width: number;
66
+ height: number;
67
+ };
68
+ propertyBindings: {
69
+ url: string;
70
+ text?: undefined;
71
+ };
72
+ position?: undefined;
73
+ style?: undefined;
74
+ } | {
75
+ type: string;
76
+ position: {
77
+ x: number;
78
+ y: number;
79
+ };
80
+ size: {
81
+ height: number;
82
+ width: number;
83
+ };
84
+ style: {
85
+ font: {
86
+ size: number;
87
+ };
88
+ color?: undefined;
89
+ };
90
+ propertyBindings: {
91
+ text: string;
92
+ url?: undefined;
93
+ };
94
+ } | {
95
+ type: string;
96
+ position: {
97
+ x: number;
98
+ y: number;
99
+ };
100
+ size: {
101
+ height: number;
102
+ width: number;
103
+ };
104
+ style: {
105
+ font: {
106
+ size: number;
107
+ };
108
+ color: string;
109
+ };
110
+ propertyBindings: {
111
+ text: string;
112
+ url?: undefined;
113
+ };
114
+ })[];
115
+ };
61
116
  export declare const ITEM_VIEW: {
62
117
  slug: string;
63
118
  defaultTemplate: {
@@ -116,6 +171,64 @@ export declare const ITEM_VIEW: {
116
171
  })[];
117
172
  };
118
173
  };
174
+ export declare const ITEM_VIEW_V2: {
175
+ slug: string;
176
+ defaultTemplate: {
177
+ elements: ({
178
+ type: string;
179
+ size: {
180
+ width: number;
181
+ height: number;
182
+ };
183
+ propertyBindings: {
184
+ url: string;
185
+ text?: undefined;
186
+ };
187
+ position?: undefined;
188
+ style?: undefined;
189
+ } | {
190
+ type: string;
191
+ position: {
192
+ x: number;
193
+ y: number;
194
+ };
195
+ size: {
196
+ height: number;
197
+ width: number;
198
+ };
199
+ style: {
200
+ font: {
201
+ size: number;
202
+ };
203
+ color?: undefined;
204
+ };
205
+ propertyBindings: {
206
+ text: string;
207
+ url?: undefined;
208
+ };
209
+ } | {
210
+ type: string;
211
+ position: {
212
+ x: number;
213
+ y: number;
214
+ };
215
+ size: {
216
+ height: number;
217
+ width: number;
218
+ };
219
+ style: {
220
+ font: {
221
+ size: number;
222
+ };
223
+ color: string;
224
+ };
225
+ propertyBindings: {
226
+ text: string;
227
+ url?: undefined;
228
+ };
229
+ })[];
230
+ };
231
+ };
119
232
  export declare class ComponentRegistry {
120
233
  private static componentDefinitionMap;
121
234
  static getComponentDefinition(slug: string): ComponentDefinition;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentRegistry = exports.ITEM_VIEW = exports.ITEM_VIEW_TEMPLATE = void 0;
3
+ exports.ComponentRegistry = exports.ITEM_VIEW_V2 = exports.ITEM_VIEW = exports.ITEM_VIEW_TEMPLATE_V2 = exports.ITEM_VIEW_TEMPLATE = void 0;
4
4
  exports.ITEM_VIEW_TEMPLATE = {
5
5
  elements: [{
6
6
  type: "image",
@@ -30,10 +30,43 @@ exports.ITEM_VIEW_TEMPLATE = {
30
30
  }
31
31
  ]
32
32
  };
33
+ exports.ITEM_VIEW_TEMPLATE_V2 = {
34
+ elements: [{
35
+ type: "image",
36
+ size: { width: 125, height: 125 },
37
+ propertyBindings: { url: 'viewable.mediumViewableDownloadUrl' }
38
+ }, {
39
+ type: "text",
40
+ position: { x: 0, y: 126 },
41
+ size: { height: 25, width: 125 },
42
+ style: {
43
+ font: {
44
+ size: 8,
45
+ }
46
+ },
47
+ propertyBindings: { text: 'item.name' }
48
+ }, {
49
+ type: "text",
50
+ position: { x: 0, y: 151 },
51
+ size: { height: 25, width: 125 },
52
+ style: {
53
+ font: {
54
+ size: 8,
55
+ },
56
+ color: 'rgba(0,0,0,.5)',
57
+ },
58
+ propertyBindings: { text: 'item.optionName' }
59
+ }
60
+ ]
61
+ };
33
62
  exports.ITEM_VIEW = {
34
63
  slug: 'item-view',
35
64
  defaultTemplate: exports.ITEM_VIEW_TEMPLATE,
36
65
  };
66
+ exports.ITEM_VIEW_V2 = {
67
+ slug: 'item-view-v2',
68
+ defaultTemplate: exports.ITEM_VIEW_TEMPLATE_V2,
69
+ };
37
70
  class ComponentRegistry {
38
71
  static getComponentDefinition(slug) {
39
72
  if (!this.componentDefinitionMap) {
@@ -44,6 +77,7 @@ class ComponentRegistry {
44
77
  static initMap() {
45
78
  this.componentDefinitionMap = new Map();
46
79
  this.componentDefinitionMap.set('item-view', exports.ITEM_VIEW);
80
+ this.componentDefinitionMap.set('item-view-v2', exports.ITEM_VIEW_V2);
47
81
  }
48
82
  }
49
83
  exports.ComponentRegistry = ComponentRegistry;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DocumentElementFactory = void 0;
4
- const uuid_1 = require("uuid");
4
+ const nanoid_1 = require("nanoid");
5
5
  const components_1 = require("./components/components");
6
6
  const document_element_property_binding_handler_1 = require("./document-element-property-binding-handler");
7
7
  class DocumentElementFactory {
8
8
  static initNewElement(type) {
9
9
  const element = {
10
- id: (0, uuid_1.v4)(),
10
+ id: (0, nanoid_1.nanoid)(16),
11
11
  position: { x: 300, y: 300 },
12
12
  type,
13
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -20,7 +20,8 @@
20
20
  "ts-jest": "^23.10.5",
21
21
  "tslint": "^5.11.0",
22
22
  "tslint-config-prettier": "^1.18.0",
23
- "typescript": "^4.0.0"
23
+ "typescript": "^4.0.0",
24
+ "nanoid": "^3.2.0"
24
25
  },
25
26
  "jest": {
26
27
  "moduleFileExtensions": [