From a712841d167dd98bf1254d1686b97aa27b9ddbc8 Mon Sep 17 00:00:00 2001 From: Samuel Rowe Date: Sat, 20 Aug 2022 12:26:16 +0530 Subject: [PATCH] feat: created interfaces for form fields --- services/frontend/src/types/index.ts | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/services/frontend/src/types/index.ts b/services/frontend/src/types/index.ts index d143a63..1db610b 100644 --- a/services/frontend/src/types/index.ts +++ b/services/frontend/src/types/index.ts @@ -527,3 +527,51 @@ export interface ITabContext { export interface ISuperFormContext { types: Record; } + +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; +}