@pdfme/schemas 3.1.5-dev.6 → 3.1.5-dev.7

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 (87) hide show
  1. package/dist/cjs/src/barcodes/propPanel.js +27 -29
  2. package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
  3. package/dist/cjs/src/barcodes/uiRender.js +3 -5
  4. package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
  5. package/dist/cjs/src/image/pdfRender.js +2 -0
  6. package/dist/cjs/src/image/pdfRender.js.map +1 -1
  7. package/dist/cjs/src/image/uiRender.js +3 -2
  8. package/dist/cjs/src/image/uiRender.js.map +1 -1
  9. package/dist/cjs/src/index.js +3 -1
  10. package/dist/cjs/src/index.js.map +1 -1
  11. package/dist/cjs/src/line/constants.js +5 -0
  12. package/dist/cjs/src/line/constants.js.map +1 -0
  13. package/dist/cjs/src/line/index.js +8 -0
  14. package/dist/cjs/src/line/index.js.map +1 -0
  15. package/dist/cjs/src/line/pdfRender.js +20 -0
  16. package/dist/cjs/src/line/pdfRender.js.map +1 -0
  17. package/dist/cjs/src/line/propPanel.js +35 -0
  18. package/dist/cjs/src/line/propPanel.js.map +1 -0
  19. package/dist/cjs/src/line/types.js +3 -0
  20. package/dist/cjs/src/line/types.js.map +1 -0
  21. package/dist/cjs/src/line/uiRender.js +17 -0
  22. package/dist/cjs/src/line/uiRender.js.map +1 -0
  23. package/dist/cjs/src/renderUtils.js +28 -1
  24. package/dist/cjs/src/renderUtils.js.map +1 -1
  25. package/dist/cjs/src/text/index.js.map +1 -1
  26. package/dist/cjs/src/text/pdfRender.js +5 -28
  27. package/dist/cjs/src/text/pdfRender.js.map +1 -1
  28. package/dist/cjs/src/text/propPanel.js +2 -2
  29. package/dist/cjs/src/text/propPanel.js.map +1 -1
  30. package/dist/cjs/src/text/uiRender.js +11 -15
  31. package/dist/cjs/src/text/uiRender.js.map +1 -1
  32. package/dist/esm/src/barcodes/propPanel.js +27 -29
  33. package/dist/esm/src/barcodes/propPanel.js.map +1 -1
  34. package/dist/esm/src/barcodes/uiRender.js +4 -6
  35. package/dist/esm/src/barcodes/uiRender.js.map +1 -1
  36. package/dist/esm/src/image/pdfRender.js +2 -0
  37. package/dist/esm/src/image/pdfRender.js.map +1 -1
  38. package/dist/esm/src/image/uiRender.js +4 -3
  39. package/dist/esm/src/image/uiRender.js.map +1 -1
  40. package/dist/esm/src/index.js +2 -1
  41. package/dist/esm/src/index.js.map +1 -1
  42. package/dist/esm/src/line/constants.js +2 -0
  43. package/dist/esm/src/line/constants.js.map +1 -0
  44. package/dist/esm/src/line/index.js +6 -0
  45. package/dist/esm/src/line/index.js.map +1 -0
  46. package/dist/esm/src/line/pdfRender.js +16 -0
  47. package/dist/esm/src/line/pdfRender.js.map +1 -0
  48. package/dist/esm/src/line/propPanel.js +32 -0
  49. package/dist/esm/src/line/propPanel.js.map +1 -0
  50. package/dist/esm/src/line/types.js +2 -0
  51. package/dist/esm/src/line/types.js.map +1 -0
  52. package/dist/esm/src/line/uiRender.js +13 -0
  53. package/dist/esm/src/line/uiRender.js.map +1 -0
  54. package/dist/esm/src/renderUtils.js +27 -2
  55. package/dist/esm/src/renderUtils.js.map +1 -1
  56. package/dist/esm/src/text/index.js.map +1 -1
  57. package/dist/esm/src/text/pdfRender.js +5 -28
  58. package/dist/esm/src/text/pdfRender.js.map +1 -1
  59. package/dist/esm/src/text/propPanel.js +2 -2
  60. package/dist/esm/src/text/propPanel.js.map +1 -1
  61. package/dist/esm/src/text/uiRender.js +12 -16
  62. package/dist/esm/src/text/uiRender.js.map +1 -1
  63. package/dist/types/src/index.d.ts +2 -1
  64. package/dist/types/src/line/constants.d.ts +1 -0
  65. package/dist/types/src/line/index.d.ts +4 -0
  66. package/dist/types/src/line/pdfRender.d.ts +3 -0
  67. package/dist/types/src/line/propPanel.d.ts +3 -0
  68. package/dist/types/src/line/types.d.ts +4 -0
  69. package/dist/types/src/line/uiRender.d.ts +3 -0
  70. package/dist/types/src/renderUtils.d.ts +3 -1
  71. package/package.json +1 -1
  72. package/src/barcodes/propPanel.ts +27 -29
  73. package/src/barcodes/uiRender.ts +4 -6
  74. package/src/image/pdfRender.ts +1 -0
  75. package/src/image/uiRender.ts +4 -3
  76. package/src/index.ts +2 -1
  77. package/src/line/constants.ts +1 -0
  78. package/src/line/index.ts +8 -0
  79. package/src/line/pdfRender.ts +24 -0
  80. package/src/line/propPanel.ts +34 -0
  81. package/src/line/types.ts +5 -0
  82. package/src/line/uiRender.ts +15 -0
  83. package/src/renderUtils.ts +34 -2
  84. package/src/text/index.ts +0 -1
  85. package/src/text/pdfRender.ts +5 -41
  86. package/src/text/propPanel.ts +2 -2
  87. package/src/text/uiRender.ts +11 -25
