mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
refactor: 支持 slot 转换后 params 参数保留
This commit is contained in:
parent
b3b76d9ba0
commit
39ba2bf6ef
@ -18,6 +18,7 @@ export function compatibleReducer(props: any) {
|
||||
slotTitle: props.title,
|
||||
slotName: props.name,
|
||||
},
|
||||
__params__: props.params,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ export function compatibleLegaoSchema(props: any): any {
|
||||
title: (props.value.props as any)?.slotTitle,
|
||||
name: (props.value.props as any)?.slotName,
|
||||
value: props.value.children,
|
||||
params: (props.value.props as any)?.__params__,
|
||||
};
|
||||
} else {
|
||||
return props.value;
|
||||
@ -44,11 +45,11 @@ export function compatibleLegaoSchema(props: any): any {
|
||||
if (/^__slot__/.test(key) && props[key] === true) {
|
||||
return;
|
||||
}
|
||||
// TODO: 目前 dataSource 面板里既用到了 JSExpression,又用到了 variable,这里先都不处理,后面再重构
|
||||
if (key === 'dataSource') {
|
||||
newProps[key] = props[key];
|
||||
return;
|
||||
}
|
||||
// TODO: 先移除,目前没有业务使用
|
||||
// if (key === 'dataSource') {
|
||||
// newProps[key] = props[key];
|
||||
// return;
|
||||
// }
|
||||
newProps[key] = compatibleLegaoSchema(props[key]);
|
||||
});
|
||||
return newProps;
|
||||
|
||||
@ -24,6 +24,7 @@ export function compatibleReducer(props: any, node: Node): any {
|
||||
slotName: props.name,
|
||||
},
|
||||
},
|
||||
__params__: props.params,
|
||||
};
|
||||
}
|
||||
if (isJSExpression(props) && !props.events) {
|
||||
@ -35,11 +36,11 @@ export function compatibleReducer(props: any, node: Node): any {
|
||||
}
|
||||
const newProps: any = {};
|
||||
Object.entries<any>(props).forEach(([key, val]) => {
|
||||
// TODO: 目前 dataSource 面板里既用到了 JSExpression,又用到了 variable,这里先都不处理,后面再重构
|
||||
if (key === 'dataSource') {
|
||||
newProps[key] = props[key];
|
||||
return;
|
||||
}
|
||||
// // TODO: 目前 dataSource 面板里既用到了 JSExpression,又用到了 variable,这里先都不处理,后面再重构
|
||||
// if (key === 'dataSource') {
|
||||
// newProps[key] = props[key];
|
||||
// return;
|
||||
// }
|
||||
newProps[key] = compatibleReducer(val, node);
|
||||
});
|
||||
return newProps;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user