feat: JSexpression props

This commit is contained in:
wanying.jwy 2020-08-19 16:24:02 +08:00
parent b9103a225b
commit 26f4fb132e
7 changed files with 10 additions and 5 deletions

View File

@ -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;
}

View File

@ -87,6 +87,7 @@ designer.addPropsReducer(upgradePropsReducer, TransformStage.Upgrade);
// 节点 props 初始化
designer.addPropsReducer((props, node) => {
// debugger;
// run initials
const newProps: any = {
...props,

View File

@ -47,7 +47,6 @@ const pages = Object.assign(project, {
}
}
}
debugger;
project.load({
version: '1.0.0',
componentsMap: [],

View File

@ -205,7 +205,6 @@ export default class BaseEngine extends Component {
// parentInfo schemaComp
// idx Index
__createVirtualDom = (schema, self, parentInfo, idx) => {
if (!schema) return null;
// rax text prop
if (schema.componentName === 'Text') {

View File

@ -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) {

View File

@ -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}

View File

@ -303,8 +303,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
getUrlParams() {
const search = history.location.search;
return parseQuery(search);
}
}
},
},
},
constants: {},
};