UI: added workaround for matChipInputAddOnBlur selection bug in tb-entity-subtype-list input

This commit is contained in:
Dmitriymush 2024-02-13 14:09:38 +02:00
parent 2fb9b74bae
commit 937124fa61
2 changed files with 11 additions and 1 deletions

View File

@ -31,9 +31,10 @@
style="max-width: 200px;"
#entitySubtypeInput
(focusin)="onFocus()"
(blur)="addOnBlur($event)"
formControlName="entitySubtype"
matAutocompleteOrigin
matChipInputAddOnBlur
matChipInputAddOnBlur="false"
#origin="matAutocompleteOrigin"
[matAutocompleteConnectedTo]="origin"
[matAutocomplete]="entitySubtypeAutocomplete"

View File

@ -262,6 +262,15 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
this.clear('');
}
}
addOnBlur(event: FocusEvent) {
if (!event.relatedTarget) {
return;
}
const value = this.entitySubtypeInput.nativeElement.value;
this.chipAdd({value} as MatChipInputEvent);
}
remove(entitySubtype: string) {
const index = this.entitySubtypeList.indexOf(entitySubtype);
if (index >= 0) {