feat: created interfaces for form fields

pull/111/head
Samuel Rowe 3 years ago
parent 3da43edd81
commit a712841d16

@ -527,3 +527,51 @@ export interface ITabContext {
export interface ISuperFormContext { export interface ISuperFormContext {
types: Record<string, FunctionComponent>; types: Record<string, FunctionComponent>;
} }
export interface IFormField {
id: string;
type: "group" | "text" | "integer" | "toggle" | "accordion" | "records";
}
export interface IGroupField {
fields: IFormField[];
}
export interface IValueField extends IFormField {
name: string;
}
export interface ISingleRowField extends IValueField {
help?: string;
}
export interface ITextField extends ISingleRowField {
type: "text";
label: string;
required: boolean;
}
export interface IIntegerField extends ISingleRowField {
type: "integer";
label: string;
required: boolean;
}
export interface IToggleField extends ISingleRowField {
type: "toggle";
label: string;
options: {
text: string;
value: string;
}[];
}
export interface IRecordsField extends IValueField {
defaultOpen?: boolean;
fields: (index: number) => IFormField[];
newValue: any;
}
export interface IAccordionField extends IFormField {
title: string;
}

Loading…
Cancel
Save