@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,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uiRender = void 0;
4
- const constants_js_1 = require("./constants.js");
5
- const uiRender = (arg) => {
6
- const { schema, rootElement } = arg;
7
- const div = document.createElement('div');
8
- div.style.backgroundColor = schema.color ?? constants_js_1.DEFAULT_LINE_COLOR;
9
- div.style.width = '100%';
10
- div.style.height = '100%';
11
- rootElement.appendChild(div);
12
- };
13
- exports.uiRender = uiRender;
14
- //# sourceMappingURL=uiRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/line/uiRender.ts"],"names":[],"mappings":";;;AAEA,iDAAoD;AAE7C,MAAM,QAAQ,GAAG,CAAC,GAA8B,EAAE,EAAE;IACzD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,KAAK,IAAI,iCAAkB,CAAC;IAC/D,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;IACzB,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC,CAAC;AAPW,QAAA,QAAQ,YAOnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderUtils.js","sourceRoot":"","sources":["../../../src/renderUtils.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,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC/E,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;IAEpC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,MA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,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACR,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;QAElF,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;QAC9B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,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 +0,0 @@
1
- import { pdfRender } from './pdfRender.js';
2
- import { propPanel } from './propPanel.js';
3
- import { uiRender } from './uiRender.js';
4
- const schema = { pdf: pdfRender, ui: uiRender, propPanel };
5
- export default schema;
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/image/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,MAAM,GAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAChF,eAAe,MAAM,CAAC"}
@@ -1,18 +0,0 @@
1
- import { convertForPdfLayoutProps } from '../renderUtils.js';
2
- const getCacheKey = (schema, input) => `${schema.type}${input}`;
3
- export const pdfRender = async (arg) => {
4
- const { value, schema, pdfDoc, page, _cache } = arg;
5
- if (!value || !value.startsWith('data:image/'))
6
- return;
7
- const inputImageCacheKey = getCacheKey(schema, value);
8
- let image = _cache.get(inputImageCacheKey);
9
- if (!image) {
10
- const isPng = value.startsWith('data:image/png;');
11
- image = await (isPng ? pdfDoc.embedPng(value) : pdfDoc.embedJpg(value));
12
- _cache.set(inputImageCacheKey, image);
13
- }
14
- const pageHeight = page.getHeight();
15
- const { width, height, rotate, position: { x, y }, opacity, } = convertForPdfLayoutProps({ schema, pageHeight });
16
- page.drawImage(image, { x, y, rotate, width, height, opacity });
17
- };
18
- //# sourceMappingURL=pdfRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/image/pdfRender.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;AAEhF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,GAAgC,EAAE,EAAE;IAClE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACpD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO;IAEvD,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,EAAE,KA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Hh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHl+d/A9cKjmiL040TAAAAAElFTkSuQmCC',
5
- defaultSchema: {
6
- type: 'image',
7
- position: { x: 0, y: 0 },
8
- width: 40,
9
- height: 40,
10
- // If the value of "rotate" is set to undefined or not set at all, rotation will be disabled in the UI.
11
- // Check this document: https://pdfme.com//docs/custom-schemas#learning-how-to-create-from-pdfmeschemas-code
12
- rotate: 0,
13
- opacity: DEFAULT_OPACITY,
14
- },
15
- };
16
- //# sourceMappingURL=propPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/image/propPanel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,SAAS,GAA2B;IAC/C,MAAM,EAAE,EAAE;IACV,YAAY,EACV,w9CAAw9C;IAC19C,aAAa,EAAE;QACb,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,uGAAuG;QACvG,4GAA4G;QAC5G,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,eAAe;KACzB;CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/image/types.ts"],"names":[],"mappings":""}
@@ -1,107 +0,0 @@
1
- import { ZOOM } from '@pdfme/common';
2
- import { addAlphaToHex, isEditable } from '../renderUtils.js';
3
- const fullSize = { width: '100%', height: '100%' };
4
- const readFile = (input) => new Promise((resolve, reject) => {
5
- const fileReader = new FileReader();
6
- fileReader.onload = (e) => {
7
- if (e.target?.result) {
8
- resolve(e.target.result);
9
- }
10
- };
11
- fileReader.onerror = (e) => {
12
- reject(new Error('[@pdfme/schemas] File reading failed'));
13
- };
14
- let file = null;
15
- if (input instanceof FileList && input.length > 0) {
16
- file = input[0];
17
- }
18
- else if (input instanceof File) {
19
- file = input;
20
- }
21
- if (file) {
22
- fileReader.readAsDataURL(file);
23
- }
24
- else {
25
- reject(new Error('[@pdfme/schemas] No files provided'));
26
- }
27
- });
28
- export const uiRender = async (arg) => {
29
- const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } = arg;
30
- const editable = isEditable(mode);
31
- const size = { width: schema.width * ZOOM, height: schema.height * ZOOM };
32
- const container = document.createElement('div');
33
- const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
34
- const containerStyle = {
35
- ...fullSize,
36
- backgroundImage: value ? 'none' : backgroundStyle,
37
- backgroundSize: `${size.width}px ${size.height}px`,
38
- };
39
- Object.assign(container.style, containerStyle);
40
- container.addEventListener('click', (e) => {
41
- if (editable) {
42
- e.stopPropagation();
43
- }
44
- });
45
- rootElement.appendChild(container);
46
- // image tag
47
- if (value) {
48
- const img = document.createElement('img');
49
- const imgStyle = { height: '100%', width: '100%', borderRadius: 0 };
50
- Object.assign(img.style, imgStyle);
51
- img.src = value;
52
- container.appendChild(img);
53
- }
54
- // remove button
55
- if (value && editable) {
56
- const button = document.createElement('button');
57
- button.textContent = 'x';
58
- const buttonStyle = {
59
- position: 'absolute',
60
- top: 0,
61
- left: 0,
62
- zIndex: 1,
63
- display: 'flex',
64
- justifyContent: 'center',
65
- alignItems: 'center',
66
- color: '#333',
67
- background: '#f2f2f2',
68
- borderRadius: '2px',
69
- border: '1px solid #767676',
70
- cursor: 'pointer',
71
- height: '24px',
72
- width: '24px',
73
- };
74
- Object.assign(button.style, buttonStyle);
75
- button.addEventListener('click', () => {
76
- onChange && onChange('');
77
- });
78
- container.appendChild(button);
79
- }
80
- // file input
81
- if (!value && editable) {
82
- const label = document.createElement('label');
83
- const labelStyle = {
84
- ...fullSize,
85
- display: editable ? 'flex' : 'none',
86
- position: 'absolute',
87
- top: 0,
88
- backgroundColor: editable || value ? addAlphaToHex(theme.colorPrimaryBg, 30) : 'none',
89
- cursor: 'pointer',
90
- };
91
- Object.assign(label.style, labelStyle);
92
- container.appendChild(label);
93
- const input = document.createElement('input');
94
- const inputStyle = { ...fullSize, position: 'absolute', top: '50%' };
95
- Object.assign(input.style, inputStyle);
96
- input.tabIndex = tabIndex || 0;
97
- input.type = 'file';
98
- input.accept = 'image/jpeg, image/png';
99
- input.addEventListener('change', (event) => {
100
- const changeEvent = event;
101
- readFile(changeEvent.target.files).then((result) => onChange && onChange(result));
102
- });
103
- input.addEventListener('blur', () => stopEditing && stopEditing());
104
- label.appendChild(input);
105
- }
106
- };
107
- //# sourceMappingURL=uiRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/image/uiRender.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,IAAI,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,QAAQ,GAAG,CAAC,KAA6B,EAAiC,EAAE,CAChF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE;QACxB,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE;YACpB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC;IAEF,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE;QACzB,MAAM,CAAC,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;IAC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,GAAG,KAAiD,CAAC;YACtE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAgB,CAAC,CAAC,CAAC;QAC9F,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,IAAI,WAAW,EAAE,CAAC,CAAC;QACnE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC1B;AACH,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export const DEFAULT_LINE_COLOR = '#000000';
2
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/line/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC"}
@@ -1,6 +0,0 @@
1
- import { pdfRender } from './pdfRender.js';
2
- import { propPanel } from './propPanel.js';
3
- import { uiRender } from './uiRender.js';
4
- const schema = { pdf: pdfRender, ui: uiRender, propPanel };
5
- export default schema;
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/line/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,MAAM,GAAuB,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAC/E,eAAe,MAAM,CAAC"}
@@ -1,16 +0,0 @@
1
- import { rotatePoint, convertForPdfLayoutProps, hex2RgbColor } from '../renderUtils.js';
2
- import { DEFAULT_LINE_COLOR } from './constants.js';
3
- export const pdfRender = (arg) => {
4
- const { page, schema } = arg;
5
- const pageHeight = page.getHeight();
6
- const { width, height, rotate, position: { x, y }, opacity, } = convertForPdfLayoutProps({ schema, pageHeight, applyRotateTranslate: false });
7
- const pivot = { x: x + width / 2, y: y + height / 2 };
8
- page.drawLine({
9
- start: rotatePoint({ x, y: y + height / 2 }, pivot, rotate.angle),
10
- end: rotatePoint({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
11
- thickness: height,
12
- color: hex2RgbColor(schema.color ?? DEFAULT_LINE_COLOR),
13
- opacity: opacity,
14
- });
15
- };
16
- //# sourceMappingURL=pdfRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/line/pdfRender.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAA+B,EAAE,EAAE;IAC3D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAC7B,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,wBAAwB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;IACtD,IAAI,CAAC,QAAQ,CAAC;QACZ,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACjE,GAAG,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QAC1E,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,kBAAkB,CAAC;QACvD,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import { HEX_COLOR_PATTERN } from '../constants.js';
2
- import { DEFAULT_LINE_COLOR } from './constants.js';
3
- export const propPanel = {
4
- schema: ({ i18n }) => {
5
- return {
6
- color: {
7
- title: i18n('schemas.line.color'),
8
- type: 'string',
9
- widget: 'color',
10
- required: true,
11
- rules: [
12
- {
13
- pattern: HEX_COLOR_PATTERN,
14
- message: i18n('hexColorPrompt'),
15
- },
16
- ],
17
- },
18
- };
19
- },
20
- defaultValue: '',
21
- defaultSchema: {
22
- type: 'line',
23
- position: { x: 0, y: 0 },
24
- width: 50,
25
- height: 1,
26
- rotate: 0,
27
- opacity: 1,
28
- readOnly: true,
29
- color: DEFAULT_LINE_COLOR,
30
- },
31
- };
32
- //# sourceMappingURL=propPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/line/propPanel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,SAAS,GAA0B;IAC9C,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACnB,OAAO;YACL,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,oBAAoB,CAAC;gBACjC,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,iBAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,kBAAkB;KAC1B;CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/line/types.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import { DEFAULT_LINE_COLOR } from './constants.js';
2
- export const uiRender = (arg) => {
3
- const { schema, rootElement } = arg;
4
- const div = document.createElement('div');
5
- div.style.backgroundColor = schema.color ?? DEFAULT_LINE_COLOR;
6
- div.style.width = '100%';
7
- div.style.height = '100%';
8
- rootElement.appendChild(div);
9
- };
10
- //# sourceMappingURL=uiRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/line/uiRender.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAA8B,EAAE,EAAE;IACzD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC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K,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAA6B,EAAE,EAAE;IAC5D,IAAI,SAAS,EAAE;QACb,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,EAAE,CAAC,CAAC;SACzD;QAED,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAErC,OAAO,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;KACvC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { Plugin } from '@pdfme/common';
2
- import type { ImageSchema } from './types';
3
- declare const schema: Plugin<ImageSchema>;
4
- export default schema;
@@ -1,3 +0,0 @@
1
- import type { PDFRenderProps } from '@pdfme/common';
2
- import type { ImageSchema } from './types';
3
- export declare const pdfRender: (arg: PDFRenderProps<ImageSchema>) => Promise<void>;
@@ -1,3 +0,0 @@
1
- import { PropPanel } from '@pdfme/common';
2
- import type { ImageSchema } from './types';
3
- export declare const propPanel: PropPanel<ImageSchema>;
@@ -1,3 +0,0 @@
1
- import { Schema } from '@pdfme/common';
2
- export interface ImageSchema extends Schema {
3
- }
@@ -1,3 +0,0 @@
1
- import type { ImageSchema } from './types';
2
- import { UIRenderProps } from '@pdfme/common';
3
- export declare const uiRender: (arg: UIRenderProps<ImageSchema>) => Promise<void>;
@@ -1 +0,0 @@
1
- export declare const DEFAULT_LINE_COLOR = "#000000";
@@ -1,4 +0,0 @@
1
- import type { Plugin } from '@pdfme/common';
2
- import type { LineSchema } from './types.js';
3
- declare const schema: Plugin<LineSchema>;
4
- export default schema;
@@ -1,3 +0,0 @@
1
- import type { PDFRenderProps } from '@pdfme/common';
2
- import type { LineSchema } from './types';
3
- export declare const pdfRender: (arg: PDFRenderProps<LineSchema>) => void;
@@ -1,3 +0,0 @@
1
- import { PropPanel } from '@pdfme/common';
2
- import type { LineSchema } from './types';
3
- export declare const propPanel: PropPanel<LineSchema>;
@@ -1,4 +0,0 @@
1
- import { Schema } from '@pdfme/common';
2
- export interface LineSchema extends Schema {
3
- color: string;
4
- }
@@ -1,3 +0,0 @@
1
- import type { LineSchema } from './types';
2
- import { UIRenderProps } from '@pdfme/common';
3
- export declare const uiRender: (arg: UIRenderProps<LineSchema>) => void;
@@ -1,8 +0,0 @@
1
- import type { Plugin } from '@pdfme/common';
2
- import { pdfRender } from './pdfRender.js';
3
- import { propPanel } from './propPanel.js';
4
- import { uiRender } from './uiRender.js';
5
- import type { ImageSchema } from './types';
6
-
7
- const schema: Plugin<ImageSchema> = { pdf: pdfRender, ui: uiRender, propPanel };
8
- export default schema;
@@ -1,29 +0,0 @@
1
- import type { PDFRenderProps, Schema } from '@pdfme/common';
2
- import type { ImageSchema } from './types';
3
- import { convertForPdfLayoutProps } from '../renderUtils.js';
4
-
5
- const getCacheKey = (schema: Schema, input: string) => `${schema.type}${input}`;
6
-
7
- export const pdfRender = async (arg: PDFRenderProps<ImageSchema>) => {
8
- const { value, schema, pdfDoc, page, _cache } = arg;
9
- if (!value || !value.startsWith('data:image/')) return;
10
-
11
- const inputImageCacheKey = getCacheKey(schema, value);
12
- let image = _cache.get(inputImageCacheKey);
13
- if (!image) {
14
- const isPng = value.startsWith('data:image/png;');
15
- image = await (isPng ? pdfDoc.embedPng(value) : pdfDoc.embedJpg(value));
16
- _cache.set(inputImageCacheKey, image);
17
- }
18
-
19
- const pageHeight = page.getHeight();
20
- const {
21
- width,
22
- height,
23
- rotate,
24
- position: { x, y },
25
- opacity,
26
- } = convertForPdfLayoutProps({ schema, pageHeight });
27
-
28
- page.drawImage(image, { x, y, rotate, width, height, opacity });
29
- };
@@ -1,19 +0,0 @@
1
- import { PropPanel } from '@pdfme/common';
2
- import type { ImageSchema } from './types';
3
- import { DEFAULT_OPACITY } from '../constants.js';
4
-
5
- export const propPanel: PropPanel<ImageSchema> = {
6
- schema: {},
7
- defaultValue:
8
- '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+Ic6X9RXSfCrrK6T5WBZASPOhrFCQ5ufyjF+a92XdkjTvyrolad6WdUvS/KawSI7/sQn7JfDl+O+bsF8CX44fN2FvHnNnIT4Nm7BfAl+ON5uwXwJfjA/LCuk2BXvCvN0U7InxflmAtxV1gvx0U2N3luPtdZOlwj/FoR5vbuq85Pi48F6LD0scOk3+sq1cleP9ohlNfkpq/N9pGaMuH7T4ZVqGWYt/nBavyxstftblfaVIWJU/y72yODCfzJH5oMvPh+adLm+PzCdzZD5U/61ClT9Lnvyo8e7QvFHlE3ydj0zOu5ucickhcpgcJofJedUVk8j5b/nGgIeHh4d/I3x/RwLlhgfNH3DavSwGXf7YjT76uqCEQ/P37p9z7uKVmwspd17S7hul3PXK6fbsmnvWhO6GZlMnn3ri8gXN5GzHnX0B35ydj91814CHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHl+d/A9cKjmiL040TAAAAAElFTkSuQmCC',
9
- defaultSchema: {
10
- type: 'image',
11
- position: { x: 0, y: 0 },
12
- width: 40,
13
- height: 40,
14
- // If the value of "rotate" is set to undefined or not set at all, rotation will be disabled in the UI.
15
- // Check this document: https://pdfme.com//docs/custom-schemas#learning-how-to-create-from-pdfmeschemas-code
16
- rotate: 0,
17
- opacity: DEFAULT_OPACITY,
18
- },
19
- };
@@ -1,3 +0,0 @@
1
- import { Schema } from '@pdfme/common';
2
-
3
- export interface ImageSchema extends Schema {}
@@ -1,121 +0,0 @@
1
- import type { ChangeEvent } from 'react';
2
- import type * as CSS from 'csstype';
3
- import type { ImageSchema } from './types';
4
- import { UIRenderProps, ZOOM } from '@pdfme/common';
5
- import { addAlphaToHex, isEditable } from '../renderUtils.js';
6
-
7
- const fullSize = { width: '100%', height: '100%' };
8
-
9
- const readFile = (input: File | FileList | null): Promise<string | ArrayBuffer> =>
10
- new Promise((resolve, reject) => {
11
- const fileReader = new FileReader();
12
-
13
- fileReader.onload = (e) => {
14
- if (e.target?.result) {
15
- resolve(e.target.result);
16
- }
17
- };
18
-
19
- fileReader.onerror = (e) => {
20
- reject(new Error('[@pdfme/schemas] File reading failed'));
21
- };
22
-
23
- let file: File | null = null;
24
- if (input instanceof FileList && input.length > 0) {
25
- file = input[0];
26
- } else if (input instanceof File) {
27
- file = input;
28
- }
29
-
30
- if (file) {
31
- fileReader.readAsDataURL(file);
32
- } else {
33
- reject(new Error('[@pdfme/schemas] No files provided'));
34
- }
35
- });
36
-
37
- export const uiRender = async (arg: UIRenderProps<ImageSchema>) => {
38
- const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } =
39
- arg;
40
- const editable = isEditable(mode);
41
-
42
- const size = { width: schema.width * ZOOM, height: schema.height * ZOOM };
43
-
44
- const container = document.createElement('div');
45
- const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
46
- const containerStyle: CSS.Properties = {
47
- ...fullSize,
48
- backgroundImage: value ? 'none' : backgroundStyle,
49
- backgroundSize: `${size.width}px ${size.height}px`,
50
- };
51
- Object.assign(container.style, containerStyle);
52
- container.addEventListener('click', (e) => {
53
- if (editable) {
54
- e.stopPropagation();
55
- }
56
- });
57
- rootElement.appendChild(container);
58
-
59
- // image tag
60
- if (value) {
61
- const img = document.createElement('img');
62
- const imgStyle: CSS.Properties = { height: '100%', width: '100%', borderRadius: 0 };
63
- Object.assign(img.style, imgStyle);
64
- img.src = value;
65
- container.appendChild(img);
66
- }
67
-
68
- // remove button
69
- if (value && editable) {
70
- const button = document.createElement('button');
71
- button.textContent = 'x';
72
- const buttonStyle: CSS.Properties = {
73
- position: 'absolute',
74
- top: 0,
75
- left: 0,
76
- zIndex: 1,
77
- display: 'flex',
78
- justifyContent: 'center',
79
- alignItems: 'center',
80
- color: '#333',
81
- background: '#f2f2f2',
82
- borderRadius: '2px',
83
- border: '1px solid #767676',
84
- cursor: 'pointer',
85
- height: '24px',
86
- width: '24px',
87
- };
88
- Object.assign(button.style, buttonStyle);
89
- button.addEventListener('click', () => {
90
- onChange && onChange('');
91
- });
92
- container.appendChild(button);
93
- }
94
-
95
- // file input
96
- if (!value && editable) {
97
- const label = document.createElement('label');
98
- const labelStyle: CSS.Properties = {
99
- ...fullSize,
100
- display: editable ? 'flex' : 'none',
101
- position: 'absolute',
102
- top: 0,
103
- backgroundColor: editable || value ? addAlphaToHex(theme.colorPrimaryBg, 30) : 'none',
104
- cursor: 'pointer',
105
- };
106
- Object.assign(label.style, labelStyle);
107
- container.appendChild(label);
108
- const input = document.createElement('input');
109
- const inputStyle: CSS.Properties = { ...fullSize, position: 'absolute', top: '50%' };
110
- Object.assign(input.style, inputStyle);
111
- input.tabIndex = tabIndex || 0;
112
- input.type = 'file';
113
- input.accept = 'image/jpeg, image/png';
114
- input.addEventListener('change', (event: Event) => {
115
- const changeEvent = event as unknown as ChangeEvent<HTMLInputElement>;
116
- readFile(changeEvent.target.files).then((result) => onChange && onChange(result as string));
117
- });
118
- input.addEventListener('blur', () => stopEditing && stopEditing());
119
- label.appendChild(input);
120
- }
121
- };
@@ -1 +0,0 @@
1
- export const DEFAULT_LINE_COLOR = '#000000';
package/src/line/index.ts DELETED
@@ -1,8 +0,0 @@
1
- import type { Plugin } from '@pdfme/common';
2
- import { pdfRender } from './pdfRender.js';
3
- import { propPanel } from './propPanel.js';
4
- import { uiRender } from './uiRender.js';
5
- import type { LineSchema } from './types.js';
6
-
7
- const schema: Plugin<LineSchema> = { pdf: pdfRender, ui: uiRender, propPanel };
8
- export default schema;
@@ -1,24 +0,0 @@
1
- import type { PDFRenderProps } from '@pdfme/common';
2
- import type { LineSchema } from './types';
3
- import { rotatePoint, convertForPdfLayoutProps, hex2RgbColor } from '../renderUtils.js';
4
- import { DEFAULT_LINE_COLOR } from './constants.js';
5
-
6
- export const pdfRender = (arg: PDFRenderProps<LineSchema>) => {
7
- const { page, schema } = arg;
8
- const pageHeight = page.getHeight();
9
- const {
10
- width,
11
- height,
12
- rotate,
13
- position: { x, y },
14
- opacity,
15
- } = convertForPdfLayoutProps({ schema, pageHeight, applyRotateTranslate: false });
16
- const pivot = { x: x + width / 2, y: y + height / 2 };
17
- page.drawLine({
18
- start: rotatePoint({ x, y: y + height / 2 }, pivot, rotate.angle),
19
- end: rotatePoint({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
20
- thickness: height,
21
- color: hex2RgbColor(schema.color ?? DEFAULT_LINE_COLOR),
22
- opacity: opacity,
23
- });
24
- };