diff --git a/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx b/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx index 0e238b19f..4ed0b29e4 100644 --- a/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx +++ b/packages/core/client/src/collection-manager/Configuration/AddCollectionAction.tsx @@ -14,6 +14,7 @@ import { useCancelAction } from '../action-hooks'; import { useCollectionManager } from '../hooks'; import * as components from './components'; import { templateOptions } from './templates'; +import { TemplateSummay } from './components/TemplateSummay'; const getSchema = (schema, category, compile): ISchema => { if (!schema) { @@ -62,7 +63,7 @@ const getSchema = (schema, category, compile): ISchema => { properties: { summary: { type: 'void', - 'x-component': 'FieldSummary', + 'x-component': 'TemplateSummay', 'x-component-props': { schemaKey: schema.name, }, @@ -283,7 +284,7 @@ export const AddCollectionAction = (props) => { { AddSubFieldAction, EditSubFieldAction, FieldSummary, + TemplateSummay, CollectionFieldsTable, }} scope={{ diff --git a/packages/core/client/src/collection-manager/Configuration/components/TemplateSummay.tsx b/packages/core/client/src/collection-manager/Configuration/components/TemplateSummay.tsx new file mode 100644 index 000000000..46b9c998b --- /dev/null +++ b/packages/core/client/src/collection-manager/Configuration/components/TemplateSummay.tsx @@ -0,0 +1,39 @@ +import { css } from '@emotion/css'; +import { observer } from '@formily/react'; +import { Tag } from 'antd'; +import React from 'react'; +import { useTranslation } from 'react-i18next'; +import { useCompile } from '../../../schema-component'; +import { useCollectionManager } from '../../hooks'; + +export const TemplateSummay = observer((props: any) => { + const { schemaKey } = props; + const { getTemplate } = useCollectionManager(); + const compile = useCompile(); + const { t } = useTranslation(); + const schema = getTemplate(schemaKey); + + if (!schema) return null; + + return ( +
+
{t('Collection template')}: {compile(schema.title)}
+ {schema.description ? ( +
+ {compile(schema.description)} +
+ ) : null} +
+ ); +}); diff --git a/packages/core/client/src/collection-manager/templates/types.ts b/packages/core/client/src/collection-manager/templates/types.ts index 3d7753cc4..a34bab121 100644 --- a/packages/core/client/src/collection-manager/templates/types.ts +++ b/packages/core/client/src/collection-manager/templates/types.ts @@ -16,6 +16,8 @@ export interface ICollectionTemplate { availableFieldInterfaces?: AvailableFieldInterfacesInclude | AvailableFieldInterfacesExclude; /** 是否分割线 */ divider?: boolean; + /** 模板描述 */ + description?: string; } interface AvailableFieldInterfacesInclude { diff --git a/packages/core/client/src/locale/en_US.ts b/packages/core/client/src/locale/en_US.ts index a1cbb36f6..3fb6d7889 100644 --- a/packages/core/client/src/locale/en_US.ts +++ b/packages/core/client/src/locale/en_US.ts @@ -62,6 +62,7 @@ export default { "Delete category":"Delete category", "Edit category":"Edit category", "Collection category":"Collection category", + "Collection template":"Collection template", "Sort":"Sort", "Categories":"Categories", "Visible":"Visible", @@ -179,7 +180,6 @@ export default { "Store the last update time of each record": "Store the last update time of each record", "More options": "More options", "Records can be sorted": "Records can be sorted", - "Collection template": "Collection template", "Calendar collection": "Calendar collection", "General collection": "General collection", "Connect to database view":"Connect to database view", diff --git a/packages/core/client/src/locale/zh_CN.ts b/packages/core/client/src/locale/zh_CN.ts index 7b23cef82..3df62a086 100644 --- a/packages/core/client/src/locale/zh_CN.ts +++ b/packages/core/client/src/locale/zh_CN.ts @@ -62,6 +62,7 @@ export default { "Delete category":"删除分类", "Edit category":"编辑分类", "Collection category":"数据表类别", + "Collection template":"数据表模板", "Visible":"显示", "Read only":"只读(禁止编辑)", "Easy reading":"只读(阅读模式)", @@ -188,7 +189,6 @@ export default { "Store the last update time of each record": "记录最后更新时间", "More options": "更多选项", "Records can be sorted": "可以对行记录进行排序", - "Collection template": "数据表模板", "Calendar collection": "日历数据表", "General collection": "普通数据表", "Connect to database view":"连接数据库视图",