@pdfme/schemas 3.1.5-dev.9 → 3.2.0-dev.1
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/dist/cjs/__tests__/{renderUtils.test.js → utils.test.js} +38 -12
- package/dist/cjs/__tests__/utils.test.js.map +1 -0
- package/dist/cjs/src/barcodes/constants.js +2 -1
- package/dist/cjs/src/barcodes/constants.js.map +1 -1
- package/dist/cjs/src/barcodes/helper.js +1 -2
- package/dist/cjs/src/barcodes/helper.js.map +1 -1
- package/dist/cjs/src/barcodes/index.js +2 -2
- package/dist/cjs/src/barcodes/index.js.map +1 -1
- package/dist/cjs/src/barcodes/pdfRender.js +3 -3
- package/dist/cjs/src/barcodes/pdfRender.js.map +1 -1
- package/dist/cjs/src/barcodes/propPanel.js +19 -2
- package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
- package/dist/cjs/src/barcodes/uiRender.js +9 -32
- package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
- package/dist/cjs/src/graphics/helper.js +115 -0
- package/dist/cjs/src/graphics/helper.js.map +1 -0
- package/dist/cjs/src/graphics/image.js +179 -0
- package/dist/cjs/src/graphics/image.js.map +1 -0
- package/dist/cjs/src/graphics/svg.js +96 -0
- package/dist/cjs/src/graphics/svg.js.map +1 -0
- package/dist/cjs/src/index.js +42 -11
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/shapes/line.js +57 -0
- package/dist/cjs/src/shapes/line.js.map +1 -0
- package/dist/cjs/src/shapes/rectAndEllipse.js +100 -0
- package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -0
- package/dist/cjs/src/text/helper.js.map +1 -1
- package/dist/cjs/src/text/index.js +16 -2
- package/dist/cjs/src/text/index.js.map +1 -1
- package/dist/cjs/src/text/pdfRender.js +5 -5
- package/dist/cjs/src/text/pdfRender.js.map +1 -1
- package/dist/cjs/src/text/uiRender.js +3 -3
- package/dist/cjs/src/text/uiRender.js.map +1 -1
- package/dist/cjs/src/{renderUtils.js → utils.js} +55 -7
- package/dist/cjs/src/utils.js.map +1 -0
- package/dist/esm/__tests__/{renderUtils.test.js → utils.test.js} +34 -8
- package/dist/esm/__tests__/utils.test.js.map +1 -0
- package/dist/esm/src/barcodes/constants.js +1 -0
- package/dist/esm/src/barcodes/constants.js.map +1 -1
- package/dist/esm/src/barcodes/helper.js +2 -3
- package/dist/esm/src/barcodes/helper.js.map +1 -1
- package/dist/esm/src/barcodes/index.js +2 -2
- package/dist/esm/src/barcodes/index.js.map +1 -1
- package/dist/esm/src/barcodes/pdfRender.js +2 -2
- package/dist/esm/src/barcodes/pdfRender.js.map +1 -1
- package/dist/esm/src/barcodes/propPanel.js +20 -3
- package/dist/esm/src/barcodes/propPanel.js.map +1 -1
- package/dist/esm/src/barcodes/uiRender.js +9 -32
- package/dist/esm/src/barcodes/uiRender.js.map +1 -1
- package/dist/esm/src/graphics/helper.js +111 -0
- package/dist/esm/src/graphics/helper.js.map +1 -0
- package/dist/esm/src/graphics/image.js +176 -0
- package/dist/esm/src/graphics/image.js.map +1 -0
- package/dist/esm/src/graphics/svg.js +93 -0
- package/dist/esm/src/graphics/svg.js.map +1 -0
- package/dist/esm/src/index.js +7 -5
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/shapes/line.js +55 -0
- package/dist/esm/src/shapes/line.js.map +1 -0
- package/dist/esm/src/shapes/rectAndEllipse.js +97 -0
- package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -0
- package/dist/esm/src/text/helper.js.map +1 -1
- package/dist/esm/src/text/index.js +15 -2
- package/dist/esm/src/text/index.js.map +1 -1
- package/dist/esm/src/text/pdfRender.js +1 -1
- package/dist/esm/src/text/pdfRender.js.map +1 -1
- package/dist/esm/src/text/uiRender.js +2 -2
- package/dist/esm/src/text/uiRender.js.map +1 -1
- package/dist/esm/src/{renderUtils.js → utils.js} +52 -6
- package/dist/esm/src/utils.js.map +1 -0
- package/dist/types/src/barcodes/constants.d.ts +1 -0
- package/dist/types/src/barcodes/helper.d.ts +1 -0
- package/dist/types/src/barcodes/index.d.ts +2 -2
- package/dist/types/src/barcodes/types.d.ts +1 -0
- package/dist/types/src/graphics/helper.d.ts +5 -0
- package/dist/types/src/graphics/image.d.ts +7 -0
- package/dist/types/src/graphics/svg.d.ts +6 -0
- package/dist/types/src/index.d.ts +7 -5
- package/dist/types/src/shapes/line.d.ts +6 -0
- package/dist/types/src/shapes/rectAndEllipse.d.ts +144 -0
- package/dist/types/src/text/index.d.ts +3 -2
- package/dist/types/src/text/pdfRender.d.ts +1 -1
- package/dist/types/src/{renderUtils.d.ts → utils.d.ts} +3 -1
- package/package.json +4 -3
- package/src/barcodes/constants.ts +2 -0
- package/src/barcodes/helper.ts +12 -3
- package/src/barcodes/index.ts +2 -2
- package/src/barcodes/pdfRender.ts +2 -2
- package/src/barcodes/propPanel.ts +25 -3
- package/src/barcodes/types.ts +1 -0
- package/src/barcodes/uiRender.ts +9 -36
- package/src/graphics/helper.ts +147 -0
- package/src/graphics/image.ts +207 -0
- package/src/graphics/svg.ts +98 -0
- package/src/index.ts +21 -5
- package/src/shapes/line.ts +67 -0
- package/src/shapes/rectAndEllipse.ts +110 -0
- package/src/text/helper.ts +0 -1
- package/src/text/index.ts +17 -2
- package/src/text/pdfRender.ts +2 -2
- package/src/text/uiRender.ts +2 -2
- package/src/{renderUtils.ts → utils.ts} +61 -5
- package/dist/cjs/__tests__/renderUtils.test.js.map +0 -1
- package/dist/cjs/src/image/index.js +0 -8
- package/dist/cjs/src/image/index.js.map +0 -1
- package/dist/cjs/src/image/pdfRender.js +0 -22
- package/dist/cjs/src/image/pdfRender.js.map +0 -1
- package/dist/cjs/src/image/propPanel.js +0 -19
- package/dist/cjs/src/image/propPanel.js.map +0 -1
- package/dist/cjs/src/image/types.js +0 -3
- package/dist/cjs/src/image/types.js.map +0 -1
- package/dist/cjs/src/image/uiRender.js +0 -111
- package/dist/cjs/src/image/uiRender.js.map +0 -1
- package/dist/cjs/src/line/constants.js +0 -5
- package/dist/cjs/src/line/constants.js.map +0 -1
- package/dist/cjs/src/line/index.js +0 -8
- package/dist/cjs/src/line/index.js.map +0 -1
- package/dist/cjs/src/line/pdfRender.js +0 -20
- package/dist/cjs/src/line/pdfRender.js.map +0 -1
- package/dist/cjs/src/line/propPanel.js +0 -35
- package/dist/cjs/src/line/propPanel.js.map +0 -1
- package/dist/cjs/src/line/types.js +0 -3
- package/dist/cjs/src/line/types.js.map +0 -1
- package/dist/cjs/src/line/uiRender.js +0 -14
- package/dist/cjs/src/line/uiRender.js.map +0 -1
- package/dist/cjs/src/renderUtils.js.map +0 -1
- package/dist/esm/__tests__/renderUtils.test.js.map +0 -1
- package/dist/esm/src/image/index.js +0 -6
- package/dist/esm/src/image/index.js.map +0 -1
- package/dist/esm/src/image/pdfRender.js +0 -18
- package/dist/esm/src/image/pdfRender.js.map +0 -1
- package/dist/esm/src/image/propPanel.js +0 -16
- package/dist/esm/src/image/propPanel.js.map +0 -1
- package/dist/esm/src/image/types.js +0 -2
- package/dist/esm/src/image/types.js.map +0 -1
- package/dist/esm/src/image/uiRender.js +0 -107
- package/dist/esm/src/image/uiRender.js.map +0 -1
- package/dist/esm/src/line/constants.js +0 -2
- package/dist/esm/src/line/constants.js.map +0 -1
- package/dist/esm/src/line/index.js +0 -6
- package/dist/esm/src/line/index.js.map +0 -1
- package/dist/esm/src/line/pdfRender.js +0 -16
- package/dist/esm/src/line/pdfRender.js.map +0 -1
- package/dist/esm/src/line/propPanel.js +0 -32
- package/dist/esm/src/line/propPanel.js.map +0 -1
- package/dist/esm/src/line/types.js +0 -2
- package/dist/esm/src/line/types.js.map +0 -1
- package/dist/esm/src/line/uiRender.js +0 -10
- package/dist/esm/src/line/uiRender.js.map +0 -1
- package/dist/esm/src/renderUtils.js.map +0 -1
- package/dist/types/src/image/index.d.ts +0 -4
- package/dist/types/src/image/pdfRender.d.ts +0 -3
- package/dist/types/src/image/propPanel.d.ts +0 -3
- package/dist/types/src/image/types.d.ts +0 -3
- package/dist/types/src/image/uiRender.d.ts +0 -3
- package/dist/types/src/line/constants.d.ts +0 -1
- package/dist/types/src/line/index.d.ts +0 -4
- package/dist/types/src/line/pdfRender.d.ts +0 -3
- package/dist/types/src/line/propPanel.d.ts +0 -3
- package/dist/types/src/line/types.d.ts +0 -4
- package/dist/types/src/line/uiRender.d.ts +0 -3
- package/src/image/index.ts +0 -8
- package/src/image/pdfRender.ts +0 -29
- package/src/image/propPanel.ts +0 -19
- package/src/image/types.ts +0 -3
- package/src/image/uiRender.ts +0 -121
- package/src/line/constants.ts +0 -1
- package/src/line/index.ts +0 -8
- package/src/line/pdfRender.ts +0 -24
- package/src/line/propPanel.ts +0 -34
- package/src/line/types.ts +0 -5
- package/src/line/uiRender.ts +0 -12
- /package/dist/types/__tests__/{renderUtils.test.d.ts → utils.test.d.ts} +0 -0
@@ -0,0 +1,179 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.readOnlyImage = void 0;
|
4
|
+
const buffer_1 = require("buffer");
|
5
|
+
const utils_js_1 = require("../utils.js");
|
6
|
+
const constants_js_1 = require("../constants.js");
|
7
|
+
const helper_js_1 = require("./helper.js");
|
8
|
+
const px2mm = (px) => {
|
9
|
+
// http://www.endmemo.com/sconvert/millimeterpixel.php
|
10
|
+
const ratio = 0.26458333333333;
|
11
|
+
return parseFloat(String(px)) * ratio;
|
12
|
+
};
|
13
|
+
const getCacheKey = (schema, input) => `${schema.type}${input}`;
|
14
|
+
const fullSize = { width: '100%', height: '100%' };
|
15
|
+
const defaultValue = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAAGQBAMAAAA+V+RCAAAAAXNSR0IArs4c6QAAABtQTFRFAAAAR3BMAAAAAAAAAAAAAAAAAAAAAAAAAAAAqmQqwQAAAAh0Uk5TDQAvVYGtxusE1uR9AAAKg0lEQVR42tTbwU7bQBDG8TWoPeOBPoBbdbhiVMGV0Kr0GCh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5eWhMeLpoibvkdJmemBejSPVeIn6V4ssr0nXo7QzNCxp+th4KVKEQXkmRvLQcaxcANKPXTO+eICkgWvIW0JkEDsWyB4hkgbuBRKRQexcIBFJA/cCichg5o5x7VUg6SCzTMN0YYikiSvIL1SNDGLnRg0i6ch2g2PeNUTSmQvIBwIknAtZLXgWiEgKY+sdckTfQ9J+Yte4eUOIhHJkQ4mJABGJSvvGeiT1F7aMyzH9KJL2biyN6zdUjUTlr6l54vZDj+qQWPrXmWEi5KUEJBa//26RGRMuP449+jEkprV8TLPGgenjx8uomkj0N73+g6V/XjknAAAAAElFTkSuQmCC';
|
16
|
+
const imageSchema = {
|
17
|
+
pdf: async (arg) => {
|
18
|
+
const { value, schema, pdfDoc, page, _cache } = arg;
|
19
|
+
if (!value || !value.startsWith('data:image/'))
|
20
|
+
return;
|
21
|
+
const inputImageCacheKey = getCacheKey(schema, value);
|
22
|
+
let image = _cache.get(inputImageCacheKey);
|
23
|
+
if (!image) {
|
24
|
+
const isPng = value.startsWith('data:image/png;');
|
25
|
+
image = await (isPng ? pdfDoc.embedPng(value) : pdfDoc.embedJpg(value));
|
26
|
+
_cache.set(inputImageCacheKey, image);
|
27
|
+
}
|
28
|
+
const _schema = { ...schema, position: { ...schema.position } };
|
29
|
+
const dataUriPrefix = ';base64,';
|
30
|
+
const idx = value.indexOf(dataUriPrefix);
|
31
|
+
const imgBase64 = value.substring(idx + dataUriPrefix.length, value.length);
|
32
|
+
const dimension = (0, helper_js_1.imageSize)(buffer_1.Buffer.from(imgBase64, 'base64'));
|
33
|
+
const imageWidth = px2mm(dimension.width);
|
34
|
+
const imageHeight = px2mm(dimension.height);
|
35
|
+
const boxWidth = _schema.width;
|
36
|
+
const boxHeight = _schema.height;
|
37
|
+
const imageRatio = imageWidth / imageHeight;
|
38
|
+
const boxRatio = boxWidth / boxHeight;
|
39
|
+
if (imageRatio > boxRatio) {
|
40
|
+
_schema.width = boxWidth;
|
41
|
+
_schema.height = boxWidth / imageRatio;
|
42
|
+
_schema.position.y += (boxHeight - _schema.height) / 2;
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
_schema.width = boxHeight * imageRatio;
|
46
|
+
_schema.height = boxHeight;
|
47
|
+
_schema.position.x += (boxWidth - _schema.width) / 2;
|
48
|
+
}
|
49
|
+
const pageHeight = page.getHeight();
|
50
|
+
const lProps = (0, utils_js_1.convertForPdfLayoutProps)({ schema: _schema, pageHeight });
|
51
|
+
const { width, height, rotate, position, opacity } = lProps;
|
52
|
+
const { x, y } = position;
|
53
|
+
page.drawImage(image, { x, y, rotate, width, height, opacity });
|
54
|
+
},
|
55
|
+
ui: (arg) => {
|
56
|
+
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, theme, schema, } = arg;
|
57
|
+
const editable = (0, utils_js_1.isEditable)(mode, schema);
|
58
|
+
const isDefault = value === defaultValue;
|
59
|
+
const container = document.createElement('div');
|
60
|
+
const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
|
61
|
+
const containerStyle = {
|
62
|
+
...fullSize,
|
63
|
+
backgroundImage: value ? 'none' : backgroundStyle,
|
64
|
+
backgroundSize: `contain`,
|
65
|
+
backgroundRepeat: 'no-repeat',
|
66
|
+
backgroundPosition: 'center',
|
67
|
+
};
|
68
|
+
Object.assign(container.style, containerStyle);
|
69
|
+
container.addEventListener('click', (e) => {
|
70
|
+
if (editable) {
|
71
|
+
e.stopPropagation();
|
72
|
+
}
|
73
|
+
});
|
74
|
+
rootElement.appendChild(container);
|
75
|
+
// image tag
|
76
|
+
if (value) {
|
77
|
+
const img = document.createElement('img');
|
78
|
+
const imgStyle = {
|
79
|
+
height: '100%',
|
80
|
+
width: '100%',
|
81
|
+
borderRadius: 0,
|
82
|
+
objectFit: 'contain',
|
83
|
+
};
|
84
|
+
Object.assign(img.style, imgStyle);
|
85
|
+
img.src = value;
|
86
|
+
container.appendChild(img);
|
87
|
+
}
|
88
|
+
// remove button
|
89
|
+
if (value && !isDefault && editable) {
|
90
|
+
const button = document.createElement('button');
|
91
|
+
button.textContent = 'x';
|
92
|
+
const buttonStyle = {
|
93
|
+
position: 'absolute',
|
94
|
+
top: 0,
|
95
|
+
left: 0,
|
96
|
+
zIndex: 1,
|
97
|
+
display: 'flex',
|
98
|
+
justifyContent: 'center',
|
99
|
+
alignItems: 'center',
|
100
|
+
color: '#333',
|
101
|
+
background: '#f2f2f2',
|
102
|
+
borderRadius: '2px',
|
103
|
+
border: '1px solid #767676',
|
104
|
+
cursor: 'pointer',
|
105
|
+
height: '24px',
|
106
|
+
width: '24px',
|
107
|
+
};
|
108
|
+
Object.assign(button.style, buttonStyle);
|
109
|
+
button.addEventListener('click', () => {
|
110
|
+
onChange && onChange('');
|
111
|
+
});
|
112
|
+
container.appendChild(button);
|
113
|
+
}
|
114
|
+
// file input
|
115
|
+
if ((!value || isDefault) && editable) {
|
116
|
+
const label = document.createElement('label');
|
117
|
+
const labelStyle = {
|
118
|
+
...fullSize,
|
119
|
+
display: editable ? 'flex' : 'none',
|
120
|
+
position: 'absolute',
|
121
|
+
top: 0,
|
122
|
+
backgroundColor: editable || value ? (0, utils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30) : 'none',
|
123
|
+
cursor: 'pointer',
|
124
|
+
};
|
125
|
+
Object.assign(label.style, labelStyle);
|
126
|
+
container.appendChild(label);
|
127
|
+
const input = document.createElement('input');
|
128
|
+
const inputStyle = {
|
129
|
+
...fullSize,
|
130
|
+
position: 'absolute',
|
131
|
+
top: '50%',
|
132
|
+
left: '50%',
|
133
|
+
width: '180px',
|
134
|
+
height: '30px',
|
135
|
+
marginLeft: '-90px',
|
136
|
+
marginTop: '-15px',
|
137
|
+
};
|
138
|
+
Object.assign(input.style, inputStyle);
|
139
|
+
input.tabIndex = tabIndex || 0;
|
140
|
+
input.type = 'file';
|
141
|
+
input.accept = 'image/jpeg, image/png';
|
142
|
+
input.addEventListener('change', (event) => {
|
143
|
+
const changeEvent = event;
|
144
|
+
(0, utils_js_1.readFile)(changeEvent.target.files).then((result) => onChange && onChange(result));
|
145
|
+
});
|
146
|
+
input.addEventListener('blur', () => stopEditing && stopEditing());
|
147
|
+
label.appendChild(input);
|
148
|
+
}
|
149
|
+
},
|
150
|
+
propPanel: {
|
151
|
+
schema: {},
|
152
|
+
defaultValue,
|
153
|
+
defaultSchema: {
|
154
|
+
type: 'image',
|
155
|
+
position: { x: 0, y: 0 },
|
156
|
+
width: 40,
|
157
|
+
height: 40,
|
158
|
+
// If the value of "rotate" is set to undefined or not set at all, rotation will be disabled in the UI.
|
159
|
+
// Check this document: https://pdfme.com//docs/custom-schemas#learning-how-to-create-from-pdfmeschemas-code
|
160
|
+
rotate: 0,
|
161
|
+
opacity: constants_js_1.DEFAULT_OPACITY,
|
162
|
+
},
|
163
|
+
},
|
164
|
+
};
|
165
|
+
exports.default = imageSchema;
|
166
|
+
exports.readOnlyImage = {
|
167
|
+
pdf: imageSchema.pdf,
|
168
|
+
ui: imageSchema.ui,
|
169
|
+
propPanel: {
|
170
|
+
...imageSchema.propPanel,
|
171
|
+
defaultSchema: {
|
172
|
+
...imageSchema.propPanel.defaultSchema,
|
173
|
+
type: 'readOnlyImage',
|
174
|
+
readOnly: true,
|
175
|
+
readOnlyValue: defaultValue,
|
176
|
+
},
|
177
|
+
},
|
178
|
+
};
|
179
|
+
//# sourceMappingURL=image.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/graphics/image.ts"],"names":[],"mappings":";;;AAKA,mCAAgC;AAEhC,0CAA4F;AAC5F,kDAAkD;AAClD,2CAAwC;AAExC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAU,EAAE;IACnC,sDAAsD;IACtD,MAAM,KAAK,GAAG,gBAAgB,CAAC;IAC/B,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAA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AAC,CAAC,CAAC;YAC9F,CAAC,CAAC,CAAC;YACH,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,IAAI,WAAW,EAAE,CAAC,CAAC;YACnE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC1B;IACH,CAAC;IACD,SAAS,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY;QACZ,aAAa,EAAE;YACb,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;YACxB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,uGAAuG;YACvG,4GAA4G;YAC5G,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;CACF,CAAC;AAEF,kBAAe,WAAW,CAAC;AAEd,QAAA,aAAa,GAAwB;IAChD,GAAG,EAAE,WAAW,CAAC,GAAG;IACpB,EAAE,EAAE,WAAW,CAAC,EAAE;IAClB,SAAS,EAAE;QACT,GAAG,WAAW,CAAC,SAAS;QACxB,aAAa,EAAE;YACb,GAAG,WAAW,CAAC,SAAS,CAAC,aAAa;YACtC,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,YAAY;SAC5B;KACF;CACF,CAAC"}
|
@@ -0,0 +1,96 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.readOnlySvg = void 0;
|
4
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
5
|
+
const utils_js_1 = require("../utils.js");
|
6
|
+
const isValidSVG = (svgString) => fast_xml_parser_1.XMLValidator.validate(svgString) === true;
|
7
|
+
const defaultValue = `<svg viewBox="0 0 488 600" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
8
|
+
<g transform="matrix(1,0,0,1,-56,0)" fill="#000000" stroke="none">
|
9
|
+
<path d="M228.667,0L56,172.667L56.267,345.334L56.667,518L59.733,527.334C65.867,545.467 72.933,557.067 86,570.134C96.133,580.4 100,583.2 110.667,588.4C134.533,600.134 120,599.334 300,599.334C480,599.334 465.467,600.134 489.334,588.4C500,583.2 503.867,580.4 514,570.134C527.334,556.8 534.534,544.8 540.267,526.667L543.334,516.667L543.334,83.333L540.267,73.333C534.534,55.2 527.334,43.2 514,29.867C503.867,19.6 500,16.8 489.334,11.6C465.734,0 475.467,0.8 344.667,0.267L228.667,0ZM466.4,41.6C483.334,48.933 496.267,61.867 502.934,78.4L506,86L506,514L502.934,521.734C496,538.934 480.267,553.867 463.334,559.334C455.6,561.867 450.8,562 300,562C149.2,562 144.4,561.867 136.667,559.334C119.733,553.867 104,538.934 97.067,521.734L94,514L93.6,351.067L93.333,188.133L149.067,187.733L204.667,187.333L213.6,182.933C224.8,177.467 235.867,165.867 240.267,155.067C243.333,147.467 243.333,146.4 243.733,92.267L244.133,37.2L458,38L466.4,41.6ZM195.067,304C175.6,306.8 164,320.667 165.6,339.467C166,343.6 167.6,348.667 169.733,352.4C174.4,360.267 185.2,365.734 201.867,368.534C208.4,369.734 215.067,371.467 216.8,372.667C224,377.334 221.467,389.067 212.533,392C205.6,394.4 193.733,392.934 185.6,388.8C173.333,382.534 164,385.334 164,395.2C164,400.934 170.133,406.667 180.267,410.134C190.933,413.867 217.067,413.734 225.467,409.867C238.933,403.6 246.667,390 244.8,375.6C242.667,359.734 232.8,351.334 212.267,347.867C193.6,344.8 189.333,342.4 189.333,334.533C189.333,324.267 201.867,320.933 218.267,326.667C228.667,330.267 232.533,330.133 235.867,325.867C242.133,318 237.6,310.667 224.267,306.8C213.333,303.6 204.267,302.8 195.067,304ZM386,304.133C377.6,305.333 374,306.8 367.334,311.6C355.734,320.133 351.2,336.4 352.4,365.334C353.2,385.334 356,394.4 364.134,402.534C372.267,410.667 381.734,413.734 396.667,413.067C406.8,412.667 409.734,412 415.734,408.667C429.2,401.334 434.534,390.934 435.6,370.667C436.4,353.734 436,353.067 420.934,352.267C401.867,351.334 396,353.467 396,361.867C396,367.867 399.467,370.667 407.067,370.667C413.2,370.667 413.334,370.667 413.334,374.934C413.334,394 386.267,400.534 378.534,383.467C374.934,375.334 374.934,341.867 378.534,333.733C382,326.4 387.467,323.467 396.8,324.267C403.067,324.8 404.667,325.6 410.534,331.067C414.267,334.533 418.4,337.333 419.867,337.333C427.334,337.333 433.334,330.267 431.334,323.733C427.2,310.133 406.4,301.2 386,304.133ZM258.4,308C255.067,311.467 254.533,312.8 255.2,316.4C257.067,326.667 285.333,405.867 288.133,408.8C289.733,410.534 293.067,412.267 295.333,412.8C303.867,414.4 310.667,407.867 314.4,394.667C315.067,392.134 321.2,374.134 327.867,354.8C334.8,334.533 340,317.467 340,314.533C340,303.733 325.067,299.867 319.867,309.467C318.533,312.133 309.467,340.933 302.667,364C301.067,369.467 299.333,374.4 298.8,375.067C298.267,375.6 292.933,360.8 286.933,342C275.333,306 274.133,304 266.267,304C263.867,304 261.067,305.467 258.4,308Z" style="fill-rule:nonzero;"/>
|
10
|
+
</g>
|
11
|
+
</svg>`;
|
12
|
+
const svgSchema = {
|
13
|
+
ui: (arg) => {
|
14
|
+
const { rootElement, value, mode, onChange, theme, schema } = arg;
|
15
|
+
const container = document.createElement((0, utils_js_1.isEditable)(mode, schema) ? 'textarea' : 'div');
|
16
|
+
container.style.width = '100%';
|
17
|
+
container.style.height = '100%';
|
18
|
+
container.style.boxSizing = 'border-box';
|
19
|
+
if ((0, utils_js_1.isEditable)(mode, schema)) {
|
20
|
+
const textarea = container;
|
21
|
+
textarea.value = value;
|
22
|
+
textarea.style.position = 'absolute';
|
23
|
+
textarea.style.backgroundColor = (0, utils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30);
|
24
|
+
if (isValidSVG(value)) {
|
25
|
+
const svgElement = new DOMParser().parseFromString(value, 'text/xml').childNodes[0];
|
26
|
+
if (svgElement instanceof SVGElement) {
|
27
|
+
svgElement.setAttribute('width', '100%');
|
28
|
+
svgElement.setAttribute('height', '100%');
|
29
|
+
svgElement.style.position = 'absolute';
|
30
|
+
}
|
31
|
+
rootElement.appendChild(svgElement);
|
32
|
+
}
|
33
|
+
else if (value) {
|
34
|
+
const errorElm = (0, utils_js_1.createErrorElm)();
|
35
|
+
errorElm.style.position = 'absolute';
|
36
|
+
rootElement.appendChild(errorElm);
|
37
|
+
}
|
38
|
+
textarea.addEventListener('change', (e) => {
|
39
|
+
const newValue = e.target.value;
|
40
|
+
onChange && onChange(newValue);
|
41
|
+
});
|
42
|
+
rootElement.appendChild(container);
|
43
|
+
textarea.setSelectionRange(value.length, value.length);
|
44
|
+
textarea.focus();
|
45
|
+
}
|
46
|
+
else {
|
47
|
+
if (!value)
|
48
|
+
return;
|
49
|
+
if (!isValidSVG(value)) {
|
50
|
+
rootElement.appendChild((0, utils_js_1.createErrorElm)());
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
container.innerHTML = value;
|
54
|
+
const svgElement = container.childNodes[0];
|
55
|
+
if (svgElement instanceof SVGElement) {
|
56
|
+
svgElement.setAttribute('width', '100%');
|
57
|
+
svgElement.setAttribute('height', '100%');
|
58
|
+
rootElement.appendChild(container);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
},
|
62
|
+
pdf: async (arg) => {
|
63
|
+
const { page, schema, value } = arg;
|
64
|
+
if (!value || !isValidSVG(value))
|
65
|
+
return;
|
66
|
+
const pageHeight = page.getHeight();
|
67
|
+
const { width, height, position } = (0, utils_js_1.convertForPdfLayoutProps)({ schema, pageHeight });
|
68
|
+
const { x, y } = position;
|
69
|
+
await page.drawSvg(value, { x, y: y + height, width, height });
|
70
|
+
},
|
71
|
+
propPanel: {
|
72
|
+
schema: {},
|
73
|
+
defaultValue,
|
74
|
+
defaultSchema: {
|
75
|
+
type: 'svg',
|
76
|
+
position: { x: 0, y: 0 },
|
77
|
+
width: 40,
|
78
|
+
height: 40,
|
79
|
+
},
|
80
|
+
},
|
81
|
+
};
|
82
|
+
exports.default = svgSchema;
|
83
|
+
exports.readOnlySvg = {
|
84
|
+
pdf: svgSchema.pdf,
|
85
|
+
ui: svgSchema.ui,
|
86
|
+
propPanel: {
|
87
|
+
...svgSchema.propPanel,
|
88
|
+
defaultSchema: {
|
89
|
+
...svgSchema.propPanel.defaultSchema,
|
90
|
+
type: 'readOnlySvg',
|
91
|
+
readOnly: true,
|
92
|
+
readOnlyValue: defaultValue,
|
93
|
+
},
|
94
|
+
},
|
95
|
+
};
|
96
|
+
//# sourceMappingURL=svg.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../../../src/graphics/svg.ts"],"names":[],"mappings":";;;AACA,qDAA+C;AAC/C,0CAAkG;AAElG,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,8BAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAEpF,MAAM,YAAY,GAAG;;;;OAId,CAAC;AAIR,MAAM,SAAS,GAAsB;IACnC,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;QACV,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAClE,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAA,qBAAU,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACxF,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QAC/B,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAChC,SAAS,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC;QACzC,IAAI,IAAA,qBAAU,EAAC,IAAI,EAAE,MAAM,CAAC,EAAE;YAC5B,MAAM,QAAQ,GAAG,SAAgC,CAAC;YAClD,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC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AE,EAAE;YACT,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC;AAEF,kBAAe,SAAS,CAAC;AAEZ,QAAA,WAAW,GAAsB;IAC5C,GAAG,EAAE,SAAS,CAAC,GAAG;IAClB,EAAE,EAAE,SAAS,CAAC,EAAE;IAChB,SAAS,EAAE;QACT,GAAG,SAAS,CAAC,SAAS;QACtB,aAAa,EAAE;YACb,GAAG,SAAS,CAAC,SAAS,CAAC,aAAa;YACpC,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,YAAY;SAC5B;KACF;CACF,CAAC"}
|
package/dist/cjs/src/index.js
CHANGED
@@ -1,20 +1,51 @@
|
|
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
27
|
};
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.rotatePoint = exports.convertForPdfLayoutProps = exports.builtInPlugins = exports.line = exports.barcodes = exports.image = exports.text = void 0;
|
7
|
-
const index_js_1 =
|
29
|
+
exports.rotatePoint = exports.convertForPdfLayoutProps = exports.builtInPlugins = exports.ellipse = exports.rectangle = exports.line = exports.barcodes = exports.readOnlySvg = exports.svg = exports.readOnlyImage = exports.image = exports.readOnlyText = exports.text = void 0;
|
30
|
+
const index_js_1 = __importStar(require("./text/index.js"));
|
8
31
|
exports.text = index_js_1.default;
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
exports
|
13
|
-
const
|
14
|
-
exports.
|
15
|
-
|
16
|
-
|
17
|
-
|
32
|
+
Object.defineProperty(exports, "readOnlyText", { enumerable: true, get: function () { return index_js_1.readOnlyText; } });
|
33
|
+
const image_js_1 = __importStar(require("./graphics/image.js"));
|
34
|
+
exports.image = image_js_1.default;
|
35
|
+
Object.defineProperty(exports, "readOnlyImage", { enumerable: true, get: function () { return image_js_1.readOnlyImage; } });
|
36
|
+
const svg_js_1 = __importStar(require("./graphics/svg.js"));
|
37
|
+
exports.svg = svg_js_1.default;
|
38
|
+
Object.defineProperty(exports, "readOnlySvg", { enumerable: true, get: function () { return svg_js_1.readOnlySvg; } });
|
39
|
+
const index_js_2 = __importDefault(require("./barcodes/index.js"));
|
40
|
+
exports.barcodes = index_js_2.default;
|
41
|
+
const line_js_1 = __importDefault(require("./shapes/line.js"));
|
42
|
+
exports.line = line_js_1.default;
|
43
|
+
const rectAndEllipse_js_1 = require("./shapes/rectAndEllipse.js");
|
44
|
+
Object.defineProperty(exports, "rectangle", { enumerable: true, get: function () { return rectAndEllipse_js_1.rectangle; } });
|
45
|
+
Object.defineProperty(exports, "ellipse", { enumerable: true, get: function () { return rectAndEllipse_js_1.ellipse; } });
|
46
|
+
const utils_js_1 = require("./utils.js");
|
47
|
+
Object.defineProperty(exports, "convertForPdfLayoutProps", { enumerable: true, get: function () { return utils_js_1.convertForPdfLayoutProps; } });
|
48
|
+
Object.defineProperty(exports, "rotatePoint", { enumerable: true, get: function () { return utils_js_1.rotatePoint; } });
|
18
49
|
const builtInPlugins = { Text: index_js_1.default };
|
19
50
|
exports.builtInPlugins = builtInPlugins;
|
20
51
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAqD;AAWnD,eAXK,kBAAI,CAWL;AACJ,6FAZa,uBAAY,OAYb;AAXd,gEAA2D;AAYzD,gBAZK,kBAAK,CAYL;AACL,8FAbc,wBAAa,OAad;AAZf,4DAAqD;AAanD,cAbK,gBAAG,CAaL;AACH,4FAdY,oBAAW,OAcZ;AAbb,mEAA2C;AAczC,mBAdK,kBAAQ,CAcL;AAbV,+DAAoC;AAclC,eAdK,iBAAI,CAcL;AAbN,kEAAgE;AAc9D,0FAdO,6BAAS,OAcP;AACT,wFAfkB,2BAAO,OAelB;AAdT,yCAAmE;AAgBjE,yGAhBO,mCAAwB,OAgBP;AACxB,4FAjBiC,sBAAW,OAiBjC;AAfb,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,kBAAI,EAAE,CAAC;AAapC,wCAAc"}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const utils_js_1 = require("../utils.js");
|
4
|
+
const constants_js_1 = require("../constants.js");
|
5
|
+
const DEFAULT_LINE_COLOR = '#000000';
|
6
|
+
const lineSchema = {
|
7
|
+
pdf: (arg) => {
|
8
|
+
const { page, schema } = arg;
|
9
|
+
const pageHeight = page.getHeight();
|
10
|
+
const { width, height, rotate, position: { x, y }, opacity, } = (0, utils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
|
11
|
+
const pivot = { x: x + width / 2, y: y + height / 2 };
|
12
|
+
page.drawLine({
|
13
|
+
start: (0, utils_js_1.rotatePoint)({ x, y: y + height / 2 }, pivot, rotate.angle),
|
14
|
+
end: (0, utils_js_1.rotatePoint)({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
|
15
|
+
thickness: height,
|
16
|
+
color: (0, utils_js_1.hex2RgbColor)(schema.color ?? DEFAULT_LINE_COLOR),
|
17
|
+
opacity: opacity,
|
18
|
+
});
|
19
|
+
},
|
20
|
+
ui: (arg) => {
|
21
|
+
const { schema, rootElement } = arg;
|
22
|
+
const div = document.createElement('div');
|
23
|
+
div.style.backgroundColor = schema.color ?? DEFAULT_LINE_COLOR;
|
24
|
+
div.style.width = '100%';
|
25
|
+
div.style.height = '100%';
|
26
|
+
rootElement.appendChild(div);
|
27
|
+
},
|
28
|
+
propPanel: {
|
29
|
+
schema: ({ i18n }) => ({
|
30
|
+
color: {
|
31
|
+
title: i18n('schemas.color'),
|
32
|
+
type: 'string',
|
33
|
+
widget: 'color',
|
34
|
+
required: true,
|
35
|
+
rules: [
|
36
|
+
{
|
37
|
+
pattern: constants_js_1.HEX_COLOR_PATTERN,
|
38
|
+
message: i18n('hexColorPrompt'),
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
}),
|
43
|
+
defaultValue: '',
|
44
|
+
defaultSchema: {
|
45
|
+
type: 'line',
|
46
|
+
position: { x: 0, y: 0 },
|
47
|
+
width: 50,
|
48
|
+
height: 1,
|
49
|
+
rotate: 0,
|
50
|
+
opacity: 1,
|
51
|
+
readOnly: true,
|
52
|
+
color: DEFAULT_LINE_COLOR,
|
53
|
+
},
|
54
|
+
},
|
55
|
+
};
|
56
|
+
exports.default = lineSchema;
|
57
|
+
//# sourceMappingURL=line.js.map
|
@@ -0,0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EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;QACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,KAAK,IAAI,kBAAkB,CAAC;QAC/D,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,SAAS,EAAE;QACT,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACrB,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC;gBAC5B,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,gCAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;SACF,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE;YACb,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;YACxB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,kBAAkB;SAC1B;KACF;CACF,CAAC;AACF,kBAAe,UAAU,CAAC"}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ellipse = exports.rectangle = void 0;
|
4
|
+
const common_1 = require("@pdfme/common");
|
5
|
+
const constants_js_1 = require("../constants.js");
|
6
|
+
const utils_js_1 = require("../utils.js");
|
7
|
+
const shape = {
|
8
|
+
ui: (arg) => {
|
9
|
+
const { schema, rootElement } = arg;
|
10
|
+
const div = document.createElement('div');
|
11
|
+
div.style.width = '100%';
|
12
|
+
div.style.height = '100%';
|
13
|
+
div.style.boxSizing = 'border-box';
|
14
|
+
if (schema.type === 'ellipse') {
|
15
|
+
div.style.borderRadius = '50%';
|
16
|
+
}
|
17
|
+
div.style.borderWidth = `${schema.borderWidth ?? 0}mm`;
|
18
|
+
div.style.borderStyle = schema.borderWidth && schema.borderColor ? 'solid' : 'none';
|
19
|
+
div.style.borderColor = schema.borderColor ?? 'transparent';
|
20
|
+
div.style.backgroundColor = schema.color ?? 'transparent';
|
21
|
+
rootElement.appendChild(div);
|
22
|
+
},
|
23
|
+
pdf: (arg) => {
|
24
|
+
const { schema, page } = arg;
|
25
|
+
const pageHeight = page.getHeight();
|
26
|
+
const cArg = { schema, pageHeight };
|
27
|
+
const { position, width, height, rotate, opacity } = (0, utils_js_1.convertForPdfLayoutProps)(cArg);
|
28
|
+
const { position: { x: x4Ellipse, y: y4Ellipse }, } = (0, utils_js_1.convertForPdfLayoutProps)({ ...cArg, applyRotateTranslate: false });
|
29
|
+
const borderWidth = schema.borderWidth ? (0, common_1.mm2pt)(schema.borderWidth) : 0;
|
30
|
+
const drawOptions = {
|
31
|
+
rotate,
|
32
|
+
borderWidth,
|
33
|
+
borderColor: (0, utils_js_1.hex2RgbColor)(schema.borderColor),
|
34
|
+
color: (0, utils_js_1.hex2RgbColor)(schema.color),
|
35
|
+
opacity,
|
36
|
+
borderOpacity: opacity,
|
37
|
+
};
|
38
|
+
if (schema.type === 'ellipse') {
|
39
|
+
page.drawEllipse({
|
40
|
+
x: x4Ellipse + width / 2,
|
41
|
+
y: y4Ellipse + height / 2,
|
42
|
+
xScale: width / 2 - borderWidth / 2,
|
43
|
+
yScale: height / 2 - borderWidth / 2,
|
44
|
+
...drawOptions,
|
45
|
+
});
|
46
|
+
}
|
47
|
+
else if (schema.type === 'rectangle') {
|
48
|
+
page.drawRectangle({
|
49
|
+
x: position.x + borderWidth / 2,
|
50
|
+
y: position.y + borderWidth / 2,
|
51
|
+
width: width - borderWidth,
|
52
|
+
height: height - borderWidth,
|
53
|
+
...drawOptions,
|
54
|
+
});
|
55
|
+
}
|
56
|
+
},
|
57
|
+
propPanel: {
|
58
|
+
schema: ({ i18n }) => ({
|
59
|
+
borderWidth: {
|
60
|
+
title: i18n('schemas.borderWidth'),
|
61
|
+
type: 'number',
|
62
|
+
widget: 'inputNumber',
|
63
|
+
min: 0,
|
64
|
+
step: 1,
|
65
|
+
},
|
66
|
+
borderColor: {
|
67
|
+
title: i18n('schemas.borderColor'),
|
68
|
+
type: 'string',
|
69
|
+
widget: 'color',
|
70
|
+
rules: [{ pattern: constants_js_1.HEX_COLOR_PATTERN, message: i18n('hexColorPrompt') }],
|
71
|
+
},
|
72
|
+
color: {
|
73
|
+
title: i18n('schemas.color'),
|
74
|
+
type: 'string',
|
75
|
+
widget: 'color',
|
76
|
+
rules: [{ pattern: constants_js_1.HEX_COLOR_PATTERN, message: i18n('hexColorPrompt') }],
|
77
|
+
},
|
78
|
+
}),
|
79
|
+
defaultValue: '',
|
80
|
+
defaultSchema: {
|
81
|
+
type: 'rectangle',
|
82
|
+
position: { x: 0, y: 0 },
|
83
|
+
width: 62.5,
|
84
|
+
height: 37.5,
|
85
|
+
rotate: 0,
|
86
|
+
opacity: 1,
|
87
|
+
borderWidth: 5,
|
88
|
+
borderColor: '#000000',
|
89
|
+
color: '#ffffff',
|
90
|
+
readOnly: true,
|
91
|
+
},
|
92
|
+
},
|
93
|
+
};
|
94
|
+
const getPropPanelSchema = (type) => ({
|
95
|
+
...shape.propPanel,
|
96
|
+
defaultSchema: { ...shape.propPanel.defaultSchema, type },
|
97
|
+
});
|
98
|
+
exports.rectangle = { ...shape, propPanel: getPropPanelSchema('rectangle') };
|
99
|
+
exports.ellipse = { ...shape, propPanel: getPropPanelSchema('ellipse') };
|
100
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ACF;CACF,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAA6B,EAAE,EAAE,CAAC,CAAC;IAC7D,GAAG,KAAK,CAAC,SAAS;IAClB,aAAa,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE;CAC1D,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;AAErE,QAAA,OAAO,GAAG,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/text/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAEnC,
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/text/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAEnC,0CASuB;AACvB,mCAAgC;AAEhC,iDASwB;AAEjB,MAAM,iCAAiC,GAAG,CAC/C,WAAwB,EACxB,QAAgB,EAChB,UAAkB,EAClB,iBAAyB,EACzB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;IAEpD,8FAA8F;IAC9F,MAAM,kBAAkB,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,UAAU,CAAC;IAE3D,6BAA6B;IAC7B,6FAA6F;IAC7F,wDAAwD;IACxD,+FAA+F;IAC/F,qFAAqF;IACrF,MAAM,aAAa,GAAG,CAAC,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAErE,IAAI,iBAAiB,KAAK,iCAAkB,EAAE;QAC5C,OAAO,EAAE,MAAM,EAAE,IAAA,cAAK,EAAC,aA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Ac,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,GAC5D,oBAAoB,CAAC,eAAe,CAAC,CAAC;QAExC,IAAI,SAAS,GAAG,SAAS,EAAE;YACzB,cAAc,GAAG,QAAQ,CAAC;YAC1B,eAAe,GAAG,SAAS,CAAC;SAC7B;aAAM;YACL,eAAe,IAAI,mCAAoB,CAAC;YACxC,MAAM;SACP;KACF;IAED,wDAAwD;IACxD,OAAO,qBAAqB,CAAC,cAAc,EAAE,eAAe,CAAC,EAAE;QAC7D,eAAe,IAAI,mCAAoB,CAAC;QACxC,CAAC,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC;KAC/E;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAvHW,QAAA,wBAAwB,4BAuHnC"}
|
@@ -1,8 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.readOnlyText = void 0;
|
3
4
|
const pdfRender_js_1 = require("./pdfRender.js");
|
4
5
|
const propPanel_js_1 = require("./propPanel.js");
|
5
6
|
const uiRender_js_1 = require("./uiRender.js");
|
6
|
-
const
|
7
|
-
exports.default =
|
7
|
+
const textSchema = { pdf: pdfRender_js_1.pdfRender, ui: uiRender_js_1.uiRender, propPanel: propPanel_js_1.propPanel };
|
8
|
+
exports.default = textSchema;
|
9
|
+
exports.readOnlyText = {
|
10
|
+
pdf: textSchema.pdf,
|
11
|
+
ui: textSchema.ui,
|
12
|
+
propPanel: {
|
13
|
+
...textSchema.propPanel,
|
14
|
+
defaultSchema: {
|
15
|
+
...textSchema.propPanel.defaultSchema,
|
16
|
+
type: 'readOnlyText',
|
17
|
+
readOnly: true,
|
18
|
+
readOnlyValue: textSchema.propPanel.defaultValue,
|
19
|
+
},
|
20
|
+
},
|
21
|
+
};
|
8
22
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/text/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/text/index.ts"],"names":[],"mappings":";;;AACA,iDAA2C;AAC3C,iDAA2C;AAC3C,+CAAyC;AAGzC,MAAM,UAAU,GAAuB,EAAE,GAAG,EAAE,wBAAS,EAAE,EAAE,EAAE,sBAAQ,EAAE,SAAS,EAAT,wBAAS,EAAE,CAAC;AAEnF,kBAAe,UAAU,CAAC;AAEb,QAAA,YAAY,GAAuB;IAC9C,GAAG,EAAE,UAAU,CAAC,GAAG;IACnB,EAAE,EAAE,UAAU,CAAC,EAAE;IACjB,SAAS,EAAE;QACT,GAAG,UAAU,CAAC,SAAS;QACvB,aAAa,EAAE;YACb,GAAG,UAAU,CAAC,SAAS,CAAC,aAAa;YACrC,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,YAAY;SACjD;KACF;CACF,CAAC"}
|