From: Alan Knowles Date: Thu, 17 Sep 2020 06:09:40 +0000 (+0800) Subject: roojs-bootstrap.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=36e645d8abf3d8fe9bf42ea169fa5a53c1b1a8ae roojs-bootstrap.js roojs-bootstrap-debug.js examples/bootstrap/dashboard4.bjs examples/bootstrap/dashboard4.js --- diff --git a/examples/bootstrap/dashboard4.bjs b/examples/bootstrap/dashboard4.bjs index 4b89c0f93b..6c2c64d9f4 100644 --- a/examples/bootstrap/dashboard4.bjs +++ b/examples/bootstrap/dashboard4.bjs @@ -34,6 +34,11 @@ "String header" : "ticket 1", "xtype" : "Card", "$ xns" : "Roo.bootstrap" + }, + { + "String weight" : "primary", + "xtype" : "Button", + "$ xns" : "Roo.bootstrap" } ] } diff --git a/examples/bootstrap/dashboard4.js b/examples/bootstrap/dashboard4.js index 444ad9bb65..d89ad36210 100644 --- a/examples/bootstrap/dashboard4.js +++ b/examples/bootstrap/dashboard4.js @@ -48,6 +48,12 @@ dashboard4 = new Roo.XComponent({ header : _this._strings['d9fb0367346d21079a1c52d72da61c9f'] /* ticket 1 */, xns : Roo.bootstrap, '|xns' : 'Roo.bootstrap' + }, + { + xtype : 'Button', + weight : 'primary', + xns : Roo.bootstrap, + '|xns' : 'Roo.bootstrap' } ] } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 324d160116..bbddd80b9f 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -1580,7 +1580,7 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { title : '', subtitle : '', html : '', - + footer: '', childContainer : false, @@ -1675,7 +1675,7 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { cls : 'card-body', cn : [] }; - cfg.push(body); + cfg.cn.push(body); if (this.title.length) { body.cn.push({ @@ -1698,6 +1698,12 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { cls : 'roo-card-body-ctr' }); + if (this.html.length) { + body.cn.push({ + tag: 'div', + html : this.html + }); + } // fixme ? handle objects? if (this.footer.length) { body.cn.push({ diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index a9da16f88b..a09e8e8f9a 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -60,13 +60,13 @@ return this.el.select('.panel-body',true).first()},titleEl:function(){if(!this.e },getTitle:function(){var A=this.titleEl();if(!A){return '';}return A.dom.innerHTML;},setRightTitle:function(v){var t=this.el.select('.panel-header-right',true).first();if(!t){return;}t.dom.innerHTML=v;},onClick:function(e){e.preventDefault();this.fireEvent('click',this,e); }}); // Roo/bootstrap/Card.js -Roo.bootstrap.Card=function(A){Roo.bootstrap.Card.superclass.constructor.call(this,A);this.addEvents({});};Roo.extend(Roo.bootstrap.Card,Roo.bootstrap.Component,{weight:'',margin:'',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 A=''; +Roo.bootstrap.Card=function(A){Roo.bootstrap.Card.superclass.constructor.call(this,A);this.addEvents({});};Roo.extend(Roo.bootstrap.Card,Roo.bootstrap.Component,{weight:'',margin:'',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:'',footer:'',childContainer:false,layoutCls:function(){var A=''; var t=this;['','top','bottom','left','right','x','y'].forEach(function(v){if(t['margin'+(v.length?'_':'')+v].length){A+=' m'+(v.length?v[0]:'')+'-'+t['margin'+(v.length?'_':'')+v];}if(t['padding'+(v.length?'_':'')+v].length){A+=' p'+(v.length?v[0]:'')+'-'+t['padding'+(v.length?'_':'')+v]; }});['','xs','sm','lg','xl'].forEach(function(v){if(t['display'+(v.length?'_':'')+v].length){A+=' d'+(v.length?'-':'')+v+'-'+t['margin'+(v.length?'_':'')+v].length}});if(this.hidden){A+=' d-none';}return A;},getAutoCreate:function(){var A={tag:'div',cls:'card',cn:[]} ;if(this.weight.length&&this.weight!='light'){A.cls+=' text-white'}if(this.weight.length){A.cls+=' bg-'+this.weight;}A.cls+=this.layoutCls();if(this.header.length){A.cn.push({tag:this.header_size>0?'h'+this.header_size:'div',cls:'card-header',html:this.header} -);}if(this.header_image.length){A.cn.push({tag:'img',cls:'card-img-top',src:this.header_image});}var B={tag:'div',cls:'card-body',cn:[]};A.push(B);if(this.title.length){B.cn.push({tag:'div',cls:'card-title',src:this.title});}if(this.subtitle.length){B.cn.push({tag:'div',cls:'card-title',src:this.subtitle} -);}B.cn.push({tag:'div',cls:'roo-card-body-ctr'});if(this.footer.length){B.cn.push({tag:'div',cls:'card-footer',html:this.footer});}return A;},getChildContainer:function(){if(!this.el){return false;}return this.el.select('.roo-card-body-ctr',true).first(); -}}); +);}if(this.header_image.length){A.cn.push({tag:'img',cls:'card-img-top',src:this.header_image});}var B={tag:'div',cls:'card-body',cn:[]};A.cn.push(B);if(this.title.length){B.cn.push({tag:'div',cls:'card-title',src:this.title});}if(this.subtitle.length){B.cn.push({tag:'div',cls:'card-title',src:this.subtitle} +);}B.cn.push({tag:'div',cls:'roo-card-body-ctr'});if(this.html.length){B.cn.push({tag:'div',html:this.html});}if(this.footer.length){B.cn.push({tag:'div',cls:'card-footer',html:this.footer});}return A;},getChildContainer:function(){if(!this.el){return false; +}return this.el.select('.roo-card-body-ctr',true).first();}}); // Roo/bootstrap/Img.js Roo.bootstrap.Img=function(A){Roo.bootstrap.Img.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Img,Roo.bootstrap.Component,{imgResponsive:true,border:'',src:'about:blank',href:false,target:false,xsUrl:'',smUrl:'',mdUrl:'',lgUrl:'',getAutoCreate:function(){if(this.src||(!this.xsUrl&&!this.smUrl&&!this.mdUrl&&!this.lgUrl)){return this.createSingleImg(); }var A={tag:'div',cls:'roo-image-responsive-group',cn:[]};var B=this;Roo.each(['xs','sm','md','lg'],function(C){if(!B[C+'Url']){return;}var D={tag:'img',cls:(B.imgResponsive)?'img-responsive':'',html:B.html||A.html,src:B[C+'Url']};D.cls+=' roo-image-responsive-'+C;