UNPKG

@ngx-formly/material

Version:

Formly is a dynamic (JSON powered) form library for Angular that bring unmatched maintainability to your application's forms.

151 lines (145 loc) 6.84 kB
import * as i0 from '@angular/core'; import { ChangeDetectionStrategy, Component, NgModule } from '@angular/core'; import { FieldType, FormlyMatFormFieldModule } from '@ngx-formly/material/form-field'; import * as i1 from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; import * as i2 from '@angular/material/input'; import { MatInputModule } from '@angular/material/input'; import * as i3 from '@ngx-formly/core'; import { FormlyModule } from '@ngx-formly/core'; import { CommonModule } from '@angular/common'; class FormlyFieldInput extends FieldType { get type() { return this.props.type || 'text'; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldInput, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: FormlyFieldInput, selector: "formly-field-mat-input", usesInheritance: true, ngImport: i0, template: ` @if (type !== 'number') { <input matInput [id]="id" [name]="field.name" [type]="type || 'text'" [readonly]="props.readonly" [required]="required" [errorStateMatcher]="errorStateMatcher" [formControl]="formControl" [formlyAttributes]="field" [tabIndex]="props.tabindex" [placeholder]="props.placeholder" /> } @else { <input matInput [id]="id" [name]="field.name" type="number" [readonly]="props.readonly" [required]="required" [errorStateMatcher]="errorStateMatcher" [formControl]="formControl" [formlyAttributes]="field" [tabIndex]="props.tabindex" [placeholder]="props.placeholder" /> } `, isInline: true, dependencies: [{ 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.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: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldInput, decorators: [{ type: Component, args: [{ selector: 'formly-field-mat-input', template: ` @if (type !== 'number') { <input matInput [id]="id" [name]="field.name" [type]="type || 'text'" [readonly]="props.readonly" [required]="required" [errorStateMatcher]="errorStateMatcher" [formControl]="formControl" [formlyAttributes]="field" [tabIndex]="props.tabindex" [placeholder]="props.placeholder" /> } @else { <input matInput [id]="id" [name]="field.name" type="number" [readonly]="props.readonly" [required]="required" [errorStateMatcher]="errorStateMatcher" [formControl]="formControl" [formlyAttributes]="field" [tabIndex]="props.tabindex" [placeholder]="props.placeholder" /> } `, changeDetection: ChangeDetectionStrategy.OnPush, }] }] }); function withFormlyFieldInput() { return { types: [ { name: 'input', component: FormlyFieldInput, wrappers: ['form-field'], }, { name: 'string', extends: 'input' }, { name: 'number', extends: 'input', defaultOptions: { props: { type: 'number', }, }, }, { name: 'integer', extends: 'input', defaultOptions: { props: { type: 'number', }, }, }, ], }; } class FormlyMatInputModule { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatInputModule, declarations: [FormlyFieldInput], imports: [CommonModule, ReactiveFormsModule, MatInputModule, FormlyMatFormFieldModule, i3.FormlyModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatInputModule, imports: [CommonModule, ReactiveFormsModule, MatInputModule, FormlyMatFormFieldModule, FormlyModule.forChild(withFormlyFieldInput())] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatInputModule, decorators: [{ type: NgModule, args: [{ declarations: [FormlyFieldInput], imports: [ CommonModule, ReactiveFormsModule, MatInputModule, FormlyMatFormFieldModule, FormlyModule.forChild(withFormlyFieldInput()), ], }] }] }); /** * Generated bundle index. Do not edit. */ export { FormlyFieldInput, FormlyMatInputModule, withFormlyFieldInput }; //# sourceMappingURL=ngx-formly-material-input.mjs.map