mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-08 07:28:26 +00:00
Maintain "blur to add" function to match previous UX
This commit is contained in:
@@ -30,19 +30,22 @@ const EditableItem = React.createClass({
|
|||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
onRemove: PropTypes.func,
|
onRemove: PropTypes.func,
|
||||||
onAdd: PropTypes.func,
|
onAdd: PropTypes.func,
|
||||||
|
|
||||||
|
addOnChange: PropTypes.bool,
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange: function(value) {
|
onChange: function(value) {
|
||||||
this.setState({ value });
|
this.setState({ value });
|
||||||
if (this.props.onChange) this.props.onChange(value, this.props.index);
|
if (this.props.onChange) this.props.onChange(value, this.props.index);
|
||||||
|
if (this.props.addOnChange && this.props.onAdd) this.props.onAdd(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
onRemove: function() {
|
onRemove: function() {
|
||||||
this.props.onRemove(this.props.index);
|
if (this.props.onRemove) this.props.onRemove(this.props.index);
|
||||||
},
|
},
|
||||||
|
|
||||||
onAdd: function() {
|
onAdd: function() {
|
||||||
this.props.onAdd(this.state.value);
|
if (this.props.onAdd) this.props.onAdd(this.state.value);
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
@@ -138,6 +141,7 @@ module.exports = React.createClass({
|
|||||||
initialValue={this.props.newItem}
|
initialValue={this.props.newItem}
|
||||||
onAdd={this.onItemAdded}
|
onAdd={this.onItemAdded}
|
||||||
onChange={this.onNewItemChanged}
|
onChange={this.onNewItemChanged}
|
||||||
|
addOnChange={true}
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
/>
|
/>
|
||||||
</div>);
|
</div>);
|
||||||
|
|||||||
Reference in New Issue
Block a user