var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { Component, Inject, forwardRef, EventEmitter, ViewEncapsulation } from '@angular/core';
import { PropertyMetadataClass } from './property.metadata.class';
import { ComponentSettingsDialogComponent } from '../component-settings-dialog.component';
export var DEFAULT_INPUTS_TEXT_METADATA = PropertyMetadataClass.DEFAULT_INPUTS_METADATA.slice();
export var DEFAULT_OUTPUTS_TEXT_METADATA = [
    'onChange'
];
var TextMetadataComponent = (function (_super) {
    __extends(TextMetadataComponent, _super);
    function TextMetadataComponent(settingsDialog) {
        var _this = _super.call(this, settingsDialog) || this;
        _this.onChange = new EventEmitter();
        return _this;
    }
    TextMetadataComponent.prototype.parseValue = function (arg) {
        if (arg !== undefined && arg !== null && this.data.type === 'number' && typeof arg !== 'number') {
            return parseInt(arg);
        }
        return arg;
    };
    TextMetadataComponent.prototype.ngOnInit = function () {
        this.initialize();
    };
    TextMetadataComponent.prototype.ngOnDestroy = function () {
        this.destroy();
    };
    TextMetadataComponent.DEFAULT_INPUTS_TEXT_METADATA = DEFAULT_INPUTS_TEXT_METADATA;
    TextMetadataComponent.DEFAULT_OUTPUTS_TEXT_METADATA = DEFAULT_OUTPUTS_TEXT_METADATA;
    TextMetadataComponent.decorators = [
        { type: Component, args: [{
                    selector: 'text-metadata',
                    template: "\n    <div fxLayout=\"row\" [formGroup]=\"getFormGroup()\">\n      <mat-form-field fxFlex>\n        <input matInput [attr.type]=\"data.type === 'number' ? 'number' : 'text'\" [attr.step]=\"data.type === 'number' ? 1 : undefined\"\n          [attr.min]=\"data.type === 'number' ? -1000 : undefined\" [attr.max]=\"data.type === 'number' ? 1000 : undefined\" [placeholder]=\"data.label\"\n          [ngModel]=\"getValue()\" (ngModelChange)=\"innerOnChange($event)\" [formControlName]=\"getPropertyName()\" />\n        <mat-hint *ngIf=\"fControl.touched && fControl.errors\">\n          <span *ngIf=\"fControl.errors?.required\">{{ 'FORM_VALIDATION.REQUIRED' | oTranslate }}</span>\n          <span *ngIf=\"fControl.errors?.minlength\">{{ 'FORM_VALIDATION.MIN_LENGTH' | oTranslate }}: {{ fControl.errors?.minlength.requiredLength }}</span>\n          <span *ngIf=\"fControl.errors?.maxlength\">{{ 'FORM_VALIDATION.MAX_LENGTH' | oTranslate }}: {{ fControl.errors?.maxlength.requiredLength }}</span>\n        </mat-hint>\n      </mat-form-field>\n      <mat-icon fxFlex=\"10\" *ngIf=\"data.tooltip\" [matTooltip]=\"data.tooltip\" matTooltipPosition=\"right\" class=\"material-icons\">info</mat-icon>\n    </div>\n  ",
                    styles: ["\n    mat-form-field.ng-invalid.ng-touched .mat-input-wrapper .mat-hint,mat-form-field.ng-invalid.ng-touched .mat-input-wrapper .mat-input-placeholder.mat-focused{color:#f44336}mat-form-field.ng-invalid.ng-touched .mat-input-wrapper .mat-input-underline{border-top-color:#f44336}mat-form-field.ng-invalid.ng-touched .mat-input-wrapper .mat-input-underline .mat-input-ripple{background-color:#f44336}\n  "],
                    inputs: DEFAULT_INPUTS_TEXT_METADATA.slice(),
                    outputs: DEFAULT_OUTPUTS_TEXT_METADATA.slice(),
                    encapsulation: ViewEncapsulation.None
                },] },
    ];
    TextMetadataComponent.ctorParameters = function () { return [
        { type: ComponentSettingsDialogComponent, decorators: [{ type: Inject, args: [forwardRef(function () { return ComponentSettingsDialogComponent; }),] }] }
    ]; };
    return TextMetadataComponent;
}(PropertyMetadataClass));
export { TextMetadataComponent };
//# sourceMappingURL=text-metadata.component.js.map