@contrail/document-generation
Advanced tools
Comparing version 1.0.13 to 1.0.14
@@ -7,3 +7,2 @@ import { DocumentPropertyDefinition } from "../interfaces"; | ||
static generatePropertyTextElement(model: any, property: DocumentPropertyDefinition, options: DocumentElement, formatter: PropertyValueFormatter, position: PositionDefinition, isComponent: boolean): DocumentElement; | ||
private static generateTextElement; | ||
} |
@@ -5,4 +5,4 @@ "use strict"; | ||
const util_1 = require("@contrail/util"); | ||
const documents_1 = require("@contrail/documents"); | ||
const types_1 = require("@contrail/types"); | ||
const document_text_element_util_1 = require("./document-text-element-util"); | ||
class DocumentPropertyUtil { | ||
@@ -32,3 +32,4 @@ static generatePropertyTextElements(data, properties, options, startingPosition, isComponent) { | ||
const mergedOptions = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(options), { style: property.style || {} }); | ||
let element = this.generateTextElement(display, mergedOptions, position); | ||
mergedOptions.position = position; | ||
let element = document_text_element_util_1.DocumentTextElementUtil.generateTextElement(display, mergedOptions, !isComponent); | ||
if (isComponent && property.includeLabel) { | ||
@@ -44,27 +45,3 @@ element.label = (_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label; | ||
} | ||
static generateTextElement(textValue, options, position) { | ||
var _a, _b, _c; | ||
const yPosition = position.y || 0; | ||
const xPosition = position.x || 0; | ||
const defaultStyle = { | ||
font: { | ||
size: 8, | ||
}, | ||
color: 'rgba(0,0,0,.5)', | ||
}; | ||
let style = options.style || defaultStyle; | ||
if ((_a = options === null || options === void 0 ? void 0 : options.style) === null || _a === void 0 ? void 0 : _a.text) { | ||
style.text = options.style.text; | ||
} | ||
let element = documents_1.DocumentElementFactory.createTextElement(textValue); | ||
const height = ((_b = options.size) === null || _b === void 0 ? void 0 : _b.height) || 25; | ||
const width = ((_c = options === null || options === void 0 ? void 0 : options.size) === null || _c === void 0 ? void 0 : _c.width) || 125; | ||
element = Object.assign(element, { | ||
position: { x: xPosition, y: yPosition }, | ||
size: { height, width }, | ||
style, | ||
}); | ||
return element; | ||
} | ||
} | ||
exports.DocumentPropertyUtil = DocumentPropertyUtil; |
{ | ||
"name": "@contrail/document-generation", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Utilities for automatic generation of documents.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is too big to display
29
1170
529899