@pdfme/schemas 3.1.5-dev.13 → 3.1.5-dev.15

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.
Files changed (73) hide show
  1. package/dist/cjs/__tests__/{renderUtils.test.js → utils.test.js} +38 -12
  2. package/dist/cjs/__tests__/utils.test.js.map +1 -0
  3. package/dist/cjs/src/barcodes/pdfRender.js +2 -2
  4. package/dist/cjs/src/barcodes/pdfRender.js.map +1 -1
  5. package/dist/cjs/src/barcodes/uiRender.js +4 -28
  6. package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
  7. package/dist/cjs/src/graphics/image.js +80 -13
  8. package/dist/cjs/src/graphics/image.js.map +1 -1
  9. package/dist/cjs/src/graphics/svg.js +82 -0
  10. package/dist/cjs/src/graphics/svg.js.map +1 -0
  11. package/dist/cjs/src/index.js +6 -4
  12. package/dist/cjs/src/index.js.map +1 -1
  13. package/dist/cjs/src/shapes/line.js +5 -5
  14. package/dist/cjs/src/shapes/line.js.map +1 -1
  15. package/dist/cjs/src/shapes/rectAndEllipse.js +5 -5
  16. package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -1
  17. package/dist/cjs/src/text/helper.js.map +1 -1
  18. package/dist/cjs/src/text/pdfRender.js +5 -5
  19. package/dist/cjs/src/text/pdfRender.js.map +1 -1
  20. package/dist/cjs/src/text/uiRender.js +3 -3
  21. package/dist/cjs/src/text/uiRender.js.map +1 -1
  22. package/dist/cjs/src/{pdfRenderUtils.js → utils.js} +53 -2
  23. package/dist/cjs/src/utils.js.map +1 -0
  24. package/dist/esm/__tests__/{renderUtils.test.js → utils.test.js} +34 -8
  25. package/dist/esm/__tests__/utils.test.js.map +1 -0
  26. package/dist/esm/src/barcodes/pdfRender.js +1 -1
  27. package/dist/esm/src/barcodes/pdfRender.js.map +1 -1
  28. package/dist/esm/src/barcodes/uiRender.js +2 -26
  29. package/dist/esm/src/barcodes/uiRender.js.map +1 -1
  30. package/dist/esm/src/graphics/image.js +74 -10
  31. package/dist/esm/src/graphics/image.js.map +1 -1
  32. package/dist/esm/src/graphics/svg.js +80 -0
  33. package/dist/esm/src/graphics/svg.js.map +1 -0
  34. package/dist/esm/src/index.js +3 -2
  35. package/dist/esm/src/index.js.map +1 -1
  36. package/dist/esm/src/shapes/line.js +1 -1
  37. package/dist/esm/src/shapes/line.js.map +1 -1
  38. package/dist/esm/src/shapes/rectAndEllipse.js +1 -1
  39. package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -1
  40. package/dist/esm/src/text/helper.js.map +1 -1
  41. package/dist/esm/src/text/pdfRender.js +1 -1
  42. package/dist/esm/src/text/pdfRender.js.map +1 -1
  43. package/dist/esm/src/text/uiRender.js +1 -1
  44. package/dist/esm/src/text/uiRender.js.map +1 -1
  45. package/dist/esm/src/{pdfRenderUtils.js → utils.js} +50 -1
  46. package/dist/esm/src/utils.js.map +1 -0
  47. package/dist/types/src/graphics/svg.d.ts +5 -0
  48. package/dist/types/src/index.d.ts +3 -2
  49. package/dist/types/src/text/pdfRender.d.ts +1 -1
  50. package/dist/types/src/{pdfRenderUtils.d.ts → utils.d.ts} +2 -0
  51. package/package.json +6 -4
  52. package/src/barcodes/pdfRender.ts +1 -1
  53. package/src/barcodes/uiRender.ts +2 -30
  54. package/src/graphics/image.ts +86 -29
  55. package/src/graphics/svg.ts +84 -0
  56. package/src/index.ts +3 -1
  57. package/src/shapes/line.ts +1 -1
  58. package/src/shapes/rectAndEllipse.ts +1 -1
  59. package/src/text/helper.ts +0 -1
  60. package/src/text/pdfRender.ts +2 -2
  61. package/src/text/uiRender.ts +1 -1
  62. package/src/{pdfRenderUtils.ts → utils.ts} +58 -0
  63. package/dist/cjs/__tests__/renderUtils.test.js.map +0 -1
  64. package/dist/cjs/src/pdfRenderUtils.js.map +0 -1
  65. package/dist/cjs/src/uiRenderUtils.js +0 -29
  66. package/dist/cjs/src/uiRenderUtils.js.map +0 -1
  67. package/dist/esm/__tests__/renderUtils.test.js.map +0 -1
  68. package/dist/esm/src/pdfRenderUtils.js.map +0 -1
  69. package/dist/esm/src/uiRenderUtils.js +0 -25
  70. package/dist/esm/src/uiRenderUtils.js.map +0 -1
  71. package/dist/types/src/uiRenderUtils.d.ts +0 -1
  72. package/src/uiRenderUtils.ts +0 -27
  73. /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 pdfRenderUtils_1 = require("../src/pdfRenderUtils");
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, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
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, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
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, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
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, pdfRenderUtils_1.rotatePoint)(point, pivot, angle);
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, pdfRenderUtils_1.convertForPdfLayoutProps)({ schema, pageHeight });
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, pdfRenderUtils_1.convertForPdfLayoutProps)({ schema, pageHeight });
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, pdfRenderUtils_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
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=renderUtils.test.js.map
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,CAAC,cAAc,EAAE,GAAG,EA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,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"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pdfRender = void 0;
4
- const pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
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, pdfRenderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight });
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,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,I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AAM,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"}
@@ -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 pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
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,7 +39,7 @@ const uiRender = async (arg) => {
62
39
  };
