UNPKG

@ngx-formly/material

Version:

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

126 lines (120 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 i2 from '@angular/material/input'; import { MAT_INPUT_VALUE_ACCESSOR, MatInputModule } from '@angular/material/input'; import * as i1 from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; import * as i3 from '@angular/cdk/text-field'; import * as i4 from '@ngx-formly/core'; import { FormlyModule } from '@ngx-formly/core'; import { CommonModule } from '@angular/common'; class FormlyFieldTextArea extends FieldType { constructor() { super(...arguments); this.defaultOptions = { props: { cols: 1, rows: 1, }, }; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldTextArea, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FormlyFieldTextArea, selector: "formly-field-mat-textarea", providers: [ // fix for https://github.com/ngx-formly/ngx-formly/issues/1688 // rely on formControl value instead of elementRef which return empty value in Firefox. { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: FormlyFieldTextArea }, ], usesInheritance: true, ngImport: i0, template: ` <textarea matInput [id]="id" [name]="field.name" [readonly]="props.readonly" [required]="required" [formControl]="formControl" [errorStateMatcher]="errorStateMatcher" [cols]="props.cols" [rows]="props.rows" [formlyAttributes]="field" [placeholder]="props.placeholder" [tabindex]="props.tabindex" [cdkTextareaAutosize]="props.autosize" [cdkAutosizeMinRows]="props.autosizeMinRows" [cdkAutosizeMaxRows]="props.autosizeMaxRows" [class.cdk-textarea-autosize]="props.autosize" ></textarea> `, 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.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.CdkTextareaAutosize, selector: "textarea[cdkTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "cdkTextareaAutosize", "placeholder"], exportAs: ["cdkTextareaAutosize"] }, { kind: "directive", type: i4.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldTextArea, decorators: [{ type: Component, args: [{ selector: 'formly-field-mat-textarea', template: ` <textarea matInput [id]="id" [name]="field.name" [readonly]="props.readonly" [required]="required" [formControl]="formControl" [errorStateMatcher]="errorStateMatcher" [cols]="props.cols" [rows]="props.rows" [formlyAttributes]="field" [placeholder]="props.placeholder" [tabindex]="props.tabindex" [cdkTextareaAutosize]="props.autosize" [cdkAutosizeMinRows]="props.autosizeMinRows" [cdkAutosizeMaxRows]="props.autosizeMaxRows" [class.cdk-textarea-autosize]="props.autosize" ></textarea> `, providers: [ // fix for https://github.com/ngx-formly/ngx-formly/issues/1688 // rely on formControl value instead of elementRef which return empty value in Firefox. { provide: MAT_INPUT_VALUE_ACCESSOR, useExisting: FormlyFieldTextArea }, ], changeDetection: ChangeDetectionStrategy.OnPush, }] }] }); function withFormlyFieldTextArea() { return { types: [ { name: 'textarea', component: FormlyFieldTextArea, wrappers: ['form-field'], }, ], }; } class FormlyMatTextAreaModule { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatTextAreaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatTextAreaModule, declarations: [FormlyFieldTextArea], imports: [CommonModule, ReactiveFormsModule, MatInputModule, FormlyMatFormFieldModule, i4.FormlyModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatTextAreaModule, imports: [CommonModule, ReactiveFormsModule, MatInputModule, FormlyMatFormFieldModule, FormlyModule.forChild(withFormlyFieldTextArea())] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyMatTextAreaModule, decorators: [{ type: NgModule, args: [{ declarations: [FormlyFieldTextArea], imports: [ CommonModule, ReactiveFormsModule, MatInputModule, FormlyMatFormFieldModule, FormlyModule.forChild(withFormlyFieldTextArea()), ], }] }] }); /** * Generated bundle index. Do not edit. */ export { FormlyFieldTextArea, FormlyMatTextAreaModule, withFormlyFieldTextArea }; //# sourceMappingURL=ngx-formly-material-textarea.mjs.map