import { Component, HostBinding, Input } from '@angular/core';
var NzFormControlComponent = (function () {
    function NzFormControlComponent() {
        this._hasFeedback = false;
        this._nzFormItemControlWrapper = true;
    }
    Object.defineProperty(NzFormControlComponent.prototype, "nzHasFeedback", {
        get: function () {
            return this._hasFeedback;
        },
        set: function (value) {
            if (value === '') {
                this._hasFeedback = true;
            }
            else {
                this._hasFeedback = value;
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NzFormControlComponent.prototype, "isWarning", {
        get: function () {
            return this._isDirtyAndError('warning');
        },
        enumerable: true,
        configurable: true
    });
    ;
    Object.defineProperty(NzFormControlComponent.prototype, "isValidate", {
        get: function () {
            return this._isDirtyAndError('validating') || this.nzValidateStatus === 'pending' || this.nzValidateStatus && this.nzValidateStatus.dirty && this.nzValidateStatus.pending;
        },
        enumerable: true,
        configurable: true
    });
    ;
    Object.defineProperty(NzFormControlComponent.prototype, "isError", {
        get: function () {
            return this._isDirtyAndError('error')
                || this._isDirtyAndError('required')
                || this._isDirtyAndError('pattern')
                || this._isDirtyAndError('email')
                || this._isDirtyAndError('maxlength')
                || this._isDirtyAndError('minlength');
        },
        enumerable: true,
        configurable: true
    });
    ;
    Object.defineProperty(NzFormControlComponent.prototype, "isSuccess", {
        get: function () {
            return this.nzValidateStatus === 'success' || this.nzValidateStatus && this.nzValidateStatus.dirty && this.nzValidateStatus.valid;
        },
        enumerable: true,
        configurable: true
    });
    ;
    Object.defineProperty(NzFormControlComponent.prototype, "hasFeedBack", {
        get: function () {
            return this.nzHasFeedback;
        },
        enumerable: true,
        configurable: true
    });
    ;
    NzFormControlComponent.prototype._isDirtyAndError = function (name) {
        return this.nzValidateStatus === name || this.nzValidateStatus && this.nzValidateStatus.dirty && this.nzValidateStatus.hasError && this.nzValidateStatus.hasError(name);
    };
    return NzFormControlComponent;
}());
export { NzFormControlComponent };
NzFormControlComponent.decorators = [
    { type: Component, args: [{
                selector: '[nz-form-control]',
                template: "\n    <div class=\"ant-form-item-control\"\n      [class.has-warning]=\"isWarning\"\n      [class.has-error]=\"isError\"\n      [class.has-success]=\"isSuccess\"\n      [class.has-feedback]=\"hasFeedBack\"\n      [class.is-validating]=\"isValidate\">\n      <ng-content></ng-content>\n    </div>\n  ",
                styles: []
            },] },
];
/** @nocollapse */
NzFormControlComponent.ctorParameters = function () { return []; };
NzFormControlComponent.propDecorators = {
    '_nzFormItemControlWrapper': [{ type: HostBinding, args: ["class.ant-form-item-control-wrapper",] },],
    'nzHasFeedback': [{ type: Input },],
    'nzValidateStatus': [{ type: Input },],
};