63
40
  Object.assign(container.style, containerStyle);
64
41
  rootElement.appendChild(container);
65
- const editable = (0, pdfRenderUtils_js_1.isEditable)(mode);
42
+ const editable = (0, utils_js_1.isEditable)(mode);
66
43
  if (editable) {
67
44
  const input = document.createElement('input');
68
45
  const inputStyle = {
@@ -72,7 +49,7 @@ const uiRender = async (arg) => {
72
49
  fontSize: '12pt',
73
50
  fontWeight: 'bold',
74
51
  color: theme.colorWhite,
75
- backgroundColor: editable || value ? (0, pdfRenderUtils_js_1.addAlphaToHex)('#000000', 80) : 'none',
52
+ backgroundColor: editable || value ? (0, utils_js_1.addAlphaToHex)('#000000', 80) : 'none',
76
53
  border: 'none',
77
54
  display: 'flex',
78
55
  alignItems: 'center',
@@ -103,8 +80,7 @@ const uiRender = async (arg) => {
103
80
  }
104
81
  catch (err) {
105
82
  console.error(`[@pdfme/ui] ${err}`);
106
- const errorBarcodeElm = createErrorBarcodeElm();
107
- container.appendChild(errorBarcodeElm);
83
+ container.appendChild((0, utils_js_1.createErrorElm)());
108
84
  }
109
85
  };
110
86
  exports.uiRender = uiRender;
@@ -1 +1 @@
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,KA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nB,IAAI;QACF,IAAI,CAAC,IAAA,gCAAoB,EAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;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,SAAS,CAAC,WAAW,CAAC,IAAA,yBAAc,GAAE,CAAC,CAAC;KACzC;AACH,CAAC,CAAC;AAxDW,QAAA,QAAQ,YAwDnB"}
@@ -1,12 +1,41 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  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 image_size_1 = __importDefault(require("image-size"));
7
+ const buffer_1 = require("buffer");
8
+ const utils_js_1 = require("../utils.js");
6
9
  const constants_js_1 = require("../constants.js");
10
+ const px2mm = (px) => {
11
+ // http://www.endmemo.com/sconvert/millimeterpixel.php
12
+ const ratio = 0.26458333333333;
13
+ return parseFloat(String(px)) * ratio;
14
+ };
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
+ };
7
36
  const getCacheKey = (schema, input) => `${schema.type}${input}`;
8
37
  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/bc9d79af2YwEPDw8P/6r8r1GVt5VcUoZPtXxGhp9rGYEM72vbEBne1hJ5Gb6ayIvwqZppi/CxmgqL8KGaTIrwc3WDfATeV/ffIryr7r+PwNvq/vsIfH17D5/qbw/gb/mLKp/OqnycFPj14yqcJPm4vfp5VJ0cP6jyzqjy9rr2q/Dr4qzBp3V5E1wxp/V3rl8LXn32qF6fAY31Psv2NXi/5lQaH+Vuzak0eLsmPRppVPa3FPiU3QiFFDZmD4FCAh6yxV+Bn7O9isLmx2d/TGHr5rI7obDxtFkcKWyb89M2+U1/sX7Kv7Io8gaxFy5l2D/faRk++3x6PgsalV52+fwUW4j/+eGhDPuneyH/otHmp9jyfHHMLM6n4phZnI/FObA4H4qDWnF+Lo46xXlflG+I864o3xDnbVG+Ic6X9RXSfCrrK6T5WBZASPOhrFCQ5ufy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TLPGgenjx8uomkj0N73+g6V/XjknAAAAAElFTkSuQmCC';
10
39
  const schema = {
11
40
  pdf: async (arg) => {
12
41
  const { value, schema, pdfDoc, page, _cache } = arg;
@@ -19,21 +48,45 @@ const schema = {
19
48
  image = await (isPng ? pdfDoc.embedPng(value) : pdfDoc.embedJpg(value));
20
49
  _cache.set(inputImageCacheKey, image);
21
50
  }
51
+ const _schema = { ...schema, position: { ...schema.position } };
52
+ const dataUriPrefix = ';base64,';
53
+ const idx = value.indexOf(dataUriPrefix);
54
+ const imgBase64 = value.substring(idx + dataUriPrefix.length, value.length);
55
+ const dimension = await getDimension(buffer_1.Buffer.from(imgBase64, 'base64'));
56
+ const imageWidth = px2mm(dimension.width);
57
+ const imageHeight = px2mm(dimension.height);
58
+ const boxWidth = _schema.width;
59
+ const boxHeight = _schema.height;
60
+ const imageRatio = imageWidth / imageHeight;
61
+ const boxRatio = boxWidth / boxHeight;
62
+ if (imageRatio > boxRatio) {
63
+ _schema.width = boxWidth;
64
+ _schema.height = boxWidth / imageRatio;
65
+ _schema.position.y += (boxHeight - _schema.height) / 2;
66
+ }
67
+ else {
68
+ _schema.width = boxHeight * imageRatio;
69
+ _schema.height = boxHeight;
70
+ _schema.position.x += (boxWidth - _schema.width) / 2;
71
+ }
22
72
  const pageHeight = page.getHeight();
23
- const { width, height, rotate, position: { x, y }, opacity, } = (0, pdfRenderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight });
73
+ const lProps = (0, utils_js_1.convertForPdfLayoutProps)({ schema: _schema, pageHeight });
74
+ const { width, height, rotate, position, opacity } = lProps;
75
+ const { x, y } = position;
24
76
  page.drawImage(image, { x, y, rotate, width, height, opacity });
25
77
  },
26
78
  ui: (arg) => {
27
- const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme, } = arg;
28
- const editable = (0, pdfRenderUtils_js_1.isEditable)(mode);
79
+ const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, theme } = arg;
80
+ const editable = (0, utils_js_1.isEditable)(mode);
29
81
  const isDefault = value === defaultValue;
