diff --git a/apps/web/api/ius/types.ts b/apps/web/api/ius/types.ts index 9eac5aa..f6ca096 100644 --- a/apps/web/api/ius/types.ts +++ b/apps/web/api/ius/types.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ export type MetaObject = { disabled: boolean; - fieldType: 'CHECKBOX' | 'DECIMAL' | 'INT' | 'STRING' | 'TEXTAREA'; + fieldType: 'CHECKBOX' | 'DECIMAL' | 'INT' | 'STRING' | 'BIGSTRING'; label: string; max: number; min: number; diff --git a/apps/web/components/Form/Common/Elements.tsx b/apps/web/components/Form/Common/Elements.tsx index 94f79f0..cc4630a 100644 --- a/apps/web/components/Form/Common/Elements.tsx +++ b/apps/web/components/Form/Common/Elements.tsx @@ -3,7 +3,7 @@ import type { MetaObject } from '@/api/ius/types'; import { mapFieldTypeElement } from '@/config/elements'; import { useFormStore } from '@/store/ius/form'; import { ElementContainer } from '@repo/ui'; -import { get, omit } from 'radash'; +import { get } from 'radash'; import { useEffect } from 'react'; function RenderElement({ @@ -56,14 +56,24 @@ export function Elements({ data, metaData }: FormComponentProps) { init(data); }, [data, init]); + const defaultElements = Object.keys(metaData).filter( + (x) => metaData[x]?.fieldType !== 'BIGSTRING' + ); + + const bigStringElements = Object.keys(metaData).filter( + (x) => metaData[x]?.fieldType === 'BIGSTRING' + ); + return ( <>
- {(Object.keys(omit(metaData, ['comment'])) as Array).map((name) => ( + {defaultElements.map((name) => ( ))}
- + {bigStringElements.map((name) => ( + + ))} ); } diff --git a/apps/web/config/elements.ts b/apps/web/config/elements.ts index e9285a2..a781d53 100644 --- a/apps/web/config/elements.ts +++ b/apps/web/config/elements.ts @@ -6,9 +6,9 @@ function wrapMap>(arg: T) { } export const mapFieldTypeElement = wrapMap({ + BIGSTRING: Textarea, CHECKBOX: Checkbox, DECIMAL: InputNumber, INT: InputNumber, STRING: Input, - TEXTAREA: Textarea, });