Roo/bootstrap/Modal.js
authorAlan Knowles <alan@roojs.com>
Fri, 27 Jul 2018 05:32:20 +0000 (13:32 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 27 Jul 2018 05:32:20 +0000 (13:32 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/Modal.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index dd537fe..5f63298 100644 (file)
@@ -197,9 +197,8 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         }
 
         var modal = {
-            cls: "modal",
-            style : 'display: none',
-            cn : [
+            cls: "modal hidden",
+             cn : [
                 {
                     cls: "modal-dialog " + size,
                     cn : [
@@ -284,8 +283,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
 
         //this.el.setStyle('display', 'block');
         this.el.removeClass('hidden');
-        this.el.addClass('show');
-
         if(this.animate){  // element has 'fade'  - so stuff happens after .3s ?- not sure why the delay?
             var _this = this;
             (function(){
@@ -332,12 +330,10 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
 
             if(this.animate){ // why
                 (function(){
-                    this.el.removeClass('show');
-                    this.el.addClass('hidden');
+                     this.el.addClass('hidden');
                 }).defer(150,this);
             }else{
-                this.el.removeClass('show');
-                this.el.addClass('hidden');
+                 this.el.addClass('hidden');
             }
             this.fireEvent('hide', this);
         }
@@ -345,7 +341,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     isVisible : function()
     {
         
-        return this.el.hasClass('show');
+        return !this.el.hasClass('hidden');
         
     },
 
index 0ef7383..9e67f98 100644 (file)
@@ -2752,9 +2752,8 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
         }
 
         var modal = {
-            cls: "modal",
-            style : 'display: none',
-            cn : [
+            cls: "modal hidden",
+             cn : [
                 {
                     cls: "modal-dialog " + size,
                     cn : [
@@ -2839,8 +2838,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
 
         //this.el.setStyle('display', 'block');
         this.el.removeClass('hidden');
-        this.el.addClass('show');
-
         if(this.animate){  // element has 'fade'  - so stuff happens after .3s ?- not sure why the delay?
             var _this = this;
             (function(){
@@ -2887,12 +2885,10 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
 
             if(this.animate){ // why
                 (function(){
-                    this.el.removeClass('show');
-                    this.el.addClass('hidden');
+                     this.el.addClass('hidden');
                 }).defer(150,this);
             }else{
-                this.el.removeClass('show');
-                this.el.addClass('hidden');
+                 this.el.addClass('hidden');
             }
             this.fireEvent('hide', this);
         }
@@ -2900,7 +2896,7 @@ Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component,  {
     isVisible : function()
     {
         
-        return this.el.hasClass('show');
+        return !this.el.hasClass('hidden');
         
     },
 
index 3b8dc0f..358e1d7 100644 (file)
@@ -108,18 +108,18 @@ if(!this.el){var B=Roo.apply({},this.getAutoCreate());B.id=Roo.id();if(this.cls)
 this.footerEl=this.el.select('.modal-footer',true).first();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){var 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.render(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.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=[];if(this.allow_close){C.push({tag:'button',cls:'close',html:'&times'});}C.push(B);var D='';if(this.size.length){D='modal-'+this.size;}var E={cls:"modal",style:'display: none',cn:[{cls:"modal-dialog "+D,cn:[{cls:"modal-content",cn:[{cls:'modal-header',cn:C}
-,A,{cls:'modal-footer',cn:[{tag:'div',cls:'btn-'+this.buttonPosition}]}]}]}]};if(this.animate){E.cls+=' fade';}return E;},getChildContainer:function(){return this.bodyEl;},getButtonContainer:function(){return this.el.select('.modal-footer div',true).first();
-},initEvents:function(){if(this.allow_close){this.closeEl.on('click',this.hide,this);}Roo.EventManager.onWindowResize(this.resize,this,true);},resize:function(){this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));if(this.fitwindow){var w=this.width||Roo.lib.Dom.getViewportWidth(true)-30;
-var h=this.height||Roo.lib.Dom.getViewportHeight(true)-60;this.setSize(w,h);}},setSize:function(w,h){if(!w&&!h){return;}this.resizeTo(w,h);},show:function(){if(!this.rendered){this.render();}this.el.removeClass('hidden');this.el.addClass('show');if(this.animate){var A=this;
-(function(){this.el.addClass('in');}).defer(50,this);}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.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);
-this.maskEl.show();this.resize();this.fireEvent('show',this);this.el.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);(function(){this.items.forEach(function(e){e.layout?e.layout():false;});}).defer(100,this);},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.maskEl.hide();
-Roo.get(document.body).removeClass("x-body-masked");this.el.removeClass('in');this.el.select('.modal-dialog',true).first().setStyle('transform','');if(this.animate){(function(){this.el.removeClass('show');this.el.addClass('hidden');}).defer(150,this);}else{this.el.removeClass('show');
-this.el.addClass('hidden');}this.fireEvent('hide',this);}},isVisible:function(){return this.el.hasClass('show');},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.render(this.el.select('.modal-footer div').first());return B;},setDefaultButton:function(A){},diff:false,resizeTo:function(w,h){this.dialogEl.setWidth(w);if(this.diff===false){this.diff=this.dialogEl.getHeight()-this.bodyEl.getHeight();
-}this.bodyEl.setHeight(h-this.diff);this.fireEvent('resize',this);},setContentSize:function(w,h){},onButtonClick:function(A,e){this.fireEvent('btnclick',A.name,e);},setTitle:function(A){this.titleEl.dom.innerHTML=A;},setBody:function(A){this.bodyEl.dom.innerHTML=A;
-},applyBody:function(A){if(!this.tmpl){Roo.log("Error - using apply Body without a template");}this.tmpl.overwrite(this.bodyEl,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'}],zIndex:10001});
+};var C=[];if(this.allow_close){C.push({tag:'button',cls:'close',html:'&times'});}C.push(B);var D='';if(this.size.length){D='modal-'+this.size;}var E={cls:"modal hidden",cn:[{cls:"modal-dialog "+D,cn:[{cls:"modal-content",cn:[{cls:'modal-header',cn:C},A,{cls:'modal-footer',cn:[{tag:'div',cls:'btn-'+this.buttonPosition}
+]}]}]}]};if(this.animate){E.cls+=' fade';}return E;},getChildContainer:function(){return this.bodyEl;},getButtonContainer:function(){return this.el.select('.modal-footer div',true).first();},initEvents:function(){if(this.allow_close){this.closeEl.on('click',this.hide,this);
+}Roo.EventManager.onWindowResize(this.resize,this,true);},resize:function(){this.maskEl.setSize(Roo.lib.Dom.getViewWidth(true),Roo.lib.Dom.getViewHeight(true));if(this.fitwindow){var w=this.width||Roo.lib.Dom.getViewportWidth(true)-30;var h=this.height||Roo.lib.Dom.getViewportHeight(true)-60;
+this.setSize(w,h);}},setSize:function(w,h){if(!w&&!h){return;}this.resizeTo(w,h);},show:function(){if(!this.rendered){this.render();}this.el.removeClass('hidden');if(this.animate){var A=this;(function(){this.el.addClass('in');}).defer(50,this);}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.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);this.maskEl.show();this.resize();this.fireEvent('show',this);
+this.el.setStyle('z-index',Roo.bootstrap.Modal.zIndex++);(function(){this.items.forEach(function(e){e.layout?e.layout():false;});}).defer(100,this);},hide:function(){if(this.fireEvent("beforehide",this)!==false){this.maskEl.hide();Roo.get(document.body).removeClass("x-body-masked");
+this.el.removeClass('in');this.el.select('.modal-dialog',true).first().setStyle('transform','');if(this.animate){(function(){this.el.addClass('hidden');}).defer(150,this);}else{this.el.addClass('hidden');}this.fireEvent('hide',this);}},isVisible:function(){return !this.el.hasClass('hidden');
+},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.render(this.el.select('.modal-footer div').first());
+return B;},setDefaultButton:function(A){},diff:false,resizeTo:function(w,h){this.dialogEl.setWidth(w);if(this.diff===false){this.diff=this.dialogEl.getHeight()-this.bodyEl.getHeight();}this.bodyEl.setHeight(h-this.diff);this.fireEvent('resize',this);},setContentSize:function(w,h){}
+,onButtonClick:function(A,e){this.fireEvent('btnclick',A.name,e);},setTitle:function(A){this.titleEl.dom.innerHTML=A;},setBody:function(A){this.bodyEl.dom.innerHTML=A;},applyBody:function(A){if(!this.tmpl){Roo.log("Error - using apply Body without a template");
+}this.tmpl.overwrite(this.bodyEl,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'}],zIndex:10001});
 // 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.footerEl.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;