don't block enter/tab for items with valueProvider

This commit is contained in:
LenAnderson 2024-06-23 12:07:24 -04:00
parent ab5a6b1c61
commit 5862c7ea91
2 changed files with 6 additions and 0 deletions

View File

@ -721,6 +721,7 @@ export class AutoComplete {
// pick the selected item to autocomplete // pick the selected item to autocomplete
if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break; if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break;
if (this.selectedItem.name == this.name) break; if (this.selectedItem.name == this.name) break;
if (!this.selectedItem.isSelectable) break;
evt.preventDefault(); evt.preventDefault();
evt.stopImmediatePropagation(); evt.stopImmediatePropagation();
this.select(); this.select();
@ -729,6 +730,7 @@ export class AutoComplete {
case 'Tab': { case 'Tab': {
// pick the selected item to autocomplete // pick the selected item to autocomplete
if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break; if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break;
if (!this.selectedItem.isSelectable) break;
evt.preventDefault(); evt.preventDefault();
evt.stopImmediatePropagation(); evt.stopImmediatePropagation();
this.select(); this.select();

View File

@ -23,6 +23,10 @@ export class AutoCompleteOption {
return this.name; return this.name;
} }
get isSelectable() {
return !this.valueProvider;
}
/** /**
* @param {string} name * @param {string} name