@pdfme/schemas 3.1.5-dev.1 → 3.1.5-dev.11
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/README.md +303 -0
- package/dist/cjs/src/barcodes/propPanel.js +27 -29
- package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
- package/dist/cjs/src/barcodes/uiRender.js +8 -10
- package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
- package/dist/cjs/src/image/pdfRender.js +2 -0
- package/dist/cjs/src/image/pdfRender.js.map +1 -1
- package/dist/cjs/src/image/uiRender.js +7 -5
- package/dist/cjs/src/image/uiRender.js.map +1 -1
- package/dist/cjs/src/index.js +3 -1
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/line/constants.js +5 -0
- package/dist/cjs/src/line/constants.js.map +1 -0
- package/dist/cjs/src/line/index.js +8 -0
- package/dist/cjs/src/line/index.js.map +1 -0
- package/dist/cjs/src/line/pdfRender.js +20 -0
- package/dist/cjs/src/line/pdfRender.js.map +1 -0
- package/dist/cjs/src/line/propPanel.js +35 -0
- package/dist/cjs/src/line/propPanel.js.map +1 -0
- package/dist/cjs/src/line/types.js +3 -0
- package/dist/cjs/src/line/types.js.map +1 -0
- package/dist/cjs/src/line/uiRender.js +14 -0
- package/dist/cjs/src/line/uiRender.js.map +1 -0
- package/dist/cjs/src/renderUtils.js +28 -1
- package/dist/cjs/src/renderUtils.js.map +1 -1
- package/dist/cjs/src/text/index.js.map +1 -1
- package/dist/cjs/src/text/pdfRender.js +6 -29
- package/dist/cjs/src/text/pdfRender.js.map +1 -1
- package/dist/cjs/src/text/propPanel.js +2 -2
- package/dist/cjs/src/text/propPanel.js.map +1 -1
- package/dist/cjs/src/text/uiRender.js +11 -17
- package/dist/cjs/src/text/uiRender.js.map +1 -1
- package/dist/esm/src/barcodes/propPanel.js +27 -29
- package/dist/esm/src/barcodes/propPanel.js.map +1 -1
- package/dist/esm/src/barcodes/uiRender.js +9 -11
- package/dist/esm/src/barcodes/uiRender.js.map +1 -1
- package/dist/esm/src/image/pdfRender.js +2 -0
- package/dist/esm/src/image/pdfRender.js.map +1 -1
- package/dist/esm/src/image/uiRender.js +8 -6
- package/dist/esm/src/image/uiRender.js.map +1 -1
- package/dist/esm/src/index.js +2 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/line/constants.js +2 -0
- package/dist/esm/src/line/constants.js.map +1 -0
- package/dist/esm/src/line/index.js +6 -0
- package/dist/esm/src/line/index.js.map +1 -0
- package/dist/esm/src/line/pdfRender.js +16 -0
- package/dist/esm/src/line/pdfRender.js.map +1 -0
- package/dist/esm/src/line/propPanel.js +32 -0
- package/dist/esm/src/line/propPanel.js.map +1 -0
- package/dist/esm/src/line/types.js +2 -0
- package/dist/esm/src/line/types.js.map +1 -0
- package/dist/esm/src/line/uiRender.js +10 -0
- package/dist/esm/src/line/uiRender.js.map +1 -0
- package/dist/esm/src/renderUtils.js +27 -2
- package/dist/esm/src/renderUtils.js.map +1 -1
- package/dist/esm/src/text/index.js.map +1 -1
- package/dist/esm/src/text/pdfRender.js +6 -29
- package/dist/esm/src/text/pdfRender.js.map +1 -1
- package/dist/esm/src/text/propPanel.js +2 -2
- package/dist/esm/src/text/propPanel.js.map +1 -1
- package/dist/esm/src/text/uiRender.js +12 -18
- package/dist/esm/src/text/uiRender.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/line/constants.d.ts +1 -0
- package/dist/types/src/line/index.d.ts +4 -0
- package/dist/types/src/line/pdfRender.d.ts +3 -0
- package/dist/types/src/line/propPanel.d.ts +3 -0
- package/dist/types/src/line/types.d.ts +4 -0
- package/dist/types/src/line/uiRender.d.ts +3 -0
- package/dist/types/src/renderUtils.d.ts +3 -1
- package/package.json +1 -1
- package/src/barcodes/propPanel.ts +27 -29
- package/src/barcodes/uiRender.ts +9 -11
- package/src/image/pdfRender.ts +1 -0
- package/src/image/uiRender.ts +8 -6
- package/src/index.ts +2 -1
- package/src/line/constants.ts +1 -0
- package/src/line/index.ts +8 -0
- package/src/line/pdfRender.ts +24 -0
- package/src/line/propPanel.ts +34 -0
- package/src/line/types.ts +5 -0
- package/src/line/uiRender.ts +12 -0
- package/src/renderUtils.ts +34 -2
- package/src/text/index.ts +0 -1
- package/src/text/pdfRender.ts +6 -42
- package/src/text/propPanel.ts +2 -2
- package/src/text/uiRender.ts +11 -27
package/src/image/uiRender.ts
CHANGED
@@ -2,7 +2,8 @@ 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
|
+
import { propPanel } from "./propPanel";
|
6
7
|
|
7
8
|
const fullSize = { width: '100%', height: '100%' };
|
8
9
|
|
@@ -37,16 +38,17 @@ const readFile = (input: File | FileList | null): Promise<string | ArrayBuffer>
|
|
37
38
|
export const uiRender = async (arg: UIRenderProps<ImageSchema>) => {
|
38
39
|
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } =
|
39
40
|
arg;
|
40
|
-
const editable = mode
|
41
|
+
const editable = isEditable(mode);
|
42
|
+
const isDefault = value === propPanel.defaultValue;
|
41
43
|
|
42
44
|
const size = { width: schema.width * ZOOM, height: schema.height * ZOOM };
|
43
45
|
|
44
46
|
const container = document.createElement('div');
|
47
|
+
const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
|
45
48
|
const containerStyle: CSS.Properties = {
|
46
49
|
...fullSize,
|
47
|
-
backgroundImage: value ? 'none' :
|
50
|
+
backgroundImage: value ? 'none' : backgroundStyle,
|
48
51
|
backgroundSize: `${size.width}px ${size.height}px`,
|
49
|
-
opacity: schema.opacity,
|
50
52
|
};
|
51
53
|
Object.assign(container.style, containerStyle);
|
52
54
|
container.addEventListener('click', (e) => {
|
@@ -66,7 +68,7 @@ export const uiRender = async (arg: UIRenderProps<ImageSchema>) => {
|
|
66
68
|
}
|
67
69
|
|
68
70
|
// remove button
|
69
|
-
if (value && editable) {
|
71
|
+
if (value && !isDefault && editable) {
|
70
72
|
const button = document.createElement('button');
|
71
73
|
button.textContent = 'x';
|
72
74
|
const buttonStyle: CSS.Properties = {
|
@@ -93,7 +95,7 @@ export const uiRender = async (arg: UIRenderProps<ImageSchema>) => {
|
|
93
95
|
}
|
94
96
|
|
95
97
|
// file input
|
96
|
-
if (!value && editable) {
|
98
|
+
if ((!value || isDefault) && editable) {
|
97
99
|
const label = document.createElement('label');
|
98
100
|
const labelStyle: CSS.Properties = {
|
99
101
|
...fullSize,
|
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,12 @@
|
|
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
|
+
};
|
package/src/renderUtils.ts
CHANGED
@@ -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
package/src/text/pdfRender.ts
CHANGED
@@ -1,12 +1,5 @@
|
|
1
|
-
import { PDFFont, PDFDocument
|
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 {
|
@@ -162,7 +126,7 @@ export const pdfRender = async (arg: PDFRenderProps<TextSchema>) => {
|
|
162
126
|
};
|
163
127
|
|
164
128
|
let lines: string[] = [];
|
165
|
-
value.split(/\r
|
129
|
+
value.split(/\r\n|\r|\n/g).forEach((line: string) => {
|
166
130
|
lines = lines.concat(getSplittedLines(line, fontWidthCalcValues));
|
167
131
|
});
|
168
132
|
|
package/src/text/propPanel.ts
CHANGED
@@ -153,7 +153,7 @@ export const propPanel: PropPanel<TextSchema> = {
|
|
153
153
|
rules: [
|
154
154
|
{
|
155
155
|
pattern: HEX_COLOR_PATTERN,
|
156
|
-
message: '
|
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: '
|
167
|
+
message: i18n('hexColorPrompt'),
|
168
168
|
},
|
169
169
|
],
|
170
170
|
},
|
package/src/text/uiRender.ts
CHANGED
@@ -18,8 +18,7 @@ import {
|
|
18
18
|
getFontKitFont,
|
19
19
|
getBrowserVerticalFontAdjustments,
|
20
20
|
} from './helper.js';
|
21
|
-
import { addAlphaToHex } from '../renderUtils.js';
|
22
|
-
import { DEFAULT_OPACITY } from '../constants.js';
|
21
|
+
import { addAlphaToHex, isEditable } from '../renderUtils.js';
|
23
22
|
|
24
23
|
const mapVerticalAlignToFlex = (verticalAlignmentValue: string | undefined) => {
|
25
24
|
switch (verticalAlignmentValue) {
|
@@ -33,19 +32,10 @@ const mapVerticalAlignToFlex = (verticalAlignmentValue: string | undefined) => {
|
|
33
32
|
return 'flex-start';
|
34
33
|
};
|
35
34
|
|
36
|
-
const getBackgroundColor = (
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
}
|
35
|
+
const getBackgroundColor = (value: string, schema: Schema, defaultBackgroundColor: string) => {
|
36
|
+
if (!value) return 'transparent';
|
37
|
+
if (schema.backgroundColor) return schema.backgroundColor as string;
|
38
|
+
return defaultBackgroundColor;
|
49
39
|
};
|
50
40
|
|
51
41
|
export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
|
@@ -94,19 +84,13 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
|
|
94
84
|
const containerStyle: CSS.Properties = {
|
95
85
|
padding: 0,
|
96
86
|
resize: 'none',
|
97
|
-
backgroundColor: getBackgroundColor(
|
98
|
-
mode,
|
99
|
-
value,
|
100
|
-
schema,
|
101
|
-
addAlphaToHex(theme.colorPrimaryBg, 30)
|
102
|
-
),
|
87
|
+
backgroundColor: getBackgroundColor(value, schema, addAlphaToHex(theme.colorPrimaryBg, 30)),
|
103
88
|
border: 'none',
|
104
89
|
display: 'flex',
|
105
90
|
flexDirection: 'column',
|
106
91
|
justifyContent: mapVerticalAlignToFlex(schema.verticalAlignment),
|
107
92
|
width: '100%',
|
108
93
|
height: '100%',
|
109
|
-
opacity: schema.opacity ?? DEFAULT_OPACITY,
|
110
94
|
};
|
111
95
|
Object.assign(container.style, containerStyle);
|
112
96
|
rootElement.innerHTML = '';
|
@@ -126,14 +110,14 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
|
|
126
110
|
resize: 'none',
|
127
111
|
border: 'none',
|
128
112
|
outline: 'none',
|
129
|
-
marginBottom: bottomAdjustment
|
130
|
-
paddingTop: topAdjustment
|
113
|
+
marginBottom: `${bottomAdjustment}px`,
|
114
|
+
paddingTop: `${topAdjustment}px`,
|
131
115
|
backgroundColor: 'transparent',
|
132
116
|
};
|
133
117
|
const textBlock = document.createElement('div');
|
134
118
|
Object.assign(textBlock.style, textBlockStyle);
|
135
119
|
|
136
|
-
if (mode
|
120
|
+
if (isEditable(mode)) {
|
137
121
|
textBlock.contentEditable = 'plaintext-only';
|
138
122
|
textBlock.tabIndex = tabIndex || 0;
|
139
123
|
textBlock.innerText = value;
|
@@ -157,8 +141,8 @@ export const uiRender = async (arg: UIRenderProps<TextSchema>) => {
|
|
157
141
|
schema.lineHeight ?? DEFAULT_LINE_HEIGHT,
|
158
142
|
schema.verticalAlignment ?? DEFAULT_VERTICAL_ALIGNMENT
|
159
143
|
);
|
160
|
-
textBlock.style.paddingTop = newTopAdj
|
161
|
-
textBlock.style.marginBottom = newBottomAdj
|
144
|
+
textBlock.style.paddingTop = `${newTopAdj}px`;
|
145
|
+
textBlock.style.marginBottom = `${newBottomAdj}px`;
|
162
146
|
})();
|
163
147
|
}, 0);
|
164
148
|
});
|