|
|
@ -50,9 +50,9 @@ export class GfTagsSelectorComponent implements OnInit, OnChanges, OnDestroy { |
|
|
|
@ViewChild('tagInput') tagInput: ElementRef<HTMLInputElement>; |
|
|
|
|
|
|
|
public filteredOptions: Subject<Tag[]> = new BehaviorSubject([]); |
|
|
|
public readonly separatorKeysCodes: number[] = [COMMA, ENTER]; |
|
|
|
public readonly tagInputControl = new FormControl(''); |
|
|
|
public readonly tagsSelected = signal<Tag[]>([]); |
|
|
|
public readonly separatorKeysCodes: number[] = [COMMA, ENTER]; |
|
|
|
|
|
|
|
private unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
@ -74,11 +74,6 @@ export class GfTagsSelectorComponent implements OnInit, OnChanges, OnDestroy { |
|
|
|
this.updateFilters(); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
} |
|
|
|
|
|
|
|
public onAddTag(event: MatAutocompleteSelectedEvent) { |
|
|
|
const tag = this.tagsAvailable.find(({ id }) => { |
|
|
|
return id === event.option.value; |
|
|
@ -104,6 +99,11 @@ export class GfTagsSelectorComponent implements OnInit, OnChanges, OnDestroy { |
|
|
|
this.updateFilters(); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
} |
|
|
|
|
|
|
|
private filterTags(query: string = ''): Tag[] { |
|
|
|
const tags = this.tagsSelected() ?? []; |
|
|
|
const tagIds = tags.map(({ id }) => { |
|
|
|