力皓 158b6a699f fix: 修复从其他页面粘贴过来的 modal 位置不对
fix: 对于 vc 场景的组件, 才做 schema 兼容处理
refactor: eslint 统一收拢到根目录
2021-01-27 14:23:57 +08:00

25 lines
726 B
TypeScript

import {
cloneDeep,
} from '@ali/lowcode-utils';
import { Node } from '@ali/lowcode-designer';
// 清除空的 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;
}