File
Extends
Implements
defaultPlaceholder$
|
Default value : defer(() =>
isObservable(this.properties?.options) ? this.properties?.options : of(this.properties?.options)
).pipe(
map(data => get(data[0], this.labelProp)),
map(example =>
this.translateService.instant(
!example ? gettext('No items') : gettext('Select your option, for example, {{ example }}'),
{ example }
)
)
)
|
labelProp
|
Type : string
|
Default value : 'label'
|
options$
|
Default value : defer(() =>
isObservable(this.properties?.options) ? this.properties?.options : of(this.properties?.options)
)
|
placeholder$
|
Default value : defer(() => of(this.properties?.placeholder)).pipe(
switchMap(placeholder =>
placeholder
? of(placeholder)
: this.defaultPlaceholder$.pipe(
startWith(this.translateService.instant(gettext('Select your option')))
)
)
)
|
valueProp
|
Type : string
|
Default value : 'value'
|
<div class="c8y-select-wrapper">
<select
class="form-control"
[class.is-invalid]="showError"
[formControl]="formControl"
[formlyAttributes]="field"
[required]="properties.required"
>
<option
[disabled]="properties.required || (!properties.acceptUndefined ?? true)"
[ngValue]="undefined"
selected
>
{{ placeholder$ | async | translate }}
</option>
<ng-container *ngFor="let opt of options$ | async">
<option
[ngValue]="opt[valueProp]"
[disabled]="opt.disabled || false"
>
{{ opt[labelProp] | translate }}
</option>
</ng-container>
</select>
</div>