@@ -1 +1 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/text/uiRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,iCAAiC,GAClC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,sBAAsB,GAAG,CAAC,sBAA0C,EAAE,EAAE;IAC5E,QAAQ,sBAAsB,EAAE;QAC9B,KAAK,kBAAkB;YACrB,OAAO,YAAY,CAAC;QACtB,KAAK,qBAAqB;YACxB,OAAO,QAAQ,CAAC;QAClB,KAAK,qBAAqB;YACxB,OAAO,UAAU,CAAC;KACrB;IACD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,M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AC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,SAAS,IAAI,kBAAkB,CAAC;iBAChE;YACH,CAAC,CAAC,CAAC;SACJ;QAED,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEjC,IAAI,IAAI,KAAK,UAAU,EAAE;YACvB,SAAS,CAAC,KAAK,EAAE,CAAC;YAElB,8FAA8F;YAC9F,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;YACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;YACrC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACpC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,4BAA4B;YACnD,SAAS,EAAE,eAAe,EAAE,CAAC;YAC7B,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC5B;KACF;SAAM;QACL,SAAS,CAAC,SAAS,GAAG,KAAK;aACxB,KAAK,CAAC,EAAE,CAAC;aACT,GAAG,CACF,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CACvB,+BACE,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SACvC,MAAM,CAAC,SAAS,CACnB;aACA,IAAI,CAAC,EAAE,CAAC,CAAC;QAEZ,SAAS,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;KAClC;AACH,CAAC,CAAC"}
@@ -1,8 +1,9 @@
1
1
  import text from './text/index.js';
2
2
  import image from './image/index.js';
3
3
  import barcodes from './barcodes/index.js';
4
+ import line from './line/index.js';
4
5
  import { convertForPdfLayoutProps, rotatePoint } from './renderUtils.js';
5
6
  declare const builtInPlugins: {
6
7
  Text: import("@pdfme/common").Plugin<import("./text/types.js").TextSchema>;
7
8
  };
