fix(charts): improve chart table preview with object type (#1555)

This commit is contained in:
Frozen FIsh 2023-03-10 16:41:31 +08:00 committed by GitHub
parent ea4d4ac062
commit 1c2711920a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,6 @@ export default ({ queryId, fields }: { queryId: number; fields }) => {
type: 'array', type: 'array',
'x-component': 'TableV2', 'x-component': 'TableV2',
'x-component-props': { 'x-component-props': {
rowKey: 'id',
scroll: { y: 300 }, scroll: { y: 300 },
}, },
default: dataSet, default: dataSet,
@ -63,6 +62,14 @@ export default ({ queryId, fields }: { queryId: number; fields }) => {
<Spin /> <Spin />
</> </>
); );
//对dataset中引用类型数据类型进行序列化处理
dataSet.forEach((item) => {
for (const key in item) {
if (item[key] && item[key] instanceof Object) {
item[key] = JSON.stringify(item[key]);
}
}
});
return ( return (
<SchemaComponentProvider scope={{ dataSet }} components={{ TableV2, Input, FormItem }}> <SchemaComponentProvider scope={{ dataSet }} components={{ TableV2, Input, FormItem }}>
<BlockSchemaComponentProvider> <BlockSchemaComponentProvider>