mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Merged in AD-xxx-fix-property-name-propagation (pull request #101)
Property component now propagate its name to its input child
This commit is contained in:
commit
27010aa2b0
@ -22,6 +22,7 @@ let InputCheckbox = React.createClass({
|
|||||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||||
React.PropTypes.element
|
React.PropTypes.element
|
||||||
]),
|
]),
|
||||||
|
name: React.PropTypes.string,
|
||||||
|
|
||||||
// provided by Property
|
// provided by Property
|
||||||
disabled: React.PropTypes.bool,
|
disabled: React.PropTypes.bool,
|
||||||
@ -50,7 +51,7 @@ let InputCheckbox = React.createClass({
|
|||||||
|
|
||||||
// Developer's are used to define defaultValues for inputs via defaultValue, but since this is a
|
// Developer's are used to define defaultValues for inputs via defaultValue, but since this is a
|
||||||
// input of type checkbox we warn the dev to not do that.
|
// input of type checkbox we warn the dev to not do that.
|
||||||
if(this.props.defaultValue) {
|
if(this.props.defaultValue) { //eslint-disable-line react/prop-types
|
||||||
console.warn('InputCheckbox is of type checkbox. Therefore its value is represented by checked and defaultChecked. defaultValue will do nothing!');
|
console.warn('InputCheckbox is of type checkbox. Therefore its value is represented by checked and defaultChecked. defaultValue will do nothing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +103,10 @@ let InputCheckbox = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
style={this.props.style}
|
style={this.props.style}
|
||||||
onClick={this.onChange}>
|
onClick={this.onChange}
|
||||||
|
name={this.props.name}>
|
||||||
<input
|
<input
|
||||||
|
name={this.props.name}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
ref="checkbox"
|
ref="checkbox"
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
@ -119,4 +122,4 @@ let InputCheckbox = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default InputCheckbox;
|
export default InputCheckbox;
|
||||||
|
@ -31,6 +31,7 @@ let Property = React.createClass({
|
|||||||
footer: React.PropTypes.element,
|
footer: React.PropTypes.element,
|
||||||
handleChange: React.PropTypes.func,
|
handleChange: React.PropTypes.func,
|
||||||
ignoreFocus: React.PropTypes.bool,
|
ignoreFocus: React.PropTypes.bool,
|
||||||
|
name: React.PropTypes.string.isRequired,
|
||||||
className: React.PropTypes.string,
|
className: React.PropTypes.string,
|
||||||
|
|
||||||
onClick: React.PropTypes.func,
|
onClick: React.PropTypes.func,
|
||||||
@ -210,7 +211,8 @@ let Property = React.createClass({
|
|||||||
onFocus: this.handleFocus,
|
onFocus: this.handleFocus,
|
||||||
onBlur: this.handleBlur,
|
onBlur: this.handleBlur,
|
||||||
disabled: !this.props.editable,
|
disabled: !this.props.editable,
|
||||||
ref: 'input'
|
ref: 'input',
|
||||||
|
name: this.props.name
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -260,4 +262,4 @@ let Property = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Property;
|
export default Property;
|
||||||
|
Loading…
Reference in New Issue
Block a user