力皓 5e6e91b265 fix: 修复 project.unload 无法正常删除 document 的 bug
chore(test): 部分完成 pages / api 等兼容测试

chore(test): 完成部分 prototype 单测
2020-11-09 09:59:42 +08:00

24 lines
680 B
TypeScript

import {
cloneDeep,
} from '@ali/lowcode-utils';
// 清除空的 props value
export function removeEmptyPropsReducer(props: any, node: Node) {
if (node.isRoot() && props.dataSource && Array.isArray(props.dataSource.online)) {
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;
}