Fixes Autocomplete error when provided value prop that is not in source option while preserving value text
parent
a825208e83
commit
0bce911718
|
@ -154,8 +154,13 @@ const factory = (Chip, Input) => {
|
|||
}
|
||||
|
||||
query (key) {
|
||||
return !this.props.multiple && key ? this.source().get(key) : '';
|
||||
}
|
||||
var query_value = '';
|
||||
if(!this.props.multiple && key) {
|
||||
var source_value = this.source().get(key)
|
||||
query_value = source_value ? source_value : key;
|
||||
}
|
||||
return query_value;
|
||||
}
|
||||
|
||||
suggestions () {
|
||||
let suggest = new Map();
|
||||
|
|
|
@ -165,8 +165,13 @@ var factory = function factory(Chip, Input) {
|
|||
}, {
|
||||
key: 'query',
|
||||
value: function query(key) {
|
||||
return !this.props.multiple && key ? this.source().get(key) : '';
|
||||
var query_value = '';
|
||||
if(!this.props.multiple && key) {
|
||||
var source_value = this.source().get(key)
|
||||
query_value = source_value ? source_value : key;
|
||||
}
|
||||
return query_value;
|
||||
}
|
||||
}, {
|
||||
key: 'suggestions',
|
||||
value: function suggestions() {
|
||||
|
@ -474,4 +479,4 @@ var factory = function factory(Chip, Input) {
|
|||
var Autocomplete = factory(_Chip2.default, _Input2.default);
|
||||
exports.default = (0, _reactCssThemr.themr)(_identifiers.AUTOCOMPLETE)(Autocomplete);
|
||||
exports.autocompleteFactory = factory;
|
||||
exports.Autocomplete = Autocomplete;
|
||||
exports.Autocomplete = Autocomplete;
|
||||
|
|
Loading…
Reference in New Issue