fix: 完善属性配置面板异常渲染屏蔽逻辑

Change-Id: I7641a9b4b800b4abecb27718504475b1712a5287
This commit is contained in:
wibetter 2022-06-20 20:18:56 +08:00
parent c531b77977
commit 197545b5cf
5 changed files with 9 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "amis-editor-core", "name": "amis-editor-core",
"version": "5.2.0-beta.5", "version": "5.2.0-beta.6",
"description": "amis 可视化编辑器", "description": "amis 可视化编辑器",
"main": "lib/index.min.js", "main": "lib/index.min.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",

View File

@ -308,7 +308,7 @@ export function makeSchemaFormRender(
api?: any; api?: any;
submitOnChange?: boolean; submitOnChange?: boolean;
justify?: boolean; justify?: boolean;
rendererName?: string; panelById?: string;
formKey?: string; formKey?: string;
}, },
) { ) {
@ -317,13 +317,10 @@ export function makeSchemaFormRender(
return ({value, onChange, popOverContainer, id, store, node}: PanelProps) => { return ({value, onChange, popOverContainer, id, store, node}: PanelProps) => {
const ctx = {...manager.store.ctx}; const ctx = {...manager.store.ctx};
if (schema?.rendererName && schema?.rendererName !== node?.type) { if (schema?.panelById && schema?.panelById !== node?.id) {
// 用于过滤掉异常的渲染 // 用于过滤掉异常的渲染
if (node?.type !== 'cell') {
// 识别表格列
return <></>; return <></>;
} }
}
if (id) { if (id) {
Object.defineProperty(ctx, '__props__', { Object.defineProperty(ctx, '__props__', {

View File

@ -1553,7 +1553,7 @@ export class EditorManager {
api?: any; api?: any;
submitOnChange?: boolean; submitOnChange?: boolean;
justify?: boolean; justify?: boolean;
rendererName?: string; panelById?: string;
formKey?: string; formKey?: string;
}) { }) {
return makeSchemaFormRender(this, schema); return makeSchemaFormRender(this, schema);

View File

@ -964,7 +964,7 @@ export abstract class BasePlugin implements PluginInterface {
? plugin.panelControlsCreator(context) ? plugin.panelControlsCreator(context)
: plugin.panelControls!, : plugin.panelControls!,
justify: plugin.panelJustify, justify: plugin.panelJustify,
rendererName: plugin.rendererName panelById: store.activeId
}) })
}); });
} else if ( } else if (
@ -990,7 +990,7 @@ export abstract class BasePlugin implements PluginInterface {
? plugin.vRendererConfig.panelBodyCreator(context) ? plugin.vRendererConfig.panelBodyCreator(context)
: plugin.vRendererConfig.panelBody!, : plugin.vRendererConfig.panelBody!,
justify: plugin.vRendererConfig.panelJustify, justify: plugin.vRendererConfig.panelJustify,
rendererName: plugin.rendererName panelById: store.activeId
}) })
}); });
} }

View File

@ -530,7 +530,7 @@ export class BasicToolbarPlugin extends BasePlugin {
if (!context.selections.length) { if (!context.selections.length) {
return; return;
} }
const plugin: PluginInterface = this; const store = this.manager.store;
let menus: Array<ContextMenuItem> = []; let menus: Array<ContextMenuItem> = [];
const contextMenuContext: ContextMenuEventContext = { const contextMenuContext: ContextMenuEventContext = {
@ -561,7 +561,7 @@ export class BasicToolbarPlugin extends BasePlugin {
})) }))
} }
], ],
rendererName: plugin.rendererName panelById: store.activeId
}) })
}); });
} }