Files
smartguide/webapp/src/app/shared/ui/searchable-select/searchable-select.component.html
T
Mats Paul Tončik 0a97b3797e
LocationBasedServices/smartguide/pipeline/head This commit looks good
feat(works-v2): optimized and documented works v2 service
2026-07-19 15:17:57 +02:00

71 lines
2.3 KiB
HTML

<mat-form-field style="width: 100%" subscriptSizing="dynamic">
@if (icon()) {
<mat-icon matPrefix [fontIcon]="icon()"></mat-icon>
}
<mat-select
canSelectNullableOptions
(selectionChange)="handleSelectChange.emit($event.value)"
[placeholder]="label()">
<mat-select-trigger>{{ label() }}</mat-select-trigger>
<div
class="search-panel-header"
(click)="$event.stopPropagation()"
(keydown)="$event.stopPropagation()">
<mat-icon matPrefix>search</mat-icon>
<input
matInput
[placeholder]="inputPlaceholder()"
[(ngModel)]="searchValue"
(ngModelChange)="_handleValueChange($event)"
(click)="$event.stopPropagation()"
(keydown)="$event.stopPropagation()" />
<button
mat-icon-button
aria-label="Clear"
(click)="_clearSearchValue(); $event.stopPropagation()">
<mat-icon>close</mat-icon>
</button>
</div>
@if (isLoading()) {
<mat-option disabled>Laden…</mat-option>
} @else {
@if (selectedElements().length > 0) {
<mat-optgroup [label]="selectedLabel()">
@for (
element of selectedElements();
track getSelectValue()(element)
) {
<mat-option [value]="element" selected>
<mat-icon>check</mat-icon>
{{ getSelectLabel()(element) }}
@if (getSelectDescription()) {
<span class="option-description">{{
getSelectDescription()!(element)
}}</span>
}
</mat-option>
} @empty {
<mat-option disabled>Keine Ergebnisse</mat-option>
}
</mat-optgroup>
}
<mat-optgroup [label]="fetchedLabel()">
@for (element of fetchedElements().elements; track getSelectValue()(element)) {
<mat-option [value]="element">
{{ getSelectLabel()(element) }}
@if (getSelectDescription()) {
<span class="option-description">{{
getSelectDescription()!(element)
}}</span>
}
</mat-option>
} @empty {
<mat-option disabled>Keine Ergebnisse</mat-option>
}
</mat-optgroup>
}
</mat-select>
</mat-form-field>