8
- export { text, image, barcodes, builtInPlugins, convertForPdfLayoutProps, rotatePoint };
9
+ export { text, image, barcodes, line, builtInPlugins, convertForPdfLayoutProps, rotatePoint };
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_LINE_COLOR = "#000000";
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from '@pdfme/common';
2
+ import type { LineSchema } from './types.js';
3
+ declare const schema: Plugin<LineSchema>;
4
+ export default schema;
@@ -0,0 +1,3 @@
1
+ import type { PDFRenderProps } from '@pdfme/common';
2
+ import type { LineSchema } from './types';
3
+ export declare const pdfRender: (arg: PDFRenderProps<LineSchema>) => void;
@@ -0,0 +1,3 @@
1
+ import { PropPanel } from '@pdfme/common';
2
+ import type { LineSchema } from './types';
3
+ export declare const propPanel: PropPanel<LineSchema>;
@@ -0,0 +1,4 @@
1
+ import { Schema } from '@pdfme/common';
2
+ export interface LineSchema extends Schema {
3
+ color: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ import type { LineSchema } from './types';
2
+ import { UIRenderProps } from '@pdfme/common';
3
+ export declare const uiRender: (arg: UIRenderProps<LineSchema>) => void;
@@ -1,4 +1,4 @@
1
- import { Schema } from '@pdfme/common';
1
+ import { Schema, Mode } from '@pdfme/common';
2
2
  export declare const convertForPdfLayoutProps: ({ schema, pageHeight, applyRotateTranslate, }: {
3
3
  schema: Schema;
4
4
  pageHeight: number;
@@ -24,3 +24,5 @@ export declare const rotatePoint: (point: {
24
24
  y: number;
25
25
  };
26
26
  export declare const addAlphaToHex: (hex: string, alphaPercentage: number) => string;
27
+ export declare const isEditable: (mode: Mode) => boolean;
28
+ export declare const hex2RgbColor: (hexString: string | undefined) => import("@pdfme/pdf-lib").RGB | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/schemas",
3
- "version": "3.1.5-dev.6",
3
+ "version": "3.1.5-dev.7",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -157,35 +157,33 @@ export const getPropPanelByBarcodeType = (barcodeType: string): PropPanel<Barcod
157
157
  if (!defaults) throw new Error(`[@pdfme/schemas] No default for barcode type ${barcodeType}`);
158
158
 
159
159
  return {
160
- schema: ({ i18n }) => {
161
- return {
162
- barColor: {
163
- title: i18n('schemas.barcodes.barColor'),
164
- type: 'string',
165
- widget: 'color',
166
- rules: [
167
- {
168
- pattern: HEX_COLOR_PATTERN,
169
- message: 'Please enter a valid hex color code.',
170
- },
171
- ],
172
- },
173
- backgroundColor: {
174
- title: i18n('schemas.bgColor'),
175
- type: 'string',
176
- widget: 'color',
177
- rules: [
178
- {
179
- pattern: HEX_COLOR_PATTERN,
180
- message: 'Please enter a valid hex color code.',
181
- },
182
- ],
183
- },
184
- ...(barcodeHasText
185
- ? { textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' } }
186
- : {}),
187
- };
188
- },
160
+ schema: ({ i18n }) => ({
161
+ barColor: {
162
+ title: i18n('schemas.barcodes.barColor'),
163
+ type: 'string',
164
+ widget: 'color',
165
+ rules: [
166
+ {
167
+ pattern: HEX_COLOR_PATTERN,
168
+ message: i18n('hexColorPrompt'),
169
+ },
170
+ ],
171
+ },
172
+ backgroundColor: {
173
+ title: i18n('schemas.bgColor'),
174
+ type: 'string',
175
+ widget: 'color',
176
+ rules: [
177
+ {
178
+ pattern: HEX_COLOR_PATTERN,
179
+ message: i18n('hexColorPrompt'),
180
+ },
181
+ ],
182
+ },
183
+ ...(barcodeHasText
184
+ ? { textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' } }
185
+ : {}),
186
+ }),
189
187
  ...defaults,
190
188
  };
191
189
  };
@@ -2,7 +2,7 @@ import type * as CSS from 'csstype';
2
2
  import { UIRenderProps } from '@pdfme/common';
3
3
  import type { BarcodeSchema } from './types';
4
4
  import { validateBarcodeInput, createBarCode } from './helper.js';
5
- import { addAlphaToHex } from '../renderUtils.js';
5
+ import { addAlphaToHex, isEditable } from '../renderUtils.js';
6
6
 
7
7
  const fullSize = { width: '100%', height: '100%' };
8
8
 
@@ -75,7 +75,7 @@ export const uiRender = async (arg: UIRenderProps<BarcodeSchema>) => {
75
75
  };
76
76
  Object.assign(container.style, containerStyle);
77
77
  rootElement.appendChild(container);
78
- const editable = mode === 'form' || mode === 'designer';
78
+ const editable = isEditable(mode);
79
79
  if (editable) {
80
80
  const input = document.createElement('input');
81
81
  const inputStyle: CSS.Properties = {
@@ -102,10 +102,8 @@ export const uiRender = async (arg: UIRenderProps<BarcodeSchema>) => {
102
102
  stopEditing && stopEditing();
103
103
  });
104
104
  container.appendChild(input);
105
- if (mode === 'designer') {
106
- input.setSelectionRange(value.length, value.length);
107
- input.focus();
108
- }
105
+ input.setSelectionRange(value.length, value.length);
106
+ input.focus();
109
107
  }
110
108
 
111
109
  if (!value) return;
@@ -6,6 +6,7 @@ const getCacheKey = (schema: Schema, input: string) => `${schema.type}${input}`;
6
6
 
7
7
  export const pdfRender = async (arg: PDFRenderProps<ImageSchema>) => {
8
8
  const { value, schema, pdfDoc, page, _cache } = arg;
9
+ if (!value || !value.startsWith('data:image/')) return;
9
10
 
10
11
  const inputImageCacheKey = getCacheKey(schema, value);
11
12
  let image = _cache.get(inputImageCacheKey);
@@ -2,7 +2,7 @@ import type { ChangeEvent } from 'react';
2
2
  import type * as CSS from 'csstype';
3
3
  import type { ImageSchema } from './types';
4
4
  import { UIRenderProps, ZOOM } from '@pdfme/common';
5
- import { addAlphaToHex } from '../renderUtils.js';
5
+ import { addAlphaToHex, isEditable } from '../renderUtils.js';
6
6
 
7
7
  const fullSize = { width: '100%', height: '100%' };
8
8
 
@@ -37,14 +37,15 @@ const readFile = (input: File | FileList | null): Promise<string | ArrayBuffer>
37
37
  export const uiRender = async (arg: UIRenderProps<ImageSchema>) => {
38
38
  const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } =
39
39
  arg;
40
- const editable = mode === 'form' || mode === 'designer';
40
+ const editable = isEditable(mode);
41
41
 
42
42
  const size = { width: schema.width * ZOOM, height: schema.height * ZOOM };
43
43
 
44
44
  const container = document.createElement('div');
45
+ const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
45
46
  const containerStyle: CSS.Properties = {
46
47
  ...fullSize,
47
- backgroundImage: value ? 'none' : `url(${placeholder})`,
48
+ backgroundImage: value ? 'none' : backgroundStyle,
48
49
  backgroundSize: `${size.width}px ${size.height}px`,
49
50
  opacity: schema.opacity,
50
51
  };
package/src/index.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import text from './text/index.js';
2
2
  import image from './image/index.js';
3
3
  import barcodes from './barcodes/index.js';
4
+ import line from './line/index.js';
4
5
  import { convertForPdfLayoutProps, rotatePoint } from './renderUtils.js';
5
6
 
6
7
  const builtInPlugins = { Text: text };
7
8
 
8
- export { text, image, barcodes, builtInPlugins, convertForPdfLayoutProps, rotatePoint };
9
+ export { text, image, barcodes, line, builtInPlugins, convertForPdfLayoutProps, rotatePoint };
@@ -0,0 +1 @@
1
+ export const DEFAULT_LINE_COLOR = '#000000';
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,24 @@
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
+ };
@@ -0,0 +1,34 @@
1
+ import { PropPanel } from '@pdfme/common';
2
+ import type { LineSchema } from './types';
3
+ import { HEX_COLOR_PATTERN } from '../constants.js';
4
+ import { DEFAULT_LINE_COLOR } from './constants.js';
5
+
6
+ export const propPanel: PropPanel<LineSchema> = {
7
+ schema: ({ i18n }) => {
8
+ return {
9
+ color: {
10
+ title: i18n('schemas.line.color'),
11
+ type: 'string',
12
+ widget: 'color',
13
+ required: true,
14
+ rules: [
15
+ {
16
+ pattern: HEX_COLOR_PATTERN,
17
+ message: i18n('hexColorPrompt'),
18
+ },
19
+ ],
20
+ },
21
+ };
22
+ },
23
+ defaultValue: '',
24
+ defaultSchema: {
25
+ type: 'line',
26
+ position: { x: 0, y: 0 },
27
+ width: 50,
28
+ height: 1,
29
+ rotate: 0,
30
+ opacity: 1,
31
+ readOnly: true,
32
+ color: DEFAULT_LINE_COLOR,
33
+ },
34
+ };
@@ -0,0 +1,5 @@
1
+ import { Schema } from '@pdfme/common';
2
+
3
+ export interface LineSchema extends Schema {
4
+ color: string;
5
+ }
@@ -0,0 +1,15 @@
1
+ import type { LineSchema } from './types';
2
+ import { UIRenderProps } from '@pdfme/common';
3
+ import { DEFAULT_LINE_COLOR } from './constants.js';
4
+
5
+ export const uiRender = (arg: UIRenderProps<LineSchema>) => {
6
+ const { schema, rootElement } = arg;
7
+ const div = document.createElement('div');
8
+ div.style.backgroundColor = schema.color ?? DEFAULT_LINE_COLOR;
9
+ div.style.width = '100%';
10
+ div.style.height = '100%';
11
+ if (schema.opacity !== undefined) {
12
+ div.style.opacity = `${schema.opacity}`;
13
+ }
14
+ rootElement.appendChild(div);
15
+ };
@@ -1,5 +1,5 @@
1
- import { degrees, degreesToRadians } from '@pdfme/pdf-lib';
2
- import { Schema, mm2pt } from '@pdfme/common';
1
+ import { degrees, degreesToRadians, rgb } from '@pdfme/pdf-lib';
2
+ import { Schema, mm2pt, Mode, isHexValid } from '@pdfme/common';
3
3
 
4
4
  export const convertForPdfLayoutProps = ({
5
5
  schema,
@@ -71,3 +71,35 @@ export const addAlphaToHex = (hex: string, alphaPercentage: number) => {
71
71
  if (alphaHex.length === 1) alphaHex = '0' + alphaHex;
72
72
  return hex + alphaHex;
73
73
  };
74
+
75
+ export const isEditable = (mode: Mode) => mode === 'form' || mode === 'designer';
76
+
77
+ const hex2rgb = (hex: string) => {
78
+ if (hex.slice(0, 1) === '#') hex = hex.slice(1);
79
+ if (hex.length === 3)
80
+ hex =
81
+ hex.slice(0, 1) +
82
+ hex.slice(0, 1) +
83
+ hex.slice(1, 2) +
84
+ hex.slice(1, 2) +
85
+ hex.slice(2, 3) +
86
+ hex.slice(2, 3);
87
+
88
+ return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map((str) => parseInt(str, 16));
89
+ };
90
+
91
+ export const hex2RgbColor = (hexString: string | undefined) => {
92
+ if (hexString) {
93
+ const isValid = isHexValid(hexString);
94
+
95
+ if (!isValid) {
96
+ throw new Error(`Invalid hex color value ${hexString}`);
97
+ }
98
+
99
+ const [r, g, b] = hex2rgb(hexString);
100
+
101
+ return rgb(r / 255, g / 255, b / 255);
102
+ }
103
+
104
+ return undefined;
105
+ };
package/src/text/index.ts CHANGED
@@ -5,5 +5,4 @@ import { uiRender } from './uiRender.js';
5
5
  import type { TextSchema } from './types';
6
6
 
7
7
  const schema: Plugin<TextSchema> = { pdf: pdfRender, ui: uiRender, propPanel };
8
-
9
8
  export default schema;
@@ -1,12 +1,5 @@
1
- import { PDFFont, PDFDocument, rgb } from '@pdfme/pdf-lib';
2
- import {
3
- PDFRenderProps,
4
- Font,
5
- getDefaultFont,
6
- getFallbackFontName,
7
- mm2pt,
8
- isHexValid,
9
- } from '@pdfme/common';
1
+ import { PDFFont, PDFDocument } from '@pdfme/pdf-lib';
2
+ import { PDFRenderProps, Font, getDefaultFont, getFallbackFontName, mm2pt } from '@pdfme/common';
10
3
  import type { TextSchema, FontWidthCalcValues } from './types';
11
4
  import {
12
5
  VERTICAL_ALIGN_TOP,
@@ -27,37 +20,7 @@ import {
27
20
  getSplittedLines,
28
21
  widthOfTextAtSize,
29
22
  } from './helper.js';
30
- import { convertForPdfLayoutProps, rotatePoint } from '../renderUtils.js';
31
-
32
- const hex2rgb = (hex: string) => {
33
- if (hex.slice(0, 1) === '#') hex = hex.slice(1);
34
- if (hex.length === 3)
35
- hex =
36
- hex.slice(0, 1) +
37
- hex.slice(0, 1) +
38
- hex.slice(1, 2) +
39
- hex.slice(1, 2) +
40
- hex.slice(2, 3) +
41
- hex.slice(2, 3);
42
-
43
- return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map((str) => parseInt(str, 16));
44
- };
45
-
46
- const hex2RgbColor = (hexString: string | undefined) => {
47
- if (hexString) {
48
- const isValid = isHexValid(hexString);
49
-
50
- if (!isValid) {
51
- throw new Error(`Invalid hex color value ${hexString}`);
52
- }
53
-
54
- const [r, g, b] = hex2rgb(hexString);
55
-
56
- return rgb(r / 255, g / 255, b / 255);
57
- }
58
-
59
- return undefined;
60
- };
23
+ import { convertForPdfLayoutProps, rotatePoint, hex2RgbColor } from '../renderUtils.js';
61
24
 
62
25
  const embedAndGetFontObj = async (arg: {
63
26
  pdfDoc: PDFDocument;
@@ -118,6 +81,7 @@ const getFontProp = async ({
118
81
 
119
82
  export const pdfRender = async (arg: PDFRenderProps<TextSchema>) => {
120
83
  const { value, pdfDoc, pdfLib, page, options, schema, _cache } = arg;
84
+ if (!value) return;
121
85
 
122
86
  const { font = getDefaultFont() } = options;
123
87
 
@@ -132,7 +96,7 @@ export const pdfRender = async (arg: PDFRenderProps<TextSchema>) => {
132
96
  const fontName = (
133
97
  schema.fontName ? schema.fontName : getFallbackFontName(font)
134
98
  ) as keyof typeof pdfFontObj;
135
- const pdfFontValue = pdfFontObj[fontName];
99
+ const pdfFontValue = pdfFontObj && pdfFontObj[fontName];
136
100
 
137
101
  const pageHeight = page.getHeight();
138
102
  const {
@@ -153,7 +153,7 @@ export const propPanel: PropPanel<TextSchema> = {
153
153
  rules: [
154
154
  {
155
155
  pattern: HEX_COLOR_PATTERN,
156
- message: 'Please enter a valid hex color code.',
156
+ message: i18n('hexColorPrompt'),
157
157
  },
158
158
  ],
159
159
  },
@@ -164,7 +164,7 @@ export const propPanel: PropPanel<TextSchema> = {
164
164
  rules: [
165
165
  {
166
166
  pattern: HEX_COLOR_PATTERN,
167
- message: 'Please enter a valid hex color code.',
167
+ message: i18n('hexColorPrompt'),
168
168
  },
169
169
  ],
170
170
  },
@@ -18,7 +18,7 @@ import {
18
18
  getFontKitFont,
19
19
  getBrowserVerticalFontAdjustments,
20
20
  } from './helper.js';
21
- import { addAlphaToHex } from '../renderUtils.js';
21
+ import { addAlphaToHex, isEditable } from '../renderUtils.js';
22
22
  import { DEFAULT_OPACITY } from '../constants.js';
23
23
 
24
24
  const mapVerticalAlignToFlex = (verticalAlignmentValue: string | undefined) => {
@@ -33,19 +33,10 @@ const mapVerticalAlignToFlex = (verticalAlignmentValue: string | undefined) => {
33
33
  return 'flex-start';
34
34
  };
35
35
 
36
- const getBackgroundColor = (
37
- mode: 'form' | 'viewer' | 'designer',
38
- value: string,
39
- schema: Schema,
40
- defaultBackgroundColor: string
41
- ) => {
42
- if ((mode === 'form' || mode === 'designer') && value && schema.backgroundColor) {
43
- return schema.backgroundColor as string;
44
- } else if (mode === 'viewer') {
45
- return (schema.backgroundColor as string) ?? 'transparent';
46
- } else {
47
- return defaultBackgroundColor;
48
- }
36
+ const getBackgroundColor = (value: string, schema: Schema, defaultBackgroundColor: string) => {
37
+ if (!value) return 'transparent';
38
+ if (schema.backgroundColor) return schema.backgroundColor as string;
39
+ return defaultBackgroundColor;
49
40
  };
50
41
 
51
42
  export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
@@ -94,12 +85,7 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
94
85
  const containerStyle: CSS.Properties = {
95
86
  padding: 0,
96
87
  resize: 'none',
97
- backgroundColor: getBackgroundColor(
98
- mode,
99
- value,
100
- schema,
101
- addAlphaToHex(theme.colorPrimaryBg, 30)
102
- ),
88
+ backgroundColor: getBackgroundColor(value, schema, addAlphaToHex(theme.colorPrimaryBg, 30)),
103
89
  border: 'none',
104
90
  display: 'flex',
105
91
  flexDirection: 'column',
@@ -126,14 +112,14 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
126
112
  resize: 'none',
127
113
  border: 'none',
128
114
  outline: 'none',
129
- marginBottom: bottomAdjustment + 'px',
130
- paddingTop: topAdjustment + 'px',
115
+ marginBottom: `${bottomAdjustment}px`,
116
+ paddingTop: `${topAdjustment}px`,
131
117
  backgroundColor: 'transparent',
132
118
  };
133
119
  const textBlock = document.createElement('div');
134
120
  Object.assign(textBlock.style, textBlockStyle);
135
121
 
136
- if (mode === 'form' || mode === 'designer') {
122
+ if (isEditable(mode)) {
137
123
  textBlock.contentEditable = 'plaintext-only';
138
124
  textBlock.tabIndex = tabIndex || 0;
139
125
  textBlock.innerText = value;
@@ -157,8 +143,8 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
157
143
  schema.lineHeight ?? DEFAULT_LINE_HEIGHT,
158
144
  schema.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT
159
145
  );
160
- textBlock.style.paddingTop = newTopAdj.toString() + 'px';
161
- textBlock.style.marginBottom = newBottomAdj.toString() + 'px';
146
+ textBlock.style.paddingTop = `${newTopAdj}px`;
147
+ textBlock.style.marginBottom = `${newBottomAdj}px`;
162
148
  })();
163
149
  }, 0);
164
150
  });