jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
10 lines (7 loc) • 14.1 kB
JavaScript
/*
jQWidgets v22.0.0 (2025-Jan)
Copyright (c) 2011-2025 jQWidgets.
License: https://jqwidgets.com/license/
*/
/* eslint-disable */
(function(){if(typeof document==="undefined"){return}(function(b){b.extend(b.jqx._jqxGrid.prototype,{_exportData:function(ai,T,at,Q){var ac=this;var ah=typeof T==="string"?T:T.fileName;if(!ah){ah="jqxGrid"}if(!T||typeof T==="string"){T={header:true,filterBy:null,groupBy:null,style:null,fileName:ah,pageOrientation:"portrait",expandChart:"+",collapseChar:"-"}}var a=new b.jqx.dataAdapter.DataExporter({exportHeader:T.header});var j=[];a.expandChar=T.expandChar;a.collapseChar=T.collapseChar;a.pageOrientation=T.pageOrientation;a.style=T.style;a.filterBy=T.filterBy;a.groupBy=T.groupBy;if(Q){a.addImageToCell=Q.addImageToCell;a.headerContent=Q.headerContent;a.footerContent=Q.footerContent;a.setRowHeight=Q.setRowHeight;a.cellFormatFunction=Q.cellFormatFunction;a.freezeHeader=Q.freezeHeader;a.exportAsTable=Q.exportAsTable;a.onlySelected=Q.onlySelected;a.autoConvertFormulas=Q.autoConvertFormulas}var al=[];var V=ac.columngroups||[];var ae=0;if(V){for(var S=0;S<V.length;S++){var Z=V[S];Z.label=Z.text}}for(var S=0;S<ac.columns.records.length;S++){var Z=ac.columns.records[S];if(!Z.exportable){continue}if(ac.columns.records[S].datafield!==null){al[ae++]={label:ac.columns.records[S].text,width:ac.columns.records[S].width?ac.columns.records[S].width+"px":"100px",dataField:ac.columns.records[S].datafield,columnGroup:ac.columns.records[S].columnGroup||ac.columns.records[S].columngroup}}}a.header={columns:al,columngroups:V};if(!T.style){var aj=window.getComputedStyle(ac.element);var ar=window.getComputedStyle(ac.columns.records.length>0&&ac.columns.records[0].element?ac.columns.records[0].element:ac.host.find(".jqx-grid-header")[0]);var ab=window.getComputedStyle(ac.host.find(".jqx-grid-header")[0]);var ao=ac.offsetWidth===0||ac.offsetHeight===0;if(!ao){var aa=function(h){var f="Helvetica";var d=h.fontSize;var c=h.borderRightColor;var e=h.backgroundColor;var k=h.color;var l=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");var m=function(n){return isNaN(n)?"00":l[(n-n%16)/16]+l[n%16]};var g=function(t){if(t.toString().indexOf("rgba")!=-1){var v=k.split(",");var r=parseInt(v[0].substring(5));var s=parseInt(v[1]);var n=parseInt(v[2]);if(v[3]){var u=parseFloat(v[3].substring(1,4))}else{var u=1}var q={r:r,g:s,b:n};var o=ac._rgbToHex(q);if(r==0&&s==0&&n==0&&u==0){return"#ffffff"}return"#"+o}t=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(!t){return"#ffffff"}return"#"+m(t[1])+m(t[2])+m(t[3]).toUpperCase()};return{borderColor:g(c),fontSize:d,fontFamily:f,color:g(k),backgroundColor:g(e)}};var ap=aa(aj);var av=aa(ar);var aq=aa(ab);var au={height:"30px",border:"1px solid "+ap.borderColor,fontFamily:aq.fontFamily,fontSize:aq.fontSize,color:aq.color,backgroundColor:av.backgroundColor,fontWeight:"400"};var an={border:"1px solid "+ap.borderColor,fontFamily:ap.fontFamily,fontSize:ap.fontSize};var R={height:ac.rowsheight+"px"};for(var S=0;S<ac.columns.records.length;S++){var Z=ac.columns.records[S];if(!Z.exportable){continue}au[Z.datafield]={textAlign:Z.align,width:Z.width+"px",format:Z.cellsformat||""};var ax=Z.cellsformat||"";if(Z.dataType==="date"){ax="d"}else{if(Z.dataType==="dateTime"){ax="D"}else{if(Z.dataType==="time"){ax="t"}}}var af={textAlign:Z.cellsalign,format:ax};an[Z.datafield]=af}if(ac.altrows){R.alternationCount=2;R.alternationStart=0;R.alternationEnd=0;R.alternationIndex0Color=ap.color;R.alternationIndex0BackgroundColor=ap.backgroundColor;R.alternationIndex1Color=ap.color;R.alternationIndex1BackgroundColor="#F5F5F5"}a.style={border:"1px solid "+ap.borderColor,borderCollapse:"collapse",header:au,columns:an,rows:R}}}if(Q){if(Q.getSpreadsheets){var ay=Q.getSpreadsheets();if(ay){a.spreadsheets=ay;var au=a.style.header;var an=a.style.columns;for(var X=0;X<ay.length;X++){var ak=ay[X];var ad=ak.columns;for(var S=0;S<ad.length;S++){var Z=ad[S];if(typeof Z==="string"){Z={label:Z,dataField:Z,allowExport:true,visible:true}}if(Z.allowExport!==undefined&&!Z.allowExport){continue}if(Z.visible!==undefined&&!Z.visible){continue}Z.label=Z.text;au[Z.dataField]={textAlign:Z.align||"left",verticalAlign:"center",width:Z.computedWidth?Z.computedWidth+"px":"100px",format:Z.cellsFormat||""};var ax=Z.cellsFormat||"";if(!ax){if(Z.dataType==="date"){ax="d"}else{if(Z.dataType==="dateTime"){ax="D"}else{if(Z.dataType==="time"){ax="t"}}}}if(ac.locale&&ax&&ax.indexOf("c")>=0&&ai==="xlsx"){if(ac.locale!==""&&ac.locale!=="en"){var i=ac._getCurrencyByLocale(ac.locale);ax=i+"x"+ax}}var af={textAlign:Z.cellsAlign||"left",format:ax};an[Z.dataField]=af}}}}}var W=at||this.getrows();var p=[];for(var S=0;S<W.length;S++){var am=W[S];if(am.hidden){continue}var Y={};for(var U=0;U<ac.columns.records.length;U++){var Z=ac.columns.records[U];if(!Z.exportable){continue}Y[Z.datafield]=am[Z.datafield]}p.push(Y)}if(!T.groupBy&&ac.groups&&ac.groups.length){a.groupBy=ac.groups.slice(0)}if(Q&&Q.formatData){var aw=function(c){a.exportData(c,ai,T.fileName,null)};Q.formatData(p,al,p,aw)}else{var ag=a.exportData(p,ai,T.fileName,null)}return ag},exportview:function(i,a,g,j){var h=this;h._exportData(i,a,g,j)},exportdata:function(Z,ab,ac,ad,X,T,al){if(!b.jqx.dataAdapter.ArrayExporter){throw"jqxGrid: Missing reference to jqxdata.export.js!"}if(Z==="xlsx"){this._exportData("xlsx",ab);return}if(ac==undefined){ac=true}var a=this;if(ad==undefined){var ad=this.getrows();if(ad.length==0){throw"No data to export."}}this.exporting=true;if(!this.pageable){this.loadondemand=true}if(this.altrows){this._renderrows(this.virtualsizeinfo)}var ae=this.hScrollInstance.value;this.hScrollInstance.setPosition(0);this._renderrows(this.virtualsizeinfo);var M=X!=undefined?X:false;var R={};var af={};var P=[];var ah=this.host.find(".jqx-grid-cell:first");var N=this.host.find(".jqx-grid-cell-alt:first");ah.removeClass(this.toThemeProperty("jqx-grid-cell-selected"));ah.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));N.removeClass(this.toThemeProperty("jqx-grid-cell-selected"));N.removeClass(this.toThemeProperty("jqx-fill-state-pressed"));ah.removeClass(this.toThemeProperty("jqx-grid-cell-hover"));ah.removeClass(this.toThemeProperty("jqx-fill-state-hover"));N.removeClass(this.toThemeProperty("jqx-grid-cell-hover"));N.removeClass(this.toThemeProperty("jqx-fill-state-hover"));var ak="cell";var am=1;var O="column";var ao=1;var aj=[];for(var W=0;W<this.columns.records.length;W++){var an=this.columns.records[W];if(an.cellclassname!=""){an.customCellStyles=new Array();if(typeof an.cellclassname=="string"){for(var V=0;V<ad.length;V++){an.customCellStyles[V]=an.cellclassname}}else{for(var V=0;V<ad.length;V++){var Q=this.getrowboundindex(V);var ap=an.cellclassname(Q,an.displayfield,ad[V][an.displayfield],ad[V]);if(ap){an.customCellStyles[V]=ap}}}}}var j=new Array();var i=null;var aq=null;var ar=null;b.each(this.columns.records,function(l){var d=b(a.table[0].rows[0].cells[l]);if(a.table[0].rows.length>1){var e=b(a.table[0].rows[1].cells[l]);if(!ar){ar=e}}if(!aq){aq=d}var m=this;var k=function(p){p.removeClass(a.toThemeProperty("jqx-grid-cell-selected"));p.removeClass(a.toThemeProperty("jqx-fill-state-pressed"));p.removeClass(a.toThemeProperty("jqx-grid-cell-hover"));p.removeClass(a.toThemeProperty("jqx-fill-state-hover"));if(m.customCellStyles){for(var o in m.customCellStyles){p.removeClass(m.customCellStyles[o])}}};k(d);if(e){k(e)}if(this.displayfield==null){return true}if(a.showaggregates){if(a.getcolumnaggregateddata){aj.push(a.getcolumnaggregateddata(this.displayfield,this.aggregates,true,ad))}}var g=a._getexportcolumntype(this);if(this.exportable&&(!this.hidden||M)){R[this.displayfield]={};R[this.displayfield].text=this.text;R[this.displayfield].width=parseInt(this.width);if(isNaN(R[this.displayfield].width)){R[this.displayfield].width=60}R[this.displayfield].formatString=this.cellsformat;R[this.displayfield].localization=a.gridlocalization;R[this.displayfield].type=g;R[this.displayfield].cellsAlign=this.cellsalign;R[this.displayfield].hidden=!ac;R[this.displayfield].displayfield=this.displayfield;j.push(R[this.displayfield])}ak="cell"+am;var c=b(this.element);if(this.element==undefined){c=b(this.uielement)}if(!i){i=c}else{if(!m._rendered){c=i;d=aq;e=ar;var h=a.toTP("jqx-grid-cell")+" "+a.toTP("jqx-item");d[0].className=h;h+=a.toTP("jqx-grid-cell-alt");if(e){e[0].className=h}}}O="column"+ao;if(Z=="html"||Z=="xls"||Z=="pdf"){var f=function(u,v,w,t,o,r,s,q,p){af[u]={};if(v==undefined){return}if(v[0].offsetWidth==0||v[0].offsetHeight==0){if(!w){af[u]["dataType"]=g}return}af[u]["font-size"]=v.css("font-size");af[u]["font-weight"]=v.css("font-weight");af[u]["font-style"]=v.css("font-style");af[u]["background-color"]=r._getexportcolor(v.css("background-color"));af[u]["color"]=r._getexportcolor(v.css("color"));af[u]["border-color"]=r._getexportcolor(v.css("border-top-color"));if(w){af[u]["text-align"]=o.align}else{af[u]["text-align"]=o.cellsalign;af[u]["formatString"]=o.cellsformat;af[u]["dataType"]=g}if(Z=="html"||Z=="pdf"){af[u]["border-top-width"]=v.css("border-top-width");af[u]["border-left-width"]=v.css("border-left-width");af[u]["border-right-width"]=v.css("border-right-width");af[u]["border-bottom-width"]=v.css("border-bottom-width");af[u]["border-top-style"]=v.css("border-top-style");af[u]["border-left-style"]=v.css("border-left-style");af[u]["border-right-style"]=v.css("border-right-style");af[u]["border-bottom-style"]=v.css("border-bottom-style");if(w){if(s==0){af[u]["border-left-width"]=v.css("border-right-width")}af[u]["border-top-width"]=v.css("border-right-width");af[u]["border-bottom-width"]=v.css("border-bottom-width")}else{if(s==0){af[u]["border-left-width"]=v.css("border-right-width")}}af[u]["height"]=v.css("height")}if(o.exportable&&(!o.hidden||M)){if(q==true){if(!R[o.displayfield].customCellStyles){R[o.displayfield].customCellStyles=new Array()}R[o.displayfield].customCellStyles[p]=u}else{if(w){R[o.displayfield].style=u}else{if(!t){R[o.displayfield].cellStyle=u}else{R[o.displayfield].cellAltStyle=u}}}}};f(O,c,true,false,this,a,l);ao++;f(ak,d,false,false,this,a,l);if(a.altrows){ak="cellalt"+am;f(ak,e,false,true,this,a,l)}if(this.customCellStyles){for(var n in m.customCellStyles){d.removeClass(m.customCellStyles[n])}for(var n in m.customCellStyles){d.addClass(m.customCellStyles[n]);f(ak+m.customCellStyles[n],d,false,false,this,a,l,true,n);d.removeClass(m.customCellStyles[n])}}am++}});b.each(this.columns.records,function(c){if(R[this.displayfield]){R[this.displayfield].columnsDataFields=j}});if(this.showaggregates){var S=[];var Y=Z=="xls"?"_AG":"";var ai=this.groupable?this.groups.length:0;if(this.rowdetails){ai++}if(this.selectionmode==="checkbox"){ai++}if(aj.length>0){b.each(this.columns.records,function(c){if(this.aggregates){for(var f=0;f<this.aggregates.length;f++){if(!S[f]){S[f]={}}if(S[f]){var e=a._getaggregatename(this.aggregates[f]);var d=a._getaggregatetype(this.aggregates[f]);var g=aj[c-ai];if(g){S[f][this.displayfield]=Y+e+": "+g[d]}}}}});b.each(this.columns.records,function(c){for(var d=0;d<S.length;d++){if(S[d][this.displayfield]==undefined){S[d][this.displayfield]=Y}}})}b.each(S,function(){ad.push(this)})}var ag=this;var U=b.jqx.dataAdapter.ArrayExporter(ad,R,af);if(ab==undefined){this._renderrows(this.virtualsizeinfo);var aa=U.exportTo(Z);if(this.showaggregates){b.each(S,function(){ad.pop(this)})}setTimeout(function(){ag.exporting=false},50);this.hScrollInstance.setPosition(ae);this._renderrows(this.virtualsizeinfo);return aa}else{U.exportToFile(Z,ab,T,al)}if(this.showaggregates){b.each(S,function(){ad.pop(this)})}this._renderrows(this.virtualsizeinfo);setTimeout(function(){ag.exporting=false},50);this.hScrollInstance.setPosition(ae);this._renderrows(this.virtualsizeinfo)},_getexportcolor:function(g){var r=g;if(g=="transparent"){r="#FFFFFF"}if(!r||!r.toString()){r="#FFFFFF"}if(r.toString().indexOf("rgb")!=-1){var p=r.split(",");if(r.toString().indexOf("rgba")!=-1){var t=parseInt(p[0].substring(5));var q=parseInt(p[1]);var o=parseInt(p[2]);var n=parseFloat(p[3].substring(1,4));var a={r:t,g:q,b:o};var s=this._rgbToHex(a);if(t==0&&q==0&&o==0&&n==0){return"#ffffff"}return"#"+s}var t=parseInt(p[0].substring(4));var q=parseInt(p[1]);var o=parseInt(p[2].substring(1,4));var a={r:t,g:q,b:o};var s=this._rgbToHex(a);return"#"+s}else{if(r.toString().indexOf("#")!=-1){if(r.toString().length==4){var u=r.toString().substring(1,4);r+=u}}}return r},_rgbToHex:function(a){return this._intToHex(a.r)+this._intToHex(a.g)+this._intToHex(a.b)},_intToHex:function(d){var a=(parseInt(d).toString(16));if(a.length==1){a=("0"+a)}return a.toUpperCase()},_getexportcolumntype:function(m){var l=this;var n="string";var o=l.source.datafields||((l.source._source)?l.source._source.datafields:null);if(o){var j="";b.each(o,function(){if(this.name==m.displayfield){if(this.type){j=this.type}return false}});if(j){return j}}if(m!=null){if(this.dataview.cachedrecords==undefined){return n}var a=null;if(!this.virtualmode){if(this.dataview.cachedrecords.length==0){return n}a=this.dataview.cachedrecords[0][m.displayfield];if(a!=null&&a.toString()==""){return"string"}}else{b.each(this.dataview.cachedrecords,function(){a=this[m.displayfield];return false})}if(a!=null){if(m.cellsformat.indexOf("c")!=-1){return"number"}if(m.cellsformat.indexOf("n")!=-1){return"number"}if(m.cellsformat.indexOf("p")!=-1){return"number"}if(m.cellsformat.indexOf("d")!=-1){return"date"}if(m.cellsformat.indexOf("y")!=-1){return"date"}if(m.cellsformat.indexOf("M")!=-1){return"date"}if(m.cellsformat.indexOf("m")!=-1){return"date"}if(m.cellsformat.indexOf("t")!=-1){return"date"}if(typeof a=="boolean"){n="boolean"}else{if(b.jqx.dataFormat.isNumber(a)){n="number"}else{var k=new Date(a);if(k.toString()=="NaN"||k.toString()=="Invalid Date"){if(b.jqx.dataFormat){k=b.jqx.dataFormat.tryparsedate(a);if(k!=null){if(k&&k.getFullYear()){if(k.getFullYear()==1970&&k.getMonth()==0&&k.getDate()==1){var p=new Number(a);if(!isNaN(p)){return"number"}return"string"}}return"date"}else{n="string"}}else{n="string"}}else{n="date"}}}}}return n}})})(jqxBaseFramework)})();