Skip to content
This repository was archived by the owner on Jun 1, 2020. It is now read-only.

Commit 173e91c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into add-email-field
# Conflicts: # src/TextWidget/TextWidget.tsx
2 parents 6b6b5d9 + 32aeed1 commit 173e91c

File tree

10 files changed

+1849
-1896
lines changed

10 files changed

+1849
-1896
lines changed

example/src/examples/alternatives/schema.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,8 @@
33
"Color": {
44
"title": "Color",
55
"type": "string",
6-
"anyOf": [
7-
{
8-
"type": "string",
9-
"enum": ["#ff0000"],
10-
"title": "Red"
11-
},
12-
{
13-
"type": "string",
14-
"enum": ["#00ff00"],
15-
"title": "Green"
16-
},
17-
{
18-
"type": "string",
19-
"enum": ["#0000ff"],
20-
"title": "Blue"
21-
}
22-
]
6+
"enum": ["#ff0000", "#00ff00", "#0000ff"],
7+
"enumNames": ["Red", "Green", "Blue"]
238
},
249
"Toggle": {
2510
"title": "Toggle",
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{}
1+
{
2+
"ui:options": {
3+
"addButtonLabel": "Custom add label"
4+
}
5+
}

example/src/menu/Menu.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,33 @@ class RawMenuAppBar extends React.Component<any, any> {
2727
const { drawerOpen } = this.state;
2828

2929
return (
30-
<AppBar position="static" className={classes.toolbar}>
31-
<Toolbar>
32-
<Hidden only={['lg', 'xl']}>
33-
<IconButton
34-
className={classes.menuButton}
35-
color="inherit"
36-
aria-label="Menu"
37-
onClick={this.toggleDrawer(true)}
38-
>
39-
<MenuIcon />
40-
</IconButton>
41-
</Hidden>
42-
<div className={classes.flexCtr}>
43-
<Typography variant="h6" color="inherit">
44-
{pkg.name}
45-
</Typography>
46-
</div>
47-
</Toolbar>
30+
<>
31+
<AppBar position="static" className={classes.toolbar}>
32+
<Toolbar>
33+
<Hidden only={['lg', 'xl']}>
34+
<IconButton
35+
className={classes.menuButton}
36+
color="inherit"
37+
aria-label="Menu"
38+
onClick={this.toggleDrawer(true)}
39+
>
40+
<MenuIcon />
41+
</IconButton>
42+
</Hidden>
43+
<div className={classes.flexCtr}>
44+
<Typography variant="h6" color="inherit">
45+
{pkg.name}
46+
</Typography>
47+
</div>
48+
</Toolbar>
49+
</AppBar>
4850
<LeftDrawer
4951
open={drawerOpen}
5052
toggleDrawer={this.toggleDrawer}
5153
onSelectMenuItem={onSelectMenuItem}
5254
selectedMenuItem={selectedMenuItem}
5355
/>
54-
</AppBar>
56+
</>
5557
);
5658
}
5759
}

example/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4855,9 +4855,9 @@ safe-regex@^1.1.0:
48554855
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
48564856

48574857
safer-eval@^1.3.0:
4858-
version "1.3.3"
4859-
resolved "https://registry.yarnpkg.com/safer-eval/-/safer-eval-1.3.3.tgz#0309e9fcc0609e66c1b599fd0d4772132b260ca8"
4860-
integrity sha512-j/qb0rtnwTp5V1D7nR0Ns/14HU8OiHPaoZNJhM+Lfmv1nbXZCXG9LHaVW157agEocdSVAeeRNddK/yuWfalzGQ==
4858+
version "1.3.5"
4859+
resolved "https://registry.yarnpkg.com/safer-eval/-/safer-eval-1.3.5.tgz#a75a1193a4e1dfadd34a8c87ad08e7b978c494b1"
4860+
integrity sha512-BJ//K2Y+EgCbOHEsDGS5YahYBcYy7JcFpKDo2ba5t4MnOGHYtk7HvQkcxTDFvjQvJ0CRcdas/PyF+gTTCay+3w==
48614861
dependencies:
48624862
clones "^1.2.0"
48634863

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
"np": "^5.0.3",
3535
"npm-run-all": "^4.1.5",
3636
"prettier": "^1.18.2",
37-
"pretty-quick": "^1.11.1",
37+
"pretty-quick": "^2.0.0",
3838
"react": "^16.8.6",
3939
"react-dom": "^16.8.6",
4040
"react-jsonschema-form": "^1.6.1",
41-
"rimraf": "^2.6.3",
42-
"tsdx": "^0.7.2",
41+
"rimraf": "^3.0.0",
42+
"tsdx": "^0.10.5",
4343
"tslib": "^1.10.0",
4444
"typescript": "^3.5.3"
4545
},

src/AddButton/AddButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { AddButtonProps } from 'react-jsonschema-form';
55
import Button from '@material-ui/core/Button';
66
import AddIcon from '@material-ui/icons/Add';
77

8-
const AddButton: React.FC<AddButtonProps> = props => (
8+
// TODO: Add label property on type definition
9+
const AddButton: React.FC<AddButtonProps & { label?: string }> = props => (
910
<Button {...props} color="secondary">
10-
<AddIcon /> Add Item
11+
<AddIcon /> {props.label || 'Add Item'}
1112
</Button>
1213
);
1314

src/ArrayFieldTemplate/ArrayFieldTemplate.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ const DefaultFixedArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
152152
className="array-item-add"
153153
onClick={props.onAddClick}
154154
disabled={props.disabled || props.readonly}
155+
label={props.uiSchema.buttonLabel}
155156
/>
156157
)}
157158
</fieldset>
@@ -192,6 +193,11 @@ const DefaultNormalArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
192193
className="array-item-add"
193194
onClick={props.onAddClick}
194195
disabled={props.disabled || props.readonly}
196+
{...(props.uiSchema['ui:options'] && {
197+
label: props.uiSchema['ui:options'][
198+
'addButtonLabel'
199+
] as string,
200+
})}
195201
/>
196202
</Box>
197203
</Grid>

src/PasswordWidget/PasswordWidget.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React from 'react';
22

33
import FormControl from '@material-ui/core/FormControl';
4-
import Input from '@material-ui/core/Input';
5-
import InputLabel from '@material-ui/core/InputLabel';
4+
import TextField from '@material-ui/core/TextField';
65

76
import { WidgetProps } from 'react-jsonschema-form';
87

@@ -36,16 +35,17 @@ const PasswordWidget = ({
3635
//error={!!rawErrors}
3736
required={required}
3837
>
39-
<InputLabel>{label || schema.title}</InputLabel>
40-
<Input
38+
<TextField
39+
id={id}
40+
label={label || schema.title}
4141
autoFocus={autofocus}
4242
required={required}
4343
disabled={disabled || readonly}
4444
type="password"
4545
value={value ? value : ''}
46+
onChange={_onChange}
4647
onFocus={_onFocus}
4748
onBlur={_onBlur}
48-
onChange={_onChange}
4949
/>
5050
</FormControl>
5151
);

src/TextWidget/TextWidget.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const TextWidget = ({
4141
autoFocus={autofocus}
4242
required={required}
4343
disabled={disabled || readonly}
44-
name={name}
4544
type="text"
4645
value={value ? value : ''}
4746
onChange={_onChange}

0 commit comments

Comments
 (0)