roojs-bootstrap.js
[roojs1] / roojs-bootstrap-debug.js
index f2f86d5..22c0d54 100644 (file)
@@ -10757,7 +10757,13 @@ Roo.bootstrap.ComboBox = function(config){
          * Fires when the remove value from the combobox array
             * @param {Roo.bootstrap.ComboBox} combo This combo box
             */
-        'remove' : true
+        'remove' : true,
+        /**
+         * @event specialfilter
+         * Fires when specialfilter
+            * @param {Roo.bootstrap.ComboBox} combo This combo box
+            */
+        'specialfilter' : true
         
     });
     
@@ -10806,6 +10812,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
      * mode = 'remote' or 'text' if mode = 'local')
      */
     displayField: undefined,
+    
     /**
      * @cfg {String} valueField The underlying data value name to bind to this CombBox (defaults to undefined if
      * mode = 'remote' or 'value' if mode = 'local'). 
@@ -10951,6 +10958,11 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
      */
     validClass : "has-success",
     
+    /**
+     * @cfg {Boolean} specialFilter (true|false) special filter default false
+     */
+    specialFilter : false,
+    
     //private
     addicon : false,
     editicon: false,
@@ -12062,6 +12074,13 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
                     if(forceAll){
                         this.store.clearFilter();
                     }else{
+                        
+                        if(this.specialFilter){
+                            this.fireEvent('specialfilter', this);
+                            this.onLoad();
+                            return;
+                        }
+                        
                         this.store.filter(this.displayField, q);
                     }
                     this.onLoad();
@@ -12093,7 +12112,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
         
         this.loadNext = false;
     },
-
+    
     // private
     getParams : function(q){
         var p = {};
@@ -14549,6 +14568,9 @@ Roo.extend(Roo.bootstrap.ProgressBar, Roo.bootstrap.Component,  {
  * Bootstrap Column class
  * @cfg {String} navId the navigation id (for use with navbars) - will be auto generated if it does not exist..
  * @cfg {Boolean} carousel true to make the group behave like a carousel
+ * @cfg {Number} bullets show the panel pointer.. default 0
+ * @cfg {Boolena} autoslide (true|false) auto slide .. default false
+ * @cfg {Number} timer auto slide timer .. default 0 millisecond
  * 
  * @constructor
  * Create a new TabGroup
@@ -14569,7 +14591,11 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
     
     carousel : false,
     transition : false,
-     
+    bullets : 0,
+    timer : 0,
+    autoslide : false,
+    slideFn : false,
+    
     getAutoCreate : function()
     {
         var cfg = Roo.apply({}, Roo.bootstrap.TabGroup.superclass.getAutoCreate.call(this));
@@ -14578,14 +14604,68 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
         
         if (this.carousel) {
             cfg.cls += ' carousel slide';
+            
             cfg.cn = [{
                cls : 'carousel-inner'
-            }]
-        }
+            }];
         
+            if(this.bullets > 0){
+                
+                var bullets = {
+                    cls : 'carousel-bullets',
+                    cn : []
+                };
+                
+                for (var i = 0; i < this.bullets; i++){
+                    bullets.cn.push({
+                        cls : 'bullet bullet-' + i
+                    });
+                }
+                
+                bullets.cn.push({
+                    cls : 'clear'
+                });
+                
+                cfg.cn[0].cn = bullets;
+            }
+        }
         
         return cfg;
     },
+    
+    initEvents:  function()
+    {
+        Roo.log('-------- init events on tab group ---------');
+        
+        var _this = this;
+        
+        if(this.bullets > 0){
+            
+            for (var i = 0; i < this.bullets; i++){
+                var bullet = this.el.select('.bullet-' + i, true).first();
+                
+                if(!bullet){
+                    continue;
+                }
+                
+                bullet.on('click', (function(e, el, o, ii, t){
+                    
+                    e.preventDefault();
+                    
+                    _this.showPanel(ii);
+                    
+                }).createDelegate(this, [i, bullet], true));
+                
+            }
+        }
+        
+        if(this.autoslide){
+            this.slideFn = window.setInterval(function() {
+                _this.showPanelNext();
+            }, this.timer);
+        }
+    },
+    
     getChildContainer : function()
     {
         return this.carousel ? this.el.select('.carousel-inner', true).first() : this.el;
@@ -14646,6 +14726,10 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
      */
     showPanel : function (pan)
     {
+        if(this.transition){
+            Roo.log("waiting for the transitionend");
+            return;
+        }
         
         if (typeof(pan) == 'number') {
             pan = this.tabs[pan];
@@ -14662,6 +14746,10 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
             return false;
         }
         
+        if(this.bullets > 0){
+            this.setActiveBullet(this.indexOfPanel(pan));
+        }
+        
         if (this.carousel && typeof(Roo.get(document.body).dom.style.transition) != 'undefined') {
             
             this.transition = true;
@@ -14685,29 +14773,59 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
                 _this.transition = false;
                 
             }, this, { single:  true } );
+            
             return true;
         }
         
         cur.setActive(false);
         pan.setActive(true);
+        
         return true;
         
     },
     showPanelNext : function()
     {
         var i = this.indexOfPanel(this.getActivePanel());
-        if (i > this.tabs.length) {
+        
+        if (i >= this.tabs.length - 1 && !this.autoslide) {
             return;
         }
+        
+        if (i >= this.tabs.length - 1 && this.autoslide) {
+            i = -1;
+        }
+        
         this.showPanel(this.tabs[i+1]);
     },
+    
     showPanelPrev : function()
     {
         var i = this.indexOfPanel(this.getActivePanel());
-        if (i  < 1) {
+        
+        if (i  < 1 && !this.autoslide) {
             return;
         }
+        
+        if (i < 1 && this.autoslide) {
+            i = this.tabs.length;
+        }
+        
         this.showPanel(this.tabs[i-1]);
+    },
+    
+    setActiveBullet : function(i)
+    {
+        Roo.each(this.el.select('.bullet', true).elements, function(el){
+            el.removeClass('selected');
+        });
+
+        var bullet = this.el.select('.bullet-' + i, true).first();
+        
+        if(!bullet){
+            return;
+        }
+        
+        bullet.addClass('selected');
     }
     
     
@@ -14833,7 +14951,14 @@ Roo.extend(Roo.bootstrap.TabPanel, Roo.bootstrap.Component,  {
             var tg = Roo.bootstrap.TabGroup.get(this.navId);
             Roo.log(['register', tg, this]);
             tg.register(this);
+            
+            var i = tg.tabs.length - 1;
+            
+            if(this.active && tg.bullets > 0 && i < tg.bullets){
+                tg.setActiveBullet(i);
+            }
         }
+        
     },
     
     
@@ -14860,6 +14985,7 @@ Roo.extend(Roo.bootstrap.TabPanel, Roo.bootstrap.Component,  {
         } else  if (!this.el.hasClass('active')) {
             this.el.addClass('active');
         }
+        
         this.fireEvent('changed', this, state);
     }