@pdfme/schemas 3.1.5-dev.12 → 3.1.5-dev.13
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 +8 -8
- package/dist/cjs/__tests__/renderUtils.test.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/uiRender.js +3 -3
- package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
- package/dist/cjs/src/graphics/image.js +122 -0
- package/dist/cjs/src/graphics/image.js.map +1 -0
- package/dist/cjs/src/index.js +13 -10
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/{renderUtils.js → pdfRenderUtils.js} +2 -5
- package/dist/cjs/src/pdfRenderUtils.js.map +1 -0
- 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/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/uiRenderUtils.js +29 -0
- package/dist/cjs/src/uiRenderUtils.js.map +1 -0
- package/dist/esm/__tests__/renderUtils.test.js +1 -1
- package/dist/esm/__tests__/renderUtils.test.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/uiRender.js +1 -1
- package/dist/esm/src/barcodes/uiRender.js.map +1 -1
- package/dist/esm/src/graphics/image.js +120 -0
- package/dist/esm/src/graphics/image.js.map +1 -0
- package/dist/esm/src/index.js +5 -4
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/{renderUtils.js → pdfRenderUtils.js} +2 -5
- package/dist/esm/src/pdfRenderUtils.js.map +1 -0
- 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/pdfRender.js +1 -1
- package/dist/esm/src/text/pdfRender.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/uiRenderUtils.js +25 -0
- package/dist/esm/src/uiRenderUtils.js.map +1 -0
- package/dist/types/src/{image/index.d.ts → graphics/image.d.ts} +3 -1
- package/dist/types/src/index.d.ts +5 -4
- package/dist/types/src/shapes/line.d.ts +6 -0
- package/dist/types/src/shapes/rectAndEllipse.d.ts +138 -0
- package/dist/types/src/uiRenderUtils.d.ts +1 -0
- package/package.json +1 -1
- package/src/barcodes/pdfRender.ts +1 -1
- package/src/barcodes/uiRender.ts +1 -1
- package/src/graphics/image.ts +151 -0
- package/src/index.ts +15 -4
- package/src/{renderUtils.ts → pdfRenderUtils.ts} +1 -4
- package/src/shapes/line.ts +67 -0
- package/src/shapes/rectAndEllipse.ts +110 -0
- package/src/text/pdfRender.ts +1 -1
- package/src/text/uiRender.ts +1 -1
- package/src/uiRenderUtils.ts +27 -0
- 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 -113
- 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/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 -109
- 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/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 -123
- 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/src/{renderUtils.d.ts → pdfRenderUtils.d.ts} +0 -0
@@ -1,13 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const common_1 = require("@pdfme/common");
|
4
|
-
const
|
4
|
+
const pdfRenderUtils_1 = require("../src/pdfRenderUtils");
|
5
5
|
describe('rotatePoint', () => {
|
6
6
|
it('should rotate one point round another by 90 degrees', () => {
|
7
7
|
const point = { x: 5, y: 5 };
|
8
8
|
const pivot = { x: 0, y: 0 };
|
9
9
|
const angle = 90;
|
10
|
-
const { x, y } = (0,
|
10
|
+
const { x, y } = (0, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
|
11
11
|
expect(x).toEqual(-5);
|
12
12
|
expect(y).toEqual(5);
|
13
13
|
});
|
@@ -15,7 +15,7 @@ describe('rotatePoint', () => {
|
|
15
15
|
const point = { x: 5, y: 5 };
|
16
16
|
const pivot = { x: 0, y: 0 };
|
17
17
|
const angle = 180;
|
18
|
-
const { x, y } = (0,
|
18
|
+
const { x, y } = (0, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
|
19
19
|
expect(x).toBeCloseTo(-5);
|
20
20
|
expect(y).toBeCloseTo(-5);
|
21
21
|
});
|
@@ -23,7 +23,7 @@ describe('rotatePoint', () => {
|
|
23
23
|
const point = { x: 10, y: 10 };
|
24
24
|
const pivot = { x: 10, y: 10 };
|
25
25
|
const angle = 221;
|
26
|
-
const { x, y } = (0,
|
26
|
+
const { x, y } = (0, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
|
27
27
|
expect(x).toEqual(10);
|
28
28
|
expect(y).toEqual(10);
|
29
29
|
});
|
@@ -31,7 +31,7 @@ describe('rotatePoint', () => {
|
|
31
31
|
const point = { x: 10, y: 10 };
|
32
32
|
const pivot = { x: 5, y: 5 };
|
33
33
|
const angle = 45;
|
34
|
-
const { x, y } = (0,
|
34
|
+
const { x, y } = (0, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
|
35
35
|
expect(x).toBeCloseTo(5);
|
36
36
|
expect(y).toBeCloseTo(12.07);
|
37
37
|
});
|
@@ -47,7 +47,7 @@ describe('convertForPdfLayoutProps', () => {
|
|
47
47
|
opacity: 1
|
48
48
|
};
|
49
49
|
const pageHeight = 1000;
|
50
|
-
const { position: { x, y }, height, width, rotate, opacity } = (0,
|
50
|
+
const { position: { x, y }, height, width, rotate, opacity } = (0, pdfRenderUtils_1.convertForPdfLayoutProps)({ schema, pageHeight });
|
51
51
|
expect(opacity).toEqual(schema.opacity);
|
52
52
|
expect(height).toEqual((0, common_1.mm2pt)(schema.height));
|
53
53
|
expect(width).toEqual((0, common_1.mm2pt)(schema.width));
|
@@ -65,7 +65,7 @@ describe('convertForPdfLayoutProps', () => {
|
|
65
65
|
opacity: 1
|
66
66
|
};
|
67
67
|
const pageHeight = 1000;
|
68
|
-
const { position: { x, y }, height, width, rotate, opacity } = (0,
|
68
|
+
const { position: { x, y }, height, width, rotate, opacity } = (0, pdfRenderUtils_1.convertForPdfLayoutProps)({ schema, pageHeight });
|
69
69
|
expect(opacity).toBeCloseTo(1);
|
70
70
|
expect((0, common_1.pt2mm)(width)).toBeCloseTo(50);
|
71
71
|
expect((0, common_1.pt2mm)(height)).toBeCloseTo(120.005);
|
@@ -83,7 +83,7 @@ describe('convertForPdfLayoutProps', () => {
|
|
83
83
|
opacity: 1
|
84
84
|
};
|
85
85
|
const pageHeight = 1000;
|
86
|
-
const { position: { x, y }, height, width, rotate, opacity } = (0,
|
86
|
+
const { position: { x, y }, height, width, rotate, opacity } = (0, pdfRenderUtils_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
|
87
87
|
expect(opacity).toBeCloseTo(1);
|
88
88
|
expect((0, common_1.pt2mm)(width)).toBeCloseTo(50);
|
89
89
|
expect((0, common_1.pt2mm)(height)).toBeCloseTo(120.005);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderUtils.test.js","sourceRoot":"","sources":["../../../__tests__/renderUtils.test.ts"],"names":[],"mappings":";;AAAA,0CAAqD;AACrD,
|
1
|
+
{"version":3,"file":"renderUtils.test.js","sourceRoot":"","sources":["../../../__tests__/renderUtils.test.ts"],"names":[],"mappings":";;AAAA,0CAAqD;AACrD,0DAA8E;AAE9E,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,EAAE,CAAC;QAEjB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAA,4BAAW,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAClD,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,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,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,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 pdfRenderUtils_js_1 = require("../pdfRenderUtils.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, pdfRenderUtils_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,4DAAgE;AAEhE,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,4CAAwB,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"}
|
@@ -2,7 +2,7 @@
|
|
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 pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
|
6
6
|
const fullSize = { width: '100%', height: '100%' };
|
7
7
|
const createErrorBarcodeElm = () => {
|
8
8
|
const container = document.createElement('div');
|
@@ -62,7 +62,7 @@ const uiRender = async (arg) => {
|
|
62
62
|
};
|
63
63
|
Object.assign(container.style, containerStyle);
|
64
64
|
rootElement.appendChild(container);
|
65
|
-
const editable = (0,
|
65
|
+
const editable = (0, pdfRenderUtils_js_1.isEditable)(mode);
|
66
66
|
if (editable) {
|
67
67
|
const input = document.createElement('input');
|
68
68
|
const inputStyle = {
|
@@ -72,7 +72,7 @@ const uiRender = async (arg) => {
|
|
72
72
|
fontSize: '12pt',
|
73
73
|
fontWeight: 'bold',
|
74
74
|
color: theme.colorWhite,
|
75
|
-
backgroundColor: editable || value ? (0,
|
75
|
+
backgroundColor: editable || value ? (0, pdfRenderUtils_js_1.addAlphaToHex)('#000000', 80) : 'none',
|
76
76
|
border: 'none',
|
77
77
|
display: 'flex',
|
78
78
|
alignItems: 'center',
|
@@ -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,4DAAiE;AAEjE,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,cAAc,GAAmB;QACrC,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,QAAQ;KACZ,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAA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AAC;QAC5D,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,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;QAChD,SAAS,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;KACxC;AACH,CAAC,CAAC;AAzDW,QAAA,QAAQ,YAyDnB"}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const common_1 = require("@pdfme/common");
|
4
|
+
const pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
|
5
|
+
const uiRenderUtils_js_1 = require("../uiRenderUtils.js");
|
6
|
+
const constants_js_1 = require("../constants.js");
|
7
|
+
const getCacheKey = (schema, input) => `${schema.type}${input}`;
|
8
|
+
const fullSize = { width: '100%', height: '100%' };
|
9
|
+
const defaultValue = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAALuAQMAAADL0wGJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURbzAw+rv8fKruy0AAAPoSURBVHja7dwxbtwwEEBRCkKwRQodYftcYk+ROkcJz5NTsEuZK/AIKlIQAUEnke0VqQ0pA5zxWvFnZcD2s0CNuENxPOZBc0QDDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PD/+P8bkxvnTzzjTG0M2b5rh08rHNT518aPOnTt63+aGTd23edPJ2h//ax+/oO6Gzx6c78+cuPu7x01vmwx5/6uLnO/PjO+b/rGifvtWH3VnT9vmh/e3eqx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page, _cache } = arg;
|
13
|
+
if (!value || !value.startsWith('data:image/'))
|
14
|
+
return;
|
15
|
+
const inputImageCacheKey = getCacheKey(schema, value);
|
16
|
+
let image = _cache.get(inputImageCacheKey);
|
17
|
+
if (!image) {
|
18
|
+
const isPng = value.startsWith('data:image/png;');
|
19
|
+
image = await (isPng ? pdfDoc.embedPng(value) : pdfDoc.embedJpg(value));
|
20
|
+
_cache.set(inputImageCacheKey, image);
|
21
|
+
}
|
22
|
+
const pageHeight = page.getHeight();
|
23
|
+
const { width, height, rotate, position: { x, y }, opacity, } = (0, pdfRenderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight });
|
24
|
+
page.drawImage(image, { x, y, rotate, width, height, opacity });
|
25
|
+
},
|
26
|
+
ui: (arg) => {
|
27
|
+
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme, } = arg;
|
28
|
+
const editable = (0, pdfRenderUtils_js_1.isEditable)(mode);
|
29
|
+
const isDefault = value === defaultValue;
|
30
|
+
const size = { width: schema.width * common_1.ZOOM, height: schema.height * common_1.ZOOM };
|
31
|
+
const container = document.createElement('div');
|
32
|
+
const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
|
33
|
+
const containerStyle = {
|
34
|
+
...fullSize,
|
35
|
+
backgroundImage: value ? 'none' : backgroundStyle,
|
36
|
+
backgroundSize: `${size.width}px ${size.height}px`,
|
37
|
+
};
|
38
|
+
Object.assign(container.style, containerStyle);
|
39
|
+
container.addEventListener('click', (e) => {
|
40
|
+
if (editable) {
|
41
|
+
e.stopPropagation();
|
42
|
+
}
|
43
|
+
});
|
44
|
+
rootElement.appendChild(container);
|
45
|
+
// image tag
|
46
|
+
if (value) {
|
47
|
+
const img = document.createElement('img');
|
48
|
+
const imgStyle = { height: '100%', width: '100%', borderRadius: 0 };
|
49
|
+
Object.assign(img.style, imgStyle);
|
50
|
+
img.src = value;
|
51
|
+
container.appendChild(img);
|
52
|
+
}
|
53
|
+
// remove button
|
54
|
+
if (value && !isDefault && editable) {
|
55
|
+
const button = document.createElement('button');
|
56
|
+
button.textContent = 'x';
|
57
|
+
const buttonStyle = {
|
58
|
+
position: 'absolute',
|
59
|
+
top: 0,
|
60
|
+
left: 0,
|
61
|
+
zIndex: 1,
|
62
|
+
display: 'flex',
|
63
|
+
justifyContent: 'center',
|
64
|
+
alignItems: 'center',
|
65
|
+
color: '#333',
|
66
|
+
background: '#f2f2f2',
|
67
|
+
borderRadius: '2px',
|
68
|
+
border: '1px solid #767676',
|
69
|
+
cursor: 'pointer',
|
70
|
+
height: '24px',
|
71
|
+
width: '24px',
|
72
|
+
};
|
73
|
+
Object.assign(button.style, buttonStyle);
|
74
|
+
button.addEventListener('click', () => {
|
75
|
+
onChange && onChange('');
|
76
|
+
});
|
77
|
+
container.appendChild(button);
|
78
|
+
}
|
79
|
+
// file input
|
80
|
+
if ((!value || isDefault) && editable) {
|
81
|
+
const label = document.createElement('label');
|
82
|
+
const labelStyle = {
|
83
|
+
...fullSize,
|
84
|
+
display: editable ? 'flex' : 'none',
|
85
|
+
position: 'absolute',
|
86
|
+
top: 0,
|
87
|
+
backgroundColor: editable || value ? (0, pdfRenderUtils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30) : 'none',
|
88
|
+
cursor: 'pointer',
|
89
|
+
};
|
90
|
+
Object.assign(label.style, labelStyle);
|
91
|
+
container.appendChild(label);
|
92
|
+
const input = document.createElement('input');
|
93
|
+
const inputStyle = { ...fullSize, position: 'absolute', top: '50%' };
|
94
|
+
Object.assign(input.style, inputStyle);
|
95
|
+
input.tabIndex = tabIndex || 0;
|
96
|
+
input.type = 'file';
|
97
|
+
input.accept = 'image/jpeg, image/png';
|
98
|
+
input.addEventListener('change', (event) => {
|
99
|
+
const changeEvent = event;
|
100
|
+
(0, uiRenderUtils_js_1.readFile)(changeEvent.target.files).then((result) => onChange && onChange(result));
|
101
|
+
});
|
102
|
+
input.addEventListener('blur', () => stopEditing && stopEditing());
|
103
|
+
label.appendChild(input);
|
104
|
+
}
|
105
|
+
},
|
106
|
+
propPanel: {
|
107
|
+
schema: {},
|
108
|
+
defaultValue,
|
109
|
+
defaultSchema: {
|
110
|
+
type: 'image',
|
111
|
+
position: { x: 0, y: 0 },
|
112
|
+
width: 40,
|
113
|
+
height: 40,
|
114
|
+
// If the value of "rotate" is set to undefined or not set at all, rotation will be disabled in the UI.
|
115
|
+
// Check this document: https://pdfme.com//docs/custom-schemas#learning-how-to-create-from-pdfmeschemas-code
|
116
|
+
rotate: 0,
|
117
|
+
opacity: constants_js_1.DEFAULT_OPACITY,
|
118
|
+
},
|
119
|
+
},
|
120
|
+
};
|
121
|
+
exports.default = schema;
|
122
|
+
//# sourceMappingURL=image.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/graphics/image.ts"],"names":[],"mappings":";;AAIA,0CAAoD;AACpD,4DAA2F;AAC3F,0DAA+C;AAC/C,kDAAkD;AAElD,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,w9CAAw9C,CAAC;AAI39C,MAAM,MAAM,GAAwB;IAClC,GAAG,EAAE,KAAK,EAAE,GAAgC,EAAE,EAAE;QAC9C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QACpD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;YAAE,OAAO;QAEvD,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACtD,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAA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AG,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;YACrF,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YACvC,KAAK,CAAC,QAAQ,GAAG,QAAQ,IAAI,CAAC,CAAC;YAC/B,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;YACpB,KAAK,CAAC,MAAM,GAAG,uBAAuB,CAAC;YACvC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,KAAY,EAAE,EAAE;gBAChD,MAAM,WAAW,GAAG,KAAiD,CAAC;gBACtE,IAAA,2BAAQ,EAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAgB,CAAC,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;AACF,kBAAe,MAAM,CAAC"}
|
package/dist/cjs/src/index.js
CHANGED
@@ -3,18 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.rotatePoint = exports.convertForPdfLayoutProps = exports.builtInPlugins = exports.line = exports.barcodes = exports.image = exports.text = void 0;
|
6
|
+
exports.rotatePoint = exports.convertForPdfLayoutProps = exports.builtInPlugins = exports.ellipse = exports.rectangle = exports.line = exports.barcodes = exports.image = exports.text = void 0;
|
7
7
|
const index_js_1 = __importDefault(require("./text/index.js"));
|
8
8
|
exports.text = index_js_1.default;
|
9
|
-
const
|
10
|
-
exports.image =
|
11
|
-
const
|
12
|
-
exports.barcodes =
|
13
|
-
const
|
14
|
-
exports.line =
|
15
|
-
const
|
16
|
-
Object.defineProperty(exports, "
|
17
|
-
Object.defineProperty(exports, "
|
9
|
+
const image_js_1 = __importDefault(require("./graphics/image.js"));
|
10
|
+
exports.image = image_js_1.default;
|
11
|
+
const index_js_2 = __importDefault(require("./barcodes/index.js"));
|
12
|
+
exports.barcodes = index_js_2.default;
|
13
|
+
const line_js_1 = __importDefault(require("./shapes/line.js"));
|
14
|
+
exports.line = line_js_1.default;
|
15
|
+
const rectAndEllipse_js_1 = require("./shapes/rectAndEllipse.js");
|
16
|
+
Object.defineProperty(exports, "rectangle", { enumerable: true, get: function () { return rectAndEllipse_js_1.rectangle; } });
|
17
|
+
Object.defineProperty(exports, "ellipse", { enumerable: true, get: function () { return rectAndEllipse_js_1.ellipse; } });
|
18
|
+
const pdfRenderUtils_js_1 = require("./pdfRenderUtils.js");
|
19
|
+
Object.defineProperty(exports, "convertForPdfLayoutProps", { enumerable: true, get: function () { return pdfRenderUtils_js_1.convertForPdfLayoutProps; } });
|
20
|
+
Object.defineProperty(exports, "rotatePoint", { enumerable: true, get: function () { return pdfRenderUtils_js_1.rotatePoint; } });
|
18
21
|
const builtInPlugins = { Text: index_js_1.default };
|
19
22
|
exports.builtInPlugins = builtInPlugins;
|
20
23
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAmC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAmC;AAUjC,eAVK,kBAAI,CAUL;AATN,mEAAwC;AAUtC,gBAVK,kBAAK,CAUL;AATP,mEAA2C;AAUzC,mBAVK,kBAAQ,CAUL;AATV,+DAAoC;AAUlC,eAVK,iBAAI,CAUL;AATN,kEAAgE;AAU9D,0FAVO,6BAAS,OAUP;AACT,wFAXkB,2BAAO,OAWlB;AAVT,2DAA4E;AAY1E,yGAZO,4CAAwB,OAYP;AACxB,4FAbiC,+BAAW,OAajC;AAXb,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,kBAAI,EAAE,CAAC;AASpC,wCAAc"}
|
@@ -23,10 +23,7 @@ const convertForPdfLayoutProps = ({ schema, pageHeight, applyRotateTranslate = t
|
|
23
23
|
y = rotatedPoint.y;
|
24
24
|
}
|
25
25
|
return {
|
26
|
-
position: {
|
27
|
-
x: x,
|
28
|
-
y: y,
|
29
|
-
},
|
26
|
+
position: { x, y },
|
30
27
|
height: height,
|
31
28
|
width: width,
|
32
29
|
rotate: (0, pdf_lib_1.degrees)(rotateDegrees),
|
@@ -83,4 +80,4 @@ const hex2RgbColor = (hexString) => {
|
|
83
80
|
return undefined;
|
84
81
|
};
|
85
82
|
exports.hex2RgbColor = hex2RgbColor;
|
86
|
-
//# sourceMappingURL=
|
83
|
+
//# sourceMappingURL=pdfRenderUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pdfRenderUtils.js","sourceRoot":"","sources":["../../../src/pdfRenderUtils.ts"],"names":[],"mappings":";;;AAAA,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,EAA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AA2B,SAAS,EAAE,CAAC,CAAC;SACzD;QAED,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAErC,OAAO,IAAA,aAAG,EAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;KACvC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAdW,QAAA,YAAY,gBAcvB"}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
|
4
|
+
const constants_js_1 = require("../constants.js");
|
5
|
+
const DEFAULT_LINE_COLOR = '#000000';
|
6
|
+
const schema = {
|
7
|
+
pdf: (arg) => {
|
8
|
+
const { page, schema } = arg;
|
9
|
+
const pageHeight = page.getHeight();
|
10
|
+
const { width, height, rotate, position: { x, y }, opacity, } = (0, pdfRenderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
|
11
|
+
const pivot = { x: x + width / 2, y: y + height / 2 };
|
12
|
+
page.drawLine({
|
13
|
+
start: (0, pdfRenderUtils_js_1.rotatePoint)({ x, y: y + height / 2 }, pivot, rotate.angle),
|
14
|
+
end: (0, pdfRenderUtils_js_1.rotatePoint)({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
|
15
|
+
thickness: height,
|
16
|
+
color: (0, pdfRenderUtils_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 = schema;
|
57
|
+
//# sourceMappingURL=line.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../../src/shapes/line.ts"],"names":[],"mappings":";;AACA,4DAA2F;AAC3F,kDAAoD;AAEpD,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAMrC,MAAM,MAAM,GAAuB;IACjC,GAAG,EAAE,CAAC,GAA+B,EAAE,EAAE;QACvC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;QAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,IAAA,4CAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;QAClF,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG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L;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,MAAM,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 pdfRenderUtils_js_1 = require("../pdfRenderUtils.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, pdfRenderUtils_js_1.convertForPdfLayoutProps)(cArg);
|
28
|
+
const { position: { x: x4Ellipse, y: y4Ellipse }, } = (0, pdfRenderUtils_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, pdfRenderUtils_js_1.hex2RgbColor)(schema.borderColor),
|
34
|
+
color: (0, pdfRenderUtils_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
|
+
//# sourceMappingURL=rectAndEllipse.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rectAndEllipse.js","sourceRoot":"","sources":["../../../../src/shapes/rectAndEllipse.ts"],"names":[],"mappings":";;;AAAA,0CAAsD;AACtD,kDAAoD;AACpD,4DAA8E;AAS9E,MAAM,KAAK,GAAkB;IAC3B,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;QACV,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;QACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,GAAG,CAAC,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC;QACnC,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KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,gCAAiB,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;aACzE;YACD,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC;gBAC5B,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,gCAAiB,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;aACzE;SACF,CAAC;QACF,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE;YACb,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;YACxB,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,SAAS;YAChB,QAAQ,EAAE,IAAI;SACf;KACF;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"}
|
@@ -4,7 +4,7 @@ exports.pdfRender = void 0;
|
|
4
4
|
const common_1 = require("@pdfme/common");
|
5
5
|
const constants_js_1 = require("./constants.js");
|
6
6
|
const helper_js_1 = require("./helper.js");
|
7
|
-
const
|
7
|
+
const pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
|
8
8
|
const embedAndGetFontObj = async (arg) => {
|
9
9
|
const { pdfDoc, font, _cache } = arg;
|
10
10
|
if (_cache.has(pdfDoc)) {
|
@@ -27,7 +27,7 @@ const getFontProp = async ({ value, font, schema, _cache, }) => {
|
|
27
27
|
const fontSize = schema.dynamicFontSize
|
28
28
|
? await (0, helper_js_1.calculateDynamicFontSize)({ textSchema: schema, font, value, _cache })
|
29
29
|
: schema.fontSize ?? constants_js_1.DEFAULT_FONT_SIZE;
|
30
|
-
const color = (0,
|
30
|
+
const color = (0, pdfRenderUtils_js_1.hex2RgbColor)(schema.fontColor || constants_js_1.DEFAULT_FONT_COLOR);
|
31
31
|
return {
|
32
32
|
alignment: schema.alignment ?? constants_js_1.DEFAULT_ALIGNMENT,
|
33
33
|
verticalAlignment: schema.verticalAlignment ?? constants_js_1.DEFAULT_VERTICAL_ALIGNMENT,
|
@@ -51,9 +51,9 @@ const pdfRender = async (arg) => {
|
|
51
51
|
const fontName = (schema.fontName ? schema.fontName : (0, common_1.getFallbackFontName)(font));
|
52
52
|
const pdfFontValue = pdfFontObj && pdfFontObj[fontName];
|
53
53
|
const pageHeight = page.getHeight();
|
54
|
-
const { width, height, rotate, position: { x, y }, opacity, } = (0,
|
54
|
+
const { width, height, rotate, position: { x, y }, opacity, } = (0, pdfRenderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
|
55
55
|
if (schema.backgroundColor) {
|
56
|
-
const color = (0,
|
56
|
+
const color = (0, pdfRenderUtils_js_1.hex2RgbColor)(schema.backgroundColor);
|
57
57
|
page.drawRectangle({ x, y, width, height, rotate, color });
|
58
58
|
}
|
59
59
|
page.pushOperators(pdfLib.setCharacterSpacing(characterSpacing ?? constants_js_1.DEFAULT_CHARACTER_SPACING));
|
@@ -100,7 +100,7 @@ const pdfRender = async (arg) => {
|
|
100
100
|
if (rotate.angle !== 0) {
|
101
101
|
// As we draw each line individually from different points, we must translate each lines position
|
102
102
|
// relative to the UI rotation pivot point. see comments in convertForPdfLayoutProps() for more info.
|
103
|
-
const rotatedPoint = (0,
|
103
|
+
const rotatedPoint = (0, pdfRenderUtils_js_1.rotatePoint)({ x: xLine, y: yLine }, pivotPoint, rotate.angle);
|
104
104
|
xLine = rotatedPoint.x;
|
105
105
|
yLine = rotatedPoint.y;
|
106
106
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/text/pdfRender.ts"],"names":[],"mappings":";;;AACA,0CAAiG;AAEjG,iDAUwB;AACxB,2CAOqB;AACrB,
|
1
|
+
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/text/pdfRender.ts"],"names":[],"mappings":";;;AACA,0CAAiG;AAEjG,iDAUwB;AACxB,2CAOqB;AACrB,4DAA2F;AAE3F,MAAM,kBAAkB,GAAG,KAAK,EAAE,GAIjC,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACrC,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QACtB,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,CAA+B,CAAC;KACzD;IAED,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAClC,IAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC;QACtB,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;YAC/D,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;SACnE;QACD,OAAO,MAAM,CAAC,SAA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