@contrail/document-generation 1.0.16 → 1.0.19

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.
@@ -13,7 +13,10 @@ class DocumentPropertyUtil {
13
13
  const formatter = new types_1.PropertyValueFormatter();
14
14
  for (let property of properties) {
15
15
  const fontSize = ((_b = (_a = property.style) === null || _a === void 0 ? void 0 : _a.font) === null || _b === void 0 ? void 0 : _b.size) || 12;
16
- let height = fontSize + 12;
16
+ const PT_TO_PX = 1.3;
17
+ const LINE_HEIGHT = 1.4;
18
+ let height = fontSize * PT_TO_PX * LINE_HEIGHT;
19
+ console.log("derived height: ", fontSize, height);
17
20
  options.size = options.size || {};
18
21
  options.size.height = height;
19
22
  let element = DocumentPropertyUtil.generatePropertyTextElement(data, property, options, formatter, { x: xPosition, y: yPosition }, isComponent);
@@ -27,6 +30,9 @@ class DocumentPropertyUtil {
27
30
  const modelKey = `${util_1.StringUtil.convertToCamelCase(property.typeRootSlug)}.${property.propertyDefinition.slug}`;
28
31
  const value = util_1.ObjectUtil.getByPath(model, modelKey);
29
32
  let display = formatter.formatValueForProperty(value, property.propertyDefinition);
33
+ if (!isComponent && property.includeLabel) {
34
+ display = property.propertyDefinition.label + ': ' + display;
35
+ }
30
36
  const mergedOptions = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(options), { style: property.style || {} });
31
37
  mergedOptions.position = position;
32
38
  const useInlineFormatting = isComponent === false;
@@ -34,10 +40,6 @@ class DocumentPropertyUtil {
34
40
  if (isComponent && property.includeLabel) {
35
41
  element.label = (_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label;
36
42
  }
37
- else if (!isComponent && property.includeLabel) {
38
- display = property.propertyDefinition.label + ': ' + display;
39
- }
40
- element.text = display;
41
43
  element.propertyBindings = { text: modelKey };
42
44
  return element;
43
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-generation",
3
- "version": "1.0.16",
3
+ "version": "1.0.19",
4
4
  "description": "Utilities for automatic generation of documents.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",