"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
var core_1 = require("@angular/core");
var typescript_angular_utilities_1 = require("typescript-angular-utilities");
var __object = typescript_angular_utilities_1.services.object;
var __array = typescript_angular_utilities_1.services.array;
var __guid = typescript_angular_utilities_1.services.guid;
var __transform = typescript_angular_utilities_1.services.transform;
var validationInput_1 = require("../validationInput");
var componentValidator_service_1 = require("../../../services/componentValidator/componentValidator.service");
var form_1 = require("../../form/form");
var busy_1 = require("../../busy/busy");
var index_1 = require("../../popoutList/index");
var input_1 = require("../input");
var SelectComponent = (function (_super) {
    __extends(SelectComponent, _super);
    function SelectComponent(transformService, rlForm, componentValidator, object, array, guid) {
        var _this = _super.call(this, rlForm, componentValidator, object, array, guid) || this;
        _this.transformService = transformService;
        _this.inputType = 'select';
        return _this;
    }
    SelectComponent.prototype.ngAfterViewInit = function () {
        _super.prototype.ngAfterViewInit.call(this);
        this.template = this.template || this.externalTemplate;
    };
    SelectComponent.prototype.select = function (value) {
        if (value != this.value) {
            this.setValue(value);
        }
        this.hideLabelIfEmpty();
    };
    SelectComponent.prototype.getDisplayName = function (item) {
        return this.transformService.getValue(item, this.transform);
    };
    return SelectComponent;
}(validationInput_1.ValidatedInputComponent));
__decorate([
    core_1.Input(),
    __metadata("design:type", Array)
], SelectComponent.prototype, "options", void 0);
__decorate([
    core_1.Input(),
    __metadata("design:type", Object)
], SelectComponent.prototype, "transform", void 0);
__decorate([
    core_1.Input(),
    __metadata("design:type", String)
], SelectComponent.prototype, "nullOption", void 0);
__decorate([
    core_1.Input(),
    __metadata("design:type", core_1.TemplateRef)
], SelectComponent.prototype, "externalTemplate", void 0);
__decorate([
    core_1.ViewChild(busy_1.BusyComponent),
    __metadata("design:type", busy_1.BusyComponent)
], SelectComponent.prototype, "busy", void 0);
__decorate([
    core_1.ContentChild(core_1.TemplateRef),
    __metadata("design:type", core_1.TemplateRef)
], SelectComponent.prototype, "template", void 0);
SelectComponent = __decorate([
    core_1.Component({
        selector: 'rlSelect',
        template: require('./select.html'),
        inputs: validationInput_1.validationInputs,
        outputs: validationInput_1.baseOutputs,
        providers: [componentValidator_service_1.ComponentValidator, index_1.POPOUT_LIST_PROVIDERS],
        animations: input_1.baseAnimations,
    }),
    __param(1, core_1.Optional()),
    __metadata("design:paramtypes", [__transform.TransformService, form_1.FormComponent,
        componentValidator_service_1.ComponentValidator, __object.ObjectUtility, __array.ArrayUtility, __guid.GuidService])
], SelectComponent);
exports.SelectComponent = SelectComponent;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic2VsZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLHNDQUF3SDtBQUV4SCw2RUFBd0Q7QUFDeEQsSUFBTyxRQUFRLEdBQUcsdUNBQVEsQ0FBQyxNQUFNLENBQUM7QUFDbEMsSUFBTyxPQUFPLEdBQUcsdUNBQVEsQ0FBQyxLQUFLLENBQUM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