From a034f108293d4b0f6980a26922d0d9cd2762f523 Mon Sep 17 00:00:00 2001 From: mikheykinnv Date: Mon, 7 Oct 2024 12:27:12 +0800 Subject: [PATCH] MSP-3423 add types --- .../ConfigurationEditor.type.ts | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/pages/ConfigurationEditorPage/ConfigurationEditor.type.ts diff --git a/src/pages/ConfigurationEditorPage/ConfigurationEditor.type.ts b/src/pages/ConfigurationEditorPage/ConfigurationEditor.type.ts new file mode 100644 index 0000000..215fb81 --- /dev/null +++ b/src/pages/ConfigurationEditorPage/ConfigurationEditor.type.ts @@ -0,0 +1,89 @@ +import {ConfigType, ResponseSchemaType} from '@pages/ModulesPage/module.type.ts' +import {ComponentType, Dispatch, MutableRefObject, ReactNode, SetStateAction} from 'react' + + +export interface ConfigurationEditorPropsType { + jsonSchema?: ResponseSchemaType + bufConfig?: ConfigType + setBufConfig: Dispatch> + isCurrentConfigLoading: boolean + setDisableBtn?: Dispatch> + submitRef?: MutableRefObject +} + +export interface DescriptionPropsType { + description?: string; +} + +export interface Schema { + type: string; + dynamic?: boolean; +} + +export interface FieldTemplatePropsType { + id: string; + classNames?: string; + label?: string; + rawHelp?: string; + required?: boolean; + rawDescription?: string; + rawErrors?: string[]; + children: ReactNode; + displayLabel?: boolean; + schema: Schema; +} + + +export interface ArrayFieldTemplatePropsType { + items: { + index: number; + children: ReactNode; + onDropIndexClick: (index: number) => () => void; + }[]; + onAddClick: (event: MouseEvent) => void + canAdd: boolean; + title: string; + titleField?: ComponentType; + idSchema: { $id: string }; + schema: { description?: string }; +} + + +export interface ObjectFieldTemplatePropertyType { + name: string; + content: ReactNode; +} + +export interface SchemaPropertiesType { + [key: string]: { + type?: string; + title?: string; + }; +} + +export interface ObjectFieldTemplatePropsType { + properties: ObjectFieldTemplatePropertyType[]; + idSchema: { + $id: string; + }; + schema: { + properties: SchemaPropertiesType; + }; + activeTabKey: string; + handleTabsChange: (key: string) => void; +} + +export interface ErrorsObjType { + message: string; + name: string; + params: { + missingProperty?: string; + }; + property: string; + schemaPath: string; + stack: string; +} + +export interface SortPropType { + name: string; +} \ No newline at end of file