@contrail/document-generation 2.0.56 → 2.0.58

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.
@@ -30,11 +30,11 @@ class ComponentGridGenerator {
30
30
  const componentPadding = gridTemplate.componentPadding || 20;
31
31
  const alignment = template.alignment || 'left';
32
32
  const maxComponentHeight = (idealSize.height - template.gridDimensions.rows * componentPadding * 2) / template.gridDimensions.rows;
33
- startingPosition.y += componentPadding;
34
33
  for (let row = 0; row < gridTemplate.gridDimensions.rows; row++) {
35
34
  const remainingItems = data.length - dataIndex;
36
35
  const itemsInRow = Math.min(remainingItems, gridTemplate.gridDimensions.cols);
37
36
  const rowWidth = itemsInRow * (componentSize.width + componentPadding * 2) - componentPadding * 2;
37
+ startingPosition.y += componentPadding;
38
38
  let rowStartX = startingPosition.x;
39
39
  if (alignment === 'center') {
40
40
  rowStartX += (idealSize.width - rowWidth) / 2;
@@ -48,7 +48,9 @@ class ComponentGridGenerator {
48
48
  rowStartX = Math.round(rowStartX);
49
49
  let componentPosition = {
50
50
  x: rowStartX,
51
- y: startingPosition.y + row * (Math.min(componentSize.height, maxComponentHeight) + componentPadding * 2),
51
+ y: startingPosition.y +
52
+ row * (Math.min(componentSize.height, maxComponentHeight) + componentPadding) +
53
+ componentPadding,
52
54
  };
53
55
  for (let col = 0; col < gridTemplate.gridDimensions.cols; col++) {
54
56
  if (dataIndex >= data.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-generation",
3
- "version": "2.0.56",
3
+ "version": "2.0.58",
4
4
  "description": "Utilities for automatic generation of documents.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",