});
/*
+ * - LGPL
+ *
+ * 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_image src url of image.
+ * @cfg {String} header
+ * @cfg {Number} header_size (0|1|2|3|4|5) H1 or H2 etc.. 0 indicates default
+ *
+ * @cfg {String} title
+ * @cfg {String} subtitle
+ * @cfg {String} html -- html contents - or just use children..
+ * @cfg {String} footer
+
+ * @cfg {String} weight (primary|warning|info|danger|secondary|success|light|dark)
+ *
+ * @cfg {String} margin (0|1|2|3|4|5|auto)
+ * @cfg {String} margin_top (0|1|2|3|4|5|auto)
+ * @cfg {String} margin_bottom (0|1|2|3|4|5|auto)
+ * @cfg {String} margin_left (0|1|2|3|4|5|auto)
+ * @cfg {String} margin_right (0|1|2|3|4|5|auto)
+ * @cfg {String} margin_x (0|1|2|3|4|5|auto)
+ * @cfg {String} margin_y (0|1|2|3|4|5|auto)
+ *
+ * @cfg {String} padding (0|1|2|3|4|5)
+ * @cfg {String} padding_top (0|1|2|3|4|5)
+ * @cfg {String} padding_bottom (0|1|2|3|4|5)
+ * @cfg {String} padding_left (0|1|2|3|4|5)
+ * @cfg {String} padding_right (0|1|2|3|4|5)
+ * @cfg {String} padding_x (0|1|2|3|4|5)
+ * @cfg {String} padding_y (0|1|2|3|4|5)
+ *
+ * @cfg {String} display (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
+ * @cfg {String} display_xs (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
+ * @cfg {String} display_sm (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
+ * @cfg {String} display_lg (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
+ * @cfg {String} display_xl (none|inline|inline-block|block|table|table-cell|table-row|flex|inline-flex)
+
+ * @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, {
+
+
+ weight : '',
+
+ margin: '', /// may be better in component?
+ margin_top: '',
+ margin_bottom: '',
+ margin_left: '',
+ margin_right: '',
+ margin_x: '',
+ margin_y: '',
+
+ padding : '',
+ padding_top: '',
+ padding_bottom: '',
+ padding_left: '',
+ padding_right: '',
+ padding_x: '',
+ padding_y: '',
+
+ display: '',
+ display_xs: '',
+ display_sm: '',
+ display_lg: '',
+ display_xl: '',
+
+ header_image : '',
+ header : '',
+ header_size : 0,
+ title : '',
+ subtitle : '',
+ html : '',
+
+
+ childContainer : false,
+
+ layoutCls : function()
+ {
+ var cls = '';
+ var t = this;
+
+ ['', 'top', 'bottom', 'left', 'right', 'x', 'y' ].forEach(function(v) {
+ // in theory these can do margin_top : ml-xs-3 ??? but we don't support that yet
+
+ if (t['margin' + (v.length ? '_' : '') + v].length) {
+ cls += ' m' + (v.length ? v[0] : '') + '-' + t['margin' + (v.length ? '_' : '') + v];
+ }
+ if (t['padding' + (v.length ? '_' : '') + v].length) {
+ cls += ' p' + (v.length ? v[0] : '') + '-' + t['padding' + (v.length ? '_' : '') + v];
+ }
+ });
+
+ ['', 'xs', 'sm', 'lg', 'xl'].forEach(function(v) {
+ if (t['display' + (v.length ? '_' : '') + v].length) {
+ cls += ' d' + (v.length ? '-' : '') + v + '-' + t['margin' + (v.length ? '_' : '') + v].length
+ }
+ });
+
+ // more generic support?
+ if (this.hidden) {
+ cls += ' d-none';
+ }
+
+ return cls;
+ },
+
+ // Roo.log("Call onRender: " + this.xtype);
+ /* We are looking at something like this.
+<div class="card">
+ <img src="..." class="card-img-top" alt="...">
+ <div class="card-body">
+ <h5 class="card-title">Card title</h5>
+ <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
+
+ >> this bit is really the body...
+ <div> << we will ad dthis in hopefully it will not break shit.
+
+ ** card text does not actually have any styling...
+
+ <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>
+
+ </div> <<
+ <a href="#" class="card-link">Card link</a>
+
+ </div>
+ <div class="card-footer">
+ <small class="text-muted">Last updated 3 mins ago</small>
+ </div>
+</div>
+ */
+ getAutoCreate : function(){
+
+ var cfg = {
+ tag : 'div',
+ cls : 'card',
+ cn : [ ]
+ };
+
+ if (this.weight.length && this.weight != 'light') {
+ cfg.cls += ' text-white'
+ }
+ if (this.weight.length) {
+ cfg.cls += ' bg-' + this.weight;
+ }
+
+ cfg.cls += this.layoutCls();
+
+ if (this.header.length) {
+ cfg.cn.push({
+ tag : this.header_size > 0 ? 'h' + this.header_size : 'div',
+ cls : 'card-header',
+ html : this.header // escape?
+ });
+ }
+ if (this.header_image.length) {
+ cfg.cn.push({
+ tag : 'img',
+ cls : 'card-img-top',
+ src: this.header_image // escape?
+ });
+ }
+
+ var body = {
+ tag : 'div',
+ cls : 'card-body',
+ cn : []
+ };
+ cfg.push(body);
+
+ if (this.title.length) {
+ body.cn.push({
+ tag : 'div',
+ cls : 'card-title',
+ src: this.title // escape?
+ });
+ }
+
+ if (this.subtitle.length) {
+ body.cn.push({
+ tag : 'div',
+ cls : 'card-title',
+ src: this.subtitle // escape?
+ });
+ }
+
+ body.cn.push({
+ tag : 'div',
+ cls : 'roo-card-body-ctr'
+ });
+
+ // fixme ? handle objects?
+ if (this.footer.length) {
+ body.cn.push({
+ tag : 'div',
+ cls : 'card-footer',
+ html: this.footer // escape?
+ });
+ }
+ // footer...
+
+ return cfg;
+ },
+
+
+ getChildContainer : function()
+ {
+
+ if(!this.el){
+ return false;
+ }
+ return this.el.select('.roo-card-body-ctr',true).first();
+ }
+
+});
+
+/*
* - LGPL
*
* image
if (tbd) {
- tbd.setSize(ctr.getWidth(),
- ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0))
- );
+ tbd.setWidth(ctr.getWidth());
+ // if the body has a max height - and then scrolls - we should perhaps set up the height here
+ // this needs fixing for various usage - currently only hydra job advers I think..
+ //tdb.setHeight(
+ // ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0))
+ //);
var barsize = (tbd.dom.offsetWidth - tbd.dom.clientWidth);
cw -= barsize;
}
var r = this.reader.readRecords(o);
this.loadRecords(r, {add: append}, true);
},
+
+ /**
+ * using 'cn' the nested child reader read the child array into it's child stores.
+ * @param {Object} rec The record with a 'children array
+ */
+ loadDataFromChildren : function(rec)
+ {
+ this.loadData(this.reader.toLoadData(rec));
+ },
+
/**
* Gets the number of cached records.
* Small helper class to make creating Stores from Array data easier.
* @cfg {Number} id The array index of the record id. Leave blank to auto generate ids.
* @cfg {Array} fields An array of field definition objects, or field name strings.
+ * @cfg {Object} an existing reader (eg. copied from another store)
* @cfg {Array} data The multi-dimensional array of data
* @constructor
* @param {Object} config
*/
-Roo.data.SimpleStore = function(config){
+Roo.data.SimpleStore = function(config)
+{
Roo.data.SimpleStore.superclass.constructor.call(this, {
isLocal : true,
- reader: new Roo.data.ArrayReader({
+ reader: typeof(config.reader) != 'undefined' ? config.reader : new Roo.data.ArrayReader({
id: config.id
},
Roo.data.Record.create(config.fields)
};
Roo.data.DataReader.prototype = {
+
+
+ readerType : 'Data',
/**
* Create an empty record
* @param {Object} data (optional) - overlay some values
return new this.recordType(Roo.apply(da, d));
}
+
};/*
* Based on:
* Ext JS Library 1.1.1
};
Roo.extend(Roo.data.JsonReader, Roo.data.DataReader, {
+ readerType : 'Json',
+
/**
* @prop {Boolean} metaFromRemote - if the meta data was loaded from the remote source.
* Used by Store query builder to append _requestMeta to params.
records : records,
totalRecords : totalRecords
};
+ },
+ // used when loading children.. @see loadDataFromChildren
+ toLoadData: function(rec)
+ {
+ // expect rec just to be an array.. eg [a,b,c, [...] << cn ]
+ var data = typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn;
+ return { data : data, total : data.length };
+
}
});/*
* Based on:
*
* created using {@link Roo.data.Record#create}.
*/
-Roo.data.ArrayReader = function(meta, recordType){
-
-
+Roo.data.ArrayReader = function(meta, recordType)
+{
Roo.data.ArrayReader.superclass.constructor.call(this, meta, recordType||meta.fields);
};
Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, {
- /**
+
+ /**
* Create a data block containing Roo.data.Records from an XML document.
* @param {Object} o An Array of row objects which represents the dataset.
* @return {Object} A data block which is used by an {@link Roo.data.Store} object as
* a cache of Roo.data.Records.
*/
- readRecords : function(o){
+ readRecords : function(o)
+ {
var sid = this.meta ? this.meta.id : null;
var recordType = this.recordType, fields = recordType.prototype.fields;
var records = [];
var root = o;
- for(var i = 0; i < root.length; i++){
- var n = root[i];
- var values = {};
- var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);
- for(var j = 0, jlen = fields.length; j < jlen; j++){
- var f = fields.items[j];
- var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
- var v = n[k] !== undefined ? n[k] : f.defaultValue;
- v = f.convert(v);
- values[f.name] = v;
- }
- var record = new recordType(values, id);
- record.json = n;
- records[records.length] = record;
+ for(var i = 0; i < root.length; i++){
+ var n = root[i];
+ var values = {};
+ var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);
+ for(var j = 0, jlen = fields.length; j < jlen; j++){
+ var f = fields.items[j];
+ var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
+ var v = n[k] !== undefined ? n[k] : f.defaultValue;
+ v = f.convert(v);
+ values[f.name] = v;
}
- return {
- records : records,
- totalRecords : records.length
- };
+ var record = new recordType(values, id);
+ record.json = n;
+ records[records.length] = record;
+ }
+ return {
+ records : records,
+ totalRecords : records.length
+ };
+ },
+ // used when loading children.. @see loadDataFromChildren
+ toLoadData: function(rec)
+ {
+ // expect rec just to be an array.. eg [a,b,c, [...] << cn ]
+ return typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn;
+
}
+
+
});/*
* - LGPL
* *
inline: false,
tooltip : '',
+ // checkbox success does not make any sense really..
+ invalidClass : "",
+ validClass : "",
+
+
getAutoCreate : function()
{
var align = (!this.labelAlign) ? this.parentLabelAlign() : this.labelAlign;
insertTag : function(tg)
{
// could be a bit smarter... -> wrap the current selected tRoo..
- if (tg.toLowerCase() == 'span' || tg.toLowerCase() == 'code') {
+ if (tg.toLowerCase() == 'span' ||
+ tg.toLowerCase() == 'code' ||
+ tg.toLowerCase() == 'sup' ||
+ tg.toLowerCase() == 'sub'
+ ) {
range = this.createRange(this.getSelection());
var wrappingNode = this.doc.createElement(tg.toLowerCase());