Merge branch 'main' into ci/test

This commit is contained in:
chenos 2024-03-23 12:22:03 +08:00
commit 0c44d79939
2 changed files with 19 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import {
useResourceContext,
useCancelAction,
} from '@nocobase/client';
import { NAMESPACE } from '../../locale';
const getSchema = (schema: IField, record: any, compile, getContainer): ISchema => {
if (!schema) {
@ -56,6 +57,14 @@ const getSchema = (schema: IField, record: any, compile, getContainer): ISchema
title: '{{ t("Edit collection") }}',
properties: {
...omit(properties, 'category', 'inherits', 'moreOptions'),
filterTargetKey: {
title: `{{ t("Filter target key",{ ns: "${NAMESPACE}" }) }}`,
type: 'single',
'x-decorator': 'FormItem',
'x-component': 'Select',
enum: '{{filterTargetKeyOptions}}',
'x-visible': '{{isView}}',
},
footer: {
type: 'void',
'x-component': 'Action.Drawer.Footer',
@ -147,6 +156,12 @@ const EditCollectionAction = (props) => {
const { t } = useTranslation();
const compile = useCompile();
const filterTargetKeyOptions = record.fields?.map((item: any) => {
return {
label: item.uiSchema?.title ? compile(item.uiSchema.title) : item.name,
value: item.name,
};
});
return (
<RecordProvider record={record}>
<ActionContextProvider value={{ visible, setVisible }}>
@ -177,6 +192,8 @@ const EditCollectionAction = (props) => {
useUpdateCollectionActionAndRefreshCM,
useCancelAction,
createOnly: false,
filterTargetKeyOptions,
isView: record.view,
...scope,
}}
/>

View File

@ -29,5 +29,6 @@
"Loaded": "已加载",
"Reloading": "加载中",
"Data source synchronization in progress": "数据源同步中",
"Data source synchronization successful": "数据源同步成功"
"Data source synchronization successful": "数据源同步成功",
"Filter target key":"筛选目标键"
}