fix: select field incorrect rendering in association field block (#2876)
* fix: select field incorrect rendering in assoction field block * fix: select field incorrect rendering in assoction field block
This commit is contained in:
parent
e05a30380a
commit
0be4e6d94d
@ -406,6 +406,7 @@ export const useAssociatedFormItemInitializerFields = (options?: any) => {
|
|||||||
?.map((subField) => {
|
?.map((subField) => {
|
||||||
const interfaceConfig = getInterface(subField.interface);
|
const interfaceConfig = getInterface(subField.interface);
|
||||||
const isFileCollection = field?.target && getCollection(field?.target)?.template === 'file';
|
const isFileCollection = field?.target && getCollection(field?.target)?.template === 'file';
|
||||||
|
const isAssociationField = ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'].includes(subField?.type);
|
||||||
const schema = {
|
const schema = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
name: `${field.name}.${subField.name}`,
|
name: `${field.name}.${subField.name}`,
|
||||||
@ -415,10 +416,12 @@ export const useAssociatedFormItemInitializerFields = (options?: any) => {
|
|||||||
'x-read-pretty': readPretty,
|
'x-read-pretty': readPretty,
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
'pattern-disable': block === 'Form' && readPretty,
|
'pattern-disable': block === 'Form' && readPretty,
|
||||||
fieldNames: {
|
fieldNames: isAssociationField
|
||||||
|
? {
|
||||||
label: isFileCollection ? 'preview' : 'id',
|
label: isFileCollection ? 'preview' : 'id',
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
}
|
||||||
|
: undefined,
|
||||||
},
|
},
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
'x-collection-field': `${name}.${field.name}.${subField.name}`,
|
'x-collection-field': `${name}.${field.name}.${subField.name}`,
|
||||||
|
Loading…
Reference in New Issue
Block a user