@pdfme/schemas 3.1.5-dev.15 → 3.1.5-dev.17
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/src/barcodes/index.js +2 -2
- package/dist/cjs/src/barcodes/index.js.map +1 -1
- package/dist/cjs/src/barcodes/propPanel.js +1 -1
- package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
- package/dist/cjs/src/barcodes/uiRender.js +2 -2
- 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 +20 -30
- package/dist/cjs/src/graphics/image.js.map +1 -1
- package/dist/cjs/src/graphics/svg.js +21 -7
- package/dist/cjs/src/graphics/svg.js.map +1 -1
- package/dist/cjs/src/index.js +30 -4
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/shapes/line.js +2 -2
- package/dist/cjs/src/shapes/line.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/uiRender.js +1 -1
- package/dist/cjs/src/text/uiRender.js.map +1 -1
- package/dist/cjs/src/utils.js +1 -1
- package/dist/cjs/src/utils.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/propPanel.js +1 -1
- package/dist/esm/src/barcodes/propPanel.js.map +1 -1
- package/dist/esm/src/barcodes/uiRender.js +2 -2
- 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 +20 -28
- package/dist/esm/src/graphics/image.js.map +1 -1
- package/dist/esm/src/graphics/svg.js +20 -7
- package/dist/esm/src/graphics/svg.js.map +1 -1
- package/dist/esm/src/index.js +4 -4
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/shapes/line.js +2 -2
- package/dist/esm/src/shapes/line.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/uiRender.js +1 -1
- package/dist/esm/src/text/uiRender.js.map +1 -1
- package/dist/esm/src/utils.js +1 -1
- package/dist/esm/src/utils.js.map +1 -1
- package/dist/types/src/barcodes/index.d.ts +2 -2
- package/dist/types/src/graphics/helper.d.ts +5 -0
- package/dist/types/src/graphics/image.d.ts +3 -2
- package/dist/types/src/graphics/svg.d.ts +4 -3
- package/dist/types/src/index.d.ts +4 -4
- package/dist/types/src/shapes/line.d.ts +2 -2
- package/dist/types/src/shapes/rectAndEllipse.d.ts +6 -0
- package/dist/types/src/text/index.d.ts +3 -2
- package/dist/types/src/utils.d.ts +1 -1
- package/package.json +3 -4
- package/src/barcodes/index.ts +2 -2
- package/src/barcodes/propPanel.ts +1 -1
- package/src/barcodes/uiRender.ts +2 -2
- package/src/graphics/helper.ts +147 -0
- package/src/graphics/image.ts +32 -33
- package/src/graphics/svg.ts +22 -8
- package/src/index.ts +6 -3
- package/src/shapes/line.ts +2 -2
- package/src/text/index.ts +17 -2
- package/src/text/uiRender.ts +1 -1
- package/src/utils.ts +2 -1
@@ -4,8 +4,8 @@ const pdfRender_js_1 = require("./pdfRender.js");
|
|
4
4
|
const propPanel_js_1 = require("./propPanel.js");
|
5
5
|
const uiRender_js_1 = require("./uiRender.js");
|
6
6
|
const constants_js_1 = require("./constants.js");
|
7
|
-
const
|
7
|
+
const barcodes = constants_js_1.BARCODE_TYPES.reduce((acc, type) => Object.assign(acc, {
|
8
8
|
[type]: { pdf: pdfRender_js_1.pdfRender, ui: uiRender_js_1.uiRender, propPanel: (0, propPanel_js_1.getPropPanelByBarcodeType)(type) },
|
9
9
|
}), {});
|
10
|
-
exports.default =
|
10
|
+
exports.default = barcodes;
|
11
11
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/barcodes/index.ts"],"names":[],"mappings":";;AAAA,iDAA2C;AAC3C,iDAA2D;AAC3D,+CAAyC;AAEzC,iDAA+C;AAG/C,MAAM,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/barcodes/index.ts"],"names":[],"mappings":";;AAAA,iDAA2C;AAC3C,iDAA2D;AAC3D,+CAAyC;AAEzC,iDAA+C;AAG/C,MAAM,QAAQ,GAAG,4BAAa,CAAC,MAAM,CACnC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CACZ,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;IACjB,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,wBAAS,EAAE,EAAE,EAAE,sBAAQ,EAAE,SAAS,EAAE,IAAA,wCAAyB,EAAC,IAAI,CAAC,EAAE;CACrF,CAAC,EACJ,EAAiD,CAClD,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
@@ -151,7 +151,7 @@ const getPropPanelByBarcodeType = (barcodeType) => {
|
|
151
151
|
const barcodeHasText = barcodeType !== 'qrcode' && barcodeType !== 'gs1datamatrix';
|
152
152
|
const defaults = barcodeDefaults.find(({ defaultSchema }) => defaultSchema.type === barcodeType);
|
153
153
|
if (!defaults)
|
154
|
-
throw new Error(`[@pdfme/schemas] No default for barcode type ${barcodeType}`);
|
154
|
+
throw new Error(`[@pdfme/schemas/barcodes] No default for barcode type ${barcodeType}`);
|
155
155
|
return {
|
156
156
|
schema: ({ i18n }) => ({
|
157
157
|
barColor: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/barcodes/propPanel.ts"],"names":[],"mappings":";;;AAEA,iDAAiF;AACjF,kDAAqE;AAErE,MAAM,aAAa,GAAG;IACpB,eAAe,EAAE,uCAAwB;IACzC,QAAQ,EAAE,oCAAqB;CAChC,CAAC;AAC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B;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;YACD,eAAe,EAAE;gBACf,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC;gBAC9B,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,gCAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;YACD,GAAG,CAAC,cAAc;gBAChB,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;gBACtF,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;QACF,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,yBAAyB,6BAqCpC"}
|
@@ -39,7 +39,7 @@ const uiRender = async (arg) => {
|
|
39
39
|
};
|
40
40
|
Object.assign(container.style, containerStyle);
|
41
41
|
rootElement.appendChild(container);
|
42
|
-
const editable = (0, utils_js_1.isEditable)(mode);
|
42
|
+
const editable = (0, utils_js_1.isEditable)(mode, schema);
|
43
43
|
if (editable) {
|
44
44
|
const input = document.createElement('input');
|
45
45
|
const inputStyle = {
|
@@ -74,7 +74,7 @@ const uiRender = async (arg) => {
|
|
74
74
|
return;
|
75
75
|
try {
|
76
76
|
if (!(0, helper_js_1.validateBarcodeInput)(schema.type, value))
|
77
|
-
throw new Error('[@pdfme/schemas] Invalid barcode input');
|
77
|
+
throw new Error('[@pdfme/schemas/barcodes] Invalid barcode input');
|
78
78
|
const imgElm = await createBarcodeImageElm(schema, value);
|
79
79
|
container.appendChild(imgElm);
|
80
80
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/barcodes/uiRender.ts"],"names":[],"mappings":";;;AAGA,2CA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,CAAC,CAAC;QACH,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE;YAClC,WAAW,IAAI,WAAW,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC7B,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,KAAK,CAAC,KAAK,EAAE,CAAC;KACf;IAED,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI;QACF,IAAI,CAAC,IAAA,gCAAoB,EAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1D,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KAC/B;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC;QACpC,SAAS,CAAC,WAAW,CAAC,IAAA,yBAAc,GAAE,CAAC,CAAC;KACzC;AACH,CAAC,CAAC;AAxDW,QAAA,QAAQ,YAwDnB"}
|
@@ -0,0 +1,115 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.imageSize = void 0;
|
4
|
+
const decoder = new TextDecoder();
|
5
|
+
const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
|
6
|
+
const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ('0' + i.toString(16)).slice(-2), '');
|
7
|
+
const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1];
|
8
|
+
const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 +
|
9
|
+
input[offset + 1] * 2 ** 16 +
|
10
|
+
input[offset + 2] * 2 ** 8 +
|
11
|
+
input[offset + 3];
|
12
|
+
const extractSize = (input, index) => {
|
13
|
+
return {
|
14
|
+
height: readUInt16BE(input, index),
|
15
|
+
width: readUInt16BE(input, index + 2),
|
16
|
+
};
|
17
|
+
};
|
18
|
+
const validateInput = (input, index) => {
|
19
|
+
// index should be within buffer limits
|
20
|
+
if (index > input.length) {
|
21
|
+
throw new TypeError('Corrupt JPG, exceeded buffer limits');
|
22
|
+
}
|
23
|
+
// Every JPEG block must begin with a 0xFF
|
24
|
+
if (input[index] !== 0xff) {
|
25
|
+
throw new TypeError('Invalid JPG, marker table corrupted');
|
26
|
+
}
|
27
|
+
};
|
28
|
+
const JPG = {
|
29
|
+
validate: (input) => toHexString(input, 0, 2) === 'ffd8',
|
30
|
+
calculate(input) {
|
31
|
+
// Skip 4 chars, they are for signature
|
32
|
+
input = input.slice(4);
|
33
|
+
let next;
|
34
|
+
while (input.length) {
|
35
|
+
// read length of the next block
|
36
|
+
const i = readUInt16BE(input, 0);
|
37
|
+
// ensure correct format
|
38
|
+
validateInput(input, i);
|
39
|
+
// 0xFFC0 is baseline standard(SOF)
|
40
|
+
// 0xFFC1 is baseline optimized(SOF)
|
41
|
+
// 0xFFC2 is progressive(SOF2)
|
42
|
+
next = input[i + 1];
|
43
|
+
if (next === 0xc0 || next === 0xc1 || next === 0xc2) {
|
44
|
+
const size = extractSize(input, i + 5);
|
45
|
+
return size;
|
46
|
+
}
|
47
|
+
// move to the next block
|
48
|
+
input = input.slice(i + 2);
|
49
|
+
}
|
50
|
+
throw new TypeError('Invalid JPG, no size found');
|
51
|
+
},
|
52
|
+
};
|
53
|
+
const pngSignature = 'PNG\r\n\x1a\n';
|
54
|
+
const pngImageHeaderChunkName = 'IHDR';
|
55
|
+
// Used to detect "fried" png's: http://www.jongware.com/pngdefry.html
|
56
|
+
const pngFriedChunkName = 'CgBI';
|
57
|
+
const PNG = {
|
58
|
+
validate(input) {
|
59
|
+
if (pngSignature === toUTF8String(input, 1, 8)) {
|
60
|
+
let chunkName = toUTF8String(input, 12, 16);
|
61
|
+
if (chunkName === pngFriedChunkName) {
|
62
|
+
chunkName = toUTF8String(input, 28, 32);
|
63
|
+
}
|
64
|
+
if (chunkName !== pngImageHeaderChunkName) {
|
65
|
+
throw new TypeError('Invalid PNG');
|
66
|
+
}
|
67
|
+
return true;
|
68
|
+
}
|
69
|
+
return false;
|
70
|
+
},
|
71
|
+
calculate(input) {
|
72
|
+
if (toUTF8String(input, 12, 16) === pngFriedChunkName) {
|
73
|
+
return {
|
74
|
+
height: readUInt32BE(input, 36),
|
75
|
+
width: readUInt32BE(input, 32),
|
76
|
+
};
|
77
|
+
}
|
78
|
+
return {
|
79
|
+
height: readUInt32BE(input, 20),
|
80
|
+
width: readUInt32BE(input, 16),
|
81
|
+
};
|
82
|
+
},
|
83
|
+
};
|
84
|
+
const typeHandlers = {
|
85
|
+
jpg: JPG,
|
86
|
+
png: PNG,
|
87
|
+
};
|
88
|
+
function detector(input) {
|
89
|
+
const firstBytes = {
|
90
|
+
0x89: 'png',
|
91
|
+
0xff: 'jpg',
|
92
|
+
};
|
93
|
+
const byte = input[0];
|
94
|
+
if (byte in firstBytes) {
|
95
|
+
const type = firstBytes[byte];
|
96
|
+
if (type && typeHandlers[type].validate(input)) {
|
97
|
+
return type;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
const keys = Object.keys(typeHandlers);
|
101
|
+
return keys.find((key) => typeHandlers[key].validate(input));
|
102
|
+
}
|
103
|
+
const imageSize = (imgBuffer) => {
|
104
|
+
const type = detector(imgBuffer);
|
105
|
+
if (typeof type !== 'undefined' && type in typeHandlers) {
|
106
|
+
const size = typeHandlers[type].calculate(imgBuffer);
|
107
|
+
if (size !== undefined) {
|
108
|
+
return size;
|
109
|
+
}
|
110
|
+
}
|
111
|
+
throw new TypeError('[@pdfme/schemas/images] Unsupported file type: ' + (type === undefined ? 'undefined' : type));
|
112
|
+
};
|
113
|
+
exports.imageSize = imageSize;
|
114
|
+
// ----------------------------
|
115
|
+
//# sourceMappingURL=helper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/graphics/helper.ts"],"names":[],"mappings":";;;AAOA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CACxE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG,CAAC,KAAiB,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,EAAE,CACvE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAE3F,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAEnG,MAAM,YAAY,GAAG,CAAC,KAAiB,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CACrD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE;IACvB,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;IAC3B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IAC1B,KAAK,CAAC,MAAM,GAAG,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|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
|
3
|
+
exports.readOnlyImage = void 0;
|
7
4
|
const buffer_1 = require("buffer");
|
8
5
|
const utils_js_1 = require("../utils.js");
|
9
6
|
const constants_js_1 = require("../constants.js");
|
7
|
+
const helper_js_1 = require("./helper.js");
|
10
8
|
const px2mm = (px) => {
|
11
9
|
// http://www.endmemo.com/sconvert/millimeterpixel.php
|
12
10
|
const ratio = 0.26458333333333;
|
13
11
|
return parseFloat(String(px)) * ratio;
|
14
12
|
};
|
15
|
-
const getDimension = (imgBuffer) => {
|
16
|
-
if (typeof window !== 'undefined') {
|
17
|
-
return new Promise((resolve, reject) => {
|
18
|
-
const blob = new Blob([imgBuffer]);
|
19
|
-
const url = URL.createObjectURL(blob);
|
20
|
-
const img = new Image();
|
21
|
-
img.onload = () => {
|
22
|
-
resolve({ width: img.width, height: img.height });
|
23
|
-
URL.revokeObjectURL(url);
|
24
|
-
};
|
25
|
-
img.onerror = (e) => {
|
26
|
-
reject(e);
|
27
|
-
};
|
28
|
-
img.src = url;
|
29
|
-
});
|
30
|
-
}
|
31
|
-
else {
|
32
|
-
const dimensions = (0, image_size_1.default)(imgBuffer);
|
33
|
-
return Promise.resolve({ width: dimensions.width ?? 0, height: dimensions.height ?? 0 });
|
34
|
-
}
|
35
|
-
};
|
36
13
|
const getCacheKey = (schema, input) => `${schema.type}${input}`;
|
37
14
|
const fullSize = { width: '100%', height: '100%' };
|
38
15
|
const defaultValue = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUgAAAGQBAMAAAA+V+RCAAAAAXNSR0IArs4c6QAAABtQTFRFAAAAR3BMAAAAAAAAAAAAAAAAAAAAAAAAAAAAqmQqwQAAAAh0Uk5TDQAvVYGtxusE1uR9AAAKg0lEQVR42tTbw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DLR6cZWCYMrIiXc7zoUnj3nX1s8ZUTbqc5eWhMeLpoibvkdJmemBejSPVeIn6V4ssr0nXo7QzNCxp+th4KVKEQXkmRvLQcaxcANKPXTO+eICkgWvIW0JkEDsWyB4hkgbuBRKRQexcIBFJA/cCichg5o5x7VUg6SCzTMN0YYikiSvIL1SNDGLnRg0i6ch2g2PeNUTSmQvIBwIknAtZLXgWiEgKY+sdckTfQ9J+Yte4eUOIhHJkQ4mJABGJSvvGeiT1F7aMyzH9KJL2biyN6zdUjUTlr6l54vZDj+qQWPrXmWEi5KUEJBa//26RGRMuP449+jEkprV8TLPGgenjx8uomkj0N73+g6V/XjknAAAAAElFTkSuQmCC';
|
39
|
-
const
|
16
|
+
const imageSchema = {
|
40
17
|
pdf: async (arg) => {
|
41
18
|
const { value, schema, pdfDoc, page, _cache } = arg;
|
42
19
|
if (!value || !value.startsWith('data:image/'))
|
@@ -52,7 +29,7 @@ const schema = {
|
|
52
29
|
const dataUriPrefix = ';base64,';
|
53
30
|
const idx = value.indexOf(dataUriPrefix);
|
54
31
|
const imgBase64 = value.substring(idx + dataUriPrefix.length, value.length);
|
55
|
-
const dimension =
|
32
|
+
const dimension = (0, helper_js_1.imageSize)(buffer_1.Buffer.from(imgBase64, 'base64'));
|
56
33
|
const imageWidth = px2mm(dimension.width);
|
57
34
|
const imageHeight = px2mm(dimension.height);
|
58
35
|
const boxWidth = _schema.width;
|
@@ -76,8 +53,8 @@ const schema = {
|
|
76
53
|
page.drawImage(image, { x, y, rotate, width, height, opacity });
|
77
54
|
},
|
78
55
|
ui: (arg) => {
|
79
|
-
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, theme } = arg;
|
80
|
-
const editable = (0, utils_js_1.isEditable)(mode);
|
56
|
+
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, theme, schema, } = arg;
|
57
|
+
const editable = (0, utils_js_1.isEditable)(mode, schema);
|
81
58
|
const isDefault = value === defaultValue;
|
82
59
|
const container = document.createElement('div');
|
83
60
|
const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
|
@@ -185,5 +162,18 @@ const schema = {
|
|
185
162
|
},
|
186
163
|
},
|
187
164
|
};
|
188
|
-
exports.default =
|
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
|
+
};
|
189
179
|
//# sourceMappingURL=image.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/graphics/image.ts"],"names":[],"mappings":"
|
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,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;AAChF,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACnD,MAAM,YAAY,GAChB,wsHAAwsH,CAAC;AAI3sH,MAAM,WAAW,GAAwB;IACvC,GAAG,EAAE,KAAK,EAAE,GAAgC,EAAE,EAAE;QAC9C,MAAM,EAA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b,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"}
|
@@ -1,21 +1,22 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.readOnlySvg = void 0;
|
3
4
|
const fast_xml_parser_1 = require("fast-xml-parser");
|
4
5
|
const utils_js_1 = require("../utils.js");
|
5
6
|
const isValidSVG = (svgString) => fast_xml_parser_1.XMLValidator.validate(svgString) === true;
|
6
|
-
const
|
7
|
+
const defaultValue = `<svg viewBox="0 0 488 600" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
7
8
|
<g transform="matrix(1,0,0,1,-56,0)" fill="#000000" stroke="none">
|
8
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;"/>
|
9
10
|
</g>
|
10
11
|
</svg>`;
|
11
|
-
const
|
12
|
+
const svgSchema = {
|
12
13
|
ui: (arg) => {
|
13
|
-
const { rootElement, value, mode, onChange, theme } = arg;
|
14
|
-
const container = document.createElement((0, utils_js_1.isEditable)(mode) ? 'textarea' : 'div');
|
14
|
+
const { rootElement, value, mode, onChange, theme, schema } = arg;
|
15
|
+
const container = document.createElement((0, utils_js_1.isEditable)(mode, schema) ? 'textarea' : 'div');
|
15
16
|
container.style.width = '100%';
|
16
17
|
container.style.height = '100%';
|
17
18
|
container.style.boxSizing = 'border-box';
|
18
|
-
if ((0, utils_js_1.isEditable)(mode)) {
|
19
|
+
if ((0, utils_js_1.isEditable)(mode, schema)) {
|
19
20
|
const textarea = container;
|
20
21
|
textarea.value = value;
|
21
22
|
textarea.style.position = 'absolute';
|
@@ -69,7 +70,7 @@ const schema = {
|
|
69
70
|
},
|
70
71
|
propPanel: {
|
71
72
|
schema: {},
|
72
|
-
defaultValue
|
73
|
+
defaultValue,
|
73
74
|
defaultSchema: {
|
74
75
|
type: 'svg',
|
75
76
|
position: { x: 0, y: 0 },
|
@@ -78,5 +79,18 @@ const schema = {
|
|
78
79
|
},
|
79
80
|
},
|
80
81
|
};
|
81
|
-
exports.default =
|
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
|
+
};
|
82
96
|
//# sourceMappingURL=svg.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../../../src/graphics/svg.ts"],"names":[],"mappings":"
|
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,CA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CAAC,EAAE;YACxB,KAAK,EAAE,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,15 +1,41 @@
|
|
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.ellipse = exports.rectangle = exports.line = exports.barcodes = exports.svg = 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
|
-
|
32
|
+
Object.defineProperty(exports, "readOnlyText", { enumerable: true, get: function () { return index_js_1.readOnlyText; } });
|
33
|
+
const image_js_1 = __importStar(require("./graphics/image.js"));
|
10
34
|
exports.image = image_js_1.default;
|
11
|
-
|
35
|
+
Object.defineProperty(exports, "readOnlyImage", { enumerable: true, get: function () { return image_js_1.readOnlyImage; } });
|
36
|
+
const svg_js_1 = __importStar(require("./graphics/svg.js"));
|
12
37
|
exports.svg = svg_js_1.default;
|
38
|
+
Object.defineProperty(exports, "readOnlySvg", { enumerable: true, get: function () { return svg_js_1.readOnlySvg; } });
|
13
39
|
const index_js_2 = __importDefault(require("./barcodes/index.js"));
|
14
40
|
exports.barcodes = index_js_2.default;
|
15
41
|
const line_js_1 = __importDefault(require("./shapes/line.js"));
|
@@ -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"}
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const utils_js_1 = require("../utils.js");
|
4
4
|
const constants_js_1 = require("../constants.js");
|
5
5
|
const DEFAULT_LINE_COLOR = '#000000';
|
6
|
-
const
|
6
|
+
const lineSchema = {
|
7
7
|
pdf: (arg) => {
|
8
8
|
const { page, schema } = arg;
|
9
9
|
const pageHeight = page.getHeight();
|
@@ -53,5 +53,5 @@ const schema = {
|
|
53
53
|
},
|
54
54
|
},
|
55
55
|
};
|
56
|
-
exports.default =
|
56
|
+
exports.default = lineSchema;
|
57
57
|
//# sourceMappingURL=line.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../../src/shapes/line.ts"],"names":[],"mappings":";;AACA,0CAAkF;AAClF,kDAAoD;AAEpD,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAMrC,MAAM,
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../../src/shapes/line.ts"],"names":[],"mappings":";;AACA,0CAAkF;AAClF,kDAAoD;AAEpD,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAMrC,MAAM,UAAU,GAAuB;IACrC,GAAG,EAAE,CAAC,GAA+B,EAAE,EAAE;QACvC,MAAM,EAAE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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"}
|
@@ -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"}
|
@@ -78,7 +78,7 @@ const uiRender = async (arg) => {
|
|
78
78
|
};
|
79
79
|
const textBlock = document.createElement('div');
|
80
80
|
Object.assign(textBlock.style, textBlockStyle);
|
81
|
-
if ((0, utils_js_1.isEditable)(mode)) {
|
81
|
+
if ((0, utils_js_1.isEditable)(mode, schema)) {
|
82
82
|
textBlock.contentEditable = 'plaintext-only';
|
83
83
|
textBlock.tabIndex = tabIndex || 0;
|
84
84
|
textBlock.innerText = value;
|
@@ -1 +1 @@
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,EAAE,CAAC;YACrC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACpC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,4BAA4B;YACnD,SAAS,EAAE,eAAe,EAAE,CAAC;YAC7B,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC5B;KACF;SAAM;QACL,SAAS,CAAC,SAAS,GAAG,KAAK;aACxB,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CACF,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CACvB,+BACE,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SACvC,MAAM,CAAC,SAAS,CACnB;aACA,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;KAClC;AACH,CAAC,CAAC;AAvJW,QAAA,QAAQ,YAuJnB"}
|
package/dist/cjs/src/utils.js
CHANGED
@@ -53,7 +53,7 @@ const addAlphaToHex = (hex, alphaPercentage) => {
|
|
53
53
|
return hex + alphaHex;
|
54
54
|
};
|
55
55
|
exports.addAlphaToHex = addAlphaToHex;
|
56
|
-
const isEditable = (mode) => mode === '
|
56
|
+
const isEditable = (mode, schema) => mode === 'designer' || (mode === 'form' && schema.readOnly !== true);
|
57
57
|
exports.isEditable = isEditable;
|
58
58
|
const hex2rgb = (hex) => {
|
59
59
|
if (hex.slice(0, 1) === '#')
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":";;;AACA,4CAAgE;AAChE,0CAAgE;AAEzD,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,UAAU,EACV,oBAAoB,GAAG,IAAI,GAK5B,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAA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AAA,cAAc,kBA2BzB"}
|
@@ -2,8 +2,8 @@ import { pdfRender } from './pdfRender.js';
|
|
2
2
|
import { getPropPanelByBarcodeType } from './propPanel.js';
|
3
3
|
import { uiRender } from './uiRender.js';
|
4
4
|
import { BARCODE_TYPES } from './constants.js';
|
5
|
-
const
|
5
|
+
const barcodes = BARCODE_TYPES.reduce((acc, type) => Object.assign(acc, {
|
6
6
|
[type]: { pdf: pdfRender, ui: uiRender, propPanel: getPropPanelByBarcodeType(type) },
|
7
7
|
}), {});
|
8
|
-
export default
|
8
|
+
export default barcodes;
|
9
9
|
//# sourceMappingURL=index.js.map
|