UNPKG

@ngx-formly/bootstrap

Version:

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

131 lines (125 loc) 6.4 kB
import * as i0 from '@angular/core'; import { ChangeDetectionStrategy, Component, NgModule } from '@angular/core'; import { FieldType, FormlyBootstrapFormFieldModule } from '@ngx-formly/bootstrap/form-field'; import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i2 from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; import * as i3 from '@ngx-formly/core'; import { FormlyModule } from '@ngx-formly/core'; class FormlyFieldCheckbox extends FieldType { constructor() { super(...arguments); this.defaultOptions = { props: { indeterminate: true, hideLabel: true, formCheck: 'default', }, }; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldCheckbox, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FormlyFieldCheckbox, selector: "formly-field-checkbox", usesInheritance: true, ngImport: i0, template: ` <ng-template #fieldTypeTemplate> <div class="form-check" [ngClass]="{ 'form-check-inline': props.formCheck === 'inline' || props.formCheck === 'inline-switch', 'form-switch': props.formCheck === 'switch' || props.formCheck === 'inline-switch', }" > <input type="checkbox" [class.is-invalid]="showError" class="form-check-input" [class.position-static]="props.formCheck === 'nolabel'" [indeterminate]="props.indeterminate && formControl.value == null" [formControl]="formControl" [formlyAttributes]="field" [attr.aria-describedby]="id + '-formly-validation-error'" [attr.aria-invalid]="showError" /> <label *ngIf="props.formCheck !== 'nolabel'" [for]="id" class="form-check-label"> {{ props.label }} <span *ngIf="props.required && props.hideRequiredMarker !== true" aria-hidden="true">*</span> </label> </div> </ng-template> `, isInline: true, 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: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldCheckbox, decorators: [{ type: Component, args: [{ selector: 'formly-field-checkbox', template: ` <ng-template #fieldTypeTemplate> <div class="form-check" [ngClass]="{ 'form-check-inline': props.formCheck === 'inline' || props.formCheck === 'inline-switch', 'form-switch': props.formCheck === 'switch' || props.formCheck === 'inline-switch', }" > <input type="checkbox" [class.is-invalid]="showError" class="form-check-input" [class.position-static]="props.formCheck === 'nolabel'" [indeterminate]="props.indeterminate && formControl.value == null" [formControl]="formControl" [formlyAttributes]="field" [attr.aria-describedby]="id + '-formly-validation-error'" [attr.aria-invalid]="showError" /> <label *ngIf="props.formCheck !== 'nolabel'" [for]="id" class="form-check-label"> {{ props.label }} <span *ngIf="props.required && props.hideRequiredMarker !== true" aria-hidden="true">*</span> </label> </div> </ng-template> `, changeDetection: ChangeDetectionStrategy.OnPush, }] }] }); function withFormlyFieldCheckbox() { return { types: [ { name: 'checkbox', component: FormlyFieldCheckbox, wrappers: ['form-field'], }, { name: 'boolean', extends: 'checkbox', }, ], }; } class FormlyBootstrapCheckboxModule { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapCheckboxModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapCheckboxModule, declarations: [FormlyFieldCheckbox], imports: [CommonModule, ReactiveFormsModule, FormlyBootstrapFormFieldModule, i3.FormlyModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapCheckboxModule, imports: [CommonModule, ReactiveFormsModule, FormlyBootstrapFormFieldModule, FormlyModule.forChild(withFormlyFieldCheckbox())] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapCheckboxModule, decorators: [{ type: NgModule, args: [{ declarations: [FormlyFieldCheckbox], imports: [ CommonModule, ReactiveFormsModule, FormlyBootstrapFormFieldModule, FormlyModule.forChild(withFormlyFieldCheckbox()), ], }] }] }); /** * Generated bundle index. Do not edit. */ export { FormlyBootstrapCheckboxModule, FormlyFieldCheckbox, withFormlyFieldCheckbox }; //# sourceMappingURL=ngx-formly-bootstrap-checkbox.mjs.map