roojs-bootstrap.js
authorleon <leon@roojs.com>
Wed, 30 Nov 2022 05:54:06 +0000 (13:54 +0800)
committerleon <leon@roojs.com>
Wed, 30 Nov 2022 05:54:06 +0000 (13:54 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 41681fe..5128143 100644 (file)
@@ -9157,6 +9157,7 @@ Currently the Table  uses multiple headers to try and handle XL / Medium etc...
  *                also adds table-responsive (see bootstrap docs for details)
  * @cfg {Boolean} loadMask (true|false) default false
  * @cfg {Boolean} footerShow (true|false) generate tfoot, default true
+ * @cfg {Boolean} summaryFooterShow (true|false) generate tfoot for summary, default false
  * @cfg {Boolean} headerShow (true|false) generate thead, default true
  * @cfg {Boolean} rowSelection (true|false) default false
  * @cfg {Boolean} cellSelection (true|false) default false
@@ -9341,6 +9342,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     store : false,
     loadMask : false,
     footerShow : true,
+    summaryFooterShow : false,
     headerShow : true,
     enableColumnResize: true,
     disableAutoSize: false,
@@ -9419,6 +9421,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
             if(this.footerShow){
                 cfg.cn.push(this.renderFooter());
             }
+
+            if(!this.footerShow && this.summaryFooterShow) {
+                cfg.cn.push(this.renderSummaryFooter());
+            }
             // where does this come from?
             //cfg.cls+=  ' TableGrid';
         }
@@ -9978,6 +9984,33 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         
         return footer;
     },
+
+    renderSummaryFooter : function()
+    {
+        var footer = {
+            tag: 'tfoot',
+            cn : []
+        };
+
+        var cm = this.cm;
+        
+        for(var i = 0, len = cm.getColumnCount(); i < len; i++){
+            
+            var config = cm.config[i];
+            
+            var c = {
+                tag: 'td',
+                cls : 'x-fcol-' + i,
+                style : '',
+                
+                html: config.footer
+            };
+            
+            footer.cn.push(c)
+        }
+        
+        return footer;
+    },
     
     
     
