UNPKG

angular-dynamic-forms-lite

Version:
46 lines (45 loc) 2.29 kB
import { ComponentFactoryResolver, Injector } from "@angular/core"; import { FormGroup, FormArray } from "@angular/forms"; import { RootSetting } from "../form-settings/form-field-setting"; import { FormModel } from "./form-model"; import { FormContext } from "./form-context"; import { FormRootDirective } from "./form-root.directive"; import { InlineForm } from "./inline/inline-form"; import { FormFieldSettings } from "../form-settings/form-field-settings"; import { FormComponentsByType } from "../form-field/form-field-type"; /** * A service for creating and rendering dynamic forms. For usage informations refer to * https://github.com/tom-schoener/angular-dynamic-forms-lite */ export declare class DynamicFormsLiteService { private componentFactoryResolver; private injector; private defaultFormComponents?; constructor(componentFactoryResolver: ComponentFactoryResolver, injector: Injector, defaultFormComponents?: FormComponentsByType); /** * Creates a form context from a seperated model and form settings. This is useful for advanced * forms, where the model is fetched from a server. * * @param formModel form model * @param formFieldSettings settings for the form model * @param rootSetting settings for the root of the form */ create<M = any>(formModel: FormModel, formFieldSettings: FormFieldSettings, rootSetting?: RootSetting): FormContext<M, FormGroup>; /** * Creates a dynamic form context which can be used to render a form. This is useful for simple forms, where * the model is basically empty. For an advanced usecase with a seperate model and form settings see 'create'. * * @param inlineForm form, where the model and settings are combined * @param rootSetting settings for the root of the form */ createInline(inlineForm: InlineForm, rootSetting?: RootSetting): FormContext<any, FormGroup>; /** * Renders the form at the specified form root recursively. * * @param formRoot root element (directive) to insert the form into * @param formContext form context */ render(formRoot: FormRootDirective, formContext: FormContext<any, FormGroup | FormArray>): void; private createRootSetting; private createParentFieldFactory; }