@contrail/documents 1.0.54 → 1.0.56

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.
@@ -1,3 +1,4 @@
1
+ import { BackgroundSizeType } from '../types';
1
2
  import { Document } from '../types/document';
2
3
  export interface ComponentDefinition {
3
4
  slug?: string;
@@ -10,12 +11,18 @@ export declare const ITEM_VIEW_TEMPLATE: {
10
11
  width: number;
11
12
  height: number;
12
13
  };
14
+ style: {
15
+ background: {
16
+ size: BackgroundSizeType;
17
+ };
18
+ font?: undefined;
19
+ color?: undefined;
20
+ };
13
21
  propertyBindings: {
14
22
  url: string;
15
23
  text?: undefined;
16
24
  };
17
25
  position?: undefined;
18
- style?: undefined;
19
26
  } | {
20
27
  type: string;
21
28
  position: {
@@ -30,6 +37,7 @@ export declare const ITEM_VIEW_TEMPLATE: {
30
37
  font: {
31
38
  size: number;
32
39
  };
40
+ background?: undefined;
33
41
  color?: undefined;
34
42
  };
35
43
  propertyBindings: {
@@ -51,6 +59,7 @@ export declare const ITEM_VIEW_TEMPLATE: {
51
59
  size: number;
52
60
  };
53
61
  color: string;
62
+ background?: undefined;
54
63
  };
55
64
  propertyBindings: {
56
65
  text: string;
@@ -65,12 +74,18 @@ export declare const ITEM_VIEW_TEMPLATE_V2: {
65
74
  width: number;
66
75
  height: number;
67
76
  };
77
+ style: {
78
+ background: {
79
+ size: BackgroundSizeType;
80
+ };
81
+ font?: undefined;
82
+ color?: undefined;
83
+ };
68
84
  propertyBindings: {
69
85
  url: string;
70
86
  text?: undefined;
71
87
  };
72
88
  position?: undefined;
73
- style?: undefined;
74
89
  } | {
75
90
  type: string;
76
91
  position: {
@@ -85,6 +100,7 @@ export declare const ITEM_VIEW_TEMPLATE_V2: {
85
100
  font: {
86
101
  size: number;
87
102
  };
103
+ background?: undefined;
88
104
  color?: undefined;
89
105
  };
90
106
  propertyBindings: {
@@ -106,6 +122,7 @@ export declare const ITEM_VIEW_TEMPLATE_V2: {
106
122
  size: number;
107
123
  };
108
124
  color: string;
125
+ background?: undefined;
109
126
  };
110
127
  propertyBindings: {
111
128
  text: string;
@@ -122,12 +139,18 @@ export declare const ITEM_VIEW: {
122
139
  width: number;
123
140
  height: number;
124
141
  };
142
+ style: {
143
+ background: {
144
+ size: BackgroundSizeType;
145
+ };
146
+ font?: undefined;
147
+ color?: undefined;
148
+ };
125
149
  propertyBindings: {
126
150
  url: string;
127
151
  text?: undefined;
128
152
  };
129
153
  position?: undefined;
130
- style?: undefined;
131
154
  } | {
132
155
  type: string;
133
156
  position: {
@@ -142,6 +165,7 @@ export declare const ITEM_VIEW: {
142
165
  font: {
143
166
  size: number;
144
167
  };
168
+ background?: undefined;
145
169
  color?: undefined;
146
170
  };
147
171
  propertyBindings: {
@@ -163,6 +187,7 @@ export declare const ITEM_VIEW: {
163
187
  size: number;
164
188
  };
165
189
  color: string;
190
+ background?: undefined;
166
191
  };
167
192
  propertyBindings: {
168
193
  text: string;
@@ -180,12 +205,18 @@ export declare const ITEM_VIEW_V2: {
180
205
  width: number;
181
206
  height: number;
182
207
  };
208
+ style: {
209
+ background: {
210
+ size: BackgroundSizeType;
211
+ };
212
+ font?: undefined;
213
+ color?: undefined;
214
+ };
183
215
  propertyBindings: {
184
216
  url: string;
185
217
  text?: undefined;
186
218
  };
187
219
  position?: undefined;
188
- style?: undefined;
189
220
  } | {
190
221
  type: string;
191
222
  position: {
@@ -200,6 +231,7 @@ export declare const ITEM_VIEW_V2: {
200
231
  font: {
201
232
  size: number;
202
233
  };
234
+ background?: undefined;
203
235
  color?: undefined;
204
236
  };
205
237
  propertyBindings: {
@@ -221,6 +253,7 @@ export declare const ITEM_VIEW_V2: {
221
253
  size: number;
222
254
  };
223
255
  color: string;
256
+ background?: undefined;
224
257
  };
225
258
  propertyBindings: {
226
259
  text: string;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  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
+ const types_1 = require("../types");
4
5
  exports.ITEM_VIEW_TEMPLATE = {
5
6
  elements: [{
6
7
  type: "image",
7
8
  size: { width: 125, height: 125 },
9
+ style: { background: { size: types_1.BackgroundSizeType.CONTAIN } },
8
10
  propertyBindings: { url: 'thumbnail.downloadUrl' }
9
11
  }, {
10
12
  type: "text",
@@ -34,6 +36,7 @@ exports.ITEM_VIEW_TEMPLATE_V2 = {
34
36
  elements: [{
35
37
  type: "image",
36
38
  size: { width: 125, height: 125 },
39
+ style: { background: { size: types_1.BackgroundSizeType.CONTAIN } },
37
40
  propertyBindings: { url: 'viewable.mediumViewableDownloadUrl' }
38
41
  }, {
39
42
  type: "text",
@@ -19,7 +19,7 @@ class DocumentElementPropertyBindingHandler {
19
19
  for (const propertyKey of Object.keys(element.propertyBindings)) {
20
20
  const modelIndex = element.propertyBindings[propertyKey];
21
21
  const propertyValue = util_1.ObjectUtil.getByPath(localModel, modelIndex) || '';
22
- element[propertyKey] = propertyValue;
22
+ util_1.ObjectUtil.setByPath(element, propertyKey, propertyValue);
23
23
  }
24
24
  if (((_b = (_a = element.propertyBindings) === null || _a === void 0 ? void 0 : _a.url) === null || _b === void 0 ? void 0 : _b.indexOf("viewable")) !== -1) {
25
25
  element.alternateUrls = {};
@@ -17,6 +17,11 @@ export interface BorderStyleDefinition {
17
17
  }
18
18
  export interface BackgroundStyleDefinition {
19
19
  color?: string;
20
+ size?: BackgroundSizeType;
21
+ }
22
+ export declare enum BackgroundSizeType {
23
+ CONTAIN = "CONTAIN",
24
+ COVER = "COVER"
20
25
  }
21
26
  export interface StyleDefinition {
22
27
  background?: BackgroundStyleDefinition;
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BackgroundSizeType = void 0;
4
+ var BackgroundSizeType;
5
+ (function (BackgroundSizeType) {
6
+ BackgroundSizeType["CONTAIN"] = "CONTAIN";
7
+ BackgroundSizeType["COVER"] = "COVER";
8
+ })(BackgroundSizeType = exports.BackgroundSizeType || (exports.BackgroundSizeType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",