import { Subject } from "rxjs"; import { OnDestroy } from "@angular/core"; import { FormGroup, AbstractControl } from "@angular/forms"; import { Field } from "./field.model"; import * as i0 from "@angular/core"; /** * Provides API to work with Form validation based on provided Fields */ export declare class Form { private _fields; private _editors; readonly destroy$: Subject; /** * Provides all registered fields for this form */ get fields(): Field[]; /** * Angular's Form group */ formGroup: FormGroup; /** * Indicates if Form is invalid */ get invalid(): boolean; /** * Indicates if Form is valid */ get valid(): boolean; constructor(...fields: Field[]); /** * Creates Form from a {@link BaseEditor} model, based on Field properties of a model. * Assigns Field name based on property name of a model. * Enables each discovered Field property unless is explicitly disabled. * * @param model {@link BaseEditor} model * @returns Form */ static Create(model: TModel, ...fieldsToIgnore: string[]): Form; /** * Adds Field to a Form * * @param field Field */ addField(field: Field): void; /** * Removes Field from a Form * * @param field Field */ removeField(field: Field, options?: { emitEvent?: boolean; }): void; /** * Marks Form and all descendants as Untouched */ markAsUntouched(): void; /** * Marks Form and all descendants as Touched */ markAsTouched(): void; /** * Shows validation errors for all descendants */ validate(): void; /** * Shows validation errors for all descendants */ validateAsync(): Promise; /** * Iterates through descendants */ applyAction(action: (control: AbstractControl) => void): void; /** * Iterates through descendants */ getDescendants(): AbstractControl[]; /** * Destroys each field in a form */ destroy(): void; /** * Iterates through descendants */ private getDescendantsInternal; } /** * Base editor model that dedicated page editors should derive from. Used by {@link Form} */ export declare abstract class BaseEditor implements OnDestroy { get destroy$(): Subject; form: Form; ngOnDestroy(): void; protected initialize(...fieldsToIgnore: string[]): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }