@pdfme/schemas 3.1.5-dev.9 → 3.2.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) 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/constants.js +2 -1
  4. package/dist/cjs/src/barcodes/constants.js.map +1 -1
  5. package/dist/cjs/src/barcodes/helper.js +1 -2
  6. package/dist/cjs/src/barcodes/helper.js.map +1 -1
  7. package/dist/cjs/src/barcodes/index.js +2 -2
  8. package/dist/cjs/src/barcodes/index.js.map +1 -1
  9. package/dist/cjs/src/barcodes/pdfRender.js +3 -3
  10. package/dist/cjs/src/barcodes/pdfRender.js.map +1 -1
  11. package/dist/cjs/src/barcodes/propPanel.js +19 -2
  12. package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
  13. package/dist/cjs/src/barcodes/uiRender.js +9 -32
  14. package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
  15. package/dist/cjs/src/graphics/helper.js +115 -0
  16. package/dist/cjs/src/graphics/helper.js.map +1 -0
  17. package/dist/cjs/src/graphics/image.js +179 -0
  18. package/dist/cjs/src/graphics/image.js.map +1 -0
  19. package/dist/cjs/src/graphics/svg.js +96 -0
  20. package/dist/cjs/src/graphics/svg.js.map +1 -0
  21. package/dist/cjs/src/index.js +42 -11
  22. package/dist/cjs/src/index.js.map +1 -1
  23. package/dist/cjs/src/shapes/line.js +57 -0
  24. package/dist/cjs/src/shapes/line.js.map +1 -0
  25. package/dist/cjs/src/shapes/rectAndEllipse.js +100 -0
  26. package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -0
  27. package/dist/cjs/src/text/helper.js.map +1 -1
  28. package/dist/cjs/src/text/index.js +16 -2
  29. package/dist/cjs/src/text/index.js.map +1 -1
  30. package/dist/cjs/src/text/pdfRender.js +5 -5
  31. package/dist/cjs/src/text/pdfRender.js.map +1 -1
  32. package/dist/cjs/src/text/uiRender.js +3 -3
  33. package/dist/cjs/src/text/uiRender.js.map +1 -1
  34. package/dist/cjs/src/{renderUtils.js → utils.js} +55 -7
  35. package/dist/cjs/src/utils.js.map +1 -0
  36. package/dist/esm/__tests__/{renderUtils.test.js → utils.test.js} +34 -8
  37. package/dist/esm/__tests__/utils.test.js.map +1 -0
  38. package/dist/esm/src/barcodes/constants.js +1 -0
  39. package/dist/esm/src/barcodes/constants.js.map +1 -1
  40. package/dist/esm/src/barcodes/helper.js +2 -3
  41. package/dist/esm/src/barcodes/helper.js.map +1 -1
  42. package/dist/esm/src/barcodes/index.js +2 -2
  43. package/dist/esm/src/barcodes/index.js.map +1 -1
  44. package/dist/esm/src/barcodes/pdfRender.js +2 -2
  45. package/dist/esm/src/barcodes/pdfRender.js.map +1 -1
  46. package/dist/esm/src/barcodes/propPanel.js +20 -3
  47. package/dist/esm/src/barcodes/propPanel.js.map +1 -1
  48. package/dist/esm/src/barcodes/uiRender.js +9 -32
  49. package/dist/esm/src/barcodes/uiRender.js.map +1 -1
  50. package/dist/esm/src/graphics/helper.js +111 -0
  51. package/dist/esm/src/graphics/helper.js.map +1 -0
  52. package/dist/esm/src/graphics/image.js +176 -0
  53. package/dist/esm/src/graphics/image.js.map +1 -0
  54. package/dist/esm/src/graphics/svg.js +93 -0
  55. package/dist/esm/src/graphics/svg.js.map +1 -0
  56. package/dist/esm/src/index.js +7 -5
  57. package/dist/esm/src/index.js.map +1 -1
  58. package/dist/esm/src/shapes/line.js +55 -0
  59. package/dist/esm/src/shapes/line.js.map +1 -0
  60. package/dist/esm/src/shapes/rectAndEllipse.js +97 -0
  61. package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -0
  62. package/dist/esm/src/text/helper.js.map +1 -1
  63. package/dist/esm/src/text/index.js +15 -2
  64. package/dist/esm/src/text/index.js.map +1 -1
  65. package/dist/esm/src/text/pdfRender.js +1 -1
  66. package/dist/esm/src/text/pdfRender.js.map +1 -1
  67. package/dist/esm/src/text/uiRender.js +2 -2
  68. package/dist/esm/src/text/uiRender.js.map +1 -1
  69. package/dist/esm/src/{renderUtils.js → utils.js} +52 -6
  70. package/dist/esm/src/utils.js.map +1 -0
  71. package/dist/types/src/barcodes/constants.d.ts +1 -0
  72. package/dist/types/src/barcodes/helper.d.ts +1 -0
  73. package/dist/types/src/barcodes/index.d.ts +2 -2
  74. package/dist/types/src/barcodes/types.d.ts +1 -0
  75. package/dist/types/src/graphics/helper.d.ts +5 -0
  76. package/dist/types/src/graphics/image.d.ts +7 -0
  77. package/dist/types/src/graphics/svg.d.ts +6 -0
  78. package/dist/types/src/index.d.ts +7 -5
  79. package/dist/types/src/shapes/line.d.ts +6 -0
  80. package/dist/types/src/shapes/rectAndEllipse.d.ts +144 -0
  81. package/dist/types/src/text/index.d.ts +3 -2
  82. package/dist/types/src/text/pdfRender.d.ts +1 -1
  83. package/dist/types/src/{renderUtils.d.ts → utils.d.ts} +3 -1
  84. package/package.json +4 -3
  85. package/src/barcodes/constants.ts +2 -0
  86. package/src/barcodes/helper.ts +12 -3
  87. package/src/barcodes/index.ts +2 -2
  88. package/src/barcodes/pdfRender.ts +2 -2
  89. package/src/barcodes/propPanel.ts +25 -3
  90. package/src/barcodes/types.ts +1 -0
  91. package/src/barcodes/uiRender.ts +9 -36
  92. package/src/graphics/helper.ts +147 -0
  93. package/src/graphics/image.ts +207 -0
  94. package/src/graphics/svg.ts +98 -0
  95. package/src/index.ts +21 -5
  96. package/src/shapes/line.ts +67 -0
  97. package/src/shapes/rectAndEllipse.ts +110 -0
  98. package/src/text/helper.ts +0 -1
  99. package/src/text/index.ts +17 -2
  100. package/src/text/pdfRender.ts +2 -2
  101. package/src/text/uiRender.ts +2 -2
  102. package/src/{renderUtils.ts → utils.ts} +61 -5
  103. package/dist/cjs/__tests__/renderUtils.test.js.map +0 -1
  104. package/dist/cjs/src/image/index.js +0 -8
  105. package/dist/cjs/src/image/index.js.map +0 -1
  106. package/dist/cjs/src/image/pdfRender.js +0 -22
  107. package/dist/cjs/src/image/pdfRender.js.map +0 -1
  108. package/dist/cjs/src/image/propPanel.js +0 -19
  109. package/dist/cjs/src/image/propPanel.js.map +0 -1
  110. package/dist/cjs/src/image/types.js +0 -3
  111. package/dist/cjs/src/image/types.js.map +0 -1
  112. package/dist/cjs/src/image/uiRender.js +0 -111
  113. package/dist/cjs/src/image/uiRender.js.map +0 -1
  114. package/dist/cjs/src/line/constants.js +0 -5
  115. package/dist/cjs/src/line/constants.js.map +0 -1
  116. package/dist/cjs/src/line/index.js +0 -8
  117. package/dist/cjs/src/line/index.js.map +0 -1
  118. package/dist/cjs/src/line/pdfRender.js +0 -20
  119. package/dist/cjs/src/line/pdfRender.js.map +0 -1
  120. package/dist/cjs/src/line/propPanel.js +0 -35
  121. package/dist/cjs/src/line/propPanel.js.map +0 -1
  122. package/dist/cjs/src/line/types.js +0 -3
  123. package/dist/cjs/src/line/types.js.map +0 -1
  124. package/dist/cjs/src/line/uiRender.js +0 -14
  125. package/dist/cjs/src/line/uiRender.js.map +0 -1
  126. package/dist/cjs/src/renderUtils.js.map +0 -1
  127. package/dist/esm/__tests__/renderUtils.test.js.map +0 -1
  128. package/dist/esm/src/image/index.js +0 -6
  129. package/dist/esm/src/image/index.js.map +0 -1
  130. package/dist/esm/src/image/pdfRender.js +0 -18
  131. package/dist/esm/src/image/pdfRender.js.map +0 -1
  132. package/dist/esm/src/image/propPanel.js +0 -16
  133. package/dist/esm/src/image/propPanel.js.map +0 -1
  134. package/dist/esm/src/image/types.js +0 -2
  135. package/dist/esm/src/image/types.js.map +0 -1
  136. package/dist/esm/src/image/uiRender.js +0 -107
  137. package/dist/esm/src/image/uiRender.js.map +0 -1
  138. package/dist/esm/src/line/constants.js +0 -2
  139. package/dist/esm/src/line/constants.js.map +0 -1
  140. package/dist/esm/src/line/index.js +0 -6
  141. package/dist/esm/src/line/index.js.map +0 -1
  142. package/dist/esm/src/line/pdfRender.js +0 -16
  143. package/dist/esm/src/line/pdfRender.js.map +0 -1
  144. package/dist/esm/src/line/propPanel.js +0 -32
  145. package/dist/esm/src/line/propPanel.js.map +0 -1
  146. package/dist/esm/src/line/types.js +0 -2
  147. package/dist/esm/src/line/types.js.map +0 -1
  148. package/dist/esm/src/line/uiRender.js +0 -10
  149. package/dist/esm/src/line/uiRender.js.map +0 -1
  150. package/dist/esm/src/renderUtils.js.map +0 -1
  151. package/dist/types/src/image/index.d.ts +0 -4
  152. package/dist/types/src/image/pdfRender.d.ts +0 -3
  153. package/dist/types/src/image/propPanel.d.ts +0 -3
  154. package/dist/types/src/image/types.d.ts +0 -3
  155. package/dist/types/src/image/uiRender.d.ts +0 -3
  156. package/dist/types/src/line/constants.d.ts +0 -1
  157. package/dist/types/src/line/index.d.ts +0 -4
  158. package/dist/types/src/line/pdfRender.d.ts +0 -3
  159. package/dist/types/src/line/propPanel.d.ts +0 -3
  160. package/dist/types/src/line/types.d.ts +0 -4
  161. package/dist/types/src/line/uiRender.d.ts +0 -3
  162. package/src/image/index.ts +0 -8
  163. package/src/image/pdfRender.ts +0 -29
  164. package/src/image/propPanel.ts +0 -19
  165. package/src/image/types.ts +0 -3
  166. package/src/image/uiRender.ts +0 -121
  167. package/src/line/constants.ts +0 -1
  168. package/src/line/index.ts +0 -8
  169. package/src/line/pdfRender.ts +0 -24
  170. package/src/line/propPanel.ts +0 -34
  171. package/src/line/types.ts +0 -5
  172. package/src/line/uiRender.ts +0 -12
  173. /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 renderUtils_1 = require("../src/renderUtils");
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, renderUtils_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, renderUtils_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, renderUtils_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, renderUtils_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, renderUtils_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, renderUtils_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, renderUtils_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,EAAE;IAC5B,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,GAAG,GAAG,SAAS,CAAC;QACtB,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,GAAG,GAAG,MAAM,CAAC;QACnB,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,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,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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_BARCODE_COLOR = exports.DEFAULT_BARCODE_BG_COLOR = exports.BARCODE_TYPES = void 0;
3
+ exports.DEFAULT_BARCODE_INCLUDETEXT = exports.DEFAULT_BARCODE_COLOR = exports.DEFAULT_BARCODE_BG_COLOR = exports.BARCODE_TYPES = void 0;
4
4
  exports.BARCODE_TYPES = [
5
5
  'qrcode',
6
6
  'japanpost',
@@ -16,4 +16,5 @@ exports.BARCODE_TYPES = [
16
16
  ];
17
17
  exports.DEFAULT_BARCODE_BG_COLOR = '#ffffff';
18
18
  exports.DEFAULT_BARCODE_COLOR = '#000000';
19
+ exports.DEFAULT_BARCODE_INCLUDETEXT = true;
19
20
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/barcodes/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,QAAQ;IACR,WAAW;IACX,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,eAAe;CACP,CAAC;AAEE,QAAA,wBAAwB,GAAG,SAAS,CAAC;AAErC,QAAA,qBAAqB,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/barcodes/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,QAAQ;IACR,WAAW;IACX,OAAO;IACP,MAAM;IACN,QAAQ;IACR,SAAS;IACT,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,eAAe;CACP,CAAC;AAEE,QAAA,wBAAwB,GAAG,SAAS,CAAC;AAErC,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAElC,QAAA,2BAA2B,GAAG,IAAI,CAAC"}
@@ -110,9 +110,8 @@ exports.barCodeType2Bcid = barCodeType2Bcid;
110
110
  const mapHexColorForBwipJsLib = (color, fallback) => color ? color.replace('#', '') : fallback ? fallback.replace('#', '') : '000000';
111
111
  exports.mapHexColorForBwipJsLib = mapHexColorForBwipJsLib;
112
112
  const createBarCode = async (arg) => {
113
- const { type, input, width, height, backgroundColor, barColor, textColor } = arg;
113
+ const { type, input, width, height, backgroundColor, barColor, textColor, includetext = constants_js_1.DEFAULT_BARCODE_INCLUDETEXT, } = arg;
114
114
  const bcid = (0, exports.barCodeType2Bcid)(type);
115
- const includetext = true;
116
115
  const scale = 5;
117
116
  const bwipjsArg = { bcid, text: input, width, height, scale, includetext };
118
117
  if (backgroundColor)
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../src/barcodes/helper.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAgD;AAChD,sDAAgD;AAEhD,iDAA+C;AAG/C,oCAAoC;AACpC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAE,EAAE;IAClE,IAAI,cAAc,GAAG,IAAI,CAAC;IAE1B,IAAI,KAAK,CAAC,MAAM,KAAK,aAAa,EAAE;QAClC,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE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AAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,aAAa;QACb,iBAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACnC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC9C,GAAG,GAAG,IAAA,wBAAe,EAAC,OAAO,CAAC,CAAC,MAAgB,CAAC;KACjD;SAAM;QACL,GAAG,GAAG,MAAM,iBAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;KACxC;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AA1CW,QAAA,aAAa,iBA0CxB"}
@@ -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 schemas = constants_js_1.BARCODE_TYPES.reduce((acc, type) => Object.assign(acc, {
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 = schemas;
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,OAAO,GAAG,4BAAa,CAAC,MAAM,CAClC,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,OAAO,CAAC"}
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,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pdfRender = void 0;
4
- const renderUtils_js_1 = require("../renderUtils.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
- return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}`;
7
+ return `${schema.type}${schema.backgroundColor}${schema.barColor}${schema.textColor}${value}${schema.includetext}`;
8
8
  };
9
9
  const pdfRender = async (arg) => {
10
10
  const { value, schema, pdfDoc, page, _cache } = arg;
@@ -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, renderUtils_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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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"}
@@ -8,6 +8,7 @@ const defaultColors = {
8
8
  barColor: constants_js_1.DEFAULT_BARCODE_COLOR,
9
9
  };
10
10
  const defaultTextColors = { textColor: constants_js_1.DEFAULT_BARCODE_COLOR };
11
+ const defaultIncludetext = { includetext: constants_js_1.DEFAULT_BARCODE_INCLUDETEXT };
11
12
  const position = { x: 0, y: 0 };
12
13
  const default40x20 = { width: 40, height: 20 };
13
14
  const barcodeDefaults = [
@@ -30,6 +31,7 @@ const barcodeDefaults = [
30
31
  position,
31
32
  ...defaultColors,
32
33
  ...defaultTextColors,
34
+ ...defaultIncludetext,
33
35
  width: 80,
34
36
  height: 7.2,
35
37
  rotate: 0,
@@ -43,6 +45,7 @@ const barcodeDefaults = [
43
45
  position,
44
46
  ...defaultColors,
45
47
  ...defaultTextColors,
48
+ ...defaultIncludetext,
46
49
  ...default40x20,
47
50
  height: 16,
48
51
  rotate: 0,
@@ -56,6 +59,7 @@ const barcodeDefaults = [
56
59
  position,
57
60
  ...defaultColors,
58
61
  ...defaultTextColors,
62
+ ...defaultIncludetext,
59
63
  ...default40x20,
60
64
  rotate: 0,
61
65
  opacity: constants_js_2.DEFAULT_OPACITY,
@@ -68,6 +72,7 @@ const barcodeDefaults = [
68
72
  position,
69
73
  ...defaultColors,
70
74
  ...defaultTextColors,
75
+ ...defaultIncludetext,
71
76
  ...default40x20,
72
77
  opacity: constants_js_2.DEFAULT_OPACITY,
73
78
  },
@@ -79,6 +84,7 @@ const barcodeDefaults = [
79
84
  position,
80
85
  ...defaultColors,
81
86
  ...defaultTextColors,
87
+ ...defaultIncludetext,
82
88
  ...default40x20,
83
89
  rotate: 0,
84
90
  opacity: constants_js_2.DEFAULT_OPACITY,
@@ -91,6 +97,7 @@ const barcodeDefaults = [
91
97
  position,
92
98
  ...defaultColors,
93
99
  ...defaultTextColors,
100
+ ...defaultIncludetext,
94
101
  ...default40x20,
95
102
  rotate: 0,
96
103
  opacity: constants_js_2.DEFAULT_OPACITY,
@@ -103,6 +110,7 @@ const barcodeDefaults = [
103
110
  position,
104
111
  ...defaultColors,
105
112
  ...defaultTextColors,
113
+ ...defaultIncludetext,
106
114
  ...default40x20,
107
115
  height: 12,
108
116
  rotate: 0,
@@ -116,6 +124,7 @@ const barcodeDefaults = [
116
124
  position,
117
125
  ...defaultColors,
118
126
  ...defaultTextColors,
127
+ ...defaultIncludetext,
119
128
  ...default40x20,
120
129
  height: 16,
121
130
  rotate: 0,
@@ -129,6 +138,7 @@ const barcodeDefaults = [
129
138
  position,
130
139
  ...defaultColors,
131
140
  ...defaultTextColors,
141
+ ...defaultIncludetext,
132
142
  ...default40x20,
133
143
  rotate: 0,
134
144
  opacity: constants_js_2.DEFAULT_OPACITY,
@@ -151,7 +161,7 @@ const getPropPanelByBarcodeType = (barcodeType) => {
151
161
  const barcodeHasText = barcodeType !== 'qrcode' && barcodeType !== 'gs1datamatrix';
152
162
  const defaults = barcodeDefaults.find(({ defaultSchema }) => defaultSchema.type === barcodeType);
153
163
  if (!defaults)
154
- throw new Error(`[@pdfme/schemas] No default for barcode type ${barcodeType}`);
164
+ throw new Error(`[@pdfme/schemas/barcodes] No default for barcode type ${barcodeType}`);
155
165
  return {
156
166
  schema: ({ i18n }) => ({
157
167
  barColor: {
@@ -177,7 +187,14 @@ const getPropPanelByBarcodeType = (barcodeType) => {
177
187
  ],
178
188
  },
179
189
  ...(barcodeHasText
180
- ? { textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' } }
190
+ ? {
191
+ textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' },
192
+ includetext: {
193
+ title: i18n('schemas.barcodes.includetext'),
194
+ type: 'boolean',
195
+ widget: 'switch',
196
+ },
197
+ }
181
198
  : {}),
182
199
  }),
183
200
  ...defaults,
@@ -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;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,MAA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ender = void 0;
4
4
  const helper_js_1 = require("./helper.js");
5
- const renderUtils_js_1 = require("../renderUtils.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,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, renderUtils_js_1.isEditable)(mode);
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
- ...fullSize,
46
+ width: '100%',
70
47
  position: 'absolute',
71
48
  textAlign: 'center',
72
- fontSize: '1rem',
73
- color: '#000',
74
- backgroundColor: editable || value ? (0, renderUtils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30) : 'none',
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
- const errorBarcodeElm = createErrorBarcodeElm();
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,sDAA8D;AAE9D,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,CAAC;IAE/C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAmB;QAChC,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,MAAM;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAErC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAC3B,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,C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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/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