|
|
|
@ -49,7 +49,7 @@ class TagInput extends Component {
|
|
|
|
|
|
|
|
|
|
_setAutosuggestRef = (ref) => {
|
|
|
|
|
this._autosuggestRef = ref;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getSuggestionValue({ name }) {
|
|
|
|
|
return name;
|
|
|
|
@ -57,7 +57,7 @@ class TagInput extends Component {
|
|
|
|
|
|
|
|
|
|
shouldRenderSuggestions = (value) => {
|
|
|
|
|
return value.length >= this.props.minQueryLength;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
renderSuggestion({ name }) {
|
|
|
|
|
return name;
|
|
|
|
@ -70,14 +70,14 @@ class TagInput extends Component {
|
|
|
|
|
value: '',
|
|
|
|
|
suggestions: []
|
|
|
|
|
});
|
|
|
|
|
}, 250, { leading: true, trailing: false })
|
|
|
|
|
}, 250, { leading: true, trailing: false });
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Listeners
|
|
|
|
|
|
|
|
|
|
onInputContainerPress = () => {
|
|
|
|
|
this._autosuggestRef.input.focus();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onInputChange = (event, { newValue, method }) => {
|
|
|
|
|
const value = _.isObject(newValue) ? newValue.name : newValue;
|
|
|
|
@ -85,7 +85,7 @@ class TagInput extends Component {
|
|
|
|
|
if (method === 'type') {
|
|
|
|
|
this.setState({ value });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onInputKeyDown = (event) => {
|
|
|
|
|
const {
|
|
|
|
@ -125,11 +125,11 @@ class TagInput extends Component {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onInputFocus = () => {
|
|
|
|
|
this.setState({ isFocused: true });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onInputBlur = () => {
|
|
|
|
|
this.setState({ isFocused: false });
|
|
|
|
@ -153,7 +153,7 @@ class TagInput extends Component {
|
|
|
|
|
if (tag) {
|
|
|
|
|
this.addTag(tag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onSuggestionsFetchRequested = ({ value }) => {
|
|
|
|
|
const lowerCaseValue = value.toLowerCase();
|
|
|
|
@ -170,16 +170,16 @@ class TagInput extends Component {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.setState({ suggestions });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onSuggestionsClearRequested = () => {
|
|
|
|
|
// Required because props aren't always rendered, but no-op
|
|
|
|
|
// because we don't want to reset the paths after a path is selected.
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onSuggestionSelected = (event, { suggestion }) => {
|
|
|
|
|
this.addTag(suggestion);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Render
|
|
|
|
@ -204,7 +204,7 @@ class TagInput extends Component {
|
|
|
|
|
onInputContainerPress={this.onInputContainerPress}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const {
|
|
|
|
|