@contrail/document-generation 1.0.28 → 1.0.30

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.
@@ -20,6 +20,7 @@ class ComponentGridGenerator {
20
20
  }
21
21
  const elements = [];
22
22
  let dataIndex = 0;
23
+ console.log("generateComponentGrid: idealSize: ", idealSize);
23
24
  let gridTemplate = template;
24
25
  const optimizeTemplate = true;
25
26
  if (optimizeTemplate) {
@@ -28,9 +29,6 @@ class ComponentGridGenerator {
28
29
  const componentTemplate = gridTemplate.componentTemplate;
29
30
  const componentPosition = util_1.ObjectUtil.cloneDeep(startingPosition);
30
31
  const componentSize = this.getComponentSize(data, gridTemplate);
31
- if (componentSize.width < 120) {
32
- componentSize.width = 120;
33
- }
34
32
  const componentPadding = gridTemplate.componentPadding || 20;
35
33
  componentPosition.x += componentPadding;
36
34
  componentPosition.y += componentPadding;
@@ -63,9 +61,11 @@ class ComponentGridGenerator {
63
61
  static adjustComponentTemplate(data, idealSize, template) {
64
62
  const componentSize = this.getComponentSize(data, template);
65
63
  const adjustedTemplate = util_1.ObjectUtil.cloneDeep(template);
64
+ const horizontalPadding = ((template.gridDimensions.cols * 2) * template.componentPadding || 20);
65
+ const verticalPadding = ((template.gridDimensions.rows * 2) * template.componentPadding || 20);
66
66
  const requiredSize = {
67
- width: componentSize.width * template.gridDimensions.cols + ((template.gridDimensions.cols * 2) * template.componentPadding || 20),
68
- height: componentSize.height * template.gridDimensions.rows + ((template.gridDimensions.rows * 2) * template.componentPadding || 20)
67
+ width: componentSize.width * template.gridDimensions.cols + horizontalPadding,
68
+ height: componentSize.height * template.gridDimensions.rows + verticalPadding,
69
69
  };
70
70
  const requiredHeightAdjustment = (idealSize.height - requiredSize.height) / template.gridDimensions.rows;
71
71
  const requiredWidthAdjustment = (idealSize.width - requiredSize.width) / template.gridDimensions.cols;
package/lib/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './document-generator';
2
2
  export * from './interfaces';
3
- export * from './util';
package/lib/index.js CHANGED
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./document-generator"), exports);
18
18
  __exportStar(require("./interfaces"), exports);
19
- __exportStar(require("./util"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-generation",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "Utilities for automatic generation of documents.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,3 +0,0 @@
1
- export * from './document-property-util';
2
- export * from './document-text-element-util';
3
- export * from './document-util';
package/lib/util/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./document-property-util"), exports);
18
- __exportStar(require("./document-text-element-util"), exports);
19
- __exportStar(require("./document-util"), exports);