roojs-bootstrap.js
authorEdward <edward@roojs.com>
Fri, 27 Mar 2015 02:54:38 +0000 (10:54 +0800)
committerEdward <edward@roojs.com>
Fri, 27 Mar 2015 02:54:38 +0000 (10:54 +0800)
roojs-bootstrap-debug.js

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

index 4562370..42969fa 100644 (file)
@@ -2029,6 +2029,7 @@ Roo.extend(Roo.bootstrap.MenuSeparator, Roo.bootstrap.Component,  {
  * @cfg {Boolean} specificTitle (true|false) default false
  * @cfg {Array} buttons Array of buttons or standard button set..
  * @cfg {String} buttonPosition (left|right|center) default right
+ * @cfg {Boolean} animate (true | false) default true
  * 
  * @constructor
  * Create a new Modal Dialog
@@ -2062,6 +2063,8 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     
     buttonPosition: 'right',
     
+    animate : true,
+    
     onRender : function(ct, position)
     {
         Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
@@ -2150,8 +2153,8 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
             title = this.title;
         };
         
-        return modal = {
-            cls: "modal fade",
+        var modal = {
+            cls: "modal",
             style : 'display: none',
             cn : [
                 {
@@ -2191,9 +2194,13 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
                         
                 }
             ]
-            
-            
         };
+        
+        if(this.animate){
+            modal.cls += ' fade';
+        }
+        
+        return modal;
           
     },
     getChildContainer : function() {
@@ -2216,10 +2223,16 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         if (!this.rendered) {
             this.render();
         }
-       
-        this.el.addClass('on');
-        this.el.removeClass('fade');
+        
         this.el.setStyle('display', 'block');
+        
+        if(this.animate){
+            var _this = this;
+            (function(){ _this.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();
@@ -2233,9 +2246,15 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         Roo.log('Modal hide?!');
         this.maskEl.hide();
         Roo.get(document.body).removeClass("x-body-masked");
-        this.el.removeClass('on');
-        this.el.addClass('fade');
-        this.el.setStyle('display', 'none');
+        this.el.removeClass('in');
+        
+        if(this.animate){
+            var _this = this;
+            (function(){ _this.el.setStyle('display', 'none'); }).defer(150);
+        }else{
+            this.el.setStyle('display', 'none');
+        }
+        
         this.fireEvent('hide', this);
     },
     
index fc53c32..87cfb75 100644 (file)
@@ -55,11 +55,13 @@ A.cn[0].href=this.href||A.cn[0].href;A.cn[0].html=this.html||A.cn[0].html;return
 //Roo/bootstrap/MenuSeparator.js
 Roo.bootstrap.MenuSeparator=function(A){Roo.bootstrap.MenuSeparator.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.MenuSeparator,Roo.bootstrap.Component,{getAutoCreate:function(){var A={cls:'divider',tag:'li'};return A;}});
 //Roo/bootstrap/Modal.js
-Roo.bootstrap.Modal=function(A){Roo.bootstrap.Modal.superclass.constructor.call(this,A);this.addEvents({"btnclick":true});this.buttons=this.buttons||[];};Roo.extend(Roo.bootstrap.Modal,Roo.bootstrap.Component,{title:'test dialog',buttons:false,body:false,specificTitle:false,buttonPosition:'right',onRender:function(ct,A){Roo.bootstrap.Component.superclass.onRender.call(this,ct,A);if(!this.el){var B=Roo.apply({},this.getAutoCreate());B.id=Roo.id();if(this.cls){B.cls+=' '+this.cls;}if(this.style){B.style=this.style;}
+Roo.bootstrap.Modal=function(A){Roo.bootstrap.Modal.superclass.constructor.call(this,A);this.addEvents({"btnclick":true});this.buttons=this.buttons||[];};Roo.extend(Roo.bootstrap.Modal,Roo.bootstrap.Component,{title:'test dialog',buttons:false,body:false,specificTitle:false,buttonPosition:'right',animate:true,onRender:function(ct,A){Roo.bootstrap.Component.superclass.onRender.call(this,ct,A);if(!this.el){var B=Roo.apply({},this.getAutoCreate());B.id=Roo.id();if(this.cls){B.cls+=' '+this.cls;}if(this.style){B.style=this.style;}
 this.el=Roo.get(document.body).createChild(B,A);}if(this.tabIndex!==undefined){this.el.dom.setAttribute('tabIndex',this.tabIndex);}
 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;};return modal={cls:"modal fade",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}]}]}]}]};},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.addClass('on');this.el.removeClass('fade');this.el.setStyle('display','block');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(){Roo.log('Modal hide?!');this.maskEl.hide();Roo.get(document.body).removeClass("x-body-masked");this.el.removeClass('on');this.el.addClass('fade');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'}]});
+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(){Roo.log('Modal hide?!');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;}
 A.footer.dom.style.display='';for(var k in J){if(typeof J[k]!="function"){if(b[k]){J[k].show();J[k].setText(typeof b[k]=="string"?b[k]:Roo.bootstrap.MessageBox.buttonText[k]);Q+=J[k].el.getWidth()+15;}else {J[k].hide();}}}return Q;};var P=function(d,k,e){if(B&&B.closable!==false){A.hide();}if(e){e.stopEvent();}};return {getDialog:function(){if(!A){A=new Roo.bootstrap.Modal({closeClick:function(){if(B&&B.buttons&&B.buttons.no&&!B.buttons.cancel){M("no");}else {M("cancel");}}});A.render();A.on("hide",N);C=A.mask;J={};this.buttons=J;var bt=this.buttonText;J["ok"]=A.addButton(bt["ok"],M.createCallback("ok"));J["yes"]=A.addButton(bt["yes"],M.createCallback("yes"));J["no"]=A.addButton(bt["no"],M.createCallback("no"));J["cancel"]=A.addButton(bt["cancel"],M.createCallback("cancel"));Roo.log(J)