roojs-bootstrap.js
authorleon <leon@roojs.com>
Fri, 23 Sep 2022 05:31:26 +0000 (13:31 +0800)
committerleon <leon@roojs.com>
Fri, 23 Sep 2022 05:31:26 +0000 (13:31 +0800)
roojs-bootstrap-debug.js

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

index 58be41b..b5197a6 100644 (file)
@@ -9165,7 +9165,7 @@ Currently the Table  uses multiple headers to try and handle XL / Medium etc...
  * @cfg {Boolean} lazyLoad  auto load data while scrolling to the end (default false)
  * @cfg {Boolean} auto_hide_footer  auto hide footer if only one page (default false)
  * @cfg {Boolean} enableColumnResize default true if columns can be resized = needs scrollBody to be set to work (drag/drop)
- * @cfg {Boolean} disableAutoSize disable auto size
+ * @cfg {Boolean} disableAutoSize disable autoSize() and initCSS()
  *
  * 
  * @cfg {Number} minColumnWidth default 50 pixels minimum column width 
@@ -9506,7 +9506,6 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     initCSS : function()
     {
         if(this.disableAutoSize) {
-            Roo.log("DISABLEINITCSS");
             return;
         }
         
@@ -10513,7 +10512,6 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     autoSize : function()
     {
         if(this.disableAutoSize) {
-            Roo.log("DISABLEAUTOSIZE");
             return;
         }
         //var ctr = Roo.get(this.container.dom.parentElement);
index 91228a5..685798e 100644 (file)
@@ -404,28 +404,27 @@ if(this.footer){this.footer.parentId=this.id;this.footer.onRender(this.el.select
 );}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;
-},initCSS:function(){if(this.disableAutoSize){Roo.log("DISABLEINITCSS");return;}var cm=this.cm,A=[];this.CSS.removeStyleSheet(this.id+'-cssrules');var B=this.headEl?this.headEl.dom.clientHeight:0;var sz=Roo.getGridSize();var C=0;var D=-1;var E=[];var F=0;
-for(var i=0,G=cm.getColumnCount();i<G;i++){var w=cm.getColumnWidth(i,false);if(cm.isHidden(i)){E.push({rel:false,abs:0});continue;}if(w!==false){E.push({rel:false,abs:w});F+=w;D=i;continue;}var w=cm.getColumnWidth(i,sz);if(w>0){D=i}C+=w;E.push({rel:w,abs:false}
-);}var H=this.bodyEl.dom.clientWidth-F;var I=Math.floor(H/C);var J=H-(I*C);var K,L,M=0,N,O;for(var i=0,G=cm.getColumnCount();i<G;i++){K='display:none;';O='';L='width:0px;';N='';if(!cm.isHidden(i)){K='';var w=E[i].rel==false?E[i].abs:(E[i].rel*I);if(w===0){K='display:none;';
-}if(i==D){w+=J;}M+=w;O="left:"+(M-4)+"px;";L="width:"+w+"px;";}if(this.responsive){L='';O='';K=cm.isHidden(i)?'display:none;':'';N='display: none;';}A.push('#',this.id,' .x-col-',i," {",cm.config[i].css,L,K,"}\n");if(this.headEl){if(i==D){N='display:none;';
-}A.push('#',this.id,' .x-hcol-',i," { ",L,K," }\n",'#',this.id,' .x-grid-split-',i," { ",O,N,'height:',(B-4),"px;}\n",'.popover-inner #',this.id,' .x-grid-split-',i," { ",O,N,'height:',100,"%;}\n");}}this.CSS.createStyleSheet(A.join(''),this.id+'-cssrules');
-},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var B=Roo.get(t);if(!B){return;}if(B.findParent('tfoot',false,true)){return;}if(B.findParent('thead',false,true)){if(e.getTarget().nodeName.toLowerCase()!='th'){B=Roo.get(t).findParent('th',false,true);
-if(!B){Roo.log("failed to find th in thead?");Roo.log(e.getTarget());return;}}var C=B.dom.cellIndex;var D=A=='touchstart'?'click':A;this.fireEvent("header"+D,this,C,e);return;}if(e.getTarget().nodeName.toLowerCase()!='td'){B=Roo.get(t).findParent('td',false,true);
-if(!B){Roo.log("failed to find th in tbody?");Roo.log(e.getTarget());return;}}var E=B.findParent('tr',false,true);var C=B.dom.cellIndex;var F=E.dom.rowIndex-1;if(E!==false){this.fireEvent("row"+A,this,F,e);if(B!==false){this.fireEvent("cell"+A,this,F,C,e);
-}}},onMouseover:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseover',this,A,D,C,e);
-},onMouseout:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseout',this,A,D,C,e);
-},onClick:function(e,el){var A=Roo.get(el);if(!A||(!this.cellSelection&&!this.rowSelection)){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true);
-if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex;var D=this.getRowIndex(B);this.fireEvent('cellclick',this,A,D,C,e);this.fireEvent('rowclick',this,B,D,e);},onDblClick:function(e,el){var A=Roo.get(el);if(!A||(!this.cellSelection&&!this.rowSelection)){return;
-}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true);if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex;var D=this.getRowIndex(B);if(this.cellSelection){this.fireEvent('celldblclick',this,A,D,C,e);
-}if(this.rowSelection){this.fireEvent('rowdblclick',this,B,D,e);}},findRowIndex:function(el){var A=Roo.get(el);if(!A){return false;}var B=A.findParent('tr',false,true);if(!B||typeof(B)=='undefined'){return false;}return this.getRowIndex(B);},sort:function(e,el){var A=Roo.get(el);
-if(!A.hasClass('sortable')){return;}var B=A.attr('sort');var C='ASC';if(A.select('i',true).first().hasClass('fa-arrow-up')){C='DESC';}this.store.sortInfo={field:B,direction:C};if(this.footer){Roo.log("calling footer first");this.footer.onClick('first');}else{this.store.load({params:{start:0}
-});}},renderHeader:function(){var A={tag:'thead',cn:[]};var cm=this.cm;this.totalWidth=0;for(var i=0,B=cm.getColumnCount();i<B;i++){var C=cm.config[i];var c={tag:'th',cls:'x-hcol-'+i,style:'',html:cm.getColumnHeader(i)};var D=cm.getColumnTooltip(i);if(D){c.tooltip=D;
-}var hh='';if(typeof(C.sortable)!='undefined'&&C.sortable){c.cls+=' sortable';c.html='<i class="fa"></i>'+c.html;}if(typeof(C.lgHeader)!='undefined'){hh+='<span class="hidden-xs hidden-sm hidden-md ">'+C.lgHeader+'</span>';}if(typeof(C.mdHeader)!='undefined'){hh+='<span class="hidden-xs hidden-sm hidden-lg">'+C.mdHeader+'</span>';
-}if(typeof(C.smHeader)!='undefined'){hh+='<span class="hidden-xs hidden-md hidden-lg">'+C.smHeader+'</span>';}if(typeof(C.xsHeader)!='undefined'){hh+='<span class="hidden-sm hidden-md hidden-lg">'+C.xsHeader+'</span>';}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']);
+},initCSS:function(){if(this.disableAutoSize){return;}var cm=this.cm,A=[];this.CSS.removeStyleSheet(this.id+'-cssrules');var B=this.headEl?this.headEl.dom.clientHeight:0;var sz=Roo.getGridSize();var C=0;var D=-1;var E=[];var F=0;for(var i=0,G=cm.getColumnCount();
+i<G;i++){var w=cm.getColumnWidth(i,false);if(cm.isHidden(i)){E.push({rel:false,abs:0});continue;}if(w!==false){E.push({rel:false,abs:w});F+=w;D=i;continue;}var w=cm.getColumnWidth(i,sz);if(w>0){D=i}C+=w;E.push({rel:w,abs:false});}var H=this.bodyEl.dom.clientWidth-F;
+var I=Math.floor(H/C);var J=H-(I*C);var K,L,M=0,N,O;for(var i=0,G=cm.getColumnCount();i<G;i++){K='display:none;';O='';L='width:0px;';N='';if(!cm.isHidden(i)){K='';var w=E[i].rel==false?E[i].abs:(E[i].rel*I);if(w===0){K='display:none;';}if(i==D){w+=J;}M+=w;
+O="left:"+(M-4)+"px;";L="width:"+w+"px;";}if(this.responsive){L='';O='';K=cm.isHidden(i)?'display:none;':'';N='display: none;';}A.push('#',this.id,' .x-col-',i," {",cm.config[i].css,L,K,"}\n");if(this.headEl){if(i==D){N='display:none;';}A.push('#',this.id,' .x-hcol-',i," { ",L,K," }\n",'#',this.id,' .x-grid-split-',i," { ",O,N,'height:',(B-4),"px;}\n",'.popover-inner #',this.id,' .x-grid-split-',i," { ",O,N,'height:',100,"%;}\n");
+}}this.CSS.createStyleSheet(A.join(''),this.id+'-cssrules');},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var B=Roo.get(t);if(!B){return;}if(B.findParent('tfoot',false,true)){return;
+}if(B.findParent('thead',false,true)){if(e.getTarget().nodeName.toLowerCase()!='th'){B=Roo.get(t).findParent('th',false,true);if(!B){Roo.log("failed to find th in thead?");Roo.log(e.getTarget());return;}}var C=B.dom.cellIndex;var D=A=='touchstart'?'click':A;
+this.fireEvent("header"+D,this,C,e);return;}if(e.getTarget().nodeName.toLowerCase()!='td'){B=Roo.get(t).findParent('td',false,true);if(!B){Roo.log("failed to find th in tbody?");Roo.log(e.getTarget());return;}}var E=B.findParent('tr',false,true);var C=B.dom.cellIndex;
+var F=E.dom.rowIndex-1;if(E!==false){this.fireEvent("row"+A,this,F,e);if(B!==false){this.fireEvent("cell"+A,this,F,C,e);}}},onMouseover:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);
+}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseover',this,A,D,C,e);},onMouseout:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);
+}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseout',this,A,D,C,e);},onClick:function(e,el){var A=Roo.get(el);if(!A||(!this.cellSelection&&!this.rowSelection)){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);
+}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true);if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex;var D=this.getRowIndex(B);this.fireEvent('cellclick',this,A,D,C,e);this.fireEvent('rowclick',this,B,D,e);},onDblClick:function(e,el){var A=Roo.get(el);
+if(!A||(!this.cellSelection&&!this.rowSelection)){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true);if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex;
+var D=this.getRowIndex(B);if(this.cellSelection){this.fireEvent('celldblclick',this,A,D,C,e);}if(this.rowSelection){this.fireEvent('rowdblclick',this,B,D,e);}},findRowIndex:function(el){var A=Roo.get(el);if(!A){return false;}var B=A.findParent('tr',false,true);
+if(!B||typeof(B)=='undefined'){return false;}return this.getRowIndex(B);},sort:function(e,el){var A=Roo.get(el);if(!A.hasClass('sortable')){return;}var B=A.attr('sort');var C='ASC';if(A.select('i',true).first().hasClass('fa-arrow-up')){C='DESC';}this.store.sortInfo={field:B,direction:C}
+;if(this.footer){Roo.log("calling footer first");this.footer.onClick('first');}else{this.store.load({params:{start:0}});}},renderHeader:function(){var A={tag:'thead',cn:[]};var cm=this.cm;this.totalWidth=0;for(var i=0,B=cm.getColumnCount();i<B;i++){var C=cm.config[i];
+var c={tag:'th',cls:'x-hcol-'+i,style:'',html:cm.getColumnHeader(i)};var D=cm.getColumnTooltip(i);if(D){c.tooltip=D;}var hh='';if(typeof(C.sortable)!='undefined'&&C.sortable){c.cls+=' sortable';c.html='<i class="fa"></i>'+c.html;}if(typeof(C.lgHeader)!='undefined'){hh+='<span class="hidden-xs hidden-sm hidden-md ">'+C.lgHeader+'</span>';
+}if(typeof(C.mdHeader)!='undefined'){hh+='<span class="hidden-xs hidden-sm hidden-lg">'+C.mdHeader+'</span>';}if(typeof(C.smHeader)!='undefined'){hh+='<span class="hidden-xs hidden-md hidden-lg">'+C.smHeader+'</span>';}if(typeof(C.xsHeader)!='undefined'){hh+='<span class="hidden-sm hidden-md hidden-lg">'+C.xsHeader+'</span>';
+}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']);
 }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);
