@contrail/documents 1.0.106 → 1.0.108

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.
@@ -130,6 +130,94 @@ export declare const ITEM_VIEW_TEMPLATE_V2: {
130
130
  };
131
131
  })[];
132
132
  };
133
+ export declare const ITEM_VIEW_TEMPLATE_V3: {
134
+ elements: ({
135
+ type: string;
136
+ size: {
137
+ width: number;
138
+ height: number;
139
+ };
140
+ style: {
141
+ background: {
142
+ size: BackgroundSizeType;
143
+ };
144
+ font?: undefined;
145
+ color?: undefined;
146
+ };
147
+ propertyBindings: {
148
+ url: string;
149
+ text?: undefined;
150
+ };
151
+ position?: undefined;
152
+ label?: undefined;
153
+ } | {
154
+ type: string;
155
+ position: {
156
+ x: number;
157
+ y: number;
158
+ };
159
+ size: {
160
+ height: number;
161
+ width: number;
162
+ };
163
+ style: {
164
+ font: {
165
+ size: number;
166
+ };
167
+ background?: undefined;
168
+ color?: undefined;
169
+ };
170
+ propertyBindings: {
171
+ text: string;
172
+ url?: undefined;
173
+ };
174
+ label?: undefined;
175
+ } | {
176
+ type: string;
177
+ position: {
178
+ x: number;
179
+ y: number;
180
+ };
181
+ size: {
182
+ height: number;
183
+ width: number;
184
+ };
185
+ style: {
186
+ font: {
187
+ size: number;
188
+ };
189
+ color: string;
190
+ background?: undefined;
191
+ };
192
+ propertyBindings: {
193
+ text: string;
194
+ url?: undefined;
195
+ };
196
+ label?: undefined;
197
+ } | {
198
+ type: string;
199
+ position: {
200
+ x: number;
201
+ y: number;
202
+ };
203
+ size: {
204
+ height: number;
205
+ width: number;
206
+ };
207
+ style: {
208
+ font: {
209
+ size: number;
210
+ };
211
+ color: string;
212
+ background?: undefined;
213
+ };
214
+ label: string;
215
+ propertyBindings: {
216
+ text: string;
217
+ url?: undefined;
218
+ };
219
+ })[];
220
+ };
133
221
  export declare const ITEM_VIEW: {
134
222
  slug: string;
135
223
  defaultTemplate: {
@@ -262,6 +350,97 @@ export declare const ITEM_VIEW_V2: {
262
350
  })[];
263
351
  };
264
352
  };