@@ -12940,12 +12973,12 @@ Roo.extend(Roo.bootstrap.form.Input, Roo.bootstrap.Component,  {
         }
         if(typeof this.validator == "function"){
             var msg = this.validator(value);
-            if(msg !== true){
-                return false;
-            }
             if (typeof(msg) == 'string') {
                 this.invalidText = msg;
             }
+            if(msg !== true){
+                return false;
+            }
         }
         
         if(this.regex && !this.regex.test(value)){
index ebdebbe..00d34cc 100644 (file)
@@ -395,12 +395,12 @@ Roo.bootstrap.Table=function(A){Roo.bootstrap.Table.superclass.constructor.call(
 this.headerShow=(typeof(A.thead)!='undefined')?A.thead:this.headerShow;this.footerShow=(typeof(A.tfoot)!='undefined')?A.tfoot:this.footerShow;this.view=this;this.sm=this.sm||{xtype:'RowSelectionModel'};if(this.sm){this.sm.grid=this;this.selModel=Roo.factory(this.sm,Roo.grid);
 this.sm=this.selModel;this.sm.xmodule=this.xmodule||false;}if(this.cm&&typeof(this.cm.config)=='undefined'){this.colModel=new Roo.grid.ColumnModel(this.cm);this.cm=this.colModel;this.cm.xmodule=this.xmodule||false;}if(this.store){this.store=Roo.factory(this.store,Roo.data);
 this.ds=this.store;this.ds.xmodule=this.xmodule||false;}if(this.footer&&this.store){this.footer.dataSource=this.ds;this.footer=Roo.factory(this.footer);}this.addEvents({"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclick":true,"mouseover":true,"mouseout":true,'rowclass':true,'rowsrendered':true,"contextmenu":true,"rowcontextmenu":true,"cellcontextmenu":true,"headercontextmenu":true,"mousedown":true}
-);};Roo.extend(Roo.bootstrap.Table,Roo.bootstrap.Component,{cls:false,empty_results:'',striped:false,scrollBody:false,bordered:false,hover:false,condensed:false,responsive:false,sm:false,cm:false,store:false,loadMask:false,footerShow:true,headerShow:true,enableColumnResize:true,disableAutoSize:false,rowSelection:false,cellSelection:false,layout:false,minColumnWidth:50,bodyEl:false,headEl:false,resizeProxy:false,container:false,lazyLoad:false,CSS:Roo.util.CSS,auto_hide_footer:false,view:false,getAutoCreate:function(){var A=Roo.apply({}
+);};Roo.extend(Roo.bootstrap.Table,Roo.bootstrap.Component,{cls:false,empty_results:'',striped:false,scrollBody:false,bordered:false,hover:false,condensed:false,responsive:false,sm:false,cm:false,store:false,loadMask:false,footerShow:true,summaryFooterShow:false,headerShow:true,enableColumnResize:true,disableAutoSize:false,rowSelection:false,cellSelection:false,layout:false,minColumnWidth:50,bodyEl:false,headEl:false,resizeProxy:false,container:false,lazyLoad:false,CSS:Roo.util.CSS,auto_hide_footer:false,view:false,getAutoCreate:function(){var A=Roo.apply({}
 ,Roo.bootstrap.Table.superclass.getAutoCreate.call(this));A={tag:'table',cls:'table',cn:[]};if(this.scrollBody){A.cls+=' table-body-fixed';}if(this.striped){A.cls+=' table-striped';}if(this.hover){A.cls+=' table-hover';}if(this.bordered){A.cls+=' table-bordered';
 }if(this.condensed){A.cls+=' table-condensed';}if(this.responsive){A.cls+=' table-responsive';}if(this.cls){A.cls+=' '+this.cls;}if(this.layout){A.style=(typeof(A.style)=='undefined')?('table-layout:'+this.layout+';'):(A.style+('table-layout:'+this.layout+';'));
-}if(this.store||this.cm){if(this.headerShow){A.cn.push(this.renderHeader());}A.cn.push(this.renderBody());if(this.footerShow){A.cn.push(this.renderFooter());}}return {cn:[A]};},initEvents:function(){if(!this.store||!this.cm){return;}if(this.selModel){this.selModel.initEvents();
-}this.bodyEl=this.el.select('tbody',true).first();this.headEl=this.el.select('thead',true).first();this.mainFoot=this.el.select('tfoot',true).first();Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.on('click',this.sort,this);},this);
-if(this.footer){this.footer.parentId=this.id;this.footer.onRender(this.el.select('tfoot tr td').first(),null);if(this.lazyLoad){this.el.select('tfoot tr td').first().addClass('hide');}}if(this.loadMask){this.maskEl=new Roo.LoadMask(this.el,{store:this.ds,msgCls:'roo-el-mask-msg'}
+}if(this.store||this.cm){if(this.headerShow){A.cn.push(this.renderHeader());}A.cn.push(this.renderBody());if(this.footerShow){A.cn.push(this.renderFooter());}if(!this.footerShow&&this.summaryFooterShow){A.cn.push(this.renderSummaryFooter());}}return {cn:[A]}
+;},initEvents:function(){if(!this.store||!this.cm){return;}if(this.selModel){this.selModel.initEvents();}this.bodyEl=this.el.select('tbody',true).first();this.headEl=this.el.select('thead',true).first();this.mainFoot=this.el.select('tfoot',true).first();Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.on('click',this.sort,this);
+},this);if(this.footer){this.footer.parentId=this.id;this.footer.onRender(this.el.select('tfoot tr td').first(),null);if(this.lazyLoad){this.el.select('tfoot tr td').first().addClass('hide');}}if(this.loadMask){this.maskEl=new Roo.LoadMask(this.el,{store:this.ds,msgCls:'roo-el-mask-msg'}
 );}this.store.on('load',this.onLoad,this);this.store.on('beforeload',this.onBeforeLoad,this);this.store.on('update',this.onUpdate,this);this.store.on('add',this.onAdd,this);this.store.on("clear",this.clear,this);this.el.on("contextmenu",this.onContextMenu,this);
 this.cm.on("headerchange",this.onHeaderChange,this);this.cm.on("hiddenchange",this.onHiddenChange,this,arguments);this.bodyEl.on("click",this.onClick,this);this.bodyEl.on("dblclick",this.onDblClick,this);this.bodyEl.on('scroll',this.onBodyScroll,this);this.relayEvents(this.bodyEl,["mousedown","mouseup","mouseover","mouseout","keypress"]);
 this.resizeProxy=Roo.get(document.body).createChild({cls:"x-grid-resize-proxy",html:'&#160;'});if(this.headEl&&this.enableColumnResize!==false&&Roo.grid.SplitDragZone){new Roo.grid.SplitDragZone(this,this.headEl.dom,false);}this.initCSS();},getView:function(){return this;
@@ -424,7 +424,8 @@ var c={tag:'th',cls:'x-hcol-'+i,style:'',html:cm.getColumnHeader(i)};var D=cm.ge
 }if(hh.length){c.html=hh;}if(typeof(C.tooltip)!='undefined'){c.tooltip=C.tooltip;}if(typeof(C.colspan)!='undefined'){c.colspan=C.colspan;}if(typeof(C.dataIndex)!='undefined'){c.sort=C.dataIndex;}if(typeof(C.align)!='undefined'&&C.align.length){c.style+=' text-align:'+C.align+';';
 }if(typeof(C.cls)!='undefined'){c.cls=(typeof(c.cls)=='undefined')?C.cls:(c.cls+' '+C.cls);}if(this.responsive){['xs','sm','md','lg'].map(function(E){if(typeof(C[E])=='undefined'){return;}if(!C[E]){c.cls+=' hidden-'+E+' hidden'+E+'-down';return;}c.cls+=' col-'+E+'-'+C[E]+(E=='xs'?(' col-'+C[E]):'');
 });}c.html+=' <span class="x-grid-split x-grid-split-'+i+'"></span>';A.cn.push(c)}return A;},renderBody:function(){var A={tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:this.cm.getColumnCount()}]}]};return A;},renderFooter:function(){var A={tag:'tfoot',cn:[{tag:'tr',cn:[{tag:'td',colspan:this.cm.getColumnCount()}
-]}]};return A;},onLoad:function(){this.clear();var A=this;var cm=this.cm;var ds=this.store;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.select('i',true).removeClass(['fa-arrow-up','fa-arrow-down']);if(A.store.sortInfo){if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='ASC'){e.select('i',true).addClass(['fa-arrow-up']);
+]}]};return A;},renderSummaryFooter:function(){var A={tag:'tfoot',cn:[]};var cm=this.cm;for(var i=0,B=cm.getColumnCount();i<B;i++){var C=cm.config[i];var c={tag:'td',cls:'x-fcol-'+i,style:'',html:C.footer};A.cn.push(c)}return A;},onLoad:function(){this.clear();
+var A=this;var cm=this.cm;var ds=this.store;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.select('i',true).removeClass(['fa-arrow-up','fa-arrow-down']);if(A.store.sortInfo){if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='ASC'){e.select('i',true).addClass(['fa-arrow-up']);
 }if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='DESC'){e.select('i',true).addClass(['fa-arrow-down']);}}});var B=this.bodyEl;if(ds.getCount()>0){ds.data.each(function(d,E){var F=this.renderRow(cm,ds,E);
 B.createChild(F);var G=this;if(F.cellObjects.length){Roo.each(F.cellObjects,function(r){G.renderCellObject(r);})}},this);}else if(this.empty_results.length){this.el.mask(this.empty_results,'no-spinner');}var C=this.el.select('tfoot',true).first();if(this.footerShow&&this.auto_hide_footer&&this.mainFoot){this.mainFoot.setVisibilityMode(Roo.Element.DISPLAY).hide();
 var D=this.ds.getTotalCount();if(this.footer.pageSize<D){this.mainFoot.show();}}Roo.each(this.el.select('tbody td',true).elements,function(e){e.on('mouseover',A.onMouseover,A);});Roo.each(this.el.select('tbody td',true).elements,function(e){e.on('mouseout',A.onMouseout,A);
@@ -544,7 +545,7 @@ if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(t
 }if(this.inputEl().is('input[type=password]')&&Roo.isSafari){this.inputEl().on('keydown',this.SafariOnKeyDown,this);}if(typeof(this.before)=='object'){this.before.render(this.el.select('.roo-input-before',true).first());}if(typeof(this.after)=='object'){this.after.render(this.el.select('.roo-input-after',true).first());
 }this.inputEl().on('change',this.onChange,this);},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},validate:function(){if(this.disabled||this.validateValue(this.getRawValue())){this.markValid();return true;
 }this.markInvalid();return false;},validateValue:function(A){if(this.getVisibilityEl().hasClass('hidden')){return true;}if(A.length<1){if(this.allowBlank){return true;}return false;}if(A.length<this.minLength){return false;}if(A.length>this.maxLength){return false;
-}if(this.vtype){var vt=Roo.form.VTypes;if(!vt[this.vtype](A,this)){return false;}}if(typeof this.validator=="function"){var B=this.validator(A);if(B!==true){return false;}if(typeof(B)=='string'){this.invalidText=B;}}if(this.regex&&!this.regex.test(A)){return false;
+}if(this.vtype){var vt=Roo.form.VTypes;if(!vt[this.vtype](A,this)){return false;}}if(typeof this.validator=="function"){var B=this.validator(A);if(typeof(B)=='string'){this.invalidText=B;}if(B!==true){return false;}}if(this.regex&&!this.regex.test(A)){return false;
 }return true;},fireKey:function(e){if(e.isNavKeyPress()){this.fireEvent("specialkey",this,e);}},focus:function(A){if(this.rendered){this.inputEl().focus();if(A===true){this.inputEl().dom.select();}}return this;},onFocus:function(){if(!Roo.isOpera&&this.focusClass){}
 if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this);}},beforeBlur:Roo.emptyFn,onBlur:function(){this.beforeBlur();if(!Roo.isOpera&&this.focusClass){}this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate();
 }var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue);}this.fireEvent("blur",this);},onChange:function(e){var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent('change',this,v,this.startValue);