tableexport
Advanced tools
Comparing version 3.0.0 to 3.1.2
{ | ||
"name": "tableexport.js", | ||
"version": "3.0.0", | ||
"version": "3.1.2", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "clarketm <travis.m.clarke@gmail.com>" |
/*! | ||
* TableExport.js v3.1.0 (http://www.clarketravis.com) | ||
* TableExport.js v3.1.2 (http://www.clarketravis.com) | ||
* Copyright 2015 Travis Clarke | ||
@@ -42,3 +42,3 @@ * Licensed under the MIT license | ||
name: name | ||
}), | ||
}).replace(/'/g, "'"), | ||
myFile = name + ".xlsx", | ||
@@ -106,3 +106,3 @@ myContent = $.fn.tableExport.xlsx.buttonContent, | ||
function createButton(dataURL, myFile, myContent, myClass) { | ||
var exportButton = "<a href='" + dataURL + "' download='" + myFile + "' role='button' class='" + bootstrapClass + bootstrapTheme + myClass + "'>" + myContent + "</a>"; | ||
var exportButton = '<a href="' + dataURL + '" download="' + myFile + '" role="button" class="' + bootstrapClass + bootstrapTheme + myClass + '">' + myContent + '</a>'; | ||
checkCaption(exportButton); | ||
@@ -173,71 +173,64 @@ } | ||
function dateNum(v, date1904) { | ||
if (date1904) v += 1462; | ||
var epoch = Date.parse(v); | ||
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); | ||
} | ||
}(window)); | ||
function createSheet(data, opts) { | ||
var ws = {}; | ||
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}}; | ||
for (var R = 0; R != data.length; ++R) { | ||
for (var C = 0; C != data[R].length; ++C) { | ||
if (range.s.r > R) range.s.r = R; | ||
if (range.s.c > C) range.s.c = C; | ||
if (range.e.r < R) range.e.r = R; | ||
if (range.e.c < C) range.e.c = C; | ||
var cell = {v: data[R][C]}; | ||
if (cell.v == null) continue; | ||
var cell_ref = XLSX.utils.encode_cell({c: C, r: R}); | ||
function dateNum(v, date1904) { | ||
if (date1904) v += 1462; | ||
var epoch = Date.parse(v); | ||
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); | ||
} | ||
if (typeof cell.v === 'number') cell.t = 'n'; | ||
else if (typeof cell.v === 'boolean') cell.t = 'b'; | ||
else if (cell.v instanceof Date) { | ||
cell.t = 'n'; | ||
cell.z = XLSX.SSF._table[14]; | ||
cell.v = dateNum(cell.v); | ||
} | ||
else cell.t = 's'; | ||
function createSheet(data, opts) { | ||
var ws = {}; | ||
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}}; | ||
for (var R = 0; R != data.length; ++R) { | ||
for (var C = 0; C != data[R].length; ++C) { | ||
if (range.s.r > R) range.s.r = R; | ||
if (range.s.c > C) range.s.c = C; | ||
if (range.e.r < R) range.e.r = R; | ||
if (range.e.c < C) range.e.c = C; | ||
var cell = {v: data[R][C]}; | ||
if (cell.v == null) continue; | ||
var cell_ref = XLSX.utils.encode_cell({c: C, r: R}); | ||
if (typeof cell.v === 'number') cell.t = 'n'; | ||
else if (typeof cell.v === 'boolean') cell.t = 'b'; | ||
else if (cell.v instanceof Date) { | ||
cell.t = 'n'; | ||
cell.z = XLSX.SSF._table[14]; | ||
cell.v = dateNum(cell.v); | ||
ws[cell_ref] = cell; | ||
} | ||
else cell.t = 's'; | ||
ws[cell_ref] = cell; | ||
} | ||
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); | ||
return ws; | ||
} | ||
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); | ||
return ws; | ||
} | ||
function Workbook() { | ||
if (!(this instanceof Workbook)) return new Workbook(); | ||
this.SheetNames = []; | ||
this.Sheets = {}; | ||
} | ||
function Workbook() { | ||
if (!(this instanceof Workbook)) return new Workbook(); | ||
this.SheetNames = []; | ||
this.Sheets = {}; | ||
} | ||
function string2ArrayBuffer(s) { | ||
var buf = new ArrayBuffer(s.length); | ||
var view = new Uint8Array(buf); | ||
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; | ||
return buf; | ||
} | ||
function string2ArrayBuffer(s) { | ||
var buf = new ArrayBuffer(s.length); | ||
var view = new Uint8Array(buf); | ||
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; | ||
return buf; | ||
} | ||
function export2xlsx(data, name) { | ||
var wb = new Workbook(), | ||
ws = createSheet(data); | ||
function export2xlsx(data, name) { | ||
var wb = new Workbook(), | ||
ws = createSheet(data); | ||
wb.SheetNames.push(name); | ||
wb.Sheets[name] = ws; | ||
wb.SheetNames.push(name); | ||
wb.Sheets[name] = ws; | ||
var wopts = {bookType: 'xlsx', bookSST: false, type: 'binary'}; | ||
var wbout = XLSX.write(wb, wopts); | ||
var wopts = {bookType: 'xlsx', bookSST: false, type: 'binary'}; | ||
var wbout = XLSX.write(wb, wopts); | ||
saveAs(new Blob([string2ArrayBuffer(wbout)], | ||
saveAs(new Blob([string2ArrayBuffer(wbout)], | ||
{type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}), | ||
name + ".xlsx"); | ||
} | ||
name + ".xlsx"); | ||
} | ||
}(window)); |
/*! | ||
* TableExport.js v3.1.0 (http://www.clarketravis.com) | ||
* TableExport.js v3.1.2 (http://www.clarketravis.com) | ||
* Copyright 2015 Travis Clarke | ||
* Licensed under the MIT license | ||
*/ | ||
function dateNum(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function createSheet(t,e){for(var n={},a={s:{c:1e7,r:1e7},e:{c:0,r:0}},o=0;o!=t.length;++o)for(var r=0;r!=t[o].length;++r){a.s.r>o&&(a.s.r=o),a.s.c>r&&(a.s.c=r),a.e.r<o&&(a.e.r=o),a.e.c<r&&(a.e.c=r);var l={v:t[o][r]};if(null!=l.v){var s=XLSX.utils.encode_cell({c:r,r:o});"number"==typeof l.v?l.t="n":"boolean"==typeof l.v?l.t="b":l.v instanceof Date?(l.t="n",l.z=XLSX.SSF._table[14],l.v=dateNum(l.v)):l.t="s",n[s]=l}}return a.s.c<1e7&&(n["!ref"]=XLSX.utils.encode_range(a)),n}function Workbook(){return this instanceof Workbook?(this.SheetNames=[],void(this.Sheets={})):new Workbook}function string2ArrayBuffer(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),a=0;a!=t.length;++a)n[a]=255&t.charCodeAt(a);return e}function export2xlsx(t,e){var n=new Workbook,a=createSheet(t);n.SheetNames.push(e),n.Sheets[e]=a;var o={bookType:"xlsx",bookSST:!1,type:"binary"},r=XLSX.write(n,o);saveAs(new Blob([string2ArrayBuffer(r)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),e+".xlsx")}!function(t,e){var n=t.jQuery;n.fn.tableExport=function(t){var e,a,o,r=n.extend({},n.fn.tableExport.defaults,t),l=n.fn.tableExport.rowDel;return r.bootstrap?(e=n.fn.tableExport.bootstrap[0]+" ",a=n.fn.tableExport.bootstrap[1]+" ",o=n.fn.tableExport.bootstrap[2]+" "):(e=n.fn.tableExport.defaultButton+" ",a=o=""),this.each(function(){function t(t){var e=u.find("caption:not(.head)");e.length?e.append(t):u.prepend('<caption class="'+o+r.position+'">'+t+"</caption>")}function s(n,o,r,l){var s="<a href='"+n+"' download='"+o+"' role='button' class='"+e+a+l+"'>"+r+"</a>";t(s)}function f(n,o,r,l){var s="<a href='#' data-obj='"+n+"' download='"+o+"' role='button' class='"+e+a+l+"'>"+r+"</a>";t(s),i(l)}function i(t){var e="."+t;return n(e).on("click",function(t){if(n(this).data("obj")){t.preventDefault();var e=n(this).data("obj"),a=e.data,o=e.name;export2xlsx(a,o)}})}var u=n(this),p=r.headings?u.find("tr"):u.find("tr:has(td)"),x="id"===r.fileName?u.attr("id")?u.attr("id"):n.fn.tableExport.defaultFileName:r.fileName,c={xlsx:function(t,e){var a=p.map(function(t,e){var a=n(e).find("th, td");return a.map(function(t,e){return n(e).text()})}).get(),o=JSON.stringify({data:a,name:e}),r=e+".xlsx",l=n.fn.tableExport.xlsx.buttonContent,s=n.fn.tableExport.xlsx.defaultClass;f(o,r,l,s)},xls:function(t,e){var a=n.fn.tableExport.xls.separator,o="data:application/vnd.ms-excel;charset=utf-16,"+encodeURIComponent(p.map(function(t,e){var o=n(e).find("th, td");return o.map(function(t,e){return n(e).html()}).get().join(a)}).get().join(t)),r=e+".xls",l=n.fn.tableExport.xls.buttonContent,f=n.fn.tableExport.xls.defaultClass;s(o,r,l,f)},csv:function(t,e){t='"'+t+'"';var a='"'+n.fn.tableExport.csv.separator+'"',o="data:text/csv;charset=utf-16,"+encodeURIComponent('"'+p.map(function(t,e){var o=n(e).find("th, td");return o.map(function(t,e){return n(e).text().replace(/"/g,'""')}).get().join(a)}).get().join(t)+'"'),r=e+".csv",l=n.fn.tableExport.csv.buttonContent,f=n.fn.tableExport.csv.defaultClass;s(o,r,l,f)},txt:function(t,e){var a=n.fn.tableExport.txt.separator,o="data:text/plain;charset=utf-16,"+encodeURIComponent(p.map(function(t,e){var o=n(e).find("th, td");return o.map(function(t,e){return n(e).text()}).get().join(a)}).get().join(t)),r=e+".txt",l=n.fn.tableExport.txt.buttonContent,f=n.fn.tableExport.txt.defaultClass;s(o,r,l,f)}};r.formats.forEach(function(t){c[t](l,x)})})},n.fn.tableExport.defaults={headings:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom"},n.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx"},n.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" "},n.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:","},n.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" "},n.fn.tableExport.defaultFileName="myDownload",n.fn.tableExport.defaultButton="button-default",n.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],n.fn.tableExport.rowDel="\r\n"}(window); | ||
!function(t,n){function e(t,n){n&&(t+=1462);var e=Date.parse(t);return(e-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,n){for(var a={},o={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var l=0;l!=t[r].length;++l){o.s.r>r&&(o.s.r=r),o.s.c>l&&(o.s.c=l),o.e.r<r&&(o.e.r=r),o.e.c<l&&(o.e.c=l);var s={v:t[r][l]};if(null!=s.v){var f=XLSX.utils.encode_cell({c:l,r:r});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=XLSX.SSF._table[14],s.v=e(s.v)):s.t="s",a[f]=s}}return o.s.c<1e7&&(a["!ref"]=XLSX.utils.encode_range(o)),a}function o(){return this instanceof o?(this.SheetNames=[],void(this.Sheets={})):new o}function r(t){for(var n=new ArrayBuffer(t.length),e=new Uint8Array(n),a=0;a!=t.length;++a)e[a]=255&t.charCodeAt(a);return n}function l(t,n){var e=new o,l=a(t);e.SheetNames.push(n),e.Sheets[n]=l;var s={bookType:"xlsx",bookSST:!1,type:"binary"},f=XLSX.write(e,s);saveAs(new Blob([r(f)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),n+".xlsx")}var s=t.jQuery;s.fn.tableExport=function(t){var n,e,a,o=s.extend({},s.fn.tableExport.defaults,t),r=s.fn.tableExport.rowDel;return o.bootstrap?(n=s.fn.tableExport.bootstrap[0]+" ",e=s.fn.tableExport.bootstrap[1]+" ",a=s.fn.tableExport.bootstrap[2]+" "):(n=s.fn.tableExport.defaultButton+" ",e=a=""),this.each(function(){function t(t){var n=u.find("caption:not(.head)");n.length?n.append(t):u.prepend('<caption class="'+a+o.position+'">'+t+"</caption>")}function f(a,o,r,l){var s='<a href="'+a+'" download="'+o+'" role="button" class="'+n+e+l+'">'+r+"</a>";t(s)}function i(a,o,r,l){var s="<a href='#' data-obj='"+a+"' download='"+o+"' role='button' class='"+n+e+l+"'>"+r+"</a>";t(s),p(l)}function p(t){var n="."+t;return s(n).on("click",function(t){if(s(this).data("obj")){t.preventDefault();var n=s(this).data("obj"),e=n.data,a=n.name;l(e,a)}})}var u=s(this),x=o.headings?u.find("tr"):u.find("tr:has(td)"),c="id"===o.fileName?u.attr("id")?u.attr("id"):s.fn.tableExport.defaultFileName:o.fileName,d={xlsx:function(t,n){var e=x.map(function(t,n){var e=s(n).find("th, td");return e.map(function(t,n){return s(n).text()})}).get(),a=JSON.stringify({data:e,name:n}).replace(/'/g,"'"),o=n+".xlsx",r=s.fn.tableExport.xlsx.buttonContent,l=s.fn.tableExport.xlsx.defaultClass;i(a,o,r,l)},xls:function(t,n){var e=s.fn.tableExport.xls.separator,a="data:application/vnd.ms-excel;charset=utf-16,"+encodeURIComponent(x.map(function(t,n){var a=s(n).find("th, td");return a.map(function(t,n){return s(n).html()}).get().join(e)}).get().join(t)),o=n+".xls",r=s.fn.tableExport.xls.buttonContent,l=s.fn.tableExport.xls.defaultClass;f(a,o,r,l)},csv:function(t,n){t='"'+t+'"';var e='"'+s.fn.tableExport.csv.separator+'"',a="data:text/csv;charset=utf-16,"+encodeURIComponent('"'+x.map(function(t,n){var a=s(n).find("th, td");return a.map(function(t,n){return s(n).text().replace(/"/g,'""')}).get().join(e)}).get().join(t)+'"'),o=n+".csv",r=s.fn.tableExport.csv.buttonContent,l=s.fn.tableExport.csv.defaultClass;f(a,o,r,l)},txt:function(t,n){var e=s.fn.tableExport.txt.separator,a="data:text/plain;charset=utf-16,"+encodeURIComponent(x.map(function(t,n){var a=s(n).find("th, td");return a.map(function(t,n){return s(n).text()}).get().join(e)}).get().join(t)),o=n+".txt",r=s.fn.tableExport.txt.buttonContent,l=s.fn.tableExport.txt.defaultClass;f(a,o,r,l)}};o.formats.forEach(function(t){d[t](r,c)})})},s.fn.tableExport.defaults={headings:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom"},s.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx"},s.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" "},s.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:","},s.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" "},s.fn.tableExport.defaultFileName="myDownload",s.fn.tableExport.defaultButton="button-default",s.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],s.fn.tableExport.rowDel="\r\n"}(window); |
{ | ||
"name": "tableexport", | ||
"version": "3.0.0", | ||
"version": "3.1.2", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "clarketm <travis.m.clarke@gmail.com>" |
@@ -22,2 +22,7 @@ [![Build Status](https://travis-ci.org/clarketm/TableExport.svg?branch=master)](https://travis-ci.org/clarketm/TableExport) | ||
### Install with npm | ||
```shell | ||
$ npm install tableexport | ||
``` | ||
### Dependencies | ||
@@ -24,0 +29,0 @@ |
/*! | ||
* TableExport.js v3.1.0 (http://www.clarketravis.com) | ||
* TableExport.js v3.1.2 (http://www.clarketravis.com) | ||
* Copyright 2015 Travis Clarke | ||
@@ -42,3 +42,3 @@ * Licensed under the MIT license | ||
name: name | ||
}), | ||
}).replace(/'/g, "'"), | ||
myFile = name + ".xlsx", | ||
@@ -106,3 +106,3 @@ myContent = $.fn.tableExport.xlsx.buttonContent, | ||
function createButton(dataURL, myFile, myContent, myClass) { | ||
var exportButton = "<a href='" + dataURL + "' download='" + myFile + "' role='button' class='" + bootstrapClass + bootstrapTheme + myClass + "'>" + myContent + "</a>"; | ||
var exportButton = '<a href="' + dataURL + '" download="' + myFile + '" role="button" class="' + bootstrapClass + bootstrapTheme + myClass + '">' + myContent + '</a>'; | ||
checkCaption(exportButton); | ||
@@ -173,71 +173,64 @@ } | ||
function dateNum(v, date1904) { | ||
if (date1904) v += 1462; | ||
var epoch = Date.parse(v); | ||
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); | ||
} | ||
}(window)); | ||
function createSheet(data, opts) { | ||
var ws = {}; | ||
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}}; | ||
for (var R = 0; R != data.length; ++R) { | ||
for (var C = 0; C != data[R].length; ++C) { | ||
if (range.s.r > R) range.s.r = R; | ||
if (range.s.c > C) range.s.c = C; | ||
if (range.e.r < R) range.e.r = R; | ||
if (range.e.c < C) range.e.c = C; | ||
var cell = {v: data[R][C]}; | ||
if (cell.v == null) continue; | ||
var cell_ref = XLSX.utils.encode_cell({c: C, r: R}); | ||
function dateNum(v, date1904) { | ||
if (date1904) v += 1462; | ||
var epoch = Date.parse(v); | ||
return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000); | ||
} | ||
if (typeof cell.v === 'number') cell.t = 'n'; | ||
else if (typeof cell.v === 'boolean') cell.t = 'b'; | ||
else if (cell.v instanceof Date) { | ||
cell.t = 'n'; | ||
cell.z = XLSX.SSF._table[14]; | ||
cell.v = dateNum(cell.v); | ||
} | ||
else cell.t = 's'; | ||
function createSheet(data, opts) { | ||
var ws = {}; | ||
var range = {s: {c: 10000000, r: 10000000}, e: {c: 0, r: 0}}; | ||
for (var R = 0; R != data.length; ++R) { | ||
for (var C = 0; C != data[R].length; ++C) { | ||
if (range.s.r > R) range.s.r = R; | ||
if (range.s.c > C) range.s.c = C; | ||
if (range.e.r < R) range.e.r = R; | ||
if (range.e.c < C) range.e.c = C; | ||
var cell = {v: data[R][C]}; | ||
if (cell.v == null) continue; | ||
var cell_ref = XLSX.utils.encode_cell({c: C, r: R}); | ||
if (typeof cell.v === 'number') cell.t = 'n'; | ||
else if (typeof cell.v === 'boolean') cell.t = 'b'; | ||
else if (cell.v instanceof Date) { | ||
cell.t = 'n'; | ||
cell.z = XLSX.SSF._table[14]; | ||
cell.v = dateNum(cell.v); | ||
ws[cell_ref] = cell; | ||
} | ||
else cell.t = 's'; | ||
ws[cell_ref] = cell; | ||
} | ||
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); | ||
return ws; | ||
} | ||
if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); | ||
return ws; | ||
} | ||
function Workbook() { | ||
if (!(this instanceof Workbook)) return new Workbook(); | ||
this.SheetNames = []; | ||
this.Sheets = {}; | ||
} | ||
function Workbook() { | ||
if (!(this instanceof Workbook)) return new Workbook(); | ||
this.SheetNames = []; | ||
this.Sheets = {}; | ||
} | ||
function string2ArrayBuffer(s) { | ||
var buf = new ArrayBuffer(s.length); | ||
var view = new Uint8Array(buf); | ||
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; | ||
return buf; | ||
} | ||
function string2ArrayBuffer(s) { | ||
var buf = new ArrayBuffer(s.length); | ||
var view = new Uint8Array(buf); | ||
for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF; | ||
return buf; | ||
} | ||
function export2xlsx(data, name) { | ||
var wb = new Workbook(), | ||
ws = createSheet(data); | ||
function export2xlsx(data, name) { | ||
var wb = new Workbook(), | ||
ws = createSheet(data); | ||
wb.SheetNames.push(name); | ||
wb.Sheets[name] = ws; | ||
wb.SheetNames.push(name); | ||
wb.Sheets[name] = ws; | ||
var wopts = {bookType: 'xlsx', bookSST: false, type: 'binary'}; | ||
var wbout = XLSX.write(wb, wopts); | ||
var wopts = {bookType: 'xlsx', bookSST: false, type: 'binary'}; | ||
var wbout = XLSX.write(wb, wopts); | ||
saveAs(new Blob([string2ArrayBuffer(wbout)], | ||
saveAs(new Blob([string2ArrayBuffer(wbout)], | ||
{type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}), | ||
name + ".xlsx"); | ||
} | ||
name + ".xlsx"); | ||
} | ||
}(window)); |
/*! | ||
* TableExport.js v3.1.0 (http://www.clarketravis.com) | ||
* TableExport.js v3.1.2 (http://www.clarketravis.com) | ||
* Copyright 2015 Travis Clarke | ||
* Licensed under the MIT license | ||
*/ | ||
;(function(a,c){var b=a.jQuery;b.fn.tableExport=function(f){var g=b.extend({},b.fn.tableExport.defaults,f),i=b.fn.tableExport.rowDel,h,d,e;if(g.bootstrap){h=b.fn.tableExport.bootstrap[0]+" ";d=b.fn.tableExport.bootstrap[1]+" ";e=b.fn.tableExport.bootstrap[2]+" "}else{h=b.fn.tableExport.defaultButton+" ";d=e=""}return this.each(function(){var n=b(this),l=g.headings?n.find("tr"):n.find("tr:has(td)"),q=g.fileName==="id"?(n.attr("id")?n.attr("id"):b.fn.tableExport.defaultFileName):g.fileName,o={xlsx:function(w,r){var x=l.map(function(z,A){var y=b(A).find("th, td");return y.map(function(B,C){return b(C).text()})}).get(),v=JSON.stringify({data:x,name:r}),u=r+".xlsx",t=b.fn.tableExport.xlsx.buttonContent,s=b.fn.tableExport.xlsx.defaultClass;p(v,u,t,s)},xls:function(s,t){var r=b.fn.tableExport.xls.separator,x="data:application/vnd.ms-excel;charset=utf-16,"+encodeURIComponent(l.map(function(z,A){var y=b(A).find("th, td");return y.map(function(B,C){return b(C).html()}).get().join(r)}).get().join(s)),w=t+".xls",v=b.fn.tableExport.xls.buttonContent,u=b.fn.tableExport.xls.defaultClass;j(x,w,v,u)},csv:function(s,t){s='"'+s+'"';var r='"'+b.fn.tableExport.csv.separator+'"',x="data:text/csv;charset=utf-16,"+encodeURIComponent('"'+l.map(function(z,A){var y=b(A).find("th, td");return y.map(function(B,C){return b(C).text().replace(/"/g,'""')}).get().join(r)}).get().join(s)+'"'),w=t+".csv",v=b.fn.tableExport.csv.buttonContent,u=b.fn.tableExport.csv.defaultClass;j(x,w,v,u)},txt:function(s,t){var r=b.fn.tableExport.txt.separator,x="data:text/plain;charset=utf-16,"+encodeURIComponent(l.map(function(z,A){var y=b(A).find("th, td");return y.map(function(B,C){return b(C).text()}).get().join(r)}).get().join(s)),w=t+".txt",v=b.fn.tableExport.txt.buttonContent,u=b.fn.tableExport.txt.defaultClass;j(x,w,v,u)}};g.formats.forEach(function(r){o[r](i,q)});function k(r){var s=n.find("caption:not(.head)");s.length?s.append(r):n.prepend('<caption class="'+e+g.position+'">'+r+"</caption>")}function j(v,t,s,r){var u="<a href='"+v+"' download='"+t+"' role='button' class='"+h+d+r+"'>"+s+"</a>";k(u)}function p(u,t,s,r){var v="<a href='#' data-obj='"+u+"' download='"+t+"' role='button' class='"+h+d+r+"'>"+s+"</a>";k(v);m(r)}function m(s){var r="."+s;return b(r).on("click",function(v){if(b(this).data("obj")){v.preventDefault();var t=b(this).data("obj"),u=t.data,w=t.name;export2xlsx(u,w)}})}})};b.fn.tableExport.defaults={headings:true,formats:["xls","csv","txt"],fileName:"id",bootstrap:true,position:"bottom"};b.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx"};b.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:"\t"};b.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:","};b.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" "};b.fn.tableExport.defaultFileName="myDownload";b.fn.tableExport.defaultButton="button-default";b.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"];b.fn.tableExport.rowDel="\r\n"}(window));function dateNum(b,a){if(a){b+=1462}var c=Date.parse(b);return(c-new Date(Date.UTC(1899,11,30)))/(24*60*60*1000)}function createSheet(g,f){var b={};var c={s:{c:10000000,r:10000000},e:{c:0,r:0}};for(var e=0;e!=g.length;++e){for(var h=0;h!=g[e].length;++h){if(c.s.r>e){c.s.r=e}if(c.s.c>h){c.s.c=h}if(c.e.r<e){c.e.r=e}if(c.e.c<h){c.e.c=h}var a={v:g[e][h]};if(a.v==null){continue}var d=XLSX.utils.encode_cell({c:h,r:e});if(typeof a.v==="number"){a.t="n"}else{if(typeof a.v==="boolean"){a.t="b"}else{if(a.v instanceof Date){a.t="n";a.z=XLSX.SSF._table[14];a.v=dateNum(a.v)}else{a.t="s"}}}b[d]=a}}if(c.s.c<10000000){b["!ref"]=XLSX.utils.encode_range(c)}return b}function Workbook(){if(!(this instanceof Workbook)){return new Workbook()}this.SheetNames=[];this.Sheets={}}function string2ArrayBuffer(d){var b=new ArrayBuffer(d.length);var a=new Uint8Array(b);for(var c=0;c!=d.length;++c){a[c]=d.charCodeAt(c)&255}return b}function export2xlsx(f,b){var e=new Workbook(),a=createSheet(f);e.SheetNames.push(b);e.Sheets[b]=a;var d={bookType:"xlsx",bookSST:false,type:"binary"};var c=XLSX.write(e,d);saveAs(new Blob([string2ArrayBuffer(c)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),b+".xlsx")}; | ||
!function(t,n){function e(t,n){n&&(t+=1462);var e=Date.parse(t);return(e-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,n){for(var a={},o={s:{c:1e7,r:1e7},e:{c:0,r:0}},r=0;r!=t.length;++r)for(var l=0;l!=t[r].length;++l){o.s.r>r&&(o.s.r=r),o.s.c>l&&(o.s.c=l),o.e.r<r&&(o.e.r=r),o.e.c<l&&(o.e.c=l);var s={v:t[r][l]};if(null!=s.v){var f=XLSX.utils.encode_cell({c:l,r:r});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=XLSX.SSF._table[14],s.v=e(s.v)):s.t="s",a[f]=s}}return o.s.c<1e7&&(a["!ref"]=XLSX.utils.encode_range(o)),a}function o(){return this instanceof o?(this.SheetNames=[],void(this.Sheets={})):new o}function r(t){for(var n=new ArrayBuffer(t.length),e=new Uint8Array(n),a=0;a!=t.length;++a)e[a]=255&t.charCodeAt(a);return n}function l(t,n){var e=new o,l=a(t);e.SheetNames.push(n),e.Sheets[n]=l;var s={bookType:"xlsx",bookSST:!1,type:"binary"},f=XLSX.write(e,s);saveAs(new Blob([r(f)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),n+".xlsx")}var s=t.jQuery;s.fn.tableExport=function(t){var n,e,a,o=s.extend({},s.fn.tableExport.defaults,t),r=s.fn.tableExport.rowDel;return o.bootstrap?(n=s.fn.tableExport.bootstrap[0]+" ",e=s.fn.tableExport.bootstrap[1]+" ",a=s.fn.tableExport.bootstrap[2]+" "):(n=s.fn.tableExport.defaultButton+" ",e=a=""),this.each(function(){function t(t){var n=u.find("caption:not(.head)");n.length?n.append(t):u.prepend('<caption class="'+a+o.position+'">'+t+"</caption>")}function f(a,o,r,l){var s='<a href="'+a+'" download="'+o+'" role="button" class="'+n+e+l+'">'+r+"</a>";t(s)}function i(a,o,r,l){var s="<a href='#' data-obj='"+a+"' download='"+o+"' role='button' class='"+n+e+l+"'>"+r+"</a>";t(s),p(l)}function p(t){var n="."+t;return s(n).on("click",function(t){if(s(this).data("obj")){t.preventDefault();var n=s(this).data("obj"),e=n.data,a=n.name;l(e,a)}})}var u=s(this),x=o.headings?u.find("tr"):u.find("tr:has(td)"),c="id"===o.fileName?u.attr("id")?u.attr("id"):s.fn.tableExport.defaultFileName:o.fileName,d={xlsx:function(t,n){var e=x.map(function(t,n){var e=s(n).find("th, td");return e.map(function(t,n){return s(n).text()})}).get(),a=JSON.stringify({data:e,name:n}).replace(/'/g,"'"),o=n+".xlsx",r=s.fn.tableExport.xlsx.buttonContent,l=s.fn.tableExport.xlsx.defaultClass;i(a,o,r,l)},xls:function(t,n){var e=s.fn.tableExport.xls.separator,a="data:application/vnd.ms-excel;charset=utf-16,"+encodeURIComponent(x.map(function(t,n){var a=s(n).find("th, td");return a.map(function(t,n){return s(n).html()}).get().join(e)}).get().join(t)),o=n+".xls",r=s.fn.tableExport.xls.buttonContent,l=s.fn.tableExport.xls.defaultClass;f(a,o,r,l)},csv:function(t,n){t='"'+t+'"';var e='"'+s.fn.tableExport.csv.separator+'"',a="data:text/csv;charset=utf-16,"+encodeURIComponent('"'+x.map(function(t,n){var a=s(n).find("th, td");return a.map(function(t,n){return s(n).text().replace(/"/g,'""')}).get().join(e)}).get().join(t)+'"'),o=n+".csv",r=s.fn.tableExport.csv.buttonContent,l=s.fn.tableExport.csv.defaultClass;f(a,o,r,l)},txt:function(t,n){var e=s.fn.tableExport.txt.separator,a="data:text/plain;charset=utf-16,"+encodeURIComponent(x.map(function(t,n){var a=s(n).find("th, td");return a.map(function(t,n){return s(n).text()}).get().join(e)}).get().join(t)),o=n+".txt",r=s.fn.tableExport.txt.buttonContent,l=s.fn.tableExport.txt.defaultClass;f(a,o,r,l)}};o.formats.forEach(function(t){d[t](r,c)})})},s.fn.tableExport.defaults={headings:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom"},s.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx"},s.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" "},s.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:","},s.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" "},s.fn.tableExport.defaultFileName="myDownload",s.fn.tableExport.defaultButton="button-default",s.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],s.fn.tableExport.rowDel="\r\n"}(window); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7512872
163
51664
180