On focus out of autocompletes clear value if not selected option (to be reviewed)
This commit is contained in:
parent
06f156c687
commit
2f61e47139
|
@ -201,6 +201,10 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp
|
|||
if (event.keyCode !== ENTER && (event.keyCode < 37 || event.keyCode > 40)) {
|
||||
this._inputSubject.next(this.inputValue);
|
||||
}
|
||||
|
||||
// if (event.keyCode !== ENTER && (event.keyCode < 37 || event.keyCode > 40) && event.keyCode !== COMMA) {
|
||||
// this._inputSubject.next(this.inputValue);
|
||||
// }
|
||||
}
|
||||
|
||||
public onKeyDown(event) {
|
||||
|
@ -232,6 +236,12 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp
|
|||
if (this.inputValue && this.inputValue.length > 1 && this.autocomplete.options && this.autocomplete.options.length > 0 && this.autoSelectFirstOptionOnBlur) {
|
||||
this.optionSelectedInternal(this.autocomplete.options.first.value);
|
||||
}
|
||||
|
||||
// Clear text if not an option
|
||||
if (this.inputValue && this.inputValue.length > 1) {
|
||||
this.inputValue = '';
|
||||
document.getElementById((<HTMLInputElement>$event.target).id).focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -242,6 +242,12 @@ export class SingleAutoCompleteComponent extends _CustomComponentMixinBase imple
|
|||
this.inputValue = this._displayFn(this.autocomplete.options.first.value);
|
||||
this.optionSelectedInternal(this.autocomplete.options.first.value);
|
||||
}
|
||||
|
||||
// Clear text if not an option
|
||||
else if (this.inputValue && this.inputValue.length > 1) {
|
||||
this.inputValue = '';
|
||||
document.getElementById((<HTMLInputElement>$event.target).id).focus();
|
||||
}
|
||||
}
|
||||
|
||||
onChange = (_: any) => { };
|
||||
|
|
Loading…
Reference in New Issue