Merge pull request #891 from elbstack/dev

Add event to autocomplete onBlur
old
Javi Velasco 2016-10-22 17:29:54 +02:00 committed by GitHub
commit 10ae964c3f
3 changed files with 5 additions and 5 deletions

View File

@ -91,9 +91,9 @@ const factory = (Chip, Input) => {
); );
}; };
handleQueryBlur = () => { handleQueryBlur = (event) => {
if (this.state.focus) this.setState({focus: false}); if (this.state.focus) this.setState({focus: false});
if (this.props.onBlur) this.props.onBlur(); if (this.props.onBlur) this.props.onBlur(event);
}; };
handleQueryChange = (value) => { handleQueryChange = (value) => {

View File

@ -86,9 +86,9 @@ var factory = function factory(Chip, Input) {
_this.setState({ focus: false, query: query, showAllSuggestions: _this.props.showSuggestionsWhenValueIsSet }, function () { _this.setState({ focus: false, query: query, showAllSuggestions: _this.props.showSuggestionsWhenValueIsSet }, function () {
_reactDom2.default.findDOMNode(_this).querySelector('input').blur(); _reactDom2.default.findDOMNode(_this).querySelector('input').blur();
}); });
}, _this.handleQueryBlur = function () { }, _this.handleQueryBlur = function (event) {
if (_this.state.focus) _this.setState({ focus: false }); if (_this.state.focus) _this.setState({ focus: false });
if (_this.props.onBlur) _this.props.onBlur(); if (_this.props.onBlur) _this.props.onBlur(event);
}, _this.handleQueryChange = function (value) { }, _this.handleQueryChange = function (value) {
_this.setState({ query: value, showAllSuggestions: false }); _this.setState({ query: value, showAllSuggestions: false });
}, _this.handleQueryFocus = function () { }, _this.handleQueryFocus = function () {

View File

@ -81,7 +81,7 @@ interface AutocompleteProps extends ReactToolbox.Props {
* If true, the list of suggestions will not be filtered when a value is selected. * If true, the list of suggestions will not be filtered when a value is selected.
* @default false * @default false
*/ */
showSuggestionsWHenValueIsSet?: boolean; showSuggestionsWhenValueIsSet?: boolean;
/** /**
* Object of key/values or array representing all items suggested. * Object of key/values or array representing all items suggested.
*/ */