ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anovi...@apache.org
Subject svn commit: r1711875 - in /ignite/site/trunk: includes/scripts.html js/tableExport.min.js
Date Mon, 02 Nov 2015 01:49:07 GMT
Author: anovikov
Date: Mon Nov  2 01:49:07 2015
New Revision: 1711875

URL: http://svn.apache.org/viewvc?rev=1711875&view=rev
Log:
Export table - fixed align for sub header in pdf

Modified:
    ignite/site/trunk/includes/scripts.html
    ignite/site/trunk/js/tableExport.min.js

Modified: ignite/site/trunk/includes/scripts.html
URL: http://svn.apache.org/viewvc/ignite/site/trunk/includes/scripts.html?rev=1711875&r1=1711874&r2=1711875&view=diff
==============================================================================
--- ignite/site/trunk/includes/scripts.html (original)
+++ ignite/site/trunk/includes/scripts.html Mon Nov  2 01:49:07 2015
@@ -85,7 +85,11 @@ $(document).ready(function() {
                         bodyStyles: {
                             fillColor: 245
                         },
-                        alternateRowStyles: {fillColor: 255}
+                        alternateRowStyles: {
+                            fillColor: 255,
+                            rowHeight: 15,
+                            valign: 'middle'
+                        }
                     }
                 }
             },