@@ -445,7 +444,7 @@ return (typeof(D[B])=='undefined')?false:D[B];},renderRow:function(cm,ds,A){var
 if(typeof(C[A])=='undefined'){return;}C[A][B?'removeClass':'addClass']('d-none');},getSelectionModel:function(){if(!this.selModel){this.selModel=new Roo.bootstrap.Table.RowSelectionModel({grid:this});}return this.selModel;},renderCellObject:function(r){var A=this;
 r.cfg.parentId=(typeof(r.container)=='string')?r.container:r.container.id;var t=r.cfg.render(r.container);if(r.cfg.cn){Roo.each(r.cfg.cn,function(c){var B={container:t.getChildContainer(),cfg:c};A.renderCellObject(B);})}},getRowIndex:function(A){var B=-1;
 Roo.each(this.el.select('tbody > tr',true).elements,function(el,C){if(el!=A){return;}B=C;});return B;},getHeaderIndex:function(A){var B=this.headEl.select('th',true).elements;return B[A];},getCellIndex:function(A){var id=String(A.className).match(Roo.bootstrap.Table.cellRE);
-if(id){return parseInt(id[1],10);}return 0;},getGridEl:function(){return this.el;},autoSize:function(){if(this.disableAutoSize){Roo.log("DISABLEAUTOSIZE");return;}var A=Roo.get(this.el.dom);var B=this.getGridEl().select('thead',true).first();var C=this.getGridEl().select('tbody',true).first();
+if(id){return parseInt(id[1],10);}return 0;},getGridEl:function(){return this.el;},autoSize:function(){if(this.disableAutoSize){return;}var A=Roo.get(this.el.dom);var B=this.getGridEl().select('thead',true).first();var C=this.getGridEl().select('tbody',true).first();
 var D=this.getGridEl().select('tfoot',true).first();var cw=A.getWidth();this.getGridEl().select('tfoot tr, tfoot  td',true).setWidth(cw);if(C){C.setWidth(A.getWidth());var E=(C.dom.offsetWidth-C.dom.clientWidth);cw-=E;}cw=Math.max(cw,this.totalWidth);this.getGridEl().select('tbody tr',true).setWidth(cw);
 this.initCSS();return;},onBodyScroll:function(){if(this.headEl){this.headEl.setStyle({'position':'relative','left':(-1*this.bodyEl.dom.scrollLeft)+'px'});}if(this.lazyLoad){var A=this.bodyEl.dom.scrollHeight;var B=Math.ceil(this.bodyEl.getScroll().top);var C=this.bodyEl.getHeight();
 if(A-C==B){var D=this.ds.getTotalCount();if(this.footer.cursor+this.footer.pageSize<D){this.footer.ds.load({params:{start:this.footer.cursor+this.footer.pageSize,limit:this.footer.pageSize},add:true});}}}},onColumnSplitterMoved:function(i,A){this.userResized=true;