import { Component, Input } 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 "@aztrix/icons";
import * as i6 from "@angular/material/autocomplete";
import * as i7 from "@aztrix/components/clear-button";
import * as i8 from "@aztrix/components/autofocus";
export class TextEditComponent extends ValueEdit {
    constructor() {
        super(...arguments);
        this.inputType = 'text';
    }
    get defaultAutocompleteAttr() {
        switch (this.inputType) {
            case 'email':
                return 'email';
            case 'url':
                return 'url';
            default:
                return 'on';
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: TextEditComponent, selector: "ax-text-edit", inputs: { inputType: "inputType", numberConfig: "numberConfig" }, usesInheritance: true, ngImport: i0, template: "<ax-icon *ngIf=\"icon\" class=\"icon type-icon\" [name]=\"icon\"></ax-icon>\n<mat-form-field\n  class=\"c-input\"\n  [ngClass]=\"{'remove-subtext': !errorsTemplate && !hint, readonly: readonly}\"\n  appearance=\"outline\"\n  [floatLabel]=\"prefix ? 'always' : floatLabel\"\n  [subscriptSizing]=\"subscriptSizing\"\n>\n  <mat-label>{{ label }}</mat-label>\n  <div class=\"input-field\">\n    <span *ngIf=\"prefix\" class=\"custom-prefix\">\n      {{ prefix }}\n    </span>\n    <input\n      matInput\n      axAutofocus\n      [attr.inputmode]=\"inputType === 'number' && !numberConfig ? 'numeric' : undefined\"\n      [attr.pattern]=\"inputType === 'number' && !numberConfig ? '[0-9]*' : undefined\"\n      [name]=\"getName()\"\n      [type]=\"inputType\"\n      [min]=\"numberConfig?.min\"\n      [max]=\"numberConfig?.max\"\n      [step]=\"numberConfig?.step\"\n      [formControl]=\"form\"\n      [autofocus]=\"autofocus\"\n      [placeholder]=\"placeholder\"\n      [autocomplete]=\"\n        matAutocomplete?.options?.length\n          ? 'no-autocomplete'\n          : autocompleteAttr || defaultAutocompleteAttr\n      \"\n      [matAutocomplete]=\"autocomplete\"\n      [matAutocompleteDisabled]=\"!matAutocomplete\"\n      [required]=\"required\"\n      [readonly]=\"readonly\"\n      (focus)=\"focused.emit()\"\n    />\n    <span *ngIf=\"postfix\" class=\"custom-prefix\">\n      {{ postfix }}\n    </span>\n  </div>\n\n  <mat-hint class=\"hint\" align=\"end\">\n    {{ hint }}\n  </mat-hint>\n  <span class=\"suffix\" matSuffix>\n    <ax-clear-button\n      [form]=\"form\"\n      *ngIf=\"hasValue && !form.disabled && !readonly\"\n    ></ax-clear-button>\n    <ng-content></ng-content>\n  </span>\n\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}.input-field{display:flex}.custom-prefix{white-space:nowrap;color:var(--font-color)}\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: "component", type: i5.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "directive", type: i6.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: ["matAutocomplete", "matAutocompletePosition", "matAutocompleteConnectedTo", "autocomplete", "matAutocompleteDisabled"], exportAs: ["matAutocompleteTrigger"] }, { 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: TextEditComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-text-edit', template: "<ax-icon *ngIf=\"icon\" class=\"icon type-icon\" [name]=\"icon\"></ax-icon>\n<mat-form-field\n  class=\"c-input\"\n  [ngClass]=\"{'remove-subtext': !errorsTemplate && !hint, readonly: readonly}\"\n  appearance=\"outline\"\n  [floatLabel]=\"prefix ? 'always' : floatLabel\"\n  [subscriptSizing]=\"subscriptSizing\"\n>\n  <mat-label>{{ label }}</mat-label>\n  <div class=\"input-field\">\n    <span *ngIf=\"prefix\" class=\"custom-prefix\">\n      {{ prefix }}\n    </span>\n    <input\n      matInput\n      axAutofocus\n      [attr.inputmode]=\"inputType === 'number' && !numberConfig ? 'numeric' : undefined\"\n      [attr.pattern]=\"inputType === 'number' && !numberConfig ? '[0-9]*' : undefined\"\n      [name]=\"getName()\"\n      [type]=\"inputType\"\n      [min]=\"numberConfig?.min\"\n      [max]=\"numberConfig?.max\"\n      [step]=\"numberConfig?.step\"\n      [formControl]=\"form\"\n      [autofocus]=\"autofocus\"\n      [placeholder]=\"placeholder\"\n      [autocomplete]=\"\n        matAutocomplete?.options?.length\n          ? 'no-autocomplete'\n          : autocompleteAttr || defaultAutocompleteAttr\n      \"\n      [matAutocomplete]=\"autocomplete\"\n      [matAutocompleteDisabled]=\"!matAutocomplete\"\n      [required]=\"required\"\n      [readonly]=\"readonly\"\n      (focus)=\"focused.emit()\"\n    />\n    <span *ngIf=\"postfix\" class=\"custom-prefix\">\n      {{ postfix }}\n    </span>\n  </div>\n\n  <mat-hint class=\"hint\" align=\"end\">\n    {{ hint }}\n  </mat-hint>\n  <span class=\"suffix\" matSuffix>\n    <ax-clear-button\n      [form]=\"form\"\n      *ngIf=\"hasValue && !form.disabled && !readonly\"\n    ></ax-clear-button>\n    <ng-content></ng-content>\n  </span>\n\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}.input-field{display:flex}.custom-prefix{white-space:nowrap;color:var(--font-color)}\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: { inputType: [{
                type: Input
            }], numberConfig: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 