UI: Fix incorrect add chip for autocomplete component
This commit is contained in:
parent
f325edef75
commit
53a919e046
@ -37,7 +37,6 @@
|
||||
[matAutocomplete]="labelAutocomplete"
|
||||
[matChipInputFor]="chipList"
|
||||
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
||||
matChipInputAddOnBlur
|
||||
(matChipInputTokenEnd)="add($event)">
|
||||
</mat-chip-list>
|
||||
<mat-autocomplete #labelAutocomplete="matAutocomplete"
|
||||
|
||||
@ -36,7 +36,6 @@
|
||||
[matAutocomplete]="entitySubtypeAutocomplete"
|
||||
[matChipInputFor]="chipList"
|
||||
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
|
||||
matChipInputAddOnBlur
|
||||
(matChipInputTokenEnd)="chipAdd($event)">
|
||||
</mat-chip-list>
|
||||
<mat-autocomplete #entitySubtypeAutocomplete="matAutocomplete"
|
||||
|
||||
@ -203,7 +203,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
|
||||
this.dirty = true;
|
||||
}
|
||||
|
||||
add(entitySubtype: string): void {
|
||||
private add(entitySubtype: string): void {
|
||||
if (!this.modelValue || this.modelValue.indexOf(entitySubtype) === -1) {
|
||||
if (!this.modelValue) {
|
||||
this.modelValue = [];
|
||||
@ -213,13 +213,12 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
|
||||
this.entitySubtypeListFormGroup.get('entitySubtypeList').setValue(this.entitySubtypeList);
|
||||
}
|
||||
this.propagateChange(this.modelValue);
|
||||
this.clear();
|
||||
}
|
||||
|
||||
chipAdd(event: MatChipInputEvent): void {
|
||||
const value = event.value;
|
||||
if ((value || '').trim()) {
|
||||
this.add(value.trim());
|
||||
const value = (event.value || '').trim();
|
||||
if (value) {
|
||||
this.add(value);
|
||||
}
|
||||
this.clear('');
|
||||
}
|
||||
@ -234,7 +233,6 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit,
|
||||
this.modelValue = null;
|
||||
}
|
||||
this.propagateChange(this.modelValue);
|
||||
this.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user