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 targetCollection = getCollection(field.target);
|
||||||
const isFileCollection = field?.target && getCollection(field?.target)?.template === 'file';
|
const isFileCollection = field?.target && getCollection(field?.target)?.template === 'file';
|
||||||
const isAssociationField = targetCollection;
|
const isAssociationField = targetCollection;
|
||||||
|
const fieldNames = field?.uiSchema['x-component-props']?.['fieldNames'];
|
||||||
const schema = {
|
const schema = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
name: field.name,
|
name: field.name,
|
||||||
@ -302,9 +303,9 @@ export const useFormItemInitializerFields = (options?: any) => {
|
|||||||
value: 'id',
|
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'],
|
'x-read-pretty': field?.uiSchema?.['x-read-pretty'],
|
||||||
|
Loading…
Reference in New Issue
Block a user