diff --git a/shared/index.tsx b/shared/index.tsx index ed116c01..10fe7594 100644 --- a/shared/index.tsx +++ b/shared/index.tsx @@ -21,6 +21,10 @@ export type { FastFormFieldMeta, FastFormContainerComponent, } from './components/FastForm/index'; +export { + createFastFormSchema, + fieldSchema, +} from './components/FastForm/schema'; export { buildPortal, DefaultEventEmitter } from './components/Portal'; export { TcProvider } from './components/Provider'; diff --git a/web/src/components/modals/CreateGroup.tsx b/web/src/components/modals/CreateGroup.tsx index 4d5d72d8..0f4e03dc 100644 --- a/web/src/components/modals/CreateGroup.tsx +++ b/web/src/components/modals/CreateGroup.tsx @@ -95,7 +95,7 @@ export const ModalCreateGroup: React.FC = React.memo(() => { }, [name, panels]); return ( - +
diff --git a/web/src/components/modals/CreateGroupPanel.tsx b/web/src/components/modals/CreateGroupPanel.tsx index bd1f4a54..f7fd6943 100644 --- a/web/src/components/modals/CreateGroupPanel.tsx +++ b/web/src/components/modals/CreateGroupPanel.tsx @@ -1,4 +1,4 @@ -import { PluginGroupPanel, pluginGroupPanel } from '@/plugin/common'; +import { pluginGroupPanel } from '@/plugin/common'; import { findPluginPanelInfoByName } from '@/utils/plugin-helper'; import React, { useMemo, useState } from 'react'; import { @@ -7,6 +7,8 @@ import { t, useAsyncRequest, createGroupPanel, + createFastFormSchema, + fieldSchema, } from 'tailchat-shared'; import { ModalWrapper } from '../Modal'; import { WebFastForm } from '../WebFastForm'; @@ -40,6 +42,14 @@ const baseFields: FastFormFieldMeta[] = [ }, ]; +const schema = createFastFormSchema({ + name: fieldSchema + .string() + .required(t('面板名不能为空')) + .max(20, t('面板名过长')), + type: fieldSchema.string().required(t('面板类型不能为空')), +}); + /** * 创建群组面板 */ @@ -95,8 +105,9 @@ export const ModalCreateGroupPanel: React.FC<{ }, [currentValues]); return ( - +