huqi преди 5 години
родител
ревизия
00d9b5a847

+ 1 - 0
o2web/source/o2_core/o2/widget/Arraylist.js

@@ -118,6 +118,7 @@ o2.widget.Arraylist = new Class({
 		return this.toArray();
 	},
 	destroy: function(){
+		this.fireEvent("destroy");
 		this.container.destroy();
 		o2.release(this);
 	}

+ 7 - 3
o2web/source/o2_core/o2/widget/Maplist.js

@@ -299,6 +299,7 @@ o2.widget.Maplist = new Class({
 		return this.toJson();
 	},
 	destroy: function(){
+		this.fireEvent("destroy");
 		this.container.destroy();
 		o2.release(this);
 	}
@@ -481,8 +482,6 @@ o2.widget.Maplist.Item = new Class({
 	
 });
 
-
-
 o2.widget.Maplist.Style = new Class({
     Implements: [Options, Events],
     Extends: o2.widget.Maplist,
@@ -692,6 +691,8 @@ o2.widget.Maplist.Style.Item = new Class({
         dlg.close();
     },
     editItemComplate: function(node, input){
+    	var isChangeed = false;
+
         var text = input.get("value");
         if (node == this.keyNode){
             if (!text){
@@ -706,6 +707,7 @@ o2.widget.Maplist.Style.Item = new Class({
             }.bind(this));
 
             if (flag){
+				if (this.key !== text) isChangeed = true;
                 this.key = text;
                 if (this.imgKeys.indexOf(this.key)==-1) this.editValue();
                 this.maplist.notAddItem = true;
@@ -719,6 +721,7 @@ o2.widget.Maplist.Style.Item = new Class({
 
         var addNewItem = false;
         if (node == this.valueNode){
+			if (this.value !== text) isChangeed = true;
             this.value = text;
             if (this.isEnterKey){
                 if (this.isNewItem){
@@ -732,7 +735,8 @@ o2.widget.Maplist.Style.Item = new Class({
         this.iconNode.setStyle("background", "transparent ");
         this.iconNode.title = "";
 
-        this.maplist.fireEvent("change");
+		if (isChangeed) this.maplist.fireEvent("change");
+        //this.maplist.fireEvent("change");
 
         if (addNewItem){
             this.maplist.notAddItem = false;

+ 1 - 1
o2web/source/x_component_FindDesigner/FindWorker.js

@@ -544,7 +544,7 @@ _worker.findInDesigner_objectArray = function(formData, key, module, designer, p
     });
 };
 
-_worker.findInDesigner_duty = function(formData, key, module, designer, propertyDefinition, option, mode){
+_worker.findInDesigner_duty = function(formData, key, module, designer, propertyDefinition, option, mode, path){
     var text = formData[key];
     if (text){
         var json = JSON.parse(text);

+ 66 - 0
o2web/source/x_component_FindDesigner/Main.js

@@ -775,6 +775,8 @@ MWF.xApplication.FindDesigner.Main = new Class({
 				this.openPatternFormEditor_array(data, node);
 				break;
 
+			default:
+				this.openPatternFormEditor_default(data, node);
 		}
 	},
 	getValueWithPath: function(data, pattern){
@@ -799,6 +801,60 @@ MWF.xApplication.FindDesigner.Main = new Class({
 
 		return "<div style='line-height: 30px'>"+title+"</div>"
 	},
+	getDefaultEditorContent: function(data, pattern){
+		var el = this.lp.elementPattern.replace("{element}", "&lt;"+pattern.pattern.type+"&gt;"+pattern.pattern.name).
+		replace("{property}", pattern.pattern.propertyName+"{"+pattern.pattern.key+"}");
+		var title = "<b>"+this.lp[pattern.module]+":<span style='color: #4A90E2'>"+pattern.appName+"</span></b>->"+": "+"<b>["+pattern.pattern.mode+this.lp[pattern.designerType]+"]</b>&nbsp;"+pattern.designerName+"->"+el;
+
+		return "<div style='line-height: 30px'>"+title+"</div>"
+	},
+
+	commonEditor: new Class({
+		Implements: [Events],
+		initialize: function(node, value){
+			this.node = $(node);
+			this.value = value;
+			this.container = new Element("div", {
+				"styles": {
+					"padding": "10px"
+				}
+			});
+		},
+		load : function(title){
+			this.container.set("html", title).inject(this.node);
+		},
+		destroy: function(){
+			this.fireEvent("destroy");
+			this.container.destroy();
+			o2.release(this);
+		},
+		getValue: function(){
+			return this.value;
+		},
+		getContent: function(){
+
+		}
+	}),
+	openPatternFormEditor_default: function(data, node){
+		debugger;
+		var d = this.getValueWithPath(data, node.pattern);
+		if (d){
+			var title = this.getTitleWithPath(data, node.pattern);
+			this.editor = new this.commonEditor(this.previewContentNode, d);
+			this.editor.addEvent("destroy", function(){
+				this.previewToolbar.childrenButton[0].disable();
+				this.previewToolbar.childrenButton[1].disable();
+			}.bind(this));
+			this.editor.pattern = node.pattern;
+			this.editor.designerNode = node;
+			this.editor.designerData = data;
+			this.editor.load(title);
+
+			this.previewToolbar.childrenButton[0].disable();
+			this.previewToolbar.childrenButton[1].enable();
+		}
+	},
+
 	openPatternFormEditor_array: function(data, node){
 		var d = this.getValueWithPath(data, node.pattern);
 		if (d){
@@ -817,6 +873,11 @@ MWF.xApplication.FindDesigner.Main = new Class({
 						}
 					}.bind(this),
 				});
+				this.editor.addEvent("destroy", function(){
+					this.previewToolbar.childrenButton[0].disable();
+					this.previewToolbar.childrenButton[1].disable();
+				}.bind(this));
+
 				this.editor.pattern = node.pattern;
 				this.editor.designerNode = node;
 				this.editor.designerData = data;
@@ -849,6 +910,11 @@ MWF.xApplication.FindDesigner.Main = new Class({
 						}
 					}.bind(this),
 				});
+				this.editor.addEvent("destroy", function(){
+					this.previewToolbar.childrenButton[0].disable();
+					this.previewToolbar.childrenButton[1].disable();
+				}.bind(this));
+
 				this.editor.pattern = node.pattern;
 				this.editor.designerNode = node;
 				this.editor.designerData = data;

+ 3 - 0
o2web/source/x_component_FindDesigner/lp/zh-cn.js

@@ -43,6 +43,9 @@ MWF.xApplication.FindDesigner.LP = {
 	"saveDesigner": "保存设计元素",
 	"openDesigner": "打开应用",
 
+	"findInfor": "您在此设计元素中找到匹配项:",
+	"findInforOpen": "请点击此处开打设计元素",
+
 	"notice": {
 		"save_success": "保存成功!"
 	}