@contrail/document-generation 2.0.50 → 2.0.51
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.
- package/README.md +2 -2
- package/lib/board-document-generator.d.ts +23 -23
- package/lib/board-document-generator.js +241 -241
- package/lib/components/component-generator.d.ts +6 -6
- package/lib/components/component-generator.js +55 -55
- package/lib/components/component-grid-generator.d.ts +7 -7
- package/lib/components/component-grid-generator.js +84 -84
- package/lib/components/component-util.d.ts +5 -5
- package/lib/components/component-util.js +43 -43
- package/lib/document-generator.d.ts +6 -6
- package/lib/document-generator.js +11 -11
- package/lib/frames/frame-generator.d.ts +12 -12
- package/lib/frames/frame-generator.js +141 -141
- package/lib/frames/frame.d.ts +18 -16
- package/lib/frames/frame.js +71 -67
- package/lib/frames/index.d.ts +2 -2
- package/lib/frames/index.js +18 -18
- package/lib/index.d.ts +6 -6
- package/lib/index.js +22 -22
- package/lib/info-panel/info-panel-generator.d.ts +6 -6
- package/lib/info-panel/info-panel-generator.js +56 -56
- package/lib/interfaces.d.ts +72 -72
- package/lib/interfaces.js +8 -8
- package/lib/scripts/test-board.d.ts +1 -1
- package/lib/scripts/test-board.js +230 -230
- package/lib/scripts/test-showcase.d.ts +1 -1
- package/lib/scripts/test-showcase.js +257 -257
- package/lib/showcase-frame-generator.d.ts +8 -8
- package/lib/showcase-frame-generator.js +44 -44
- package/lib/test-data.d.ts +72 -72
- package/lib/test-data.js +187 -187
- package/lib/util/document-dynamic-text-element-util.d.ts +8 -8
- package/lib/util/document-dynamic-text-element-util.js +77 -77
- package/lib/util/document-property-util.d.ts +9 -9
- package/lib/util/document-property-util.js +102 -102
- package/lib/util/document-text-element-util.d.ts +12 -12
- package/lib/util/document-text-element-util.js +148 -148
- package/lib/util/document-util.d.ts +8 -8
- package/lib/util/document-util.js +22 -22
- package/lib/util/index.d.ts +2 -2
- package/lib/util/index.js +18 -18
- package/lib/util/text-util.d.ts +4 -4
- package/lib/util/text-util.js +28 -28
- package/package.json +1 -1
- package/testdocument.json +25972 -25972
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InfoPanelGenerator = void 0;
|
|
4
|
-
const documents_1 = require("@contrail/documents");
|
|
5
|
-
const document_property_util_1 = require("../util/document-property-util");
|
|
6
|
-
class InfoPanelGenerator {
|
|
7
|
-
static generatedModelBindings(data) {
|
|
8
|
-
const model = {};
|
|
9
|
-
if (data.item) {
|
|
10
|
-
model.item = `item:${data.item.id}`;
|
|
11
|
-
}
|
|
12
|
-
if (data.projectItem) {
|
|
13
|
-
model.projectItem = `project-item:${data.projectItem.id}`;
|
|
14
|
-
}
|
|
15
|
-
if (data.assortmentItem) {
|
|
16
|
-
model.assortmentItem = `assortment-item:${data.assortmentItem.id}`;
|
|
17
|
-
}
|
|
18
|
-
if (data.assortment) {
|
|
19
|
-
model.assortment = `assortment:${data.assortment.id}`;
|
|
20
|
-
}
|
|
21
|
-
return model;
|
|
22
|
-
}
|
|
23
|
-
static generatePanelFromTemplate(data, template, position, panelSize) {
|
|
24
|
-
var _a;
|
|
25
|
-
if (!template.propertyTemplate) {
|
|
26
|
-
throw Error('No panel property template defined');
|
|
27
|
-
}
|
|
28
|
-
const elements = [];
|
|
29
|
-
const panel = documents_1.DocumentElementFactory.createShapeElement('rectangle', {});
|
|
30
|
-
panel.style = ((_a = template.panelDocumentTemplate) === null || _a === void 0 ? void 0 : _a.style) || {};
|
|
31
|
-
panel.size = panelSize
|
|
32
|
-
? {
|
|
33
|
-
width: panelSize.width,
|
|
34
|
-
height: panelSize.height,
|
|
35
|
-
}
|
|
36
|
-
: {};
|
|
37
|
-
panel.position = { x: position.x, y: position.y };
|
|
38
|
-
elements.push(panel);
|
|
39
|
-
const modelBindings = this.generatedModelBindings(data);
|
|
40
|
-
const textOptions = {
|
|
41
|
-
style: {
|
|
42
|
-
text: {
|
|
43
|
-
align: template.propertyTemplate.textHorizontalAlignment,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
size: {
|
|
47
|
-
width: panelSize.width - 10,
|
|
48
|
-
},
|
|
49
|
-
modelBindings,
|
|
50
|
-
};
|
|
51
|
-
const textElements = document_property_util_1.DocumentPropertyUtil.generatePropertyElements(data, template.propertyTemplate.properties, textOptions, { x: panel.position.x, y: panel.position.y }, {}, false);
|
|
52
|
-
elements.push(...textElements);
|
|
53
|
-
return elements;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.InfoPanelGenerator = InfoPanelGenerator;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InfoPanelGenerator = void 0;
|
|
4
|
+
const documents_1 = require("@contrail/documents");
|
|
5
|
+
const document_property_util_1 = require("../util/document-property-util");
|
|
6
|
+
class InfoPanelGenerator {
|
|
7
|
+
static generatedModelBindings(data) {
|
|
8
|
+
const model = {};
|
|
9
|
+
if (data.item) {
|
|
10
|
+
model.item = `item:${data.item.id}`;
|
|
11
|
+
}
|
|
12
|
+
if (data.projectItem) {
|
|
13
|
+
model.projectItem = `project-item:${data.projectItem.id}`;
|
|
14
|
+
}
|
|
15
|
+
if (data.assortmentItem) {
|
|
16
|
+
model.assortmentItem = `assortment-item:${data.assortmentItem.id}`;
|
|
17
|
+
}
|
|
18
|
+
if (data.assortment) {
|
|
19
|
+
model.assortment = `assortment:${data.assortment.id}`;
|
|
20
|
+
}
|
|
21
|
+
return model;
|
|
22
|
+
}
|
|
23
|
+
static generatePanelFromTemplate(data, template, position, panelSize) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (!template.propertyTemplate) {
|
|
26
|
+
throw Error('No panel property template defined');
|
|
27
|
+
}
|
|
28
|
+
const elements = [];
|
|
29
|
+
const panel = documents_1.DocumentElementFactory.createShapeElement('rectangle', {});
|
|
30
|
+
panel.style = ((_a = template.panelDocumentTemplate) === null || _a === void 0 ? void 0 : _a.style) || {};
|
|
31
|
+
panel.size = panelSize
|
|
32
|
+
? {
|
|
33
|
+
width: panelSize.width,
|
|
34
|
+
height: panelSize.height,
|
|
35
|
+
}
|
|
36
|
+
: {};
|
|
37
|
+
panel.position = { x: position.x, y: position.y };
|
|
38
|
+
elements.push(panel);
|
|
39
|
+
const modelBindings = this.generatedModelBindings(data);
|
|
40
|
+
const textOptions = {
|
|
41
|
+
style: {
|
|
42
|
+
text: {
|
|
43
|
+
align: template.propertyTemplate.textHorizontalAlignment,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
size: {
|
|
47
|
+
width: panelSize.width - 10,
|
|
48
|
+
},
|
|
49
|
+
modelBindings,
|
|
50
|
+
};
|
|
51
|
+
const textElements = document_property_util_1.DocumentPropertyUtil.generatePropertyElements(data, template.propertyTemplate.properties, textOptions, { x: panel.position.x, y: panel.position.y }, {}, false);
|
|
52
|
+
elements.push(...textElements);
|
|
53
|
+
return elements;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.InfoPanelGenerator = InfoPanelGenerator;
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { DataGroupStructure } from '@contrail/data-grouping';
|
|
2
|
-
import { PositionDefinition, SizeDefinition, Document, DocumentElement, StyleDefinition } from '@contrail/documents';
|
|
3
|
-
import { TypeProperty } from '@contrail/types';
|
|
4
|
-
export declare enum Orientation {
|
|
5
|
-
HORIZONTAL = "horizontal",
|
|
6
|
-
VERTICAL = "vertical"
|
|
7
|
-
}
|
|
8
|
-
export interface DocumentGenerationDataDefinition {
|
|
9
|
-
dataGroup: DataGroupStructure;
|
|
10
|
-
}
|
|
11
|
-
export interface DocumentGenerationOptions {
|
|
12
|
-
startingCoordinates: PositionDefinition;
|
|
13
|
-
data: DocumentGenerationDataDefinition;
|
|
14
|
-
documentTemplateDefinition: DocumentTemplate;
|
|
15
|
-
frameTemplate?: FrameDocumentTemplate;
|
|
16
|
-
}
|
|
17
|
-
export interface DocumentTemplate {
|
|
18
|
-
frameOrientation: Orientation;
|
|
19
|
-
frameSize: SizeDefinition;
|
|
20
|
-
framePadding?: number;
|
|
21
|
-
frameGroupHeaderTemplate: DocumentElement;
|
|
22
|
-
secondaryFrameGroupHeaderTemplate?: DocumentElement;
|
|
23
|
-
frameHeaderTemplate?: DocumentElement;
|
|
24
|
-
frameInfoPanelTemplate?: FrameInfoPanelTemplate;
|
|
25
|
-
componentGridTemplate: ComponentGridTemplate;
|
|
26
|
-
}
|
|
27
|
-
export interface GridSpaceDefinition {
|
|
28
|
-
size: SizeDefinition;
|
|
29
|
-
position: PositionDefinition;
|
|
30
|
-
}
|
|
31
|
-
export interface FrameDocumentTemplate {
|
|
32
|
-
id: string;
|
|
33
|
-
templateType: 'FRAME' | 'BOARD';
|
|
34
|
-
document: Document;
|
|
35
|
-
gridSpaceDefinition: GridSpaceDefinition;
|
|
36
|
-
name: string;
|
|
37
|
-
clipContent: boolean;
|
|
38
|
-
}
|
|
39
|
-
export interface FrameInfoPanelTemplate {
|
|
40
|
-
panelDocumentTemplate: DocumentElement;
|
|
41
|
-
propertyTemplate: PanelPropertyTemplate;
|
|
42
|
-
}
|
|
43
|
-
export interface PanelPropertyTemplate {
|
|
44
|
-
textHorizontalAlignment?: 'center' | 'right' | 'left';
|
|
45
|
-
properties: Array<DocumentPropertyDefinition>;
|
|
46
|
-
}
|
|
47
|
-
export interface ComponentGridTemplate {
|
|
48
|
-
componentTemplate: ComponentTemplate;
|
|
49
|
-
componentPadding?: number;
|
|
50
|
-
gridDimensions: {
|
|
51
|
-
rows: number;
|
|
52
|
-
cols: number;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export interface ComponentTemplate {
|
|
56
|
-
propertyTemplate?: ComponentPropertyTemplate;
|
|
57
|
-
}
|
|
58
|
-
export interface ComponentPropertyTemplate {
|
|
59
|
-
imageDimension?: SizeDefinition;
|
|
60
|
-
imageLocation?: 'top' | 'right' | 'left' | 'bottom';
|
|
61
|
-
textHorizontalAlignment?: 'center' | 'right' | 'left';
|
|
62
|
-
properties: Array<DocumentPropertyDefinition>;
|
|
63
|
-
}
|
|
64
|
-
export interface DocumentPropertyDefinition {
|
|
65
|
-
style?: StyleDefinition;
|
|
66
|
-
propertyDefinition: TypeProperty;
|
|
67
|
-
slug: string;
|
|
68
|
-
typeRootSlug: string;
|
|
69
|
-
includeLabel?: boolean;
|
|
70
|
-
isHidden?: boolean;
|
|
71
|
-
size?: SizeDefinition;
|
|
72
|
-
}
|
|
1
|
+
import { DataGroupStructure } from '@contrail/data-grouping';
|
|
2
|
+
import { PositionDefinition, SizeDefinition, Document, DocumentElement, StyleDefinition } from '@contrail/documents';
|
|
3
|
+
import { TypeProperty } from '@contrail/types';
|
|
4
|
+
export declare enum Orientation {
|
|
5
|
+
HORIZONTAL = "horizontal",
|
|
6
|
+
VERTICAL = "vertical"
|
|
7
|
+
}
|
|
8
|
+
export interface DocumentGenerationDataDefinition {
|
|
9
|
+
dataGroup: DataGroupStructure;
|
|
10
|
+
}
|
|
11
|
+
export interface DocumentGenerationOptions {
|
|
12
|
+
startingCoordinates: PositionDefinition;
|
|
13
|
+
data: DocumentGenerationDataDefinition;
|
|
14
|
+
documentTemplateDefinition: DocumentTemplate;
|
|
15
|
+
frameTemplate?: FrameDocumentTemplate;
|
|
16
|
+
}
|
|
17
|
+
export interface DocumentTemplate {
|
|
18
|
+
frameOrientation: Orientation;
|
|
19
|
+
frameSize: SizeDefinition;
|
|
20
|
+
framePadding?: number;
|
|
21
|
+
frameGroupHeaderTemplate: DocumentElement;
|
|
22
|
+
secondaryFrameGroupHeaderTemplate?: DocumentElement;
|
|
23
|
+
frameHeaderTemplate?: DocumentElement;
|
|
24
|
+
frameInfoPanelTemplate?: FrameInfoPanelTemplate;
|
|
25
|
+
componentGridTemplate: ComponentGridTemplate;
|
|
26
|
+
}
|
|
27
|
+
export interface GridSpaceDefinition {
|
|
28
|
+
size: SizeDefinition;
|
|
29
|
+
position: PositionDefinition;
|
|
30
|
+
}
|
|
31
|
+
export interface FrameDocumentTemplate {
|
|
32
|
+
id: string;
|
|
33
|
+
templateType: 'FRAME' | 'BOARD';
|
|
34
|
+
document: Document;
|
|
35
|
+
gridSpaceDefinition: GridSpaceDefinition;
|
|
36
|
+
name: string;
|
|
37
|
+
clipContent: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface FrameInfoPanelTemplate {
|
|
40
|
+
panelDocumentTemplate: DocumentElement;
|
|
41
|
+
propertyTemplate: PanelPropertyTemplate;
|
|
42
|
+
}
|
|
43
|
+
export interface PanelPropertyTemplate {
|
|
44
|
+
textHorizontalAlignment?: 'center' | 'right' | 'left';
|
|
45
|
+
properties: Array<DocumentPropertyDefinition>;
|
|
46
|
+
}
|
|
47
|
+
export interface ComponentGridTemplate {
|
|
48
|
+
componentTemplate: ComponentTemplate;
|
|
49
|
+
componentPadding?: number;
|
|
50
|
+
gridDimensions: {
|
|
51
|
+
rows: number;
|
|
52
|
+
cols: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface ComponentTemplate {
|
|
56
|
+
propertyTemplate?: ComponentPropertyTemplate;
|
|
57
|
+
}
|
|
58
|
+
export interface ComponentPropertyTemplate {
|
|
59
|
+
imageDimension?: SizeDefinition;
|
|
60
|
+
imageLocation?: 'top' | 'right' | 'left' | 'bottom';
|
|
61
|
+
textHorizontalAlignment?: 'center' | 'right' | 'left';
|
|
62
|
+
properties: Array<DocumentPropertyDefinition>;
|
|
63
|
+
}
|
|
64
|
+
export interface DocumentPropertyDefinition {
|
|
65
|
+
style?: StyleDefinition;
|
|
66
|
+
propertyDefinition: TypeProperty;
|
|
67
|
+
slug: string;
|
|
68
|
+
typeRootSlug: string;
|
|
69
|
+
includeLabel?: boolean;
|
|
70
|
+
isHidden?: boolean;
|
|
71
|
+
size?: SizeDefinition;
|
|
72
|
+
}
|
package/lib/interfaces.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Orientation = void 0;
|
|
4
|
-
var Orientation;
|
|
5
|
-
(function (Orientation) {
|
|
6
|
-
Orientation["HORIZONTAL"] = "horizontal";
|
|
7
|
-
Orientation["VERTICAL"] = "vertical";
|
|
8
|
-
})(Orientation = exports.Orientation || (exports.Orientation = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Orientation = void 0;
|
|
4
|
+
var Orientation;
|
|
5
|
+
(function (Orientation) {
|
|
6
|
+
Orientation["HORIZONTAL"] = "horizontal";
|
|
7
|
+
Orientation["VERTICAL"] = "vertical";
|
|
8
|
+
})(Orientation = exports.Orientation || (exports.Orientation = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|