@pdfme/ui 2.2.0 → 3.0.0-beta.2
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 +33 -35
- package/__mocks__/form-render.js +7 -0
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +42 -4
- package/dist/index.js.map +1 -1
- package/dist/types/Designer.d.ts +3 -0
- package/dist/types/builtInPropPanel.d.ts +3 -0
- package/dist/types/builtInRenderer.d.ts +3 -0
- package/dist/types/class.d.ts +18 -38
- package/dist/types/components/CtlBar/Pager.d.ts +3 -2
- package/dist/types/components/CtlBar/Zoom.d.ts +3 -2
- package/dist/types/components/CtlBar/index.d.ts +3 -2
- package/dist/types/components/Designer/{Main → Canvas}/Guides.d.ts +2 -2
- package/dist/types/components/Designer/Canvas/Mask.d.ts +4 -0
- package/dist/types/components/Designer/Canvas/Moveable.d.ts +37 -0
- package/dist/types/components/Designer/{Main → Canvas}/Selecto.d.ts +2 -1
- package/dist/types/components/Designer/{Main → Canvas}/index.d.ts +3 -6
- package/dist/types/components/Designer/Sidebar/DetailView/AlignWidget.d.ts +4 -0
- package/dist/types/components/Designer/Sidebar/DetailView/WidgetRenderer.d.ts +7 -0
- package/dist/types/components/Designer/Sidebar/DetailView/index.d.ts +5 -4
- package/dist/types/components/Designer/Sidebar/ListView/SelectableSortableContainer.d.ts +3 -2
- package/dist/types/components/Designer/Sidebar/ListView/SelectableSortableItem.d.ts +1 -1
- package/dist/types/components/Designer/Sidebar/ListView/index.d.ts +3 -2
- package/dist/types/components/Designer/Sidebar/index.d.ts +3 -23
- package/dist/types/components/Designer/index.d.ts +6 -107
- package/dist/types/components/Divider.d.ts +2 -1
- package/dist/types/components/ErrorScreen.d.ts +7 -0
- package/dist/types/components/Paper.d.ts +3 -2
- package/dist/types/components/Preview.d.ts +10 -2
- package/dist/types/components/Renderer.d.ts +10 -0
- package/dist/types/components/Root.d.ts +1 -1
- package/dist/types/components/Spinner.d.ts +2 -1
- package/dist/types/components/UnitPager.d.ts +3 -2
- package/dist/types/constants.d.ts +3 -3
- package/dist/types/contexts.d.ts +4 -1
- package/dist/types/helper.d.ts +4 -46
- package/dist/types/hooks.d.ts +2 -2
- package/dist/types/i18n.d.ts +4 -2
- package/dist/types/index.d.ts +1 -4
- package/dist/types/types.d.ts +25 -0
- package/package.json +19 -8
- package/src/Designer.tsx +69 -21
- package/src/Form.tsx +18 -14
- package/src/Viewer.tsx +6 -2
- package/src/builtInPropPanel.ts +5 -0
- package/src/builtInRenderer.ts +5 -0
- package/src/class.ts +25 -2
- package/src/components/CtlBar/index.tsx +4 -7
- package/src/components/Designer/{Main → Canvas}/Guides.tsx +2 -2
- package/src/components/Designer/{Main → Canvas}/Moveable.tsx +23 -19
- package/src/components/Designer/{Main → Canvas}/index.tsx +77 -30
- package/src/components/Designer/Sidebar/DetailView/AlignWidget.tsx +182 -0
- package/src/components/Designer/Sidebar/DetailView/WidgetRenderer.tsx +28 -0
- package/src/components/Designer/Sidebar/DetailView/index.tsx +153 -22
- package/src/components/Designer/Sidebar/ListView/Item.tsx +1 -1
- package/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.tsx +6 -6
- package/src/components/Designer/Sidebar/ListView/index.tsx +1 -4
- package/src/components/Designer/Sidebar/index.tsx +26 -60
- package/src/components/Designer/index.tsx +53 -32
- package/src/components/{Error.tsx → ErrorScreen.tsx} +2 -2
- package/src/components/Paper.tsx +35 -9
- package/src/components/Preview.tsx +48 -50
- package/src/components/Renderer.tsx +90 -0
- package/src/components/Root.tsx +5 -1
- package/src/constants.ts +4 -4
- package/src/contexts.ts +7 -0
- package/src/helper.ts +19 -122
- package/src/hooks.ts +6 -5
- package/src/i18n.ts +48 -11
- package/src/index.ts +1 -76
- package/src/types.ts +36 -0
- package/tsconfig.json +2 -1
- package/webpack.config.js +6 -1
- package/dist/types/components/Designer/Main/Mask.d.ts +0 -3
- package/dist/types/components/Designer/Main/Moveable.d.ts +0 -31
- package/dist/types/components/Designer/Sidebar/DetailView/ExampleInputEditor.d.ts +0 -6
- package/dist/types/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.d.ts +0 -6
- package/dist/types/components/Designer/Sidebar/DetailView/TextPropEditor.d.ts +0 -6
- package/dist/types/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.d.ts +0 -6
- package/dist/types/components/Error.d.ts +0 -6
- package/dist/types/components/Schemas/BarcodeSchema.d.ts +0 -15
- package/dist/types/components/Schemas/ImageSchema.d.ts +0 -15
- package/dist/types/components/Schemas/SchemaUI.d.ts +0 -15
- package/dist/types/components/Schemas/TextSchema.d.ts +0 -28
- package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +0 -85
- package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +0 -275
- package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +0 -357
- package/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.tsx +0 -87
- package/src/components/Schemas/BarcodeSchema.tsx +0 -124
- package/src/components/Schemas/ImageSchema.tsx +0 -87
- package/src/components/Schemas/SchemaUI.tsx +0 -62
- package/src/components/Schemas/TextSchema.tsx +0 -175
- /package/src/components/Designer/{Main → Canvas}/Mask.tsx +0 -0
- /package/src/components/Designer/{Main → Canvas}/Selecto.tsx +0 -0
@@ -1,15 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SchemaUIProps } from './SchemaUI';
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<SchemaUIProps & {
|
4
|
-
schema: {
|
5
|
-
type: "qrcode" | "japanpost" | "ean13" | "ean8" | "code39" | "code128" | "nw7" | "itf14" | "upca" | "upce" | "gs1datamatrix";
|
6
|
-
height: number;
|
7
|
-
width: number;
|
8
|
-
position: {
|
9
|
-
x: number;
|
10
|
-
y: number;
|
11
|
-
};
|
12
|
-
rotate?: number | undefined;
|
13
|
-
};
|
14
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
15
|
-
export default _default;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SchemaUIProps } from './SchemaUI';
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<SchemaUIProps & {
|
4
|
-
schema: {
|
5
|
-
type: "image";
|
6
|
-
height: number;
|
7
|
-
width: number;
|
8
|
-
position: {
|
9
|
-
x: number;
|
10
|
-
y: number;
|
11
|
-
};
|
12
|
-
rotate?: number | undefined;
|
13
|
-
};
|
14
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
15
|
-
export default _default;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
export interface SchemaUIProps {
|
4
|
-
schema: SchemaForUI;
|
5
|
-
editable: boolean;
|
6
|
-
onChange: (value: string) => void;
|
7
|
-
onStopEditing: () => void;
|
8
|
-
tabIndex?: number;
|
9
|
-
placeholder?: string;
|
10
|
-
}
|
11
|
-
declare const _default: React.ForwardRefExoticComponent<SchemaUIProps & {
|
12
|
-
outline: string;
|
13
|
-
onChangeHoveringSchemaId?: ((id: string | null) => void) | undefined;
|
14
|
-
} & React.RefAttributes<HTMLTextAreaElement | HTMLInputElement>>;
|
15
|
-
export default _default;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { SchemaUIProps } from './SchemaUI';
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<SchemaUIProps & {
|
4
|
-
schema: {
|
5
|
-
type: "text";
|
6
|
-
height: number;
|
7
|
-
width: number;
|
8
|
-
position: {
|
9
|
-
x: number;
|
10
|
-
y: number;
|
11
|
-
};
|
12
|
-
rotate?: number | undefined;
|
13
|
-
alignment?: "center" | "left" | "right" | undefined;
|
14
|
-
verticalAlignment?: "top" | "bottom" | "middle" | undefined;
|
15
|
-
fontSize?: number | undefined;
|
16
|
-
fontName?: string | undefined;
|
17
|
-
fontColor?: string | undefined;
|
18
|
-
backgroundColor?: string | undefined;
|
19
|
-
characterSpacing?: number | undefined;
|
20
|
-
lineHeight?: number | undefined;
|
21
|
-
dynamicFontSize?: {
|
22
|
-
max: number;
|
23
|
-
min: number;
|
24
|
-
fit?: string | undefined;
|
25
|
-
} | undefined;
|
26
|
-
};
|
27
|
-
} & React.RefAttributes<HTMLTextAreaElement>>;
|
28
|
-
export default _default;
|
@@ -1,85 +0,0 @@
|
|
1
|
-
import React, { useContext } from 'react';
|
2
|
-
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { readFiles } from '../../../../helper';
|
4
|
-
import { FontContext, I18nContext } from '../../../../contexts';
|
5
|
-
import { SidebarProps } from '..';
|
6
|
-
import { XMarkIcon } from '@heroicons/react/24/outline';
|
7
|
-
|
8
|
-
const ExampleInputEditor = (
|
9
|
-
props: Pick<SidebarProps, 'changeSchemas'> & { activeSchema: SchemaForUI }
|
10
|
-
) => {
|
11
|
-
const { changeSchemas, activeSchema } = props;
|
12
|
-
const i18n = useContext(I18nContext);
|
13
|
-
const fontData = useContext(FontContext);
|
14
|
-
|
15
|
-
return (
|
16
|
-
<div>
|
17
|
-
<label>{i18n('inputExample')}</label>
|
18
|
-
{activeSchema.type === 'image' ? (
|
19
|
-
<div style={{ position: 'relative' }}>
|
20
|
-
{activeSchema.data ? (
|
21
|
-
<div style={{ margin: '0 auto' }}>
|
22
|
-
<button
|
23
|
-
style={{
|
24
|
-
position: 'absolute',
|
25
|
-
top: 0,
|
26
|
-
left: 0,
|
27
|
-
display: 'flex',
|
28
|
-
alignItems: 'center',
|
29
|
-
justifyContent: 'center',
|
30
|
-
color: '#333',
|
31
|
-
background: '#f2f2f2',
|
32
|
-
cursor: 'pointer',
|
33
|
-
borderRadius: 2,
|
34
|
-
border: '1px solid #767676',
|
35
|
-
height: 24,
|
36
|
-
width: 24,
|
37
|
-
}}
|
38
|
-
aria-label="close"
|
39
|
-
onClick={() =>
|
40
|
-
changeSchemas([{ key: 'data', value: '', schemaId: activeSchema.id }])
|
41
|
-
}
|
42
|
-
>
|
43
|
-
<XMarkIcon width={10} height={10} />
|
44
|
-
</button>
|
45
|
-
<img style={{ maxHeight: 180 }} src={activeSchema.data} alt="Input Example" />
|
46
|
-
</div>
|
47
|
-
) : (
|
48
|
-
<label>
|
49
|
-
<input
|
50
|
-
style={{ color: '#333', background: 'none' }}
|
51
|
-
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
52
|
-
const { files } = e.target;
|
53
|
-
readFiles(files, 'dataURL').then((result) => {
|
54
|
-
changeSchemas([
|
55
|
-
{ key: 'data', value: result as string, schemaId: activeSchema.id },
|
56
|
-
]);
|
57
|
-
});
|
58
|
-
}}
|
59
|
-
type="file"
|
60
|
-
accept="image/jpeg, image/png"
|
61
|
-
/>
|
62
|
-
</label>
|
63
|
-
)}
|
64
|
-
</div>
|
65
|
-
) : (
|
66
|
-
<textarea
|
67
|
-
rows={6}
|
68
|
-
onChange={async (e) => {
|
69
|
-
changeSchemas([{ key: 'data', value: e.target.value, schemaId: activeSchema.id }]);
|
70
|
-
}}
|
71
|
-
style={{
|
72
|
-
width: '100%',
|
73
|
-
border: '1px solid #767676',
|
74
|
-
borderRadius: 2,
|
75
|
-
color: '#333',
|
76
|
-
background: activeSchema.data ? 'none' : '#ffa19b',
|
77
|
-
}}
|
78
|
-
value={activeSchema.data}
|
79
|
-
/>
|
80
|
-
)}
|
81
|
-
</div>
|
82
|
-
);
|
83
|
-
};
|
84
|
-
|
85
|
-
export default ExampleInputEditor;
|
@@ -1,275 +0,0 @@
|
|
1
|
-
import React, { CSSProperties, useContext } from 'react';
|
2
|
-
import { SchemaForUI } from '@pdfme/common';
|
3
|
-
import { round } from '../../../../helper';
|
4
|
-
import { SidebarProps } from '../index';
|
5
|
-
import { FontContext } from '../../../../contexts';
|
6
|
-
|
7
|
-
const inputSetStyle: CSSProperties = { marginRight: '1rem', display: 'flex', alignItems: 'center' };
|
8
|
-
|
9
|
-
const inputStyle: CSSProperties = {
|
10
|
-
width: 70,
|
11
|
-
border: '1px solid #767676',
|
12
|
-
borderRadius: 2,
|
13
|
-
color: '#333',
|
14
|
-
background: 'none',
|
15
|
-
};
|
16
|
-
|
17
|
-
const buttonStyle: CSSProperties = {
|
18
|
-
display: 'flex',
|
19
|
-
background: 'none',
|
20
|
-
alignItems: 'center',
|
21
|
-
borderRadius: 2,
|
22
|
-
border: '1px solid rgb(118, 118, 118)',
|
23
|
-
cursor: 'pointer',
|
24
|
-
};
|
25
|
-
|
26
|
-
const svgBaseProp = {
|
27
|
-
style: { width: '100%', height: '100%' },
|
28
|
-
xmlns: 'http://www.w3.org/2000/svg',
|
29
|
-
enableBackground: 'new 0 0 24 24',
|
30
|
-
height: '24px',
|
31
|
-
viewBox: '0 0 24 24',
|
32
|
-
width: '24px',
|
33
|
-
fill: '#000000',
|
34
|
-
};
|
35
|
-
|
36
|
-
const PositionAndSizeEditor = (
|
37
|
-
props: Pick<SidebarProps, 'pageSize' | 'schemas' | 'changeSchemas' | 'activeElements'> & {
|
38
|
-
activeSchema: SchemaForUI;
|
39
|
-
}
|
40
|
-
) => {
|
41
|
-
const font = useContext(FontContext);
|
42
|
-
const { changeSchemas, schemas, activeSchema, activeElements, pageSize } = props;
|
43
|
-
|
44
|
-
const align = (type: 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom') => {
|
45
|
-
const ids = activeElements.map((ae) => ae.id);
|
46
|
-
const ass = schemas.filter((s) => ids.includes(s.id));
|
47
|
-
|
48
|
-
const isVertical = ['left', 'center', 'right'].includes(type);
|
49
|
-
const tgtPos = isVertical ? 'x' : 'y';
|
50
|
-
const tgtSize = isVertical ? 'width' : 'height';
|
51
|
-
const isSingle = ass.length === 1;
|
52
|
-
const root = pageSize[tgtSize];
|
53
|
-
|
54
|
-
const min = isSingle ? 0 : Math.min(...ass.map((as) => as.position[tgtPos]));
|
55
|
-
const max = isSingle ? root : Math.max(...ass.map((as) => as.position[tgtPos] + as[tgtSize]));
|
56
|
-
|
57
|
-
let basePos = min;
|
58
|
-
let adjust = (_: number) => 0;
|
59
|
-
|
60
|
-
if (['center', 'middle'].includes(type)) {
|
61
|
-
basePos = (min + max) / 2;
|
62
|
-
adjust = (num: number) => num / 2;
|
63
|
-
} else if (['right', 'bottom'].includes(type)) {
|
64
|
-
basePos = max;
|
65
|
-
adjust = (num: number) => num;
|
66
|
-
}
|
67
|
-
|
68
|
-
changeSchemas(
|
69
|
-
ass.map((as) => ({
|
70
|
-
key: `position.${tgtPos}`,
|
71
|
-
value: round(basePos - adjust(as[tgtSize]), 2),
|
72
|
-
schemaId: as.id,
|
73
|
-
}))
|
74
|
-
);
|
75
|
-
};
|
76
|
-
|
77
|
-
const distribute = (type: 'vertical' | 'horizontal') => {
|
78
|
-
const ids = activeElements.map((ae) => ae.id);
|
79
|
-
const ass = schemas.filter((s) => ids.includes(s.id));
|
80
|
-
|
81
|
-
const isVertical = type === 'vertical';
|
82
|
-
const tgtPos = isVertical ? 'y' : 'x';
|
83
|
-
const tgtSize = isVertical ? 'height' : 'width';
|
84
|
-
const min = Math.min(...ass.map((as) => as.position[tgtPos]));
|
85
|
-
const max = Math.max(...ass.map((as) => as.position[tgtPos] + as[tgtSize]));
|
86
|
-
|
87
|
-
if (ass.length < 3) return;
|
88
|
-
|
89
|
-
const boxPos = min;
|
90
|
-
const boxSize = max - min;
|
91
|
-
const sum = ass.reduce((acc, cur) => acc + cur[tgtSize], 0);
|
92
|
-
const remain = boxSize - sum;
|
93
|
-
const unit = remain / (ass.length - 1);
|
94
|
-
|
95
|
-
let prev = 0;
|
96
|
-
changeSchemas(
|
97
|
-
ass.map((as, index) => {
|
98
|
-
prev += index === 0 ? 0 : ass[index - 1][tgtSize] + unit;
|
99
|
-
const value = round(boxPos + prev, 2);
|
100
|
-
return { key: `position.${tgtPos}`, value, schemaId: as.id };
|
101
|
-
})
|
102
|
-
);
|
103
|
-
};
|
104
|
-
|
105
|
-
const layoutBtns: { id: string; icon: any; action: () => void }[] = [
|
106
|
-
{
|
107
|
-
id: 'left',
|
108
|
-
icon: (
|
109
|
-
<svg {...svgBaseProp}>
|
110
|
-
<rect fill="none" height="24" width="24" />
|
111
|
-
<path d="M4,22H2V2h2V22z M22,7H6v3h16V7z M16,14H6v3h10V14z" />
|
112
|
-
</svg>
|
113
|
-
),
|
114
|
-
action: () => align('left'),
|
115
|
-
},
|
116
|
-
{
|
117
|
-
id: 'center',
|
118
|
-
icon: (
|
119
|
-
<svg {...svgBaseProp}>
|
120
|
-
<rect fill="none" height="24" width="24" />
|
121
|
-
<polygon points="11,2 13,2 13,7 21,7 21,10 13,10 13,14 18,14 18,17 13,17 13,22 11,22 11,17 6,17 6,14 11,14 11,10 3,10 3,7 11,7" />
|
122
|
-
</svg>
|
123
|
-
),
|
124
|
-
action: () => align('center'),
|
125
|
-
},
|
126
|
-
{
|
127
|
-
id: 'right',
|
128
|
-
icon: (
|
129
|
-
<svg {...svgBaseProp}>
|
130
|
-
<rect fill="none" height="24" width="24" />
|
131
|
-
<path d="M20,2h2v20h-2V2z M2,10h16V7H2V10z M8,17h10v-3H8V17z" />
|
132
|
-
</svg>
|
133
|
-
),
|
134
|
-
action: () => align('right'),
|
135
|
-
},
|
136
|
-
{
|
137
|
-
id: 'top',
|
138
|
-
icon: (
|
139
|
-
<svg {...svgBaseProp}>
|
140
|
-
<rect fill="none" height="24" width="24" />
|
141
|
-
<path d="M22,2v2H2V2H22z M7,22h3V6H7V22z M14,16h3V6h-3V16z" />
|
142
|
-
</svg>
|
143
|
-
),
|
144
|
-
action: () => align('top'),
|
145
|
-
},
|
146
|
-
{
|
147
|
-
id: 'middle',
|
148
|
-
icon: (
|
149
|
-
<svg {...svgBaseProp}>
|
150
|
-
<rect fill="none" height="24" width="24" />
|
151
|
-
<polygon points="22,11 17,11 17,6 14,6 14,11 10,11 10,3 7,3 7,11 1.84,11 1.84,13 7,13 7,21 10,21 10,13 14,13 14,18 17,18 17,13 22,13" />
|
152
|
-
</svg>
|
153
|
-
),
|
154
|
-
action: () => align('middle'),
|
155
|
-
},
|
156
|
-
{
|
157
|
-
id: 'bottom',
|
158
|
-
icon: (
|
159
|
-
<svg {...svgBaseProp}>
|
160
|
-
<rect fill="none" height="24" width="24" />
|
161
|
-
<path d="M22,22H2v-2h20V22z M10,2H7v16h3V2z M17,8h-3v10h3V8z" />
|
162
|
-
</svg>
|
163
|
-
),
|
164
|
-
action: () => align('bottom'),
|
165
|
-
},
|
166
|
-
{
|
167
|
-
id: 'vertical',
|
168
|
-
icon: (
|
169
|
-
<svg {...svgBaseProp}>
|
170
|
-
<rect fill="none" height="24" width="24" />
|
171
|
-
<path d="M22,2v2H2V2H22z M7,10.5v3h10v-3H7z M2,20v2h20v-2H2z" />
|
172
|
-
</svg>
|
173
|
-
),
|
174
|
-
action: () => distribute('vertical'),
|
175
|
-
},
|
176
|
-
{
|
177
|
-
id: 'horizontal',
|
178
|
-
icon: (
|
179
|
-
<svg {...svgBaseProp}>
|
180
|
-
<rect fill="none" height="24" width="24" />
|
181
|
-
<path d="M4,22H2V2h2V22z M22,2h-2v20h2V2z M13.5,7h-3v10h3V7z" />
|
182
|
-
</svg>
|
183
|
-
),
|
184
|
-
action: () => distribute('horizontal'),
|
185
|
-
},
|
186
|
-
];
|
187
|
-
|
188
|
-
return (
|
189
|
-
<section>
|
190
|
-
<div style={{ display: 'flex', alignItems: 'center', marginBottom: '0.5rem' }}>
|
191
|
-
{layoutBtns.map((b) => (
|
192
|
-
<button key={b.id} title={b.id} onClick={b.action} style={buttonStyle}>
|
193
|
-
<object width={15} height={15}>
|
194
|
-
{b.icon}
|
195
|
-
</object>
|
196
|
-
</button>
|
197
|
-
))}
|
198
|
-
</div>
|
199
|
-
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
200
|
-
<div style={inputSetStyle}>
|
201
|
-
<label style={{ width: 17 }}>X</label>
|
202
|
-
<input
|
203
|
-
style={inputStyle}
|
204
|
-
type="number"
|
205
|
-
onChange={(e) => {
|
206
|
-
const value = Number(e.target.value);
|
207
|
-
if (value >= 0 && activeSchema.width + value < pageSize.width) {
|
208
|
-
changeSchemas([{ key: 'position.x', value, schemaId: activeSchema.id }]);
|
209
|
-
}
|
210
|
-
}}
|
211
|
-
value={activeSchema.position.x}
|
212
|
-
/>
|
213
|
-
<span style={{ fontSize: '0.6rem' }}>mm</span>
|
214
|
-
</div>
|
215
|
-
<div style={inputSetStyle}>
|
216
|
-
<label style={{ width: 17 }}>Y</label>
|
217
|
-
<input
|
218
|
-
style={inputStyle}
|
219
|
-
type="number"
|
220
|
-
onChange={(e) => {
|
221
|
-
const value = Number(e.target.value);
|
222
|
-
if (value >= 0 && activeSchema.height + value < pageSize.height) {
|
223
|
-
changeSchemas([{ key: 'position.y', value, schemaId: activeSchema.id }]);
|
224
|
-
}
|
225
|
-
}}
|
226
|
-
value={activeSchema.position.y}
|
227
|
-
/>
|
228
|
-
<span style={{ fontSize: '0.6rem' }}>mm</span>
|
229
|
-
</div>
|
230
|
-
</div>
|
231
|
-
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
232
|
-
<div style={inputSetStyle}>
|
233
|
-
<label htmlFor="input-width" style={{ width: 17 }}>
|
234
|
-
W
|
235
|
-
</label>
|
236
|
-
<input
|
237
|
-
id="input-width"
|
238
|
-
name="input-width"
|
239
|
-
style={inputStyle}
|
240
|
-
type="number"
|
241
|
-
onChange={(e) => {
|
242
|
-
const value = Number(e.target.value);
|
243
|
-
if (value >= 0 && activeSchema.position.x + value < pageSize.width) {
|
244
|
-
changeSchemas([{ key: 'width', value, schemaId: activeSchema.id }]);
|
245
|
-
}
|
246
|
-
}}
|
247
|
-
value={activeSchema.width}
|
248
|
-
/>
|
249
|
-
<span style={{ fontSize: '0.6rem' }}>mm</span>
|
250
|
-
</div>
|
251
|
-
<div style={inputSetStyle}>
|
252
|
-
<label htmlFor="input-height" style={{ width: 17 }}>
|
253
|
-
H
|
254
|
-
</label>
|
255
|
-
<input
|
256
|
-
id="input-height"
|
257
|
-
name="input-height"
|
258
|
-
style={inputStyle}
|
259
|
-
type="number"
|
260
|
-
onChange={(e) => {
|
261
|
-
const value = Number(e.target.value);
|
262
|
-
if (value >= 0 && activeSchema.position.y + value < pageSize.height) {
|
263
|
-
changeSchemas([{ key: 'height', value, schemaId: activeSchema.id }]);
|
264
|
-
}
|
265
|
-
}}
|
266
|
-
value={activeSchema.height}
|
267
|
-
/>
|
268
|
-
<span style={{ fontSize: '0.6rem' }}>mm</span>
|
269
|
-
</div>
|
270
|
-
</div>
|
271
|
-
</section>
|
272
|
-
);
|
273
|
-
};
|
274
|
-
|
275
|
-
export default PositionAndSizeEditor;
|