UNPKG

@ngx-formly/bootstrap

Version:

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

128 lines (111 loc) 6.69 kB
import * as i0 from '@angular/core'; import { Component, NgModule, ViewChild, Optional, Directive } from '@angular/core'; import * as i2 from '@ngx-formly/core'; import { FieldWrapper, FormlyModule, FieldType as FieldType$1 } from '@ngx-formly/core'; import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import { ReactiveFormsModule } from '@angular/forms'; class FormlyWrapperFormField extends FieldWrapper { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyWrapperFormField, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FormlyWrapperFormField, selector: "formly-wrapper-form-field", usesInheritance: true, ngImport: i0, template: ` <ng-template #labelTemplate> <label *ngIf="props.label && props.hideLabel !== true" [attr.for]="id" class="form-label"> {{ props.label }} <span *ngIf="props.required && props.hideRequiredMarker !== true" aria-hidden="true">*</span> </label> </ng-template> <div [class.form-floating]="props.labelPosition === 'floating'" [class.has-error]="showError"> <ng-container *ngIf="props.labelPosition !== 'floating'"> <ng-container [ngTemplateOutlet]="labelTemplate"></ng-container> </ng-container> <ng-template #fieldComponent></ng-template> <ng-container *ngIf="props.labelPosition === 'floating'"> <ng-container [ngTemplateOutlet]="labelTemplate"></ng-container> </ng-container> <div *ngIf="showError" class="invalid-feedback" [style.display]="'block'"> <formly-validation-message id="{{ id }}-formly-validation-error" [field]="field" role="alert" ></formly-validation-message> </div> <small *ngIf="props.description" class="form-text text-muted">{{ props.description }}</small> </div> `, isInline: true, styles: [":host{display:block;margin-bottom:1rem}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i2.LegacyFormlyValidationMessage, selector: "formly-validation-message" }] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyWrapperFormField, decorators: [{ type: Component, args: [{ selector: 'formly-wrapper-form-field', template: ` <ng-template #labelTemplate> <label *ngIf="props.label && props.hideLabel !== true" [attr.for]="id" class="form-label"> {{ props.label }} <span *ngIf="props.required && props.hideRequiredMarker !== true" aria-hidden="true">*</span> </label> </ng-template> <div [class.form-floating]="props.labelPosition === 'floating'" [class.has-error]="showError"> <ng-container *ngIf="props.labelPosition !== 'floating'"> <ng-container [ngTemplateOutlet]="labelTemplate"></ng-container> </ng-container> <ng-template #fieldComponent></ng-template> <ng-container *ngIf="props.labelPosition === 'floating'"> <ng-container [ngTemplateOutlet]="labelTemplate"></ng-container> </ng-container> <div *ngIf="showError" class="invalid-feedback" [style.display]="'block'"> <formly-validation-message id="{{ id }}-formly-validation-error" [field]="field" role="alert" ></formly-validation-message> </div> <small *ngIf="props.description" class="form-text text-muted">{{ props.description }}</small> </div> `, styles: [":host{display:block;margin-bottom:1rem}\n"] }] }] }); function withFormlyFormField() { return { wrappers: [ { name: 'form-field', component: FormlyWrapperFormField, }, ], }; } class FormlyBootstrapFormFieldModule { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapFormFieldModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapFormFieldModule, declarations: [FormlyWrapperFormField], imports: [CommonModule, ReactiveFormsModule, i2.FormlyModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapFormFieldModule, imports: [CommonModule, ReactiveFormsModule, FormlyModule.forChild(withFormlyFormField())] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyBootstrapFormFieldModule, decorators: [{ type: NgModule, args: [{ declarations: [FormlyWrapperFormField], imports: [CommonModule, ReactiveFormsModule, FormlyModule.forChild(withFormlyFormField())], }] }] }); class FieldType extends FieldType$1 { set content(templateRef) { if (templateRef && this.hostContainerRef) { this.hostContainerRef.createEmbeddedView(templateRef); } } constructor(hostContainerRef) { super(); this.hostContainerRef = hostContainerRef; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FieldType, deps: [{ token: i0.ViewContainerRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: FieldType, viewQueries: [{ propertyName: "content", first: true, predicate: ["fieldTypeTemplate"], descendants: true, static: true }], usesInheritance: true, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FieldType, decorators: [{ type: Directive }], ctorParameters: () => [{ type: i0.ViewContainerRef, decorators: [{ type: Optional }] }], propDecorators: { content: [{ type: ViewChild, args: ['fieldTypeTemplate', { static: true }] }] } }); /** * Generated bundle index. Do not edit. */ export { FieldType, FormlyBootstrapFormFieldModule, withFormlyFormField }; //# sourceMappingURL=ngx-formly-bootstrap-form-field.mjs.map