/**
 * @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';
export class DynamicInputComponent {
    /**
     * @return {?}
     */
    get isValid() {
        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;
    }
}
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 }]
};
if (false) {
    /** @type {?} */
    DynamicInputComponent.prototype.input;
    /** @type {?} */
    DynamicInputComponent.prototype.form;
    /** @type {?} */
    DynamicInputComponent.prototype.submitted;
    /** @type {?} */
    DynamicInputComponent.prototype.validatorForm;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pYy1pbnB1dC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9yZWFjdGl2ZS1mb3JtLXRlc3QvIiwic291cmNlcyI6WyJsaWIvY29tcG9uZW50cy9keW5hbWljLWlucHV0L2R5bmFtaWMtaW5wdXQuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLEtBQUssRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNqRCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDM0MsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBU25ELE1BQU07Ozs7SUFPSixJQUFJLE9BQU87UUFDVCxJQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsTUFBTSxFQUFFO1lBQzVDLElBQUksQ0FBQyxhQUFh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