angular-dynamic-forms-lite
Version:
Efficient dynamic and customizable Angular 7+ forms.
32 lines (31 loc) • 1.3 kB
TypeScript
import { Type } from "@angular/core";
import { FormFieldComponentType } from "../form-field/form-field-component";
import { FormFieldGroupComponent } from "../form-field/group/form-field-group-component";
import { DynamicFormType } from "../form-field/form-field-type";
import { ValidatorFn, AsyncValidatorFn } from "@angular/forms";
import { SubType } from "./sub-type";
export interface BaseSetting<M = {}> {
name: string;
metadata?: M;
validators?: ValidatorFn[];
asyncValidators?: AsyncValidatorFn[];
}
export declare type FormFieldSettingType<T = DynamicFormType> = T | SubType;
export interface FormFieldSetting<M = {}> extends BaseSetting<M> {
/**
* The component to be rendered. If you use default form components, this field is optional.
*/
component?: FormFieldComponentType;
/**
* The type of the form field. This will also resolve the default form component, if no
* component is specified.
*
* The second array element describes the sub type of the form field. It is used to differentiate
* components in GROUP, ARRAY or SINGLE. To override the default use the "DEFAULT" key.
*/
type?: FormFieldSettingType;
}
export interface RootSetting<M = {}> {
component: Type<FormFieldGroupComponent>;
metadata: M;
}