mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 01:48:18 +00:00
22 lines
727 B
TypeScript
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;
|
|
}
|