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_image src url of image.
13 * @cfg {String} header
14 * @cfg {Number} header_size (0|1|2|3|4|5) H1 or H2 etc.. 0 indicates default
17 * @cfg {String} subtitle
18 * @cfg {String} html -- html contents - or just use children..
19 * @cfg {String} footer
21 * @cfg {String} weight (primary|warning|info|danger|secondary|success|light|dark)
23 * @cfg {String} margin (0|1|2|3|4|5|auto)
24 * @cfg {String} margin_top (0|1|2|3|4|5|auto)
25 * @cfg {String} margin_bottom (0|1|2|3|4|5|auto)
26 * @cfg {String} margin_left (0|1|2|3|4|5|auto)
27 * @cfg {String} margin_right (0|1|2|3|4|5|auto)
28 * @cfg {String} margin_x (0|1|2|3|4|5|auto)
29 * @cfg {String} margin_y (0|1|2|3|4|5|auto)
31 * @cfg {String} padding (0|1|2|3|4|5)
32 * @cfg {String} padding_top (0|1|2|3|4|5)
33 * @cfg {String} padding_bottom (0|1|2|3|4|5)
34 * @cfg {String} padding_left (0|1|2|3|4|5)
35 * @cfg {String} padding_right (0|1|2|3|4|5)
36 * @cfg {String} padding_x (0|1|2|3|4|5)
37 * @cfg {String} padding_y (0|1|2|3|4|5)
39 * @cfg {String} display (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
40 * @cfg {String} display_xs (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
41 * @cfg {String} display_sm (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
42 * @cfg {String} display_lg (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
43 * @cfg {String} display_xl (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
46 * Create a new Container
47 * @param {Object} config The config object
50 Roo.bootstrap.Card = function(config){
51 Roo.bootstrap.Card.superclass.constructor.call(this, config);
59 Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, {
64 margin: '', /// may be better in component?
94 childContainer : false,
96 layoutCls : function()
101 ['', 'top', 'bottom', 'left', 'right', 'x', 'y' ].forEach(function(v) {
102 // in theory these can do margin_top : ml-xs-3 ??? but we don't support that yet
104 if (t['margin' + (v.length ? '_' : '') + v].length) {
105 cls += ' m' + (v.length ? v[0] : '') + '-' + t['margin' + (v.length ? '_' : '') + v];
107 if (t['padding' + (v.length ? '_' : '') + v].length) {
108 cls += ' p' + (v.length ? v[0] : '') + '-' + t['padding' + (v.length ? '_' : '') + v];
112 ['', 'xs', 'sm', 'lg', 'xl', ].forEach(function(v) {
113 if (t['display' + (v.length ? '_' : '') + v].length) {
114 cls += ' d' + (v.length ? '-' : '') + v + '-' + t['margin' + (v.length ? '_' : '') + v].length
118 // more generic support?
126 // Roo.log("Call onRender: " + this.xtype);
127 /* We are looking at something like this.
129 <img src="..." class="card-img-top" alt="...">
130 <div class="card-body">
131 <h5 class="card-title">Card title</h5>
132 <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
134 >> this bit is really the body...
135 <div> << we will ad dthis in hopefully it will not break shit.
137 ** card text does not actually have any styling...
139 <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>
142 <a href="#" class="card-link">Card link</a>
145 <div class="card-footer">
146 <small class="text-muted">Last updated 3 mins ago</small>
150 getAutoCreate : function(){
158 if (this.weight.length && this.weight != 'light') {
159 cfg.cls += ' text-white'
161 if (this.weight.length) {
162 cfg.cls += ' bg-' + this.weight;
165 cfg.cls += this.layoutCls();
167 if (this.header.length) {
169 tag : this.header_size > 0 ? 'h' + this.header_size : 'div',
171 html : this.header // escape?
174 if (this.header_image.length) {
177 cls : 'card-img-top',
178 src: this.header_image // escape?
189 if (this.title.length) {
193 src: this.title // escape?
197 if (this.subtitle.length) {
201 src: this.subtitle // escape?
207 cls : 'roo-card-body-ctr'
210 // fixme ? handle objects?
211 if (this.footer.length) {
215 html: this.footer // escape?
224 getChildContainer : function()
230 return this.el.select('.roo-card-body-ctr',true).first();