@pdfme/schemas 3.1.5-dev.9 → 3.2.0
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/index.js +2 -2
- package/dist/cjs/src/barcodes/index.js.map +1 -1
- package/dist/cjs/src/barcodes/pdfRender.js +2 -2
- package/dist/cjs/src/barcodes/pdfRender.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 +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/index.js +2 -2
- package/dist/esm/src/barcodes/index.js.map +1 -1
- package/dist/esm/src/barcodes/pdfRender.js +1 -1
- package/dist/esm/src/barcodes/pdfRender.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 +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/index.d.ts +2 -2
- 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/index.ts +2 -2
- package/src/barcodes/pdfRender.ts +1 -1
- package/src/barcodes/propPanel.ts +1 -1
- 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
@@ -1,13 +1,39 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const common_1 = require("@pdfme/common");
|
4
|
-
const
|
4
|
+
const utils_1 = require("../src/utils");
|
5
|
+
describe('hex2RgbColor', () => {
|
6
|
+
it('should convert hex to rgb', () => {
|
7
|
+
const hex = '#000000';
|
8
|
+
const rgbValue = (0, utils_1.hex2RgbColor)(hex);
|
9
|
+
expect(rgbValue).toEqual({ red: 0, green: 0, blue: 0, type: 'RGB' });
|
10
|
+
});
|
11
|
+
it('should convert hex to rgb with a short hex', () => {
|
12
|
+
const hex = '#fff';
|
13
|
+
const rgbValue = (0, utils_1.hex2RgbColor)(hex);
|
14
|
+
expect(rgbValue).toEqual({ red: 1, green: 1, blue: 1, type: 'RGB' });
|
15
|
+
});
|
16
|
+
it('should convert hex to rgb for non-trivial color', () => {
|
17
|
+
const hex = '#33af5a';
|
18
|
+
const rgbValue = (0, utils_1.hex2RgbColor)(hex);
|
19
|
+
expect(rgbValue).toEqual({
|
20
|
+
red: 0.2,
|
21
|
+
green: 0.6862745098039216,
|
22
|
+
blue: 0.35294117647058826,
|
23
|
+
type: 'RGB',
|
24
|
+
});
|
25
|
+
});
|
26
|
+
it('should throw an error if hex is invalid', () => {
|
27
|
+
const hex = '#fffee';
|
28
|
+
expect(() => (0, utils_1.hex2RgbColor)(hex)).toThrowError('Invalid hex color value #ff');
|
29
|
+
});
|
30
|
+
});
|
5
31
|
describe('rotatePoint', () => {
|
6
32
|
it('should rotate one point round another by 90 degrees', () => {
|
7
33
|
const point = { x: 5, y: 5 };
|
8
34
|
const pivot = { x: 0, y: 0 };
|
9
35
|
const angle = 90;
|
10
|
-
const { x, y } = (0,
|
36
|
+
const { x, y } = (0, utils_1.rotatePoint)(point, pivot, angle);
|
11
37
|
expect(x).toEqual(-5);
|
12
38
|
expect(y).toEqual(5);
|
13
39
|
});
|
@@ -15,7 +41,7 @@ describe('rotatePoint', () => {
|
|
15
41
|
const point = { x: 5, y: 5 };
|
16
42
|
const pivot = { x: 0, y: 0 };
|
17
43
|
const angle = 180;
|
18
|
-
const { x, y } = (0,
|
44
|
+
const { x, y } = (0, utils_1.rotatePoint)(point, pivot, angle);
|
19
45
|
expect(x).toBeCloseTo(-5);
|
20
46
|
expect(y).toBeCloseTo(-5);
|
21
47
|
});
|
@@ -23,7 +49,7 @@ describe('rotatePoint', () => {
|
|
23
49
|
const point = { x: 10, y: 10 };
|
24
50
|
const pivot = { x: 10, y: 10 };
|
25
51
|
const angle = 221;
|
26
|
-
const { x, y } = (0,
|
52
|
+
const { x, y } = (0, utils_1.rotatePoint)(point, pivot, angle);
|
27
53
|
expect(x).toEqual(10);
|
28
54
|
expect(y).toEqual(10);
|
29
55
|
});
|
@@ -31,7 +57,7 @@ describe('rotatePoint', () => {
|
|
31
57
|
const point = { x: 10, y: 10 };
|
32
58
|
const pivot = { x: 5, y: 5 };
|
33
59
|
const angle = 45;
|
34
|
-
const { x, y } = (0,
|
60
|
+
const { x, y } = (0, utils_1.rotatePoint)(point, pivot, angle);
|
35
61
|
expect(x).toBeCloseTo(5);
|
36
62
|
expect(y).toBeCloseTo(12.07);
|
37
63
|
});
|
@@ -44,10 +70,10 @@ describe('convertForPdfLayoutProps', () => {
|
|
44
70
|
height: 100,
|
45
71
|
position: { x: 100, y: 100 },
|
46
72
|
rotate: 0,
|
47
|
-
opacity: 1
|
73
|
+
opacity: 1,
|
48
74
|
};
|
49
75
|
const pageHeight = 1000;
|
50
|
-
const { position: { x, y }, height, width, rotate, opacity } = (0,
|
76
|
+
const { position: { x, y }, height, width, rotate, opacity, } = (0, utils_1.convertForPdfLayoutProps)({ schema, pageHeight });
|
51
77
|
expect(opacity).toEqual(schema.opacity);
|
52
78
|
expect(height).toEqual((0, common_1.mm2pt)(schema.height));
|
53
79
|
expect(width).toEqual((0, common_1.mm2pt)(schema.width));
|
@@ -62,10 +88,10 @@ describe('convertForPdfLayoutProps', () => {
|
|
62
88
|
height: 120,
|
63
89
|
position: { x: 100, y: 100 },
|
64
90
|
rotate: 90,
|
65
|
-
opacity: 1
|
91
|
+
opacity: 1,
|
66
92
|
};
|
67
93
|
const pageHeight = 1000;
|
68
|
-
const { position: { x, y }, height, width, rotate, opacity } = (0,
|
94
|
+
const { position: { x, y }, height, width, rotate, opacity, } = (0, utils_1.convertForPdfLayoutProps)({ schema, pageHeight });
|
69
95
|
expect(opacity).toBeCloseTo(1);
|
70
96
|
expect((0, common_1.pt2mm)(width)).toBeCloseTo(50);
|
71
97
|
expect((0, common_1.pt2mm)(height)).toBeCloseTo(120.005);
|
@@ -80,10 +106,10 @@ describe('convertForPdfLayoutProps', () => {
|
|
80
106
|
height: 120,
|
81
107
|
position: { x: 100, y: 100 },
|
82
108
|
rotate: 90,
|
83
|
-
opacity: 1
|
109
|
+
opacity: 1,
|
84
110
|
};
|
85
111
|
const pageHeight = 1000;
|
86
|
-
const { position: { x, y }, height, width, rotate, opacity } = (0,
|
112
|
+
const { position: { x, y }, height, width, rotate, opacity, } = (0, utils_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
|
87
113
|
expect(opacity).toBeCloseTo(1);
|
88
114
|
expect((0, common_1.pt2mm)(width)).toBeCloseTo(50);
|
89
115
|
expect((0, common_1.pt2mm)(height)).toBeCloseTo(120.005);
|
@@ -92,4 +118,4 @@ describe('convertForPdfLayoutProps', () => {
|
|
92
118
|
expect(rotate).toEqual({ angle: -90, type: 'degrees' });
|
93
119
|
});
|
94
120
|
});
|
95
|
-
//# sourceMappingURL=
|
121
|
+
//# sourceMappingURL=utils.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.test.js","sourceRoot":"","sources":["../../../__tests__/utils.test.ts"],"names":[],"mappings":";;AAAA,0CAAqD;AACrD,wCAAmF;AAEnF,QAAQ,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,IAAA,gCAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;QAElF,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAA,cAAK,EAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACrC,MAAM,CAAC,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,CAAC,IAAA,cAAK,EAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAA,cAAK,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAA,cAAK,EAAC,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;QAC1E,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -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"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.pdfRender = void 0;
|
4
|
-
const
|
4
|
+
const utils_js_1 = require("../utils.js");
|
5
5
|
const helper_js_1 = require("./helper.js");
|
6
6
|
const getBarcodeCacheKey = (schema, value) => {
|
7
7
|
return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}`;
|
@@ -18,7 +18,7 @@ const pdfRender = async (arg) => {
|
|
18
18
|
_cache.set(inputBarcodeCacheKey, image);
|
19
19
|
}
|
20
20
|
const pageHeight = page.getHeight();
|
21
|
-
const { width, height, rotate, position: { x, y }, opacity, } = (0,
|
21
|
+
const { width, height, rotate, position: { x, y }, opacity, } = (0, utils_js_1.convertForPdfLayoutProps)({ schema, pageHeight });
|
22
22
|
page.drawImage(image, { x, y, rotate, width, height, opacity });
|
23
23
|
};
|
24
24
|
exports.pdfRender = pdfRender;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/barcodes/pdfRender.ts"],"names":[],"mappings":";;;AACA,
|
1
|
+
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/barcodes/pdfRender.ts"],"names":[],"mappings":";;;AACA,0CAAuD;AAEvD,2CAAkE;AAElE,MAAM,kBAAkB,GAAG,CAAC,MAAqB,EAAE,KAAa,EAAE,EAAE;IAClE,OAAO,GAAG,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,SAAS,GAAG,KAAK,EAAE,CAAC;AAChG,CAAC,CAAC;AAEK,MAAM,SAAS,GAAG,KAAK,EAAE,GAAkC,EAAE,EAAE;IACpE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACpD,IAAI,CAAC,IAAA,gCAAoB,EAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO;IAEtD,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/D,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC7C,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAa,EAClC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAC3D,CAAC;QACF,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;KACzC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,IAAA,mCAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAxBW,QAAA,SAAS,aAwBpB"}
|
@@ -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;AACF,MAAM,iBAAiB,GAAG,EAAE,SAAS,EAAE,oCAAqB,EAAE,CAAC;AAC/D,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAChC,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE/C,MAAM,eAAe,GAA6D;IAChF;QACE,YAAY,EAAE,oBAAoB;QACl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,KAAK,WAAW,CAAC,CAAC;IAEjG,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,
|
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;AACF,MAAM,iBAAiB,GAAG,EAAE,SAAS,EAAE,oCAAqB,EAAE,CAAC;AAC/D,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAChC,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE/C,MAAM,eAAe,GAA6D;IAChF;QACE,YAAY,EAAE,oBAAoB;QAClC,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ;YACR,GAAG,aAAa;YAChB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;IACD;QACE,YAAY,EAAE,kBAAkB;QAChC,aAAa,EAAE;YACb,IAAI,EAAE,WAAW;YACjB,QAAQ;YACR,GAAG,aAAa;YAChB,GAAG,iBAAiB;YACpB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,GAAG;YACX,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;IACD;QACE,YAAY,EAAE,eAAe;QAC7B,aAAa,EAAE;YACb,IAAI,EAAE,OAAO;YACb,QAAQ;YACR,GAAG,aAAa;YAChB,GAAG,iBAAiB;YACpB,GAAG,YAAY;YACf,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;IACD;QACE,YAAY,EAAE,UAAU;QACxB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F;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"}
|
@@ -2,31 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.uiRender = void 0;
|
4
4
|
const helper_js_1 = require("./helper.js");
|
5
|
-
const
|
5
|
+
const utils_js_1 = require("../utils.js");
|
6
6
|
const fullSize = { width: '100%', height: '100%' };
|
7
|
-
const createErrorBarcodeElm = () => {
|
8
|
-
const container = document.createElement('div');
|
9
|
-
const containerStyle = {
|
10
|
-
display: 'flex',
|
11
|
-
alignItems: 'center',
|
12
|
-
justifyContent: 'center',
|
13
|
-
...fullSize,
|
14
|
-
};
|
15
|
-
Object.assign(container.style, containerStyle);
|
16
|
-
const span = document.createElement('span');
|
17
|
-
const spanStyle = {
|
18
|
-
color: 'white',
|
19
|
-
background: 'red',
|
20
|
-
padding: '0.25rem',
|
21
|
-
fontSize: '12pt',
|
22
|
-
fontWeight: 'bold',
|
23
|
-
borderRadius: '2px',
|
24
|
-
};
|
25
|
-
Object.assign(span.style, spanStyle);
|
26
|
-
span.textContent = 'ERROR';
|
27
|
-
container.appendChild(span);
|
28
|
-
return container;
|
29
|
-
};
|
30
7
|
const blobToDataURL = (blob) => new Promise((resolve, reject) => {
|
31
8
|
const reader = new FileReader();
|
32
9
|
reader.onloadend = () => resolve(reader.result);
|
@@ -62,16 +39,17 @@ const uiRender = async (arg) => {
|
|
62
39
|
};
|
63
40
|
Object.assign(container.style, containerStyle);
|
64
41
|
rootElement.appendChild(container);
|
65
|
-
const editable = (0,
|
42
|
+
const editable = (0, utils_js_1.isEditable)(mode, schema);
|
66
43
|
if (editable) {
|
67
44
|
const input = document.createElement('input');
|
68
45
|
const inputStyle = {
|
69
|
-
|
46
|
+
width: '100%',
|
70
47
|
position: 'absolute',
|
71
48
|
textAlign: 'center',
|
72
|
-
fontSize: '
|
73
|
-
|
74
|
-
|
49
|
+
fontSize: '12pt',
|
50
|
+
fontWeight: 'bold',
|
51
|
+
color: theme.colorWhite,
|
52
|
+
backgroundColor: editable || value ? (0, utils_js_1.addAlphaToHex)('#000000', 80) : 'none',
|
75
53
|
border: 'none',
|
76
54
|
display: 'flex',
|
77
55
|
alignItems: 'center',
|
@@ -96,14 +74,13 @@ const uiRender = async (arg) => {
|
|
96
74
|
return;
|
97
75
|
try {
|
98
76
|
if (!(0, helper_js_1.validateBarcodeInput)(schema.type, value))
|
99
|
-
throw new Error('[@pdfme/schemas] Invalid barcode input');
|
77
|
+
throw new Error('[@pdfme/schemas/barcodes] Invalid barcode input');
|
100
78
|
const imgElm = await createBarcodeImageElm(schema, value);
|
101
79
|
container.appendChild(imgElm);
|
102
80
|
}
|
103
81
|
catch (err) {
|
104
82
|
console.error(`[@pdfme/ui] ${err}`);
|
105
|
-
|
106
|
-
container.appendChild(errorBarcodeElm);
|
83
|
+
container.appendChild((0, utils_js_1.createErrorElm)());
|
107
84
|
}
|
108
85
|
};
|
109
86
|
exports.uiRender = uiRender;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/barcodes/uiRender.ts"],"names":[],"mappings":";;;AAGA,2CAAkE;AAClE,
|
1
|
+
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/barcodes/uiRender.ts"],"names":[],"mappings":";;;AAGA,2CAAkE;AAClE,0CAAwE;AAExE,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,aAAa,GAAG,CAAC,IAAU,EAAmB,EAAE,CACpD,IA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,WAAW,GAAG,WAAW,IAAI,EAAE,CAAC;QACtC,KAAK,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;QAC/B,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAQ,EAAE,EAAE;YAC5C,QAAQ,IAAI,QAAQ,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAC;QAC7D,CAAC,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,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,EAAE;YACtB,OAAO,IAAI,CAAC;SACb;KACF;IAED,MAAM,IAAI,SAAS,CACjB,iDAAiD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAC9F,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,SAAS,aAapB;AACF,+BAA+B"}
|
@@ -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+RCAAAAAXNSR0IArs4c6QAAABtQTFRFAAAAR3BMAAAAAAAAAAAAAAAAAAAAAAAAAAAAqmQqwQAAAAh0Uk5TDQAvVYGtxusE1uR9AAAKg0lEQVR42tTbwU7bQBDG8TWoPeOBPoBbdbhiVMGV0Kr0GChSe0RtRfccEOROnP0eu8ckTMHrjD27/h4Afvo7u4kUxZXbjuboZ+Hx9vrz+6J8eW5rJKPHhYfr46J/JHn0u/DnuHcko/eF71Ub0j6k3P1Rr0jGIHs4bkPah5RbnveHZMBQ6VKHlMqjnpCMAdfUApk8pNx91QeSMex+C2R2IYFwrkcyht6yEsjkIeXutEjG8AtnApldSGBRqJAMk10JZHYhgaZSIBlG+yWQipAGKZ0ipNmr0uUaEmiKLZEMw52tkLqQD7f6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PrXmWEi5KUEJBa//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,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,EAAE,KAAK,EAAE,MAAM,E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