353
+ export declare const ITEM_VIEW_V3: {
354
+ slug: string;
355
+ defaultTemplate: {
356
+ elements: ({
357
+ type: string;
358
+ size: {
359
+ width: number;
360
+ height: number;
361
+ };
362
+ style: {
363
+ background: {
364
+ size: BackgroundSizeType;
365
+ };
366
+ font?: undefined;
367
+ color?: undefined;
368
+ };
369
+ propertyBindings: {
370
+ url: string;
371
+ text?: undefined;
372
+ };
373
+ position?: undefined;
374
+ label?: undefined;
375
+ } | {
376
+ type: string;
377
+ position: {
378
+ x: number;
379
+ y: number;
380
+ };
381
+ size: {
382
+ height: number;
383
+ width: number;
384
+ };
385
+ style: {
386
+ font: {
387
+ size: number;
388
+ };
389
+ background?: undefined;
390
+ color?: undefined;
391
+ };
392
+ propertyBindings: {
393
+ text: string;
394
+ url?: undefined;
395
+ };
396
+ label?: undefined;
397
+ } | {
398
+ type: string;
399
+ position: {
400
+ x: number;
401
+ y: number;
402
+ };
403
+ size: {
404
+ height: number;
405
+ width: number;
406
+ };
407
+ style: {
408
+ font: {
409
+ size: number;
410
+ };
411
+ color: string;
412
+ background?: undefined;
413
+ };
414
+ propertyBindings: {
415
+ text: string;
416
+ url?: undefined;
417
+ };
418
+ label?: undefined;
419
+ } | {
420
+ type: string;
421
+ position: {
422
+ x: number;
423
+ y: number;
424
+ };
425
+ size: {
426
+ height: number;
427
+ width: number;
428
+ };
429
+ style: {
430
+ font: {
431
+ size: number;
432
+ };
433
+ color: string;
434
+ background?: undefined;
435
+ };
436
+ label: string;
437
+ propertyBindings: {
438
+ text: string;
439
+ url?: undefined;
440
+ };
441
+ })[];
442
+ };
443
+ };
265
444
  export declare class ComponentRegistry {
266
445
  private static componentDefinitionMap;
267
446
  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_V2 = exports.ITEM_VIEW = exports.ITEM_VIEW_TEMPLATE_V2 = exports.ITEM_VIEW_TEMPLATE = void 0;
3
+ exports.ComponentRegistry = exports.ITEM_VIEW_V3 = exports.ITEM_VIEW_V2 = exports.ITEM_VIEW = exports.ITEM_VIEW_TEMPLATE_V3 = exports.ITEM_VIEW_TEMPLATE_V2 = exports.ITEM_VIEW_TEMPLATE = void 0;
4
4
  const types_1 = require("../types");
5
5
  exports.ITEM_VIEW_TEMPLATE = {
6
6
  elements: [
@@ -68,6 +68,52 @@ exports.ITEM_VIEW_TEMPLATE_V2 = {
68
68
  },
69
69
  ],
70
70
  };
71
+ exports.ITEM_VIEW_TEMPLATE_V3 = {
72
+ elements: [
73
+ {
74
+ type: 'image',
75
+ size: { width: 125, height: 125 },
76
+ style: { background: { size: types_1.BackgroundSizeType.CONTAIN } },
77
+ propertyBindings: { url: 'viewable.mediumViewableDownloadUrl' },
78
+ },
79
+ {
80
+ type: 'text',
81
+ position: { x: 0, y: 126 },
82
+ size: { height: 25, width: 125 },
83
+ style: {
84
+ font: {
85
+ size: 8,
86
+ },
87
+ },
88
+ propertyBindings: { text: 'item.name' },
89
+ },
90
+ {
91
+ type: 'text',
92
+ position: { x: 0, y: 151 },
93
+ size: { height: 25, width: 125 },
94
+ style: {
95
+ font: {
96
+ size: 8,
97
+ },
98
+ color: 'rgba(0,0,0,.5)',
99
+ },
100
+ propertyBindings: { text: 'item.optionName' },
101
+ },
102
+ {
103
+ type: 'text',
104
+ position: { x: 0, y: 176 },
105
+ size: { height: 25, width: 125 },
106
+ style: {
107
+ font: {
108
+ size: 8,
109
+ },
110
+ color: 'rgba(0,0,0,.5)',
111
+ },
112
+ label: 'Item Type',
113
+ propertyBindings: { text: 'item.type.label' },
114
+ },
115
+ ],
116
+ };
71
117
  exports.ITEM_VIEW = {
72
118
  slug: 'item-view',
73
119
  defaultTemplate: exports.ITEM_VIEW_TEMPLATE,
@@ -76,6 +122,10 @@ exports.ITEM_VIEW_V2 = {
76
122
  slug: 'item-view-v2',
77
123
  defaultTemplate: exports.ITEM_VIEW_TEMPLATE_V2,
78
124
  };
125
+ exports.ITEM_VIEW_V3 = {
126
+ slug: 'item-view-v3',
127
+ defaultTemplate: exports.ITEM_VIEW_TEMPLATE_V3,
128
+ };
79
129
  class ComponentRegistry {
80
130
  static getComponentDefinition(slug) {
81
131
  if (!this.componentDefinitionMap) {
@@ -87,6 +137,7 @@ class ComponentRegistry {
87
137
  this.componentDefinitionMap = new Map();
88
138
  this.componentDefinitionMap.set('item-view', exports.ITEM_VIEW);
89
139
  this.componentDefinitionMap.set('item-view-v2', exports.ITEM_VIEW_V2);
140
+ this.componentDefinitionMap.set('item-view-v3', exports.ITEM_VIEW_V3);
90
141
  }
91
142
  }
92
143
  exports.ComponentRegistry = ComponentRegistry;
@@ -1,7 +1,25 @@
1
1
  import { Action } from '@contrail/actions';
2
- import { DocumentChange } from './types';
2
+ import { DocumentChange, DocumentElement } from './types';
3
3
  export declare class DocumentAction extends Action {
4
4
  changeDefinition: DocumentChange;
5
5
  undoChangeDefinition: DocumentChange;
6
6
  constructor(change: any, undoChange?: any);
7
7
  }
8
+ export interface DocumentElementChanges {
9
+ elementsToUpdate?: Array<{
10
+ change: DocumentElement;
11
+ undo: DocumentElement;
12
+ }>;
13
+ elementsToCreate?: DocumentElement[];
14
+ elementsToDelete?: DocumentElement[];
15
+ }
16
+ export declare function uniqueElementsToUpdate(elementsToUpdate: Array<{
17
+ change: DocumentElement;
18
+ undo: DocumentElement;
19
+ }>, mainElementsToUpdate: Array<{
20
+ change: DocumentElement;
21
+ undo: DocumentElement;
22
+ }>): {
23
+ change: DocumentElement;
24
+ undo: DocumentElement;
25
+ }[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DocumentAction = void 0;
3
+ exports.uniqueElementsToUpdate = exports.DocumentAction = void 0;
4
4
  const actions_1 = require("@contrail/actions");
5
5
  class DocumentAction extends actions_1.Action {
6
6
  constructor(change, undoChange = null) {
@@ -8,3 +8,7 @@ class DocumentAction extends actions_1.Action {
8
8
  }
9
9
  }
10
10
  exports.DocumentAction = DocumentAction;
11
+ function uniqueElementsToUpdate(elementsToUpdate, mainElementsToUpdate) {
12
+ return elementsToUpdate.filter(({ change }) => mainElementsToUpdate.findIndex(elementToUpdate => elementToUpdate.change.id === change.id) === -1);
13
+ }
14
+ exports.uniqueElementsToUpdate = uniqueElementsToUpdate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.0.106",
3
+ "version": "1.0.108",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",