Modified: ignite/site/trunk/js/tableExport.min.js
URL: http://svn.apache.org/viewvc/ignite/site/trunk/js/tableExport.min.js?rev=1711875&r1=1711874&r2=1711875&view=diff
==============================================================================
--- ignite/site/trunk/js/tableExport.min.js (original)
+++ ignite/site/trunk/js/tableExport.min.js Mon Nov  2 01:49:07 2015
@@ -1,29 +1,32 @@
-(function(b){b.fn.extend({tableExport:function(t){function v(h,x,e,g,H){if(-1==b.inArray(e,a.ignoreRow)&&-1==b.inArray(e-g,a.ignoreRow)){var
d=b(h).filter(function(){return"none"!=b(this).data("tableexport-display")&&(b(this).is(":visible")||"always"==b(this).data("tableexport-display")||"always"==b(this).closest("table").data("tableexport-display"))}).find(x);d.each(function(h){if(("always"==b(this).data("tableexport-display")||"none"!=b(this).css("display")&&"hidden"!=b(this).css("visibility")&&
-"none"!=b(this).data("tableexport-display"))&&-1==b.inArray(h,a.ignoreColumn)&&-1==b.inArray(h-d.length,a.ignoreColumn)&&"function"===typeof
H){var g=0;if("undefined"!=typeof C[e]&&0<C[e].length)for(c=0;c<=h;c++)"undefined"!=typeof
C[e][c]&&(H(null,e,c),delete C[e][c],h++);H(this,e,h);if(b(this).is("[colspan]"))for(g=b(this).attr("colspan"),c=0;c<g-1;c++)H(null,e,h+c);if(b(this).is("[rowspan]")){var
x=parseInt(b(this).attr("rowspan"));for(r=1;r<x;r++)for("undefined"==typeof C[e+r]&&(C[e+r]=[]),C[e+
-r][h]="",c=1;c<g;c++)C[e+r][h+c]=""}}})}}function O(h){!0===a.consoleLog&&console.log(h.output());if("string"==a.outputMode)return
h.output();if("base64"==a.outputMode)return D(h.output());try{var x=h.output("blob");saveAs(x,a.fileName+".pdf")}catch(e){E(a.fileName+".pdf","data:application/pdf;base64,"+D(h.output()))}}function
L(h,a,e){return h.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function
P(h,x,e){var g="";if(null!=h)if(h=w(h,x,e),x=null===h||""==h?"":h.toString(),
-h instanceof Date)g=a.csvEnclosure+h.toLocaleString()+a.csvEnclosure;else if(g=L(x,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=g.indexOf(a.csvSeparator)||/[\r\n
]/g.test(g))g=a.csvEnclosure+g+a.csvEnclosure;return g}function V(h){h=L(h||"0",a.numbers.html.decimalMark,".");h=L(h,a.numbers.html.thousandsSeparator,"");return"number"===typeof
h||!1!==jQuery.isNumeric(h)?h:!1}function w(h,x,e){var g="";if(null!=h){h=b(h);if(!0===a.htmlContent)g=b.trim(h.html());else{var
d=h.html().replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,
-"\u2060"),f=b("<div/>").html(d).contents(),d="";b.each(f.text().split("\u2028"),function(h,a){0<h&&(d+="
");d+=b.trim(a)});b.each(d.split("\u2060"),function(h,a){0<h&&(g+="\n");g+=b.trim(a).replace(/\u00AD/g,"")});if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(f=V(g),!1!==f){var
k=(""+f).split(".");1==k.length&&(k[1]="");var l=3<k[0].length?k[0].length%3:0,g=(0>f?"-":"")+(a.numbers.output.thousandsSeparator?(l?
-k[0].substr(0,l)+a.numbers.output.thousandsSeparator:"")+k[0].substr(l).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):k[0])+(k[1].length?a.numbers.output.decimalMark+k[1]:"")}}!0===a.escape&&(g=escape(g));"function"===typeof
a.onCellData&&(g=a.onCellData(h,x,e,g))}return g}function W(h,a,e){return a+"-"+e.toLowerCase()}function
I(a,b){var e=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(a),g=b;e&&(g=[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]);return
g}function A(a,b){try{return window.getComputedStyle?
-(b=b.replace(/([a-z])([A-Z])/,W),window.getComputedStyle(a,null).getPropertyValue(b)):a.currentStyle?a.currentStyle[b]:a.style[b]}catch(e){}return""}function
M(a,b,e){b=A(a,b).match(/\d+/);if(null!==b){b=b[0];var g=document.createElement("div");g.style.overflow="hidden";g.style.visibility="hidden";a.parentElement.appendChild(g);g.style.width=100+e;e=100/g.offsetWidth;a.parentElement.removeChild(g);return
b*e}return 0}function E(a,b){var e=document.createElement("a");if(e){e.style.display="none";e.download=
-a;e.href=b;document.body.appendChild(e);if(document.createEvent)null==J&&(J=document.createEvent("MouseEvents")),J.initEvent("click",!0,!1),e.dispatchEvent(J);else
if(document.createEventObject)e.fireEvent("onclick");else if("function"==typeof e.onclick)e.onclick();document.body.removeChild(e)}}function
D(a){var b="",e,g,d,f,k,l,m=0;a=a.replace(/\x0d\x0a/g,"\n");g="";for(d=0;d<a.length;d++)f=a.charCodeAt(d),128>f?g+=String.fromCharCode(f):(127<f&&2048>f?g+=String.fromCharCode(f>>6|192):(g+=String.fromCharCode(f>>
-12|224),g+=String.fromCharCode(f>>6&63|128)),g+=String.fromCharCode(f&63|128));for(a=g;m<a.length;)e=a.charCodeAt(m++),g=a.charCodeAt(m++),d=a.charCodeAt(m++),f=e>>2,e=(e&3)<<4|g>>4,k=(g&15)<<2|d>>6,l=d&63,isNaN(g)?k=l=64:isNaN(d)&&(l=64),b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l);
-return b}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelstyles:["border-bottom","border-top","border-left","border-right"],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize"},headerStyles:{fillColor:[52,73,94],textColor:255,
-fontStyle:"bold"},alternateRowStyles:{fillColor:245},tableExport:{onAfterAutotable:null,onBeforeAutotable:null,onTable:null}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,outputMode:"file",tbodySelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"xlsWorksheetName"},J=null,m=[],p=[],n=0,C=[],d="";b.extend(!0,a,t);if("csv"==a.type||"txt"==a.type){var
q="",n=0,m=b(this).find("thead").first().find(a.theadSelector);
-m.each(function(){d="";v(this,"th,td",n,m.length,function(h,b,e){d+=P(h,b,e)+a.csvSeparator});d=b.trim(d).substring(0,d.length-1);0<d.length&&(0<q.length&&(q+="\n"),q+=d);n++});p=b(this).find("tbody").first().find(a.tbodySelector);p.each(function(){d="";v(this,"td",n,m.length+p.length,function(h,b,e){d+=P(h,b,e)+a.csvSeparator});d=b.trim(d).substring(0,d.length-1);0<d.length&&(0<q.length&&(q+="\n"),q+=d);n++});q+="\n";!0===a.consoleLog&&console.log(q);if("string"===a.outputMode)return
q;if("base64"===
-a.outputMode)return D(q);try{var y=new Blob([q],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(y,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(h){E(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+encodeURIComponent(q))}}else
if("sql"==a.type){var n=0,l="INSERT INTO `"+a.tableName+"` (",m=b(this).find("thead").first().find(a.theadSelector);m.each(function(){v(this,"th,td",n,m.length,function(a,b,e){l+="'"+w(a,b,e)+"',"});n++;
-l=b.trim(l);l=b.trim(l).substring(0,l.length-1)});l+=") VALUES ";p=b(this).find("tbody").first().find(a.tbodySelector);p.each(function(){d="";v(this,"td",n,m.length+p.length,function(a,b,e){d+="'"+w(a,b,e)+"',"});3<d.length&&(l+="("+d,l=b.trim(l).substring(0,l.length-1),l+="),");n++});l=b.trim(l).substring(0,l.length-1);l+=";";!0===a.consoleLog&&console.log(l);if("string"==a.outputMode)return
l;if("base64"==a.outputMode)return D(l);try{y=new Blob([l],{type:"text/plain;charset=utf-8"}),saveAs(y,a.fileName+
-".sql")}catch(h){E(a.fileName+".sql","data:application/sql;charset=utf-8,"+encodeURIComponent(l))}}else
if("json"==a.type){var Q=[],m=b(this).find("thead").first().find(a.theadSelector);m.each(function(){var
a=[];v(this,"th,td",n,m.length,function(b,e,g){a.push(w(b,e,g))});Q.push(a)});var R=[],p=b(this).find("tbody").first().find(a.tbodySelector);p.each(function(){var
a=[];v(this,"td",n,m.length+p.length,function(b,e,g){a.push(w(b,e,g))});0<a.length&&(1!=a.length||""!=a[0])&&R.push(a);n++});t=[];
-t.push({header:Q,data:R});var B=JSON.stringify(t);!0===a.consoleLog&&console.log(B);if("string"==a.outputMode)return
B;t=D(B);if("base64"==a.outputMode)return t;try{y=new Blob([B],{type:"application/json;charset=utf-8"}),saveAs(y,a.fileName+".json")}catch(h){E(a.fileName+".json","data:application/json;charset=utf-8;base64,"+t)}}else
if("xml"===a.type){var n=0,u='<?xml version="1.0" encoding="utf-8"?>',u=u+"<tabledata><fields>",m=b(this).find("thead").first().find(a.theadSelector);m.each(function(){v(this,
-"th,td",n,p.length,function(a,b,e){u+="<field>"+w(a,b,e)+"</field>"});n++});var
u=u+"</fields><data>",S=1,p=b(this).find("tbody").first().find(a.tbodySelector);p.each(function(){var
a=1;d="";v(this,"td",n,m.length+p.length,function(b,e,g){d+="<column-"+a+">"+w(b,e,g)+"</column-"+a+">";a++});0<d.length&&"<column-1></column-1>"!=d&&(u+='<row
id="'+S+'">'+d+"</row>",S++);n++});u+="</data></tabledata>";!0===a.consoleLog&&console.log(u);if("string"==a.outputMode)return
u;t=D(u);if("base64"==a.outputMode)return t;
-try{y=new Blob([u],{type:"application/xml;charset=utf-8"}),saveAs(y,a.fileName+".xml")}catch(h){E(a.fileName+".xml","data:application/xml;charset=utf-8;base64,"+t)}}else
if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){var B="excel"==a.type||"xls"==a.type?"excel":"word",N="excel"==B?"xls":"doc";t="xls"==N?'xmlns:x="urn:schemas-microsoft-com:office:excel"':'xmlns:w="urn:schemas-microsoft-com:office:word"';var
n=0,z="<table>",m=b(this).find("thead").first().find(a.theadSelector);m.each(function(){d=
-"";v(this,"th,td",n,m.length,function(h,f,e){if(null!=h){d+='<td style="';for(var g in
a.excelstyles)a.excelstyles.hasOwnProperty(g)&&(d+=a.excelstyles[g]+": "+b(h).css(a.excelstyles[g])+";");d+='">'+w(h,f,e)+"</td>"}});0<d.length&&(z+="<tr>"+d+"</tr>");n++});p=b(this).find("tbody").first().find(a.tbodySelector);p.each(function(){d="";v(this,"td",n,m.length+p.length,function(h,f,e){if(null!=h){d+='<td
style="';for(var g in a.excelstyles)a.excelstyles.hasOwnProperty(g)&&(d+=a.excelstyles[g]+":
"+b(h).css(a.excelstyles[g])+
-";");b(h).is("[colspan]")&&(d+='" colspan="'+b(h).attr("colspan"));b(h).is("[rowspan]")&&(d+='"
rowspan="'+b(h).attr("rowspan"));d+='">'+w(h,f,e)+"</td>"}});0<d.length&&(z+="<tr>"+d+"</tr>");n++});a.displayTableName&&(z+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+w(b("<p>"+a.tableName+"</p>"))+"</td></tr>");z+="</table>";!0===a.consoleLog&&console.log(z);var
f;f='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+t+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta
http-equiv="content-type" content="application/vnd.ms-'+
-B+'; charset=UTF-8">');f+="<head>";"excel"===B&&(f+="\x3c!--[if gte mso
9]>",f+="<xml>",f+="<x:ExcelWorkbook>",f+="<x:ExcelWorksheets>",f+="<x:ExcelWorksheet>",f+="<x:Name>",f+=a.worksheetName,f+="</x:Name>",f+="<x:WorksheetOptions>",f+="<x:DisplayGridlines/>",f+="</x:WorksheetOptions>",f+="</x:ExcelWorksheet>",f+="</x:ExcelWorksheets>",f+="</x:ExcelWorkbook>",f+="</xml>",f+="<![endif]--\x3e");f+="</head>";f+="<body>";f+=z;f+="</body>";f+="</html>";if("string"==a.outputMode)return
f;t=D(f);if("base64"===
-a.outputMode)return t;try{y=new Blob([f],{type:"application/vnd.ms-"+a.type}),saveAs(y,a.fileName+"."+N)}catch(h){E(a.fileName+"."+N,"data:application/vnd.ms-"+B+";base64,"+t)}}else
if("png"==a.type)html2canvas(b(this)[0],{allowTaint:!0,background:"#fff",onrendered:function(b){b=b.toDataURL();b=b.substring(22);for(var
f=atob(b),e=new ArrayBuffer(f.length),g=new Uint8Array(e),d=0;d<f.length;d++)g[d]=f.charCodeAt(d);try{var
k=new Blob([e],{type:"image/png"});saveAs(k,a.fileName+".png")}catch(l){E(a.fileName+
-".png","data:image/png;base64,"+b)}}});else if("pdf"==a.type)if(!1===a.jspdf.autotable){var
y={dim:{w:M(b(this).first().get(0),"width","mm"),h:M(b(this).first().get(0),"height","mm")},pagesplit:!1},T=new
jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);T.addHTML(b(this).first(),a.jspdf.margins.left,a.jspdf.margins.top,y,function(){O(T)})}else{var
k=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var
F={a0:[2383.94,3370.39],a1:[1683.78,
-2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},K="",G="",U=0;b(this).filter(":visible").each(function(){if("none"!=b(this).css("display")){var
a=M(b(this).get(0),"width","pt");if(a>U){a>F.a0[0]&&(K="a0",G="l");for(var d
in F)F.hasOwnProperty(d)&&F[d][1]>a&&(K=d,G="l",F[d][0]>a&&(G="p"));U=a}}});a.jspdf.format=""==K?"a4":K;a.jspdf.orientation=""==G?"w":G}k.doc=new
jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);b(this).filter(function(){return"none"!=b(this).data("tableexport-display")&&
-(b(this).is(":visible")||"always"==b(this).data("tableexport-display"))}).each(function(){var
d,f=0,e={};k.columns=[];k.rows=[];k.rowoptions={};if("function"===typeof k.onTable&&!1===k.onTable(b(this),a))return!0;Object.keys(a.jspdf.autotable).forEach(function(b){e[b]=a.jspdf.autotable[b]});e.margin={};b.extend(!0,e.margin,a.jspdf.margins);"function"!==typeof
e.createdHeaderCell&&(e.createdHeaderCell=function(a,b){if("undefined"!=typeof k.columns[b.column.dataKey]){var
d=k.columns[b.column.dataKey];
-a.styles.halign=d.style.align;"inherit"===e.styles.fillColor&&(a.styles.fillColor=d.style.bcolor);"inherit"===e.styles.textColor&&(a.styles.textColor=d.style.color)}});"function"!==typeof
e.createdCell&&(e.createdCell=function(a,b){var d=k.rowoptions[b.row.index+":"+b.column.dataKey];"undefined"!=typeof
d&&(a.styles.halign=d.style.align,"inherit"===e.styles.fillColor&&(a.styles.fillColor=d.style.bcolor),"inherit"===e.styles.textColor&&(a.styles.textColor=d.style.color))});"function"!==typeof
e.drawHeaderCell&&
-(e.drawHeaderCell=function(a,b){var d=k.columns[b.column.dataKey];return 1!=d.style.hasOwnProperty("hidden")||!0!==d.style.hidden});m=b(this).find("thead").find(a.theadSelector);m.each(function(){d=0;v(this,"th,td",f,m.length,function(a,b,e){var
f=A(a,"text-align");"start"==f&&(f="rtl"==A(a,"direction")?"right":"left");a={title:w(a,b,e),key:d++,style:{align:f,bcolor:I(A(a,"background-color"),[255,255,255]),color:I(A(a,"color"),[0,0,0])}};k.columns.push(a)});f++});var
g=0;p=b(this).find("tbody").find(a.tbodySelector);
-p.each(function(){var a=[];d=0;v(this,"td",f,m.length+p.length,function(b,e,f){if("undefined"===typeof
k.columns[d]){var l={title:"",key:d,style:{hidden:!0}};k.columns.push(l)}null!==b?(l=A(b,"text-align"),"start"==l&&(l="rtl"==A(b,"direction")?"right":"left"),l={style:{align:l,bcolor:I(A(b,"background-color"),[255,255,255]),color:I(A(b,"color"),[0,0,0])}}):l=k.rowoptions[g+":"+(d-1)];k.rowoptions[g+":"+d++]=l;a.push(w(b,e,f))});a.length&&(k.rows.push(a),g++);f++});if("function"===typeof
k.onBeforeAutotable)k.onBeforeAutotable(b(this),
-k.columns,k.rows,e);k.doc.autoTable(k.columns,k.rows,e);if("function"===typeof k.onAfterAutotable)k.onAfterAutotable(b(this),e);a.jspdf.autotable.startY=k.doc.autoTableEndPosY()+e.margin.top});O(k.doc);k.columns.length=0;k.rows.length=0;delete
k.doc;k.doc=null}return this}})})(jQuery);
+(function(c){c.fn.extend({tableExport:function(q){function v(b,t,d,e,r){if(-1==c.inArray(d,a.ignoreRow)&&-1==c.inArray(d-e,a.ignoreRow)){var
L=c(b).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display")||"always"==c(this).closest("table").data("tableexport-display"))}).find(t);L.each(function(b){if(("always"==c(this).data("tableexport-display")||"none"!=c(this).css("display")&&"hidden"!=c(this).css("visibility")&&
+"none"!=c(this).data("tableexport-display"))&&-1==c.inArray(b,a.ignoreColumn)&&-1==c.inArray(b-L.length,a.ignoreColumn)&&"function"===typeof
r){var e,t=0;if("undefined"!=typeof A[d]&&0<A[d].length)for(e=0;e<=b;e++)"undefined"!=typeof
A[d][e]&&(r(null,d,e),delete A[d][e],b++);r(this,d,b);if(c(this).is("[colspan]"))for(t=parseInt(c(this).attr("colspan")),e=0;e<t-1;e++)r(null,d,b+e);if(c(this).is("[rowspan]")){var
f,g=parseInt(c(this).attr("rowspan"));for(f=1;f<g;f++)for("undefined"==typeof A[d+f]&&
+(A[d+f]=[]),A[d+f][b]="",e=1;e<t;e++)A[d+f][b+e]=""}}})}}function M(b){!0===a.consoleLog&&console.log(b.output());if("string"==a.outputMode)return
b.output();if("base64"==a.outputMode)return B(b.output());try{var t=b.output("blob");saveAs(t,a.fileName+".pdf")}catch(d){C(a.fileName+".pdf","data:application/pdf;base64,"+B(b.output()))}}function
N(b,a,d){var e=0;"undefined"!=typeof d&&(e=d.colspan);if(0<=e){d=b.width;for(var
c=b.textPos.x,f=a.table.columns.indexOf(a.column),g=1;g<e;g++)d+=a.table.columns[f+
+g].width;1<e&&("right"===b.styles.halign?c=b.textPos.x+d-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(d-b.width)/2));b.width=d;b.textPos.x=c;if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof
b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function
I(b,a,d){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),d)}function
O(b,t,d){var e="";if(null!=b)if(b=
+w(b,t,d),t=null===b||""==b?"":b.toString(),b instanceof Date)e=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else
if(e=I(t,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=e.indexOf(a.csvSeparator)||/[\r\n
]/g.test(e))e=a.csvEnclosure+e+a.csvEnclosure;return e}function W(b){b=I(b||"0",a.numbers.html.decimalMark,".");b=I(b,a.numbers.html.thousandsSeparator,"");return"number"===typeof
b||!1!==jQuery.isNumeric(b)?b:!1}function w(b,t,d){var e="";if(null!=b){b=c(b);var r=b.html();"function"===typeof
a.onCellHtmlData&&
+(r=a.onCellHtmlData(b,t,d,r));if(!0===a.htmlContent)e=c.trim(r);else{var f=r.replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,"\u2060"),r=c("<div/>").html(f).contents(),f="";c.each(r.text().split("\u2028"),function(b,a){0<b&&(f+="
");f+=c.trim(a)});c.each(f.split("\u2060"),function(b,a){0<b&&(e+="\n");e+=c.trim(a).replace(/\u00AD/g,"")});if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(r=W(e),!1!==r){var
g=(""+r).split(".");
+1==g.length&&(g[1]="");var h=3<g[0].length?g[0].length%3:0,e=(0>r?"-":"")+(a.numbers.output.thousandsSeparator?(h?g[0].substr(0,h)+a.numbers.output.thousandsSeparator:"")+g[0].substr(h).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):g[0])+(g[1].length?a.numbers.output.decimalMark+g[1]:"")}}!0===a.escape&&(e=escape(e));"function"===typeof
a.onCellData&&(e=a.onCellData(b,t,d,e))}return e}function X(b,a,d){return a+"-"+d.toLowerCase()}function
P(b,a){var d=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b),
+e=a;d&&(e=[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]);return e}function Q(b){var
a=D(b,"text-align"),d=D(b,"font-weight"),e=D(b,"font-style"),f="";"start"==a&&(a="rtl"==D(b,"direction")?"right":"left");700<=d&&(f="bold");"italic"==e&&(f+=e);""==f&&(f="normal");return{style:{align:a,bcolor:P(D(b,"background-color"),[255,255,255]),color:P(D(b,"color"),[0,0,0]),fstyle:f},colspan:parseInt(c(b).attr("colspan"))||0}}function
D(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,X),
+window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(d){}return""}function
J(b,a,d){a=D(b,a).match(/\d+/);if(null!==a){a=a[0];var e=document.createElement("div");e.style.overflow="hidden";e.style.visibility="hidden";b.parentElement.appendChild(e);e.style.width=100+d;d=100/e.offsetWidth;b.parentElement.removeChild(e);return
a*d}return 0}function C(a,f){var d=document.createElement("a");if(d){d.style.display="none";d.download=a;d.href=f;document.body.appendChild(d);
+if(document.createEvent)null==G&&(G=document.createEvent("MouseEvents")),G.initEvent("click",!0,!1),d.dispatchEvent(G);else
if(document.createEventObject)d.fireEvent("onclick");else if("function"==typeof d.onclick)d.onclick();document.body.removeChild(d)}}function
B(a){var f="",d,e,c,g,h,k,l=0;a=a.replace(/\x0d\x0a/g,"\n");e="";for(c=0;c<a.length;c++)g=a.charCodeAt(c),128>g?e+=String.fromCharCode(g):(127<g&&2048>g?e+=String.fromCharCode(g>>6|192):(e+=String.fromCharCode(g>>12|224),e+=String.fromCharCode(g>>
+6&63|128)),e+=String.fromCharCode(g&63|128));for(a=e;l<a.length;)d=a.charCodeAt(l++),e=a.charCodeAt(l++),c=a.charCodeAt(l++),g=d>>2,d=(d&3)<<4|e>>4,h=(e&15)<<2|c>>6,k=c&63,isNaN(e)?h=k=64:isNaN(c)&&(k=64),f=f+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k);
+return f}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelstyles:["border-bottom","border-top","border-left","border-right"],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,
+73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{onAfterAutotable:null,onBeforeAutotable:null,onTable:null}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,outputMode:"file",tbodySelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"xlsWorksheetName"},G=null,l=[],n=[],m=0,A=[],f="";c.extend(!0,a,q);if("csv"==a.type||"txt"==
+a.type){var p="",m=0,l=c(this).find("thead").first().find(a.theadSelector);l.each(function(){f="";v(this,"th,td",m,l.length,function(b,c,d){f+=O(b,c,d)+a.csvSeparator});f=c.trim(f).substring(0,f.length-1);0<f.length&&(0<p.length&&(p+="\n"),p+=f);m++});n=c(this).find("tbody").first().find(a.tbodySelector);n.each(function(){f="";v(this,"td",m,l.length+n.length,function(b,c,d){f+=O(b,c,d)+a.csvSeparator});f=c.trim(f).substring(0,f.length-1);0<f.length&&(0<p.length&&(p+="\n"),p+=f);m++});p+="\n";!0===
+a.consoleLog&&console.log(p);if("string"===a.outputMode)return p;if("base64"===a.outputMode)return
B(p);try{var x=new Blob([p],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(x,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){C(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+encodeURIComponent(p))}}else
if("sql"==a.type){var m=0,k="INSERT INTO `"+a.tableName+"` (",l=c(this).find("thead").first().find(a.theadSelector);l.each(function(){v(this,
+"th,td",m,l.length,function(a,c,d){k+="'"+w(a,c,d)+"',"});m++;k=c.trim(k);k=c.trim(k).substring(0,k.length-1)});k+=")
VALUES ";n=c(this).find("tbody").first().find(a.tbodySelector);n.each(function(){f="";v(this,"td",m,l.length+n.length,function(a,c,d){f+="'"+w(a,c,d)+"',"});3<f.length&&(k+="("+f,k=c.trim(k).substring(0,k.length-1),k+="),");m++});k=c.trim(k).substring(0,k.length-1);k+=";";!0===a.consoleLog&&console.log(k);if("string"==a.outputMode)return
k;if("base64"==a.outputMode)return B(k);try{x=
+new Blob([k],{type:"text/plain;charset=utf-8"}),saveAs(x,a.fileName+".sql")}catch(b){C(a.fileName+".sql","data:application/sql;charset=utf-8,"+encodeURIComponent(k))}}else
if("json"==a.type){var R=[],l=c(this).find("thead").first().find(a.theadSelector);l.each(function(){var
a=[];v(this,"th,td",m,l.length,function(c,d,e){a.push(w(c,d,e))});R.push(a)});var S=[],n=c(this).find("tbody").first().find(a.tbodySelector);n.each(function(){var
a=[];v(this,"td",m,l.length+n.length,function(c,d,e){a.push(w(c,
+d,e))});0<a.length&&(1!=a.length||""!=a[0])&&S.push(a);m++});q=[];q.push({header:R,data:S});var
z=JSON.stringify(q);!0===a.consoleLog&&console.log(z);if("string"==a.outputMode)return
z;q=B(z);if("base64"==a.outputMode)return q;try{x=new Blob([z],{type:"application/json;charset=utf-8"}),saveAs(x,a.fileName+".json")}catch(b){C(a.fileName+".json","data:application/json;charset=utf-8;base64,"+q)}}else
if("xml"===a.type){var m=0,u='<?xml version="1.0" encoding="utf-8"?>',u=u+"<tabledata><fields>",l=c(this).find("thead").first().find(a.theadSelector);
+l.each(function(){v(this,"th,td",m,n.length,function(a,c,d){u+="<field>"+w(a,c,d)+"</field>"});m++});var
u=u+"</fields><data>",T=1,n=c(this).find("tbody").first().find(a.tbodySelector);n.each(function(){var
a=1;f="";v(this,"td",m,l.length+n.length,function(c,d,e){f+="<column-"+a+">"+w(c,d,e)+"</column-"+a+">";a++});0<f.length&&"<column-1></column-1>"!=f&&(u+='<row
id="'+T+'">'+f+"</row>",T++);m++});u+="</data></tabledata>";!0===a.consoleLog&&console.log(u);if("string"==a.outputMode)return
u;q=B(u);
+if("base64"==a.outputMode)return q;try{x=new Blob([u],{type:"application/xml;charset=utf-8"}),saveAs(x,a.fileName+".xml")}catch(b){C(a.fileName+".xml","data:application/xml;charset=utf-8;base64,"+q)}}else
if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){var z="excel"==a.type||"xls"==a.type?"excel":"word",K="excel"==z?"xls":"doc";q="xls"==K?'xmlns:x="urn:schemas-microsoft-com:office:excel"':'xmlns:w="urn:schemas-microsoft-com:office:word"';var
m=0,y="<table>",l=c(this).find("thead").first().find(a.theadSelector);
+l.each(function(){f="";v(this,"th,td",m,l.length,function(b,g,d){if(null!=b){f+='<td style="';for(var
e in a.excelstyles)a.excelstyles.hasOwnProperty(e)&&(f+=a.excelstyles[e]+": "+c(b).css(a.excelstyles[e])+";");f+='">'+w(b,g,d)+"</td>"}});0<f.length&&(y+="<tr>"+f+"</tr>");m++});n=c(this).find("tbody").first().find(a.tbodySelector);n.each(function(){f="";v(this,"td",m,l.length+n.length,function(b,g,d){if(null!=b){f+='<td
style="';for(var e in a.excelstyles)a.excelstyles.hasOwnProperty(e)&&(f+=a.excelstyles[e]+
+": "+c(b).css(a.excelstyles[e])+";");c(b).is("[colspan]")&&(f+='" colspan="'+c(b).attr("colspan"));c(b).is("[rowspan]")&&(f+='"
rowspan="'+c(b).attr("rowspan"));f+='">'+w(b,g,d)+"</td>"}});0<f.length&&(y+="<tr>"+f+"</tr>");m++});a.displayTableName&&(y+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+w(c("<p>"+a.tableName+"</p>"))+"</td></tr>");y+="</table>";!0===a.consoleLog&&console.log(y);var
g;g='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+q+' xmlns="http://www.w3.org/TR/REC-html40">'+
+('<meta http-equiv="content-type" content="application/vnd.ms-'+z+'; charset=UTF-8">');g+="<head>";"excel"===z&&(g+="\x3c!--[if
gte mso 9]>",g+="<xml>",g+="<x:ExcelWorkbook>",g+="<x:ExcelWorksheets>",g+="<x:ExcelWorksheet>",g+="<x:Name>",g+=a.worksheetName,g+="</x:Name>",g+="<x:WorksheetOptions>",g+="<x:DisplayGridlines/>",g+="</x:WorksheetOptions>",g+="</x:ExcelWorksheet>",g+="</x:ExcelWorksheets>",g+="</x:ExcelWorkbook>",g+="</xml>",g+="<![endif]--\x3e");g+="</head>";g+="<body>";g+=y;g+="</body>";
+g+="</html>";if("string"==a.outputMode)return g;q=B(g);if("base64"===a.outputMode)return
q;try{x=new Blob([g],{type:"application/vnd.ms-"+a.type}),saveAs(x,a.fileName+"."+K)}catch(b){C(a.fileName+"."+K,"data:application/vnd.ms-"+z+";base64,"+q)}}else
if("png"==a.type)html2canvas(c(this)[0],{allowTaint:!0,background:"#fff",onrendered:function(b){b=b.toDataURL();b=b.substring(22);for(var
c=atob(b),d=new ArrayBuffer(c.length),e=new Uint8Array(d),f=0;f<c.length;f++)e[f]=c.charCodeAt(f);try{var
g=new Blob([d],
+{type:"image/png"});saveAs(g,a.fileName+".png")}catch(h){C(a.fileName+".png","data:image/png;base64,"+b)}}});else
if("pdf"==a.type)if(!1===a.jspdf.autotable){var x={dim:{w:J(c(this).first().get(0),"width","mm"),h:J(c(this).first().get(0),"height","mm")},pagesplit:!1},U=new
jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);U.addHTML(c(this).first(),a.jspdf.margins.left,a.jspdf.margins.top,x,function(){M(U)})}else{var
h=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===
+a.jspdf.format.toLowerCase()){var E={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},H="",F="",V=0;c(this).filter(":visible").each(function(){if("none"!=c(this).css("display")){var
a=J(c(this).get(0),"width","pt");if(a>V){a>E.a0[0]&&(H="a0",F="l");for(var f
in E)E.hasOwnProperty(f)&&E[f][1]>a&&(H=f,F="l",E[f][0]>a&&(F="p"));V=a}}});a.jspdf.format=""==H?"a4":H;a.jspdf.orientation=""==F?"w":F}h.doc=new
jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);
+c(this).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var
b,f=0;h.columns=[];h.rows=[];h.rowoptions={};if("function"===typeof h.onTable&&!1===h.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var
d=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=h;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);"function"!==typeof
d.beforePageContent&&(d.beforePageContent=
+function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+=(2-1.15)/2*b.styles.fontSize)})});"function"!==typeof
d.createdHeaderCell&&(d.createdHeaderCell=function(a,b){if("undefined"!=typeof h.columns[b.column.dataKey]){var
c=h.columns[b.column.dataKey];a.styles.halign=c.style.align;"inherit"===d.styles.fillColor&&(a.styles.fillColor=c.style.bcolor);"inherit"===d.styles.textColor&&(a.styles.textColor=
+c.style.color);"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle)}});"function"!==typeof
d.createdCell&&(d.createdCell=function(a,b){var c=h.rowoptions[b.row.index+":"+b.column.dataKey];"undefined"!=typeof
c&&"undefined"!=typeof c.style&&(a.styles.halign=c.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=c.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=c.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle))});"function"!==
+typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=h.columns[b.column.dataKey];return
1!=c.style.hasOwnProperty("hidden")||!0!==c.style.hidden?N(a,b,c):!1});"function"!==typeof
d.drawCell&&(d.drawCell=function(a,b){return N(a,b,h.rowoptions[b.row.index+":"+b.column.dataKey])});l=c(this).find("thead").find(a.theadSelector);l.each(function(){b=0;v(this,"th,td",f,l.length,function(a,c,d){var
e=Q(a);e.title=w(a,c,d);e.key=b++;h.columns.push(e)});f++});var e=0;n=c(this).find("tbody").find(a.tbodySelector);
+n.each(function(){var a=[];b=0;v(this,"td",f,l.length+n.length,function(d,f,g){if("undefined"===typeof
h.columns[b]){var k={title:"",key:b,style:{hidden:!0}};h.columns.push(k)}null!==d?h.rowoptions[e+":"+b++]=Q(d):(k=c.extend(!0,{},h.rowoptions[e+":"+(b-1)]),k.colspan=-1,h.rowoptions[e+":"+b++]=k);a.push(w(d,f,g))});a.length&&(h.rows.push(a),e++);f++});if("function"===typeof
h.onBeforeAutotable)h.onBeforeAutotable(c(this),h.columns,h.rows,d);h.doc.autoTable(h.columns,h.rows,d);if("function"===typeof
h.onAfterAutotable)h.onAfterAutotable(c(this),
+d);a.jspdf.autotable.startY=h.doc.autoTableEndPosY()+d.margin.top});M(h.doc);h.columns.length=0;h.rows.length=0;delete
h.doc;h.doc=null}return this}})})(jQuery);
\ No newline at end of file



Mime
View raw message