Specify default props
This commit is contained in:
parent
808344eecf
commit
fce2434dcd
4 changed files with 8 additions and 19 deletions
|
@ -25,10 +25,6 @@ class BlacklistForm extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
bindValue(e) {
|
bindValue(e) {
|
||||||
if (!this.props.onChange) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let name = e.target.name;
|
let name = e.target.name;
|
||||||
let index = e.target.getAttribute('data-index');
|
let index = e.target.getAttribute('data-index');
|
||||||
let next = this.props.value ? this.props.value.slice() : [];
|
let next = this.props.value ? this.props.value.slice() : [];
|
||||||
|
@ -52,6 +48,7 @@ BlacklistForm.propTypes = {
|
||||||
|
|
||||||
BlacklistForm.defaultProps = {
|
BlacklistForm.defaultProps = {
|
||||||
value: [],
|
value: [],
|
||||||
|
onChange: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BlacklistForm;
|
export default BlacklistForm;
|
||||||
|
|
|
@ -30,10 +30,6 @@ class KeymapsForm extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
bindValue(e) {
|
bindValue(e) {
|
||||||
if (!this.props.onChange) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let next = { ...this.props.value };
|
let next = { ...this.props.value };
|
||||||
next[e.target.name] = e.target.value;
|
next[e.target.name] = e.target.value;
|
||||||
|
|
||||||
|
@ -48,6 +44,7 @@ KeymapsForm.propTypes = {
|
||||||
|
|
||||||
KeymapsForm.defaultProps = {
|
KeymapsForm.defaultProps = {
|
||||||
value: {},
|
value: {},
|
||||||
|
onChange: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default KeymapsForm;
|
export default KeymapsForm;
|
||||||
|
|
|
@ -7,9 +7,6 @@ class PropertiesForm extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
let types = this.props.types;
|
let types = this.props.types;
|
||||||
let value = this.props.value;
|
let value = this.props.value;
|
||||||
if (!value) {
|
|
||||||
value = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div className='form-properties-form'>
|
return <div className='form-properties-form'>
|
||||||
{
|
{
|
||||||
|
@ -40,10 +37,6 @@ class PropertiesForm extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
bindValue(e) {
|
bindValue(e) {
|
||||||
if (!this.props.onChange) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let name = e.target.name;
|
let name = e.target.name;
|
||||||
let next = { ...this.props.value };
|
let next = { ...this.props.value };
|
||||||
if (e.target.type.toLowerCase() === 'checkbox') {
|
if (e.target.type.toLowerCase() === 'checkbox') {
|
||||||
|
@ -63,4 +56,9 @@ PropertiesForm.propTypes = {
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PropertiesForm.defaultProps = {
|
||||||
|
value: {},
|
||||||
|
onChange: () => {},
|
||||||
|
};
|
||||||
|
|
||||||
export default PropertiesForm;
|
export default PropertiesForm;
|
||||||
|
|
|
@ -44,10 +44,6 @@ class SearchForm extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
bindValue(e) {
|
bindValue(e) {
|
||||||
if (!this.props.onChange) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let value = this.props.value;
|
let value = this.props.value;
|
||||||
let name = e.target.name;
|
let name = e.target.name;
|
||||||
let index = e.target.getAttribute('data-index');
|
let index = e.target.getAttribute('data-index');
|
||||||
|
@ -83,6 +79,7 @@ SearchForm.propTypes = {
|
||||||
|
|
||||||
SearchForm.defaultProps = {
|
SearchForm.defaultProps = {
|
||||||
value: { default: '', engines: []},
|
value: { default: '', engines: []},
|
||||||
|
onChange: () => {},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SearchForm;
|
export default SearchForm;
|
||||||
|
|
Reference in a new issue