Thu, 31 Jan 2019 17:16:51 +0100
The miscs grid rebuild to use a popup editor for the rows.
/* jQWidgets v6.2.0 (2018-Dec) Copyright (c) 2011-2018 jQWidgets. License: https://jqwidgets.com/license/ */ /* eslint-disable */ (function(a){a.extend(a.jqx._jqxGrid.prototype,{selectallrows:function(){this._trigger=false;var d=this.virtualmode?this.dataview.totalrecords:this.dataview.loadedrecords.length;this.selectedrowindexes=new Array();var e=this.dataview.loadedrecords;for(var c=0;c<d;c++){var f=e[c];if(!f){this.selectedrowindexes[c]=c;continue}var b=this.getboundindex(f);if(b!=undefined){this.selectedrowindexes[c]=b}}if(this.selectionmode=="checkbox"&&!this._checkboxcolumnupdating){if(this._checkboxcolumn){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:true})}}this._renderrows(this.virtualsizeinfo);this._trigger=true;if(this.selectionmode=="checkbox"){this._raiseEvent(2,{rowindex:this.selectedrowindexes})}},unselectallrows:function(){this._trigger=false;var b=this.virtualmode?this.dataview.totalrecords:this.dataview.loadedrecords.length;this.selectedrowindexes=new Array();if(this.selectionmode=="checkbox"&&!this._checkboxcolumnupdating){if(this._checkboxcolumn){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:false})}}this._renderrows(this.virtualsizeinfo);this._trigger=true;if(this.selectionmode=="checkbox"){this._raiseEvent(2,{rowindex:this.selectedrowindexes})}},selectrow:function(b,c){this._applyrowselection(b,true,c);if(c!==false){this._updatecheckboxselection()}},_updatecheckboxselection:function(){if(this.selectionmode=="checkbox"){var d=this.getrows();if(d&&this._checkboxcolumn){if(d.length===0){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:false});return}var c=d.length;if(this.groupable){c=this.dataview.loadedrecords.length}if(this.virtualmode){c=this.source._source.totalrecords}var b=this.selectedrowindexes.length;if(b===c){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:true})}else{if(b===0){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:false})}else{this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:null})}}}}},unselectrow:function(b,c){this._applyrowselection(b,false,c);if(c!==false){this._updatecheckboxselection()}},selectcell:function(c,b){this._applycellselection(c,b,true)},unselectcell:function(c,b){this._applycellselection(c,b,false)},clearselection:function(c,d){this._trigger=false;this.selectedrowindex=-1;this._oldselectedcell=null;if(d!==false){for(var b=0;b<this.selectedrowindexes.length;b++){this._raiseEvent(3,{rowindex:this.selectedrowindexes[b]})}}this.selectedrowindexes=new Array();this.selectedcells=new Array();this.selectedcell=null;if(this.selectionmode=="checkbox"&&!this._checkboxcolumnupdating){this._checkboxcolumn.checkboxelement.jqxCheckBox({checked:false})}if(false===c){this._trigger=true;return}this._renderrows(this.virtualsizeinfo);this._trigger=true;if(this.selectionmode=="checkbox"){this._raiseEvent(3,{rowindex:this.selectedrowindexes})}},getselectedrowindex:function(){if(this.selectedrowindex==-1||this.selectedrowindex==undefined){for(var b=0;b<this.selectedrowindexes.length;b++){return this.selectedrowindexes[b]}}return this.selectedrowindex},getselectedrowindexes:function(){return this.selectedrowindexes},getselectedcell:function(){if(!this.selectedcell){return null}var b=this.selectedcell;b.row=this.selectedcell.rowindex;b.column=this.selectedcell.datafield;b.value=this.getcellvalue(b.row,b.column);return b},getselectedcells:function(){var b=new Array();for(obj in this.selectedcells){b[b.length]=this.selectedcells[obj]}return b},_getcellsforcopypaste:function(){var e=new Array();if(this.selectionmode.indexOf("cell")==-1){var h=this.selectedrowindexes;for(var d=0;d<h.length;d++){var c=h[d];for(var f=0;f<this.columns.records.length;f++){if(this.columns.records[f].datafield==="_checkboxcolumn"){continue}var g=c+"_"+this.columns.records[f].datafield;var b={rowindex:c,datafield:this.columns.records[f].datafield};e.push(b)}}}return e},deleteselection:function(){var d=this;var f=d.getselectedcells();if(this.selectionmode.indexOf("cell")==-1){f=this._getcellsforcopypaste()}if(f!=null&&f.length>0){for(var e=0;e<f.length;e++){var b=f[e];var g=d.getcolumn(b.datafield);var h=d.getcellvalue(b.rowindex,b.datafield);if(!g){continue}if(h!==""){var c=null;if(g.columntype=="checkbox"){if(!g.threestatecheckbox){c=false}}d._raiseEvent(17,{rowindex:b.rowindex,datafield:b.datafield,value:h});if(e==f.length-1){d.setcellvalue(b.rowindex,b.datafield,c,true);if(g.displayfield!=g.datafield){d.setcellvalue(b.rowindex,g.displayfield,c,true)}}else{d.setcellvalue(b.rowindex,b.datafield,c,false);if(g.displayfield!=g.datafield){d.setcellvalue(b.rowindex,g.displayfield,c,true)}}d._raiseEvent(18,{rowindex:b.rowindex,datafield:b.datafield,oldvalue:h,value:c})}}this.dataview.updateview();this._renderrows(this.virtualsizeinfo)}},copyselection:function(){var n="";var s=this;this.clipboardselection={};this.logicalclipboardselection={};this._clipboardselection=[];var r=s.getselectedcells();if(this.selectionmode.indexOf("cell")==-1){r=this._getcellsforcopypaste()}var b=0;var e=new Array();if(r!=null&&r.length>0){var t=999999999999999;var q=-1;for(var j=0;j<r.length;j++){var l=r[j];var d=s.getcolumn(l.datafield);if(d!=null&&d.clipboard&&(!d.hidden||this.copytoclipboardhiddencolumns)){if(e.indexOf(d.text)==-1){e.push(d.text)}var p=s.getcelltext(l.rowindex,d.displayfield);var h=this.getrowdisplayindex(l.rowindex);if(!this.clipboardselection[h]){this.clipboardselection[h]={}}this.clipboardselection[h][d.displayfield]=p;if(!this.logicalclipboardselection[h]){this.logicalclipboardselection[h]={}}this.logicalclipboardselection[h][d.displayfield]=p;if(d.displayfield!=d.datafield){this.logicalclipboardselection[h][d.datafield]=s.getcellvalue(l.rowindex,d.datafield)}t=Math.min(t,h);q=Math.max(q,h)}}var g=new Array();for(var f=t;f<=q;f++){if(!this.logicalclipboardselection[f]){continue}var o=a.extend({},this.logicalclipboardselection[f]);g.push(o)}this.logicalclipboardselection=g;if(this.copytoclipboardwithheaders){for(var c=0;c<e.length;c++){if(c>0){n+="\t"}n+=e[c]}n+="\r\n"}for(var f=t;f<=q;f++){var k=0;this._clipboardselection[this._clipboardselection.length]=new Array();if(this.clipboardselection[f]!=undefined){a.each(this.clipboardselection[f],function(i,m){if(k>0){n+="\t"}var u=m;if(m==null){u=""}s._clipboardselection[s._clipboardselection.length-1][k]=u;k++;n+=u})}else{continue}if(f<q){n+="\r\n"}}}this.clipboardselectedtext=n;return n},pasteselection:function(){var g=this.getselectedcells();this._oldselectedcell=null;if(this.selectionmode.indexOf("cell")==-1){g=this._getcellsforcopypaste()}if(g!=null&&g.length>0){var h=g[0].rowindex;var w=this.getrowdisplayindex(h);var q=g[0].datafield;var u=this._getcolumnindex(q);var o=0;this.selectedrowindexes=new Array();this.selectedcells=new Array();var k=g.length;var B=0;var d=new Array();if(this.copytoclipboardwithheaders){this._clipboardselection.splice(0,1)}for(var z=0;z<this._clipboardselection.length;z++){B+=this._clipboardselection[z].length;d[z]=new Array();for(var y=0;y<this._clipboardselection[z].length;y++){var r=this._clipboardselection[z][y];d[z].push(r)}}if(B<g.length){var n=new Array();for(var z=0;z<g.length;z++){var e=g[z];if(!n[e.rowindex]){n[e.rowindex]=new Array()}n[e.rowindex].push(e)}var A=0;var D=0;for(var z=0;z<n.length;z++){if(!n[z]){continue}for(var y=0;y<n[z].length;y++){var e=n[z][y];var m=e.rowindex;var f=this.getcolumn(e.datafield);if(f.datafield==="_checkboxcolumn"){continue}if(f.hidden){continue}var r="";if(undefined==d[A][D]){D=0}r=d[A][D];D++;if(f.cellsformat){if(f.cellsformat.indexOf("p")!=-1||f.cellsformat.indexOf("c")!=-1||f.cellsformat.indexOf("n")!=-1||f.cellsformat.indexOf("f")!=-1){if(r.indexOf(this.gridlocalization.currencysymbol)>-1){r=r.replace(this.gridlocalization.currencysymbol,"")}var b=function(x,j,t){var c=x;if(j==t){return x}var i=c.indexOf(j);while(i!=-1){c=c.replace(j,t);i=c.indexOf(j)}return c};r=b(r,this.gridlocalization.thousandsseparator,"");r=r.replace(this.gridlocalization.decimalseparator,".");if(r.indexOf(this.gridlocalization.percentsymbol)>-1){r=r.replace(this.gridlocalization.percentsymbol,"")}var E="";for(var s=0;s<r.length;s++){var p=r.substring(s,s+1);if(p==="-"){E+="-"}if(p==="."){E+="."}if(p.match(/^[0-9]+$/)!=null){E+=p}}r=E;r=r.replace(/ /g,"");r=new Number(r);if(isNaN(r)){r=""}}}this._raiseEvent(17,{rowindex:m,datafield:e.datafield,value:r});this.setcellvalue(m,f.displayfield,r,false);if(f.displayfield!=f.datafield&&this.logicalclipboardselection){if(this.logicalclipboardselection[m]){var v=this.logicalclipboardselection[m][f.datafield];if(v!=undefined){this.setcellvalue(m,f.datafield,v,false)}}}this._raiseEvent(18,{rowindex:m,datafield:e.datafield,oldvalue:this.getcellvalue(e.rowindex,e.datafield),value:r});this._applycellselection(m,e.datafield,true,false)}A++;D=0;if(!d[A]){A=0}}}else{if(!this._clipboardselection){return}for(var l=0;l<this._clipboardselection.length;l++){for(var C=0;C<this._clipboardselection[l].length;C++){var f=this.getcolumnat(u+C);if(!f){continue}if(f.datafield==="_checkboxcolumn"){continue}if(f.hidden){continue}var m=this.getrowboundindex(w+l);var e=this.getcell(m,f.datafield);var r=null;r=this._clipboardselection[l][C];if(r!=null){if(f.cellsformat){if(f.cellsformat.indexOf("p")!=-1||f.cellsformat.indexOf("c")!=-1||f.cellsformat.indexOf("n")!=-1||f.cellsformat.indexOf("f")!=-1){if(r.indexOf(this.gridlocalization.currencysymbol)>-1){r=r.replace(this.gridlocalization.currencysymbol,"")}var b=function(x,j,t){var c=x;if(j==t){return x}var i=c.indexOf(j);while(i!=-1){c=c.replace(j,t);i=c.indexOf(j)}return c};r=b(r,this.gridlocalization.thousandsseparator,"");r=r.replace(this.gridlocalization.decimalseparator,".");if(r.indexOf(this.gridlocalization.percentsymbol)>-1){r=r.replace(this.gridlocalization.percentsymbol,"")}var E="";for(var s=0;s<r.length;s++){var p=r.substring(s,s+1);if(p==="-"){E+="-"}if(p==="."){E+="."}if(p.match(/^[0-9]+$/)!=null){E+=p}}r=E;r=r.replace(/ /g,"");r=new Number(r);if(isNaN(r)){r=""}}}this._raiseEvent(17,{rowindex:m,datafield:e.datafield,value:r});this.setcellvalue(m,f.displayfield,r,false);if(f.displayfield!=f.datafield&&this.logicalclipboardselection){var v=this.logicalclipboardselection[l][f.datafield];if(v!=undefined){this.setcellvalue(m,f.datafield,v,false)}}this._raiseEvent(18,{rowindex:m,datafield:e.datafield,oldvalue:this.getcellvalue(e.rowindex,e.datafield),value:r});this._applycellselection(m,e.datafield,true,false)}}}}if(this.selectionmode=="checkbox"){this._updatecheckboxselection()}this.dataview.updateview();this._renderrows(this.virtualsizeinfo)}if(this.clipboardend){this.clipboardend("paste")}},_applyrowselection:function(e,i,f,h,b){if(e==null){return false}var j=this.selectedrowindex;if(this.selectionmode=="singlerow"){if(i){this._raiseEvent(2,{rowindex:e,row:this.getrowdata(e)})}else{this._raiseEvent(3,{rowindex:e,row:this.getrowdata(e)})}this._raiseEvent(3,{rowindex:j});this.selectedrowindexes=new Array();this.selectedcells=new Array()}if(h==true){this.selectedrowindexes=new Array()}if(this.dataview.filters.length>0){var c=this.getrowdata(e);if(c&&c.dataindex!==undefined){e=c.dataindex}else{if(c&&c.dataindex===undefined){if(c.uid!=undefined){e=this.getrowboundindexbyid(c.uid)}}}}var d=this.selectedrowindexes.indexOf(e);if(i){this.selectedrowindex=e;if(d==-1){this.selectedrowindexes.push(e);if(this.selectionmode!="singlerow"){this._raiseEvent(2,{rowindex:e,row:this.getrowdata(e)})}}else{if(this.selectionmode=="multiplerows"){this.selectedrowindexes.splice(d,1);this._raiseEvent(3,{rowindex:this.selectedrowindex,row:this.getrowdata(e)});this.selectedrowindex=this.selectedrowindexes.length>0?this.selectedrowindexes[this.selectedrowindexes.length-1]:-1}}}else{if(d>=0||this.selectionmode=="singlerow"||this.selectionmode=="multiplerowsextended"||this.selectionmode=="multiplerowsadvanced"){var g=this.selectedrowindexes[d];this.selectedrowindexes.splice(d,1);this._raiseEvent(3,{rowindex:g,row:this.getrowdata(e)});this.selectedrowindex=-1}}if(f==undefined||f){this._rendervisualrows()}return true},_applycellselection:function(e,b,h,f){if(e==null){return false}if(b==null){return false}var j=this.selectedrowindex;if(this.selectionmode=="singlecell"){var d=this.selectedcell;if(d!=null){this._raiseEvent(16,{rowindex:d.rowindex,datafield:d.datafield})}this.selectedcells=new Array()}if(this.selectionmode=="multiplecellsextended"||this.selectionmode=="multiplecellsadvanced"){var d=this.selectedcell;if(d!=null){this._raiseEvent(16,{rowindex:d.rowindex,datafield:d.datafield})}}var g=e+"_"+b;if(this.dataview.filters.length>0){var c=this.getrowdata(e);if(c&&c.dataindex!==undefined){e=c.dataindex;var g=e+"_"+b}else{if(c&&c.dataindex===undefined){if(c.uid){e=this.getrowboundindexbyid(c.uid);var g=e+"_"+b}}}}var i={rowindex:e,datafield:b};if(h){this.selectedcell=i;if(!this.selectedcells[g]){this.selectedcells[g]=i;this.selectedcells.length++;this._raiseEvent(15,i)}else{if(this.selectionmode=="multiplecells"||this.selectionmode=="multiplecellsextended"||this.selectionmode=="multiplecellsadvanced"){delete this.selectedcells[g];if(this.selectedcells.length>0){this.selectedcells.length--}this._raiseEvent(16,i)}}}else{delete this.selectedcells[g];if(this.selectedcells.length>0){this.selectedcells.length--}this._raiseEvent(16,i)}if(f==undefined||f){this._rendervisualrows()}return true},_getcellindex:function(b){var c=-1;a.each(this.selectedcells,function(){c++;if(this[b]){return false}});return c},_clearhoverstyle:function(){if(undefined==this.hoveredrow||this.hoveredrow==-1){return}if(this.vScrollInstance.isScrolling()){return}if(this.hScrollInstance.isScrolling()){return}var b=this.table.find(".jqx-grid-cell-hover");if(b.length>0){b.removeClass(this.toTP("jqx-grid-cell-hover"));b.removeClass(this.toTP("jqx-fill-state-hover"))}this.hoveredrow=-1},_clearselectstyle:function(){var k=this.table[0].rows.length;var p=this.table[0].rows;var l=this.toTP("jqx-grid-cell-selected");var c=this.toTP("jqx-fill-state-pressed");var m=this.toTP("jqx-grid-cell-hover");var h=this.toTP("jqx-fill-state-hover");for(var g=0;g<k;g++){var b=p[g];var f=b.cells.length;var o=b.cells;for(var e=0;e<f;e++){var d=o[e];var n=a(d);if(d.className.indexOf("jqx-grid-cell-selected")!=-1){n.removeClass(l);n.removeClass(c)}if(d.className.indexOf("jqx-grid-cell-hover")!=-1){n.removeClass(m);n.removeClass(h)}}}},_selectpath:function(n,e){var l=this;var i=this._lastClickedCell?Math.min(this._lastClickedCell.row,n):0;var k=this._lastClickedCell?Math.max(this._lastClickedCell.row,n):0;if(i<=k){var h=this._getcolumnindex(this._lastClickedCell.column);var g=this._getcolumnindex(e);var f=Math.min(h,g);var d=Math.max(h,g);this.selectedcells=new Array();var m=this.dataview.loadedrecords;for(var b=i;b<=k;b++){for(var j=f;j<=d;j++){var n=m[b];this._applycellselection(l.getboundindex(n),l._getcolumnat(j).datafield,true,false)}}this._rendervisualrows()}},_selectrowpath:function(g){if(this.selectionmode=="multiplerowsextended"){var c=this;var b=this._lastClickedCell?Math.min(this._lastClickedCell.row,g):0;var h=this._lastClickedCell?Math.max(this._lastClickedCell.row,g):0;var f=this.dataview.loadedrecords;if(b<=h){this.selectedrowindexes=new Array();for(var e=b;e<=h;e++){var g=f[e];var d=this.getrowboundindex(e);this._applyrowselection(d,true,false)}this._rendervisualrows()}}},_selectrowwithmouse:function(p,b,c,f,d,s){var j=b.row;if(j==undefined){return}var k=b.index;if(this.hittestinfo[k]==undefined){return}var t=this.hittestinfo[k].visualrow;if(this.hittestinfo[k].details){return}var m=t.cells[0].className;if(j.group){return}if(this.selectionmode=="multiplerows"||this.selectionmode=="multiplecells"||this.selectionmode=="checkbox"||(this.selectionmode.indexOf("multiple")!=-1&&(s==true||d==true))){var l=this.getboundindex(j);if(this.dataview.filters.length>0){var v=this.getrowdata(l);if(v){l=v.dataindex;if(l==undefined){var l=this.getboundindex(j)}}}var q=c.indexOf(l)!=-1;var w=this.getboundindex(j)+"_"+f;if(this.selectionmode.indexOf("cell")!=-1){var h=this.selectedcells[w]!=undefined;if(this.selectedcells[w]!=undefined&&h){this._selectcellwithstyle(p,false,k,f,t)}else{this._selectcellwithstyle(p,true,k,f,t)}if(s&&this._lastClickedCell==undefined){var g=this.getselectedcells();if(g&&g.length>0){this._lastClickedCell={row:g[0].rowindex,column:g[0].datafield}}}if(s&&this._lastClickedCell){this._selectpath(j.visibleindex,f);this.mousecaptured=false;if(this.selectionarea.css("visibility")=="visible"){this.selectionarea.css("visibility","hidden")}}}else{if(q){if(d){this._applyrowselection(this.getboundindex(j),false)}else{this._selectrowwithstyle(p,t,false,f)}}else{this._selectrowwithstyle(p,t,true,f)}if(s&&this._lastClickedCell==undefined){var i=this.getselectedrowindexes();if(i&&i.length>0){this._lastClickedCell={row:i[0],column:f}}}if(s&&this._lastClickedCell){this.selectedrowindexes=new Array();var e=this._lastClickedCell?Math.min(this._lastClickedCell.row,j.visibleindex):0;var u=this._lastClickedCell?Math.max(this._lastClickedCell.row,j.visibleindex):0;var n=this.dataview.loadedrecords;for(var o=e;o<=u;o++){var j=n[o];if(j){this._applyrowselection(this.getboundindex(j),true,false,false)}}this._rendervisualrows()}}}else{this._clearselectstyle();this._selectrowwithstyle(p,t,true,f);if(this.selectionmode.indexOf("cell")!=-1){this._selectcellwithstyle(p,true,k,f,t)}}if(!s){this._lastClickedCell={row:j.visibleindex,column:f}}},_selectcellwithstyle:function(d,c,g,f,e){var b=a(e.cells[d._getcolumnindex(f)]);b.removeClass(this.toTP("jqx-grid-cell-hover"));b.removeClass(this.toTP("jqx-fill-state-hover"));if(c){b.addClass(this.toTP("jqx-grid-cell-selected"));b.addClass(this.toTP("jqx-fill-state-pressed"))}else{b.removeClass(this.toTP("jqx-grid-cell-selected"));b.removeClass(this.toTP("jqx-fill-state-pressed"))}},_selectrowwithstyle:function(e,h,b,j){var c=h.cells.length;var f=0;if(e.rowdetails&&e.showrowdetailscolumn){if(!this.rtl){f=1+this.groups.length}else{c-=1;c-=this.groups.length}}else{if(this.groupable){if(!this.rtl){f=this.groups.length}else{c-=this.groups.length}}}for(var g=f;g<c;g++){var d=h.cells[g];if(b){a(d).removeClass(this.toTP("jqx-grid-cell-hover"));a(d).removeClass(this.toTP("jqx-fill-state-hover"));if(e.selectionmode.indexOf("cell")==-1){a(d).addClass(this.toTP("jqx-grid-cell-selected"));a(d).addClass(this.toTP("jqx-fill-state-pressed"))}}else{a(d).removeClass(this.toTP("jqx-grid-cell-hover"));a(d).removeClass(this.toTP("jqx-grid-cell-selected"));a(d).removeClass(this.toTP("jqx-fill-state-hover"));a(d).removeClass(this.toTP("jqx-fill-state-pressed"))}}},_handlemousemoveselection:function(ac,r){if(r.hScrollInstance.isScrolling()||r.vScrollInstance.isScrolling()){return false}if((r.selectionmode=="multiplerowsextended"||r.selectionmode=="multiplecellsextended"||r.selectionmode=="multiplecellsadvanced")&&r.mousecaptured){if(r.multipleselectionbegins){var b=r.multipleselectionbegins(ac);if(b===false){return true}}var ab=this.showheader?this.columnsheader.height()+2:0;var J=this._groupsheader()?this.groupsheader.height():0;var L=this.showtoolbar?this.toolbar.height():0;J+=L;var aa=this.host.coord();if(this.hasTransform){aa=a.jqx.utilities.getOffset(this.host);var ae=this._getBodyOffset();aa.left-=ae.left;aa.top-=ae.top}if(this.host.css("border-top-width")==="0px"){J-=2}var N=ac.pageX;var M=ac.pageY-J;if(Math.abs(this.mousecaptureposition.left-N)>3||Math.abs(this.mousecaptureposition.top-M)>3){var g=parseInt(this.columnsheader.coord().top);if(this.hasTransform){g=a.jqx.utilities.getOffset(this.columnsheader).top}if(N<aa.left){N=aa.left}if(N>aa.left+this.host.width()){N=aa.left+this.host.width()}var Y=aa.top+ab;if(M<Y){M=Y+5}var K=parseInt(Math.min(r.mousecaptureposition.left,N));var h=-5+parseInt(Math.min(r.mousecaptureposition.top,M));var I=parseFloat(Math.abs(r.mousecaptureposition.left-N));var Q=parseInt(Math.abs(r.mousecaptureposition.top-M));K-=aa.left;h-=aa.top;this.selectionarea.css("visibility","visible");if(r.selectionmode=="multiplecellsadvanced"){var N=K;var u=N+I;var H=N;var o=r.hScrollInstance;var w=o.value;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){w=o.max-o.value}if(this.vScrollBar[0].style.visibility!="hidden"){}}var j=r.table[0].rows[0];var U=0;var C=r.mousecaptureposition.clickedcell;var B=C;var n=false;var s=0;var ad=j.cells.length;if(r.mousecaptureposition.left<=ac.pageX){s=C}var c=false;for(var X=s;X<ad;X++){var Z=parseFloat(a(this.columnsrow[0].cells[X]).css("left"));var l=Z-w;if(r.columns.records[X].pinned&&!r.columns.records[X].hidden){if(X==C){c=true}var T=Z+a(this.columnsrow[0].cells[X]).width();if(r.mousecaptureposition.left>ac.pageX){if(T>=N&&N>=l){B=X;n=true;break}}else{if(T>=u&&u>=l){B=X;n=true;break}}continue}if(c){n=true;B--;break}var P=this._getcolumnat(X);if(P!=null&&P.hidden){continue}if(r.groupable&&r.groups.length>0){if(X<r.groups.length){continue}}var T=l+a(this.columnsrow[0].cells[X]).width();if(r.mousecaptureposition.left>ac.pageX){if(T>=N&&N>=l){B=X;n=true;break}}else{if(T>=u&&u>=l){B=X;n=true;break}}}if(!n){if(r.mousecaptureposition.left>ac.pageX){a.each(this.columns.records,function(i,k){if(r.groupable&&r.groups.length>0){if(i<r.groups.length){return true}}if(!this.pinned&&!this.hidden){B=i;return false}})}else{if(!r.groupable||(r.groupable&&!r.groups.length>0)){B=j.cells.length-1}}}var O=C;C=Math.min(C,B);B=Math.max(O,B);h+=5;h+=J;var S=r.table[0].rows.indexOf(r.mousecaptureposition.clickedrow);var z=0;var f=-1;var v=-1;var e=0;for(var X=0;X<r.table[0].rows.length;X++){var t=a(r.table[0].rows[X]);if(X==0){e=t.coord().top}var G=t.height();var A=e-aa.top;if(f==-1&&A+G>=h){var d=false;for(var R=0;R<r.groups.length;R++){var W=t[0].cells[R].className;if(W.indexOf("jqx-grid-group-collapse")!=-1||W.indexOf("jqx-grid-group-expand")!=-1){d=true;break}}if(d){continue}f=X}e+=G;if(r.groupable&&r.groups.length>0){var d=false;for(var R=0;R<r.groups.length;R++){var W=t[0].cells[R].className;if(W.indexOf("jqx-grid-group-collapse")!=-1||W.indexOf("jqx-grid-group-expand")!=-1){d=true;break}}if(d){continue}var U=0;for(var V=r.groups.length;V<t[0].cells.length;V++){var F=t[0].cells[V];if(a(F).html()==""){U++}}if(U==t[0].cells.length-r.groups.length){continue}}if(f!=-1){z+=G}if(A+G>h+Q){v=X;break}}if(f!=-1){h=a(r.table[0].rows[f]).coord().top-aa.top-J-2;var E=0;if(this.filterable&&this.showfilterrow){E=this.filterrowheight}if(parseFloat(r.table[0].style.top)<0&&h<this.rowsheight+E){h-=parseFloat(r.table[0].style.top);z+=parseFloat(r.table[0].style.top)}Q=z;var m=a(this.columnsrow[0].cells[C]);var D=a(this.columnsrow[0].cells[B]);K=parseFloat(m.css("left"));I=parseFloat(D.css("left"))-parseFloat(K)+D.width()-2;K-=w;if(c){K+=w}if(r.editcell&&r.editable&&r.endcelledit&&(C!=B||f!=v)){if(r.editcell.validated==false){return}r.endcelledit(r.editcell.row,r.editcell.column,true,true)}}}this.selectionarea.width(I);this.selectionarea.height(Q);this.selectionarea.css("left",K);this.selectionarea.css("top",h)}}},_handlemouseupselection:function(u,o){if(!this.selectionarea){return}if(this.selectionarea[0].style.visibility!="visible"){o.mousecaptured=false;return true}if(o.mousecaptured&&(o.selectionmode=="multiplerowsextended"||o.selectionmode=="multiplerowsadvanced"||o.selectionmode=="multiplecellsextended"||o.selectionmode=="multiplecellsadvanced")){o.mousecaptured=false;if(this.selectionarea.css("visibility")=="visible"){this.selectionarea.css("visibility","hidden");var w=this.showheader?this.columnsheader.height()+2:0;var p=this._groupsheader()?this.groupsheader.height():0;if(this.host.css("border-top-width")==="0px"){p-=2}var B=this.showtoolbar?this.toolbar.height():0;p+=B;var C=this.selectionarea.coord();var c=this.host.coord();if(this.hasTransform){c=a.jqx.utilities.getOffset(this.host);C=a.jqx.utilities.getOffset(this.selectionarea)}if(this.host.css("border-top-width")==="0px"){p-=2}var n=C.left-c.left;var k=C.top-w-c.top-p;var s=k;var g=n+this.selectionarea.width();var D=n;var l=new Array();var e=new Array();if(o.selectionmode=="multiplerowsextended"){while(k<s+this.selectionarea.height()){var b=this._hittestrow(n,k);var f=b.row;var h=b.index;if(h!=-1){if(!e[h]){e[h]=true;l[l.length]=b}}k+=20}var s=0;a.each(l,function(){var i=this;var m=this.row;if(o.selectionmode!="none"&&o._selectrowwithmouse){if(u.ctrlKey||u.metaKey){o._applyrowselection(o.getboundindex(m),true,false,false)}else{if(s==0){o._applyrowselection(o.getboundindex(m),true,false,true)}else{o._applyrowselection(o.getboundindex(m),true,false,false)}}s++}})}else{if(o.selectionmode=="multiplecellsadvanced"){k+=2}var r=o.hScrollInstance;var t=r.value;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){t=r.max-r.value}if(this.vScrollBar[0].style.visibility!="hidden"){t-=this.scrollbarsize+4}}var q=o.table[0].rows[0];var j=o.selectionarea.height();if(!u.ctrlKey&&!u.metaKey&&j>0){o.selectedcells=new Array()}var A=j;while(k<s+A){var b=o._hittestrow(n,k);if(!b){k+=5;continue}var f=b.row;var h=b.index;if(h!=-1){if(!e[h]){e[h]=true;for(var v=0;v<q.cells.length;v++){var d=parseFloat(a(o.columnsrow[0].cells[v]).css("left"))-t;var z=d+a(o.columnsrow[0].cells[v]).width();if((D>=d&&D<=z)||(g>=d&&g<=z)||(d>=D&&d<=g)){o._applycellselection(o.getboundindex(f),o._getcolumnat(v).datafield,true,false)}}}}k+=5}}if(o.autosavestate){if(o.savestate){o.savestate()}}o._renderrows(o.virtualsizeinfo)}}},selectprevcell:function(e,c){var f=this._getcolumnindex(c);var b=this.columns.records.length;var d=this._getprevvisiblecolumn(f);if(d!=null){this.clearselection();this.selectcell(e,d.datafield)}},selectnextcell:function(e,d){var f=this._getcolumnindex(d);var c=this.columns.records.length;var b=this._getnextvisiblecolumn(f);if(b!=null){this.clearselection();this.selectcell(e,b.datafield)}},_getfirstvisiblecolumn:function(){var b=this;var e=this.columns.records.length;for(var c=0;c<e;c++){var d=this.columns.records[c];if(!d.hidden&&d.datafield!=null){return d}}return null},_getlastvisiblecolumn:function(){var b=this;var e=this.columns.records.length;for(var c=e-1;c>=0;c--){var d=this.columns.records[c];if(!d.hidden&&d.datafield!=null){return d}}return null},_handlekeydown:function(A,t){if(t.groupable&&t.groups.length>0){}if(t.disabled){return false}var H=A.charCode?A.charCode:A.keyCode?A.keyCode:0;if(t.editcell&&t.selectionmode!="multiplecellsadvanced"){return true}else{if(t.editcell&&t.selectionmode=="multiplecellsadvanced"){if(H>=33&&H<=40){if(!A.altKey){if(t._cancelkeydown==undefined||t._cancelkeydown==false){if(t.editmode!=="selectedrow"){t.endcelledit(t.editcell.row,t.editcell.column,false,true);t._cancelkeydown=false;if(t.editcell&&!t.editcell.validated){t._rendervisualrows();t.endcelledit(t.editcell.row,t.editcell.column,false,true);return false}}else{return true}}else{t._cancelkeydown=false;return true}}else{t._cancelkeydown=false;return true}}else{return true}}}if(t.selectionmode=="none"){return true}if(t.showfilterrow&&t.filterable){if(this.filterrow){if(a(A.target).ischildof(t.filterrow)){return true}}}if(t.showeverpresentrow){if(t.addnewrowtop){if(a(A.target).ischildof(t.addnewrowtop)){return true}}if(t.addnewrowbottom){if(a(A.target).ischildof(t.addnewrowbottom)){return true}}}if(A.target.className&&A.target.className.indexOf("jqx-grid-widget")>=0){return true}if(t.pageable){if(a(A.target).ischildof(this.pager)){return true}}if(this.showtoolbar){if(a(A.target).ischildof(this.toolbar)){return true}}if(this.showstatusbar){if(a(A.target).ischildof(this.statusbar)){return true}}var r=false;if(A.altKey){return true}if(A.ctrlKey||A.metaKey){if(this.clipboard){var b=String.fromCharCode(H).toLowerCase();if(this.clipboardbegin){var j=null;if(b=="c"){j=this.clipboardbegin("copy",this.copyselection())}else{if(b=="x"){j=this.clipboardbegin("cut",this.copyselection())}else{if(b=="v"){j=this.clipboardbegin("paste")}}}if(j===false){return false}}if(b=="c"||b=="x"){var q=this.copyselection();if(b=="c"&&this.clipboardend){this.clipboardend("copy")}if(b=="x"&&this.clipboardend){this.clipboardend("cut")}if(window.clipboardData){window.clipboardData.setData("Text",q)}else{var g=a('<textarea style="position: absolute; left: -1000px; top: -1000px;"/>');g.val(q);a("body").append(g);g.select();setTimeout(function(){document.designMode="off";g.select();g.remove();t.focus()},100)}if(b=="c"&&a.jqx.browser.msie){return false}else{if(b=="c"){return true}}}else{if(b=="v"){var F=a('<textarea style="position: absolute; left: -1000px; top: -1000px;"/>');a("body").append(F);F.select();var k=this;setTimeout(function(){k._clipboardselection=new Array();var M=F.val();if(M.length==0&&window.clipboardData){F.val(window.clipboardData.getData("Text"));var M=F.val()}var L=M.split("\n");for(var K=0;K<L.length;K++){if(L[K].split("\t").length>0){var J=L[K].split("\t");if(J.length==1&&K==L.length-1&&J[0]==""){continue}if(J.length>0){k._clipboardselection.push(J)}}}k.pasteselection();F.remove();k.focus()},100);return true}}if(b=="x"){this.deleteselection();this.host.focus();return false}}}var n=Math.round(t._gettableheight());var y=Math.round(n/t.rowsheight);var f=t.getdatainformation();switch(t.selectionmode){case"singlecell":case"multiplecells":case"multiplecellsextended":case"multiplecellsadvanced":var I=t.getselectedcell();if(I===null){t.selectcell(0,t.columns.records[0].displayfield)}if(I!=null){var e=this.getrowvisibleindex(I.rowindex);var i=e;var p=I.datafield;var w=t._getcolumnindex(p);var c=t.columns.records.length;var v=function(Q,K,P,O){var J=function(ab,U){var W=t.dataview.loadedrecords[ab];if(t.groupable&&t.groups.length>0){var X=ab;if(O=="up"){X++}if(O=="down"){X--}var W=t.getdisplayrows()[X];var R=function(ac){if(ac.group){if(t.expandedgroups[ac.uniqueid]){return t.expandedgroups[ac.uniqueid].expanded}}else{return false}};var Z=1;var S=true;while(S&&Z<300){S=false;if(O=="down"){W=t.getdisplayrows()[X+Z]}else{if(O=="up"){W=t.getdisplayrows()[X-Z]}}if(!W){break}if(W&&W.group){S=true}var aa=W.parentItem;while(aa){if(aa&&!R(aa)){S=true}aa=aa.parentItem}if(!S){break}Z++}if(Z==300){W=null}if(t.pageable){var Y=false;if(W){for(var V=0;V<t.dataview.rows.length;V++){if(t.dataview.rows[V].boundindex==W.boundindex){Y=true}}if(!Y){W=null}}}}else{if(t.pageable){var Y=false;if(W){for(var V=0;V<t.dataview.rows.length;V++){if(t.dataview.rows[V].boundindex==W.boundindex){Y=true}}if(!Y){if(t.pagerpageinput&&A.keyCode===9){if(W.boundindex>t.dataview.rows[t.dataview.rows.length-1].boundindex){t.pagerpageinput.focus();A.preventDefault()}}t.ensurerowvisible(W)}}}}if(W!=undefined&&U!=null){if(P||P==undefined){t.clearselection()}var T=t.getboundindex(W);t.selectcell(T,U);t._oldselectedcell=t.selectedcell;r=true;if(t.groupable){t.ensurecellvisible(T,U)}else{t.ensurecellvisible(ab,U)}return true}return false};if(!J(Q,K)&&!t.groupable){t.ensurecellvisible(Q,K);J(Q,K);if(t.virtualmode){t.host.focus()}}var M=t.groupable&&t.groups.length>0;if(!M){if(A.shiftKey&&A.keyCode!=9){if(t.selectionmode=="multiplecellsextended"||t.selectionmode=="multiplecellsadvanced"){if(t._lastClickedCell){t._selectpath(Q,K);var N=t.dataview.loadedrecords[Q];var L=t.getboundindex(N);t.selectedcell={rowindex:L,datafield:K};return}}}else{if(!A.shiftKey){t._lastClickedCell={row:Q,column:K}}}}};var B=A.shiftKey&&t.selectionmode!="singlecell"&&t.selectionmode!="multiplecells";var C=function(){if(t.pageable){var J=t.dataview.pagenum*t.dataview.pagesize;v(J,p,!B)}else{v(0,p,!B)}};var h=function(){var K=f.rowscount-1;if(t.pageable){var J=t.dataview.pagenum*t.dataview.pagesize;K=J+t.dataview.rows.length-1}v(K,p,!B)};var d=H==9&&!A.shiftKey;var m=H==9&&A.shiftKey;if(t.rtl){var s=d;d=m;m=s}if(d||m){B=false}if(d||m){if(document.activeElement&&document.activeElement.className&&document.activeElement.className.indexOf("jqx-grid-cell-add-new-row")>=0){return true}}var o=A.ctrlKey||A.metaKey;if(o&&H==37){var E=t._getfirstvisiblecolumn(w);if(E!=null){v(i,E.datafield)}}else{if(o&&H==39){var u=t._getlastvisiblecolumn(w);if(u!=null){v(i,u.datafield)}}else{if(H==39||d){var x=t._getnextvisiblecolumn(w);if(x!=null){v(i,x.datafield,!B)}else{if(!d){r=true}else{var G=t._getfirstvisiblecolumn();H=40;p=G.displayfield}}}else{if(H==37||m){var E=t._getprevvisiblecolumn(w);if(E!=null){v(i,E.datafield,!B)}else{if(!m){r=true}else{var l=t._getlastvisiblecolumn();H=38;p=l.displayfield}}}else{if(H==36){C()}else{if(H==35){h()}else{if(H==33){if(i-y>=0){var D=i-y;v(D,p,!B);if(t.pageable&&t.virtualmode){t.gotoprevpage();setTimeout(function(){v(D,p,!B)},25)}}else{C()}}else{if(H==34){if(f.rowscount>i+y){var D=i+y;v(D,p,!B);if(t.pageable&&t.virtualmode){t.gotonextpage();setTimeout(function(){v(D,p,!B)},25)}}else{h()}}}}}}}}}if(H==38){if(o){C()}else{if(i>0){v(i-1,p,!B,"up")}else{r=false}}}if(H==40){if(o){h()}else{if((f.rowscount>i+1)||(t.groupable&&t.groups.length>0)){v(i+1,p,!B,"down")}else{r=true}}}}break;case"singlerow":case"multiplerows":case"multiplerowsextended":case"multiplerowsadvanced":var i=t.getselectedrowindex();if(i==null||i==-1){return true}i=this.getrowvisibleindex(i);var z=function(K,N,M){var J=function(V){var U=t.dataview.loadedrecords[V];if(t.groupable&&t.groups.length>0){if(M=="up"){V++}if(M=="down"){V--}var U=t.getdisplayrows()[V];var O=function(Z){if(Z.group){if(t.expandedgroups[Z.uniqueid]){return t.expandedgroups[Z.uniqueid].expanded}}else{return false}};var X=1;var P=true;while(P&&X<300){P=false;if(M=="down"){U=t.getdisplayrows()[V+X]}else{if(M=="up"){U=t.getdisplayrows()[V-X]}}if(!U){break}if(U&&U.group){P=true}var Y=U.parentItem;while(Y){if(Y&&!O(Y)){P=true}Y=Y.parentItem}if(!P){break}X++}if(X==300){U=null}if(t.pageable){var W=false;if(U){for(var T=0;T<t.dataview.rows.length;T++){if(t.dataview.rows[T].boundindex==U.boundindex){W=true}}if(!W){U=null}}}}if(U!=undefined){var Q=t.getboundindex(U);var S=t.selectedrowindex;if(N||N==undefined){t.clearselection()}t.selectedrowindex=S;t.selectrow(Q,false);if(t.groupable){var R=t.ensurerowvisible(Q)}else{var R=t.ensurerowvisible(V)}if(!R||t.autoheight||t.groupable){t._rendervisualrows()}r=true;return true}return false};if(!J(K)&&!t.groupable){t.ensurerowvisible(K);J(K,N);if(t.virtualmode){setTimeout(function(){J(K,N)},25)}if(t.virtualmode){t.host.focus()}}var L=t.groupable&&t.groups.length>0;if(!L){if(A.shiftKey&&H!=9){if(t.selectionmode=="multiplerowsextended"){if(t._lastClickedCell){t._selectrowpath(K);t.selectedrowindex=t.getrowboundindex(K);return}}}else{if(!A.shiftKey){t._lastClickedCell={row:K};t.selectedrowindex=t.getrowboundindex(K)}}}};var B=A.shiftKey&&t.selectionmode!="singlerow"&&t.selectionmode!="multiplerows";var C=function(){if(t.pageable){var J=t.dataview.pagenum*t.dataview.pagesize;z(J,!B)}else{z(0,!B)}};var h=function(){var K=f.rowscount-1;if(t.pageable){var J=t.dataview.pagenum*t.dataview.pagesize;K=J+t.dataview.rows.length-1}z(K,!B)};var o=A.ctrlKey||A.metaKey;if(H==36||(o&&H==38)){C()}else{if(H==35||(o&&H==40)){h()}else{if(H==33){if(i-y>=0){var D=i-y;z(D,!B);if(t.pageable&&t.virtualmode){t.gotoprevpage();setTimeout(function(){z(D,!B)},25)}}else{C()}}else{if(H==34){if(f.rowscount>i+y){var D=i+y;z(D,!B);if(t.pageable&&t.virtualmode){t.gotonextpage();setTimeout(function(){z(D,!B)},25)}}else{h()}}else{if(H==38){if(i>0){z(i-1,!B,"up")}else{r=true}}else{if(H==40){if((f.rowscount>i+1)||(t.groupable&&t.groups.length>0)){z(i+1,!B,"down")}else{r=true}}}}}}}break}if(r){if(t.autosavestate){if(t.savestate){t.savestate()}}return false}return true},_handlemousemove:function(u,p){if(p.vScrollInstance.isScrolling()){return}if(p.hScrollInstance.isScrolling()){return}var w;var q;var f;var n;var m;if(p.enablehover||p.selectionmode=="multiplerows"){w=this.showheader?this.columnsheader.height()+2:0;q=this._groupsheader()?this.groupsheader.height():0;var A=this.showtoolbar?this.toolbarheight:0;q+=A;f=this.host.coord();if(this.hasTransform){f=a.jqx.utilities.getOffset(this.host);var k=this._getBodyOffset();f.left-=k.left;f.top-=k.top}n=u.pageX-f.left;m=u.pageY-w-f.top-q}if(p.selectionmode=="multiplerowsextended"||p.selectionmode=="multiplecellsextended"||p.selectionmode=="multiplecellsadvanced"){if(p.mousecaptured==true){return}}if(p.enablehover){if(p.disabled){return}if(this.vScrollInstance.isScrolling()||this.hScrollInstance.isScrolling()){return}var c=this._hittestrow(n,m);if(!c){return}var h=c.row;var j=c.index;if(this.hoveredrow!=-1&&j!=-1&&this.hoveredrow==j&&this.selectionmode.indexOf("cell")==-1&&this.selectionmode!="checkbox"){return}this._clearhoverstyle();if(j==-1||h==undefined){return}var r=this.hittestinfo[j].visualrow;if(r==null){return}if(this.hittestinfo[j].details){return}if(u.clientX>a(r).width()+a(r).coord().left){return}var B=0;var o=r.cells.length;if(p.rowdetails&&p.showrowdetailscolumn){if(!this.rtl){B=1+this.groups.length}else{o-=1;o-=this.groups.length}}else{if(this.groupable){if(!this.rtl){B=this.groups.length}else{o-=this.groups.length}}}if(r.cells.length==0){return}var l=r.cells[B].className;if(h.group||(this.selectionmode.indexOf("row")>=0&&l.indexOf("jqx-grid-cell-selected")!=-1)){return}this.hoveredrow=j;if(this.selectionmode.indexOf("cell")!=-1||this.selectionmode=="checkbox"){var e=-1;var s=this.hScrollInstance;var t=s.value;if(this.rtl){if(this.hScrollBar.css("visibility")!="hidden"){t=s.max-s.value}}for(var v=B;v<o;v++){var g=parseInt(a(this.columnsrow[0].cells[v]).css("left"))-t;if(this.columns.records[v].pinned&&!this.rtl){g=parseInt(a(this.columnsrow[0].cells[v]).css("left"))}var z=g+a(this.columnsrow[0].cells[v]).width();if(z>=n&&n>=g){e=v;break}}if(e!=-1){var b=r.cells[e];if(this.cellhover){this.cellhover(b,u.pageX,u.pageY)}if(b.className.indexOf("jqx-grid-cell-selected")==-1){if(this.editcell){var d=this._getcolumnat(e);if(d){if(this.editcell.row==j&&this.editcell.column==d.datafield){return}}}a(b).addClass(this.toTP("jqx-grid-cell-hover"));a(b).addClass(this.toTP("jqx-fill-state-hover"))}}return}for(var v=B;v<o;v++){var b=r.cells[v];a(b).addClass(this.toTP("jqx-grid-cell-hover"));a(b).addClass(this.toTP("jqx-fill-state-hover"));if(this.cellhover){this.cellhover(b,u.pageX,u.pageY)}}}else{return true}}})})(jqxBaseFramework);