mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
fix: lowcode component exec lifecycle has error
This commit is contained in:
parent
9d51dcdae3
commit
f99a47e502
@ -2,6 +2,15 @@ import { isJSBlock, isJSSlot, ActivityType, NodeSchema, PageSchema, RootSchema }
|
|||||||
import { isVariable } from './misc';
|
import { isVariable } from './misc';
|
||||||
import { isPlainObject } from './is-plain-object';
|
import { isPlainObject } from './is-plain-object';
|
||||||
|
|
||||||
|
function isJsObject(props: any) {
|
||||||
|
if (typeof props === 'object' && props !== null) {
|
||||||
|
return props.type && props.source && props.compiled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isActionRef(props: any): boolean {
|
||||||
|
return props.type && props.type === 'actionRef';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将「乐高版本」协议升级成 JSExpression / JSSlot 等标准协议的结构
|
* 将「乐高版本」协议升级成 JSExpression / JSSlot 等标准协议的结构
|
||||||
* @param props
|
* @param props
|
||||||
@ -40,6 +49,19 @@ export function compatibleLegaoSchema(props: any): any {
|
|||||||
mock: props.value,
|
mock: props.value,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (isJsObject(props)) {
|
||||||
|
return {
|
||||||
|
type: 'JSExpression',
|
||||||
|
value: props.compiled,
|
||||||
|
extType: 'function',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (isActionRef(props)) {
|
||||||
|
return {
|
||||||
|
type: 'JSExpression',
|
||||||
|
value: `${props.id}.bind(this)`,
|
||||||
|
};
|
||||||
|
}
|
||||||
const newProps: any = {};
|
const newProps: any = {};
|
||||||
Object.keys(props).forEach((key) => {
|
Object.keys(props).forEach((key) => {
|
||||||
if (/^__slot__/.test(key) && props[key] === true) {
|
if (/^__slot__/.test(key) && props[key] === true) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user