/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
 */
import { Component, Input } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { InputBase } from '../../models/InputBase';
var DynamicInputComponent = /** @class */ (function () {
    function DynamicInputComponent() {
    }
    Object.defineProperty(DynamicInputComponent.prototype, "isValid", {
        get: /**
         * @return {?}
         */
        function () {
            if (this.form.controls[this.input.key].errors) {
                this.validatorForm = Object.keys(this.form.controls[this.input.key].errors)[0];
            }
            return this.submitted && this.form.controls[this.input.key].valid;
        },
        enumerable: true,
        configurable: true
    });
    DynamicInputComponent.decorators = [
        { type: Component, args: [{
                    // tslint:disable-next-line:component-selector
                    selector: 'dynamic-input',
                    template: "<div [formGroup]=\"form\">\r\n  <div [ngSwitch]=\"input.controlType\">\r\n    <div *ngSwitchCase=\"'textbox'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <input class=\"form-control\" [formControlName]=\"input.key\" [type]=\"input.type\">\r\n        <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n          <div *ngFor=\"let validator of input.validators\">\r\n            <div *ngIf=\"validator.label === validatorForm\">\r\n              {{ validator.message }}\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div class=\"flex-row\" *ngSwitchCase=\"'dropdown'\">\r\n      <div class=\"reactive-form-group\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <select [formControlName]=\"input.key\" class=\"form-control\">\r\n          <option *ngFor=\"let opt of input.options\" [ngValue]=\"opt\">{{opt.label}}</option>\r\n        </select>\r\n        <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n          <div *ngFor=\"let validator of input.validators\">\r\n            <div *ngIf=\"validator.label === validatorForm\">\r\n              {{ validator.message }}\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'radio'\">\r\n      <label class=\"float-label\">{{input.label}}</label>\r\n      <div class=\"form-primary\">\r\n        <div class=\"form-radio\">\r\n          <div class=\"group-add-on\">\r\n            <div class=\"radio radiofill\" *ngFor=\"let opt of input.options\">\r\n              <label>\r\n                <input type=\"radio\" [formControlName]=\"input.key\" [value]=\"opt.value\">\r\n                <i class=\"helper\"></i> {{ opt.label }}\r\n              </label>\r\n            </div>\r\n            <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n              <div *ngFor=\"let validator of input.validators\">\r\n                <div *ngIf=\"validator.label === validatorForm\">\r\n                  {{ validator.message }}\r\n                </div>\r\n              </div>\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'custom_dropdown'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <custom-selection [formControlName]=\"input.key\" name=\"test-dropdown\" [(options)]=\"input.options\"></custom-selection>\r\n        <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n          <div *ngFor=\"let validator of input.validators\">\r\n            <div *ngIf=\"validator.label === validatorForm\">\r\n              {{ validator.message }}\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'tinymce'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <editor [formControlName]=\"input.key\" [init]=\"{height : input.height, plugins: input.plugins}\"></editor>\r\n        <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n          <div *ngFor=\"let validator of input.validators\">\r\n            <div *ngIf=\"validator.label === validatorForm\">\r\n              {{ validator.message }}\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'checkbox'\" style=\"padding: 0 15px;\">\r\n      <div class=\"form-primary\">\r\n        <input [formControlName]=\"input.key\" [(ngModel)]=\"input.value\" [id]=\"input.key\" type=\"checkbox\" (change)=\"input.value = ckb.checked\"\r\n          #ckb>\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'list-checkbox'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <mutiple-checkbox [formControlName]=\"input.key\" [(options)]=\"input.options\"></mutiple-checkbox>\r\n        <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n          <div *ngFor=\"let validator of input.validators\">\r\n            <div *ngIf=\"validator.label === validatorForm\">\r\n              {{ validator.message }}\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'textbox-mask'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <mask-input [formControlName]=\"input.key\" [placeholder]=\"input.placeholder\" [guide]=\"input.guide\" [valueWithCharacter]=\"input.valueWithCharacter\"\r\n          [inputMaskText]=\"input.mask\"></mask-input>\r\n        <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n          <div *ngFor=\"let validator of input.validators\">\r\n            <div *ngIf=\"validator.label === validatorForm\">\r\n              {{ validator.message }}\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'dropzone'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <custom-dropzone [url]=\"input.url\" [formControlName]=\"input.key\" [oldValue]=\"input.value\" [showPreview]=\"input.showPreview\"\r\n          [maxFiles]=\"input. maxFiles\" [maxFilesize]=\"input.maxFilesize\" [acceptedFiles]=\"input.acceptedFiles\" [message]=\"input.message\"\r\n          [upload_path]=\"input.upload_path\"></custom-dropzone>\r\n        <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n          <div *ngFor=\"let validator of input.validators\">\r\n            <div *ngIf=\"validator.label === validatorForm\">\r\n              {{ validator.message }}\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'datetimepicker'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <div class=\"form-group\">\r\n          <custom-date-time-picker [dateFormat]=\"input.dateFormat\" [timeOnly]=\"input.timeOnly\" [showTime]=\"input.showTime\" [yearRange]=\"input.yearRange\"\r\n            [yearNavigator]=\"input.yearNavigator\" [monthNavigator]=\"input.monthNavigator\" [showIcon]=\"input.showIcon\" [formControlName]=\"input.key\"></custom-date-time-picker>\r\n          <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n            <div *ngFor=\"let validator of input.validators\">\r\n              <div *ngIf=\"validator.label === validatorForm\">\r\n                {{ validator.message }}\r\n              </div>\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'phonecode'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <div class=\"form-group\">\r\n          <app-phone-input [formControlName]=\"input.key\"></app-phone-input>\r\n          <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n            <div *ngFor=\"let validator of input.validators\">\r\n              <div *ngIf=\"validator.label === validatorForm\">\r\n                {{ validator.message }}\r\n              </div>\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'select2'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <div class=\"form-group\">\r\n          <app-custom-select2 [formControlName]=\"input.key\" [placeholder]=\"input.placeholder\" [tags]=\"input.tags\" [options]=\"input.options\"></app-custom-select2>\r\n          <div class=\"errorMessage messages text-danger\" *ngIf=\"submitted && !isValid\">\r\n            <div *ngFor=\"let validator of input.validators\">\r\n              <div *ngIf=\"validator.label === validatorForm\">\r\n                {{ validator.message }}\r\n              </div>\r\n            </div>\r\n          </div>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n    <div *ngSwitchCase=\"'custom_checkbox'\">\r\n      <div class=\"form-primary\">\r\n        <label class=\"float-label\">{{input.label}}</label>\r\n        <div class=\"form-group\">\r\n          <custom-checkbox [formControlName]=\"input.key\" [onChange]=\"input.onChange\"></custom-checkbox>\r\n        </div>\r\n      </div>\r\n    </div>\r\n\r\n  </div>\r\n</div>\r\n",
                    styles: [":host .reactive-form-group label{font-size:12px;margin-bottom:0}"]
                }] }
    ];
    DynamicInputComponent.propDecorators = {
        input: [{ type: Input }],
        form: [{ type: Input }],
        submitted: [{ type: Input }]
    };
    return DynamicInputComponent;
}());
export { DynamicInputComponent };
if (false) {
    /** @type {?} */
    DynamicInputComponent.prototype.input;
    /** @type {?} */
    DynamicInputComponent.prototype.form;
    /** @type {?} */
    DynamicInputComponent.prototype.submitted;
    /** @type {?} */
    DynamicInputComponent.prototype.validatorForm;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pYy1pbnB1dC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9yZWFjdGl2ZS1mb3JtLXRlc3QvIiwic291cmNlcyI6WyJsaWIvY29tcG9uZW50cy9keW5hbWljLWlucHV0L2R5bmFtaWMtaW5wdXQuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNqRCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDM0MsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBR25EO0lBQUE7SUFvQkEsQ0FBQztJQVBDLHNCQUFJLDBDQUFPOzs7O1FBQ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