UNPKG

@ngx-formly/bootstrap

Version:

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

137 lines (132 loc) 6.73 kB
import * as i0 from '@angular/core'; import { Component, ChangeDetectionStrategy, NgModule } from '@angular/core'; import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i3 from '@ngx-formly/core'; import { FormlyModule } from '@ngx-formly/core'; import * as i2 from '@angular/forms'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; import * as i4 from '@ngx-formly/core/select'; import { FormlySelectModule } from '@ngx-formly/core/select'; import { FieldType, FormlyBootstrapFormFieldModule } from '@ngx-formly/bootstrap/form-field'; class FormlyFieldRadio extends FieldType { constructor() { super(...arguments); this.defaultOptions = { props: { formCheck: 'default', }, }; } get disabledControl() { return new FormControl({ value: this.formControl.value, disabled: true }); } } FormlyFieldRadio.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormlyFieldRadio, deps: null, target: i0.ɵɵFactoryTarget.Component }); FormlyFieldRadio.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: FormlyFieldRadio, selector: "formly-field-radio", usesInheritance: true, ngImport: i0, template: ` <ng-template #fieldTypeTemplate> <div *ngFor="let option of props.options | formlySelectOptions : field | async; let i = index" class="form-check" [class.form-check-inline]="props.formCheck === 'inline'" > <input type="radio" [id]="id + '_' + i" class="form-check-input" [name]="field.name || id" [class.is-invalid]="showError" [attr.value]="option.value" [value]="option.value" [formControl]="option.disabled ? disabledControl : formControl" [formlyAttributes]="field" [attr.aria-describedby]="id + '-formly-validation-error'" [attr.aria-invalid]="showError" /> <label class="form-check-label" [for]="id + '_' + i"> {{ option.label }} </label> </div> </ng-template> `, isInline: true, directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i2.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { 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]" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i3.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }], pipes: { "async": i1.AsyncPipe, "formlySelectOptions": i4.FormlySelectOptionsPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormlyFieldRadio, decorators: [{ type: Component, args: [{ selector: 'formly-field-radio', template: ` <ng-template #fieldTypeTemplate> <div *ngFor="let option of props.options | formlySelectOptions : field | async; let i = index" class="form-check" [class.form-check-inline]="props.formCheck === 'inline'" > <input type="radio" [id]="id + '_' + i" class="form-check-input" [name]="field.name || id" [class.is-invalid]="showError" [attr.value]="option.value" [value]="option.value" [formControl]="option.disabled ? disabledControl : formControl" [formlyAttributes]="field" [attr.aria-describedby]="id + '-formly-validation-error'" [attr.aria-invalid]="showError" /> <label class="form-check-label" [for]="id + '_' + i"> {{ option.label }} </label> </div> </ng-template> `, changeDetection: ChangeDetectionStrategy.OnPush, }] }] }); class FormlyBootstrapRadioModule { } FormlyBootstrapRadioModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormlyBootstrapRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); FormlyBootstrapRadioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormlyBootstrapRadioModule, declarations: [FormlyFieldRadio], imports: [CommonModule, ReactiveFormsModule, FormlyBootstrapFormFieldModule, FormlySelectModule, i3.FormlyModule] }); FormlyBootstrapRadioModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormlyBootstrapRadioModule, imports: [[ CommonModule, ReactiveFormsModule, FormlyBootstrapFormFieldModule, FormlySelectModule, FormlyModule.forChild({ types: [ { name: 'radio', component: FormlyFieldRadio, wrappers: ['form-field'], }, ], }), ]] }); i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FormlyBootstrapRadioModule, decorators: [{ type: NgModule, args: [{ declarations: [FormlyFieldRadio], imports: [ CommonModule, ReactiveFormsModule, FormlyBootstrapFormFieldModule, FormlySelectModule, FormlyModule.forChild({ types: [ { name: 'radio', component: FormlyFieldRadio, wrappers: ['form-field'], }, ], }), ], }] }] }); /** * Generated bundle index. Do not edit. */ export { FormlyBootstrapRadioModule, FormlyFieldRadio }; //# sourceMappingURL=ngx-formly-bootstrap-radio.mjs.map