/**
 * @fileoverview added by tsickle
 * Generated from: common-form/common-form.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormBuilder, FormControl, Validators } from '@angular/forms';
var CommonFormComponent = /** @class */ (function () {
    function CommonFormComponent(fb) {
        this.fb = fb;
        this.bcacFormEmit = new EventEmitter();
        this.validateForm = this.fb.group({});
        this.formSize = "small";
        this.fieldList = [];
    }
    /**
     * @return {?}
     */
    CommonFormComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
    };
    Object.defineProperty(CommonFormComponent.prototype, "bcacSize", {
        set: /**
         * @param {?} value
         * @return {?}
         */
        function (value) {
            this.formSize = value;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(CommonFormComponent.prototype, "bcacFields", {
        set: /**
         * @param {?} fields
         * @return {?}
         */
        function (fields) {
            var _this = this;
            this.fieldList = fields;
            this.fieldList.forEach((/**
             * @param {?} element
             * @return {?}
             */
            function (element) {
                /** @type {?} */
                var formControl = new FormControl();
                if (element.required) {
                    formControl.setValidators(Validators.required);
                }
                _this.validateForm.addControl(element.value, formControl);
            }));
        },
        enumerable: true,
        configurable: true
    });
    /**
     * @return {?}
     */
    CommonFormComponent.prototype.submit = /**
     * @return {?}
     */
    function () {
        var _this = this;
        console.log("submit");
        this.fieldList.forEach((/**
         * @param {?} element
         * @return {?}
         */
        function (element) {
            if (element.type === "tree") {
                _this.validateForm.get(element.value).setValue(element.nodes);
            }
        }));
        this.bcacFormEmit.emit(this.validateForm);
    };
    /**
     * @return {?}
     */
    CommonFormComponent.prototype.resetForm = /**
     * @return {?}
     */
    function () {
        this.validateForm.reset();
    };
    CommonFormComponent.decorators = [
        { type: Component, args: [{
                    selector: 'bcac-common-form',
                    template: "<!-- <div>\r\n    <form nz-form [formGroup]=\"validateForm\">\r\n        <div nz-row [nzGutter]=\"0\">\r\n            <div nz-col [nzSpan]=\"colSpan\" *ngFor=\"let field of fieldList\">\r\n                <nz-form-item nzFlex>\r\n                    <nz-form-label>{{field.label}}</nz-form-label>\r\n                    <nz-form-control>\r\n                        <input\r\n                            nz-input\r\n                            [placeholder]=\"field.label\"\r\n                            [formControlName]=\"field.value\"/>\r\n                    </nz-form-control>\r\n                </nz-form-item>\r\n            </div>\r\n        </div>\r\n    </form>\r\n    <div class=\"button-area\">\r\n        <bcac-button bcacContent=\"\u53D6\u6D88\" bcacType=\"default\" bcacSize=\"small\" (click)=\"modalClose()\"></bcac-button>\r\n        <bcac-button bcacContent=\"\u786E\u5B9A\" bcacType=\"primary\" bcacSize=\"small\" (click)=\"print()\"></bcac-button>\r\n    </div>\r\n</div> -->\r\n<form nz-form [formGroup]=\"validateForm\">\r\n    <nz-form-item *ngFor=\"let field of fieldList\">\r\n        <nz-form-label [nzSpan]=\"field.labelSpan\" [nzRequired]=\"field.required\">{{field.label}}</nz-form-label>\r\n        <!-- [nzSm]=\"8\" [nzXs]=\"24\" required -->\r\n        <!-- [nzSm]=\"16\" [nzXs]=\"24\" -->\r\n        <nz-form-control [nzSpan]=\"field.valueSpan\">\r\n            <ng-container *ngIf=\"field.type === 'text'\">\r\n                <input nz-input [nzSize]=\"formSize\" [placeholder]=\"field.placeholder? field.placeholder: ''\" [formControlName]=\"field.value\" />\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'date'\">\r\n                <nz-date-picker [nzSize]=\"formSize\" [formControlName]=\"field.value\" [nzPlaceHolder]=\"field.placeholder? field.placeholder: '\u8BF7\u9009\u62E9\u65E5\u671F'\"></nz-date-picker>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'date-time'\">\r\n                <nz-date-picker nzShowTime [nzSize]=\"formSize\" [formControlName]=\"field.value\" [nzPlaceHolder]=\"field.placeholder? field.placeholder: '\u8BF7\u9009\u62E9\u65F6\u95F4'\"></nz-date-picker>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'month'\">\r\n                <nz-month-picker  [nzSize]=\"formSize\" [formControlName]=\"field.value\" [nzPlaceHolder]=\"field.placeholder? field.placeholder: '\u8BF7\u9009\u62E9\u6708\u4EFD'\"></nz-month-picker>\r\n            </ng-container>\r\n            <!-- <ng-container *ngIf=\"field.type === 'month'\">\r\n                <nz-month-picker [formControlName]=\"field.value\"></nz-month-picker>\r\n            </ng-container> -->\r\n            <ng-container *ngIf=\"field.type === 'time'\">\r\n                <nz-time-picker [nzSize]=\"formSize\" [formControlName]=\"field.value\" [nzPlaceHolder]=\"field.placeholder? field.placeholder: '\u8BF7\u9009\u62E9\u65F6\u95F4'\"></nz-time-picker>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'year'\">\r\n                <nz-year-picker [nzSize]=\"formSize\" [formControlName]=\"field.value\" [nzPlaceHolder]=\"field.placeholder? field.placeholder: '\u8BF7\u9009\u62E9\u5E74\u4EFD'\"></nz-year-picker>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'week'\">\r\n                <nz-week-picker [nzSize]=\"formSize\" [formControlName]=\"field.value\" [nzPlaceHolder]=\"field.placeholder? field.placeholder: '\u8BF7\u9009\u62E9\u5468'\"></nz-week-picker>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'time-range'\">\r\n                <nz-range-picker [nzFormat]=\"field.format\" [nzSize]=\"formSize\" [formControlName]=\"field.value\" [nzPlaceHolder]=\"field.placeholder? field.placeholder: ['\u5F00\u59CB', '\u7ED3\u675F']\"></nz-range-picker>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'textarea'\">\r\n                <textarea [nzSize]=\"formSize\" [formControlName]=\"field.value\" nz-input [rows]=\"field.textAreaRows\" [placeholder]=\"field.placeholder? field.placeholder: '\u8BF7\u8F93\u5165'\"></textarea>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'select'\">\r\n                <nz-select nzPlaceHolder=\"\u5168\u90E8\" [nzAllowClear]=\"true\" [nzSize]=\"formSize\" [formControlName]=\"field.value\">\r\n                    <nz-option *ngFor=\"let option of field.selectOptions\" [nzLabel]=\"option.label\" [nzValue]=\"option.value\">\r\n                    </nz-option>\r\n                </nz-select>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'radio'\">\r\n                <nz-radio-group [nzSize]=\"formSize\" [formControlName]=\"field.value\" [(ngModel)]=\"field.default\">\r\n                    <label nz-radio *ngFor=\"let option of field.selectOptions\" [nzValue]=\"option.value\">{{option.label}}</label>\r\n                </nz-radio-group>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'switch'\">\r\n                <nz-switch [nzSize]=\"formSize\" nzCheckedChildren=\"\u5F00\" nzUnCheckedChildren=\"\u5173\" [formControlName]=\"field.value\" [(ngModel)]=\"field.default\"></nz-switch>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'slider'\">\r\n                <nz-slider [nzMin]=\"field.nzMin? field.nzMin: 1\" [nzMax]=\"field.nzMax? field.nzMax: 100\" \r\n                [formControlName]=\"field.value\"\r\n                [nzTooltipVisible]=\"field.sliderTooltipVisible? field.sliderTooltipVisible: 'default'\"></nz-slider>\r\n            </ng-container>\r\n            <ng-container *ngIf=\"field.type === 'tree'\">\r\n                <nz-tree\r\n                [nzData]=\"field.nodes\"\r\n                nzCheckable\r\n                nzMultiple\r\n                ></nz-tree>\r\n            </ng-container>\r\n        </nz-form-control>\r\n    </nz-form-item>\r\n    <nz-form-item *ngIf=\"fieldList.length > 0\">\r\n        <nz-form-control [nzOffset]=\"fieldList[0].labelSpan\" [nzSpan]=\"fieldList[0].valueSpan\">\r\n            <bcac-button class=\"left-button\" bcacContent=\"\u63D0\u4EA4\" bcacType=\"primary\" [bcacSize]=\"formSize\" (click)=\"submit()\" \r\n            [disabled]=\"!validateForm.valid\" ></bcac-button>\r\n            <bcac-button bcacContent=\"\u91CD\u7F6E\" bcacType=\"default\" [bcacSize]=\"formSize\" (click)=\"resetForm()\"></bcac-button>\r\n        </nz-form-control>\r\n      </nz-form-item>\r\n</form>\r\n<!-- <div class=\"button-area\">\r\n    <bcac-button bcacContent=\"\u53D6\u6D88\" bcacType=\"default\" bcacSize=\"default\" (click)=\"modalClose()\"></bcac-button>\r\n    <bcac-button bcacContent=\"\u786E\u5B9A\" bcacType=\"primary\" bcacSize=\"default\" (click)=\"print()\"></bcac-button>\r\n</div> -->\r\n",
                    host: {
                        '[class.bcac-form-sm]': "formSize === 'small'",
                    },
                    styles: [".left-button{margin-right:.8rem}:host ::ng-deep .ant-form-item{margin-bottom:1rem}:host.bcac-form-sm .ant-form-item{margin-bottom:0}"]
                }] }
    ];
    /** @nocollapse */
    CommonFormComponent.ctorParameters = function () { return [
        { type: FormBuilder }
    ]; };
    CommonFormComponent.propDecorators = {
        bcacFormEmit: [{ type: Output }],
        bcacSize: [{ type: Input }],
        bcacFields: [{ type: Input }]
    };
    return CommonFormComponent;
}());
export { CommonFormComponent };
if (false) {
    /** @type {?} */
    CommonFormComponent.prototype.bcacFormEmit;
    /** @type {?} */
    CommonFormComponent.prototype.validateForm;
    /** @type {?} */
    CommonFormComponent.prototype.formSize;
    /** @type {?} */
    CommonFormComponent.prototype.fieldList;
    /**
     * @type {?}
     * @private
     */
    CommonFormComponent.prototype.fb;
}
//# sourceMappingURL=data:application/json;base64, 