@pdfme/ui 1.0.0-beta.7 → 1.0.0-beta.8
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/coverage/clover.xml +6 -0
- package/coverage/coverage-final.json +1 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/class.d.ts +1 -1
- package/dist/types/components/Designer/Main/Moveable.d.ts +1 -1
- package/dist/types/components/Designer/Sidebar/ListView.d.ts +1 -1
- package/dist/types/components/Designer/Sidebar/index.d.ts +1 -0
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/contexts.d.ts +1 -1
- package/dist/types/i18n.d.ts +0 -1
- package/package.json +8 -6
- package/src/Designer.tsx +2 -1
- package/src/Form.tsx +1 -0
- package/src/Viewer.tsx +1 -0
- package/src/assets/icons/close.svg +4 -0
- package/src/assets/imageExample.png +0 -0
- package/src/class.ts +5 -6
- package/src/components/Designer/Main/Moveable.tsx +1 -1
- package/src/components/Designer/Main/index.tsx +6 -8
- package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +24 -5
- package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +12 -4
- package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +32 -5
- package/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.tsx +12 -4
- package/src/components/Designer/Sidebar/DetailView/index.tsx +15 -13
- package/src/components/Designer/Sidebar/ListView.tsx +47 -25
- package/src/components/Designer/Sidebar/index.tsx +9 -7
- package/src/components/Designer/index.tsx +5 -3
- package/src/components/Paper.tsx +1 -3
- package/src/components/Preview/Pager/Page.tsx +1 -1
- package/src/components/Preview/Pager/Unit.tsx +1 -1
- package/src/components/Preview/index.tsx +3 -4
- package/src/components/Root.tsx +2 -7
- package/src/components/Schemas/BarcodeSchema.tsx +37 -22
- package/src/components/Schemas/ImageSchema.tsx +71 -66
- package/src/components/Schemas/TextSchema.tsx +1 -1
- package/src/constants.ts +2 -0
- package/src/helper.ts +31 -27
- package/src/i18n.ts +0 -2
- package/tsconfig.json +1 -1
- package/webpack.config.js +0 -18
package/dist/types/class.d.ts
CHANGED
@@ -7,7 +7,7 @@ export declare abstract class BaseUIClass {
|
|
7
7
|
private readonly font;
|
8
8
|
private readonly setSize;
|
9
9
|
constructor(props: UIProps);
|
10
|
-
protected getI18n(): (key: "type" | "field" | "fieldName" | "require" | "uniq" | "inputExample" | "edit" | "plsSelect" | "plsInputName" | "plsAddNewField" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "addNewField" | "editField" | "previewWarnMsg" | "previewErrMsg" | "goToFirst" | "goToPrevious" | "goToNext" | "goToEnd" | "
|
10
|
+
protected getI18n(): (key: "type" | "field" | "fieldName" | "require" | "uniq" | "inputExample" | "edit" | "plsSelect" | "plsInputName" | "plsAddNewField" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "addNewField" | "editField" | "previewWarnMsg" | "previewErrMsg" | "goToFirst" | "goToPrevious" | "goToNext" | "goToEnd" | "errorOccurred") => string;
|
11
11
|
protected getFont(): Record<string, {
|
12
12
|
fallback?: boolean | undefined;
|
13
13
|
subset?: boolean | undefined;
|
@@ -25,7 +25,7 @@ declare type Props = {
|
|
25
25
|
onResizeGroupEnd: ((e: OnResizeGroupEnd) => void) & (({ targets }: {
|
26
26
|
targets: (HTMLElement | SVGElement)[];
|
27
27
|
}) => void);
|
28
|
-
onClick: (
|
28
|
+
onClick: (e: OnClick) => void;
|
29
29
|
};
|
30
30
|
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<any>>;
|
31
31
|
export default _default;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { SidebarProps } from '.';
|
2
|
-
declare const ListView: (props: Pick<SidebarProps, 'schemas' | 'onSortEnd' | 'onEdit' | 'size' | 'hoveringSchemaId' | 'onChangeHoveringSchemaId'>) => JSX.Element;
|
2
|
+
declare const ListView: (props: Pick<SidebarProps, 'scale' | 'schemas' | 'onSortEnd' | 'onEdit' | 'size' | 'hoveringSchemaId' | 'onChangeHoveringSchemaId'>) => JSX.Element;
|
3
3
|
export default ListView;
|
package/dist/types/contexts.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
-
export declare const I18nContext: import("react").Context<(key: "type" | "field" | "fieldName" | "require" | "uniq" | "inputExample" | "edit" | "plsSelect" | "plsInputName" | "plsAddNewField" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "addNewField" | "editField" | "previewWarnMsg" | "previewErrMsg" | "goToFirst" | "goToPrevious" | "goToNext" | "goToEnd" | "
|
2
|
+
export declare const I18nContext: import("react").Context<(key: "type" | "field" | "fieldName" | "require" | "uniq" | "inputExample" | "edit" | "plsSelect" | "plsInputName" | "plsAddNewField" | "fieldMustUniq" | "notUniq" | "noKeyName" | "fieldsList" | "addNewField" | "editField" | "previewWarnMsg" | "previewErrMsg" | "goToFirst" | "goToPrevious" | "goToNext" | "goToEnd" | "errorOccurred") => string>;
|
3
3
|
export declare const FontContext: import("react").Context<Record<string, {
|
4
4
|
fallback?: boolean | undefined;
|
5
5
|
subset?: boolean | undefined;
|
package/dist/types/i18n.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pdfme/ui",
|
3
|
-
"version": "1.0.0-beta.
|
3
|
+
"version": "1.0.0-beta.8",
|
4
4
|
"author": "hand-dot",
|
5
5
|
"license": "MIT",
|
6
6
|
"description": "TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!",
|
7
7
|
"homepage": "https://pdfme.com",
|
8
|
-
"repository":
|
8
|
+
"repository": {
|
9
|
+
"type": "git",
|
10
|
+
"url": "git@github.com:pdfme/pdfme.git"
|
11
|
+
},
|
9
12
|
"bugs": {
|
10
13
|
"url": "https://github.com/pdfme/pdfme/issues"
|
11
14
|
},
|
@@ -16,7 +19,7 @@
|
|
16
19
|
"node": ">=14"
|
17
20
|
},
|
18
21
|
"scripts": {
|
19
|
-
"develop": "webpack
|
22
|
+
"develop": "webpack --watch --mode development",
|
20
23
|
"build": "NODE_ENV=production webpack --mode production",
|
21
24
|
"clean": "rimraf dist",
|
22
25
|
"lint": "tsc --noEmit",
|
@@ -26,7 +29,7 @@
|
|
26
29
|
"prune": "ts-prune src"
|
27
30
|
},
|
28
31
|
"dependencies": {
|
29
|
-
"@pdfme/common": "^1.0.0-beta.
|
32
|
+
"@pdfme/common": "^1.0.0-beta.8",
|
30
33
|
"@scena/react-guides": "^0.16.0",
|
31
34
|
"hotkeys-js": "^3.8.7",
|
32
35
|
"pdfjs-dist": "^2.12.313",
|
@@ -46,7 +49,6 @@
|
|
46
49
|
"@types/react-dom": "^17.0.9",
|
47
50
|
"eslint-plugin-react": "^7.28.0",
|
48
51
|
"eslint-plugin-react-hooks": "^4.3.0",
|
49
|
-
"html-webpack-plugin": "^5.3.2",
|
50
52
|
"jest-canvas-mock": "^2.3.1",
|
51
53
|
"process": "^0.11.10"
|
52
54
|
},
|
@@ -80,4 +82,4 @@
|
|
80
82
|
"publishConfig": {
|
81
83
|
"access": "public"
|
82
84
|
}
|
83
|
-
}
|
85
|
+
}
|
package/src/Designer.tsx
CHANGED
@@ -5,6 +5,7 @@ import { BaseUIClass } from './class';
|
|
5
5
|
import { DESTROYED_ERR_MSG } from './constants';
|
6
6
|
import { I18nContext, FontContext } from './contexts';
|
7
7
|
import DesignerComponent from './components/Designer';
|
8
|
+
import { cloneDeep } from './helper';
|
8
9
|
|
9
10
|
class Designer extends BaseUIClass {
|
10
11
|
private onSaveTemplateCallback?: (template: Template) => void;
|
@@ -26,7 +27,7 @@ class Designer extends BaseUIClass {
|
|
26
27
|
|
27
28
|
public updateTemplate(template: Template) {
|
28
29
|
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
29
|
-
this.template = template;
|
30
|
+
this.template = cloneDeep(template);
|
30
31
|
if (this.onChangeTemplateCallback) {
|
31
32
|
this.onChangeTemplateCallback(template);
|
32
33
|
}
|
package/src/Form.tsx
CHANGED
package/src/Viewer.tsx
CHANGED
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000">
|
2
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
3
|
+
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z" />
|
4
|
+
</svg>
|
Binary file
|
package/src/class.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import ReactDOM from 'react-dom';
|
2
2
|
import { curriedI18n } from './i18n';
|
3
3
|
import { DESTROYED_ERR_MSG, DEFAULT_LANG } from './constants';
|
4
|
-
import { debounce, flatten } from './helper';
|
4
|
+
import { debounce, flatten, cloneDeep } from './helper';
|
5
5
|
import {
|
6
6
|
Template,
|
7
7
|
Size,
|
@@ -76,7 +76,7 @@ export abstract class BaseUIClass {
|
|
76
76
|
const { domContainer, template, options } = props;
|
77
77
|
const { lang, font } = options || {};
|
78
78
|
this.domContainer = domContainer;
|
79
|
-
this.template = generateColumnsAndSampledataIfNeeded(template);
|
79
|
+
this.template = generateColumnsAndSampledataIfNeeded(cloneDeep(template));
|
80
80
|
this.size = {
|
81
81
|
height: this.domContainer.clientHeight || window.innerHeight,
|
82
82
|
width: this.domContainer.clientWidth || window.innerWidth,
|
@@ -107,7 +107,7 @@ export abstract class BaseUIClass {
|
|
107
107
|
|
108
108
|
public updateTemplate(template: Template) {
|
109
109
|
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
110
|
-
this.template = template;
|
110
|
+
this.template = cloneDeep(template);
|
111
111
|
this.render();
|
112
112
|
}
|
113
113
|
|
@@ -127,8 +127,7 @@ export abstract class PreviewUI extends BaseUIClass {
|
|
127
127
|
super(props);
|
128
128
|
checkPreviewProps(props);
|
129
129
|
|
130
|
-
this.inputs = props.inputs;
|
131
|
-
this.render();
|
130
|
+
this.inputs = cloneDeep(props.inputs);
|
132
131
|
}
|
133
132
|
|
134
133
|
public getInputs() {
|
@@ -139,7 +138,7 @@ export abstract class PreviewUI extends BaseUIClass {
|
|
139
138
|
|
140
139
|
public setInputs(inputs: { [key: string]: string }[]) {
|
141
140
|
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
142
|
-
this.inputs = inputs;
|
141
|
+
this.inputs = cloneDeep(inputs);
|
143
142
|
this.render();
|
144
143
|
}
|
145
144
|
|
@@ -25,7 +25,7 @@ type Props = {
|
|
25
25
|
(({ target }: { target: HTMLElement | SVGElement }) => void);
|
26
26
|
onResizeGroupEnd: ((e: OnResizeGroupEnd) => void) &
|
27
27
|
(({ targets }: { targets: (HTMLElement | SVGElement)[] }) => void);
|
28
|
-
onClick: (
|
28
|
+
onClick: (e: OnClick) => void;
|
29
29
|
};
|
30
30
|
|
31
31
|
const _Moveable = (
|
@@ -7,7 +7,7 @@ import React, {
|
|
7
7
|
forwardRef,
|
8
8
|
useCallback,
|
9
9
|
} from 'react';
|
10
|
-
import { OnDrag, OnResize } from 'react-moveable';
|
10
|
+
import { OnDrag, OnResize, OnClick } from 'react-moveable';
|
11
11
|
import { SchemaForUI, Size } from '@pdfme/common';
|
12
12
|
import { ZOOM, RULER_HEIGHT } from '../../../constants';
|
13
13
|
import { usePrevious } from '../../../hooks';
|
@@ -39,7 +39,7 @@ const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }
|
|
39
39
|
color: 'white',
|
40
40
|
border: 'none',
|
41
41
|
fontWeight: 'bold',
|
42
|
-
borderRadius:
|
42
|
+
borderRadius: 2,
|
43
43
|
background: 'rgb(68, 170, 255)',
|
44
44
|
}}
|
45
45
|
>
|
@@ -201,15 +201,13 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
201
201
|
const getGuideLines = (guides: GuidesInterface[], index: number) =>
|
202
202
|
guides[index] && guides[index].getGuides().map((g) => g * ZOOM);
|
203
203
|
|
204
|
-
const onClickMoveable = () => {
|
204
|
+
const onClickMoveable = (e: OnClick) => {
|
205
|
+
e.inputEvent.stopPropagation();
|
205
206
|
setEditing(true);
|
206
207
|
const ic = inputRef.current;
|
207
208
|
if (!ic) return;
|
208
|
-
ic.disabled = false;
|
209
209
|
ic.focus();
|
210
|
-
if (ic.type
|
211
|
-
ic.click();
|
212
|
-
} else {
|
210
|
+
if (ic.type !== 'file') {
|
213
211
|
ic.setSelectionRange(ic.value.length, ic.value.length);
|
214
212
|
}
|
215
213
|
};
|
@@ -298,7 +296,7 @@ const Main = (props: Props, ref: Ref<HTMLDivElement>) => {
|
|
298
296
|
)}
|
299
297
|
renderSchema={({ schema }) => (
|
300
298
|
<SchemaUI
|
301
|
-
key={schema.
|
299
|
+
key={schema.id}
|
302
300
|
schema={schema}
|
303
301
|
onChangeHoveringSchemaId={onChangeHoveringSchemaId}
|
304
302
|
editable={editing && activeElements.map((ae) => ae.id).includes(schema.id)}
|
@@ -2,6 +2,7 @@ import React, { useContext } from 'react';
|
|
2
2
|
import { readFiles } from '../../../../helper';
|
3
3
|
import { I18nContext } from '../../../../contexts';
|
4
4
|
import { SidebarProps } from '..';
|
5
|
+
import closeIcon from '../../../../assets/icons/close.svg';
|
5
6
|
|
6
7
|
const ExampleInputEditor = (props: Pick<SidebarProps, 'changeSchemas' | 'activeSchema'>) => {
|
7
8
|
const { changeSchemas, activeSchema } = props;
|
@@ -9,25 +10,40 @@ const ExampleInputEditor = (props: Pick<SidebarProps, 'changeSchemas' | 'activeS
|
|
9
10
|
|
10
11
|
return (
|
11
12
|
<div>
|
12
|
-
<label
|
13
|
+
<label>{i18n('inputExample')}</label>
|
13
14
|
{activeSchema.type === 'image' ? (
|
14
|
-
<div style={{ position: 'relative'
|
15
|
+
<div style={{ position: 'relative' }}>
|
15
16
|
{activeSchema.data ? (
|
16
17
|
<div style={{ margin: '0 auto' }}>
|
17
18
|
<button
|
18
|
-
style={{
|
19
|
+
style={{
|
20
|
+
position: 'absolute',
|
21
|
+
top: 0,
|
22
|
+
left: 0,
|
23
|
+
display: 'flex',
|
24
|
+
justifyContent: 'center',
|
25
|
+
alignItems: 'center',
|
26
|
+
color: '#333',
|
27
|
+
background: '#f2f2f2',
|
28
|
+
cursor: 'pointer',
|
29
|
+
borderRadius: 2,
|
30
|
+
border: '1px solid #767676',
|
31
|
+
height: 20,
|
32
|
+
width: 20,
|
33
|
+
}}
|
19
34
|
aria-label="close"
|
20
35
|
onClick={() =>
|
21
36
|
changeSchemas([{ key: 'data', value: '', schemaId: activeSchema.id }])
|
22
37
|
}
|
23
38
|
>
|
24
|
-
|
39
|
+
<img src={closeIcon} alt="Close icon" width={10} />
|
25
40
|
</button>
|
26
41
|
<img style={{ maxHeight: 180 }} src={activeSchema.data} alt="Input Example" />
|
27
42
|
</div>
|
28
43
|
) : (
|
29
44
|
<label>
|
30
45
|
<input
|
46
|
+
style={{ color: '#333', background: 'none' }}
|
31
47
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
32
48
|
const { files } = e.target;
|
33
49
|
readFiles(files, 'dataURL').then((result) => {
|
@@ -50,7 +66,10 @@ const ExampleInputEditor = (props: Pick<SidebarProps, 'changeSchemas' | 'activeS
|
|
50
66
|
}
|
51
67
|
style={{
|
52
68
|
width: '100%',
|
53
|
-
|
69
|
+
border: '1px solid #767676',
|
70
|
+
borderRadius: 2,
|
71
|
+
color: '#333',
|
72
|
+
background: activeSchema.data ? 'none' : '#ffa19b',
|
54
73
|
}}
|
55
74
|
value={activeSchema.data}
|
56
75
|
/>
|
@@ -7,6 +7,14 @@ const inputSetStyle: React.CSSProperties = {
|
|
7
7
|
alignItems: 'center',
|
8
8
|
};
|
9
9
|
|
10
|
+
const inputStyle: React.CSSProperties = {
|
11
|
+
width: 70,
|
12
|
+
border: '1px solid #767676',
|
13
|
+
borderRadius: 2,
|
14
|
+
color: '#333',
|
15
|
+
background: 'none',
|
16
|
+
};
|
17
|
+
|
10
18
|
const PositionAndSizeEditor = (
|
11
19
|
props: Pick<SidebarProps, 'pageSize' | 'changeSchemas' | 'activeSchema'>
|
12
20
|
) => {
|
@@ -24,7 +32,7 @@ const PositionAndSizeEditor = (
|
|
24
32
|
<div style={inputSetStyle}>
|
25
33
|
<label style={{ width: 17 }}>X</label>
|
26
34
|
<input
|
27
|
-
style={
|
35
|
+
style={inputStyle}
|
28
36
|
type="number"
|
29
37
|
onChange={(e) => {
|
30
38
|
const value = Number(e.target.value);
|
@@ -39,7 +47,7 @@ const PositionAndSizeEditor = (
|
|
39
47
|
<div style={inputSetStyle}>
|
40
48
|
<label style={{ width: 17 }}>Y</label>
|
41
49
|
<input
|
42
|
-
style={
|
50
|
+
style={inputStyle}
|
43
51
|
type="number"
|
44
52
|
onChange={(e) => {
|
45
53
|
const value = Number(e.target.value);
|
@@ -63,7 +71,7 @@ const PositionAndSizeEditor = (
|
|
63
71
|
<div style={inputSetStyle}>
|
64
72
|
<label style={{ width: 17 }}>W</label>
|
65
73
|
<input
|
66
|
-
style={
|
74
|
+
style={inputStyle}
|
67
75
|
type="number"
|
68
76
|
onChange={(e) => {
|
69
77
|
const value = Number(e.target.value);
|
@@ -78,7 +86,7 @@ const PositionAndSizeEditor = (
|
|
78
86
|
<div style={inputSetStyle}>
|
79
87
|
<label style={{ width: 17 }}>H</label>
|
80
88
|
<input
|
81
|
-
style={
|
89
|
+
style={inputStyle}
|
82
90
|
type="number"
|
83
91
|
onChange={(e) => {
|
84
92
|
const value = Number(e.target.value);
|
@@ -4,9 +4,20 @@ import {
|
|
4
4
|
DEFAULT_FONT_SIZE,
|
5
5
|
DEFAULT_LINE_HEIGHT,
|
6
6
|
DEFAULT_CHARACTER_SPACING,
|
7
|
+
DEFAULT_FONT_COLOR,
|
7
8
|
} from '@pdfme/common';
|
8
9
|
import { FontContext } from '../../../../contexts';
|
9
10
|
import { SidebarProps } from '..';
|
11
|
+
import closeIcon from '../../../../assets/icons/close.svg';
|
12
|
+
|
13
|
+
const inputStyle = {
|
14
|
+
width: '90%',
|
15
|
+
color: '#333',
|
16
|
+
background: 'none',
|
17
|
+
borderRadius: 2,
|
18
|
+
border: '1px solid #767676',
|
19
|
+
};
|
20
|
+
const selectStyle = inputStyle;
|
10
21
|
|
11
22
|
const NumberInputSet = (props: {
|
12
23
|
width: string;
|
@@ -19,7 +30,7 @@ const NumberInputSet = (props: {
|
|
19
30
|
return (
|
20
31
|
<div style={{ width }}>
|
21
32
|
<label>{label}</label>
|
22
|
-
<input style={
|
33
|
+
<input style={inputStyle} onChange={onChange} value={value} type="number" />
|
23
34
|
</div>
|
24
35
|
);
|
25
36
|
};
|
@@ -36,8 +47,20 @@ const ColorInputSet = (props: {
|
|
36
47
|
<div style={{ width: '45%' }}>
|
37
48
|
<label>{label}</label>
|
38
49
|
<div style={{ display: 'flex' }}>
|
39
|
-
<input onChange={onChange} value={value} type="color" style={
|
40
|
-
<button
|
50
|
+
<input onChange={onChange} value={value || '#ffffff'} type="color" style={inputStyle} />
|
51
|
+
<button
|
52
|
+
onClick={onClear}
|
53
|
+
style={{
|
54
|
+
display: 'flex',
|
55
|
+
background: 'none',
|
56
|
+
alignItems: 'center',
|
57
|
+
borderRadius: 2,
|
58
|
+
border: '1px solid #767676',
|
59
|
+
cursor: 'pointer',
|
60
|
+
}}
|
61
|
+
>
|
62
|
+
<img src={closeIcon} width={10} alt="Close icon" />
|
63
|
+
</button>
|
41
64
|
</div>
|
42
65
|
</div>
|
43
66
|
);
|
@@ -54,7 +77,7 @@ const SelectSet = (props: {
|
|
54
77
|
return (
|
55
78
|
<div style={{ width: '45%' }}>
|
56
79
|
<label>{label}:</label>
|
57
|
-
<select style={
|
80
|
+
<select style={selectStyle} onChange={onChange} value={value}>
|
58
81
|
{options.map((o) => (
|
59
82
|
<option key={o} value={o}>
|
60
83
|
{o}
|
@@ -80,6 +103,7 @@ const TextPropEditor = (props: Pick<SidebarProps, 'changeSchemas' | 'activeSchem
|
|
80
103
|
display: 'flex',
|
81
104
|
alignItems: 'center',
|
82
105
|
justifyContent: 'space-between',
|
106
|
+
marginBottom: '0.25rem',
|
83
107
|
}}
|
84
108
|
>
|
85
109
|
<SelectSet
|
@@ -105,6 +129,7 @@ const TextPropEditor = (props: Pick<SidebarProps, 'changeSchemas' | 'activeSchem
|
|
105
129
|
display: 'flex',
|
106
130
|
alignItems: 'center',
|
107
131
|
justifyContent: 'space-between',
|
132
|
+
marginBottom: '0.25rem',
|
108
133
|
}}
|
109
134
|
>
|
110
135
|
<NumberInputSet
|
@@ -154,7 +179,9 @@ const TextPropEditor = (props: Pick<SidebarProps, 'changeSchemas' | 'activeSchem
|
|
154
179
|
changeSchemas([{ key: 'fontColor', value: e.target.value, schemaId: activeSchema.id }])
|
155
180
|
}
|
156
181
|
onClear={() =>
|
157
|
-
changeSchemas([
|
182
|
+
changeSchemas([
|
183
|
+
{ key: 'fontColor', value: DEFAULT_FONT_COLOR, schemaId: activeSchema.id },
|
184
|
+
])
|
158
185
|
}
|
159
186
|
/>
|
160
187
|
|
@@ -37,7 +37,13 @@ const TypeAndKeyEditor = (
|
|
37
37
|
<div>
|
38
38
|
<label style={{ marginBottom: 0 }}>{i18n('type')}</label>
|
39
39
|
<select
|
40
|
-
style={{
|
40
|
+
style={{
|
41
|
+
width: '100%',
|
42
|
+
border: '1px solid #767676',
|
43
|
+
borderRadius: 2,
|
44
|
+
color: '#333',
|
45
|
+
background: 'none',
|
46
|
+
}}
|
41
47
|
onChange={(e) =>
|
42
48
|
changeSchemas([{ key: 'type', value: e.target.value, schemaId: activeSchema.id }])
|
43
49
|
}
|
@@ -50,7 +56,7 @@ const TypeAndKeyEditor = (
|
|
50
56
|
))}
|
51
57
|
</select>
|
52
58
|
</div>
|
53
|
-
<div
|
59
|
+
<div>
|
54
60
|
<label style={{ marginBottom: 0 }}>
|
55
61
|
{i18n('fieldName')}
|
56
62
|
<u style={{ fontSize: '0.7rem' }}>
|
@@ -65,9 +71,11 @@ const TypeAndKeyEditor = (
|
|
65
71
|
changeSchemas([{ key: 'key', value: e.target.value, schemaId: activeSchema.id }])
|
66
72
|
}
|
67
73
|
style={{
|
68
|
-
|
74
|
+
width: '100%',
|
69
75
|
border: '1px solid #767676',
|
70
|
-
|
76
|
+
borderRadius: 2,
|
77
|
+
color: '#333',
|
78
|
+
background: hasSameKey || blankKey ? '#ffa19b' : 'none',
|
71
79
|
}}
|
72
80
|
value={activeSchema.key}
|
73
81
|
/>
|
@@ -14,25 +14,27 @@ const DetailView = (
|
|
14
14
|
const i18n = useContext(I18nContext);
|
15
15
|
|
16
16
|
return (
|
17
|
-
<
|
17
|
+
<div>
|
18
18
|
<div style={{ height: 40, display: 'flex', alignItems: 'center' }}>
|
19
19
|
<p style={{ textAlign: 'center', width: '100%', fontWeight: 'bold' }}>
|
20
20
|
{i18n('editField')}
|
21
21
|
</p>
|
22
22
|
</div>
|
23
23
|
<Divider />
|
24
|
-
<
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
24
|
+
<div style={{ fontSize: '0.9rem' }}>
|
25
|
+
<TypeAndKeyEditor {...props} />
|
26
|
+
<Divider />
|
27
|
+
<PositionAndSizeEditor {...props} />
|
28
|
+
<Divider />
|
29
|
+
{activeSchema.type === 'text' && (
|
30
|
+
<>
|
31
|
+
<TextPropEditor {...props} />
|
32
|
+
<Divider />
|
33
|
+
</>
|
34
|
+
)}
|
35
|
+
<ExampleInputEditor {...props} />
|
36
|
+
</div>
|
37
|
+
</div>
|
36
38
|
);
|
37
39
|
};
|
38
40
|
|