From 31fef93c09f5a7e14553ef8502332121638178b7 Mon Sep 17 00:00:00 2001 From: Edward Date: Fri, 7 Mar 2014 17:53:27 +0800 Subject: [PATCH] roojs-ui.js roojs-ui-debug.js roojs-bootstrap.js roojs-bootstrap-debug.js roojs-all.js roojs-debug.js --- roojs-bootstrap-debug.js | 7393 ++++++++++++++++++++++++++++++++++++++ roojs-bootstrap.js | 208 ++ 2 files changed, 7601 insertions(+) diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index c67a5a6995..40af41e0dc 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -1275,4 +1275,7397 @@ Roo.apply(Roo.bootstrap.Modal, { ] }); + /* + * - LGPL + * + * navbar + * + */ + +/** + * @class Roo.bootstrap.Navbar + * @extends Roo.bootstrap.Component + * Bootstrap Navbar class + * @cfg {Boolean} sidebar has side bar + * @cfg {Boolean} bar is a bar? + * @cfg {String} position (fixed-top|fixed-bottom|static-top) position + * @cfg {String} brand what is brand + * @cfg {Boolean} inverse is inverted color + * @cfg {String} type (nav | pills | tabs) + * @cfg {Boolean} arrangement stacked | justified + * @cfg {String} align (left | right) alignment + * + * + * @constructor + * Create a new Navbar + * @param {Object} config The config object + */ + + +Roo.bootstrap.Navbar = function(config){ + Roo.bootstrap.Navbar.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, { + + sidebar: false, + + bar: false, + brand: '', + inverse: false, + position: '', + align : false, + type: 'nav', + arrangement: '', + + getAutoCreate : function(){ + var cfg = { + cls : 'navbar' + }; + + if (this.sidebar === true) { + cfg = { + tag: 'div', + cls: 'sidebar-nav' + }; + return cfg; + } + + if (this.bar === true) { + cfg = { + tag: 'nav', + cls: 'navbar', + role: 'navigation', + cn: [ + { + tag: 'div', + cls: 'navbar-header', + cn: [ + { + tag: 'button', + type: 'button', + cls: 'navbar-toggle', + 'data-toggle': 'collapse', + cn: [ + { + tag: 'span', + cls: 'sr-only', + html: 'Toggle navigation' + }, + { + tag: 'span', + cls: 'icon-bar' + }, + { + tag: 'span', + cls: 'icon-bar' + }, + { + tag: 'span', + cls: 'icon-bar' + } + ] + } + ] + }, + { + tag: 'div', + cls: 'collapse navbar-collapse' + } + ] + }; + + cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default'; + + if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) { + cfg.cls += ' navbar-' + this.position; + cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header'; + } + + if (this.brand !== '') { + cfg.cn[0].cn.push({ + tag: 'a', + href: '#', + cls: 'navbar-brand', + cn: [ + this.brand + ] + }); + } + + return cfg; + + } else if (this.bar === false) { + + } else { + Roo.log('Property \'bar\' in of Navbar must be either true or false') + } + + cfg.cn = [ + { + cls: 'nav', + tag : 'ul' + } + ]; + + if (['tabs','pills'].indexOf(this.type)!==-1) { + cfg.cn[0].cls += ' nav-' + this.type + } else { + if (this.type!=='nav') { + Roo.log('nav type must be nav/tabs/pills') + } + cfg.cn[0].cls += ' navbar-nav' + } + + if (['stacked','justified'].indexOf(this.arrangement)!==-1) { + cfg.cn[0].cls += ' nav-' + this.arrangement; + } + + if (this.align === 'right') { + cfg.cn[0].cls += ' navbar-right'; + } + if (this.inverse) { + cfg.cls += ' navbar-inverse'; + + } + + + return cfg; + }, + + initEvents :function () + { + //Roo.log(this.el.select('.navbar-toggle',true)); + this.el.select('.navbar-toggle',true).on('click', function() { + // Roo.log('click'); + this.el.select('.navbar-collapse',true).toggleClass('in'); + }, this); + }, + + + getChildContainer : function() + { + if (this.bar === true) { + return this.el.select('.collapse',true).first(); + } + console.log(this); + return this.el; + } + +}); + + + + /* + * - LGPL + * + * nav group + * + */ + +/** + * @class Roo.bootstrap.NavGroup + * @extends Roo.bootstrap.Component + * Bootstrap NavGroup class + * @cfg {String} align left | right + * @cfg {Boolean} inverse false | true + * + * @constructor + * Create a new nav group + * @param {Object} config The config object + */ + +Roo.bootstrap.NavGroup = function(config){ + Roo.bootstrap.NavGroup.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.NavGroup, Roo.bootstrap.Component, { + + align: '', + inverse: false, + form: false, + + getAutoCreate : function(){ + var cfg = Roo.apply({}, Roo.bootstrap.NavGroup.superclass.getAutoCreate.call(this)); + + cfg = { + tag : 'ul', + cls: 'nav navbar-nav' + } + + if (this.parent().sidebar === true) { + cfg = { + tag: 'ul', + cls: 'dashboard-menu' + } + + return cfg; + } + + if (this.form === true) { + cfg = { + tag: 'form', + cls: 'navbar-form' + } + + if (this.align === 'right') { + cfg.cls += ' navbar-right'; + } else { + cfg.cls += ' navbar-left'; + } + } + + + if (this.align === 'right') { + cfg.cls += ' navbar-right'; + } + + if (this.inverse) { + cfg.cls += ' navbar-inverse'; + + } + + + return cfg; + } + +}); + + + + /* + * - LGPL + * + * row + * + */ + +/** + * @class Roo.bootstrap.Navbar.Item + * @extends Roo.bootstrap.Component + * Bootstrap Navbar.Button class + * @cfg {String} href link to + * @cfg {String} html content of button + * @cfg {String} badge text inside badge + * @cfg {String} glyphicon name of glyphicon + + * @constructor + * Create a new Navbar Button + * @param {Object} config The config object + */ +Roo.bootstrap.Navbar.Item = function(config){ + Roo.bootstrap.Navbar.Item.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.Navbar.Item, Roo.bootstrap.Component, { + + href: false, + html: '', + badge: '', + icon: false, + glyphicon: false, + + getAutoCreate : function(){ + + var cfg = Roo.apply({}, Roo.bootstrap.Navbar.Item.superclass.getAutoCreate.call(this)); + + if (this.parent().parent().sidebar === true) { + cfg = { + tag: 'li', + cls: '', + cn: [ + { + tag: 'p', + cls: '' + } + ] + } + + if (this.html) { + cfg.cn[0].html = this.html; + } + + if (this.active) { + this.cls += ' active'; + } + + if (this.menu) { + cfg.cn[0].cls += ' dropdown-toggle'; + cfg.cn[0].html = (cfg.cn[0].html || this.html) + ''; + } + + if (this.href) { + cfg.cn[0].tag = 'a', + cfg.cn[0].href = this.href; + } + + if (this.glyphicon) { + cfg.cn[0].html = '' + cfg.cn[0].html || this.html + '' + } + + return cfg; + } + + cfg = { + tag: 'li' + } + cfg.cn = [ + { + tag: 'p', + html: 'Text' + } + ]; + + if (this.glyphicon) { + if(cfg.html){cfg.html = ' ' + this.html}; + cfg.cn=[ + { + tag: 'span', + cls: 'glyphicon glyphicon-' + this.glyphicon + } + ]; + } + + cfg.cn[0].html = this.html || cfg.cn[0].html ; + if (this.menu) { + cfg.cn[0].tag='a'; + cfg.cn[0].href='#'; + cfg.cn[0].html += " "; + //}else if (!this.href) { + // cfg.cn[0].tag='p'; + // cfg.cn[0].cls='navbar-text'; + } else { + cfg.cn[0].tag='a'; + cfg.cn[0].href=this.href||'#'; + cfg.cn[0].html=this.html; + } + + if (this.badge !== '') { + + cfg.cn[0].cn=[ + cfg.cn[0].html + ' ', + { + tag: 'span', + cls: 'badge', + html: this.badge + } + ]; + cfg.cn[0].html='' + } + + + return cfg; + }, + initEvents: function() { + // Roo.log('init events?'); + // Roo.log(this.el.dom); + this.el.select('a',true).on('click', + function(e) { + this.fireEvent('click', this); + }, + this + ); + } + +}); + + + /* + * - LGPL + * + * row + * + */ + +/** + * @class Roo.bootstrap.Row + * @extends Roo.bootstrap.Component + * Bootstrap Row class (contains columns...) + * + * @constructor + * Create a new Row + * @param {Object} config The config object + */ + +Roo.bootstrap.Row = function(config){ + Roo.bootstrap.Row.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.Row, Roo.bootstrap.Component, { + + getAutoCreate : function(){ + return { + cls: 'row clearfix' + }; + } + + +}); + + + + /* + * - LGPL + * + * element + * + */ + +/** + * @class Roo.bootstrap.Element + * @extends Roo.bootstrap.Component + * Bootstrap Element class + * @cfg {String} html contents of the element + * @cfg {String} tag tag of the element + * @cfg {String} cls class of the element + * + * @constructor + * Create a new Element + * @param {Object} config The config object + */ + +Roo.bootstrap.Element = function(config){ + Roo.bootstrap.Element.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component, { + + tag: 'div', + cls: '', + html: '', + + + getAutoCreate : function(){ + + var cfg = { + tag: this.tag, + cls: '', + html: this.html + } + + return cfg; + } + +}); + + + + /* + * - LGPL + * + * pagination + * + */ + +/** + * @class Roo.bootstrap.Pagination + * @extends Roo.bootstrap.Component + * Bootstrap Pagination class + * @cfg {String} size xs | sm | md | lg + * @cfg {Boolean} inverse false | true + * @cfg {Number} from pagination starting number + * @cfg {Number} to pagination ending number + * @cfg {String} align empty or left | right + * @cfg {Number} active active page number + * + * @constructor + * Create a new Pagination + * @param {Object} config The config object + */ + +Roo.bootstrap.Pagination = function(config){ + Roo.bootstrap.Pagination.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.Pagination, Roo.bootstrap.Component, { + + cls: false, + size: false, + inverse: false, + from: 1, + to: 4, + align: false, + active: 1, + + getAutoCreate : function(){ + cfg = { + tag: 'ul', + cls: 'pagination', + cn: [] + }; + if (this.inverse) { + cfg.cls += ' inverse'; + } + if (this.html) { + cfg.html=this.html; + } + if (this.cls) { + cfg.cls=this.cls; + } + cfg.cn[0]={ + tag: 'li', + cn: [ + { + tag: 'a', + href:'#', + html: '«' + } + ] + }; + var from=this.from>0?this.from:1; + var to=this.to-from<=10?this.to:from+10; + var active=this.active>=from&&this.active<=to?this.active:null; + for (var i=from;i<=to;i++) { + cfg.cn.push( + { + tag: 'li', + cls: active===i?'active':'', + cn: [ + { + tag: 'a', + href: '#', + html: i + } + ] + } + ); + } + + cfg.cn.push( + { + tag: 'li', + cn: [ + { + tag: 'a', + href: '#', + html: '»' + } + ] + } + ); + + return cfg; + } + +}); + + + + /* + * - LGPL + * + * slider + * + */ + + +/** + * @class Roo.bootstrap.Slider + * @extends Roo.bootstrap.Component + * Bootstrap Slider class + * + * @constructor + * Create a new Slider + * @param {Object} config The config object + */ + +Roo.bootstrap.Slider = function(config){ + Roo.bootstrap.Slider.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.Slider, Roo.bootstrap.Component, { + + getAutoCreate : function(){ + + var cfg = { + tag: 'div', + cls: 'slider slider-sample1 vertical-handler ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all', + cn: [ + { + tag: 'a', + cls: 'ui-slider-handle ui-state-default ui-corner-all' + } + ] + } + + return cfg; + } + +}); + + /* + * - LGPL + * + * table + * + */ + +/** + * @class Roo.bootstrap.Table + * @extends Roo.bootstrap.Component + * Bootstrap Table class + * + * @constructor + * Create a new Table + * @param {Object} config The config object + */ + +Roo.bootstrap.Table = function(config){ + Roo.bootstrap.Table.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { + + html: false, + cls: false, + + getAutoCreate : function(){ + var cfg = Roo.apply({}, Roo.bootstrap.Table.superclass.getAutoCreate.call(this)); + + cfg = { + tag: 'table', + cn: [ + { + tag: 'tbody' + } + ] + } + if (this.html) { + cfg.html=this.html + } + if (this.cls) { + cfg.cls=this.cls + } + + return cfg; + } + +}); + + + + /* + * - LGPL + * + * table cell + * + */ + +/** + * @class Roo.bootstrap.TableCell + * @extends Roo.bootstrap.Component + * Bootstrap TableCell class + * + * @constructor + * Create a new TableCell + * @param {Object} config The config object + */ + +Roo.bootstrap.TableCell = function(config){ + Roo.bootstrap.TableCell.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.TableCell, Roo.bootstrap.Component, { + + getAutoCreate : function(){ + var cfg = Roo.apply({}, Roo.bootstrap.TableCell.superclass.getAutoCreate.call(this)); + + cfg = { + tag: 'td' + } + if (this.html) { + cfg.html=this.html + } + if (this.cls) { + cfg.cls=this.cls + } + + return cfg; + } + +}); + + + + /* + * - LGPL + * + * table row + * + */ + +/** + * @class Roo.bootstrap.TableRow + * @extends Roo.bootstrap.Component + * Bootstrap TableRow class + * + * @constructor + * Create a new TableRow + * @param {Object} config The config object + */ + +Roo.bootstrap.TableRow = function(config){ + Roo.bootstrap.TableRow.superclass.constructor.call(this, config); +}; + +Roo.extend(Roo.bootstrap.TableRow, Roo.bootstrap.Component, { + + getAutoCreate : function(){ + var cfg = Roo.apply({}, Roo.bootstrap.TableRow.superclass.getAutoCreate.call(this)); + + cfg = { + tag: 'tr' + } + + return cfg; + } + +}); + + + + /* + * Based on: + * Ext JS Library 1.1.1 + * Copyright(c) 2006-2007, Ext JS, LLC. + * + * Originally Released Under LGPL - original licence link has changed is not relivant. + * + * Fork - LGPL + *