@contrail/document-generation 2.0.22 → 2.0.23
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.
|
@@ -2,9 +2,10 @@ import { DocumentElement, PositionDefinition } from "@contrail/documents";
|
|
|
2
2
|
import { DocumentGenerationOptions, DocumentTemplate, FrameDocumentTemplate } from "./interfaces";
|
|
3
3
|
import { DataGroup } from "@contrail/data-grouping";
|
|
4
4
|
export declare class BoardDocumentGenerator {
|
|
5
|
+
static secondaryGroupPadding: number;
|
|
5
6
|
constructor();
|
|
6
7
|
static generateDocumentElements(options: DocumentGenerationOptions): Array<DocumentElement>;
|
|
7
|
-
static adjustPositionBasedGroupHeaderSpan(currentPosition: PositionDefinition, template: DocumentTemplate, subGroup: DataGroup, totalDepth: number, currentDepth: number): {
|
|
8
|
+
static adjustPositionBasedGroupHeaderSpan(currentPosition: PositionDefinition, template: DocumentTemplate, subGroup: DataGroup, totalDepth: number, currentDepth: number, containsSecondaryGroup: any): {
|
|
8
9
|
x: number;
|
|
9
10
|
y: number;
|
|
10
11
|
};
|
|
@@ -12,10 +13,11 @@ export declare class BoardDocumentGenerator {
|
|
|
12
13
|
x: number;
|
|
13
14
|
y: number;
|
|
14
15
|
};
|
|
15
|
-
static generateBoardGroupHeaders(group: DataGroup, template: DocumentTemplate, startingPosition: PositionDefinition, totalDepth: number, currentDepth: number): any[];
|
|
16
|
-
static generateBoardFrames(group: DataGroup, template: DocumentTemplate, frameTemplate: FrameDocumentTemplate, startingPosition: PositionDefinition, totalDepth: number, currentDepth: number): any[];
|
|
17
|
-
static getGroupSpan(group: DataGroup, totalDepth: any, currentDepth: any): number;
|
|
16
|
+
static generateBoardGroupHeaders(group: DataGroup, template: DocumentTemplate, startingPosition: PositionDefinition, totalDepth: number, currentDepth: number, containsSecondaryGroup?: boolean): any[];
|
|
17
|
+
static generateBoardFrames(group: DataGroup, template: DocumentTemplate, frameTemplate: FrameDocumentTemplate, startingPosition: PositionDefinition, totalDepth: number, currentDepth: number, containsSecondaryGroup: boolean, frameTitle: string): any[];
|
|
18
|
+
static getGroupSpan(group: DataGroup, totalDepth: any, currentDepth: any, stopAtSecondary: any): number;
|
|
18
19
|
private static findDeepestSubgroups;
|
|
19
|
-
static generateFrameGroup(dataGroup: DataGroup, template: DocumentTemplate, frameTemplate: any, position: PositionDefinition): Array<DocumentElement>;
|
|
20
|
-
static generateBoardGroupHeader(dataGroup: DataGroup, template: DocumentTemplate, position: PositionDefinition, span: any): any[];
|
|
20
|
+
static generateFrameGroup(dataGroup: DataGroup, template: DocumentTemplate, frameTemplate: any, position: PositionDefinition, frameTitle: string): Array<DocumentElement>;
|
|
21
|
+
static generateBoardGroupHeader(dataGroup: DataGroup, template: DocumentTemplate, position: PositionDefinition, span: any, containsSecondaryGroup?: boolean): any[];
|
|
22
|
+
static generateSecondaryGroupHeader(dataGroup: any, template: any, position: any, span: any): any[];
|
|
21
23
|
}
|
|
@@ -20,21 +20,36 @@ class BoardDocumentGenerator {
|
|
|
20
20
|
console.log("generateDocumentElements: ", structure.depth, structure.groupingProperties.length);
|
|
21
21
|
let position = options.startingCoordinates || { x: 0, y: 0 };
|
|
22
22
|
const group = structure.rootGroup;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const deepestSubgroups = [];
|
|
24
|
+
this.findDeepestSubgroups(group, deepestSubgroups, structure.depth, 0, true);
|
|
25
|
+
let containsSecondaryGroup = deepestSubgroups.length > 0 && deepestSubgroups[0].isSecondaryGroup;
|
|
26
|
+
elements.push(...this.generateBoardGroupHeaders(group, template, position, structure.depth, 0, containsSecondaryGroup));
|
|
27
|
+
elements.push(...this.generateBoardFrames(group, template, frameTemplate, position, structure.depth, 0, containsSecondaryGroup, null));
|
|
25
28
|
return elements;
|
|
26
29
|
}
|
|
27
|
-
static adjustPositionBasedGroupHeaderSpan(currentPosition, template, subGroup, totalDepth, currentDepth) {
|
|
28
|
-
let frameSetMultiple = this.getGroupSpan(subGroup, totalDepth, currentDepth + 1);
|
|
30
|
+
static adjustPositionBasedGroupHeaderSpan(currentPosition, template, subGroup, totalDepth, currentDepth, containsSecondaryGroup) {
|
|
31
|
+
let frameSetMultiple = this.getGroupSpan(subGroup, totalDepth, currentDepth + 1, !subGroup.isSecondaryGroup);
|
|
29
32
|
let paddingMultiple = 1;
|
|
30
33
|
if (currentDepth < totalDepth) {
|
|
31
34
|
paddingMultiple = frameSetMultiple;
|
|
32
35
|
}
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
let adjustment = 0;
|
|
37
|
+
if (!subGroup.isSecondaryGroup && containsSecondaryGroup) {
|
|
38
|
+
adjustment = this.secondaryGroupPadding * paddingMultiple;
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
if ((template.frameOrientation === interfaces_1.Orientation.HORIZONTAL && !subGroup.isSecondaryGroup) ||
|
|
41
|
+
(template.frameOrientation === interfaces_1.Orientation.VERTICAL && subGroup.isSecondaryGroup)) {
|
|
42
|
+
return {
|
|
43
|
+
x: currentPosition.x,
|
|
44
|
+
y: currentPosition.y + (template.frameSize.height * frameSetMultiple) + (template.framePadding * paddingMultiple) + adjustment
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else if ((template.frameOrientation === interfaces_1.Orientation.HORIZONTAL && subGroup.isSecondaryGroup) ||
|
|
48
|
+
(template.frameOrientation === interfaces_1.Orientation.VERTICAL && !subGroup.isSecondaryGroup)) {
|
|
49
|
+
return {
|
|
50
|
+
x: currentPosition.x + (template.frameSize.width * frameSetMultiple) + (template.framePadding * paddingMultiple) + adjustment,
|
|
51
|
+
y: currentPosition.y
|
|
52
|
+
};
|
|
38
53
|
}
|
|
39
54
|
}
|
|
40
55
|
static adjustPositionBasedOnGroupHeaderSize(currentPosition, template) {
|
|
@@ -46,48 +61,53 @@ class BoardDocumentGenerator {
|
|
|
46
61
|
return { x: currentPosition.x, y: currentPosition.y + groupHeaderDimensions.height + template.framePadding };
|
|
47
62
|
}
|
|
48
63
|
}
|
|
49
|
-
static generateBoardGroupHeaders(group, template, startingPosition, totalDepth, currentDepth) {
|
|
64
|
+
static generateBoardGroupHeaders(group, template, startingPosition, totalDepth, currentDepth, containsSecondaryGroup = false) {
|
|
50
65
|
const elements = [];
|
|
51
66
|
let position = util_1.ObjectUtil.cloneDeep(startingPosition);
|
|
52
67
|
if (currentDepth > 0) {
|
|
53
68
|
let groupHeaderPosition = { x: position.x + template.framePadding, y: position.y + template.framePadding };
|
|
54
|
-
let span = this.getGroupSpan(group, totalDepth, currentDepth);
|
|
55
|
-
elements.push(...this.generateBoardGroupHeader(group, template, groupHeaderPosition, span));
|
|
69
|
+
let span = this.getGroupSpan(group, totalDepth, currentDepth, true);
|
|
70
|
+
elements.push(...this.generateBoardGroupHeader(group, template, groupHeaderPosition, span, containsSecondaryGroup));
|
|
56
71
|
position = this.adjustPositionBasedOnGroupHeaderSize(position, template);
|
|
57
72
|
}
|
|
58
73
|
if (currentDepth < totalDepth) {
|
|
59
74
|
for (let subGroup of group.subGroups) {
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
if (!subGroup.isSecondaryGroup) {
|
|
76
|
+
elements.push(...this.generateBoardGroupHeaders(subGroup, template, position, totalDepth, currentDepth + 1, containsSecondaryGroup));
|
|
77
|
+
position = util_1.ObjectUtil.cloneDeep(this.adjustPositionBasedGroupHeaderSpan(position, template, subGroup, totalDepth, currentDepth, containsSecondaryGroup));
|
|
78
|
+
}
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
81
|
return elements;
|
|
65
82
|
}
|
|
66
|
-
static generateBoardFrames(group, template, frameTemplate, startingPosition, totalDepth, currentDepth) {
|
|
83
|
+
static generateBoardFrames(group, template, frameTemplate, startingPosition, totalDepth, currentDepth, containsSecondaryGroup, frameTitle) {
|
|
84
|
+
if (currentDepth > 0) {
|
|
85
|
+
frameTitle = (!frameTitle) ? group.name : (frameTitle + ' / ' + group.name);
|
|
86
|
+
}
|
|
67
87
|
const elements = [];
|
|
68
88
|
let position = util_1.ObjectUtil.cloneDeep(startingPosition);
|
|
69
|
-
if (currentDepth > 0) {
|
|
89
|
+
if (currentDepth > 0 && !group.isSecondaryGroup) {
|
|
70
90
|
position = this.adjustPositionBasedOnGroupHeaderSize(position, template);
|
|
71
91
|
}
|
|
72
92
|
if (currentDepth === totalDepth) {
|
|
73
|
-
elements.push(...this.generateFrameGroup(group, template, frameTemplate, position));
|
|
93
|
+
elements.push(...this.generateFrameGroup(group, template, frameTemplate, position, frameTitle));
|
|
74
94
|
}
|
|
75
95
|
if (currentDepth < totalDepth) {
|
|
76
96
|
for (let subGroup of group.subGroups) {
|
|
77
|
-
elements.push(...this.generateBoardFrames(subGroup, template, frameTemplate, position, totalDepth, currentDepth + 1));
|
|
78
|
-
position = util_1.ObjectUtil.cloneDeep(this.adjustPositionBasedGroupHeaderSpan(position, template, subGroup, totalDepth, currentDepth));
|
|
97
|
+
elements.push(...this.generateBoardFrames(subGroup, template, frameTemplate, position, totalDepth, currentDepth + 1, containsSecondaryGroup, frameTitle));
|
|
98
|
+
position = util_1.ObjectUtil.cloneDeep(this.adjustPositionBasedGroupHeaderSpan(position, template, subGroup, totalDepth, currentDepth, containsSecondaryGroup));
|
|
79
99
|
}
|
|
80
100
|
}
|
|
81
101
|
return elements;
|
|
82
102
|
}
|
|
83
|
-
static getGroupSpan(group, totalDepth, currentDepth) {
|
|
103
|
+
static getGroupSpan(group, totalDepth, currentDepth, stopAtSecondary) {
|
|
84
104
|
const deepestSubgroups = [];
|
|
85
|
-
this.findDeepestSubgroups(group, deepestSubgroups, totalDepth, currentDepth);
|
|
105
|
+
this.findDeepestSubgroups(group, deepestSubgroups, totalDepth, currentDepth, stopAtSecondary);
|
|
86
106
|
return deepestSubgroups.length;
|
|
87
107
|
}
|
|
88
|
-
static findDeepestSubgroups(group, subgroups, totalDepth, currentDepth) {
|
|
108
|
+
static findDeepestSubgroups(group, subgroups, totalDepth, currentDepth, stopAtSecondary) {
|
|
89
109
|
if (currentDepth === totalDepth && group.subGroups.length > 0) {
|
|
90
|
-
if (group.subGroups.filter(subgroup => subgroup.name === group.subGroups[0].name).length > 1) {
|
|
110
|
+
if (!group.isSecondaryGroup && group.subGroups.filter(subgroup => subgroup.name === group.subGroups[0].name).length > 1) {
|
|
91
111
|
subgroups.push(group.subGroups[0]);
|
|
92
112
|
}
|
|
93
113
|
else {
|
|
@@ -95,14 +115,27 @@ class BoardDocumentGenerator {
|
|
|
95
115
|
}
|
|
96
116
|
}
|
|
97
117
|
for (let i = 0; i < group.subGroups.length; i++) {
|
|
98
|
-
|
|
118
|
+
if (group.subGroups[i].isSecondaryGroup && stopAtSecondary) {
|
|
119
|
+
subgroups.push(group.subGroups[0]);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
this.findDeepestSubgroups(group.subGroups[i], subgroups, totalDepth, currentDepth + 1, stopAtSecondary);
|
|
99
123
|
}
|
|
100
124
|
}
|
|
101
|
-
static generateFrameGroup(dataGroup, template, frameTemplate, position) {
|
|
125
|
+
static generateFrameGroup(dataGroup, template, frameTemplate, position, frameTitle) {
|
|
102
126
|
const elements = [];
|
|
103
127
|
let framePosition = { x: position.x + template.framePadding, y: position.y + template.framePadding };
|
|
128
|
+
if (dataGroup.isSecondaryGroup) {
|
|
129
|
+
elements.push(...this.generateSecondaryGroupHeader(dataGroup, template, util_1.ObjectUtil.cloneDeep(framePosition), dataGroup.subGroups.length));
|
|
130
|
+
if (template.frameOrientation === interfaces_1.Orientation.VERTICAL) {
|
|
131
|
+
framePosition.x = framePosition.x + template.frameGroupHeaderTemplate.size.height + 20;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
framePosition.y = framePosition.y + template.frameGroupHeaderTemplate.size.height + 20;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
104
137
|
for (let group of dataGroup.subGroups) {
|
|
105
|
-
let frame = frame_generator_1.FrameGenerator.generateBoardFrameForDataGroup(group, framePosition, template, frameTemplate);
|
|
138
|
+
let frame = frame_generator_1.FrameGenerator.generateBoardFrameForDataGroup(group, framePosition, template, frameTemplate, frameTitle);
|
|
106
139
|
elements.push(...frame.toDocumentElements());
|
|
107
140
|
if (template.frameOrientation === interfaces_1.Orientation.HORIZONTAL) {
|
|
108
141
|
framePosition.x = framePosition.x + template.frameSize.width + template.framePadding || 10;
|
|
@@ -113,13 +146,41 @@ class BoardDocumentGenerator {
|
|
|
113
146
|
}
|
|
114
147
|
return elements;
|
|
115
148
|
}
|
|
116
|
-
static generateBoardGroupHeader(dataGroup, template, position, span) {
|
|
149
|
+
static generateBoardGroupHeader(dataGroup, template, position, span, containsSecondaryGroup = false) {
|
|
117
150
|
const elements = [];
|
|
118
151
|
const heading = documents_1.DocumentElementFactory.createTextElement("Placeholder", {});
|
|
119
152
|
heading.style = { border: { width: 1, color: "rgba(0,0,0,0)" }, color: "#000000", backgroundColor: template.frameGroupHeaderTemplate.style.backgroundColor || 'black' };
|
|
120
153
|
heading.text = `<p><span style=\"font-size: ${template.frameGroupHeaderTemplate.style.font.size}pt;\"><strong><span style=\"color: ${template.frameGroupHeaderTemplate.style.color};\">${document_util_1.DocumentUtil.sanitizeHTML(dataGroup.name)}</span></strong></span></p>`;
|
|
121
154
|
heading.position = position;
|
|
155
|
+
let adjustment = (containsSecondaryGroup ? this.secondaryGroupPadding : 0);
|
|
122
156
|
if (template.frameOrientation === interfaces_1.Orientation.HORIZONTAL) {
|
|
157
|
+
let sizeDim = (template.frameSize.height + adjustment) * span;
|
|
158
|
+
if (span > 1) {
|
|
159
|
+
sizeDim += (span - 1) * template.framePadding;
|
|
160
|
+
}
|
|
161
|
+
heading.size = { width: sizeDim, height: template.frameGroupHeaderTemplate.size.height };
|
|
162
|
+
heading.rotate = { angle: 270 };
|
|
163
|
+
heading.position.x = heading.position.x - (heading.size.width / 2) + (heading.size.height / 2);
|
|
164
|
+
heading.position.y = heading.position.y + (heading.size.width / 2) - (heading.size.height / 2);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
let sizeDim = (template.frameSize.width + adjustment) * span;
|
|
168
|
+
if (span > 1) {
|
|
169
|
+
sizeDim += (span - 1) * template.framePadding;
|
|
170
|
+
}
|
|
171
|
+
heading.rotate = { angle: 0 };
|
|
172
|
+
heading.size = { width: sizeDim, height: template.frameGroupHeaderTemplate.size.height };
|
|
173
|
+
}
|
|
174
|
+
elements.push(heading);
|
|
175
|
+
return elements;
|
|
176
|
+
}
|
|
177
|
+
static generateSecondaryGroupHeader(dataGroup, template, position, span) {
|
|
178
|
+
const elements = [];
|
|
179
|
+
const heading = documents_1.DocumentElementFactory.createTextElement("Placeholder", {});
|
|
180
|
+
heading.style = { border: { width: 1, color: "rgba(0,0,0,0)" }, color: "#000000", backgroundColor: template.frameGroupHeaderTemplate.style.backgroundColor || 'black' };
|
|
181
|
+
heading.text = `<p><span style=\"font-size: ${template.frameGroupHeaderTemplate.style.font.size}pt;\"><strong><span style=\"color: ${template.frameGroupHeaderTemplate.style.color};\">${document_util_1.DocumentUtil.sanitizeHTML(dataGroup.name)}</span></strong></span></p>`;
|
|
182
|
+
heading.position = position;
|
|
183
|
+
if (template.frameOrientation === interfaces_1.Orientation.VERTICAL) {
|
|
123
184
|
let sizeDim = template.frameSize.height * span;
|
|
124
185
|
if (span > 1) {
|
|
125
186
|
sizeDim += (span - 1) * template.framePadding;
|
|
@@ -142,3 +203,4 @@ class BoardDocumentGenerator {
|
|
|
142
203
|
}
|
|
143
204
|
}
|
|
144
205
|
exports.BoardDocumentGenerator = BoardDocumentGenerator;
|
|
206
|
+
BoardDocumentGenerator.secondaryGroupPadding = 80;
|
|
@@ -3,9 +3,9 @@ import { DataGroup } from "@contrail/data-grouping";
|
|
|
3
3
|
import { DocumentTemplate, FrameDocumentTemplate } from "../interfaces";
|
|
4
4
|
import { DocumentFrame } from "./frame";
|
|
5
5
|
export declare class FrameGenerator {
|
|
6
|
-
static generateBoardFrameForDataGroup(dataGroup: DataGroup, framePosition: PositionDefinition, template: DocumentTemplate, frameTemplate: FrameDocumentTemplate): DocumentFrame;
|
|
7
|
-
static generateFrameContentForGroup(frame: DocumentFrame, dataGroup: DataGroup, template: DocumentTemplate, frameTemplate?: FrameDocumentTemplate): DocumentFrame;
|
|
8
|
-
static generateFrameHeaderForDataGroup(dataGroup: DataGroup, position: PositionDefinition, template: DocumentTemplate, headerSize: SizeDefinition): DocumentElement[];
|
|
6
|
+
static generateBoardFrameForDataGroup(dataGroup: DataGroup, framePosition: PositionDefinition, template: DocumentTemplate, frameTemplate: FrameDocumentTemplate, frameTitle: string): DocumentFrame;
|
|
7
|
+
static generateFrameContentForGroup(frame: DocumentFrame, dataGroup: DataGroup, template: DocumentTemplate, frameTemplate?: FrameDocumentTemplate, frameTitle?: string): DocumentFrame;
|
|
8
|
+
static generateFrameHeaderForDataGroup(dataGroup: DataGroup, position: PositionDefinition, template: DocumentTemplate, headerSize: SizeDefinition, frameTitle?: string): DocumentElement[];
|
|
9
9
|
static generateFrameInfoPanelForDataGroup(dataGroup: DataGroup, position: PositionDefinition, template: DocumentTemplate, panelSize: SizeDefinition): DocumentElement[];
|
|
10
10
|
static generateFrame(options: DocumentElement): DocumentElement;
|
|
11
11
|
static generateFrameTemplateElements(frameTemplate: FrameDocumentTemplate, dataGroup: DataGroup): DocumentElement[];
|
|
@@ -8,7 +8,7 @@ const document_util_1 = require("../util/document-util");
|
|
|
8
8
|
const info_panel_generator_1 = require("../info-panel/info-panel-generator");
|
|
9
9
|
const frame_1 = require("./frame");
|
|
10
10
|
class FrameGenerator {
|
|
11
|
-
static generateBoardFrameForDataGroup(dataGroup, framePosition, template, frameTemplate) {
|
|
11
|
+
static generateBoardFrameForDataGroup(dataGroup, framePosition, template, frameTemplate, frameTitle) {
|
|
12
12
|
let style = { backgroundColor: "#fff", border: { width: 1, color: "#616161" } };
|
|
13
13
|
let frameSize = template.frameSize;
|
|
14
14
|
let clipContent = false;
|
|
@@ -22,10 +22,10 @@ class FrameGenerator {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
let frame = new frame_1.BoardFrame(dataGroup.name, util_1.ObjectUtil.cloneDeep(framePosition), frameSize, style, clipContent);
|
|
25
|
-
frame = this.generateFrameContentForGroup(frame, dataGroup, template, frameTemplate);
|
|
25
|
+
frame = this.generateFrameContentForGroup(frame, dataGroup, template, frameTemplate, frameTitle);
|
|
26
26
|
return frame;
|
|
27
27
|
}
|
|
28
|
-
static generateFrameContentForGroup(frame, dataGroup, template, frameTemplate = null) {
|
|
28
|
+
static generateFrameContentForGroup(frame, dataGroup, template, frameTemplate = null, frameTitle = null) {
|
|
29
29
|
var _a, _b;
|
|
30
30
|
const FRAME_PADDING = 20;
|
|
31
31
|
const headerPosition = {
|
|
@@ -48,7 +48,7 @@ class FrameGenerator {
|
|
|
48
48
|
if (template.frameHeaderTemplate) {
|
|
49
49
|
hasHeader = true;
|
|
50
50
|
frameHeaderDimensions = { height: 50, width: template.frameSize.width - 50 };
|
|
51
|
-
const headerElements = this.generateFrameHeaderForDataGroup(dataGroup, headerPosition, template, frameHeaderDimensions);
|
|
51
|
+
const headerElements = this.generateFrameHeaderForDataGroup(dataGroup, headerPosition, template, frameHeaderDimensions, frameTitle);
|
|
52
52
|
frame.addDocumentElements(headerElements);
|
|
53
53
|
}
|
|
54
54
|
if (template.frameInfoPanelTemplate) {
|
|
@@ -85,10 +85,10 @@ class FrameGenerator {
|
|
|
85
85
|
frame.addDocumentElements(gridElements);
|
|
86
86
|
return frame;
|
|
87
87
|
}
|
|
88
|
-
static generateFrameHeaderForDataGroup(dataGroup, position, template, headerSize) {
|
|
88
|
+
static generateFrameHeaderForDataGroup(dataGroup, position, template, headerSize, frameTitle = null) {
|
|
89
89
|
const heading = documents_1.DocumentElementFactory.createTextElement(dataGroup.name, template.frameHeaderTemplate);
|
|
90
90
|
heading.style = { border: { width: 1, color: "rgba(0,0,0,0)" }, color: "#000000", backgroundColor: template.frameHeaderTemplate.style.backgroundColor || 'black' };
|
|
91
|
-
heading.text = `<p><span style=\"font-size: ${template.frameHeaderTemplate.style.font.size}pt;\"><strong><span style=\"color: ${template.frameHeaderTemplate.style.color};\">${document_util_1.DocumentUtil.sanitizeHTML(dataGroup.name)}</span></strong></span></p>`;
|
|
91
|
+
heading.text = `<p><span style=\"font-size: ${template.frameHeaderTemplate.style.font.size}pt;\"><strong><span style=\"color: ${template.frameHeaderTemplate.style.color};\">${document_util_1.DocumentUtil.sanitizeHTML(frameTitle || dataGroup.name)}</span></strong></span></p>`;
|
|
92
92
|
heading.size = util_1.ObjectUtil.cloneDeep(headerSize);
|
|
93
93
|
heading.position = util_1.ObjectUtil.cloneDeep(position);
|
|
94
94
|
return [heading];
|
|
@@ -22,14 +22,21 @@ class ShowcaseFrameGenerator {
|
|
|
22
22
|
static getFrameGroups(groupStructure) {
|
|
23
23
|
return this.getLeafGroupsFromGroups(groupStructure.rootGroup.subGroups, groupStructure.depth, 0);
|
|
24
24
|
}
|
|
25
|
-
static getLeafGroupsFromGroups(groups, totalDepth, currentDepth) {
|
|
25
|
+
static getLeafGroupsFromGroups(groups, totalDepth, currentDepth, groupName = null) {
|
|
26
26
|
const leafGroups = [];
|
|
27
27
|
for (let group of groups) {
|
|
28
|
+
if (currentDepth === 0) {
|
|
29
|
+
groupName = null;
|
|
30
|
+
}
|
|
28
31
|
if (currentDepth === totalDepth) {
|
|
32
|
+
group.name = (!groupName) ? group.name : (groupName + ' / ' + group.name);
|
|
33
|
+
;
|
|
29
34
|
leafGroups.push(group);
|
|
30
35
|
}
|
|
31
36
|
else {
|
|
32
|
-
|
|
37
|
+
if (currentDepth < totalDepth - 1)
|
|
38
|
+
groupName = (!groupName) ? group.name : (groupName + ' / ' + group.name);
|
|
39
|
+
leafGroups.push(...this.getLeafGroupsFromGroups(group.subGroups, totalDepth, currentDepth + 1, groupName));
|
|
33
40
|
}
|
|
34
41
|
}
|
|
35
42
|
return leafGroups;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/document-generation",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.23",
|
|
4
4
|
"description": "Utilities for automatic generation of documents.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"testEnvironment": "node"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@contrail/data-grouping": "^1.0.
|
|
45
|
+
"@contrail/data-grouping": "^1.0.24",
|
|
46
46
|
"@contrail/documents": "^1.0.68",
|
|
47
47
|
"@contrail/types": "^3.0.27",
|
|
48
48
|
"@contrail/util": "^1.0.27"
|