4 * base class for bootstrap elements.
8 Roo.bootstrap = Roo.bootstrap || {};
10 * @class Roo.bootstrap.Component
11 * @extends Roo.Component
12 * Bootstrap Component base class
13 * @cfg {String} cls css class
14 * @cfg {String} style any extra css
17 * Do not use directly - it does not do anything..
18 * @param {Object} config The config object
23 Roo.bootstrap.Component = function(config){
24 Roo.bootstrap.Component.superclass.constructor.call(this, config);
27 Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent, {
35 initEvents : function() { },
40 // returns the parent component..
41 return Roo.ComponentMgr.get(this.parentId)
47 onRender : function(ct, position)
49 Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
53 var cfg = Roo.apply({}, this.getAutoCreate());
57 cfg.cls += ' ' + this.cls;
59 if (this.style) { // fixme needs to support more complex style data.
60 cfg.style = this.style;
62 this.el = ct.createChild(cfg, position);
63 if(this.tabIndex !== undefined){
64 this.el.dom.setAttribute('tabIndex', this.tabIndex);
71 getChildContainer : function()
76 addxtype : function (tree, cntr) {
78 cntr = typeof(cntr == 'undefined' ) ? 'getChildContainer' : cntr;
80 if (tree.xtype != 'Body') {
82 cn = Roo.factory(tree);
84 cn.parentType = this.xtype; //??
85 cn.parentId = this.id;
86 cn.render(this[cntr]());
87 // then add the element..
90 if (typeof (tree.menu) != 'undefined') {
91 tree.menu.parentType = cn.xtype;
92 tree.menu.triggerEl = cn.el;
93 nitems.push(cn.addxtype(Roo.apply({}, tree.menu)));
96 if (typeof (tree.buttons) != 'undefined' && typeof(cn.getButtonContainer) == 'function') {
98 for(var i =0;i < tree.buttons.length;i++) {
99 nitems.push(cn.addxtype(Roo.apply({}, tree.buttons[i]), 'getButtonContainer'));
104 if (!tree.items || !tree.items.length) {
108 var items = tree.items;
111 //Roo.log(items.length);
113 for(var i =0;i < items.length;i++) {
114 nitems.push(cn.addxtype(Roo.apply({}, items[i])));
134 Roo.bootstrap.Body = function(config){
135 Roo.bootstrap.Body.superclass.constructor.call(this, config);
138 Roo.extend(Roo.bootstrap.Body, Roo.bootstrap.Component, {
143 onRender : function(ct, position){
144 this.el = Roo.get(document.body);
146 //this.el.addClass([this.fieldClass, this.cls]);
164 * @class Roo.bootstrap.ButtonGroup
165 * @extends Roo.bootstrap.Component
166 * Bootstrap ButtonGroup class
167 * @cfg {String} size lg | sm | xs (default empty normal)
168 * @cfg {String} align vertical | justified (default none)
169 * @cfg {String} direction up | down (default down)
170 * @cfg {Boolean} toolbar false | true
171 * @cfg {Boolean} btn true | false
176 * @param {Object} config The config object
179 Roo.bootstrap.ButtonGroup = function(config){
180 Roo.bootstrap.ButtonGroup.superclass.constructor.call(this, config);
183 Roo.extend(Roo.bootstrap.ButtonGroup, Roo.bootstrap.Component, {
191 getAutoCreate : function(){
197 cfg.html = this.html || cfg.html;
208 if (['vertical','justified'].indexOf(this.align)!==-1) {
209 cfg.cls = 'btn-group-' + this.align;
211 if (this.align == 'justified') {
212 console.log(this.items);
216 if (['lg','sm','xs'].indexOf(this.size)!==-1) {
217 cfg.cls += ' btn-group-' + this.size;
220 if (this.direction == 'up') {
221 cfg.cls += ' dropup' ;
237 * @class Roo.bootstrap.Button
238 * @extends Roo.bootstrap.Component
239 * Bootstrap Button class
240 * @cfg {String} html The button content
241 * @cfg {String} weight default (or empty) | primary | success | info | warning | danger
242 * @cfg {String} size empty | lg | sm | xs
243 * @cfg {String} tag empty | a | input | submit
244 * @cfg {String} href empty or href
245 * @cfg {Boolean} disabled false | true
246 * @cfg {Boolean} isClose false | true
247 * @cfg {String} glyphicon empty | adjust | align-center | align-justify | align-left | align-right | arrow-down | arrow-left | arrow-right | arrow-up | asterisk | backward | ban-circle | barcode | bell | bold | book | bookmark | briefcase | bullhorn | calendar | camera | certificate | check | chevron-down | chevron-left | chevron-right | chevron-up | circle-arrow-down | circle-arrow-left | circle-arrow-right | circle-arrow-up | cloud | cloud-download | cloud-upload | cog | collapse-down | collapse-up | comment | compressed | copyright-mark | credit-card | cutlery | dashboard | download | download-alt | earphone | edit | eject | envelope | euro | exclamation-sign | expand | export | eye-close | eye-open | facetime-video | fast-backward | fast-forward | file | film | filter | fire | flag | flash | floppy-disk | floppy-open | floppy-remove | floppy-save | floppy-saved | folder-close | folder-open | font | forward | fullscreen | gbp | gift | glass | globe | hand-down | hand-left | hand-right | hand-up | hd-video | hdd | header | headphones | heart | heart-empty | home | import | inbox | indent-left | indent-right | info-sign | italic | leaf | link | list | list-alt | lock | log-in | log-out | magnet | map-marker | minus | minus-sign | move | music | new-window | off | ok | ok-circle | ok-sign | open | paperclip | pause | pencil | phone | phone-alt | picture | plane | play | play-circle | plus | plus-sign | print | pushpin | qrcode | question-sign | random | record | refresh | registration-mark | remove | remove-circle | remove-sign | repeat | resize-full | resize-horizontal | resize-small | resize-vertical | retweet | road | save | saved | screenshot | sd-video | search | send | share | share-alt | shopping-cart | signal | sort | sort-by-alphabet | sort-by-alphabet-alt | sort-by-attributes | sort-by-attributes-alt | sort-by-order | sort-by-order-alt | sound-5-1 | sound-6-1 | sound-7-1 | sound-dolby | sound-stereo | star | star-empty | stats | step-backward | step-forward | stop | subtitles | tag | tags | tasks | text-height | text-width | th | th-large | th-list | thumbs-down | thumbs-up | time | tint | tower | transfer | trash | tree-conifer | tree-deciduous | unchecked | upload | usd | user | volume-down | volume-off | volume-up | warning-sign | wrench | zoom-in | zoom-out
248 * @cfg {String} badge text for badge
249 * @cfg {String} theme default (or empty) | glow
250 * @cfg {Boolean} inverse false | true
251 * @cfg {Boolean} toggle false | true
252 * @cfg {String} ontext text for on toggle state
253 * @cfg {String} offtext text for off toggle state
254 * @cfg {Boolean} defaulton true | false
257 * Create a new button
258 * @param {Object} config The config object
262 Roo.bootstrap.Button = function(config){
263 Roo.bootstrap.Button.superclass.constructor.call(this, config);
268 * The raw click event for the entire grid.
269 * @param {Roo.EventObject} e
275 Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, {
294 getAutoCreate : function(){
301 if (['a', 'button', 'input', 'submit'].indexOf(this.tag) < 0) {
302 throw "Invalid value for tag: " + this.tag + ". must be a, button, input or submit.";
307 cfg.html = this.html || cfg.html;
309 if (this.toggle===true) {
317 'data-off-text':'OFF',
318 cls: 'slider-button',
324 if (['default', 'primary', 'success', 'info', 'warning', 'danger', 'link'].indexOf(this.weight) > -1) {
325 cfg.cls += ' '+this.weight;
334 cfg["aria-hidden"] = true;
336 cfg.html = "×";
342 if (this.theme==='default') {
345 if (this.parentType != 'Navbar') {
346 this.weight = this.weight.length ? this.weight : 'default';
348 if (['default', 'primary', 'success', 'info', 'warning', 'danger', 'link'].indexOf(this.weight) > -1) {
350 cfg.cls += ' btn-' + this.weight;
352 } else if (this.theme==='glow') {
357 if (['default', 'primary', 'success', 'info', 'warning', 'danger', 'link'].indexOf(this.weight) > -1) {
359 cfg.cls += ' ' + this.weight;
365 this.cls += ' inverse';
370 cfg.cls += ' active';
373 cfg.cls += this.size.length ? (' btn-' + this.size) : '';
375 //gsRoo.log(this.parentType);
376 if (this.parentType === 'Navbar') {
383 href : this.href || '#'
386 cfg.cn[0].html = this.html + ' <span class="caret"></span>';
387 cfg.cls += ' dropdown';
392 } else if (this.menu) {
394 cfg.cls += ' dropdown test';
400 cfg.disabled = 'disabled';
404 Roo.log('changing to ul' );
406 this.glyphicon = 'caret';
409 if (this.glyphicon) {
410 cfg.html = ' ' + cfg.html;
415 cls: 'glyphicon glyphicon-' + this.glyphicon
441 if (cfg.tag !== 'a' && this.href !== '') {
442 throw "Tag must be a to set href.";
443 } else if (this.href.length > 0) {
444 cfg.href = this.href;
449 initEvents: function() {
450 // Roo.log('init events?');
451 // Roo.log(this.el.dom);
452 this.el.select('a',true).on('click',
454 this.fireEvent('click', this);
470 * @class Roo.bootstrap.Column
471 * @extends Roo.bootstrap.Component
472 * Bootstrap Column class
473 * @cfg {Number} xs colspan out of 12 for mobile-sized screens
474 * @cfg {Number} sm colspan out of 12 for tablet-sized screens
475 * @cfg {Number} md colspan out of 12 for computer-sized screens
476 * @cfg {Number} lg colspan out of 12 for large computer-sized screens
477 * @cfg {String} html content of column.
480 * Create a new Column
481 * @param {Object} config The config object
484 Roo.bootstrap.Column = function(config){
485 Roo.bootstrap.Column.superclass.constructor.call(this, config);
488 Roo.extend(Roo.bootstrap.Column, Roo.bootstrap.Component, {
497 getAutoCreate : function(){
498 var cfg = Roo.apply({}, Roo.bootstrap.Column.superclass.getAutoCreate.call(this));
506 ['xs','sm','md','lg'].map(function(size){
507 if (settings[size]) {
508 cfg.cls += ' col-' + size + '-' + settings[size];
511 if (this.html.length) {
512 cfg.html = this.html;
531 * @class Roo.bootstrap.Container
532 * @extends Roo.bootstrap.Component
533 * Bootstrap Container class
534 * @cfg {Boolean} jumbotron is it a jumbotron element
535 * @cfg {String} html content of element
536 * @cfg {String} well (lg|sm|md) a well, large, small or medium.
537 * @cfg {String} panel (primary|success|info|warning|danger) render as a panel.
538 * @cfg {String} header content of header (for panel)
539 * @cfg {String} footer content of footer (for panel)
540 * @cfg {String} sticky (footer|wrap|push) block to use as footer or body- needs css-bootstrap/sticky-footer.css
543 * Create a new Container
544 * @param {Object} config The config object
547 Roo.bootstrap.Container = function(config){
548 Roo.bootstrap.Container.superclass.constructor.call(this, config);
551 Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, {
561 getChildContainer : function() {
562 if (this.panel.length) {
563 return this.el.select('.panel-body',true).first();
570 getAutoCreate : function(){
576 if (this.jumbotron) {
577 cfg.cls = 'jumbotron';
580 cfg.cls = this.cls + '';
583 if (this.sticky.length) {
584 var bd = Roo.get(document.body)
585 if (!bd.hasClass('bootstrap-sticky')) {
586 bd.addClass('bootstrap-sticky');
587 Roo.select('html',true).setStyle('height', '100%');
590 cfg.cls += 'bootstrap-sticky-' + this.sticky;
594 if (this.well.length) {
598 cfg.cls +=' well well-' +this.well;
608 if (this.panel.length) {
609 cfg.cls += 'panel panel-' + this.panel;
611 if (this.header.length) {
614 cls : 'panel-heading',
630 if (this.footer.length) {
632 cls : 'panel-footer',
640 body.html = this.html || cfg.html;
642 if (!cfg.cls.length) {
643 cfg.cls = 'container';
659 * @class Roo.bootstrap.Form
660 * @extends Roo.bootstrap.Component
661 * Bootstrap Form class
662 * @cfg {String} method GET | POST (default POST)
663 * @cfg {String} labelAlign top | left (default top)
667 * @param {Object} config The config object
671 Roo.bootstrap.Form = function(config){
672 Roo.bootstrap.Form.superclass.constructor.call(this, config);
675 * @event clientvalidation
676 * If the monitorValid config option is true, this event fires repetitively to notify of valid state
678 * @param {Boolean} valid true if the form has passed client-side validation
680 clientvalidation: true,
683 * Fires when the form is rendered
684 * @param {Roo.form.Form} form
690 Roo.extend(Roo.bootstrap.Form, Roo.bootstrap.Component, {
693 getAutoCreate : function(){
697 method : this.method || 'POST',
698 id : this.id || Roo.id(),
702 if (this.labelAlign == 'left' ) {
703 cfg.cls += ' form-horizontal';
720 * @class Roo.bootstrap.Img
721 * @extends Roo.bootstrap.Component
722 * Bootstrap Img class
723 * @cfg {Boolean} imgResponsive false | true
724 * @cfg {String} border rounded | circle | thumbnail
725 * @cfg {String} src image source
726 * @cfg {String} alt image alternative text
730 * @param {Object} config The config object
733 Roo.bootstrap.Img = function(config){
734 Roo.bootstrap.Img.superclass.constructor.call(this, config);
737 Roo.extend(Roo.bootstrap.Img, Roo.bootstrap.Component, {
743 getAutoCreate : function(){
747 cls: 'img-responsive',
751 cfg.html = this.html || cfg.html;
753 cfg.src = this.src || cfg.src;
755 if (['rounded','circle','thumbnail'].indexOf(this.border)>-1) {
756 cfg.cls += ' img-' + this.border;
776 * @class Roo.bootstrap.Input
777 * @extends Roo.bootstrap.Component
778 * Bootstrap Input class
779 * @cfg {Boolean} disabled is it disabled
780 * @cfg {String} fieldLabel - the label associated
781 * @cfg {String} inputType button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text
782 * @cfg {String} name name of the input
783 * @cfg {boolean} disabled is it disabled
784 * @cfg {string} fieldLabel - the label associated
785 * @cfg {string} inputType - input / file submit ...
786 * @cfg {string} placeholder - placeholder to put in text.
787 * @cfg {string} before - input group add on before
788 * @cfg {string} after - input group add on after
793 * @param {Object} config The config object
796 Roo.bootstrap.Input = function(config){
797 Roo.bootstrap.Input.superclass.constructor.call(this, config);
801 Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component, {
811 getAutoCreate : function(){
813 var parent = this.parent();
815 var align = parent.labelAlign;
820 cls: 'form-group' //input-group
826 type : this.inputType,
827 cls : 'form-control',
828 placeholder : this.placeholder || ''
835 var inputblock = input;
837 if (this.before || this.after) {
846 cls : 'input-group-addon',
850 inputblock.cn.push(input);
854 cls : 'input-group-addon',
862 Roo.log(this.fieldLabel.length);
864 if (align ==='left' && this.fieldLabel.length) {
865 Roo.log("left and has label");
871 cls : 'col-sm-2 control-label',
872 html : this.fieldLabel
883 } else if ( this.fieldLabel.length) {
889 //cls : 'input-group-addon',
890 html : this.fieldLabel
900 Roo.log(" no label && no align");
919 setDisabled : function(v)
921 var i = this.el.select('input',true).dom;
923 i.removeAttribute('disabled');
927 i.setAttribute('disabled','true');
940 * @class Roo.bootstrap.Header
941 * @extends Roo.bootstrap.Component
942 * Bootstrap Header class
943 * @cfg {String} html content of header
944 * @cfg {Number} level (1|2|3|4|5|6) default 1
947 * Create a new Header
948 * @param {Object} config The config object
952 Roo.bootstrap.Header = function(config){
953 Roo.bootstrap.Header.superclass.constructor.call(this, config);
956 Roo.extend(Roo.bootstrap.Header, Roo.bootstrap.Component, {
964 getAutoCreate : function(){
967 tag: 'h' + (1 *this.level),
968 html: this.html || 'fill in html'
986 * @class Roo.bootstrap.Menu
987 * @extends Roo.bootstrap.Component
988 * Bootstrap Menu class - container for MenuItems
989 * @cfg {String} type type of menu
993 * @param {Object} config The config object
997 Roo.bootstrap.Menu = function(config){
998 Roo.bootstrap.Menu.superclass.constructor.call(this, config);
1001 Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component, {
1009 getChildContainer : function() {
1013 getAutoCreate : function(){
1015 //if (['right'].indexOf(this.align)!==-1) {
1016 // cfg.cn[1].cls += ' pull-right'
1020 cls : 'dropdown-menu'
1024 if (this.type==='submenu') {
1025 cfg.cls='submenu active'
1030 initEvents : function() {
1031 // Roo.log("ADD event");
1032 // Roo.log(this.triggerEl.dom);
1033 this.triggerEl.on('click', this.toggle, this);
1034 this.triggerEl.addClass('dropdown-toggle');
1037 toggle : function(e)
1039 //Roo.log(e.getTarget());
1040 // Roo.log(this.triggerEl.dom);
1041 if (Roo.get(e.getTarget()).findParent('.dropdown-menu')) {
1044 var isActive = this.triggerEl.hasClass('open');
1045 // if disabled.. ingore
1047 //if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
1048 // if mobile we use a backdrop because click events don't delegate
1049 // $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
1052 //var relatedTarget = { relatedTarget: this }
1053 //$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
1055 //if (e.isDefaultPrevented()) return;
1057 this.triggerEl[isActive ? 'removeClass' : 'addClass']('open');
1059 // .trigger('shown.bs.dropdown', relatedTarget)
1061 this.triggerEl.focus();
1067 clearMenus : function()
1069 //$(backdrop).remove()
1070 Roo.select('.dropdown-toggle',true).each(function(aa) {
1071 if (!aa.hasClass('open')) {
1075 aa.removeClass('open');
1076 //var parent = getParent($(this))
1077 //var relatedTarget = { relatedTarget: this }
1079 //$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
1080 //if (e.isDefaultPrevented()) return
1081 //$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
1099 * @class Roo.bootstrap.MenuItem
1100 * @extends Roo.bootstrap.Component
1101 * Bootstrap MenuItem class
1102 * @cfg {String} html the menu label
1103 * @cfg {String} href the link
1107 * Create a new MenuItem
1108 * @param {Object} config The config object
1112 Roo.bootstrap.MenuItem = function(config){
1113 Roo.bootstrap.MenuItem.superclass.constructor.call(this, config);
1116 Roo.extend(Roo.bootstrap.MenuItem, Roo.bootstrap.Component, {
1121 getAutoCreate : function(){
1133 cfg.cn[0].href = this.href || cfg.cn[0].href ;
1134 cfg.cn[0].html = this.html || cfg.cn[0].html ;
1151 * @class Roo.bootstrap.MenuSeparator
1152 * @extends Roo.bootstrap.Component
1153 * Bootstrap MenuSeparator class
1156 * Create a new MenuItem
1157 * @param {Object} config The config object
1161 Roo.bootstrap.MenuSeparator = function(config){
1162 Roo.bootstrap.MenuSeparator.superclass.constructor.call(this, config);
1165 Roo.extend(Roo.bootstrap.MenuSeparator, Roo.bootstrap.Component, {
1167 getAutoCreate : function(){
1182 <div class="modal fade">
1183 <div class="modal-dialog">
1184 <div class="modal-content">
1185 <div class="modal-header">
1186 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
1187 <h4 class="modal-title">Modal title</h4>
1189 <div class="modal-body">
1190 <p>One fine body…</p>
1192 <div class="modal-footer">
1193 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1194 <button type="button" class="btn btn-primary">Save changes</button>
1196 </div><!-- /.modal-content -->
1197 </div><!-- /.modal-dialog -->
1198 </div><!-- /.modal -->
1208 * @class Roo.bootstrap.Modal
1209 * @extends Roo.bootstrap.Component
1210 * Bootstrap Modal class
1211 * @cfg {String} title Title of dialog
1212 * @cfg {Array} buttons Array of buttons
1215 * Create a new Modal Dialog
1216 * @param {Object} config The config object
1219 Roo.bootstrap.Modal = function(config){
1220 Roo.bootstrap.Modal.superclass.constructor.call(this, config);
1223 Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component, {
1225 title : 'test dialog',
1229 onRender : function(ct, position)
1231 Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
1233 var cfg = Roo.apply({}, this.getAutoCreate());
1236 // cfg.name = typeof(this.name) == 'undefined' ? this.id : this.name;
1238 //if (!cfg.name.length) {
1242 cfg.cls += ' ' + this.cls;
1245 cfg.style = this.style;
1247 this.el = Roo.get(document.body).createChild(cfg, position);
1249 //var type = this.el.dom.type;
1251 if(this.tabIndex !== undefined){
1252 this.el.dom.setAttribute('tabIndex', this.tabIndex);
1255 //this.el.addClass([this.fieldClass, this.cls]);
1258 getAutoCreate : function(){
1264 cls: "modal-dialog",
1267 cls : "modal-content",
1270 cls : 'modal-header',
1279 cls : 'modal-title',
1290 cls : 'modal-footer'
1295 cls : 'btn btn-default',
1300 cls : 'btn btn-primary',
1321 getChildContainer : function() {
1323 return this.el.select('.modal-body',true).first();
1326 getButtonContainer : function() {
1327 return this.el.select('.modal-footer',true).first();
1330 initEvents : function()
1332 this.el.select('.modal-header .close').on('click', this.hide, this);
1335 this.el.addClass('on');
1336 this.el.removeClass('fade');
1337 this.el.setStyle('display', 'block');
1340 this.el.removeClass('on');
1341 this.el.addClass('fade');
1342 this.el.setStyle('display', 'none');
1354 * @class Roo.bootstrap.Navbar
1355 * @extends Roo.bootstrap.Component
1356 * Bootstrap Navbar class
1357 * @cfg {Boolean} sidebar has side bar
1358 * @cfg {Boolean} bar is a bar?
1359 * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
1360 * @cfg {String} brand what is brand
1361 * @cfg {Boolean} inverse is inverted color
1362 * @cfg {String} type (nav | pills | tabs)
1363 * @cfg {Boolean} arrangement stacked | justified
1364 * @cfg {String} align (left | right) alignment
1368 * Create a new Navbar
1369 * @param {Object} config The config object
1373 Roo.bootstrap.Navbar = function(config){
1374 Roo.bootstrap.Navbar.superclass.constructor.call(this, config);
1377 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, {
1389 getAutoCreate : function(){
1394 if (this.sidebar === true) {
1402 if (this.bar === true) {
1410 cls: 'navbar-header',
1415 cls: 'navbar-toggle',
1416 'data-toggle': 'collapse',
1421 html: 'Toggle navigation'
1441 cls: 'collapse navbar-collapse'
1446 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
1448 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
1449 cfg.cls += ' navbar-' + this.position;
1450 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
1453 if (this.brand !== '') {
1457 cls: 'navbar-brand',
1466 } else if (this.bar === false) {
1469 Roo.log('Property \'bar\' in of Navbar must be either true or false')
1479 if (['tabs','pills'].indexOf(this.type)!==-1) {
1480 cfg.cn[0].cls += ' nav-' + this.type
1482 if (this.type!=='nav') {
1483 Roo.log('nav type must be nav/tabs/pills')
1485 cfg.cn[0].cls += ' navbar-nav'
1488 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
1489 cfg.cn[0].cls += ' nav-' + this.arrangement;
1492 if (this.align === 'right') {
1493 cfg.cn[0].cls += ' navbar-right';
1496 cfg.cls += ' navbar-inverse';
1504 getChildContainer : function() {
1505 if (this.bar === true) {
1506 return this.el.select('.collapse',true).first();
1524 * @class Roo.bootstrap.NavGroup
1525 * @extends Roo.bootstrap.Component
1526 * Bootstrap NavGroup class
1527 * @cfg {String} align left | right
1528 * @cfg {Boolean} inverse false | true
1531 * Create a new nav group
1532 * @param {Object} config The config object
1535 Roo.bootstrap.NavGroup = function(config){
1536 Roo.bootstrap.NavGroup.superclass.constructor.call(this, config);
1539 Roo.extend(Roo.bootstrap.NavGroup, Roo.bootstrap.Component, {
1545 getAutoCreate : function(){
1546 var cfg = Roo.apply({}, Roo.bootstrap.NavGroup.superclass.getAutoCreate.call(this));
1550 cls: 'nav navbar-nav'
1553 if (this.parent().sidebar === true) {
1556 cls: 'dashboard-menu'
1562 if (this.form === true) {
1568 if (this.align === 'right') {
1569 cfg.cls += ' navbar-right';
1571 cfg.cls += ' navbar-left';
1576 if (this.align === 'right') {
1577 cfg.cls += ' navbar-right';
1581 cfg.cls += ' navbar-inverse';
1601 * @class Roo.bootstrap.Navbar.Item
1602 * @extends Roo.bootstrap.Component
1603 * Bootstrap Navbar.Button class
1604 * @cfg {String} href link to
1605 * @cfg {String} html content of button
1606 * @cfg {String} badge text inside badge
1607 * @cfg {String} glyphicon name of glyphicon
1610 * Create a new Navbar Button
1611 * @param {Object} config The config object
1613 Roo.bootstrap.Navbar.Item = function(config){
1614 Roo.bootstrap.Navbar.Item.superclass.constructor.call(this, config);
1617 Roo.extend(Roo.bootstrap.Navbar.Item, Roo.bootstrap.Component, {
1625 getAutoCreate : function(){
1627 var cfg = Roo.apply({}, Roo.bootstrap.Navbar.Item.superclass.getAutoCreate.call(this));
1629 if (this.parent().parent().sidebar === true) {
1642 cfg.cn[0].html = this.html;
1646 this.cls += ' active';
1650 cfg.cn[0].cls += ' dropdown-toggle';
1651 cfg.cn[0].html = (cfg.cn[0].html || this.html) + '<span class="glyphicon glyphicon-chevron-down"></span>';
1655 cfg.cn[0].tag = 'a',
1656 cfg.cn[0].href = this.href;
1659 if (this.glyphicon) {
1660 cfg.cn[0].html = '<i class="glyphicon glyphicon-'+this.glyphicon+'"></i><span>' + cfg.cn[0].html || this.html + '</span>'
1676 if (this.glyphicon) {
1677 if(cfg.html){cfg.html = ' ' + this.html};
1681 cls: 'glyphicon glyphicon-' + this.glyphicon
1686 cfg.cn[0].html = this.html || cfg.cn[0].html ;
1690 cfg.cn[0].html += " <span class='caret'></span>";
1691 //}else if (!this.href) {
1692 // cfg.cn[0].tag='p';
1693 // cfg.cn[0].cls='navbar-text';
1696 cfg.cn[0].href=this.href||'#';
1697 cfg.cn[0].html=this.html;
1700 if (this.badge !== '') {
1703 cfg.cn[0].html + ' ',
1716 initEvents: function() {
1717 // Roo.log('init events?');
1718 // Roo.log(this.el.dom);
1719 this.el.select('a',true).on('click',
1721 this.fireEvent('click', this);
1738 * @class Roo.bootstrap.Row
1739 * @extends Roo.bootstrap.Component
1740 * Bootstrap Row class (contains columns...)
1744 * @param {Object} config The config object
1747 Roo.bootstrap.Row = function(config){
1748 Roo.bootstrap.Row.superclass.constructor.call(this, config);
1751 Roo.extend(Roo.bootstrap.Row, Roo.bootstrap.Component, {
1770 * @class Roo.bootstrap.Element
1771 * @extends Roo.bootstrap.Component
1772 * Bootstrap Element class
1773 * @cfg {String} html contents of the element
1774 * @cfg {String} tag tag of the element
1775 * @cfg {String} cls class of the element
1778 * Create a new Element
1779 * @param {Object} config The config object
1782 Roo.bootstrap.Element = function(config){
1783 Roo.bootstrap.Element.superclass.constructor.call(this, config);
1786 Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component, {
1794 getAutoCreate : function(){
1795 var cfg = Roo.apply({}, Roo.bootstrap.Element.superclass.getAutoCreate.call(this));
1818 * @class Roo.bootstrap.Pagination
1819 * @extends Roo.bootstrap.Component
1820 * Bootstrap Pagination class
1821 * @cfg {String} size xs | sm | md | lg
1822 * @cfg {Boolean} inverse false | true
1823 * @cfg {Number} from pagination starting number
1824 * @cfg {Number} to pagination ending number
1825 * @cfg {String} align empty or left | right
1826 * @cfg {Number} active active page number
1829 * Create a new Pagination
1830 * @param {Object} config The config object
1833 Roo.bootstrap.Pagination = function(config){
1834 Roo.bootstrap.Pagination.superclass.constructor.call(this, config);
1837 Roo.extend(Roo.bootstrap.Pagination, Roo.bootstrap.Component, {
1847 getAutoCreate : function(){
1854 cfg.cls += ' inverse';
1872 var from=this.from>0?this.from:1;
1873 var to=this.to-from<=10?this.to:from+10;
1874 var active=this.active>=from&&this.active<=to?this.active:null;
1875 for (var i=from;i<=to;i++) {
1879 cls: active===i?'active':'',
1920 * @class Roo.bootstrap.Slider
1921 * @extends Roo.bootstrap.Component
1922 * Bootstrap Slider class
1925 * Create a new Slider
1926 * @param {Object} config The config object
1929 Roo.bootstrap.Slider = function(config){
1930 Roo.bootstrap.Slider.superclass.constructor.call(this, config);
1933 Roo.extend(Roo.bootstrap.Slider, Roo.bootstrap.Component, {
1935 getAutoCreate : function(){
1939 cls: 'slider slider-sample1 vertical-handler ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all',
1943 cls: 'ui-slider-handle ui-state-default ui-corner-all'
1961 * @class Roo.bootstrap.Table
1962 * @extends Roo.bootstrap.Component
1963 * Bootstrap Table class
1966 * Create a new Table
1967 * @param {Object} config The config object
1970 Roo.bootstrap.Table = function(config){
1971 Roo.bootstrap.Table.superclass.constructor.call(this, config);
1974 Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, {
1979 getAutoCreate : function(){
1980 var cfg = Roo.apply({}, Roo.bootstrap.Table.superclass.getAutoCreate.call(this));
2012 * @class Roo.bootstrap.TableCell
2013 * @extends Roo.bootstrap.Component
2014 * Bootstrap TableCell class
2017 * Create a new TableCell
2018 * @param {Object} config The config object
2021 Roo.bootstrap.TableCell = function(config){
2022 Roo.bootstrap.TableCell.superclass.constructor.call(this, config);
2025 Roo.extend(Roo.bootstrap.TableCell, Roo.bootstrap.Component, {
2027 getAutoCreate : function(){
2028 var cfg = Roo.apply({}, Roo.bootstrap.TableCell.superclass.getAutoCreate.call(this));
2055 * @class Roo.bootstrap.TableRow
2056 * @extends Roo.bootstrap.Component
2057 * Bootstrap TableRow class
2060 * Create a new TableRow
2061 * @param {Object} config The config object
2064 Roo.bootstrap.TableRow = function(config){
2065 Roo.bootstrap.TableRow.superclass.constructor.call(this, config);
2068 Roo.extend(Roo.bootstrap.TableRow, Roo.bootstrap.Component, {
2070 getAutoCreate : function(){
2071 var cfg = Roo.apply({}, Roo.bootstrap.TableRow.superclass.getAutoCreate.call(this));