@contrail/documents 1.0.7 → 1.0.9

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.
@@ -1,8 +1,8 @@
1
1
  import { DocumentElement } from './types/document-element';
2
2
  export declare class DocumentElementFactory {
3
3
  private static initNewElement;
4
- static createTextElement(text: string): DocumentElement;
5
- static createShapeElement(type: string): DocumentElement;
4
+ static createTextElement(text: string, options?: DocumentElement): DocumentElement;
5
+ static createShapeElement(type: string, options?: DocumentElement): DocumentElement;
6
6
  static createImageElement(options: DocumentElement): DocumentElement;
7
7
  static createComponent(componentType: string, model: any, modelBindings: any, options?: DocumentElement): DocumentElement;
8
8
  }
@@ -10,39 +10,22 @@ class DocumentElementFactory {
10
10
  id: uuid_1.v4(),
11
11
  position: { x: 300, y: 300 },
12
12
  type,
13
- size: {
14
- width: 0,
15
- height: 0,
16
- },
17
- style: {
18
- font: {
19
- size: 0,
20
- family: '',
21
- weight: '',
22
- style: '',
23
- },
24
- text: {
25
- decoration: '',
26
- },
27
- color: '',
28
- },
29
- text: '',
30
- url: '',
31
13
  };
32
14
  return element;
33
15
  }
34
- static createTextElement(text) {
35
- const element = this.initNewElement('text');
16
+ static createTextElement(text, options = {}) {
17
+ let element = this.initNewElement('text');
36
18
  element.text = text;
37
19
  element.size = { width: 65, height: 20 };
38
20
  element.style = {
39
21
  color: '#000000'
40
22
  };
23
+ element = Object.assign(element, options);
41
24
  return element;
42
25
  }
43
- static createShapeElement(type) {
44
- const element = this.initNewElement('shape');
45
- element.type = type;
26
+ static createShapeElement(type, options = {}) {
27
+ let element = this.initNewElement('shape');
28
+ element = Object.assign(element, options);
46
29
  return element;
47
30
  }
48
31
  static createImageElement(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",