30
- const size = { width: schema.width * common_1.ZOOM, height: schema.height * common_1.ZOOM };
31
82
  const container = document.createElement('div');
32
83
  const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
33
84
  const containerStyle = {
34
85
  ...fullSize,
35
86
  backgroundImage: value ? 'none' : backgroundStyle,
36
- backgroundSize: `${size.width}px ${size.height}px`,
87
+ backgroundSize: `contain`,
88
+ backgroundRepeat: 'no-repeat',
89
+ backgroundPosition: 'center',
37
90
  };
38
91
  Object.assign(container.style, containerStyle);
39
92
  container.addEventListener('click', (e) => {
@@ -45,7 +98,12 @@ const schema = {
45
98
  // image tag
46
99
  if (value) {
47
100
  const img = document.createElement('img');
48
- const imgStyle = { height: '100%', width: '100%', borderRadius: 0 };
101
+ const imgStyle = {
102
+ height: '100%',
103
+ width: '100%',
104
+ borderRadius: 0,
105
+ objectFit: 'contain',
106
+ };
49
107
  Object.assign(img.style, imgStyle);
50
108
  img.src = value;
51
109
  container.appendChild(img);
@@ -84,20 +142,29 @@ const schema = {
84
142
  display: editable ? 'flex' : 'none',
85
143
  position: 'absolute',
86
144
  top: 0,
87
- backgroundColor: editable || value ? (0, pdfRenderUtils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30) : 'none',
145
+ backgroundColor: editable || value ? (0, utils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30) : 'none',
88
146
  cursor: 'pointer',
89
147
  };
90
148
  Object.assign(label.style, labelStyle);
91
149
  container.appendChild(label);
92
150
  const input = document.createElement('input');
93
- const inputStyle = { ...fullSize, position: 'absolute', top: '50%' };
151
+ const inputStyle = {
152
+ ...fullSize,
153
+ position: 'absolute',
154
+ top: '50%',
155
+ left: '50%',
156
+ width: '180px',
157
+ height: '30px',
158
+ marginLeft: '-90px',
159
+ marginTop: '-15px',
160
+ };
94
161
  Object.assign(input.style, inputStyle);
95
162
  input.tabIndex = tabIndex || 0;
96
163
  input.type = 'file';
97
164
  input.accept = 'image/jpeg, image/png';
98
165
  input.addEventListener('change', (event) => {
99
166
  const changeEvent = event;
100
- (0, uiRenderUtils_js_1.readFile)(changeEvent.target.files).then((result) => onChange && onChange(result));
167
+ (0, utils_js_1.readFile)(changeEvent.target.files).then((result) => onChange && onChange(result));
101
168
  });
102
169
  input.addEventListener('blur', () => stopEditing && stopEditing());
103
170
  label.appendChild(input);
@@ -1 +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,CAAC;QAC3C,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;YAClD,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,M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AE,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"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fast_xml_parser_1 = require("fast-xml-parser");
4
+ const utils_js_1 = require("../utils.js");
5
+ const isValidSVG = (svgString) => fast_xml_parser_1.XMLValidator.validate(svgString) === true;
6
+ const svgData = `<svg viewBox="0 0 488 600" version="1.1" xmlns="http://www.w3.org/2000/svg">
7
+ <g transform="matrix(1,0,0,1,-56,0)" fill="#000000" stroke="none">
8
+ <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
+ </g>
10
+ </svg>`;
11
+ const schema = {
12
+ ui: (arg) => {
13
+ const { rootElement, value, mode, onChange, theme } = arg;
14
+ const container = document.createElement((0, utils_js_1.isEditable)(mode) ? 'textarea' : 'div');
15
+ container.style.width = '100%';
16
+ container.style.height = '100%';
17
+ container.style.boxSizing = 'border-box';
18
+ if ((0, utils_js_1.isEditable)(mode)) {
19
+ const textarea = container;
20
+ textarea.value = value;
21
+ textarea.style.position = 'absolute';
22
+ textarea.style.backgroundColor = (0, utils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30);
23
+ if (isValidSVG(value)) {
24
+ const svgElement = new DOMParser().parseFromString(value, 'text/xml').childNodes[0];
25
+ if (svgElement instanceof SVGElement) {
26
+ svgElement.setAttribute('width', '100%');
27
+ svgElement.setAttribute('height', '100%');
28
+ svgElement.style.position = 'absolute';
29
+ }
30
+ rootElement.appendChild(svgElement);
31
+ }
32
+ else if (value) {
33
+ const errorElm = (0, utils_js_1.createErrorElm)();
34
+ errorElm.style.position = 'absolute';
35
+ rootElement.appendChild(errorElm);
36
+ }
37
+ textarea.addEventListener('change', (e) => {
38
+ const newValue = e.target.value;
39
+ onChange && onChange(newValue);
40
+ });
41
+ rootElement.appendChild(container);
42
+ textarea.setSelectionRange(value.length, value.length);
43
+ textarea.focus();
44
+ }
45
+ else {
46
+ if (!value)
47
+ return;
48
+ if (!isValidSVG(value)) {
49
+ rootElement.appendChild((0, utils_js_1.createErrorElm)());
50
+ return;
51
+ }
52
+ container.innerHTML = value;
53
+ const svgElement = container.childNodes[0];
54
+ if (svgElement instanceof SVGElement) {
55
+ svgElement.setAttribute('width', '100%');
56
+ svgElement.setAttribute('height', '100%');
57
+ rootElement.appendChild(container);
58
+ }
59
+ }
60
+ },
61
+ pdf: async (arg) => {
62
+ const { page, schema, value } = arg;
63
+ if (!value || !isValidSVG(value))
64
+ return;
65
+ const pageHeight = page.getHeight();
66
+ const { width, height, position } = (0, utils_js_1.convertForPdfLayoutProps)({ schema, pageHeight });
67
+ const { x, y } = position;
68
+ await page.drawSvg(value, { x, y: y + height, width, height });
69
+ },
70
+ propPanel: {
71
+ schema: {},
72
+ defaultValue: svgData,
73
+ defaultSchema: {
74
+ type: 'svg',
75
+ position: { x: 0, y: 0 },
76
+ width: 40,
77
+ height: 40,
78
+ },
79
+ },
80
+ };
81
+ exports.default = schema;
82
+ //# sourceMappingURL=svg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svg.js","sourceRoot":"","sources":["../../../../src/graphics/svg.ts"],"names":[],"mappings":";;AACA,qDAA+C;AAC/C,0CAAkG;AAElG,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,8BAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;AAEpF,MAAM,OAAO,GAAG;;;;OAIT,CAAC;AAIR,MAAM,MAAM,GAAgB;IAC1B,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;QACV,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;QAC1D,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAChF,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,CAAC,EAAE;YACpB,MAAM,QAAQ,GAAG,SAAgC,CAAC;YAClD,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;YACvB,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;YACrC,QAAQ,CAAC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e,MAAM,CAAC"}
@@ -3,11 +3,13 @@ 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.ellipse = exports.rectangle = 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.svg = 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
9
  const image_js_1 = __importDefault(require("./graphics/image.js"));
10
10
  exports.image = image_js_1.default;
11
+ const svg_js_1 = __importDefault(require("./graphics/svg.js"));
12
+ exports.svg = svg_js_1.default;
11
13
  const index_js_2 = __importDefault(require("./barcodes/index.js"));
12
14
  exports.barcodes = index_js_2.default;
13
15
  const line_js_1 = __importDefault(require("./shapes/line.js"));
@@ -15,9 +17,9 @@ exports.line = line_js_1.default;
15
17
  const rectAndEllipse_js_1 = require("./shapes/rectAndEllipse.js");
16
18
  Object.defineProperty(exports, "rectangle", { enumerable: true, get: function () { return rectAndEllipse_js_1.rectangle; } });
17
19
  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; } });
20
+ const utils_js_1 = require("./utils.js");
21
+ Object.defineProperty(exports, "convertForPdfLayoutProps", { enumerable: true, get: function () { return utils_js_1.convertForPdfLayoutProps; } });
22
+ Object.defineProperty(exports, "rotatePoint", { enumerable: true, get: function () { return utils_js_1.rotatePoint; } });
21
23
  const builtInPlugins = { Text: index_js_1.default };
22
24
  exports.builtInPlugins = builtInPlugins;
23
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAmC;AAWjC,eAXK,kBAAI,CAWL;AAVN,mEAAwC;AAWtC,gBAXK,kBAAK,CAWL;AAVP,+DAAoC;AAWlC,cAXK,gBAAG,CAWL;AAVL,mEAA2C;AAWzC,mBAXK,kBAAQ,CAWL;AAVV,+DAAoC;AAWlC,eAXK,iBAAI,CAWL;AAVN,kEAAgE;AAW9D,0FAXO,6BAAS,OAWP;AACT,wFAZkB,2BAAO,OAYlB;AAXT,yCAAmE;AAajE,yGAbO,mCAAwB,OAaP;AACxB,4FAdiC,sBAAW,OAcjC;AAZb,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,kBAAI,EAAE,CAAC;AAUpC,wCAAc"}
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
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
6
  const schema = {
7
7
  pdf: (arg) => {
8
8
  const { page, schema } = arg;
9
9
  const pageHeight = page.getHeight();
10
- const { width, height, rotate, position: { x, y }, opacity, } = (0, pdfRenderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
10
+ const { width, height, rotate, position: { x, y }, opacity, } = (0, utils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
11
11
  const pivot = { x: x + width / 2, y: y + height / 2 };
12
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),
13
+ start: (0, utils_js_1.rotatePoint)({ x, y: y + height / 2 }, pivot, rotate.angle),
14
+ end: (0, utils_js_1.rotatePoint)({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
15
15
  thickness: height,
16
- color: (0, pdfRenderUtils_js_1.hex2RgbColor)(schema.color ?? DEFAULT_LINE_COLOR),
16
+ color: (0, utils_js_1.hex2RgbColor)(schema.color ?? DEFAULT_LINE_COLOR),
17
17
  opacity: opacity,
18
18
  });
19
19
  },
@@ -1 +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,G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O,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"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ellipse = exports.rectangle = void 0;
4
4
  const common_1 = require("@pdfme/common");
5
5
  const constants_js_1 = require("../constants.js");
6
- const pdfRenderUtils_js_1 = require("../pdfRenderUtils.js");
6
+ const utils_js_1 = require("../utils.js");
7
7
  const shape = {
8
8
  ui: (arg) => {
9
9
  const { schema, rootElement } = arg;
@@ -24,14 +24,14 @@ const shape = {
24
24
  const { schema, page } = arg;
25
25
  const pageHeight = page.getHeight();
26
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 });
27
+ const { position, width, height, rotate, opacity } = (0, utils_js_1.convertForPdfLayoutProps)(cArg);
28
+ const { position: { x: x4Ellipse, y: y4Ellipse }, } = (0, utils_js_1.convertForPdfLayoutProps)({ ...cArg, applyRotateTranslate: false });
29
29
  const borderWidth = schema.borderWidth ? (0, common_1.mm2pt)(schema.borderWidth) : 0;
30
30
  const drawOptions = {
31
31
  rotate,
32
32
  borderWidth,
33
- borderColor: (0, pdfRenderUtils_js_1.hex2RgbColor)(schema.borderColor),
34
- color: (0, pdfRenderUtils_js_1.hex2RgbColor)(schema.color),
33
+ borderColor: (0, utils_js_1.hex2RgbColor)(schema.borderColor),
34
+ color: (0, utils_js_1.hex2RgbColor)(schema.color),
35
35
  opacity,
36
36
  borderOpacity: opacity,
37
37
  };