UNPKG

angular-dynamic-forms-lite

Version:
36 lines (35 loc) 2.08 kB
import { AbstractControl, FormBuilder } from "@angular/forms"; import { Type, ComponentFactoryResolver, Injector, ViewRef } from "@angular/core"; import { FormContext } from "../form/form-context"; import { FormFieldSetting } from "../form-settings/form-field-setting"; import { FormRootDirective } from "../form/form-root.directive"; import { DynamicController } from "./dynamic-controller"; import { BasicFormFieldValue } from "../form/form-model"; import { FormFieldSettings } from "../form-settings/form-field-settings"; export interface CreateFormContextOptions<M, T extends AbstractControl, S extends FormFieldSetting<M>> { initialValue?: BasicFormFieldValue; formControl?: T; setting: S; settings: FormFieldSettings; } export interface FieldFactory<T extends AbstractControl, S extends FormFieldSetting<any>> { create<M>(params: CreateFormContextOptions<M, T, S>): FormContext<M, T>; render(formRoot: FormRootDirective, root: FormContext<any, T>): ViewRef; updateChildren(context: FormContext<any, T>): void; } export declare class ParentFieldFactory implements FieldFactory<AbstractControl, FormFieldSetting<any>> { private factories; private componentFactoryResolver; private injector; private formBuilder; private settings; constructor(factories: { [key: string]: Type<FieldFactory<AbstractControl, FormFieldSetting<any>>>; }, componentFactoryResolver: ComponentFactoryResolver, injector: Injector, formBuilder: FormBuilder, settings: FormFieldSettings); create<M>(params: CreateFormContextOptions<M, AbstractControl, FormFieldSetting<M>>): FormContext<M, AbstractControl>; render(formRoot: FormRootDirective, root: FormContext<any, AbstractControl>): ViewRef; updateChildren(context: FormContext<any, AbstractControl>): void; resolveComponent<M, H extends AbstractControl = AbstractControl>(formControl: H, setting: FormFieldSetting<M>, value: BasicFormFieldValue, dynamicController: DynamicController): FormContext<M, H>; private patchAsyncChangeDetection; private getFactory; }