import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../../../data/providers/data.service";
import * as i2 from "@clr/angular";
import * as i3 from "@angular/common";
import * as i4 from "@angular/forms";
import * as i5 from "../../components/form-field/form-field-control.directive";
import * as i6 from "../../directives/disabled.directive";
import * as i7 from "../../pipes/custom-field-label.pipe";
/**
 * @description
 * Uses a select input to allow the selection of a string value. Should be used with
 * `string` type fields with options.
 *
 * @docsCategory custom-input-components
 * @docsPage default-inputs
 */
export class SelectFormInputComponent {
    static { this.id = 'select-form-input'; }
    get options() {
        return this.config.ui?.options || this.config.options;
    }
    constructor(dataService) {
        this.dataService = dataService;
    }
    ngOnInit() {
        this.uiLanguage$ = this.dataService.client.uiState().mapStream(({ uiState }) => uiState.language);
    }
    trackByFn(index, item) {
        return item.value;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: SelectFormInputComponent, deps: [{ token: i1.DataService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: SelectFormInputComponent, selector: "vdr-select-form-input", inputs: { readonly: "readonly" }, ngImport: i0, template: "<select [formControl]=\"formControl\" [vdrDisabled]=\"readonly\">\n    <option *ngIf=\"config.nullable\" [ngValue]=\"null\"></option>\n    <option *ngFor=\"let option of options;trackBy:trackByFn\" [ngValue]=\"option.value\">\n        {{ (option | customFieldLabel:(uiLanguage$ | async)) || option.label || option.value }}\n    </option>\n</select>\n", styles: ["select{width:100%}\n"], dependencies: [{ kind: "directive", type: i2.ClrDatagridItemsTrackBy, selector: "[ngForTrackBy]", inputs: ["ngForTrackBy"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i4.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i5.FormFieldControlDirective, selector: "input, textarea, select" }, { kind: "directive", type: i6.DisabledDirective, selector: "[vdrDisabled]", inputs: ["vdrDisabled"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i7.CustomFieldLabelPipe, name: "customFieldLabel" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: SelectFormInputComponent, decorators: [{
            type: Component,
            args: [{ selector: 'vdr-select-form-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<select [formControl]=\"formControl\" [vdrDisabled]=\"readonly\">\n    <option *ngIf=\"config.nullable\" [ngValue]=\"null\"></option>\n    <option *ngFor=\"let option of options;trackBy:trackByFn\" [ngValue]=\"option.value\">\n        {{ (option | customFieldLabel:(uiLanguage$ | async)) || option.label || option.value }}\n    </option>\n</select>\n", styles: ["select{width:100%}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.DataService }]; }, propDecorators: { readonly: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0LWZvcm0taW5wdXQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL2xpYi9jb3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