import { CdkTextareaAutosize } from '@angular/cdk/text-field';
import { Component, ViewChild } from '@angular/core';
import { ValueEdit } from '../../value-edit';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "@angular/material/form-field";
import * as i4 from "@angular/material/input";
import * as i5 from "@angular/cdk/text-field";
import * as i6 from "@aztrix/icons";
import * as i7 from "@aztrix/components/clear-button";
import * as i8 from "@aztrix/components/autofocus";
export class TextareaEditComponent extends ValueEdit {
    ngOnInit() {
        setTimeout(() => {
            this.autoSizer.resizeToFitContent(true);
        }, 500);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: TextareaEditComponent, selector: "ax-textarea-edit", viewQueries: [{ propertyName: "autoSizer", first: true, predicate: ["autoSizer"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<ax-icon *ngIf=\"icon\" class=\"icon type-icon\" [name]=\"icon\"></ax-icon>\n\n<mat-form-field\n  class=\"c-input\"\n  [ngClass]=\"{'remove-subtext': !errorsTemplate && !hint, readonly: readonly}\"\n  appearance=\"outline\"\n  [floatLabel]=\"floatLabel\"\n  [subscriptSizing]=\"subscriptSizing\"\n>\n  <mat-label>{{ label }}</mat-label>\n  <textarea\n    matInput\n    axAutofocus\n    #autoSizer=\"cdkTextareaAutosize\"\n    cdkTextareaAutosize\n    cdkAutosizeMinRows=\"1\"\n    cdkAutosizeMaxRows=\"10\"\n    autocomplete=\"off\"\n    [formControl]=\"form\"\n    [placeholder]=\"placeholder\"\n    [autofocus]=\"autofocus\"\n    [required]=\"required\"\n    [readonly]=\"readonly\"\n    (change)=\"$event.preventDefault()\"\n    (focus)=\"focused.emit()\"\n  ></textarea>\n  <mat-hint class=\"hint\" align=\"end\">\n    {{ hint }}\n  </mat-hint>\n  <ax-clear-button\n    matSuffix\n    [form]=\"form\"\n    *ngIf=\"hasValue && !form.disabled && !readonly\"\n  ></ax-clear-button>\n  <ng-content matSuffix></ng-content>\n  <mat-error *ngIf=\"errorsTemplate\">\n    <ng-template [ngTemplateOutlet]=\"errorsTemplate\"></ng-template>\n  </mat-error>\n</mat-form-field>\n", styles: [":host{display:block;position:relative}.type-icon{margin-top:20px}\n", ":host .type-icon{display:none}:host.showIcon{display:grid;grid-template-columns:38px 1fr}:host.showIcon .type-icon{display:inline}\n", "input::placeholder,area::placeholder{color:#0006}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.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: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i4.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: "directive", type: i5.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "component", type: i6.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "component", type: i7.ClearButtonComponent, selector: "ax-clear-button", inputs: ["form"] }, { kind: "directive", type: i8.AutofocusDirective, selector: "[axAutofocus]", inputs: ["autofocus"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaEditComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-textarea-edit', template: "<ax-icon *ngIf=\"icon\" class=\"icon type-icon\" [name]=\"icon\"></ax-icon>\n\n<mat-form-field\n  class=\"c-input\"\n  [ngClass]=\"{'remove-subtext': !errorsTemplate && !hint, readonly: readonly}\"\n  appearance=\"outline\"\n  [floatLabel]=\"floatLabel\"\n  [subscriptSizing]=\"subscriptSizing\"\n>\n  <mat-label>{{ label }}</mat-label>\n  <textarea\n    matInput\n    axAutofocus\n    #autoSizer=\"cdkTextareaAutosize\"\n    cdkTextareaAutosize\n    cdkAutosizeMinRows=\"1\"\n    cdkAutosizeMaxRows=\"10\"\n    autocomplete=\"off\"\n    [formControl]=\"form\"\n    [placeholder]=\"placeholder\"\n    [autofocus]=\"autofocus\"\n    [required]=\"required\"\n    [readonly]=\"readonly\"\n    (change)=\"$event.preventDefault()\"\n    (focus)=\"focused.emit()\"\n  ></textarea>\n  <mat-hint class=\"hint\" align=\"end\">\n    {{ hint }}\n  </mat-hint>\n  <ax-clear-button\n    matSuffix\n    [form]=\"form\"\n    *ngIf=\"hasValue && !form.disabled && !readonly\"\n  ></ax-clear-button>\n  <ng-content matSuffix></ng-content>\n  <mat-error *ngIf=\"errorsTemplate\">\n    <ng-template [ngTemplateOutlet]=\"errorsTemplate\"></ng-template>\n  </mat-error>\n</mat-form-field>\n", styles: [":host{display:block;position:relative}.type-icon{margin-top:20px}\n", ":host .type-icon{display:none}:host.showIcon{display:grid;grid-template-columns:38px 1fr}:host.showIcon .type-icon{display:inline}\n", "input::placeholder,area::placeholder{color:#0006}\n"] }]
        }], propDecorators: { autoSizer: [{
                type: ViewChild,
                args: ['autoSizer']
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGV4dGFyZWEtZWRpdC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9saWJzL2NvbXBvbmVudHMvdmFsdWUtZWRpdC92YWx1ZS1lZGl0cy90ZXh0YXJlYS1lZGl0L3RleHRhcmVhLWVkaXQuY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9jb21wb25lbnRzL3ZhbHVlLWVkaXQvdmFsdWUtZWRpdHMvdGV4dGFyZWEtZWRpdC90ZXh0YXJlYS1lZGl0LmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxtQkFBbUIsRUFBQyxNQUFNLHlCQUF5QixDQUFDO0FBQzVELE9BQU8sRUFBQyxTQUFTLEVBQVUsU0FBUyxFQUFDLE1BQU0sZUFBZSxDQUFDO0FBRTNELE9BQU8sRUFBQyxTQUFTLEVBQUMsTUFBTSxrQkFBa0IsQ0FBQzs7Ozs7Ozs7OztBQVczQyxNQUFNLE9BQU8scUJBQX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