mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 21:20:28 +00:00
feat: JSexpression props
This commit is contained in:
parent
b9103a225b
commit
26f4fb132e
@ -2,6 +2,7 @@ import Env from './env';
|
||||
import { isJSSlot, isI18nData, isJSExpression } from '@ali/lowcode-types';
|
||||
import { isPlainObject } from '@ali/lowcode-utils';
|
||||
import i18nUtil from './i18n-util';
|
||||
import { editor } from './editor';
|
||||
|
||||
function isVariable(obj: any) {
|
||||
return obj && obj.type === 'variable';
|
||||
@ -9,6 +10,10 @@ function isVariable(obj: any) {
|
||||
|
||||
// FIXME: 表达式使用 mock 值,未来live 模式直接使用原始值
|
||||
export function deepValueParser(obj?: any): any {
|
||||
// live
|
||||
if (editor.get('designMode') === 'live') {
|
||||
return obj;
|
||||
}
|
||||
if (isJSExpression(obj)) {
|
||||
obj = obj.mock;
|
||||
}
|
||||
|
||||
@ -87,6 +87,7 @@ designer.addPropsReducer(upgradePropsReducer, TransformStage.Upgrade);
|
||||
|
||||
// 节点 props 初始化
|
||||
designer.addPropsReducer((props, node) => {
|
||||
// debugger;
|
||||
// run initials
|
||||
const newProps: any = {
|
||||
...props,
|
||||
|
||||
@ -47,7 +47,6 @@ const pages = Object.assign(project, {
|
||||
}
|
||||
}
|
||||
}
|
||||
debugger;
|
||||
project.load({
|
||||
version: '1.0.0',
|
||||
componentsMap: [],
|
||||
|
||||
@ -205,7 +205,6 @@ export default class BaseEngine extends Component {
|
||||
// parentInfo 父组件的信息,包含schema和Comp
|
||||
// idx 若为循环渲染的循环Index
|
||||
__createVirtualDom = (schema, self, parentInfo, idx) => {
|
||||
|
||||
if (!schema) return null;
|
||||
// rax text prop 兼容处理
|
||||
if (schema.componentName === 'Text') {
|
||||
|
||||
@ -22,6 +22,7 @@ export default class PageEngine extends BaseEngine {
|
||||
static contextType = AppContext;
|
||||
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
debugger;
|
||||
debug('page.getDerivedStateFromProps');
|
||||
const func = props.__schema.lifeCycles && props.__schema.lifeCycles.getDerivedStateFromProps;
|
||||
if (func) {
|
||||
|
||||
@ -165,7 +165,7 @@ class Renderer extends Component<{
|
||||
<RaxEngine
|
||||
schema={documentInstance.schema}
|
||||
components={renderer.components}
|
||||
context={renderer.context}
|
||||
appHelper={renderer.context}
|
||||
designMode={renderer.designMode}
|
||||
suspended={documentInstance.suspended}
|
||||
self={documentInstance.scope}
|
||||
|
||||
@ -303,8 +303,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
getUrlParams() {
|
||||
const search = history.location.search;
|
||||
return parseQuery(search);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
constants: {},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user