roojs-bootstrap.js
authoredward <edward@roojs.com>
Thu, 10 Mar 2016 04:14:33 +0000 (12:14 +0800)
committeredward <edward@roojs.com>
Thu, 10 Mar 2016 04:14:33 +0000 (12:14 +0800)
roojs-bootstrap-debug.js

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

index ed8ec8f..c77672c 100644 (file)
@@ -26350,3 +26350,498 @@ Roo.extend(Roo.bootstrap.DocumentViewer, Roo.bootstrap.Component,  {
     }
     
 });
+/*
+ * - LGPL
+ *
+ * nav progress bar
+ * 
+ */
+
+/**
+ * @class Roo.bootstrap.NavProgressBar
+ * @extends Roo.bootstrap.Component
+ * Bootstrap NavProgressBar class
+ * @cfg {String} navId - reference Id for nav progress bar.
+ * 
+ * @constructor
+ * Create a new nav progress bar
+ * @param {Object} config The config object
+ */
+
+Roo.bootstrap.NavProgressBar = function(config){
+    Roo.bootstrap.NavProgressBar.superclass.constructor.call(this, config);
+    this.items = [];
+   
+//    Roo.bootstrap.NavProgressBar.register(this);
+     this.addEvents({
+        /**
+            * @event changed
+            * Fires when the active item changes
+            * @param {Roo.bootstrap.NavProgressBar} this
+            * @param {Roo.bootstrap.NavProgressItem} selected The item selected
+            * @param {Roo.bootstrap.NavProgressItem} prev The previously selected item 
+         */
+        'changed': true
+     });
+    
+};
+
+Roo.extend(Roo.bootstrap.NavProgressBar, Roo.bootstrap.Component,  {
+    
+    items : [],
+    navId : '',
+    
+    getAutoCreate : function()
+    {
+        var cfg = Roo.apply({}, Roo.bootstrap.NavProgressBar.superclass.getAutoCreate.call(this));
+        
+        cfg = {
+            tag : 'ul',
+            cls: 'roo-navigation-bar' 
+        }
+        
+        return cfg;
+    }
+//    
+//    /**
+//    * sets the active Navigation item
+//    * @param {Roo.bootstrap.NavProgressItem} the new current navitem
+//    */
+//    setActiveItem : function(item)
+//    {
+//        var prev = false;
+//        Roo.each(this.items, function(v){
+//            if (v == item) {
+//                return ;
+//            }
+//            if (v.isActive()) {
+//                v.setActive(false, true);
+//                prev = v;
+//                
+//            }
+//            
+//        });
+//
+//        item.setActive(true, true);
+//        this.fireEvent('changed', this, item, prev);
+//    },
+//    
+//    /**
+//    * gets the active Navigation item
+//    * @return {Roo.bootstrap.NavProgressItem} the current navitem
+//    */
+//    getActive : function()
+//    {
+//        var active = false;
+//        
+//        Roo.each(this.items, function(v){
+//            
+//            if (!v.isActive()) {
+//                return;
+//            }
+//            
+//            active = v;
+//            return false;
+//            
+//        });
+//        
+//        return active;
+//    },
+//    
+//    indexOfNav : function(item)
+//    {
+//        var index = false;
+//        
+//        Roo.each(this.items, function(v,i){
+//            
+//            if (v != item) {
+//                return;
+//            }
+//            
+//            index = i;
+//            return false
+//        });
+//        
+//        return index;
+//    },
+//    
+//    /**
+//    * adds a Navigation item
+//    * @param {Roo.bootstrap.NavProgressItem} the NavProgressItem to add
+//    */
+//    addItem : function(cfg)
+//    {
+//        var cn = new Roo.bootstrap.NavProgressItem(cfg);
+//        this.register(cn);
+//        cn.parentId = this.id;
+//        cn.onRender(this.el, null);
+//        return cn;
+//    },
+//    
+//    /**
+//    * register a Navigation item
+//    * @param {Roo.bootstrap.NavItem} the navitem to add
+//    */
+//    register : function(item)
+//    {
+//        this.items.push(item);
+//        item.navId = this.navId;
+//    
+//    },
+//    
+//    /**
+//    * clear all the Navigation item
+//    */
+//   
+//    clearAll : function()
+//    {
+//        this.items = [];
+//        this.el.dom.innerHTML = '';
+//    },
+//    
+//    getNavItem: function(tabId)
+//    {
+//        var ret = false;
+//        Roo.each(this.items, function(e) {
+//            if (e.tabId == tabId) {
+//               ret =  e;
+//               return false;
+//            }
+//            return true;
+//            
+//        });
+//        return ret;
+//    },
+//    
+//    setActiveNext : function()
+//    {
+//        var i = this.indexOfNav(this.getActive());
+//        
+//        if (i > this.items.length) {
+//            return;
+//        }
+//        
+//        this.setActiveItem(this.items[i+1]);
+//    },
+//    
+//    setActivePrev : function()
+//    {
+//        var i = this.indexOfNav(this.getActive());
+//        
+//        if (i  < 1) {
+//            return;
+//        }
+//        
+//        this.setActiveItem(this.items[i-1]);
+//    },
+//    
+//    clearWasActive : function(except) {
+//        Roo.each(this.items, function(e) {
+//            if (e.tabId != except.tabId && e.was_active) {
+//               e.was_active = false;
+//               return false;
+//            }
+//            return true;
+//            
+//        });
+//    },
+//    
+//    getWasActive : function ()
+//    {
+//        var r = false;
+//        Roo.each(this.items, function(e) {
+//            if (e.was_active) {
+//               r = e;
+//               return false;
+//            }
+//            return true;
+//            
+//        });
+//        return r;
+//    }
+    
+    
+});
+
+// 
+//Roo.apply(Roo.bootstrap.NavProgressBar, {
+//    
+//    groups: {},
+//     /**
+//    * register a Navigation Group
+//    * @param {Roo.bootstrap.NavGroup} the navgroup to add
+//    */
+//    register : function(bar)
+//    {
+//        this.groups[bar.navId] = bar;
+//     
+//    },
+//    /**
+//    * fetch a Navigation Bar based on the navigation ID
+//    * @param {string} the nav bar to add
+//    * @returns {Roo.bootstrap.NavProgressBar} the nav bar
+//    */
+//    get: function(navId) 
+//    {
+//        if (typeof(this.groups[navId]) == 'undefined') {
+//            return false;
+//        }
+//        
+//        return this.groups[navId] ;
+//    }
+//    
+//});
+
+ /*
+ * - LGPL
+ *
+ * Nav Progress Item
+ * 
+ */
+
+/**
+ * @class Roo.bootstrap.NavProgressItem
+ * @extends Roo.bootstrap.Component
+ * Bootstrap NavProgressItem class
+ * @cfg {String} tabId the tab that this item activates.
+ * @cfg {Boolean} active (true|false) Is item active default false
+ * @cfg {Boolean} disabled (true|false) Is item active default false
+ * 
+ * @constructor
+ * Create a new NavProgressItem
+ * @param {Object} config The config object
+ */
+Roo.bootstrap.NavProgressItem = function(config){
+    Roo.bootstrap.NavProgressItem.superclass.constructor.call(this, config);
+    this.addEvents({
+        // raw events
+        /**
+         * @event click
+         * The raw click event for the entire grid.
+         * @param {Roo.bootstrap.NavProgressItem} this
+         * @param {Roo.EventObject} e
+         */
+        "click" : true,
+        /**
+           * @event changed
+           * Fires when the active item active state changes
+           * @param {Roo.bootstrap.NavProgressItem} this
+           * @param {boolean} state the new state
+            
+         */
+        'changed': true
+    });
+   
+};
+
+Roo.extend(Roo.bootstrap.NavProgressItem, Roo.bootstrap.Component,  {
+    
+    tabId : '',
+    active : false,
+    disabled : false,
+    
+    getAutoCreate : function()
+    {
+         
+        var cfg = {
+            tag: 'li',
+            cls: 'roo-navigation-bar-item'
+            
+        }
+        
+        if (this.active) {
+            cfg.cls += ' active';
+        }
+        if (this.disabled) {
+            cfg.cls += ' disabled';
+        }
+        
+        return cfg;
+    }
+//    initEvents: function() 
+//    {
+//        if (typeof (this.menu) != 'undefined') {
+//            this.menu.parentType = this.xtype;
+//            this.menu.triggerEl = this.el;
+//            this.menu = this.addxtype(Roo.apply({}, this.menu));
+//        }
+//        
+//        this.el.select('a',true).on('click', this.onClick, this);
+//        
+//        if(this.tagtype == 'span'){
+//            this.el.select('span',true).on('click', this.onClick, this);
+//        }
+//       
+//        // at this point parent should be available..
+//        this.parent().register(this);
+//    },
+//    
+//    onClick : function(e)
+//    {
+//        if(
+//                this.preventDefault || 
+//                this.href == '#' 
+//        ){
+//            
+//            e.preventDefault();
+//        }
+//        
+//        if (this.disabled) {
+//            return;
+//        }
+//        
+//        var tg = Roo.bootstrap.TabGroup.get(this.navId);
+//        if (tg && tg.transition) {
+//            Roo.log("waiting for the transitionend");
+//            return;
+//        }
+//        
+//        
+//        
+//        //Roo.log("fire event clicked");
+//        if(this.fireEvent('click', this, e) === false){
+//            return;
+//        };
+//        
+//        if(this.tagtype == 'span'){
+//            return;
+//        }
+//        
+//        //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);
+//        }
+//        
+//        
+//        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 () {
+//        return this.active
+//    },
+//    setActive : function(state, fire, is_was_active)
+//    {
+//        if (this.active && !state && this.navId) {
+//            this.was_active = true;
+//            var nv = Roo.bootstrap.NavGroup.get(this.navId);
+//            if (nv) {
+//                nv.clearWasActive(this);
+//            }
+//            
+//        }
+//        this.active = state;
+//        
+//        if (!state ) {
+//            this.el.removeClass('active');
+//        } else if (!this.el.hasClass('active')) {
+//            this.el.addClass('active');
+//        }
+//        if (fire) {
+//            this.fireEvent('changed', this, state);
+//        }
+//        
+//        // show a panel if it's registered and related..
+//        
+//        if (!this.navId || !this.tabId || !state || is_was_active) {
+//            return;
+//        }
+//        
+//        var tg = Roo.bootstrap.TabGroup.get(this.navId);
+//        if (!tg) {
+//            return;
+//        }
+//        var pan = tg.getPanelByName(this.tabId);
+//        if (!pan) {
+//            return;
+//        }
+//        // if we can not flip to new panel - go back to old nav highlight..
+//        if (false == tg.showPanel(pan)) {
+//            var nv = Roo.bootstrap.NavGroup.get(this.navId);
+//            if (nv) {
+//                var onav = nv.getWasActive();
+//                if (onav) {
+//                    onav.setActive(true, false, true);
+//                }
+//            }
+//            
+//        }
+//        
+//        
+//     
+//    },
+//     // this should not be here...
+//    setDisabled : function(state)
+//    {
+//        this.disabled = state;
+//        if (!state ) {
+//            this.el.removeClass('disabled');
+//        } else if (!this.el.hasClass('disabled')) {
+//            this.el.addClass('disabled');
+//        }
+//        
+//    },
+//    
+//    /**
+//     * Fetch the element to display the tooltip on.
+//     * @return {Roo.Element} defaults to this.el
+//     */
+//    tooltipEl : function()
+//    {
+//        return this.el.select('' + this.tagtype + '', true).first();
+//    },
+//    
+//    scrollToElement : function(e)
+//    {
+//        var c = document.body;
+//        
+//        /*
+//         * Firefox / IE places the overflow at the html level, unless specifically styled to behave differently.
+//         */
+//        if(Roo.isFirefox || Roo.isIE || Roo.isIE11){
+//            c = document.documentElement;
+//        }
+//        
+//        var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
+//        
+//        if(!target){
+//            return;
+//        }
+//
+//        var o = target.calcOffsetsTo(c);
+//        
+//        var options = {
+//            target : target,
+//            value : o[1]
+//        }
+//        
+//        this.fireEvent('scrollto', this, options, e);
+//        
+//        Roo.get(c).scrollTo('top', options.value, true);
+//        
+//        return;
+//    }
+});
+
\ No newline at end of file
index 1266640..6bb3369 100644 (file)
@@ -1099,3 +1099,9 @@ return A;},initEvents:function(){this.bodyEl=this.el.select('.roo-document-viewe
 this.imageEl=this.el.select('.roo-document-viewer-image',true).first();this.imageEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.footerEl=this.el.select('.roo-document-viewer-footer',true).first();this.footerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';
 this.trashBtn=this.el.select('.roo-document-viewer-trash',true).first();this.trashBtn.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.bodyEl.on('click',this.onClick,this);this.trashBtn.on('click',this.onTrash,this);},initial:function(){this.fireEvent('initial',this);
 },onClick:function(e){e.preventDefault();this.fireEvent('click',this);},onTrash:function(e){e.preventDefault();this.fireEvent('trash',this);}});
+// Roo/bootstrap/NavProgressBar.js
+Roo.bootstrap.NavProgressBar=function(A){Roo.bootstrap.NavProgressBar.superclass.constructor.call(this,A);this.items=[];this.addEvents({'changed':true});};Roo.extend(Roo.bootstrap.NavProgressBar,Roo.bootstrap.Component,{items:[],navId:'',getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.NavProgressBar.superclass.getAutoCreate.call(this));
+A={tag:'ul',cls:'roo-navigation-bar'};return A;}});
+// Roo/bootstrap/NavProgressItem.js
+Roo.bootstrap.NavProgressItem=function(A){Roo.bootstrap.NavProgressItem.superclass.constructor.call(this,A);this.addEvents({"click":true,'changed':true});};Roo.extend(Roo.bootstrap.NavProgressItem,Roo.bootstrap.Component,{tabId:'',active:false,disabled:false,getAutoCreate:function(){var A={tag:'li',cls:'roo-navigation-bar-item'};if(this.active){A.cls+=' active';
+}if(this.disabled){A.cls+=' disabled';}return A;}});