From df566467b1316e949d8763259bb950200854331a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2022 13:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4=E8=8A=82=E7=82=B9=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- o2web/source/o2_core/o2/lp/en.js | 4 +- o2web/source/o2_core/o2/lp/zh-cn.js | 4 +- .../o2_core/o2/widget/$Tree/editor/check.png | Bin 0 -> 2874 bytes .../o2/widget/$Tree/editor/checked.png | Bin 0 -> 3003 bytes .../o2_core/o2/widget/$Tree/editor/css.wcss | 37 ++++++- o2web/source/o2_core/o2/widget/Tree.js | 28 ++++-- o2web/source/o2_core/o2/widget/TreeEditor.js | 90 +++++++++++++++++- .../Module/Tab.js | 2 +- .../Module/Tab.js | 2 +- 9 files changed, 149 insertions(+), 18 deletions(-) create mode 100644 o2web/source/o2_core/o2/widget/$Tree/editor/check.png create mode 100644 o2web/source/o2_core/o2/widget/$Tree/editor/checked.png diff --git a/o2web/source/o2_core/o2/lp/en.js b/o2web/source/o2_core/o2/lp/en.js index 26c6872c5c..9266e9ca0d 100644 --- a/o2web/source/o2_core/o2/lp/en.js +++ b/o2web/source/o2_core/o2/lp/en.js @@ -124,7 +124,9 @@ o2.LP.process = { "copy": "Copy", "delete": "Delete", "add": "Add", - "script": "Script" + "script": "Script", + "clickScript": "Click Event Script", + "defaultNode": "Default Node" } }; o2.LP.desktop = { diff --git a/o2web/source/o2_core/o2/lp/zh-cn.js b/o2web/source/o2_core/o2/lp/zh-cn.js index 0530d8dc66..bbcb1fcb70 100644 --- a/o2web/source/o2_core/o2/lp/zh-cn.js +++ b/o2web/source/o2_core/o2/lp/zh-cn.js @@ -124,7 +124,9 @@ o2.LP.process = { "copy": "复制", "delete": "删除", "add": "添加", - "script": "脚本" + "script": "脚本", + "clickScript": "点击事件脚本", + "defaultNode": "默认节点" } }; o2.LP.desktop = { diff --git a/o2web/source/o2_core/o2/widget/$Tree/editor/check.png b/o2web/source/o2_core/o2/widget/$Tree/editor/check.png new file mode 100644 index 0000000000000000000000000000000000000000..af36ca94cff1f3422b7c67154bb51896a095babf GIT binary patch literal 2874 zcmV-A3&r$_P)p00009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2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HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C z0B1==K~#9!?9wp`fFKlr;b-KV)FVg~3ElrNfgyx@hFZ&W=>|$$L;w7ZKMQBH&Jz`= zhRDsNd+YpS1|>yZr+lq;?}$p10)Uc&sC4kAUw>L7@|3TpOZi65*%9LAJeBr?^QfNz Y04Px=Qjx7^bN~PV07*qoM6N<$f_@Kq#sB~S literal 0 HcmV?d00001 diff --git a/o2web/source/o2_core/o2/widget/$Tree/editor/checked.png b/o2web/source/o2_core/o2/widget/$Tree/editor/checked.png new file mode 100644 index 0000000000000000000000000000000000000000..48707628a2079895c415a240e7a01643bced2273 GIT binary patch literal 3003 zcmV;s3qp00009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~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C9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C z0O(0XK~#9!V%&NAf7WJ(7hf3g0|_36X}%1M%61H+3i3``8900OF+ z85t&fGhEIgLNyyR!@NL-1S5vYC!iuM5K5Mx;mucu?|%?VxmXz%hcLJ(Gh}XJSaK27 z?A-|r`;!q$W)R|HIGD`fpvWM^$*?t+!BCPRY$d~n z>nLtxCcbL5R!r---VZnI@R%QmT#aNW0m`#Q7 xMprGtL#$G99tNhVz6|0-XprJ%nC8m>7yv>gI&&g46=47X002ovPDHLkV1k0%sc`@R literal 0 HcmV?d00001 diff --git a/o2web/source/o2_core/o2/widget/$Tree/editor/css.wcss b/o2web/source/o2_core/o2/widget/$Tree/editor/css.wcss index b600c2cf3f..2eff6bc875 100644 --- a/o2web/source/o2_core/o2/widget/$Tree/editor/css.wcss +++ b/o2web/source/o2_core/o2/widget/$Tree/editor/css.wcss @@ -16,7 +16,8 @@ "treeItemNode":{ "height": "24px", "border-bottom": "1px solid #DDD", - "background": "transparent" + "background": "transparent", + "position": "relative" }, "treeChildrenNode": { }, @@ -75,7 +76,7 @@ "font-family": "Verdana, Geneva, sans-serif" }, "itemActionNode": { - "width": "70px", + "width": "86px", "height": "22px", "position": "absolute", "z-index": 10000, @@ -105,6 +106,38 @@ "float": "right", "background": "url("+o2.session.path+"/widget/$Tree/editor/code.png) center center no-repeat" }, + "itemCheckActionNode": { + "padding-left": "3px", + "width": "19px", + "height": "22px", + "line-height": "20px", + "font-size": "8px", + "font-weight": "bold", + "float": "right", + "color": "#333" + }, + "itemCheckedActionNode": { + "padding-left": "3px", + "width": "19px", + "height": "22px", + "line-height": "20px", + "float": "right", + "font-size": "8px", + "font-weight": "bold", + "color": "#4A90E2" + }, + "itemCheckedNode": { + "position": "absolute", + "right": "0px", + "top": "1px", + "width": "19px", + "height": "22px", + "line-height": "20px", + "float": "right", + "font-size": "8px", + "font-weight": "bold", + "color": "#4A90E2" + }, "scriptNode":{ "width": "98%", "height": "98%", diff --git a/o2web/source/o2_core/o2/widget/Tree.js b/o2web/source/o2_core/o2/widget/Tree.js index 24ae17231b..941573efa9 100644 --- a/o2web/source/o2_core/o2/widget/Tree.js +++ b/o2web/source/o2_core/o2/widget/Tree.js @@ -374,18 +374,28 @@ o2.widget.Tree.Node = new Class({ this.selectNode(e); this.doAction(e); }, - + unselectNode: function(){ + this.fireEvent("unselect"); + var textDivNode = this.textNode.getElement("div"); + textDivNode.setStyles(this.tree.css.textDivNode); + if (this.options.style){ + if (this.tree.css[this.options.style]){ + textDivNode.setStyles(this.tree.css[this.options.style].textDivNode); + } + } + }, selectNode: function(){ this.tree.fireEvent("beforeSelect", [this]); if (this.tree.currentNode){ - this.tree.currentNode.fireEvent("unselect"); - var textDivNode = this.tree.currentNode.textNode.getElement("div"); - textDivNode.setStyles(this.tree.css.textDivNode); - if (this.tree.currentNode.options.style){ - if (this.tree.css[this.tree.currentNode.options.style]){ - textDivNode.setStyles(this.tree.css[this.tree.currentNode.options.style].textDivNode); - } - } + this.tree.currentNode.unselectNode(); + // this.tree.currentNode.fireEvent("unselect"); + // var textDivNode = this.tree.currentNode.textNode.getElement("div"); + // textDivNode.setStyles(this.tree.css.textDivNode); + // if (this.tree.currentNode.options.style){ + // if (this.tree.css[this.tree.currentNode.options.style]){ + // textDivNode.setStyles(this.tree.css[this.tree.currentNode.options.style].textDivNode); + // } + // } } var textDivNode = this.textNode.getElement("div"); textDivNode.setStyles(this.tree.css.textDivNodeSelected); diff --git a/o2web/source/o2_core/o2/widget/TreeEditor.js b/o2web/source/o2_core/o2/widget/TreeEditor.js index a12b89b0b3..4b5ae8e448 100644 --- a/o2web/source/o2_core/o2/widget/TreeEditor.js +++ b/o2web/source/o2_core/o2/widget/TreeEditor.js @@ -172,6 +172,9 @@ o2.widget.TreeEditor.Tree.Node = new Class({ this.hideItemAction(); }.bind(this) }); + if( this.options.default ){ + this.setDefaultItem(); + } }, appendChild: function(obj){ @@ -196,12 +199,52 @@ o2.widget.TreeEditor.Tree.Node = new Class({ return treeNode; }, + createTextNode: function(){ + this.textNode = new Element("td",{ + "styles": this.tree.css.textNode + }).inject(this.nodeArea); + if (this.options.style){ + if (this.tree.css[this.options.style]){ + this.textNode.setStyles(this.tree.css[this.options.style].textNode); + } + } + // var width = this.tree.container.getSize().x - (this.level*20+40); + // this.textNode.setStyle("width", ""+width+"px"); + + var textDivNode = new Element("div", { + "styles": {"display": "inline-block"}, + // "html": this.options.text, + "title": this.options.title + }); + textDivNode.setStyles(this.tree.css.textDivNode); + if (this.options.style){ + if (this.tree.css[this.options.style]){ + textDivNode.setStyles(this.tree.css[this.options.style].textDivNode); + } + } + + if (this.tree.options.text=="html"){ + textDivNode.set("html", this.options.text); + }else{ + textDivNode.set("text", this.options.text); + } + + textDivNode.addEvent("click", function(e){ + this.clickNode(e); + }.bind(this)); + + textDivNode.inject(this.textNode); + if( this.options.default ){ + this.selectNode(); + } + }, doAction: function(e){ var textNode = e.target; this.editItem(textNode); }, hideItemAction: function(){ if (this.actionNode) this.actionNode.setStyle("display", "none"); + if( this.defaultNode )this.defaultNode.show(); }, setActionPosition: function(){ if (this.actionNode){ @@ -226,11 +269,21 @@ o2.widget.TreeEditor.Tree.Node = new Class({ if (!this.actionNode) this.createItemActionNode(); this.setActionPosition(); this.actionNode.setStyle("display", "block"); + if( this.defaultNode )this.defaultNode.hide(); }, createItemActionNode: function(){ this.actionNode = new Element("div", { "styles": this.tree.css.itemActionNode }).inject(this.itemNode); + + this.defaultAction = new Element("div", { + "styles": this.tree.css.itemCheckActionNode, + "title": o2.LP.process.formAction.defaultNode, + "text": "✔", + "events": { + "click": this.switchDefaultItem.bind(this) + } + }).inject(this.actionNode); var deleteAction = new Element("div", { "styles": this.tree.css.itemDeleteActionNode, @@ -244,7 +297,7 @@ o2.widget.TreeEditor.Tree.Node = new Class({ var scriptAction = new Element("div", { "styles": this.tree.css.itemScriptActionNode, - "title": o2.LP.process.formAction["script"], + "title": o2.LP.process.formAction["clickScript"], "events": { "click": function(e){ this.editScriptItem(e); @@ -317,7 +370,7 @@ o2.widget.TreeEditor.Tree.Node = new Class({ var node = new Element("div").inject(this.itemNode, "after"); o2.require("o2.widget.ScriptArea", function(){ this.scriptArea = new o2.widget.ScriptArea(node, { - "title": o2.LP.process.formAction["script"], + "title": o2.LP.process.formAction["clickScript"], "maxObj": this.tree.editor.options.maxObj, "style": "treeEditor", "onChange": function(){ @@ -349,7 +402,7 @@ o2.widget.TreeEditor.Tree.Node = new Class({ this.scriptArea.container.scrollIntoView(); this.scriptArea.focus(); this.setActionPosition(); - }.bind(this));; + }.bind(this)); this.isEditScript = true; this.tree.currentEditNode = this; @@ -372,6 +425,37 @@ o2.widget.TreeEditor.Tree.Node = new Class({ treeNode.editItem(textDivNode); }, + switchDefaultItem: function(e){ + if( this.options.default ){ + this.unsetDefaultItem(); + }else{ + if( this.tree.defaultItem ){ + this.tree.defaultItem.unsetDefaultItem(); + } + this.setDefaultItem( e ); + } + this.tree.editor.fireEvent("change"); + }, + unsetDefaultItem: function(){ + this.options.default = false; + if( this.defaultNode )this.defaultNode.destroy(); + this.defaultAction.setStyles( this.tree.css.itemCheckActionNode ); + this.tree.defaultItem = null; + this.unselectNode(); + }, + setDefaultItem: function(e){ + this.defaultNode = new Element("div", { + "styles": this.tree.css.itemCheckedNode, + "title": o2.LP.process.formAction.defaultNode, + "text": "✔" + }).inject(this.itemNode); + this.tree.defaultItem = this; + if(e){ + this.options.default = true; + this.defaultNode.hide(); + this.defaultAction.setStyles( this.tree.css.itemCheckedActionNode ); + } + }, deleteItem: function(e){ var treeNode = this; diff --git a/o2web/source/x_component_portal_PageDesigner/Module/Tab.js b/o2web/source/x_component_portal_PageDesigner/Module/Tab.js index cbf3ee20e3..6fbb1ce254 100644 --- a/o2web/source/x_component_portal_PageDesigner/Module/Tab.js +++ b/o2web/source/x_component_portal_PageDesigner/Module/Tab.js @@ -70,7 +70,7 @@ MWF.xApplication.portal.PageDesigner.Module.Tab = MWF.PCTab = new Class({ }.bind(this)); }, addPage: function(){ - tabNode = new Element("div"); + var tabNode = new Element("div"); var page = this.tabWidget.addTab(tabNode, "page", false); this.form.getTemplateData("Tab$Page", function(data){ diff --git a/o2web/source/x_component_process_FormDesigner/Module/Tab.js b/o2web/source/x_component_process_FormDesigner/Module/Tab.js index 74ce6434d3..74248698e7 100644 --- a/o2web/source/x_component_process_FormDesigner/Module/Tab.js +++ b/o2web/source/x_component_process_FormDesigner/Module/Tab.js @@ -197,7 +197,7 @@ MWF.xApplication.process.FormDesigner.Module.Tab = MWF.FCTab = new Class({ this.tabWidget.css.tabNode = this.json.tabStyles; this.tabWidget.css.tabTextNode = this.json.tabTextStyles; this.tabWidget.css.tabNodeCurrent = this.json.tabCurrentStyles; - this.tabWidget.css.contentNodeContainer.clear = "both"; + if( !this.json.contentNodeContainer || !this.json.contentNodeContainer.clear )this.tabWidget.css.contentNodeContainer.clear = "both"; this.tabWidget.css.tabTextNodeCurrent = this.json.tabTextCurrentStyles; }, _getElements: function(){ -- GitLab