mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Property component now propagate its name to its input child
This commit is contained in:
parent
7af4e0912e
commit
01cea9ad3d
@ -17,11 +17,13 @@ let InputCheckbox = React.createClass({
|
||||
//
|
||||
// Since this component even has checkbox in its name, it felt wrong to expose defaultValue
|
||||
// as the default-setting prop to other developers, which is why we choose defaultChecked.
|
||||
defaultValue: React.PropTypes.string,
|
||||
defaultChecked: React.PropTypes.bool,
|
||||
children: React.PropTypes.oneOfType([
|
||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||
React.PropTypes.element
|
||||
]),
|
||||
name: React.PropTypes.string,
|
||||
|
||||
// provided by Property
|
||||
disabled: React.PropTypes.bool,
|
||||
@ -102,8 +104,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 +123,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