fix(m2m-array): issue where select component for a m2m array field has only one option (#5544)

This commit is contained in:
YANG QIA 2024-10-29 20:07:42 +08:00 committed by GitHub
parent 4bb9cdd141
commit cf0a62a502
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View File

@ -48,3 +48,5 @@ export * from './nanoid';
export * from './unixTimestamp';
export * from './dateOnly';
export * from './datetimeNoTz';
export { getUniqueKeyFromCollection } from './utils';

View File

@ -8,14 +8,10 @@
*/
import { ISchema } from '@formily/react';
import { Collection, CollectionFieldInterface } from '@nocobase/client';
import { CollectionFieldInterface, getUniqueKeyFromCollection } from '@nocobase/client';
import { tval } from '@nocobase/utils/client';
import { NAMESPACE } from './locale';
function getUniqueKeyFromCollection(collection: Collection) {
return collection?.filterTargetKey?.[0] || collection?.filterTargetKey || collection?.getPrimaryKey() || 'id';
}
export class MBMFieldInterface extends CollectionFieldInterface {
name = 'mbm';
type = 'object';