roojs-bootstrap.js
authoredward <edward@roojs.com>
Mon, 9 Nov 2015 03:59:00 +0000 (11:59 +0800)
committeredward <edward@roojs.com>
Mon, 9 Nov 2015 03:59:00 +0000 (11:59 +0800)
roojs-bootstrap-debug.js

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

index f94d3ba..5d00d4b 100644 (file)
@@ -14550,6 +14550,7 @@ Roo.extend(Roo.bootstrap.ProgressBar, Roo.bootstrap.Component,  {
  * @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 {Number} timer auto slide timer .. default 0 second
  * 
  * @constructor
  * Create a new TabGroup
@@ -14571,6 +14572,7 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
     carousel : false,
     transition : false,
     bullets : 0,
+    timer : 0,
      
     getAutoCreate : function()
     {
@@ -14641,6 +14643,12 @@ Roo.extend(Roo.bootstrap.TabGroup, Roo.bootstrap.Column,  {
                 
             }
         }
+        
+        if(this.timer > 0){
+            window.setInterval(function() {
+                _this.showPanelNext();
+            }, this.timer * 1000);
+        }
     },
     
     getChildContainer : function()
index 85dceb4..a59570e 100644 (file)
@@ -333,10 +333,10 @@ Roo.bootstrap.Progress=function(A){Roo.bootstrap.Progress.superclass.constructor
 Roo.bootstrap.ProgressBar=function(A){Roo.bootstrap.ProgressBar.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.ProgressBar,Roo.bootstrap.Component,{aria_valuenow:0,aria_valuemin:0,aria_valuemax:100,label:false,panel:false,role:false,sr_only:false,getAutoCreate:function(){var A={tag:'div',cls:'progress-bar',style:'width:'+Math.ceil((this.aria_valuenow/this.aria_valuemax)*100)+'%'};if(this.sr_only){A.cn={tag:'span',cls:'sr-only',html:this.sr_only}}if(this.role){A.role=this.role;}if(this.aria_valuenow){A['aria-valuenow']=this.aria_valuenow;}if(this.aria_valuemin){A['aria-valuemin']=this.aria_valuemin;}if(this.aria_valuemax){A['aria-valuemax']=this.aria_valuemax;}if(this.label&&!this.sr_only){A.html=this.label;}if(this.panel){A.cls+=' progress-bar-'+this.panel;}return A;},update:function(A){this.aria_valuenow=A;this.el.setStyle('width',Math.ceil((this.aria_valuenow/this.aria_valuemax)*100)+'%');}});
 //Roo/bootstrap/TabGroup.js
 Roo.bootstrap.TabGroup=function(A){Roo.bootstrap.TabGroup.superclass.constructor.call(this,A);if(!this.navId){this.navId=Roo.id();}
-this.tabs=[];Roo.bootstrap.TabGroup.register(this);};Roo.extend(Roo.bootstrap.TabGroup,Roo.bootstrap.Column,{carousel:false,transition:false,bullets:0,getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.TabGroup.superclass.getAutoCreate.call(this));A.cls+=' tab-content';if(this.carousel){A.cls+=' carousel slide';A.cn=[{cls:'carousel-inner'}];if(this.bullets>0){var B={cls:'carousel-bullets',cn:[]};for(var i=0;i<this.bullets;i++){B.cn.push({cls:'bullet bullet-'+i});}
+this.tabs=[];Roo.bootstrap.TabGroup.register(this);};Roo.extend(Roo.bootstrap.TabGroup,Roo.bootstrap.Column,{carousel:false,transition:false,bullets:0,timer:0,getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.TabGroup.superclass.getAutoCreate.call(this));A.cls+=' tab-content';if(this.carousel){A.cls+=' carousel slide';A.cn=[{cls:'carousel-inner'}];if(this.bullets>0){var B={cls:'carousel-bullets',cn:[]};for(var i=0;i<this.bullets;i++){B.cn.push({cls:'bullet bullet-'+i});}
 B.cn.push({cls:'clear'});A.cn[0].cn=B;}}return A;},initEvents:function(){Roo.log('-------- init events on tab group ---------');var A=this;if(this.bullets>0){for(var i=0;i<this.bullets;i++){var B=this.el.select('.bullet-'+i,true).first();if(!B){continue;}
 B.on('click',(function(e,el,o,ii,t){e.preventDefault();if(A.transition){Roo.log("waiting for the transitionend");return;}
-A.showPanel(ii);A.setActiveBullet(ii);}).createDelegate(this,[i,B],true));}}},getChildContainer:function(){return this.carousel?this.el.select('.carousel-inner',true).first():this.el;},register:function(A){this.tabs.push(A);A.navId=this.navId;},getActivePanel:function(){var r=false;Roo.each(this.tabs,function(t){if(t.active){r=t;return false;}return null;});return r;},getPanelByName:function(n){var r=false;Roo.each(this.tabs,function(t){if(t.tabId==n){r=t;return false;}return null;});return r;},indexOfPanel:function(p){var r=false;Roo.each(this.tabs,function(t,i){if(t.tabId==p.tabId){r=i;return false;}return null;});return r;},showPanel:function(A){if(typeof(A)=='number'){A=this.tabs[A];}if(typeof(A)=='string'){A=this.getPanelByName(A);}if(A.tabId==this.getActivePanel().tabId){return true;}var B=this.getActivePanel();if(false===B.fireEvent('beforedeactivate')){return false;}if(this.carousel&&typeof(Roo.get(document.body).dom.style.transition)!='undefined'){this.transition=true;var C=this.indexOfPanel(A)>this.indexOfPanel(B)?'next':'prev';var lr=C=='next'?'left':'right';A.el.addClass(C);A.el.dom.offsetWidth;B.el.addClass(lr);A.el.addClass(lr);var D=this;B.el.on('transitionend',function(){Roo.log("trans end?");A.el.removeClass([lr,C]);A.setActive(true);B.el.removeClass([lr]);B.setActive(false);D.transition=false;},this,{single:true});return true;}
+A.showPanel(ii);A.setActiveBullet(ii);}).createDelegate(this,[i,B],true));}}if(this.timer>0){window.setInterval(function(){A.showPanelNext();},this.timer*1000);}},getChildContainer:function(){return this.carousel?this.el.select('.carousel-inner',true).first():this.el;},register:function(A){this.tabs.push(A);A.navId=this.navId;},getActivePanel:function(){var r=false;Roo.each(this.tabs,function(t){if(t.active){r=t;return false;}return null;});return r;},getPanelByName:function(n){var r=false;Roo.each(this.tabs,function(t){if(t.tabId==n){r=t;return false;}return null;});return r;},indexOfPanel:function(p){var r=false;Roo.each(this.tabs,function(t,i){if(t.tabId==p.tabId){r=i;return false;}return null;});return r;},showPanel:function(A){if(typeof(A)=='number'){A=this.tabs[A];}if(typeof(A)=='string'){A=this.getPanelByName(A);}if(A.tabId==this.getActivePanel().tabId){return true;}var B=this.getActivePanel();if(false===B.fireEvent('beforedeactivate')){return false;}if(this.carousel&&typeof(Roo.get(document.body).dom.style.transition)!='undefined'){this.transition=true;var C=this.indexOfPanel(A)>this.indexOfPanel(B)?'next':'prev';var lr=C=='next'?'left':'right';A.el.addClass(C);A.el.dom.offsetWidth;B.el.addClass(lr);A.el.addClass(lr);var D=this;B.el.on('transitionend',function(){Roo.log("trans end?");A.el.removeClass([lr,C]);A.setActive(true);B.el.removeClass([lr]);B.setActive(false);D.transition=false;},this,{single:true});return true;}
 B.setActive(false);A.setActive(true);return true;},showPanelNext:function(){var i=this.indexOfPanel(this.getActivePanel());if(i>this.tabs.length){return;}
 this.showPanel(this.tabs[i+1]);},showPanelPrev:function(){var i=this.indexOfPanel(this.getActivePanel());if(i<1){return;}
 this.showPanel(this.tabs[i-1]);},setActiveBullet:function(i){Roo.each(this.el.select('.bullet',true).elements,function(el){el.removeClass('selected');});var A=this.el.select('.bullet-'+i,true).first();if(!A){return;}