73 lines
2.0 KiB
HTML
73 lines
2.0 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">
|
|
<div class="topic-option">
|
|
<div class="topic-main">
|
|
{{ topic.display_name }}
|
|
</div>
|
|
|
|
<div class="topic-path">
|
|
{{ topic.domain?.display_name }} >
|
|
{{ topic.field?.display_name }} >
|
|
{{ topic.subfield?.display_name }}
|
|
</div>
|
|
</div></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>
|