From e7b680aeb1940680d58b701879bb95be1072da2f Mon Sep 17 00:00:00 2001 From: txix Date: Sat, 28 Dec 2024 11:32:46 +0300 Subject: [PATCH] 2024-12-28 11:32:46: merge [main:49411ff93c78a55478e3432737bab9a499b0066d]; --- CHANGELOG.md | 2 + package.json | 2 +- .../ConfigurationEditorForm/index.tsx | 227 ++++++++---------- .../ConfigurationEditor.type.ts | 13 +- .../configuration-editor-page.scss | 75 +++++- 5 files changed, 190 insertions(+), 129 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ac5a3f..340e11e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 0.18.9 +- Исправлены дополнительные параметры подключения в форме ## 0.18.8 - Добавлено кеширование статики для nginx ## 0.18.7 diff --git a/package.json b/package.json index fe53799..a2b47c4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "isp-admin-ui", "private": true, - "version": "0.18.8", + "version": "0.18.9", "type": "module", "scripts": { "start": "vite", diff --git a/src/components/ConfigurationEditorForm/index.tsx b/src/components/ConfigurationEditorForm/index.tsx index a2cf4dc..2b9bef1 100644 --- a/src/components/ConfigurationEditorForm/index.tsx +++ b/src/components/ConfigurationEditorForm/index.tsx @@ -8,7 +8,6 @@ import { Button, Tabs, Tooltip, - Form as FormAntd, Collapse, Typography, Space @@ -22,9 +21,9 @@ import { ConfigurationEditorPropsType, DescriptionPropsType, ErrorsObjType, - FieldTemplatePropsType, ObjectFieldTemplatePropertyType, ObjectFieldTemplatePropsType, + RemoveButtonProps, SortPropType } from '@pages/ConfigurationEditorPage/ConfigurationEditor.type.ts' import { ResponseSchemaType } from '@pages/ModulesPage/module.type.ts' @@ -103,98 +102,12 @@ const ConfigurationEditorForm: FC = ({ return id.split('_').length } - const getName = (id: string) => { - if (!id) { - return '' - } - const arr = id.split('_') - return `#${arr[arr.length - 1] || ''}` - } - - const FieldTemplate: FC = (props) => { - const { - id, - classNames, - label, - rawHelp, - required, - rawDescription, - rawErrors, - children, - displayLabel, - schema - } = props - - const isObject = schema.type === 'object' - const depth = getDepth(id) - const name = label || getName(id) - - // Проверяем на наличие ошибок и формируем их вывод - const errorMessages = rawErrors ? rawErrors.join('\n') : null - - // Объекты и массивы - Обработка по глубине - if (isObject && depth !== 1) { - const title = ( -
- {depth !== 2 && {name}} - {errorMessages && ( - {` (${errorMessages})`} - )} - {depth !== 2 && } -
- ) - - if (depth === 2 || schema.dynamic) { - return ( -
- {!schema.dynamic && title} - {children} -
- ) - } - - return ( - 1 ? '' : id}> - - {children} - - - ) - } - - // Для остальных типов возвращаем форму с элементами - return ( - - {name} - - - ) : null - } - > - {children} - - ) - } - const ArrayFieldTemplate: FC = ({ items, onAddClick, canAdd, title, - idSchema, - schema: { description } + idSchema }) => { return ( @@ -207,9 +120,11 @@ const ConfigurationEditorForm: FC = ({ style={{ justifyContent: 'space-between', width: '100%' }} > + {title} + - + {canAdd && (