import { __decorate, __extends } from "tslib";
import { Component, Input } from '@angular/core';
import { CustomInputComponent } from '../custom-input/custom-input.component';
import { coerceBooleanProperty } from '../util/coerceBoolean.service';
var TextFieldComponent = /** @class */ (function (_super) {
    __extends(TextFieldComponent, _super);
    function TextFieldComponent() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.maxLength = 255;
        _this.placeholder = "";
        _this.inputType = 'text';
        return _this;
    }
    TextFieldComponent.prototype.ngOnInit = function () {
        this.before = coerceBooleanProperty(this.before);
        this.after = coerceBooleanProperty(this.after);
        if (this.password === undefined) {
            this.password = false;
        }
        else if (this.password !== false) {
            this.password = true;
        }
        if (this.password) {
            this.inputType = 'password';
        }
        _super.prototype.ngOnInit.call(this);
    };
    __decorate([
        Input()
    ], TextFieldComponent.prototype, "maxLength", void 0);
    __decorate([
        Input()
    ], TextFieldComponent.prototype, "password", void 0);
    __decorate([
        Input()
    ], TextFieldComponent.prototype, "placeholder", void 0);
    __decorate([
        Input()
    ], TextFieldComponent.prototype, "before", void 0);
    __decorate([
        Input()
    ], TextFieldComponent.prototype, "after", void 0);
    TextFieldComponent = __decorate([
        Component({
            selector: 'tree-text-field',
            template: "<div class=\"form-group\" *ngIf='!before && !after'>\n  <label>\n    <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n  </label>\n  <input [maxLength]=\"maxLength\"  [attr.type]=\"inputType\" class=\"form-control\" [(ngModel)]=\"ngValue\" name=\"\" [disabled]='disabled' [placeholder]='placeholder'>\n  <small class='text-danger' *ngIf='showError'>{{ errors }}</small>\n</div>\n\n<div class=\"input-group form-group\" *ngIf='before'>\n  <div class=\"input-group-prepend\">\n    <span class=\"input-group-text\">\n      <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n    </span>\n  </div>\n  <input [maxLength]=\"maxLength\"  [attr.type]=\"inputType\" class=\"form-control\" [(ngModel)]=\"ngValue\" name=\"\" [disabled]='disabled' [placeholder]='placeholder'>\n</div>\n\n<div class=\"input-group form-group\" *ngIf='after'>\n  <input [maxLength]=\"maxLength\"  [attr.type]=\"inputType\" class=\"form-control\" [(ngModel)]=\"ngValue\" name=\"\" [disabled]='disabled' [placeholder]='placeholder'>\n  <div class=\"input-group-append\">\n    <span class=\"input-group-text\">\n      <ng-container *ngTemplateOutlet=\"contentTpl\"></ng-container>\n    </span>\n  </div>\n</div>\n\n<ng-template #contentTpl><ng-content></ng-content></ng-template>\n",
            styles: [""]
        })
    ], TextFieldComponent);
    return TextFieldComponent;
}(CustomInputComponent));
export { TextFieldComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGV4dC1maWVsZC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AZG90bGluZS9mb3Jlc3QvIiwic291cmNlcyI6WyJsaWIvdGV4dC1maWVsZC90ZXh0LWZpZWxkLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQVUsTUFBTSxlQUFlLENBQUM7QUFDekQsT0FBTyxFQUFFLG9CQUFvQixFQUFFLE1BQU0sd0NBQXdDLENBQUM7QUFDOUUsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFPdEU7SUFBd0Msc0NBQW9CO0lBQTVEO1FBQUEscUVBdUJDO1FBdEJVLGVBQVMsR0FBRyxHQUFHLENBQUM7UUFFaEIsaUJBQVcsR0FBRyxFQUFFLENBQUM7UUFLbkIsZUFBUyxHQUFHLE1BQU0sQ0FBQzs7SUFlNUIsQ0FBQztJQWJDLHFDQUFRLEdBQVI7UUFDRSxJQUFJLENBQUMsTUFBTSxHQUFHLHFCQUFxQixDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUNqRCxJQUFJLENBQUMsS0FBSyxHQUFHLHFCQUFxQixDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ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