mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch 'fix/rax-miniapp-0922' into 'release/0.9.22'
fix: save 的时候删除空的 props See merge request !989562
This commit is contained in:
commit
b4a5f7c35c
@ -311,26 +311,30 @@ designer.addPropsReducer(stylePropsReducer, TransformStage.Render);
|
||||
// 国际化 & Expression 渲染时处理
|
||||
designer.addPropsReducer(deepValueParser, TransformStage.Render);
|
||||
|
||||
designer.addPropsReducer((props: any, node: Node) => {
|
||||
if (node.isRoot()) {
|
||||
if (props.dataSource) {
|
||||
const online = cloneDeep(props.dataSource.online);
|
||||
online.forEach((item: any) => {
|
||||
const newParam: any = {};
|
||||
if (item.options && item.options.params && item.options.params.length) {
|
||||
item.options.params.map((element: any) => {
|
||||
if (element.name && element.value) {
|
||||
newParam[element.name] = element.value;
|
||||
}
|
||||
});
|
||||
item.options.params = newParam;
|
||||
}
|
||||
});
|
||||
props.dataSource.list = online;
|
||||
}
|
||||
// 清除空的 props value
|
||||
function removeEmptyProps(props: any, node: Node) {
|
||||
if (node.isRoot() && props.dataSource) {
|
||||
const online = cloneDeep(props.dataSource.online);
|
||||
online.forEach((item: any) => {
|
||||
const newParam: any = {};
|
||||
if (Array.isArray(item?.options?.params)) {
|
||||
item.options.params.forEach((element: any) => {
|
||||
if (element.name) {
|
||||
newParam[element.name] = element.value;
|
||||
}
|
||||
});
|
||||
item.options.params = newParam;
|
||||
}
|
||||
});
|
||||
props.dataSource.list = online;
|
||||
}
|
||||
return props;
|
||||
}, TransformStage.Render);
|
||||
}
|
||||
|
||||
// Init 的时候没有拿到 dataSource, 只能在 Render 和 Save 的时候都调用一次,理论上执行时机在 Init
|
||||
// Render 和 Save 都要各调用一次,感觉也是有问题的,是不是应该在 Render 执行一次就行了?见上 filterReducer 也是一样的处理方式。
|
||||
designer.addPropsReducer(removeEmptyProps, TransformStage.Render);
|
||||
designer.addPropsReducer(removeEmptyProps, TransformStage.Save);
|
||||
|
||||
skeleton.add({
|
||||
area: 'mainArea',
|
||||
|
||||
@ -700,7 +700,6 @@ export function parseExpression(str, self) {
|
||||
if (inSameDomain() && window.parent.__newFunc) {
|
||||
return window.parent.__newFunc(tarStr)(self);
|
||||
}
|
||||
console.log('aaaaaaaa')
|
||||
return new Function(tarStr)(self);
|
||||
} catch (err) {
|
||||
debug('parseExpression.error', err, str, self);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user