63 lines
1.7 KiB
HTML
63 lines
1.7 KiB
HTML
<div class="topic-autocomplete">
|
|
<mat-form-field appearance="outline" class="topic-field">
|
|
<mat-label>{{ label() }}</mat-label>
|
|
<input
|
|
matInput
|
|
[placeholder]="placeholder()"
|
|
[formControl]="searchControl"
|
|
[matAutocomplete]="auto"
|
|
(click)="$event.preventDefault()"
|
|
(keydown.enter)="submitCurrentValue(); $event.preventDefault()"
|
|
(keydown.tab)="onKeydownTab($any($event))" />
|
|
<mat-hint>Füge ein Keyword hinzu</mat-hint>
|
|
|
|
@if (searchControl.value.trim()) {
|
|
<button
|
|
mat-icon-button
|
|
matSuffix
|
|
type="button"
|
|
color="primary"
|
|
aria-label="Thema hinzufügen"
|
|
(click)="submitCurrentValue()">
|
|
<mat-icon>add</mat-icon>
|
|
</button>
|
|
}
|
|
|
|
<!-- @if (searchControl.value) {
|
|
<button
|
|
mat-icon-button
|
|
matSuffix
|
|
type="button"
|
|
aria-label="Suche löschen"
|
|
(click)="clear()">
|
|
<mat-icon>close</mat-icon>
|
|
</button>
|
|
} -->
|
|
|
|
<mat-autocomplete
|
|
#auto="matAutocomplete"
|
|
(optionSelected)="selectTopic($event.option.value)">
|
|
@if (loading()) {
|
|
<mat-option disabled>
|
|
<mat-spinner diameter="18"></mat-spinner>
|
|
<span>Lade Themen...</span>
|
|
</mat-option>
|
|
}
|
|
|
|
@for (topic of topics(); track topic) {
|
|
<mat-option [value]="topic.display_name">{{
|
|
topic.display_name
|
|
}}</mat-option>
|
|
}
|
|
|
|
@if (
|
|
!loading() &&
|
|
searchControl.value.trim().length >= minCharacters() &&
|
|
topics().length === 0
|
|
) {
|
|
<mat-option disabled>Keine passenden Themen gefunden.</mat-option>
|
|
}
|
|
</mat-autocomplete>
|
|
</mat-form-field>
|
|
</div>
|