import { __decorate, __metadata } from "tslib";
import { Component, ElementRef, forwardRef, Injector, ViewEncapsulation } from '@angular/core';
import { NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatTooltipModule } from '@angular/material/tooltip';
import { NumberInputConverter } from '../../../decorators/input-converter';
import { OMatErrorDirective } from '../../../directives/o-mat-error.directive';
import { OTranslatePipe } from '../../../pipes/o-translate.pipe';
import { OTextInputComponent } from '../text-input/o-text-input.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
import * as i2 from "@angular/material/form-field";
import * as i3 from "@angular/material/input";
import * as i4 from "@angular/material/tooltip";
export const DEFAULT_INPUTS_O_TEXTAREA_INPUT = [
    'columns',
    'rows'
];
export class OTextareaInputComponent extends OTextInputComponent {
    constructor(elRef, injector) {
        super(elRef, injector);
        this.rows = 5;
        this.columns = 3;
    }
    isResizable() {
        let resizable = true;
        if (!this.enabled || this.isReadOnly) {
            resizable = false;
        }
        return resizable;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: OTextareaInputComponent, deps: [{ token: i0.ElementRef }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: OTextareaInputComponent, isStandalone: true, selector: "o-textarea-input", inputs: { columns: "columns", rows: "rows" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => OTextareaInputComponent), multi: true }], usesInheritance: true, ngImport: i0, template: "<div [formGroup]=\"getFormGroup()\" [matTooltip]=\"tooltip\" [matTooltipClass]=\"tooltipClass\" [matTooltipPosition]=\"tooltipPosition\"\n  [matTooltipShowDelay]=\"tooltipShowDelay\" [matTooltipHideDelay]=\"tooltipHideDelay\">\n  <mat-form-field [appearance]=\"appearance\" [floatLabel]=\"floatLabel\" [hideRequiredMarker]=\"hideRequiredMarker\" [class.custom-width]=\"hasCustomWidth\"\n    class=\"o-flex-fill\" [subscriptSizing]=\"subscriptSizing\">\n    @if (labelVisible) {\n      <mat-label>{{ olabel | oTranslate }}</mat-label>\n    }\n    <textarea matInput class=\"mat-textarea\" type=\"text\" [id]=\"getAttribute()\" [formControlName]=\"getAttribute()\" [placeholder]=\"placeHolder\"\n      (focus)=\"innerOnFocus($event)\" (blur)=\"innerOnBlur($event)\" [readonly]=\"isReadOnly\" [class.no-resize]=\"!isResizable()\" [rows]=\"rows\"\n    [cols]=\"columns\" [required]=\"isRequired\" (change)=\"onChangeEvent($event)\" [maxlength]=\"maxLength\" [minlength]=\"minLength\"></textarea>\n    <mat-error *oMatError=\"hasError('required')\">\n      {{ 'FORM_VALIDATION.REQUIRED' | oTranslate }}\n    </mat-error>\n    <mat-error *oMatError=\"hasError('minlength')\">\n      {{ 'FORM_VALIDATION.MIN_LENGTH' | oTranslate }}: {{ getErrorValue('minlength', 'requiredLength') }}\n    </mat-error>\n    <mat-error *oMatError=\"hasError('maxlength')\">\n      {{ 'FORM_VALIDATION.MAX_LENGTH' | oTranslate }}: {{ getErrorValue('maxlength', 'requiredLength') }}\n    </mat-error>\n    @for (oError of getActiveOErrors(); track oError) {\n      <mat-error>\n        {{ oError.text | oTranslate }}\n      </mat-error>\n    }\n  </mat-form-field>\n</div>\n", styles: [".mat-textarea{resize:vertical}.mat-textarea.no-resize{resize:none}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i2.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i2.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i3.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i4.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: OMatErrorDirective, selector: "[oMatError]", inputs: ["oMatError"] }, { kind: "pipe", type: OTranslatePipe, name: "oTranslate" }], encapsulation: i0.ViewEncapsulation.None }); }
}
__decorate([
    NumberInputConverter(),
    __metadata("design:type", Number)
], OTextareaInputComponent.prototype, "rows", void 0);
__decorate([
    NumberInputConverter(),
    __metadata("design:type", Number)
], OTextareaInputComponent.prototype, "columns", void 0);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: OTextareaInputComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, imports: [ReactiveFormsModule, MatFormFieldModule, MatInputModule, MatTooltipModule, OMatErrorDirective, OTranslatePipe], selector: 'o-textarea-input', inputs: DEFAULT_INPUTS_O_TEXTAREA_INPUT, encapsulation: ViewEncapsulation.None, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => OTextareaInputComponent), multi: true }], template: "<div [formGroup]=\"getFormGroup()\" [matTooltip]=\"tooltip\" [matTooltipClass]=\"tooltipClass\" [matTooltipPosition]=\"tooltipPosition\"\n  [matTooltipShowDelay]=\"tooltipShowDelay\" [matTooltipHideDelay]=\"tooltipHideDelay\">\n  <mat-form-field [appearance]=\"appearance\" [floatLabel]=\"floatLabel\" [hideRequiredMarker]=\"hideRequiredMarker\" [class.custom-width]=\"hasCustomWidth\"\n    class=\"o-flex-fill\" [subscriptSizing]=\"subscriptSizing\">\n    @if (labelVisible) {\n      <mat-label>{{ olabel | oTranslate }}</mat-label>\n    }\n    <textarea matInput class=\"mat-textarea\" type=\"text\" [id]=\"getAttribute()\" [formControlName]=\"getAttribute()\" [placeholder]=\"placeHolder\"\n      (focus)=\"innerOnFocus($event)\" (blur)=\"innerOnBlur($event)\" [readonly]=\"isReadOnly\" [class.no-resize]=\"!isResizable()\" [rows]=\"rows\"\n    [cols]=\"columns\" [required]=\"isRequired\" (change)=\"onChangeEvent($event)\" [maxlength]=\"maxLength\" [minlength]=\"minLength\"></textarea>\n    <mat-error *oMatError=\"hasError('required')\">\n      {{ 'FORM_VALIDATION.REQUIRED' | oTranslate }}\n    </mat-error>\n    <mat-error *oMatError=\"hasError('minlength')\">\n      {{ 'FORM_VALIDATION.MIN_LENGTH' | oTranslate }}: {{ getErrorValue('minlength', 'requiredLength') }}\n    </mat-error>\n    <mat-error *oMatError=\"hasError('maxlength')\">\n      {{ 'FORM_VALIDATION.MAX_LENGTH' | oTranslate }}: {{ getErrorValue('maxlength', 'requiredLength') }}\n    </mat-error>\n    @for (oError of getActiveOErrors(); track oError) {\n      <mat-error>\n        {{ oError.text | oTranslate }}\n      </mat-error>\n    }\n  </mat-form-field>\n</div>\n", styles: [".mat-textarea{resize:vertical}.mat-textarea.no-resize{resize:none}\n"] }]
        }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Injector }], propDecorators: { rows: [], columns: [] } });
//# sourceMappingURL=data:application/json;base64, 