add seperator keycodes for schematics field

This commit is contained in:
Bernaldo Mihasi 2023-04-20 16:43:15 +03:00
parent 681f73b865
commit 5d7e2cb307
2 changed files with 4 additions and 1 deletions

View File

@ -228,7 +228,7 @@
<mat-form-field class="col-6">
<mat-label>Schematics</mat-label>
<app-multiple-auto-complete placeholder="Schematics" [hidePlaceholder]="true" required='false' [formControl]="this.form.get('schematics')" [configuration]="schematicsAutoCompleteConfiguration">
<app-multiple-auto-complete placeholder="Schematics" [hidePlaceholder]="true" required='false' [separatorKeysCodes]="separatorKeysCodes" [formControl]="this.form.get('schematics')" [configuration]="schematicsAutoCompleteConfiguration">
</app-multiple-auto-complete>
</mat-form-field>

View File

@ -46,6 +46,7 @@ import {
import {ConfigurationService} from "@app/core/services/configuration/configuration.service";
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { map } from 'rxjs/operators';
import { COMMA, ENTER } from '@angular/cdk/keycodes';
@Component({
selector: 'app-dataset-profile-editor-field-component',
@ -72,6 +73,8 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
@Output() delete = new EventEmitter<void>();
readonly separatorKeysCodes: number[] = [ENTER, COMMA];
schematicsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
filterFn: this.filterSchematics.bind(this),
initialItems: (excludedItems: any[]) => this.filterSchematics('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x !== resultItem)))),