docs/default.css
[roojs1] / roojs-bootstrap-debug.js
index 9fca23a..95f44c3 100644 (file)
@@ -1842,14 +1842,19 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component,  {
         }
         if(_e !== false){
             this.fireEvent("beforeshow", this);
-            
             //xy = this.el.adjustForConstraints(xy);
         }
-        //this.el.setXY(xy);
+        
         //this.el.show();
         this.hideMenuItems();
         this.hidden = false;
         this.triggerEl.addClass('open');
+        
+        if(this.el.getWidth() + xy[0] > Roo.lib.Dom.getViewWidth()){
+            xy[0] = xy[0] - this.el.getWidth() + this.triggerEl.getWidth();
+        }
+        
+        this.el.setXY(xy);
         this.focus();
         this.fireEvent("show", this);
     },
@@ -3764,7 +3769,7 @@ Roo.apply(Roo.bootstrap.NavGroup, {
  * @cfg {Boolean} preventDefault (true | false) default false
  * @cfg {String} tabId the tab that this item activates.
  * @cfg {String} tagtype (a|span) render as a href or span?
- * @cfg {Boolean} animateRef (true|false) link to element default false
+ * @cfg {Boolean} animateRef (true|false) link to element default false  
   
  * @constructor
  * Create a new Navbar Item
@@ -3885,9 +3890,9 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
     {
         if(
                 this.preventDefault || 
-                this.href == '#' ||
-                (this.animateRef && this.href.charAt(0) == '#')
+                this.href == '#' 
         ){
+            
             e.preventDefault();
         }
         
@@ -3901,7 +3906,9 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
             return;
         }
         
-        Roo.log("fire event clicked");
+        
+        
+        //Roo.log("fire event clicked");
         if(this.fireEvent('click', this, e) === false){
             return;
         };
@@ -3910,23 +3917,28 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
             return;
         }
         
-        if(this.animateRef && this.href.charAt(0) == '#'){
+        //Roo.log(this.href);
+        var ael = this.el.select('a',true).first();
+        //Roo.log(ael);
+        
+        if(ael && this.animateRef && this.href.indexOf('#') > -1){
+            //Roo.log(["test:",ael.dom.href.split("#")[0], document.location.toString().split("#")[0]]);
+            if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
+                return; // ignore... - it's a 'hash' to another page.
+            }
+            
+            e.preventDefault();
             this.scrollToElement(e);
-            return;
         }
         
-        var p = this.parent();
+        
+        var p =  this.parent();
+   
         if (['tabs','pills'].indexOf(p.type)!==-1) {
             if (typeof(p.setActiveItem) !== 'undefined') {
                 p.setActiveItem(this);
             }
         }
-        // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
-        if (p.parentType == 'NavHeaderbar' && !this.menu) {
-            // remove the collapsed menu expand...
-            p.parent().el.select('.navbar-collapse',true).removeClass('in');  
-        }
-        
     },
     
     isActive: function () {
@@ -4007,7 +4019,7 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
     {
         var c = document.body;
         
-        var target = Roo.get(c).select('a[name=' + this.href.replace('#', '') +']', true).first();
+        var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
         
         if(!target){
             return;
@@ -4176,6 +4188,8 @@ Roo.extend(Roo.bootstrap.Row, Roo.bootstrap.Component,  {
  * @cfg {String} html contents of the element
  * @cfg {String} tag tag of the element
  * @cfg {String} cls class of the element
+ * @cfg {Boolean} preventDefault (true|false) default false
+ * @cfg {Boolean} clickable (true|false) default false
  * 
  * @constructor
  * Create a new Element
@@ -4184,6 +4198,17 @@ Roo.extend(Roo.bootstrap.Row, Roo.bootstrap.Component,  {
 
 Roo.bootstrap.Element = function(config){
     Roo.bootstrap.Element.superclass.constructor.call(this, config);
+    
+    this.addEvents({
+        // raw events
+        /**
+         * @event click
+         * When a element is chick
+         * @param {Roo.bootstrap.Element} this
+         * @param {Roo.EventObject} e
+         */
+        "click" : true
+    });
 };
 
 Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
@@ -4191,7 +4216,8 @@ Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
     tag: 'div',
     cls: '',
     html: '',
-     
+    preventDefault: false, 
+    clickable: false,
     
     getAutoCreate : function(){
         
@@ -4201,11 +4227,28 @@ Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component,  {
             html: this.html
         }
         
-        
-       
         return cfg;
     },
     
+    initEvents: function() 
+    {
+        Roo.bootstrap.Element.superclass.initEvents.call(this);
+        
+        if(this.clickable){
+            this.el.on('click', this.onClick, this);
+        }
+        
+    },
+    
+    onClick : function(e)
+    {
+        if(this.preventDefault){
+            e.preventDefault();
+        }
+        
+        this.fireEvent('click', this, e);
+    },
+    
     getValue : function()
     {
         return this.el.dom.innerHTML;
@@ -5537,6 +5580,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
                 c.style += ' width:' + config.width + 'px;';
             }
             
+            if(typeof(config.cls) != 'undefined'){
+                c.cls = (typeof(c.cls) == 'undefined') ? config.cls : (c.cls + ' ' + config.cls);
+            }
+            
             header.cn.push(c)
         }
         
@@ -5809,6 +5856,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
             if(typeof(config.cursor) != 'undefined'){
                 td.style += ' cursor:' +  config.cursor + ';';
             }
+            
+            if(typeof(config.cls) != 'undefined'){
+                td.cls = (typeof(td.cls) == 'undefined') ? config.cls : (td.cls + ' ' + config.cls);
+            }
              
             row.cn.push(td);
            
@@ -7437,6 +7488,22 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
         
         var inputblock = input;
         
+        var feedback = {
+            tag: 'span',
+            cls: 'glyphicon form-control-feedback'
+        };
+            
+        if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
+            
+            inputblock = {
+                cls : 'has-feedback',
+                cn :  [
+                    input,
+                    feedback
+                ] 
+            };  
+        }
+        
         if (this.before || this.after) {
             
             inputblock = {
@@ -7480,16 +7547,13 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
                         (this.after.xtype == 'Button' ? 'btn' : 'addon')  //?? what about checkboxes - that looks like a bit of a hack thought? 
                 });
             }
+            
+            if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
+                inputblock.cls += ' has-feedback';
+                inputblock.cn.push(feedback);
+            }
         };
         
-        if(this.hasFeedback && this.inputType != 'hidden' && !this.allowBlank){
-            inputblock.cls += ' has-feedback';
-            inputblock.cn.push({
-                tag: 'span',
-                cls: 'glyphicon form-control-feedback'
-            });
-        }
-        
         if (align ==='left' && this.fieldLabel.length) {
                 Roo.log("left and has label");
                 cfg.cn = [
@@ -12068,7 +12132,12 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
                         
                         this.store.filter(this.displayField, q);
                     }
+                    
+                    this.store.fireEvent("datachanged", this.store);
+                    
                     this.onLoad();
+                    
+                    
                 }else{
                     
                     this.store.baseParams[this.queryParam] = q;
@@ -12450,6 +12519,8 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
         if(this.hiddenField){
             this.hiddenField.dom.value = this.value;
         }
+        
+        this.store.fireEvent("datachanged", this.store);
     },
     
     clearItem : function()
@@ -14587,6 +14658,8 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
         
         cfg.cls += ' tab-content';
         
+        Roo.log('get auto create...............');
+        
         if (this.carousel) {
             cfg.cls += ' carousel slide';
             
@@ -14597,10 +14670,14 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
             if(this.bullets > 0){
                 
                 var bullets = {
-                    cls : 'carousel-bullets',
+                    cls : 'carousel-bullets hidden-xs',
                     cn : []
                 };
                 
+                if(this.bullets_cls){
+                    bullets.cls = bullets.cls + ' ' + this.bullets_cls;
+                }
+                
                 for (var i = 0; i < this.bullets; i++){
                     bullets.cn.push({
                         cls : 'bullet bullet-' + i
@@ -14639,8 +14716,14 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
                     
                     _this.showPanel(ii);
                     
+                    if(_this.autoslide && _this.slideFn){
+                        clearInterval(_this.slideFn);
+                        _this.slideFn = window.setInterval(function() {
+                            _this.showPanelNext();
+                        }, _this.timer);
+                    }
+                    
                 }).createDelegate(this, [i, bullet], true));
-                
             }
         }