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/legacy-form-field";
import * as i4 from "@angular/material/legacy-input";
import * as i5 from "@aztrix/icons";
import * as i6 from "@angular/material/legacy-autocomplete";
import * as i7 from "@aztrix/components/clear-button";
import * as i8 from "@aztrix/components/autofocus";
import * as i9 from "@aztrix/components/property-published-button";
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';
        }
    }
}
TextEditComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: TextEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
TextEditComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", 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}\"\n  appearance=\"outline\"\n  [floatLabel]=\"prefix ? 'always' : floatLabel\"\n>\n  <mat-label>\n    <span *ngIf=\"label\">{{ label }}</span>\n  </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 === 'number' && !numberConfig ? 'text' : inputType\"\n      [min]=\"numberConfig ? numberConfig.min : undefined\"\n      [max]=\"numberConfig ? numberConfig.max : undefined\"\n      [step]=\"numberConfig ? numberConfig.step : undefined\"\n      [formControl]=\"form\"\n      [autofocus]=\"autofocus\"\n      [placeholder]=\"placeholder\"\n      [autocomplete]=\"\n        matAutocomplete?.options?.length\n          ? 'no-autocomplete'\n          : autocompleteAttr || defaultAutocompleteAttr\n      \"\n      [matAutocomplete]=\"matAutocomplete\"\n      [matAutocompleteDisabled]=\"!matAutocomplete\"\n      [required]=\"required\"\n      (focus)=\"focused.emit()\"\n    />\n    <span *ngIf=\"postfix\" class=\"custom-prefix\">\n      {{ postfix }}\n    </span>\n  </div>\n\n  <mat-hint\n    [ngClass]=\"{collapsed}\"\n    (click)=\"collapsed = !collapsed\"\n    class=\"hint collapsible\"\n    align=\"end\"\n    #hintElement\n  >\n    <div><ax-icon *ngIf=\"isOverflowing()\" class=\"icon\" name=\"chevron-down\"></ax-icon></div>\n    <span [ngClass]=\"{overflowing: isOverflowing()}\">\n      {{ hint }}\n    </span>\n  </mat-hint>\n  <span class=\"suffix\" matSuffix>\n    <ax-clear-button [form]=\"form\" *ngIf=\"hasValue && !form.disabled\"></ax-clear-button>\n    <ng-content></ng-content>\n  </span>\n\n  <mat-error>\n    <ng-template [ngTemplateOutlet]=\"errorsTemplate\"></ng-template>\n  </mat-error>\n</mat-form-field>\n<ax-property-published-button *ngIf=\"published\"></ax-property-published-button>\n", styles: [":host{display:block;position:relative}.type-icon{margin-top:20px}.input-field{display:flex}.custom-prefix{color:#0006}.suffix{display:flex}\n", ":host .type-icon{display:none}:host.showIcon{display:grid;grid-template-columns:38px 1fr}:host.showIcon .type-icon{display:inline}\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.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.MatLegacyError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLegacyHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatLegacyLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatLegacySuffix, selector: "[matSuffix]" }, { kind: "directive", type: i4.MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", exportAs: ["matInput"] }, { kind: "component", type: i5.IconComponent, selector: "ax-icon", inputs: ["name", "inline"] }, { kind: "directive", type: i6.MatLegacyAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "component", type: i7.ClearButtonComponent, selector: "ax-clear-button", inputs: ["form"] }, { kind: "directive", type: i8.AutofocusDirective, selector: "[axAutofocus]", inputs: ["autofocus"] }, { kind: "component", type: i9.PropertyPublishedButtonComponent, selector: "ax-property-published-button" }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", 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}\"\n  appearance=\"outline\"\n  [floatLabel]=\"prefix ? 'always' : floatLabel\"\n>\n  <mat-label>\n    <span *ngIf=\"label\">{{ label }}</span>\n  </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 === 'number' && !numberConfig ? 'text' : inputType\"\n      [min]=\"numberConfig ? numberConfig.min : undefined\"\n      [max]=\"numberConfig ? numberConfig.max : undefined\"\n      [step]=\"numberConfig ? numberConfig.step : undefined\"\n      [formControl]=\"form\"\n      [autofocus]=\"autofocus\"\n      [placeholder]=\"placeholder\"\n      [autocomplete]=\"\n        matAutocomplete?.options?.length\n          ? 'no-autocomplete'\n          : autocompleteAttr || defaultAutocompleteAttr\n      \"\n      [matAutocomplete]=\"matAutocomplete\"\n      [matAutocompleteDisabled]=\"!matAutocomplete\"\n      [required]=\"required\"\n      (focus)=\"focused.emit()\"\n    />\n    <span *ngIf=\"postfix\" class=\"custom-prefix\">\n      {{ postfix }}\n    </span>\n  </div>\n\n  <mat-hint\n    [ngClass]=\"{collapsed}\"\n    (click)=\"collapsed = !collapsed\"\n    class=\"hint collapsible\"\n    align=\"end\"\n    #hintElement\n  >\n    <div><ax-icon *ngIf=\"isOverflowing()\" class=\"icon\" name=\"chevron-down\"></ax-icon></div>\n    <span [ngClass]=\"{overflowing: isOverflowing()}\">\n      {{ hint }}\n    </span>\n  </mat-hint>\n  <span class=\"suffix\" matSuffix>\n    <ax-clear-button [form]=\"form\" *ngIf=\"hasValue && !form.disabled\"></ax-clear-button>\n    <ng-content></ng-content>\n  </span>\n\n  <mat-error>\n    <ng-template [ngTemplateOutlet]=\"errorsTemplate\"></ng-template>\n  </mat-error>\n</mat-form-field>\n<ax-property-published-button *ngIf=\"published\"></ax-property-published-button>\n", styles: [":host{display:block;position:relative}.type-icon{margin-top:20px}.input-field{display:flex}.custom-prefix{color:#0006}.suffix{display:flex}\n", ":host .type-icon{display:none}:host.showIcon{display:grid;grid-template-columns:38px 1fr}:host.showIcon .type-icon{display:inline}\n"] }]
        }], propDecorators: { inputType: [{
                type: Input
            }], numberConfig: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 