mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 10:06:22 +00:00
refactor: useFormItemInitializerFields (#3621)
This commit is contained in:
parent
96832e6113
commit
951aece70c
@ -287,6 +287,7 @@ export const useFormItemInitializerFields = (options?: any) => {
|
||||
const targetCollection = getCollection(field.target);
|
||||
const isFileCollection = field?.target && getCollection(field?.target)?.template === 'file';
|
||||
const isAssociationField = targetCollection;
|
||||
const fieldNames = field?.uiSchema['x-component-props']?.['fieldNames'];
|
||||
const schema = {
|
||||
type: 'string',
|
||||
name: field.name,
|
||||
@ -302,9 +303,9 @@ export const useFormItemInitializerFields = (options?: any) => {
|
||||
value: 'id',
|
||||
},
|
||||
}
|
||||
: isAssociationField
|
||||
: isAssociationField && fieldNames
|
||||
? {
|
||||
fieldNames: field?.uiSchema['x-component-props']['fieldNames'],
|
||||
fieldNames: { ...fieldNames, label: targetCollection?.titleField || fieldNames.label },
|
||||
}
|
||||
: {},
|
||||
'x-read-pretty': field?.uiSchema?.['x-read-pretty'],
|
||||
|
Loading…
Reference in New Issue
Block a user