adapt to auto-complete

This commit is contained in:
Sergio Crisostomo 2018-04-24 08:54:46 +02:00
parent ae7579e98d
commit bc348e7ebf

View file

@ -250,16 +250,16 @@
}, },
dropVisible () { dropVisible () {
let status = true; let status = true;
const options = this.selectOptions; const noOptions = !this.selectOptions || this.selectOptions.length === 0;
if (!this.loading && this.remote && this.query === '' && !options.length) status = false; if (!this.loading && this.remote && this.query === '' && noOptions) status = false;
if (this.autoComplete && !options.length) status = false; if (this.autoComplete && noOptions) status = false;
return this.visible && status; return this.visible && status;
}, },
showNotFoundLabel () { showNotFoundLabel () {
const {loading, remote, selectOptions} = this; const {loading, remote, selectOptions} = this;
return selectOptions.length === 0 && (!remote || (remote && !loading)); return selectOptions && selectOptions.length === 0 && (!remote || (remote && !loading));
}, },
publicValue(){ publicValue(){
if (this.labelInValue){ if (this.labelInValue){
@ -278,6 +278,8 @@
let optionCounter = -1; let optionCounter = -1;
const currentIndex = this.focusIndex; const currentIndex = this.focusIndex;
const selectedValues = this.values.map(({value}) => value); const selectedValues = this.values.map(({value}) => value);
if (this.autoComplete) return this.slotOptions;
for (let option of (this.slotOptions || [])) { for (let option of (this.slotOptions || [])) {
const cOptions = option.componentOptions; const cOptions = option.componentOptions;
@ -618,7 +620,7 @@
this.hasExpectedValue = false; this.hasExpectedValue = false;
} }
if (options.length === 0){ if (options && options.length === 0){
this.query = ''; this.query = '';
} }
} }