fix: association field detection to be based on type (#6506)

This commit is contained in:
Katherine 2025-03-19 21:01:24 +08:00 committed by GitHub
parent ee728bd9bf
commit 186463abb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -985,12 +985,11 @@ function useFormItemCollectionField() {
export function useIsAssociationField() { export function useIsAssociationField() {
const collectionField = useFormItemCollectionField(); const collectionField = useFormItemCollectionField();
const isAssociationField = ['obo', 'oho', 'o2o', 'o2m', 'm2m', 'm2o', 'updatedBy', 'createdBy', 'mbm'].includes( const isAssociationField =
collectionField?.interface, collectionField &&
); ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany', 'belongsToArray'].includes(collectionField.type);
return isAssociationField; return isAssociationField;
} }
export function useIsFileField() { export function useIsFileField() {
const cm = useCollectionManager(); const cm = useCollectionManager();
const collectionField = useFormItemCollectionField(); const collectionField = useFormItemCollectionField();