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 (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
38 * @cfg {String} display_xs (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
39 * @cfg {String} display_sm (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
40 * @cfg {String} display_lg (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
41 * @cfg {String} display_xl (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
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 layoutCls : function()
89 ['', 'top', 'bottom', 'left', 'right', 'x', 'y' ].forEach(function(v) {
90 // in theory these can do margin_top : ml-xs-3 ??? but we don't support that yet
92 if (t['margin' + (v.length ? '_' : '') + v].length) {
93 cls += ' m' + (v.length ? v[0] : '') + '-' + t['margin' + (v.length ? '_' : '') + v];
95 if (t['padding' + (v.length ? '_' : '') + v].length) {
96 cls += ' p' + (v.length ? v[0] : '') + '-' + t['padding' + (v.length ? '_' : '') + v];
100 ['', 'xs', 'sm', 'lg', 'xl', ].forEach(function(v) {
101 if (t['display' + (v.length ? '_' : '') + v].length) {
102 cls += ' d' + (v.length ? '-' : '') + v + '-' + t['margin' + (v.length ? '_' : '') + v].length
106 // more generic support?
114 // Roo.log("Call onRender: " + this.xtype);
115 /* We are looking at something like this.
117 <img src="..." class="card-img-top" alt="...">
118 <div class="card-body">
119 <h5 class="card-title">Card title</h5>
120 <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
122 >> this bit is really the body...
123 <div> << we will ad dthis in hopefully it will not break shit.
125 <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>
128 <a href="#" class="card-link">Card link</a>
131 <div class="card-footer">
132 <small class="text-muted">Last updated 3 mins ago</small>
136 getAutoCreate : function(){
139 tag : this.tag || 'div',
144 if (this.weight.length && this.weight != 'light') {
145 cfg.cls += ' text-white'
147 if (this.weight.length) {
148 cfg.cls += ' bg-' + this.weight;
151 cfg.cls += this.layoutCls();
156 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
157 cfg.cls +=' alert alert-' + this.alert;
162 if (this.panel.length) {
163 cfg.cls += ' panel panel-' + this.panel;
165 if (this.header.length) {
171 cfg.cls = cfg.cls + ' expandable';
175 cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus')
184 html : (this.expandable ? ' ' : '') + this.header
188 cls: 'panel-header-right',
194 cls : 'panel-heading',
195 style : this.expandable ? 'cursor: pointer' : '',
203 cls : 'panel-body' + (this.expanded ? '' : ' hide'),
208 if (this.footer.length) {
210 cls : 'panel-footer',
219 body.html = this.html || cfg.html;
220 // prefix with the icons..
222 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
225 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
230 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
231 cfg.cls = 'container';