From 64e3705669e7c12b8013704654f17cf8eaf659d4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 25 May 2023 18:08:20 -0300 Subject: cases, account details and new-form screen --- .../exchange-backoffice-ui/src/handlers/forms.ts | 32 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'packages/exchange-backoffice-ui/src/handlers/forms.ts') diff --git a/packages/exchange-backoffice-ui/src/handlers/forms.ts b/packages/exchange-backoffice-ui/src/handlers/forms.ts index 115127cc3..4eb188a09 100644 --- a/packages/exchange-backoffice-ui/src/handlers/forms.ts +++ b/packages/exchange-backoffice-ui/src/handlers/forms.ts @@ -13,8 +13,10 @@ import { Group } from "./Group.js"; import { InputSelectOne } from "./InputSelectOne.js"; import { FormProvider } from "./FormProvider.js"; import { InputLine } from "./InputLine.js"; +import { InputAmount } from "./InputAmount.js"; +import { InputChoiceHorizontal } from "./InputChoiceHorizontal.js"; -export type DoubleColumnForm = DoubleColumnFormSection[]; +export type DoubleColumnForm = Array; type DoubleColumnFormSection = { title: TranslatedString; @@ -35,8 +37,10 @@ type FieldType = { text: Parameters>[0]; textArea: Parameters>[0]; choiceStacked: Parameters>[0]; + choiceHorizontal: Parameters>[0]; date: Parameters>[0]; integer: Parameters>[0]; + amount: Parameters>[0]; }; /** @@ -47,11 +51,13 @@ export type UIFormField = | { type: "caption"; props: FieldType["caption"] } | { type: "array"; props: FieldType["array"] } | { type: "file"; props: FieldType["file"] } + | { type: "amount"; props: FieldType["amount"] } | { type: "selectOne"; props: FieldType["selectOne"] } | { type: "selectMultiple"; props: FieldType["selectMultiple"] } | { type: "text"; props: FieldType["text"] } | { type: "textArea"; props: FieldType["textArea"] } | { type: "choiceStacked"; props: FieldType["choiceStacked"] } + | { type: "choiceHorizontal"; props: FieldType["choiceHorizontal"] } | { type: "integer"; props: FieldType["integer"] } | { type: "date"; props: FieldType["date"] }; @@ -79,11 +85,15 @@ const UIFormConfiguration: UIFormFieldMap = { date: InputDate, //@ts-ignore choiceStacked: InputChoiceStacked, + //@ts-ignore + choiceHorizontal: InputChoiceHorizontal, integer: InputInteger, //@ts-ignore selectOne: InputSelectOne, //@ts-ignore selectMultiple: InputSelectMultiple, + //@ts-ignore + amount: InputAmount, }; export function RenderAllFieldsByUiConfig({ @@ -103,13 +113,23 @@ export function RenderAllFieldsByUiConfig({ ); } -type FormSet = { +type FormSet = { Provider: typeof FormProvider; - InputLine: typeof InputLine; + InputLine: () => typeof InputLine; + InputChoiceHorizontal: () => typeof InputChoiceHorizontal< + T, + K + >; }; -export function createNewForm(): FormSet { - return { +export function createNewForm() { + const res: FormSet = { Provider: FormProvider, - InputLine: InputLine, + InputLine: () => InputLine, + InputChoiceHorizontal: () => InputChoiceHorizontal, + }; + return { + Provider: res.Provider, + InputLine: res.InputLine(), + InputChoiceHorizontal: res.InputChoiceHorizontal(), }; } -- cgit v1.2.3