@contrail/documents 1.0.58 → 1.0.60

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.
@@ -9,7 +9,7 @@ class DocumentElementPropertyBindingHandler {
9
9
  });
10
10
  }
11
11
  static bindPropertiesToElement(element, model) {
12
- var _a, _b, _c, _d, _e, _f, _g;
12
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
13
13
  const localModel = Object.assign({}, model);
14
14
  if (!element.propertyBindings) {
15
15
  return;
@@ -25,13 +25,19 @@ class DocumentElementPropertyBindingHandler {
25
25
  element.alternateUrls = {};
26
26
  let highResUrl = ((_c = model === null || model === void 0 ? void 0 : model.viewable) === null || _c === void 0 ? void 0 : _c.largeViewableDownloadUrl) || ((_d = model === null || model === void 0 ? void 0 : model.viewable) === null || _d === void 0 ? void 0 : _d.largeViewableUrl);
27
27
  const content = (_e = model === null || model === void 0 ? void 0 : model.viewable) === null || _e === void 0 ? void 0 : _e.content;
28
- if ((content === null || content === void 0 ? void 0 : content.length) > 0 && content[0].contentType === 'image/svg+xml') {
29
- highResUrl = content[0].primaryFileUrl;
28
+ if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
29
+ const primaryContent = content.find((c) => { var _a; return (c === null || c === void 0 ? void 0 : c.id) === ((_a = model === null || model === void 0 ? void 0 : model.viewable) === null || _a === void 0 ? void 0 : _a.primaryViewableId); });
30
+ if ((primaryContent === null || primaryContent === void 0 ? void 0 : primaryContent.contentType) === 'image/svg+xml') {
31
+ highResUrl = primaryContent.primaryFileUrl;
32
+ }
33
+ }
34
+ else if (((_f = model === null || model === void 0 ? void 0 : model.viewable) === null || _f === void 0 ? void 0 : _f.contentType) === 'image/svg+xml') {
35
+ highResUrl = (_g = model === null || model === void 0 ? void 0 : model.viewable) === null || _g === void 0 ? void 0 : _g.primaryFileUrl;
30
36
  }
31
37
  if (highResUrl) {
32
38
  element.alternateUrls.highResolution = highResUrl;
33
39
  }
34
- let lowResUrl = ((_f = model === null || model === void 0 ? void 0 : model.viewable) === null || _f === void 0 ? void 0 : _f.smallViewableDownloadUrl) || ((_g = model === null || model === void 0 ? void 0 : model.viewable) === null || _g === void 0 ? void 0 : _g.smallViewableUrl);
40
+ let lowResUrl = ((_h = model === null || model === void 0 ? void 0 : model.viewable) === null || _h === void 0 ? void 0 : _h.smallViewableDownloadUrl) || ((_j = model === null || model === void 0 ? void 0 : model.viewable) === null || _j === void 0 ? void 0 : _j.smallViewableUrl);
35
41
  if (lowResUrl) {
36
42
  element.alternateUrls.lowResolution = lowResUrl;
37
43
  }
@@ -1,5 +1,6 @@
1
1
  import { CropDefinition, LineDefinition, PositionDefinition, RotationDefinition } from './common';
2
2
  import { Document } from './document';
3
+ import { ScaleTransformation } from './element-transformation';
3
4
  export interface AlternateUrls {
4
5
  highResolution?: string;
5
6
  lowResolution?: string;
@@ -10,6 +11,7 @@ export interface DocumentElement extends Document {
10
11
  type?: string;
11
12
  position?: PositionDefinition;
12
13
  rotate?: RotationDefinition;
14
+ scale?: ScaleTransformation;
13
15
  text?: string;
14
16
  url?: string;
15
17
  alternateUrls?: AlternateUrls;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",