d7737c8b0997ccce992327aa5dca6610ea2e928a
[roojs1] / Roo / bootstrap / NavSimplebar.js
1 /*
2  * - LGPL
3  *
4  * navbar
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.NavSimplebar
10  * @extends Roo.bootstrap.Navbar
11  * Bootstrap Sidebar class
12  *
13  * @cfg {Boolean} inverse is inverted color
14  * 
15  * @cfg {String} type (nav | pills | tabs)
16  * @cfg {Boolean} arrangement stacked | justified
17  * @cfg {String} align (left | right) alignment
18  * 
19  * @cfg {Boolean} main (true|false) main nav bar? default false
20  * @cfg {Boolean} loadMask (true|false) loadMask on the bar
21  * 
22  * @cfg {String} tag (header|footer|nav|div) default is nav 
23
24  * @cfg {String} weight (light|primary|secondary|success|danger|warning|info|dark|white) default is light.
25  * 
26  * 
27  * @constructor
28  * Create a new Sidebar
29  * @param {Object} config The config object
30  */
31
32
33 Roo.bootstrap.NavSimplebar = function(config){
34     Roo.bootstrap.NavSimplebar.superclass.constructor.call(this, config);
35 };
36
37 Roo.extend(Roo.bootstrap.NavSimplebar, Roo.bootstrap.Navbar,  {
38     
39     inverse: false,
40     
41     type: false,
42     arrangement: '',
43     align : false,
44     
45     weight : 'light',
46     
47     main : false,
48     
49     
50     tag : false,
51     
52     
53     getAutoCreate : function(){
54         
55         
56         var cfg = {
57             tag : this.tag || 'div',
58             cls : 'navbar navbar-expand-lg roo-navbar-simple'
59         };
60         if (['light','white'].indexOf(this.weight) > -1) {
61             cfg.cls += ['light','white'].indexOf(this.weight) > -1 ? ' navbar-light' : ' navbar-dark';
62         }
63         cfg.cls += ' bg-' + this.weight;
64         
65         if (this.inverse) {
66             cfg.cls += ' navbar-inverse';
67             
68         }
69         
70         // i'm not actually sure these are really used - normally we add a navGroup to a navbar
71         
72         if (Roo.bootstrap.version == 4) {
73             cfg.cn = [
74                 {
75                     cls: 'nav',
76                     tag : 'ul'
77                 }
78             ];
79         
80              return cfg;
81         }
82         
83         
84     
85         
86         cfg.cn = [
87             {
88                 cls: 'nav',
89                 tag : 'ul'
90             }
91         ];
92         
93          
94         this.type = this.type || 'nav';
95         if (['tabs','pills'].indexOf(this.type) != -1) {
96             cfg.cn[0].cls += ' nav-' + this.type
97         
98         
99         } else {
100             if (this.type!=='nav') {
101                 Roo.log('nav type must be nav/tabs/pills')
102             }
103             cfg.cn[0].cls += ' navbar-nav'
104         }
105         
106         
107         
108         
109         if (['stacked','justified'].indexOf(this.arrangement) != -1) {
110             cfg.cn[0].cls += ' nav-' + this.arrangement;
111         }
112         
113         
114         if (this.align === 'right') {
115             cfg.cn[0].cls += ' navbar-right';
116         }
117         
118         
119         
120         
121         return cfg;
122     
123         
124     }
125     
126     
127     
128 });
129
130
131
132  
133
134  
135