@contrail/document-generation 2.1.35 → 2.1.36

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.
@@ -116,6 +116,7 @@ class FrameGenerator {
116
116
  const templateElements = util_1.ObjectUtil.cloneDeep(frameTemplate.document.elements);
117
117
  const elementMapping = {};
118
118
  const createdElements = [];
119
+ const calloutElements = [];
119
120
  for (let element of templateElements) {
120
121
  if (['row', 'column', 'cell'].indexOf(element.type) !== -1)
121
122
  continue;
@@ -151,9 +152,25 @@ class FrameGenerator {
151
152
  documentElement = newTableElement;
152
153
  childDocumentElements = newChildElements;
153
154
  }
155
+ if (documentElement.type === 'callout')
156
+ calloutElements.push(documentElement);
154
157
  createdElements.push(documentElement);
155
158
  createdElements.push(...childDocumentElements);
156
159
  }
160
+ calloutElements.forEach((calloutElement) => {
161
+ if (calloutElement.start.id) {
162
+ const startId = elementMapping[calloutElement.start.id];
163
+ if (startId) {
164
+ calloutElement.start.id = startId;
165
+ }
166
+ }
167
+ if (calloutElement.end.id) {
168
+ const endId = elementMapping[calloutElement.end.id];
169
+ if (endId) {
170
+ calloutElement.end.id = endId;
171
+ }
172
+ }
173
+ });
157
174
  return createdElements;
158
175
  }
159
176
  }
@@ -40,6 +40,7 @@ class BoardFrame extends DocumentFrame {
40
40
  this.frameElement.name = name;
41
41
  }
42
42
  toDocumentElements() {
43
+ var _a, _b;
43
44
  const elements = [];
44
45
  elements.push(this.frameElement);
45
46
  const repositionedElements = [];
@@ -52,6 +53,9 @@ class BoardFrame extends DocumentFrame {
52
53
  else {
53
54
  element.position.x += this.frameElement.position.x;
54
55
  }
56
+ if (['line', 'callout'].includes(element.type) && ((_a = element.points) === null || _a === void 0 ? void 0 : _a.length) > 0) {
57
+ element.points = element.points.map(([x, y]) => [x + this.frameElement.position.x, y]);
58
+ }
55
59
  }
56
60
  if (this.frameElement.position.y !== 0) {
57
61
  if (element.type === 'line') {
@@ -61,6 +65,9 @@ class BoardFrame extends DocumentFrame {
61
65
  else {
62
66
  element.position.y += this.frameElement.position.y;
63
67
  }
68
+ if (['line', 'callout'].includes(element.type) && ((_b = element.points) === null || _b === void 0 ? void 0 : _b.length) > 0) {
69
+ element.points = element.points.map(([x, y]) => [x, y + this.frameElement.position.y]);
70
+ }
64
71
  }
65
72
  repositionedElements.push(element);
66
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-generation",
3
- "version": "2.1.35",
3
+ "version": "2.1.36",
4
4
  "description": "Utilities for automatic generation of documents.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",