diff --git a/o2web/source/x_component_process_FormDesigner/Module/$Component.js b/o2web/source/x_component_process_FormDesigner/Module/$Component.js index 9e97d6f15269d9b6c1078ee39410adf7c2ba3ab2..aec57aecc9a3273c94bb6d66b0ceb56d21268ab5 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/$Component.js +++ b/o2web/source/x_component_process_FormDesigner/Module/$Component.js @@ -91,6 +91,7 @@ MWF.xApplication.process.FormDesigner.Module.$Component = MWF.FC$Component = new var copyNode = module._getCopyNode(this); copyNode.show(); copyNode.inject(this.node, "before"); + this._positionCopyNode(copyNode); } // var copyNode = module._getCopyNode(); diff --git a/o2web/source/x_component_process_FormDesigner/Module/$Container.js b/o2web/source/x_component_process_FormDesigner/Module/$Container.js index f39be83edd28a2f3fd73d2e50185e102d11906ca..84e2eb9414b85103ce1b4427369b8acd5d2a9e41 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/$Container.js +++ b/o2web/source/x_component_process_FormDesigner/Module/$Container.js @@ -59,6 +59,8 @@ MWF.xApplication.process.FormDesigner.Module.$Container = MWF.FC$Container = new var copyNode = module._getCopyNode(this); copyNode.show(); copyNode.inject(this.node); + //copyNode.setStyle("position", "static"); + //this._positionCopyNode(copyNode, "in"); } //this._showInjectAction( module ); @@ -105,7 +107,11 @@ MWF.xApplication.process.FormDesigner.Module.$Container = MWF.FC$Container = new //this.parentContainer.node.setStyles({"border": "1px solid #ffa200"}); var copyNode = module._getCopyNode(); copyNode.inject(this.node, "before"); + this._positionCopyNode(copyNode); }, + + + _getSubModule: function(){ var modules = []; var subNode = this.node.getFirst(); @@ -122,7 +128,6 @@ MWF.xApplication.process.FormDesigner.Module.$Container = MWF.FC$Container = new return modules; }, load : function(json, node, parent){ - this.json = json; this.node= node; this.node.store("module", this); @@ -134,6 +139,14 @@ MWF.xApplication.process.FormDesigner.Module.$Container = MWF.FC$Container = new this._initModule(); this._loadTreeNode(parent); + if (!this.json.id){ + var id = this._getNewId(((parent) ? parent.json.id : null)); + this.json.id = id; + } + if (!this.form.json.moduleList[this.json.id]){ + this.form.json.moduleList[this.json.id] = this.json; + } + this.parseModules(); this.parentContainer = this.treeNode.parentNode.module; diff --git a/o2web/source/x_component_process_FormDesigner/Module/$Element.js b/o2web/source/x_component_process_FormDesigner/Module/$Element.js index 835159fa3c06506a7101fe212ab6db4d478d2269..171ea295ce74f556446dc8d406640710eff7a1fd 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/$Element.js +++ b/o2web/source/x_component_process_FormDesigner/Module/$Element.js @@ -29,6 +29,7 @@ MWF.xApplication.process.FormDesigner.Module.$Element = MWF.FC$Element = new Cla var copyNode = module._getCopyNode(this); copyNode.show(); copyNode.inject(this.node, "before"); + this._positionCopyNode(copyNode) } //this._showInjectAction( module ); diff --git a/o2web/source/x_component_process_FormDesigner/Module/$Module.js b/o2web/source/x_component_process_FormDesigner/Module/$Module.js index 248bc4736323e78b7d2718e57da3e18ccfa9e896..c88f54c2d9ee4bd773ef78a2b03b6a3962d70489 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/$Module.js +++ b/o2web/source/x_component_process_FormDesigner/Module/$Module.js @@ -305,6 +305,10 @@ MWF.xApplication.process.FormDesigner.Module.$Module = MWF.FC$Module = new Class this.close(); }, null); }, + selectedContainer: function(){ + debugger; + if (this.parentContainer) this.parentContainer.selected(); + }, styleBrush: function(){ //@todo this.form.styleBrushContent = Object.clone(this.json.styles); @@ -374,10 +378,10 @@ MWF.xApplication.process.FormDesigner.Module.$Module = MWF.FC$Module = new Class _hideActions: function(){ if (this.actionArea) this.actionArea.setStyle("display", "none"); }, - selected: function(){ + selected: function(force){ if (this.form && this.form.node)this.form.node.focus(); if (this.form.currentSelectedModule){ - if (this.form.currentSelectedModule==this){ + if (!force && this.form.currentSelectedModule==this){ return true; }else{ this.form.currentSelectedModule.unSelected(); @@ -461,7 +465,8 @@ MWF.xApplication.process.FormDesigner.Module.$Module = MWF.FC$Module = new Class if (this.property) this.property.hide(); }, - create: function(data, e){ + create: function(data, e, group){ + data.moduleGroup = group; this.json = data; this.json.id = this._getNewId(); this._createMoveNode(); @@ -488,6 +493,8 @@ MWF.xApplication.process.FormDesigner.Module.$Module = MWF.FC$Module = new Class _onEnterOther: function(dragging, inObj){ }, _onLeaveOther: function(dragging, inObj){ + if (this.copyNode) this.copyNode.destroy(); + this.copyNode = null; }, _onMoveEnter: function(dragging, inObj){ var module = inObj.retrieve("module"); @@ -569,6 +576,33 @@ MWF.xApplication.process.FormDesigner.Module.$Module = MWF.FC$Module = new Class // this.copyNode.setStyle("display", "block"); return this.copyNode; }, + _positionCopyNode: function(copyNode, isIn){ + var display = this.node.getStyle("display"); + copyNode.setStyle("margin", "0"); + + if (display.indexOf("inline") !==-1){ + var size = this.node.getComputedSize(); + copyNode.setStyle("position", "absolute"); + copyNode.setStyle("width", "1px"); + copyNode.setStyle("min-width", "0"); + copyNode.setStyle("height", size.height+"px"); + copyNode.position({ + relativeTo: this.node, + position: 'leftTop', + edge: 'rightTop' + }) + }else{ + var w = copyNode.getStyle("width").toFloat(); + if (!w) w = copyNode.getSize().x; + copyNode.setStyle("position", "absolute"); + copyNode.setStyle("width", ""+w+"px"); + copyNode.position({ + relativeTo: this.node, + position: (!!isIn) ? 'leftBottom': 'leftTop', + edge: 'leftBottom' + }) + } + }, _createCopyNode: function(){ this.copyNode = this.moveNode.clone(); this.copyNode.setStyles(this.css.moduleNodeShow); @@ -934,10 +968,13 @@ MWF.xApplication.process.FormDesigner.Module.$Module = MWF.FC$Module = new Class } if (name=="properties"){ try{ - this.node.setProperties(this.json.properties); + this.setCustomProperties(); }catch(e){} } }, + setCustomProperties: function(){ + this.node.setProperties(this.json.properties); + }, setCustomNodeStyles: function(node, styles){ var border = node.getStyle("border"); node.clearStyles(); diff --git a/o2web/source/x_component_process_FormDesigner/Module/Form.js b/o2web/source/x_component_process_FormDesigner/Module/Form.js index ee4919cb53aeaf731b18ecb6bf7d212ad1a90841..42d3b8f0b31cb7ad4d5e882cfdd2e82e1f757d90 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Form.js +++ b/o2web/source/x_component_process_FormDesigner/Module/Form.js @@ -542,11 +542,11 @@ MWF.xApplication.process.FormDesigner.Module.Form = MWF.FCForm = new Class({ return module; }, - createModule: function(className, e){ + createModule: function(className, e, group){ this.getTemplateData(className, function(data){ var moduleData = Object.clone(data); var newTool = new MWF["FC"+className](this); - newTool.create(moduleData, e); + newTool.create(moduleData, e, group); }.bind(this)); }, getTemplateData: function(className, callback , async){ diff --git a/o2web/source/x_component_process_FormDesigner/Module/Stat/default/css.wcss b/o2web/source/x_component_process_FormDesigner/Module/Stat/default/css.wcss index 8e0793ce5950c56eb555996b39577162fd90aca6..358efaddca575abd404711bbb02bb645977fe7bf 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Stat/default/css.wcss +++ b/o2web/source/x_component_process_FormDesigner/Module/Stat/default/css.wcss @@ -30,7 +30,7 @@ "left": "auto", "width": "auto", "opacity": 0.5, - "background": "#ffffff" + "background": "#ffa200" }, "moduleNode": { "border": "1px dashed #333", @@ -89,4 +89,4 @@ "padding": "0px 10px" } -} \ No newline at end of file +}