roojs-core.js
authorjohn <john@roojs.com>
Thu, 24 May 2018 09:19:21 +0000 (17:19 +0800)
committerjohn <john@roojs.com>
Thu, 24 May 2018 09:19:21 +0000 (17:19 +0800)
roojs-core-debug.js

roojs-core-debug.js
roojs-core.js

index afc112b..85f064d 100644 (file)
@@ -15395,40 +15395,49 @@ Roo.extend(Roo.Component, Roo.util.Observable, {
      * @param {String/HTMLElement/Element} container (optional) The element this component should be rendered into. If it is being applied to existing markup, this should be left off.
      */
     render : function(container, position){
-        if(!this.rendered && this.fireEvent("beforerender", this) !== false){
-            if(!container && this.el){
-                this.el = Roo.get(this.el);
-                container = this.el.dom.parentNode;
-                this.allowDomMove = false;
-            }
-            this.container = Roo.get(container);
-            this.rendered = true;
-            if(position !== undefined){
-                if(typeof position == 'number'){
-                    position = this.container.dom.childNodes[position];
-                }else{
-                    position = Roo.getDom(position);
-                }
-            }
-            this.onRender(this.container, position || null);
-            if(this.cls){
-                this.el.addClass(this.cls);
-                delete this.cls;
-            }
-            if(this.style){
-                this.el.applyStyles(this.style);
-                delete this.style;
-            }
-            this.fireEvent("render", this);
-            this.afterRender(this.container);
-            if(this.hidden){
-                this.hide();
-            }
-            if(this.disabled){
-                this.disable();
+        
+        if(this.rendered){
+            return this;
+        }
+        
+        if(this.fireEvent("beforerender", this) === false){
+            return false;
+        }
+        
+        if(!container && this.el){
+            this.el = Roo.get(this.el);
+            container = this.el.dom.parentNode;
+            this.allowDomMove = false;
+        }
+        this.container = Roo.get(container);
+        this.rendered = true;
+        if(position !== undefined){
+            if(typeof position == 'number'){
+                position = this.container.dom.childNodes[position];
+            }else{
+                position = Roo.getDom(position);
             }
         }
+        this.onRender(this.container, position || null);
+        if(this.cls){
+            this.el.addClass(this.cls);
+            delete this.cls;
+        }
+        if(this.style){
+            this.el.applyStyles(this.style);
+            delete this.style;
+        }
+        this.fireEvent("render", this);
+        this.afterRender(this.container);
+        if(this.hidden){
+            this.hide();
+        }
+        if(this.disabled){
+            this.disable();
+        }
+
         return this;
+        
     },
 
     /** @private */
@@ -16625,7 +16634,7 @@ Roo.apply(Roo.XComponent, {
      */
        overlayStrings : function( component, strings )
     {
-        if (typeof(component['_named_strings']) == undefined) {
+        if (typeof(component['_named_strings']) == 'undefined') {
             throw "ERROR: component does not have _named_strings";
         }
         for ( var k in strings ) {
index 149ec3e..52413fb 100644 (file)
@@ -629,18 +629,18 @@ A.un("add",fn,B);}});}};}();
 // Roo/Component.js
 Roo.Component=function(A){A=A||{};if(A.tagName||A.dom||typeof A=="string"){A={el:A,id:A.id||A};}this.initialConfig=A;Roo.apply(this,A);this.addEvents({disable:true,enable:true,beforeshow:true,show:true,beforehide:true,hide:true,beforerender:true,render:true,beforedestroy:true,destroy:true}
 );if(!this.id){this.id="roo-comp-"+(++Roo.Component.AUTO_ID);}Roo.ComponentMgr.register(this);Roo.Component.superclass.constructor.call(this);this.initComponent();if(this.renderTo){this.render(this.renderTo);delete this.renderTo;}};Roo.Component.AUTO_ID=1000;
-Roo.extend(Roo.Component,Roo.util.Observable,{hidden:false,disabled:false,rendered:false,disabledClass:"x-item-disabled",allowDomMove:true,hideMode:'display',ctype:"Roo.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initComponent:Roo.emptyFn,render:function(A,B){if(!this.rendered&&this.fireEvent("beforerender",this)!==false){if(!A&&this.el){this.el=Roo.get(this.el);
-A=this.el.dom.parentNode;this.allowDomMove=false;}this.container=Roo.get(A);this.rendered=true;if(B!==undefined){if(typeof B=='number'){B=this.container.dom.childNodes[B];}else{B=Roo.getDom(B);}}this.onRender(this.container,B||null);if(this.cls){this.el.addClass(this.cls);
-delete this.cls;}if(this.style){this.el.applyStyles(this.style);delete this.style;}this.fireEvent("render",this);this.afterRender(this.container);if(this.hidden){this.hide();}if(this.disabled){this.disable();}}return this;},onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);
-if(this.allowDomMove!==false){ct.dom.insertBefore(this.el.dom,A);}}},getAutoCreate:function(){var A=typeof this.autoCreate=="object"?this.autoCreate:Roo.apply({},this.defaultAutoCreate);if(this.id&&!A.id){A.id=this.id;}return A;},afterRender:Roo.emptyFn,destroy:function(){if(this.fireEvent("beforedestroy",this)!==false){this.purgeListeners();
-this.beforeDestroy();if(this.rendered){this.el.removeAllListeners();this.el.remove();if(this.actionMode=="container"){this.container.remove();}}this.onDestroy();Roo.ComponentMgr.unregister(this);this.fireEvent("destroy",this);}},beforeDestroy:function(){}
-,onDestroy:function(){},getEl:function(){return this.el;},getId:function(){return this.id;},focus:function(A){if(this.rendered){this.el.focus();if(A===true){this.el.dom.select();}}return this;},blur:function(){if(this.rendered){this.el.blur();}return this;
-},disable:function(){if(this.rendered){this.onDisable();}this.disabled=true;this.fireEvent("disable",this);return this;},onDisable:function(){this.getActionEl().addClass(this.disabledClass);this.el.dom.disabled=true;},enable:function(){if(this.rendered){this.onEnable();
-}this.disabled=false;this.fireEvent("enable",this);return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);this.el.dom.disabled=false;},setDisabled:function(A){this[A?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;
-if(this.rendered){this.onShow();}this.fireEvent("show",this);}return this;},onShow:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="visible";}else if(this.hideMode=='offsets'){ae.removeClass('x-hidden');}else{ae.dom.style.display="";
-}},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;if(this.rendered){this.onHide();}this.fireEvent("hide",this);}return this;},onHide:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="hidden";
-}else if(this.hideMode=='offsets'){ae.addClass('x-hidden');}else{ae.dom.style.display="none";}},setVisible:function(A){if(A){this.show();}else{this.hide();}return this;},isVisible:function(){return this.getActionEl().isVisible();},cloneConfig:function(A){A=A||{}
-;var id=A.id||Roo.id();var B=Roo.applyIf(A,this.initialConfig);B.id=id;return new this.constructor(B);}});
+Roo.extend(Roo.Component,Roo.util.Observable,{hidden:false,disabled:false,rendered:false,disabledClass:"x-item-disabled",allowDomMove:true,hideMode:'display',ctype:"Roo.Component",actionMode:"el",getActionEl:function(){return this[this.actionMode];},initComponent:Roo.emptyFn,render:function(A,B){if(this.rendered){return this;
+}if(this.fireEvent("beforerender",this)===false){return false;}if(!A&&this.el){this.el=Roo.get(this.el);A=this.el.dom.parentNode;this.allowDomMove=false;}this.container=Roo.get(A);this.rendered=true;if(B!==undefined){if(typeof B=='number'){B=this.container.dom.childNodes[B];
+}else{B=Roo.getDom(B);}}this.onRender(this.container,B||null);if(this.cls){this.el.addClass(this.cls);delete this.cls;}if(this.style){this.el.applyStyles(this.style);delete this.style;}this.fireEvent("render",this);this.afterRender(this.container);if(this.hidden){this.hide();
+}if(this.disabled){this.disable();}return this;},onRender:function(ct,A){if(this.el){this.el=Roo.get(this.el);if(this.allowDomMove!==false){ct.dom.insertBefore(this.el.dom,A);}}},getAutoCreate:function(){var A=typeof this.autoCreate=="object"?this.autoCreate:Roo.apply({}
+,this.defaultAutoCreate);if(this.id&&!A.id){A.id=this.id;}return A;},afterRender:Roo.emptyFn,destroy:function(){if(this.fireEvent("beforedestroy",this)!==false){this.purgeListeners();this.beforeDestroy();if(this.rendered){this.el.removeAllListeners();this.el.remove();
+if(this.actionMode=="container"){this.container.remove();}}this.onDestroy();Roo.ComponentMgr.unregister(this);this.fireEvent("destroy",this);}},beforeDestroy:function(){},onDestroy:function(){},getEl:function(){return this.el;},getId:function(){return this.id;
+},focus:function(A){if(this.rendered){this.el.focus();if(A===true){this.el.dom.select();}}return this;},blur:function(){if(this.rendered){this.el.blur();}return this;},disable:function(){if(this.rendered){this.onDisable();}this.disabled=true;this.fireEvent("disable",this);
+return this;},onDisable:function(){this.getActionEl().addClass(this.disabledClass);this.el.dom.disabled=true;},enable:function(){if(this.rendered){this.onEnable();}this.disabled=false;this.fireEvent("enable",this);return this;},onEnable:function(){this.getActionEl().removeClass(this.disabledClass);
+this.el.dom.disabled=false;},setDisabled:function(A){this[A?"disable":"enable"]();},show:function(){if(this.fireEvent("beforeshow",this)!==false){this.hidden=false;if(this.rendered){this.onShow();}this.fireEvent("show",this);}return this;},onShow:function(){var ae=this.getActionEl();
+if(this.hideMode=='visibility'){ae.dom.style.visibility="visible";}else if(this.hideMode=='offsets'){ae.removeClass('x-hidden');}else{ae.dom.style.display="";}},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.hidden=true;if(this.rendered){this.onHide();
+}this.fireEvent("hide",this);}return this;},onHide:function(){var ae=this.getActionEl();if(this.hideMode=='visibility'){ae.dom.style.visibility="hidden";}else if(this.hideMode=='offsets'){ae.addClass('x-hidden');}else{ae.dom.style.display="none";}},setVisible:function(A){if(A){this.show();
+}else{this.hide();}return this;},isVisible:function(){return this.getActionEl().isVisible();},cloneConfig:function(A){A=A||{};var id=A.id||Roo.id();var B=Roo.applyIf(A,this.initialConfig);B.id=id;return new this.constructor(B);}});
 // Roo/BoxComponent.js
 Roo.BoxComponent=function(A){Roo.Component.call(this,A);this.addEvents({resize:true,move:true});};Roo.extend(Roo.BoxComponent,Roo.Component,{boxReady:false,deferHeight:false,setSize:function(w,h){if(typeof w=='object'){h=w.height;w=w.width;}if(!this.boxReady){this.width=w;
 this.height=h;return this;}if(this.lastSize&&this.lastSize.width==w&&this.lastSize.height==h){return this;}this.lastSize={width:w,height:h};var A=this.adjustSize(w,h);var aw=A.width,ah=A.height;if(aw!==undefined||ah!==undefined){var rz=this.getResizeEl();
@@ -673,7 +673,7 @@ m.modules.each(D);}else{Roo.debug&&Roo.log("build Order: no child modules");}if(
 }return C;},build:function(A){if(typeof(A)!='undefined'){Roo.apply(this,A);}this.preBuild();var B=this.buildOrder();if(!B.length){throw "NO modules!!!";}var C="Building Interface...";if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.show({title:'loading'}
 );Roo.MessageBox.show({title:"Please wait...",msg:C,width:450,progress:true,closable:false,modal:false});}var D=B.length;var E=this;var F=function(){if(!B.length){Roo.debug&&Roo.log('hide?');if(!this.hideProgress&&Roo.MessageBox){Roo.MessageBox.hide();}Roo.XComponent.build_from_html=false;
 Roo.XComponent.event.fireEvent('buildcomplete',E.topModule);return false;}var m=B.shift();Roo.debug&&Roo.log(m);if(typeof(m)=='function'){m.call(this);return F.defer(10,E);}C="Building Interface "+(D-B.length)+" of "+D+(m.name?(' - '+m.name):'');Roo.debug&&Roo.log(C);
-if(!E.hideProgress&&Roo.MessageBox){Roo.MessageBox.updateProgress((D-B.length)/D,C);}var G=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(G){return F();}m.render();return F.defer(10,E);};F.defer(1,E);},overlayStrings:function(A,B){if(typeof(A['_named_strings'])==undefined){throw "ERROR: component does not have _named_strings";
+if(!E.hideProgress&&Roo.MessageBox){Roo.MessageBox.updateProgress((D-B.length)/D,C);}var G=(typeof(m.disabled)=='function')?m.disabled.call(m.module.disabled):m.disabled;if(G){return F();}m.render();return F.defer(10,E);};F.defer(1,E);},overlayStrings:function(A,B){if(typeof(A['_named_strings'])=='undefined'){throw "ERROR: component does not have _named_strings";
 }for(var k in B){var md=typeof(A['_named_strings'][k])=='undefined'?false:A['_named_strings'][k];if(md!==false){A['_strings'][md]=B[k];}else{Roo.log('could not find named string: '+k+' in');Roo.log(A);}}},event:false,on:false});Roo.XComponent.event=new Roo.util.Observable({events:{'register':true,'beforebuild':true,'buildcomplete':true}
 });Roo.XComponent.on=Roo.XComponent.event.on.createDelegate(Roo.XComponent.event);
 // Roo/Markdown.js