mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge remote-tracking branch 'origin/develop' into release/1.0.81
This commit is contained in:
commit
b84d5c8486
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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() {}
|
||||
};
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user