/**
 * @fileoverview added by tsickle
 * Generated from: form/form-select/form-select.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { __extends } from "tslib";
/*!
 * Copyright 2020 VMware, Inc.
 * SPDX-License-Identifier: BSD-2-Clause
 */
import { Component, Input, Optional, Self } from '@angular/core';
import { NgControl } from '@angular/forms';
import { BaseFormControl } from '../base-form-control';
/**
 * {\@link FormControl} wrapper around a select HTML element
 */
var FormSelectComponent = /** @class */ (function (_super) {
    __extends(FormSelectComponent, _super);
    function FormSelectComponent(ngControl) {
        var _this = _super.call(this, ngControl) || this;
        /**
         * The displayed options for the select element
         */
        _this.options = [];
        return _this;
    }
    Object.defineProperty(FormSelectComponent.prototype, "selectedOption", {
        get: /**
         * @return {?}
         */
        function () {
            var _this = this;
            if (!this.options || this.formControl.value === null || this.formControl.value === undefined) {
                return undefined;
            }
            // option.value and formControl.value can be of type number or string
            return this.options.find((/**
             * @param {?} option
             * @return {?}
             */
            function (option) { return option.value.toString() === _this.formControl.value.toString(); }));
        },
        enumerable: true,
        configurable: true
    });
    FormSelectComponent.decorators = [
        { type: Component, args: [{
                    selector: 'vcd-form-select',
                    template: "<div class=\"form-group\">\n    <div class=\"clr-form-control\">\n        <label *ngIf=\"label\" [attr.for]=\"id\" class=\"clr-control-label\" [ngClass]=\"{ 'required-field': showAsterisk }\">\n            {{ label }}\n        </label>\n        <span *ngIf=\"isReadOnly && selectedOption\" class=\"readOnly\">\n            {{ selectedOption.isTranslatable ? (selectedOption.display | translate) : selectedOption.display }}\n        </span>\n        <div class=\"clr-control-container\" [ngClass]=\"{ 'clr-error': showErrors }\">\n            <div class=\"clr-select-wrapper\" *ngIf=\"!isReadOnly\">\n                <select [id]=\"id\" [formControl]=\"formControl\">\n                    <option *ngFor=\"let option of options\" [value]=\"option.value\">\n                        {{ option.isTranslatable ? (option.display | translate) : option.display }}\n                    </option>\n                </select>\n            </div>\n\n            <ng-content select=\"aside\"></ng-content>\n\n            <span class=\"clr-subtext\" *ngIf=\"showErrors\">\n                <div *ngFor=\"let key of errorKeys\">\n                    <div>{{ key | translate: [formControl.value] }}</div>\n                </div>\n            </span>\n        </div>\n    </div>\n    <span class=\"clr-subtext\">\n        <ng-content select=\"footer\"></ng-content>\n    </span>\n</div>\n",
                    styles: [".required-field:after{content:\"*\";color:red;padding-left:5px}", ".form-group.hide-label{padding-left:0}.form-group.hide-label label:first-child{visibility:hidden}.error-content{white-space:normal}:host(.site-selector-single-site){display:none}"]
                }] }
    ];
    /** @nocollapse */
    FormSelectComponent.ctorParameters = function () { return [
        { type: NgControl, decorators: [{ type: Self }, { type: Optional }] }
    ]; };
    FormSelectComponent.propDecorators = {
        options: [{ type: Input }]
    };
    return FormSelectComponent;
}(BaseFormControl));
export { FormSelectComponent };
if (false) {
    /**
     * The displayed options for the select element
     * @type {?}
     */
    FormSelectComponent.prototype.options;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS1zZWxlY3QuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQHZjZC91aS1jb21wb25lbnRzLyIsInNvdXJjZXMiOlsiZm9ybS9mb3JtLXNlbGVjdC9mb3JtLXNlbGVjdC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUtBLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFFLFFBQVEsRUFBRSxJQUFJLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDakUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRTNDLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQzs7OztBQUt2RDtJQUt5Qyx1Q0FBZTtJQU1wRCw2QkFBZ0MsU0FBb0I7UUFBcEQsWUFDSSxrQkFBTSxTQUFTLENBQUMsU0F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