mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +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.element
|
||||
]),
|
||||
name: React.PropTypes.string,
|
||||
|
||||
// provided by Property
|
||||
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
|
||||
// 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!');
|
||||
}
|
||||
|
||||
@ -102,8 +103,10 @@ let InputCheckbox = React.createClass({
|
||||
return (
|
||||
<span
|
||||
style={this.props.style}
|
||||
onClick={this.onChange}>
|
||||
onClick={this.onChange}
|
||||
name={this.props.name}>
|
||||
<input
|
||||
name={this.props.name}
|
||||
type="checkbox"
|
||||
ref="checkbox"
|
||||
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,
|
||||
handleChange: React.PropTypes.func,
|
||||
ignoreFocus: React.PropTypes.bool,
|
||||
name: React.PropTypes.string.isRequired,
|
||||
className: React.PropTypes.string,
|
||||
|
||||
onClick: React.PropTypes.func,
|
||||
@ -210,7 +211,8 @@ let Property = React.createClass({
|
||||
onFocus: this.handleFocus,
|
||||
onBlur: this.handleBlur,
|
||||
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