Merge branch 'components-panel' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into components-panel

This commit is contained in:
春希 2020-07-16 20:31:45 +08:00
commit 7ecf137800
4 changed files with 31 additions and 18 deletions

View File

@ -19,12 +19,14 @@
"value": "function() {\n \t\tconsole.log('will umount');\n\t}"
}
},
"methods": {
"testFunc": {
"type": "JSFunction",
"value": "function() { console.log('test func');}"
"value": "function() {console.log('test func');}"
}
},
"props": {
"ref": "outterView",
"autoLoading": true,

View File

@ -268,9 +268,19 @@ export default class EventsSetter extends Component<{
onRelatedEventNameClick = (eventName:String) => {
const {editor} = this.props.field;
editor.emit('sourceEditor.focusByFunction',{
functionName:eventName
})
editor.get('skeleton').getPanel('sourceEditor').show();
setTimeout(()=>{
editor.emit('sourceEditor.focusByFunction',{
functionName:eventName
})
},300)
// editor.emit('sourceEditor.focusByFunction',{
// functionName:eventName
// })
}
closeEventMenu = () => {
@ -324,6 +334,7 @@ export default class EventsSetter extends Component<{
eventDataList
})
this.props.onChange(eventDataList);
//this.closeDialog();

View File

@ -99,16 +99,6 @@ export default class SourceEditor extends Component<{
//});
}
componentDidMount() {}
openPluginPannel = () => {
const { editor } = this.props;
// 判断面板是否处于激活状态
if (!editor.leftNav || editor.leftNav != 'sourceEditor') {
// 打开面板
editor.emit('leftNav.change', 'sourceEditor');
}
};
/**
*
@ -122,7 +112,6 @@ export default class SourceEditor extends Component<{
return;
}
debugger;
if (this.state.selectTab == TAB_KEY.CSS_TAB) {
this.setState({
selectTab: TAB_KEY.JS_TAB,
@ -173,7 +162,6 @@ export default class SourceEditor extends Component<{
this.monocoEditor.focus();
}, 100);
debugger;
this.updateCode(this.monocoEditor.getModel().getValue());
}
@ -213,6 +201,10 @@ export default class SourceEditor extends Component<{
}
onTabChange = (key) => {
const { editor } = this.props;
let schema = editor.get('designer').project.getSchema();
console.log(schema);
this.setState({
selectTab: key,
});

View File

@ -59,7 +59,15 @@ const transfrom = {
setFunction2Schema(functionMap,schema){
let pageNode = schema.componentsTree[0];
pageNode.state = functionMap.state;
for (let key in functionMap){
if (key == 'state'){
pageNode.state = functionMap[key];
}else{
if (LIFECYCLES_FUNCTION_MAP.react.indexOf(key)>=0){
// 判断有没有lifecycles节点
}
}
}
}
};
@ -104,7 +112,7 @@ function initMethodsCode(componentSchema: Object) {
}
function createFunctionCode(functionName: String, functionNode: Object) {
if (functionNode.type === 'JSExpression') {
if (functionNode.type === 'JSExpression' || functionNode.type === 'JSFunction') {
let functionCode = functionNode.value;
functionCode = functionCode.replace(/function/, functionName);
return functionCode;