2 * This is BS4's Card element.. - similar to our containers probably..
6 * @class Roo.bootstrap.Card
7 * @extends Roo.bootstrap.Component
11 * possible... may not be implemented..
12 * @cfg {String} header content of header (for panel)
13 * @cfg {String|Object} title
14 * @cfg {String|Object} subtitle
15 * @cfg {String|Object} body
16 * @cfg {String|Object} footer
17 * @cfg {Array} - links
19 * @cfg {String} weight (primary|warning|info|danger|secondary|success|light|dark)
21 * @cfg {String} margin (0|1|2|3|4|5|auto)
22 * @cfg {String} margin_top (0|1|2|3|4|5|auto)
23 * @cfg {String} margin_bottom (0|1|2|3|4|5|auto)
24 * @cfg {String} margin_left (0|1|2|3|4|5|auto)
25 * @cfg {String} margin_right (0|1|2|3|4|5|auto)
26 * @cfg {String} margin_x (0|1|2|3|4|5|auto)
27 * @cfg {String} margin_y (0|1|2|3|4|5|auto)
29 * @cfg {String} padding (0|1|2|3|4|5)
30 * @cfg {String} padding_top (0|1|2|3|4|5)
31 * @cfg {String} padding_bottom (0|1|2|3|4|5)
32 * @cfg {String} padding_left (0|1|2|3|4|5)
33 * @cfg {String} padding_right (0|1|2|3|4|5)
34 * @cfg {String} padding_x (0|1|2|3|4|5)
35 * @cfg {String} padding_y (0|1|2|3|4|5)
37 * @cfg {String} display (block|none)
38 * @cfg {String} display_xs (block|none)
39 * @cfg {String} display_sm (block|none)
40 * @cfg {String} display_lg (block|none)
41 * @cfg {String} display_xl (block|none)
44 * Create a new Container
45 * @param {Object} config The config object
48 Roo.bootstrap.Card = function(config){
49 Roo.bootstrap.Card.superclass.constructor.call(this, config);
57 Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, {
61 margin: '', /// may be better in component?
84 // Roo.log("Call onRender: " + this.xtype);
85 /* We are looking at something like this.
87 <img src="..." class="card-img-top" alt="...">
88 <div class="card-body">
89 <h5 class="card-title">Card title</h5>
90 <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
92 >> this bit is really the body...
93 <div> << we will ad dthis in hopefully it will not break shit.
95 <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
98 <a href="#" class="card-link">Card link</a>
101 <div class="card-footer">
102 <small class="text-muted">Last updated 3 mins ago</small>
106 getAutoCreate : function(){
109 tag : this.tag || 'div',
114 if (this.weight.length && this.weight != 'light') {
115 cfg.cls += ' text-white'
117 if (this.weight.length) {
118 cfg.cls += ' bg-' + this.weight;
122 if (this.margin.length) {
123 var bits = this.margin.split(" ");
124 bits.forEach(function (b) {
125 cfg.cls += ' m' + (b.length == 1 ? '-' : '') + b;
128 if (this.padding.length) {
129 var bits = this.padding.split(" ");
130 bits.forEach(function (b) {
131 cfg.cls += ' p' + (b.length == 1 ? '-' : '') + b;
135 // - this is applied by the parent..
137 // cfg.cls = this.cls + '';
140 if (this.sticky.length) {
142 var bd = Roo.get(document.body);
143 if (!bd.hasClass('bootstrap-sticky')) {
144 bd.addClass('bootstrap-sticky');
145 Roo.select('html',true).setStyle('height', '100%');
148 cfg.cls += 'bootstrap-sticky-' + this.sticky;
152 if (this.well.length) {
156 cfg.cls +=' well well-' +this.well;
165 cfg.cls += ' hidden';
169 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
170 cfg.cls +=' alert alert-' + this.alert;
175 if (this.panel.length) {
176 cfg.cls += ' panel panel-' + this.panel;
178 if (this.header.length) {
184 cfg.cls = cfg.cls + ' expandable';
188 cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus')
197 html : (this.expandable ? ' ' : '') + this.header
201 cls: 'panel-header-right',
207 cls : 'panel-heading',
208 style : this.expandable ? 'cursor: pointer' : '',
216 cls : 'panel-body' + (this.expanded ? '' : ' hide'),
221 if (this.footer.length) {
223 cls : 'panel-footer',
232 body.html = this.html || cfg.html;
233 // prefix with the icons..
235 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
238 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
243 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
244 cfg.cls = 'container';