From: Alan Knowles Date: Wed, 16 Sep 2020 09:32:26 +0000 (+0800) Subject: Roo/bootstrap/Card.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=e0a25f98fcb969e6af1b01d04ac158d4b87ca5b8 Roo/bootstrap/Card.js --- diff --git a/Roo/bootstrap/Card.js b/Roo/bootstrap/Card.js new file mode 100644 index 0000000000..fe7af1065f --- /dev/null +++ b/Roo/bootstrap/Card.js @@ -0,0 +1,186 @@ +/* + * This is BS4's Card element.. - similar to our containers probably.. + * + */ +/** + * @class Roo.bootstrap.Card + * @extends Roo.bootstrap.Component + * Bootstrap Card class + * + * + * possible... may not be implemented.. + * @cfg {String} header content of header (for panel) + * @cfg {String|Object} - title + * @cfg {String|Object} - subtitle + * @cfg {String|Object} - body + * @cfg {String|Object} - footer + * @cfg {Array} - links + * + * @constructor + * Create a new Container + * @param {Object} config The config object + */ + +Roo.bootstrap.Card = function(config){ + Roo.bootstrap.Card.superclass.constructor.call(this, config); + + this.addEvents({ + + }); +}; + + +Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { + + + + // Roo.log("Call onRender: " + this.xtype); + /* We are looking at something like this. +
+ ... +
+
Card title
+
Card subtitle
+ + >> this bit is really the body... +
<< we will ad dthis in hopefully it will not break shit. + +

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

+ +
<< + Card link + +
+ +
+ */ + getAutoCreate : function(){ + + var cfg = { + tag : this.tag || 'div', + html : '', + cls : '' + }; + if (this.jumbotron) { + cfg.cls = 'jumbotron'; + } + + + + // - this is applied by the parent.. + //if (this.cls) { + // cfg.cls = this.cls + ''; + //} + + if (this.sticky.length) { + + var bd = Roo.get(document.body); + if (!bd.hasClass('bootstrap-sticky')) { + bd.addClass('bootstrap-sticky'); + Roo.select('html',true).setStyle('height', '100%'); + } + + cfg.cls += 'bootstrap-sticky-' + this.sticky; + } + + + if (this.well.length) { + switch (this.well) { + case 'lg': + case 'sm': + cfg.cls +=' well well-' +this.well; + break; + default: + cfg.cls +=' well'; + break; + } + } + + if (this.hidden) { + cfg.cls += ' hidden'; + } + + + if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) { + cfg.cls +=' alert alert-' + this.alert; + } + + var body = cfg; + + if (this.panel.length) { + cfg.cls += ' panel panel-' + this.panel; + cfg.cn = []; + if (this.header.length) { + + var h = []; + + if(this.expandable){ + + cfg.cls = cfg.cls + ' expandable'; + + h.push({ + tag: 'i', + cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus') + }); + + } + + h.push( + { + tag: 'span', + cls : 'panel-title', + html : (this.expandable ? ' ' : '') + this.header + }, + { + tag: 'span', + cls: 'panel-header-right', + html: this.rheader + } + ); + + cfg.cn.push({ + cls : 'panel-heading', + style : this.expandable ? 'cursor: pointer' : '', + cn : h + }); + + } + + body = false; + cfg.cn.push({ + cls : 'panel-body' + (this.expanded ? '' : ' hide'), + html : this.html + }); + + + if (this.footer.length) { + cfg.cn.push({ + cls : 'panel-footer', + html : this.footer + + }); + } + + } + + if (body) { + body.html = this.html || cfg.html; + // prefix with the icons.. + if (this.fa) { + body.html = '' + body.html ; + } + if (this.icon) { + body.html = '' + body.html ; + } + + + } + if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) { + cfg.cls = 'container'; + } + + return cfg; + }, +} \ No newline at end of file