@contrail/document-generation 2.0.26 → 2.0.28

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.
@@ -6,6 +6,7 @@ export declare abstract class DocumentFrame {
6
6
  toDocumentElements(): Array<DocumentElement>;
7
7
  }
8
8
  export declare class ShowcaseFrame extends DocumentFrame {
9
+ documentGenerationConfigId?: string;
9
10
  }
10
11
  export declare class BoardFrame extends DocumentFrame {
11
12
  private frameElement;
@@ -59,7 +59,7 @@ class DocumentPropertyUtil {
59
59
  const mergedOptions = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(options), { style: property.style || {} });
60
60
  mergedOptions.position = position;
61
61
  const useInlineFormatting = isComponent === false;
62
- let element = document_text_element_util_1.DocumentTextElementUtil.generateTextElement(display, mergedOptions, useInlineFormatting);
62
+ let element = document_text_element_util_1.DocumentTextElementUtil.generateTextElement(display, mergedOptions, useInlineFormatting, !isComponent);
63
63
  if (property.includeLabel) {
64
64
  element.label = (_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label;
65
65
  }
@@ -1,6 +1,6 @@
1
1
  import { DocumentElement, StyleDefinition } from "@contrail/documents";
2
2
  export declare class DocumentTextElementUtil {
3
- static generateTextElement(textValue: any, options: any, applyInlineFormatting?: boolean): DocumentElement;
3
+ static generateTextElement(textValue: any, options: any, applyInlineFormatting?: boolean, sanitizeHTML?: boolean): DocumentElement;
4
4
  static applyInLineStyling(text: any, style: StyleDefinition): any;
5
5
  static extractStyleFromInline(text: string): StyleDefinition;
6
6
  static extractFontSizeFromHTML(text: any): number;
@@ -5,7 +5,7 @@ const documents_1 = require("@contrail/documents");
5
5
  const util_1 = require("@contrail/util");
6
6
  const document_util_1 = require("./document-util");
7
7
  class DocumentTextElementUtil {
8
- static generateTextElement(textValue, options, applyInlineFormatting = true) {
8
+ static generateTextElement(textValue, options, applyInlineFormatting = true, sanitizeHTML = true) {
9
9
  var _a;
10
10
  const defaultStyle = {
11
11
  font: {
@@ -24,7 +24,11 @@ class DocumentTextElementUtil {
24
24
  size.height = size.height || 25;
25
25
  size.width = size.width || 125;
26
26
  const defaultedOptions = util_1.ObjectUtil.mergeDeep(util_1.ObjectUtil.cloneDeep(options), { position, size, style });
27
- let element = documents_1.DocumentElementFactory.createTextElement(document_util_1.DocumentUtil.sanitizeHTML(textValue));
27
+ let textVal = (sanitizeHTML) ? document_util_1.DocumentUtil.sanitizeHTML(textValue) : textValue;
28
+ if (textVal === undefined || textVal === null) {
29
+ textVal = '';
30
+ }
31
+ let element = documents_1.DocumentElementFactory.createTextElement(textVal);
28
32
  element = Object.assign(element, defaultedOptions);
29
33
  if (applyInlineFormatting) {
30
34
  element.text = this.applyInLineStyling(element.text, element.style);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-generation",
3
- "version": "2.0.26",
3
+ "version": "2.0.28",
4
4
  "description": "Utilities for automatic generation of documents.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",