roojs-bootstrap.js
authorAlan Knowles <alan@roojs.com>
Tue, 15 Jan 2019 03:01:46 +0000 (11:01 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 15 Jan 2019 03:01:46 +0000 (11:01 +0800)
roojs-bootstrap-debug.js

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

index 2bcdb19..bf0f2b1 100644 (file)
@@ -2268,7 +2268,7 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component,  {
     isVisible : function(){
         return !this.hidden;
     },
-     onMouseOut : function(e){
+    onMouseOut : function(e){
         var t  = this.findTargetItem(e);
         
         //if(t ){
@@ -3878,46 +3878,7 @@ Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component,  {
     initEvents :function ()
     {
         //Roo.log(this.el.select('.navbar-toggle',true));
-        this.el.select('.navbar-toggle',true).on('click', function() {
-            if(this.fireEvent('beforetoggle', this) !== false){
-                var ce = this.el.select('.navbar-collapse',true).first();
-                ce.toggleClass('in'); // old...
-                if (ce.hasClass('collapse')) {
-                    // show it...
-                    ce.removeClass('collapse');
-                    ce.addClass('show');
-                    var h = ce.getHeight();
-                    Roo.log(h);
-                    ce.removeClass('show');
-                    // at this point we should be able to see it..
-                    ce.addClass('collapsing');
-                    
-                    ce.setHeight(0); // resize it ...
-                    ce.on('transitionend', function() {
-                        Roo.log('done transition');
-                        ce.removeClass('collapsing');
-                        ce.addClass('show');
-                        ce.removeClass('collapse');
-
-                        ce.dom.style.height = '';
-                    }, this, { single: true} );
-                    ce.setHeight(h);
-                    
-                } else {
-                    ce.setHeight(ce.getHeight());
-                    ce.removeClass('show');
-                    ce.addClass('collapsing');
-                    
-                    ce.on('transitionend', function() {
-                        ce.dom.style.height = '';
-                        ce.removeClass('collapsing');
-                        ce.addClass('collapse');
-                    }, this, { single: true} );
-                    ce.setHeight(0);
-                }
-            }
-            
-        }, this);
+        this.el.select('.navbar-toggle',true).on('click', this.onToggle , this);
         
         var mark = {
             tag: "div",
@@ -3954,8 +3915,69 @@ Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component,  {
     unmask : function()
     {
         this.maskEl.hide();
-    } 
+    },
+    onToggle : function()
+    {
+        
+        if(this.fireEvent('beforetoggle', this) === false){
+            return;
+        }
+        var ce = this.el.select('.navbar-collapse',true).first();
+      
+        if (ce.hasClass('collapse')) {
+           this.expand();
+        } else {
+            this.collapse();
+        }
+        
+        
     
+    },
+    /**
+     * Expand the navbar pulldown 
+     */
+    expand : function ()
+    {
+        var ce = this.el.select('.navbar-collapse',true).first();
+               // show it...
+        ce.addClass('in'); // old...
+        ce.removeClass('collapse');
+        ce.addClass('show');
+        var h = ce.getHeight();
+        Roo.log(h);
+        ce.removeClass('show');
+        // at this point we should be able to see it..
+        ce.addClass('collapsing');
+        
+        ce.setHeight(0); // resize it ...
+        ce.on('transitionend', function() {
+            //Roo.log('done transition');
+            ce.removeClass('collapsing');
+            ce.addClass('show');
+            ce.removeClass('collapse');
+
+            ce.dom.style.height = '';
+        }, this, { single: true} );
+        ce.setHeight(h);
+    },
+    /**
+     * Collapse the navbar pulldown 
+     */
+    collapse : function()
+    {
+        var ce = this.el.select('.navbar-collapse',true).first();
+        ce.removeClass('in'); // old...
+        ce.setHeight(ce.getHeight());
+        ce.removeClass('show');
+        ce.addClass('collapsing');
+        
+        ce.on('transitionend', function() {
+            ce.dom.style.height = '';
+            ce.removeClass('collapsing');
+            ce.addClass('collapse');
+        }, this, { single: true} );
+        ce.setHeight(0);
+    }
     
     
     
@@ -12989,15 +13011,18 @@ var myReader = new Roo.data.ArrayReader({
  * <pre><code>
 [ [1, 'Bill', 'Gardener'], [2, 'Ben', 'Horticulturalist'] ]
   </code></pre>
- * @cfg {String} id (optional) The subscript within row Array that provides an ID for the Record
  * @constructor
  * Create a new JsonReader
  * @param {Object} meta Metadata configuration options.
- * @param {Object} recordType Either an Array of field definition objects
+ * @param {Object|Array} recordType Either an Array of field definition objects
+ * 
  * @cfg {Array} fields Array of field definition objects
  * @cfg {String} id Name of the property within a row object that contains a record identifier value.
  * as specified to {@link Roo.data.Record#create},
  * or an {@link Roo.data.Record} object
+ *
+ * 
  * created using {@link Roo.data.Record#create}.
  */
 Roo.data.ArrayReader = function(meta, recordType){
@@ -13010,7 +13035,7 @@ Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, {
     /**
      * Create a data block containing Roo.data.Records from an XML document.
      * @param {Object} o An Array of row objects which represents the dataset.
-     * @return {Object} data A data block which is used by an Roo.data.Store object as
+     * @return {Object} A data block which is used by an {@link Roo.data.Store} object as
      * a cache of Roo.data.Records.
      */
     readRecords : function(o){
index 57ca6fb..643e556 100644 (file)
@@ -153,11 +153,12 @@ H.hide();}I.setDisplayed(B.progress===true);if(B.progress){d.animate=false;}this
 Roo.Msg=Roo.Msg||Roo.MessageBox;
 // Roo/bootstrap/Navbar.js
 Roo.bootstrap.Navbar=function(A){Roo.bootstrap.Navbar.superclass.constructor.call(this,A);this.addEvents({"beforetoggle":true});};Roo.extend(Roo.bootstrap.Navbar,Roo.bootstrap.Component,{navItems:false,loadMask:false,getAutoCreate:function(){throw {message:"nav bar is now a abstract base class - use NavSimplebar / NavHeaderbar / NavSidebar etc..."}
-;},initEvents:function(){this.el.select('.navbar-toggle',true).on('click',function(){if(this.fireEvent('beforetoggle',this)!==false){var ce=this.el.select('.navbar-collapse',true).first();ce.toggleClass('in');if(ce.hasClass('collapse')){ce.removeClass('collapse');
-ce.addClass('show');var h=ce.getHeight();Roo.log(h);ce.removeClass('show');ce.addClass('collapsing');ce.setHeight(0);ce.on('transitionend',function(){Roo.log('done transition');ce.removeClass('collapsing');ce.addClass('show');ce.removeClass('collapse');ce.dom.style.height='';
-},this,{single:true});ce.setHeight(h);}else{ce.setHeight(ce.getHeight());ce.removeClass('show');ce.addClass('collapsing');ce.on('transitionend',function(){ce.dom.style.height='';ce.removeClass('collapsing');ce.addClass('collapse');},this,{single:true});ce.setHeight(0);
-}}},this);var A={tag:"div",cls:"x-dlg-mask"};this.maskEl=Roo.DomHelper.append(this.el,A,true);var B=this.el.getSize();this.maskEl.setSize(B.width,B.height);this.maskEl.enableDisplayMode("block");this.maskEl.hide();if(this.loadMask){this.maskEl.show();}},getChildContainer:function(){if(this.el&&this.el.select('.collapse').getCount()){return this.el.select('.collapse',true).first();
-}return this.el;},mask:function(){this.maskEl.show();},unmask:function(){this.maskEl.hide();}});
+;},initEvents:function(){this.el.select('.navbar-toggle',true).on('click',this.onToggle,this);var A={tag:"div",cls:"x-dlg-mask"};this.maskEl=Roo.DomHelper.append(this.el,A,true);var B=this.el.getSize();this.maskEl.setSize(B.width,B.height);this.maskEl.enableDisplayMode("block");
+this.maskEl.hide();if(this.loadMask){this.maskEl.show();}},getChildContainer:function(){if(this.el&&this.el.select('.collapse').getCount()){return this.el.select('.collapse',true).first();}return this.el;},mask:function(){this.maskEl.show();},unmask:function(){this.maskEl.hide();
+},onToggle:function(){if(this.fireEvent('beforetoggle',this)===false){return;}var ce=this.el.select('.navbar-collapse',true).first();if(ce.hasClass('collapse')){this.expand();}else{this.collapse();}},expand:function(){var ce=this.el.select('.navbar-collapse',true).first();
+ce.addClass('in');ce.removeClass('collapse');ce.addClass('show');var h=ce.getHeight();Roo.log(h);ce.removeClass('show');ce.addClass('collapsing');ce.setHeight(0);ce.on('transitionend',function(){ce.removeClass('collapsing');ce.addClass('show');ce.removeClass('collapse');
+ce.dom.style.height='';},this,{single:true});ce.setHeight(h);},collapse:function(){var ce=this.el.select('.navbar-collapse',true).first();ce.removeClass('in');ce.setHeight(ce.getHeight());ce.removeClass('show');ce.addClass('collapsing');ce.on('transitionend',function(){ce.dom.style.height='';
+ce.removeClass('collapsing');ce.addClass('collapse');},this,{single:true});ce.setHeight(0);}});
 // Roo/bootstrap/NavSimplebar.js
 Roo.bootstrap.NavSimplebar=function(A){Roo.bootstrap.NavSimplebar.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.NavSimplebar,Roo.bootstrap.Navbar,{inverse:false,type:false,arrangement:'',align:false,weight:'light',main:false,tag:false,getAutoCreate:function(){var A={tag:this.tag||'div',cls:'navbar navbar-expand-lg roo-navbar-simple'}
 ;if(['light','white'].indexOf(this.weight)>-1){A.cls+=['light','white'].indexOf(this.weight)>-1?' navbar-light':' navbar-dark';}A.cls+=' bg-'+this.weight;if(this.inverse){A.cls+=' navbar-inverse';}A.cn=[{cls:'nav',tag:'ul'}];this.type=this.type||'nav';if(['tabs','pills'].indexOf(this.type)!=-1){A.cn[0].cls+=' nav-'+this.type}