import { ChangeDetectionStrategy, Component, importProvidersFrom } from '@angular/core';
import { FieldType, FormlyModule } from '@ngx-formly/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "../../forms/required-input-placeholder.directive";
import * as i4 from "@ngx-formly/core";
export const fieldInputTypeConfig = () => importProvidersFrom(FormlyModule.forChild({
    types: [
        {
            name: 'input',
            component: FieldInput,
            wrappers: ['c8y-form-field']
        },
        { name: 'string', extends: 'input' },
        { name: 'typeahead', extends: 'input' },
        {
            name: 'number',
            extends: 'input',
            defaultOptions: {
                templateOptions: {
                    type: 'number'
                }
            }
        },
        {
            name: 'integer',
            extends: 'input',
            defaultOptions: {
                templateOptions: {
                    type: 'number'
                }
            }
        }
    ]
}));
export class FieldInput extends FieldType {
    get type() {
        return this.to.type || 'text';
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: FieldInput, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: FieldInput, selector: "c8y-field-input", usesInheritance: true, ngImport: i0, template: "<input\n  *ngIf=\"type !== 'number'; else numberTmp\"\n  [type]=\"type\"\n  [formControl]=\"formControl\"\n  class=\"form-control\"\n  [formlyAttributes]=\"field\"\n  [required]=\"to.required\"\n  [attr.autocomplete]=\"to.autocomplete ? to.autocomplete : null\"\n  [class.is-invalid]=\"showError\"\n/>\n<ng-template #numberTmp>\n  <input\n    type=\"number\"\n    [formControl]=\"formControl\"\n    class=\"form-control\"\n    [formlyAttributes]=\"field\"\n    [required]=\"to.required\"\n    [attr.autocomplete]=\"to.autocomplete ? to.autocomplete : null\"\n    [class.is-invalid]=\"showError\"\n  />\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { 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: "directive", type: i3.RequiredInputPlaceholderDirective, selector: "input[required], input[formControlName]" }, { kind: "directive", type: i4.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: FieldInput, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-field-input', changeDetection: ChangeDetectionStrategy.OnPush, template: "<input\n  *ngIf=\"type !== 'number'; else numberTmp\"\n  [type]=\"type\"\n  [formControl]=\"formControl\"\n  class=\"form-control\"\n  [formlyAttributes]=\"field\"\n  [required]=\"to.required\"\n  [attr.autocomplete]=\"to.autocomplete ? to.autocomplete : null\"\n  [class.is-invalid]=\"showError\"\n/>\n<ng-template #numberTmp>\n  <input\n    type=\"number\"\n    [formControl]=\"formControl\"\n    class=\"form-control\"\n    [formlyAttributes]=\"field\"\n    [required]=\"to.required\"\n    [attr.autocomplete]=\"to.autocomplete ? to.autocomplete : null\"\n    [class.is-invalid]=\"showError\"\n  />\n</ng-template>\n" }]
        }] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5wdXQudHlwZS5jb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