@contrail/documents 1.3.14 → 1.3.16

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.
@@ -6,14 +6,14 @@ const document_element_factory_1 = require("./document-element-factory");
6
6
  class DocumentFrameService {
7
7
  static generateFrames(document, documentFrameGenerationOptions = {}) {
8
8
  var _a, _b, _c, _d, _e, _f;
9
- const options = Object.assign(documentFrameGenerationOptions, {
9
+ const options = Object.assign({
10
10
  includeHidden: true,
11
11
  selectedIds: [],
12
12
  relativePosition: false,
13
- });
13
+ }, documentFrameGenerationOptions);
14
14
  const includeSelected = ((_a = options.selectedIds) === null || _a === void 0 ? void 0 : _a.length) > 0;
15
15
  const frames = new Map();
16
- const elementsMap = new Map((_b = document === null || document === void 0 ? void 0 : document.elements) === null || _b === void 0 ? void 0 : _b.map(element => [element.id, element]));
16
+ const elementsMap = new Map((_b = document === null || document === void 0 ? void 0 : document.elements) === null || _b === void 0 ? void 0 : _b.map((element) => [element.id, element]));
17
17
  for (let i = 0; i < ((_c = document === null || document === void 0 ? void 0 : document.elements) === null || _c === void 0 ? void 0 : _c.length); i++) {
18
18
  const documentElement = document.elements[i];
19
19
  if (['row', 'column', 'cell'].indexOf(documentElement.type) !== -1)
@@ -57,7 +57,7 @@ class DocumentFrameService {
57
57
  top: y + height / 2,
58
58
  bottom: y + height / 2,
59
59
  };
60
- const overlappedFrame = ([...frames.values()].filter(frame => {
60
+ const overlappedFrame = ([...frames.values()].filter((frame) => {
61
61
  return i > frame.index && this.isInBox(frame.box, elementBox);
62
62
  }) || []).pop();
63
63
  if (overlappedFrame) {
@@ -74,7 +74,7 @@ class DocumentFrameService {
74
74
  const frame = frames.get(overlappedFrame.id);
75
75
  frames.set(overlappedFrame.id, Object.assign(Object.assign({}, frame), { elements: [
76
76
  ...frame.elements,
77
- ...childElements.map(e => ({
77
+ ...childElements.map((e) => ({
78
78
  element: e,
79
79
  index: i,
80
80
  })),
@@ -88,7 +88,7 @@ class DocumentFrameService {
88
88
  return [];
89
89
  }
90
90
  const documentFrames = [];
91
- frames.forEach(frame => {
91
+ frames.forEach((frame) => {
92
92
  var _a, _b, _c;
93
93
  const framePosition = frame.element.position;
94
94
  const position = (options === null || options === void 0 ? void 0 : options.relativePosition) ? { x: 0, y: 0 } : framePosition;
@@ -115,11 +115,9 @@ class DocumentFrameService {
115
115
  }
116
116
  }
117
117
  documentFrames.push({
118
- id: frame.element.id,
119
- type: 'document',
120
118
  name: frame.element.name,
121
119
  background: [frame.element],
122
- elements: (_c = frame.elements) === null || _c === void 0 ? void 0 : _c.map(frameElement => frameElement.element),
120
+ elements: (_c = frame.elements) === null || _c === void 0 ? void 0 : _c.map((frameElement) => frameElement.element),
123
121
  size: frame.element.size,
124
122
  position,
125
123
  });
@@ -17,6 +17,7 @@ export interface DocumentElement extends Document {
17
17
  id?: string;
18
18
  specifiedId?: string;
19
19
  documentId?: string;
20
+ type?: string;
20
21
  rotate?: RotationDefinition;
21
22
  scale?: ScaleTransformation;
22
23
  text?: string;
@@ -7,7 +7,6 @@ export interface ImportReferenceDetail {
7
7
  export interface Document {
8
8
  id?: string;
9
9
  name?: string;
10
- type?: string;
11
10
  elements?: Array<DocumentElement>;
12
11
  size?: SizeDefinition;
13
12
  position?: PositionDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",