fix:子表单上下文类型错误

This commit is contained in:
lvxiaojiao 2024-01-25 10:20:53 +08:00
parent 03175e1df5
commit 8dfa6dfe8f

View File

@ -10,7 +10,9 @@ import {
getSchemaTpl,
registerEditorPlugin,
diff,
JSONPipeOut
JSONPipeOut,
EditorNodeType,
jsonToJsonSchema
} from 'amis-editor-core';
export class SubFormControlPlugin extends BasePlugin {
@ -208,6 +210,29 @@ export class SubFormControlPlugin extends BasePlugin {
}
});
}
async buildDataSchemas(
node: EditorNodeType,
region: EditorNodeType,
trigger?: EditorNodeType
) {
// 渲染出来才能取到孩子所以现在subform现在是拿不到的so这里只提供基本类型不展开
let dataSchema: any = {
type: 'object',
title: node.schema?.label || node.schema?.name,
originalValue: node.schema?.value // 记录原始值,循环引用检测需要
};
if (node.schema?.multiple) {
dataSchema = {
type: 'array',
title: node.schema?.label || node.schema?.name,
originalValue: dataSchema.originalValue
};
}
return dataSchema;
}
}
registerEditorPlugin(SubFormControlPlugin);