Merge branch 'main' into next

This commit is contained in:
GitHub Actions Bot 2024-08-01 03:46:48 +00:00
commit a0e42a027f
3 changed files with 12 additions and 3 deletions

View File

@ -58,6 +58,14 @@ const getSchema = (schema: IField, record: any, compile, getContainer): ISchema
title: '{{ t("Edit collection") }}', title: '{{ t("Edit collection") }}',
properties: { properties: {
...properties, ...properties,
filterTargetKey: {
title: `{{ t("Record unique key")}}`,
type: 'single',
description: `{{t( "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.")}}`,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-reactions': ['{{useAsyncDataSource(loadFilterTargetKeys)}}'],
},
footer: { footer: {
type: 'void', type: 'void',
'x-component': 'Action.Drawer.Footer', 'x-component': 'Action.Drawer.Footer',

View File

@ -78,7 +78,6 @@ const getSchema = (schema: IField, record: any, compile, getContainer): ISchema
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-component': 'Select', 'x-component': 'Select',
enum: '{{filterTargetKeyOptions}}', enum: '{{filterTargetKeyOptions}}',
'x-visible': '{{!!isView}}',
}, },
footer: { footer: {
type: 'void', type: 'void',

View File

@ -29,6 +29,7 @@ import {
FieldSummary, FieldSummary,
TemplateSummary, TemplateSummary,
useRequest, useRequest,
useCollectionRecordData,
} from '@nocobase/client'; } from '@nocobase/client';
import { CollectionFields } from './CollectionFields'; import { CollectionFields } from './CollectionFields';
import { collectionSchema } from './schemas/collections'; import { collectionSchema } from './schemas/collections';
@ -101,7 +102,7 @@ const useNewId = (prefix) => {
export const ConfigurationTable = () => { export const ConfigurationTable = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const { interfaces, getCollections } = useCollectionManager_deprecated(); const { interfaces, getCollections, getCollection } = useCollectionManager_deprecated();
const { const {
data: { database }, data: { database },
} = useCurrentAppInfo(); } = useCurrentAppInfo();
@ -163,7 +164,8 @@ export const ConfigurationTable = () => {
}; };
const loadFilterTargetKeys = async (field) => { const loadFilterTargetKeys = async (field) => {
const { fields } = field.form.values; const { name } = field.form.values;
const { fields } = getCollection(name);
return Promise.resolve({ return Promise.resolve({
data: fields, data: fields,
}).then(({ data }) => { }).then(({ data }) => {