@pdfme/schemas 3.1.5-dev.12 → 3.1.5-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/__tests__/renderUtils.test.js +8 -8
- package/dist/cjs/__tests__/renderUtils.test.js.map +1 -1
- package/dist/cjs/src/barcodes/pdfRender.js +2 -2
- package/dist/cjs/src/barcodes/pdfRender.js.map +1 -1
- package/dist/cjs/src/barcodes/uiRender.js +3 -3
- package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
- package/dist/cjs/src/graphics/image.js +122 -0
- package/dist/cjs/src/graphics/image.js.map +1 -0
- package/dist/cjs/src/index.js +13 -10
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/{renderUtils.js → pdfRenderUtils.js} +2 -5
- package/dist/cjs/src/pdfRenderUtils.js.map +1 -0
- package/dist/cjs/src/shapes/line.js +57 -0
- package/dist/cjs/src/shapes/line.js.map +1 -0
- package/dist/cjs/src/shapes/rectAndEllipse.js +100 -0
- package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -0
- package/dist/cjs/src/text/pdfRender.js +5 -5
- package/dist/cjs/src/text/pdfRender.js.map +1 -1
- package/dist/cjs/src/text/uiRender.js +3 -3
- package/dist/cjs/src/text/uiRender.js.map +1 -1
- package/dist/cjs/src/uiRenderUtils.js +29 -0
- package/dist/cjs/src/uiRenderUtils.js.map +1 -0
- package/dist/esm/__tests__/renderUtils.test.js +1 -1
- package/dist/esm/__tests__/renderUtils.test.js.map +1 -1
- package/dist/esm/src/barcodes/pdfRender.js +1 -1
- package/dist/esm/src/barcodes/pdfRender.js.map +1 -1
- package/dist/esm/src/barcodes/uiRender.js +1 -1
- package/dist/esm/src/barcodes/uiRender.js.map +1 -1
- package/dist/esm/src/graphics/image.js +120 -0
- package/dist/esm/src/graphics/image.js.map +1 -0
- package/dist/esm/src/index.js +5 -4
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/{renderUtils.js → pdfRenderUtils.js} +2 -5
- package/dist/esm/src/pdfRenderUtils.js.map +1 -0
- package/dist/esm/src/shapes/line.js +55 -0
- package/dist/esm/src/shapes/line.js.map +1 -0
- package/dist/esm/src/shapes/rectAndEllipse.js +97 -0
- package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -0
- package/dist/esm/src/text/pdfRender.js +1 -1
- package/dist/esm/src/text/pdfRender.js.map +1 -1
- package/dist/esm/src/text/uiRender.js +1 -1
- package/dist/esm/src/text/uiRender.js.map +1 -1
- package/dist/esm/src/uiRenderUtils.js +25 -0
- package/dist/esm/src/uiRenderUtils.js.map +1 -0
- package/dist/types/src/{image/index.d.ts → graphics/image.d.ts} +3 -1
- package/dist/types/src/index.d.ts +5 -4
- package/dist/types/src/shapes/line.d.ts +6 -0
- package/dist/types/src/shapes/rectAndEllipse.d.ts +138 -0
- package/dist/types/src/uiRenderUtils.d.ts +1 -0
- package/package.json +1 -1
- package/src/barcodes/pdfRender.ts +1 -1
- package/src/barcodes/uiRender.ts +1 -1
- package/src/graphics/image.ts +151 -0
- package/src/index.ts +15 -4
- package/src/{renderUtils.ts → pdfRenderUtils.ts} +1 -4
- package/src/shapes/line.ts +67 -0
- package/src/shapes/rectAndEllipse.ts +110 -0
- package/src/text/pdfRender.ts +1 -1
- package/src/text/uiRender.ts +1 -1
- package/src/uiRenderUtils.ts +27 -0
- package/dist/cjs/src/image/index.js +0 -8
- package/dist/cjs/src/image/index.js.map +0 -1
- package/dist/cjs/src/image/pdfRender.js +0 -22
- package/dist/cjs/src/image/pdfRender.js.map +0 -1
- package/dist/cjs/src/image/propPanel.js +0 -19
- package/dist/cjs/src/image/propPanel.js.map +0 -1
- package/dist/cjs/src/image/types.js +0 -3
- package/dist/cjs/src/image/types.js.map +0 -1
- package/dist/cjs/src/image/uiRender.js +0 -113
- package/dist/cjs/src/image/uiRender.js.map +0 -1
- package/dist/cjs/src/line/constants.js +0 -5
- package/dist/cjs/src/line/constants.js.map +0 -1
- package/dist/cjs/src/line/index.js +0 -8
- package/dist/cjs/src/line/index.js.map +0 -1
- package/dist/cjs/src/line/pdfRender.js +0 -20
- package/dist/cjs/src/line/pdfRender.js.map +0 -1
- package/dist/cjs/src/line/propPanel.js +0 -35
- package/dist/cjs/src/line/propPanel.js.map +0 -1
- package/dist/cjs/src/line/types.js +0 -3
- package/dist/cjs/src/line/types.js.map +0 -1
- package/dist/cjs/src/line/uiRender.js +0 -14
- package/dist/cjs/src/line/uiRender.js.map +0 -1
- package/dist/cjs/src/renderUtils.js.map +0 -1
- package/dist/esm/src/image/index.js +0 -6
- package/dist/esm/src/image/index.js.map +0 -1
- package/dist/esm/src/image/pdfRender.js +0 -18
- package/dist/esm/src/image/pdfRender.js.map +0 -1
- package/dist/esm/src/image/propPanel.js +0 -16
- package/dist/esm/src/image/propPanel.js.map +0 -1
- package/dist/esm/src/image/types.js +0 -2
- package/dist/esm/src/image/types.js.map +0 -1
- package/dist/esm/src/image/uiRender.js +0 -109
- package/dist/esm/src/image/uiRender.js.map +0 -1
- package/dist/esm/src/line/constants.js +0 -2
- package/dist/esm/src/line/constants.js.map +0 -1
- package/dist/esm/src/line/index.js +0 -6
- package/dist/esm/src/line/index.js.map +0 -1
- package/dist/esm/src/line/pdfRender.js +0 -16
- package/dist/esm/src/line/pdfRender.js.map +0 -1
- package/dist/esm/src/line/propPanel.js +0 -32
- package/dist/esm/src/line/propPanel.js.map +0 -1
- package/dist/esm/src/line/types.js +0 -2
- package/dist/esm/src/line/types.js.map +0 -1
- package/dist/esm/src/line/uiRender.js +0 -10
- package/dist/esm/src/line/uiRender.js.map +0 -1
- package/dist/esm/src/renderUtils.js.map +0 -1
- package/dist/types/src/image/pdfRender.d.ts +0 -3
- package/dist/types/src/image/propPanel.d.ts +0 -3
- package/dist/types/src/image/types.d.ts +0 -3
- package/dist/types/src/image/uiRender.d.ts +0 -3
- package/dist/types/src/line/constants.d.ts +0 -1
- package/dist/types/src/line/index.d.ts +0 -4
- package/dist/types/src/line/pdfRender.d.ts +0 -3
- package/dist/types/src/line/propPanel.d.ts +0 -3
- package/dist/types/src/line/types.d.ts +0 -4
- package/dist/types/src/line/uiRender.d.ts +0 -3
- package/src/image/index.ts +0 -8
- package/src/image/pdfRender.ts +0 -29
- package/src/image/propPanel.ts +0 -19
- package/src/image/types.ts +0 -3
- package/src/image/uiRender.ts +0 -123
- package/src/line/constants.ts +0 -1
- package/src/line/index.ts +0 -8
- package/src/line/pdfRender.ts +0 -24
- package/src/line/propPanel.ts +0 -34
- package/src/line/types.ts +0 -5
- package/src/line/uiRender.ts +0 -12
- /package/dist/types/src/{renderUtils.d.ts → pdfRenderUtils.d.ts} +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
export declare const DEFAULT_LINE_COLOR = "#000000";
|
package/src/image/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 { ImageSchema } from './types';
|
6
|
-
|
7
|
-
const schema: Plugin<ImageSchema> = { pdf: pdfRender, ui: uiRender, propPanel };
|
8
|
-
export default schema;
|
package/src/image/pdfRender.ts
DELETED
@@ -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
|
-
};
|
package/src/image/propPanel.ts
DELETED
@@ -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
|
-
};
|
package/src/image/types.ts
DELETED
package/src/image/uiRender.ts
DELETED
@@ -1,123 +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
|
-
import { propPanel } from "./propPanel";
|
7
|
-
|
8
|
-
const fullSize = { width: '100%', height: '100%' };
|
9
|
-
|
10
|
-
const readFile = (input: File | FileList | null): Promise<string | ArrayBuffer> =>
|
11
|
-
new Promise((resolve, reject) => {
|
12
|
-
const fileReader = new FileReader();
|
13
|
-
|
14
|
-
fileReader.onload = (e) => {
|
15
|
-
if (e.target?.result) {
|
16
|
-
resolve(e.target.result);
|
17
|
-
}
|
18
|
-
};
|
19
|
-
|
20
|
-
fileReader.onerror = (e) => {
|
21
|
-
reject(new Error('[@pdfme/schemas] File reading failed'));
|
22
|
-
};
|
23
|
-
|
24
|
-
let file: File | null = null;
|
25
|
-
if (input instanceof FileList && input.length > 0) {
|
26
|
-
file = input[0];
|
27
|
-
} else if (input instanceof File) {
|
28
|
-
file = input;
|
29
|
-
}
|
30
|
-
|
31
|
-
if (file) {
|
32
|
-
fileReader.readAsDataURL(file);
|
33
|
-
} else {
|
34
|
-
reject(new Error('[@pdfme/schemas] No files provided'));
|
35
|
-
}
|
36
|
-
});
|
37
|
-
|
38
|
-
export const uiRender = async (arg: UIRenderProps<ImageSchema>) => {
|
39
|
-
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } =
|
40
|
-
arg;
|
41
|
-
const editable = isEditable(mode);
|
42
|
-
const isDefault = value === propPanel.defaultValue;
|
43
|
-
|
44
|
-
const size = { width: schema.width * ZOOM, height: schema.height * ZOOM };
|
45
|
-
|
46
|
-
const container = document.createElement('div');
|
47
|
-
const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
|
48
|
-
const containerStyle: CSS.Properties = {
|
49
|
-
...fullSize,
|
50
|
-
backgroundImage: value ? 'none' : backgroundStyle,
|
51
|
-
backgroundSize: `${size.width}px ${size.height}px`,
|
52
|
-
};
|
53
|
-
Object.assign(container.style, containerStyle);
|
54
|
-
container.addEventListener('click', (e) => {
|
55
|
-
if (editable) {
|
56
|
-
e.stopPropagation();
|
57
|
-
}
|
58
|
-
});
|
59
|
-
rootElement.appendChild(container);
|
60
|
-
|
61
|
-
// image tag
|
62
|
-
if (value) {
|
63
|
-
const img = document.createElement('img');
|
64
|
-
const imgStyle: CSS.Properties = { height: '100%', width: '100%', borderRadius: 0 };
|
65
|
-
Object.assign(img.style, imgStyle);
|
66
|
-
img.src = value;
|
67
|
-
container.appendChild(img);
|
68
|
-
}
|
69
|
-
|
70
|
-
// remove button
|
71
|
-
if (value && !isDefault && editable) {
|
72
|
-
const button = document.createElement('button');
|
73
|
-
button.textContent = 'x';
|
74
|
-
const buttonStyle: CSS.Properties = {
|
75
|
-
position: 'absolute',
|
76
|
-
top: 0,
|
77
|
-
left: 0,
|
78
|
-
zIndex: 1,
|
79
|
-
display: 'flex',
|
80
|
-
justifyContent: 'center',
|
81
|
-
alignItems: 'center',
|
82
|
-
color: '#333',
|
83
|
-
background: '#f2f2f2',
|
84
|
-
borderRadius: '2px',
|
85
|
-
border: '1px solid #767676',
|
86
|
-
cursor: 'pointer',
|
87
|
-
height: '24px',
|
88
|
-
width: '24px',
|
89
|
-
};
|
90
|
-
Object.assign(button.style, buttonStyle);
|
91
|
-
button.addEventListener('click', () => {
|
92
|
-
onChange && onChange('');
|
93
|
-
});
|
94
|
-
container.appendChild(button);
|
95
|
-
}
|
96
|
-
|
97
|
-
// file input
|
98
|
-
if ((!value || isDefault) && editable) {
|
99
|
-
const label = document.createElement('label');
|
100
|
-
const labelStyle: CSS.Properties = {
|
101
|
-
...fullSize,
|
102
|
-
display: editable ? 'flex' : 'none',
|
103
|
-
position: 'absolute',
|
104
|
-
top: 0,
|
105
|
-
backgroundColor: editable || value ? addAlphaToHex(theme.colorPrimaryBg, 30) : 'none',
|
106
|
-
cursor: 'pointer',
|
107
|
-
};
|
108
|
-
Object.assign(label.style, labelStyle);
|
109
|
-
container.appendChild(label);
|
110
|
-
const input = document.createElement('input');
|
111
|
-
const inputStyle: CSS.Properties = { ...fullSize, position: 'absolute', top: '50%' };
|
112
|
-
Object.assign(input.style, inputStyle);
|
113
|
-
input.tabIndex = tabIndex || 0;
|
114
|
-
input.type = 'file';
|
115
|
-
input.accept = 'image/jpeg, image/png';
|
116
|
-
input.addEventListener('change', (event: Event) => {
|
117
|
-
const changeEvent = event as unknown as ChangeEvent<HTMLInputElement>;
|
118
|
-
readFile(changeEvent.target.files).then((result) => onChange && onChange(result as string));
|
119
|
-
});
|
120
|
-
input.addEventListener('blur', () => stopEditing && stopEditing());
|
121
|
-
label.appendChild(input);
|
122
|
-
}
|
123
|
-
};
|
package/src/line/constants.ts
DELETED
@@ -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;
|
package/src/line/pdfRender.ts
DELETED
@@ -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
|
-
};
|
package/src/line/propPanel.ts
DELETED
@@ -1,34 +0,0 @@
|
|
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
|
-
};
|
package/src/line/types.ts
DELETED
package/src/line/uiRender.ts
DELETED
@@ -1,12 +0,0 @@
|
|
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
|
-
rootElement.appendChild(div);
|
12
|
-
};
|
File without changes
|