Merge commit 'b84d5c8486bb7ccfd6b3e300c29054c97837cd4a' into def_releases_2022040810384040_ali-lowcode_ali-lowcode-engine/1.0.81

This commit is contained in:
tbfed 2022-04-11 14:13:06 +08:00
commit b07c066728
4 changed files with 31 additions and 4 deletions

View File

@ -498,8 +498,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
const _schema: any = {
...compatibleLegaoSchema(schema),
};
_schema.methods = {};
_schema.lifeCycles = {};
if (schema.componentName === 'Component' && (schema as ComponentSchema).css) {
const doc = window.document;

View File

@ -429,8 +429,6 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
const _schema: any = {
...compatibleLegaoSchema(schema),
};
_schema.methods = {};
_schema.lifeCycles = {};
if (schema.componentName === 'Component' && (schema as ComponentSchema).css) {
const doc = window.document;

View File

@ -32,6 +32,8 @@ export default function componentRendererFactory() {
const noContainer = this.__parseData(__schema.props?.noContainer);
this.__bindCustomMethods();
if (noContainer) {
return this.__renderContextProvider({ compContext: this });
}
@ -44,5 +46,12 @@ export default function componentRendererFactory() {
return this.__renderComp(Component, this.__renderContextProvider({ compContext: this }));
}
/** 需要重载下面几个方法,如果在低代码组件中绑定了对应的生命周期时会出现死循环 */
componentDidMount() {}
getSnapshotBeforeUpdate() {}
componentDidUpdate() {}
componentWillUnmount() {}
componentDidCatch() {}
};
}

View File

@ -2,6 +2,15 @@ import { isJSBlock, isJSSlot, ActivityType, NodeSchema, PageSchema, RootSchema }
import { isVariable } from './misc';
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
* @param props
@ -40,6 +49,19 @@ export function compatibleLegaoSchema(props: any): any {
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 = {};
Object.keys(props).forEach((key) => {
if (/^__slot__/.test(key) && props[key] === true) {