Browse Source

Merge pull request #5075 from vvlladd28/bug/add-chip-adter-blur

[3.3.0] UI: Fix incorrect add chip for autocomplete component
pull/5076/head
Igor Kulikov 5 years ago
committed by GitHub
parent
commit
30828fbdab
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      ui-ngx/src/app/modules/home/pages/rulechain/link-labels.component.html
  2. 1
      ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.html
  3. 10
      ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts

1
ui-ngx/src/app/modules/home/pages/rulechain/link-labels.component.html

@ -37,7 +37,6 @@
[matAutocomplete]="labelAutocomplete"
[matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
matChipInputAddOnBlur
(matChipInputTokenEnd)="add($event)">
</mat-chip-list>
<mat-autocomplete #labelAutocomplete="matAutocomplete"

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

@ -36,7 +36,6 @@
[matAutocomplete]="entitySubtypeAutocomplete"
[matChipInputFor]="chipList"
[matChipInputSeparatorKeyCodes]="separatorKeysCodes"
matChipInputAddOnBlur
(matChipInputTokenEnd)="chipAdd($event)">
</mat-chip-list>
<mat-autocomplete #entitySubtypeAutocomplete="matAutocomplete"

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

@ -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…
Cancel
Save