UNPKG

@ngx-formly/ionic

Version:

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

126 lines (120 loc) 7.12 kB
import * as i0 from '@angular/core'; import { ChangeDetectionStrategy, Component, NO_ERRORS_SCHEMA, NgModule } from '@angular/core'; import * as i1$1 from '@ngx-formly/core'; import { FieldType, FormlyModule } from '@ngx-formly/core'; 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 '@ionic/angular'; import { IonicModule } from '@ionic/angular'; import * as i4 from '@ngx-formly/ionic/form-field'; import { FormlyFormFieldModule } from '@ngx-formly/ionic/form-field'; import * as i5 from '@ngx-formly/core/select'; import { FormlySelectModule as FormlySelectModule$1 } from '@ngx-formly/core/select'; class FormlyFieldSelect extends FieldType { constructor() { super(...arguments); this.defaultOptions = { props: { compareWith(o1, o2) { return o1 === o2; }, }, }; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldSelect, deps: null, target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: FormlyFieldSelect, selector: "formly-field-ion-select", usesInheritance: true, ngImport: i0, template: ` <!-- ng-container used as a workaround for https://github.com/ionic-team/ionic/issues/19324 --> <ng-container *ngIf="props.options | formlySelectOptions: field | async; let selectOptions"> <ion-select [style.align-self]="props.labelPosition === 'floating' ? 'stretch' : ''" [style.max-width.%]="props.labelPosition === 'floating' ? 100 : ''" [formControl]="formControl" [compareWith]="props.compareWith" [ionFormlyAttributes]="field" [multiple]="props.multiple" [interface]="props.interface" [okText]="props.okText" [cancelText]="props.cancelText" [label]="props.label" [labelPlacement]="props.labelPosition" > <ion-select-option *ngFor="let option of selectOptions" [value]="option.value" [disabled]="option.disabled"> {{ option.label }} </ion-select-option> </ion-select> </ng-container> `, isInline: true, styles: [":host{display:inherit}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: "component", type: i3.IonSelect, selector: "ion-select", inputs: ["cancelText", "color", "compareWith", "disabled", "expandedIcon", "fill", "interface", "interfaceOptions", "justify", "label", "labelPlacement", "mode", "multiple", "name", "okText", "placeholder", "selectedText", "shape", "toggleIcon", "value"] }, { kind: "component", type: i3.IonSelectOption, selector: "ion-select-option", inputs: ["disabled", "value"] }, { kind: "directive", type: i3.SelectValueAccessor, selector: "ion-select, ion-radio-group, ion-segment, ion-datetime" }, { kind: "directive", type: i4.ɵIonFormlyAttributes, selector: "[ionFormlyAttributes]", inputs: ["ionFormlyAttributes"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "pipe", type: i5.LegacyFormlySelectOptionsPipe, name: "formlySelectOptions" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlyFieldSelect, decorators: [{ type: Component, args: [{ selector: 'formly-field-ion-select', template: ` <!-- ng-container used as a workaround for https://github.com/ionic-team/ionic/issues/19324 --> <ng-container *ngIf="props.options | formlySelectOptions: field | async; let selectOptions"> <ion-select [style.align-self]="props.labelPosition === 'floating' ? 'stretch' : ''" [style.max-width.%]="props.labelPosition === 'floating' ? 100 : ''" [formControl]="formControl" [compareWith]="props.compareWith" [ionFormlyAttributes]="field" [multiple]="props.multiple" [interface]="props.interface" [okText]="props.okText" [cancelText]="props.cancelText" [label]="props.label" [labelPlacement]="props.labelPosition" > <ion-select-option *ngFor="let option of selectOptions" [value]="option.value" [disabled]="option.disabled"> {{ option.label }} </ion-select-option> </ion-select> </ng-container> `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:inherit}\n"] }] }] }); function withFormlyFieldSelect() { return { types: [ { name: 'select', component: FormlyFieldSelect, wrappers: ['form-field'], }, { name: 'enum', extends: 'select' }, ], }; } class FormlySelectModule { static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlySelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: FormlySelectModule, declarations: [FormlyFieldSelect], imports: [CommonModule, ReactiveFormsModule, IonicModule, FormlyFormFieldModule, FormlySelectModule$1, i1$1.FormlyModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlySelectModule, imports: [CommonModule, ReactiveFormsModule, IonicModule, FormlyFormFieldModule, FormlySelectModule$1, FormlyModule.forChild(withFormlyFieldSelect())] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: FormlySelectModule, decorators: [{ type: NgModule, args: [{ declarations: [FormlyFieldSelect], imports: [ CommonModule, ReactiveFormsModule, IonicModule, FormlyFormFieldModule, FormlySelectModule$1, FormlyModule.forChild(withFormlyFieldSelect()), ], schemas: [NO_ERRORS_SCHEMA], }] }] }); /** * Generated bundle index. Do not edit. */ export { FormlyFieldSelect, FormlySelectModule, withFormlyFieldSelect }; //# sourceMappingURL=ngx-formly-ionic-select.mjs.map