refactor: view collection support filterTargetKey config (#3767)
* refactor: view collection support filterTargetkey config * refactor: locale improve * refactor: locale improve
This commit is contained in:
parent
b879d11235
commit
00dc004601
@ -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,
|
||||
}}
|
||||
/>
|
||||
|
@ -29,5 +29,6 @@
|
||||
"Loaded": "已加载",
|
||||
"Reloading": "加载中",
|
||||
"Data source synchronization in progress": "数据源同步中",
|
||||
"Data source synchronization successful": "数据源同步成功"
|
||||
"Data source synchronization successful": "数据源同步成功",
|
||||
"Filter target key":"筛选目标键"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user