@contrail/document-generation 2.0.43 → 2.0.45
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 -227
- 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 -135
- package/lib/frames/frame.d.ts +16 -16
- package/lib/frames/frame.js +67 -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 -52
- 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 +71 -71
- package/lib/util/document-property-util.d.ts +9 -9
- package/lib/util/document-property-util.js +104 -101
- package/lib/util/document-text-element-util.d.ts +10 -10
- package/lib/util/document-text-element-util.js +124 -124
- 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 +3 -3
- package/testdocument.json +25972 -25972
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PositionDefinition } from '@contrail/documents';
|
|
2
|
-
export declare class DocumentUtil {
|
|
3
|
-
static getRelativePosition(position1: PositionDefinition, position2: PositionDefinition): {
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
};
|
|
7
|
-
static sanitizeHTML(text: string): string;
|
|
8
|
-
}
|
|
1
|
+
import { PositionDefinition } from '@contrail/documents';
|
|
2
|
+
export declare class DocumentUtil {
|
|
3
|
+
static getRelativePosition(position1: PositionDefinition, position2: PositionDefinition): {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
};
|
|
7
|
+
static sanitizeHTML(text: string): string;
|
|
8
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentUtil = void 0;
|
|
4
|
-
class DocumentUtil {
|
|
5
|
-
static getRelativePosition(position1, position2) {
|
|
6
|
-
const relativePosition = {
|
|
7
|
-
x: position2.x - position1.x,
|
|
8
|
-
y: position2.y - position1.y,
|
|
9
|
-
};
|
|
10
|
-
return relativePosition;
|
|
11
|
-
}
|
|
12
|
-
static sanitizeHTML(text) {
|
|
13
|
-
if (text === undefined || text === null) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
if (typeof text !== 'string') {
|
|
17
|
-
return text;
|
|
18
|
-
}
|
|
19
|
-
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.DocumentUtil = DocumentUtil;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentUtil = void 0;
|
|
4
|
+
class DocumentUtil {
|
|
5
|
+
static getRelativePosition(position1, position2) {
|
|
6
|
+
const relativePosition = {
|
|
7
|
+
x: position2.x - position1.x,
|
|
8
|
+
y: position2.y - position1.y,
|
|
9
|
+
};
|
|
10
|
+
return relativePosition;
|
|
11
|
+
}
|
|
12
|
+
static sanitizeHTML(text) {
|
|
13
|
+
if (text === undefined || text === null) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
if (typeof text !== 'string') {
|
|
17
|
+
return text;
|
|
18
|
+
}
|
|
19
|
+
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.DocumentUtil = DocumentUtil;
|
package/lib/util/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './document-text-element-util';
|
|
2
|
-
export * from './document-property-util';
|
|
1
|
+
export * from './document-text-element-util';
|
|
2
|
+
export * from './document-property-util';
|
package/lib/util/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./document-text-element-util"), exports);
|
|
18
|
-
__exportStar(require("./document-property-util"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./document-text-element-util"), exports);
|
|
18
|
+
__exportStar(require("./document-property-util"), exports);
|
package/lib/util/text-util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentPropertyDefinition } from '../interfaces';
|
|
2
|
-
export declare class TextUtil {
|
|
3
|
-
static getHeightByTextWidth(text: string, property: DocumentPropertyDefinition, width: number): number;
|
|
4
|
-
}
|
|
1
|
+
import { DocumentPropertyDefinition } from '../interfaces';
|
|
2
|
+
export declare class TextUtil {
|
|
3
|
+
static getHeightByTextWidth(text: string, property: DocumentPropertyDefinition, width: number): number;
|
|
4
|
+
}
|
package/lib/util/text-util.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextUtil = void 0;
|
|
4
|
-
class TextUtil {
|
|
5
|
-
static getHeightByTextWidth(text, property, width) {
|
|
6
|
-
var _a, _b, _c, _d, _e;
|
|
7
|
-
let height = 0;
|
|
8
|
-
let div = document.createElement('DIV');
|
|
9
|
-
div.id = '__textMeasure';
|
|
10
|
-
div.innerHTML = (property.includeLabel ? ((_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label) + ': ' : '') + text;
|
|
11
|
-
div.style.position = 'absolute';
|
|
12
|
-
div.style.top = '-500px';
|
|
13
|
-
div.style.left = '0';
|
|
14
|
-
div.style.width = width + 'px';
|
|
15
|
-
div.style.lineHeight = 'normal';
|
|
16
|
-
div.style.overflowWrap = 'break-word';
|
|
17
|
-
div.style.fontFamily = ((_c = (_b = property.style) === null || _b === void 0 ? void 0 : _b.font) === null || _c === void 0 ? void 0 : _c.family) || 'Roboto';
|
|
18
|
-
div.style.fontWeight = property.style.font.weight ? 'bold' : 'normal';
|
|
19
|
-
div.style.fontSize = (((_e = (_d = property.style) === null || _d === void 0 ? void 0 : _d.font) === null || _e === void 0 ? void 0 : _e.size) || 12) + 'pt';
|
|
20
|
-
div.style.padding = '11px';
|
|
21
|
-
document.body.appendChild(div);
|
|
22
|
-
height = div.offsetHeight;
|
|
23
|
-
document.body.removeChild(div);
|
|
24
|
-
div = null;
|
|
25
|
-
return height;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.TextUtil = TextUtil;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextUtil = void 0;
|
|
4
|
+
class TextUtil {
|
|
5
|
+
static getHeightByTextWidth(text, property, width) {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
let height = 0;
|
|
8
|
+
let div = document.createElement('DIV');
|
|
9
|
+
div.id = '__textMeasure';
|
|
10
|
+
div.innerHTML = (property.includeLabel ? ((_a = property.propertyDefinition) === null || _a === void 0 ? void 0 : _a.label) + ': ' : '') + text;
|
|
11
|
+
div.style.position = 'absolute';
|
|
12
|
+
div.style.top = '-500px';
|
|
13
|
+
div.style.left = '0';
|
|
14
|
+
div.style.width = width + 'px';
|
|
15
|
+
div.style.lineHeight = 'normal';
|
|
16
|
+
div.style.overflowWrap = 'break-word';
|
|
17
|
+
div.style.fontFamily = ((_c = (_b = property.style) === null || _b === void 0 ? void 0 : _b.font) === null || _c === void 0 ? void 0 : _c.family) || 'Roboto';
|
|
18
|
+
div.style.fontWeight = property.style.font.weight ? 'bold' : 'normal';
|
|
19
|
+
div.style.fontSize = (((_e = (_d = property.style) === null || _d === void 0 ? void 0 : _d.font) === null || _e === void 0 ? void 0 : _e.size) || 12) + 'pt';
|
|
20
|
+
div.style.padding = '11px';
|
|
21
|
+
document.body.appendChild(div);
|
|
22
|
+
height = div.offsetHeight;
|
|
23
|
+
document.body.removeChild(div);
|
|
24
|
+
div = null;
|
|
25
|
+
return height;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.TextUtil = TextUtil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/document-generation",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.45",
|
|
4
4
|
"description": "Utilities for automatic generation of documents.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@contrail/data-grouping": "^1.0.24",
|
|
46
|
-
"@contrail/documents": "^1.0.
|
|
46
|
+
"@contrail/documents": "^1.0.103",
|
|
47
47
|
"@contrail/types": "^3.0.27",
|
|
48
|
-
"@contrail/util": "^1.0.
|
|
48
|
+
"@contrail/util": "^1.0.62"
|
|
49
49
|
}
|
|
50
50
|
}
|