This repository was archived by the owner on Jun 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +145
-213
lines changed Expand file tree Collapse file tree 6 files changed +145
-213
lines changed Original file line number Diff line number Diff line change 39
39
"react-dom" : " ^16.8.6" ,
40
40
"react-jsonschema-form" : " ^1.6.1" ,
41
41
"rimraf" : " ^3.0.0" ,
42
- "tsdx" : " ^0.10.5 " ,
42
+ "tsdx" : " ^0.11.0 " ,
43
43
"tslib" : " ^1.10.0" ,
44
44
"typescript" : " ^3.5.3"
45
45
},
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+
3
+ import FormControl from '@material-ui/core/FormControl' ;
4
+ import TextField from '@material-ui/core/TextField' ;
5
+
6
+ import { WidgetProps } from 'react-jsonschema-form' ;
7
+
8
+ const EmailWidget = ( {
9
+ id,
10
+ required,
11
+ readonly,
12
+ disabled,
13
+ label,
14
+ value,
15
+ onChange,
16
+ onBlur,
17
+ onFocus,
18
+ autofocus,
19
+ options,
20
+ schema,
21
+ } : WidgetProps ) => {
22
+ const _onChange = ( {
23
+ target : { value } ,
24
+ } : React . ChangeEvent < HTMLInputElement > ) =>
25
+ onChange ( value === '' ? options . emptyValue : value ) ;
26
+ const _onBlur = ( { target : { value } } : React . FocusEvent < HTMLInputElement > ) =>
27
+ onBlur ( id , value ) ;
28
+ const _onFocus = ( {
29
+ target : { value } ,
30
+ } : React . FocusEvent < HTMLInputElement > ) => onFocus ( id , value ) ;
31
+
32
+ return (
33
+ < FormControl
34
+ fullWidth = { true }
35
+ //error={!!rawErrors}
36
+ required = { required }
37
+ >
38
+ < TextField
39
+ id = { id }
40
+ label = { label || schema . title }
41
+ autoFocus = { autofocus }
42
+ required = { required }
43
+ disabled = { disabled || readonly }
44
+ type = "email"
45
+ value = { value ? value : '' }
46
+ onChange = { _onChange }
47
+ onBlur = { _onBlur }
48
+ onFocus = { _onFocus }
49
+ />
50
+ </ FormControl >
51
+ ) ;
52
+ } ;
53
+
54
+ export default EmailWidget ;
Original file line number Diff line number Diff line change
1
+ export { default } from './EmailWidget' ;
2
+ export * from './EmailWidget' ;
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ const TextWidget = ({
41
41
autoFocus = { autofocus }
42
42
required = { required }
43
43
disabled = { disabled || readonly }
44
- type = { schema . type as string }
44
+ type = "text"
45
45
value = { value ? value : '' }
46
46
onChange = { _onChange }
47
47
onBlur = { _onBlur }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import SelectWidget from '../SelectWidget/SelectWidget';
7
7
import TextareaWidget from '../TextareaWidget/TextareaWidget' ;
8
8
import TextWidget from '../TextWidget/TextWidget' ;
9
9
import UpDownWidget from '../UpDownWidget/UpDownWidget' ;
10
+ import EmailWidget from '../EmailWidget/EmailWidget' ;
10
11
11
12
export default {
12
13
CheckboxWidget,
@@ -18,4 +19,5 @@ export default {
18
19
TextareaWidget,
19
20
TextWidget,
20
21
UpDownWidget,
22
+ EmailWidget,
21
23
} ;
You can’t perform that action at this time.
0 commit comments