/**
 * @fileoverview added by tsickle
 * Generated from: lib/attribute/attribute-form2/attribute-form2.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Input } from '@angular/core';
import { AttributeBase } from '../attribute-base';
import { FormGroup } from '@angular/forms';
var AttributeForm2Component = /** @class */ (function () {
    function AttributeForm2Component() {
    }
    /**
     * @return {?}
     */
    AttributeForm2Component.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
    };
    Object.defineProperty(AttributeForm2Component.prototype, "invalid", {
        get: /**
         * @return {?}
         */
        function () { return this.formGroup.controls[this.attributeControl.name].invalid; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(AttributeForm2Component.prototype, "errorMessage", {
        get: /**
         * @return {?}
         */
        function () {
            /** @type {?} */
            var fieldCtrl = this.formGroup.get(this.attributeControl.name);
            if (fieldCtrl.getError('pattern')) {
                return 'The pattern is not correct';
            }
            else if (fieldCtrl.getError('required')) {
                return 'Required';
            }
            else if (fieldCtrl.getError('message')) {
                return fieldCtrl.getError('message');
            }
            else {
                return null;
            }
        },
        enumerable: true,
        configurable: true
    });
    AttributeForm2Component.decorators = [
        { type: Component, args: [{
                    selector: 'dk-app-attribute-form2',
                    template: "<div class=\"form-group\" [formGroup]=\"formGroup\">\n  <label class=\"col-form-label\"\n         [class.form-control-sm]=\"isSmallSize\"\n         [attr.for]=\"attributeControl.key\">\n    {{attributeControl.label}}<strong *ngIf=\"attributeControl.primaryKey\" class=\"primaryKey\">*</strong>:\n    <span [class.ng-invalid]=\"invalid\" class=\"dk-invalid-feedback\">{{errorMessage}}</span>\n  </label>\n\n  <dk-app-attribute [attributeControl]=\"attributeControl\" [formGroup]=\"formGroup\"\n                    [isSmallSize]=\"isSmallSize\" [readonly]=\"readonly\" [noErrorMsg]=\"true\">\n  </dk-app-attribute>\n\n</div>\n",
                    styles: [""]
                }] }
    ];
    /** @nocollapse */
    AttributeForm2Component.ctorParameters = function () { return []; };
    AttributeForm2Component.propDecorators = {
        attributeControl: [{ type: Input }],
        formGroup: [{ type: Input }],
        readonly: [{ type: Input }],
        isSmallSize: [{ type: Input }]
    };
    return AttributeForm2Component;
}());
export { AttributeForm2Component };
if (false) {
    /** @type {?} */
    AttributeForm2Component.prototype.attributeControl;
    /** @type {?} */
    AttributeForm2Component.prototype.formGroup;
    /** @type {?} */
    AttributeForm2Component.prototype.readonly;
    /** @type {?} */
    AttributeForm2Component.prototype.isSmallSize;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0cmlidXRlLWZvcm0yLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2pvci1hbmd1bGFyLyIsInNvdXJjZXMiOlsibGliL2F0dHJpYnV0ZS9hdHRyaWJ1dGUtZm9ybTIvYXR0cmlidXRlLWZvcm0yLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBQyxTQUFTLEVBQUUsS0FBSyxFQUFTLE1BQU0sZUFBZSxDQUFDO0FBQ3ZELE9BQU8sRUFBQyxhQUFhLEVBQUMsTUFBTSxtQkFBbUIsQ0FBQztBQUNoRCxPQUFPLEVBQUMsU0FBUyxFQUFDLE1BQU0sZ0JBQWdCLENBQUM7QUFFekM7SUFPRTtJQUFnQixDQUFDOzs7O0lBTWpCLDBDQUFROzs7SUFBUjtJQUVBLENBQUM7SUFFRCxzQkFBSSw0Q0FBTzs7OztRQUFYLGNBQWdCLE9BQU8sSUFBSSxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLElBQUksQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7OztPQUFBO0lBRXJGLHNCQUFJLGlEQUFZOzs7O1FBQWhCOztnQkFDUSxTQUFTLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxHQU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