Skip to content

Commit 969b845

Browse files
authored
Merge pull request thingsboard#10173 from Dmitriymush/bug-fix/tb-entity-subtype-list
Added workaround for matChipInputAddOnBlur selection bug in tb-entity-subtype-list input
2 parents 7aced8f + adbf708 commit 969b845

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
style="max-width: 200px;"
3232
#entitySubtypeInput
3333
(focusin)="onFocus()"
34+
(blur)="addOnBlur($event)"
3435
formControlName="entitySubtype"
3536
matAutocompleteOrigin
36-
matChipInputAddOnBlur
3737
#origin="matAutocompleteOrigin"
3838
[matAutocompleteConnectedTo]="origin"
3939
[matAutocomplete]="entitySubtypeAutocomplete"

ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
262262
this.clear('');
263263
}
264264
}
265+
266+
addOnBlur(event: FocusEvent) {
267+
if (!event.relatedTarget) {
268+
return;
269+
}
270+
const value = this.entitySubtypeInput.nativeElement.value;
271+
this.chipAdd({value} as MatChipInputEvent);
272+
}
273+
265274
remove(entitySubtype: string) {
266275
const index = this.entitySubtypeList.indexOf(entitySubtype);
267276
if (index >= 0) {

0 commit comments

Comments
 (0)