import { AbstractControl } from '@angular/forms'; import { SchemaValidator } from './schema.validator'; import { WidgetContext } from './widget.context'; import { FormState } from './form.state'; /** * Context abstraction. * * @author Wael Jammal */ export declare abstract class Context { private _formGroup; private _childContexts; private _valid; private _schema; private _type; private _root; private _state; /** * The initial data model. */ model: MT; /** * Widgets belonging to this parent. */ readonly childContexts: Array>; /** * Form group representing the entire schema. */ readonly formGroup: AbstractControl; /** * Schema part. */ readonly schema: any; /** * Widget type. */ readonly type: string; /** * Form state. */ readonly state: FormState; /** * Schema validator. */ readonly validator: SchemaValidator; /** * Root context. */ readonly root: WidgetContext; /** True if widget is valid **/ readonly valid: boolean; protected doInit(state: FormState, root: WidgetContext, schema: any, type: string): void; /** * Registers a new child context. * * @param context Child context */ registerChild(context: WidgetContext): void; /** * Removes all children of this context from both the view and form. */ removeAllChildren(): void; /** * Creates a form group. * * @param controls Controls to add to the group * @param overrideGroup If supplied will be set as the form group for this context, use this to add a nested group to a parent while * maintaining the correct hierarchy. */ createFormGroup(controls: { [key: string]: AbstractControl; }, overrideGroup?: AbstractControl): AbstractControl; /** * Creates a form array. * * @param controls Controls to add to the group */ createFormArray(controls: Array): AbstractControl; /** * Destroy widget. */ doDestroy(): void; /** * Validates the model against the schema and returns errors if any. */ private validate; /** * Widget path. */ abstract readonly path: string; /** * Parent widget. */ abstract readonly parent: Context; /** * Update the model. * * @param model New model */ abstract updateModel(model: any): any; /** * Group id identifies the widget field. */ abstract readonly groupId: string; /** * Initialize the widget. */ abstract initialize(): Promise; /** * Destroy. */ protected abstract destroy(): void; }