From 8f8f8b858f631aeae3266a86ce09d5b82706a2ff Mon Sep 17 00:00:00 2001 From: Edward Date: Fri, 7 Mar 2014 17:50:34 +0800 Subject: [PATCH] roojs-ui-debug.js roojs-ui.js roojs-bootstrap.js roojs-bootstrap-debug.js roojs-all.js roojs-debug.js --- roojs-all.js | 2 +- roojs-bootstrap-debug.js | 7393 -------------------------------------- roojs-bootstrap.js | 208 -- roojs-debug.js | 25 + roojs-ui-debug.js | 444 ++- roojs-ui.js | 873 +++++ 6 files changed, 1342 insertions(+), 7603 deletions(-) diff --git a/roojs-all.js b/roojs-all.js index 4be0445bef..284d9699d2 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -866,7 +866,7 @@ Roo.extend(Roo.form.ComboBoxArray,Roo.form.TextField,{lastData:false,inputType:' this.combo.initEvents();this.store=this.combo.store;this.valueField=this.combo.valueField;this.displayField=this.combo.displayField;this.combo.wrap.addClass('x-cbarray-grp');var B=this.combo.wrap.createChild({tag:'div',cls:'x-cbarray-cb'},this.combo.el.dom);this.hiddenEl=this.combo.wrap.createChild({tag:'input',type:'hidden',name:this.hiddenName,value:''});this.el=this.combo.wrap.createChild({tag:'input',type:'hidden',name:this.name,value:''});this.outerWrap=this.combo.wrap;this.wrap=B;this.outerWrap.setWidth(this.width);this.outerWrap.dom.removeChild(this.el.dom);this.wrap.dom.appendChild(this.el.dom);this.outerWrap.dom.removeChild(this.combo.trigger.dom);this.combo.wrap.dom.appendChild(this.combo.trigger.dom);this.combo.trigger.setStyle('position','relative');this.combo.trigger.setStyle('left','0px');this.combo.trigger.setStyle('top','2px');this.combo.el.setStyle('vertical-align','text-bottom');if(this.adder){this.adder=this.outerWrap.createChild({tag:'img',src:Roo.BLANK_IMAGE_URL,cls:'x-form-adder',style:'margin-left:2px'});var _t=this;this.adder.on('click',function(e){_t.fireEvent('adderclick',this,e);},_t);} this.combo.on('select',function(cb,C,ix){this.addItem(C.data);cb.setValue('');cb.el.dom.value='';},this);},getName:function(){if(!this.rendered){return ''};return this.hiddenName?this.hiddenName:this.name;},onResize:function(w,h){return;if(typeof w!='number'){return;}var tw=this.combo.trigger.getWidth();tw+=this.addicon?this.addicon.getWidth():0;tw+=this.editicon?this.editicon.getWidth():0;var x=w-tw;this.combo.el.setWidth(this.combo.adjustWidth('input',x));this.combo.trigger.setStyle('left','0px');if(this.list&&this.listWidth===undefined){var lw=Math.max(x+this.combo.trigger.getWidth(),this.combo.minListWidth);this.list.setWidth(lw);this.innerList.setWidth(lw-this.list.getFrameWidth('lr'));}},addItem:function(A){var B=this.combo.valueField;var C=this.combo.displayField;if(this.items.indexOfKey(A[B])>-1){return;}var x=new Roo.form.ComboBoxArray.Item({data:A,displayField:C,tipField:C,cb:this});this.items.add(A[B],x);this.updateHiddenEl();x.render(this.outerWrap,this.wrap.dom);},updateHiddenEl:function(){this.validate();if(!this.hiddenEl){return;}var ar=[];var A=this.combo.valueField;this.items.each(function(f){ar.push(f.data[A]);});this.hiddenEl.dom.value=ar.join(',');this.validate();},reset:function(){this.items.each(function(f){f.remove();});this.el.dom.value='';if(this.hiddenEl){this.hiddenEl.dom.value='';}},getValue:function(){return this.hiddenEl?this.hiddenEl.dom.value:'';},setValue:function(v){this.reset();if(this.store.isLocal&&(typeof(v)=='string')){this.hiddenEl.value=v;var A=[];Roo.each(v.split(','),function(k){Roo.log("CHECK "+this.valueField+','+k);var li=this.store.query(this.valueField,k);if(!li.length){return;}var B={};B[this.valueField]=k;B[this.displayField]=li.item(0).data[this.displayField];this.addItem(B);},this)}if(typeof(v)=='object'){Roo.each(v,function(l){this.addItem(l);},this);}},setFromData:function(v){this.reset();this.el.dom.value=v[this.displayField];this.hiddenEl.dom.value=v[this.valueField];if(typeof(v[this.valueField])!='string'||!v[this.valueField].length){return;}var kv=v[this.valueField];var dv=v[this.displayField];kv=typeof(kv)!='string'?'':kv;dv=typeof(dv)!='string'?'':dv;var A=kv.split(',');var B=dv.split(',');for(var i=0;i-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 - *