mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-06 02:11:56 +00:00
25 lines
726 B
TypeScript
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;
|
|
}
|