mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:19:01 +08:00
controls 可能是对象的问题处理 (#2221)
This commit is contained in:
parent
7e55499d39
commit
a46b37588d
@ -444,16 +444,19 @@ addSchemaFilter(function (schema: Schema, renderer: any, props: any) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(schema?.controls) && schema.type !== 'audio') {
|
if (schema?.controls && schema.type !== 'audio') {
|
||||||
schema = {
|
schema = {
|
||||||
...schema,
|
...schema,
|
||||||
[schema.type === 'combo' ? `items` : 'body']: schema?.controls.map(
|
[schema.type === 'combo' ? `items` : 'body']: (Array.isArray(
|
||||||
controlToNormalRenderer
|
schema.controls
|
||||||
)
|
)
|
||||||
|
? schema.controls
|
||||||
|
: [schema.controls]
|
||||||
|
).map(controlToNormalRenderer)
|
||||||
};
|
};
|
||||||
delete schema.controls;
|
delete schema.controls;
|
||||||
} else if (
|
} else if (
|
||||||
Array.isArray(schema?.quickEdit?.controls) &&
|
schema?.quickEdit?.controls &&
|
||||||
(!schema.quickEdit.type ||
|
(!schema.quickEdit.type ||
|
||||||
!~['combo', 'group', 'panel', 'fieldSet', 'fieldset'].indexOf(
|
!~['combo', 'group', 'panel', 'fieldSet', 'fieldset'].indexOf(
|
||||||
schema.quickEdit.type
|
schema.quickEdit.type
|
||||||
@ -463,7 +466,10 @@ addSchemaFilter(function (schema: Schema, renderer: any, props: any) {
|
|||||||
...schema,
|
...schema,
|
||||||
quickEdit: {
|
quickEdit: {
|
||||||
...schema.quickEdit,
|
...schema.quickEdit,
|
||||||
body: schema.quickEdit.controls.map(controlToNormalRenderer)
|
body: (Array.isArray(schema.quickEdit.controls)
|
||||||
|
? schema.quickEdit.controls
|
||||||
|
: [schema.quickEdit.controls]
|
||||||
|
).map(controlToNormalRenderer)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
delete schema.quickEdit.controls;
|
delete schema.quickEdit.controls;
|
||||||
@ -535,13 +541,13 @@ addSchemaFilter(function (schema: Schema, renderer: any, props: any) {
|
|||||||
return column;
|
return column;
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
} else if (
|
} else if (schema?.type === 'service' && schema?.body?.controls) {
|
||||||
schema?.type === 'service' &&
|
|
||||||
Array.isArray(schema?.body?.controls)
|
|
||||||
) {
|
|
||||||
schema = {
|
schema = {
|
||||||
...schema,
|
...schema,
|
||||||
body: schema.body.controls.map(controlToNormalRenderer)
|
body: (Array.isArray(schema.body.controls)
|
||||||
|
? schema.body.controls
|
||||||
|
: [schema.body.controls]
|
||||||
|
).map(controlToNormalRenderer)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user