roojs-bootstrap.js
authorEdward <edward@roojs.com>
Mon, 27 Apr 2015 03:10:15 +0000 (11:10 +0800)
committerEdward <edward@roojs.com>
Mon, 27 Apr 2015 03:10:15 +0000 (11:10 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 01016b8..31dad4c 100644 (file)
@@ -2275,6 +2275,10 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     },
     hide : function()
     {
+        if(this.fireEvent("beforehide", this) === false){
+            return;
+        }
+        
         this.maskEl.hide();
         Roo.get(document.body).removeClass("x-body-masked");
         this.el.removeClass('in');
index 68b0147..b61c9cb 100644 (file)
@@ -60,7 +60,8 @@ this.el=Roo.get(document.body).createChild(B,A);}if(this.tabIndex!==undefined){t
 this.maskEl=Roo.DomHelper.append(document.body,{tag:"div",cls:"x-dlg-mask"},true);this.maskEl.enableDisplayMode("block");this.maskEl.hide();if(this.buttons.length){Roo.each(this.buttons,function(bb){b=Roo.apply({},bb);b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';if(typeof(b.listeners)=='undefined'){b.listeners={click:this.onButtonClick.createDelegate(this)};}var E=Roo.factory(b);E.onRender(this.el.select('.modal-footer div').first());},this);}var C=[];if(typeof(this.items)!='undefined'){var D=this.items;delete this.items;for(var i=0;i<D.length;i++){C.push(this.addxtype(Roo.apply({},D[i])));}}
 this.items=C;this.body=this.el.select('.modal-body',true).first();this.close=this.el.select('.modal-header .close',true).first();this.footer=this.el.select('.modal-footer',true).first();this.initEvents();},getAutoCreate:function(){var A={cls:'modal-body',html:this.html||''};var B={tag:'h4',cls:'modal-title',html:this.title};if(this.specificTitle){B=this.title;};var C={cls:"modal",style:'display: none',cn:[{cls:"modal-dialog",cn:[{cls:"modal-content",cn:[{cls:'modal-header',cn:[{tag:'button',cls:'close',html:'&times'},B]},A,{cls:'modal-footer',cn:[{tag:'div',cls:'btn-'+this.buttonPosition}]}]}]}]};if(this.animate){C.cls+=' fade';}return C;},getChildContainer:function(){return this.el.select('.modal-body',true).first();},getButtonContainer:function(){return this.el.select('.modal-footer div',true).first();},initEvents:function(){this.el.select('.modal-header .close').on('click',this.hide,this);},show:function(){if(!this.rendered){this.render();}
 this.el.setStyle('display','block');if(this.animate){var A=this;(function(){A.el.addClass('in');}).defer(50);}else {this.el.addClass('in');}
-Roo.get(document.body).addClass("x-body-masked");this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.show();this.el.setStyle('zIndex','10001');this.fireEvent('show',this);},hide:function(){this.maskEl.hide();Roo.get(document.body).removeClass("x-body-masked");this.el.removeClass('in');if(this.animate){var A=this;(function(){A.el.setStyle('display','none');}).defer(150);}else {this.el.setStyle('display','none');}
+Roo.get(document.body).addClass("x-body-masked");this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));this.maskEl.show();this.el.setStyle('zIndex','10001');this.fireEvent('show',this);},hide:function(){if(this.fireEvent("beforehide",this)===false){return;}
+this.maskEl.hide();Roo.get(document.body).removeClass("x-body-masked");this.el.removeClass('in');if(this.animate){var A=this;(function(){A.el.setStyle('display','none');}).defer(150);}else {this.el.setStyle('display','none');}
 this.fireEvent('hide',this);},addButton:function(A,cb){var b=Roo.apply({},{html:A});b.xns=b.xns||Roo.bootstrap;b.xtype=b.xtype||'Button';if(typeof(b.listeners)=='undefined'){b.listeners={click:cb.createDelegate(this)};}var B=Roo.factory(b);B.onRender(this.el.select('.modal-footer div').first());return B;},setDefaultButton:function(A){},resizeTo:function(w,h){},setContentSize:function(w,h){},onButtonClick:function(A,e){this.fireEvent('btnclick',A.name,e);},setTitle:function(A){this.el.select('.modal-title',true).first().dom.innerHTML=A;}});Roo.apply(Roo.bootstrap.Modal,{OK:[{name:'ok',weight:'primary',html:'OK'}],YESNO:[{name:'no',html:'No'},{name:'yes',weight:'primary',html:'Yes'}],OKCANCEL:[{name:'cancel',html:'Cancel'},{name:'ok',weight:'primary',html:'OK'}],YESNOCANCEL:[{name:'yes',weight:'primary',html:'Yes'},{name:'no',html:'No'},{name:'cancel',html:'Cancel'}]});
 //Roo/bootstrap/MessageBox.js
 Roo.bootstrap.MessageBox=function(){var A,B,C,D;var E,F,G,H,I,pp;var J,K,L;var M=function(Q){A.hide();Roo.callback(B.fn,B.scope||window,[Q,K.dom.value],1);};var N=function(){if(B&&B.cls){A.el.removeClass(B.cls);}};var O=function(b){var Q=0;if(!b){J["ok"].hide();J["cancel"].hide();J["yes"].hide();J["no"].hide();return Q;}