2021-03-09 19:53:22 +08:00

22 lines
727 B
TypeScript

import { Node } from '@ali/lowcode-designer';
import { compatibleLegaoSchema } from '@ali/lowcode-utils';
import { designerCabin } from '@ali/lowcode-engine';
const { getConvertedExtraKey } = designerCabin;
export const upgradePropsReducer = compatibleLegaoSchema;
export function upgradePageLifeCyclesReducer(props: any, node: Node) {
const lifeCycleNames = ['didMount', 'willUnmount'];
if (node.isRoot()) {
lifeCycleNames.forEach(key => {
if (props[key]) {
const lifeCycles = node.props.getPropValue(getConvertedExtraKey('lifeCycles')) || {};
lifeCycles[key] = props[key];
node.props.setPropValue(getConvertedExtraKey('lifeCycles'), lifeCycles);
}
});
}
return props;
}