Skip to content

Commit

Permalink
fix:子表单上下文类型错误
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Jan 25, 2024
1 parent 03175e1 commit 8dfa6df
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion packages/amis-editor/src/plugin/Form/InputSubForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import {
getSchemaTpl,
registerEditorPlugin,
diff,
JSONPipeOut
JSONPipeOut,
EditorNodeType,
jsonToJsonSchema
} from 'amis-editor-core';

export class SubFormControlPlugin extends BasePlugin {
Expand Down Expand Up @@ -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);

0 comments on commit 8dfa6df

Please sign in to comment.