tableexport
Advanced tools
Comparing version 3.3.9 to 3.3.10
{ | ||
"name": "tableexport.js", | ||
"version": "3.3.9", | ||
"version": "3.3.10", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "clarketm <travis.m.clarke@gmail.com>" |
/*! | ||
* TableExport.js v3.3.9 (https://www.travismclarke.com) | ||
* TableExport.js v3.3.10 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
@@ -312,3 +312,3 @@ * Licensed under the MIT license | ||
*/ | ||
version: "3.3.9", | ||
version: "3.3.10", | ||
/** | ||
@@ -506,5 +506,8 @@ * Default plugin options. | ||
} | ||
saveAs(new Blob([data], | ||
{type: mime + ";" + this.charset}), | ||
name + extension, true); | ||
var blob = new Blob([data], {type: mime + ";" + this.charset}); | ||
if (typeof saveAs === "undefined" && typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) { | ||
window.navigator.msSaveOrOpenBlob(blob, name + extension); | ||
} else { | ||
saveAs(blob, name + extension, true); | ||
} | ||
}, | ||
@@ -554,2 +557,2 @@ /** | ||
} | ||
)); | ||
)); |
/*! | ||
* TableExport.js v3.3.9 (https://www.travismclarke.com) | ||
* TableExport.js v3.3.10 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
* Licensed under the MIT license | ||
*/ | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","blobjs","file-saverjs","xlsx-js"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("blobjs"),require("file-saverjs"),require("xlsx-js")):e(t,t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this||window,function(t,e,n,o,i){"use strict";var r=function(t,n,o){var s=this;s.settings=o?n:e.extend({},r.prototype.defaults,n),s.selectors=t;var a,p,f,l=r.prototype.rowDel,u=s.settings.ignoreRows instanceof Array?s.settings.ignoreRows:[s.settings.ignoreRows],c=s.settings.ignoreCols instanceof Array?s.settings.ignoreCols:[s.settings.ignoreCols],x=s.settings.ignoreCSS instanceof Array?s.settings.ignoreCSS.join(", "):s.settings.ignoreCSS,y=s.settings.emptyCSS instanceof Array?s.settings.emptyCSS.join(", "):s.settings.emptyCSS;return s.settings.bootstrap?(a=r.prototype.bootstrap[0]+" ",p=r.prototype.bootstrap[1]+" ",f=r.prototype.bootstrap[2]+" "):(a=r.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function t(t){return s.settings.trimWhitespace?t.trim():t}function n(t){var e=m.find("caption:not(.head)");e.length?e.append(t):m.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function d(t,e,o){var i="<button data-fileblob='"+t+"' class='"+a+p+o+"'>"+e+"</button>";n(i)}var m=e(this);o&&m.find("caption:not(.head)").remove();var g=m.find("tbody").find("tr"),g=s.settings.headings?g.add(m.find("thead>tr")):g,g=s.settings.footers?g.add(m.find("tfoot>tr")):g,b=s.settings.headings?m.find("thead>tr").length:0,h="id"===s.settings.fileName?m.attr("id")?m.attr("id"):r.prototype.defaultFileName:s.settings.fileName,v={xlsx:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(y))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xlsx.mimeType,fileExtension:r.prototype.xlsx.fileExtension})),p=r.prototype.xlsx.buttonContent,f=r.prototype.xlsx.defaultClass;d(a,p,f)},xlsm:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(y))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;d(a,p,f)},xls:function(n,o){var i=r.prototype.xls.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(y)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;d(a,p,f)},csv:function(n,o){var i=r.prototype.csv.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(y)?" ":'"'+t(e(o).text().replace(/"/g,'""'))+'"'}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.csv.mimeType,fileExtension:r.prototype.csv.fileExtension})),p=r.prototype.csv.buttonContent,f=r.prototype.csv.defaultClass;d(a,p,f)},txt:function(n,o){var i=r.prototype.txt.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(y)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.txt.mimeType,fileExtension:r.prototype.txt.fileExtension})),p=r.prototype.txt.buttonContent,f=r.prototype.txt.defaultClass;d(a,p,f)}};s.settings.formats.forEach(function(t){!(!i||"xls"!==t)&&(t="xlsm"),!i&&"xlsx"===t&&(t=null),t&&v[t](l,h)})}),e("button[data-fileblob]").off("click").on("click",function(){var t=e(this).data("fileblob"),n=t.data,o=t.fileName,i=t.mimeType,s=t.fileExtension;r.prototype.export2file(n,i,o,s)}),s};r.prototype={version:"3.3.9",defaults:{headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore",emptyCSS:".tableexport-empty",trimWhitespace:!1},charset:"charset=utf-8",defaultFileName:"myDownload",defaultButton:"button-default",bootstrap:["btn","btn-default","btn-toolbar"],rowDel:"\r\n",entityMap:{"&":"&","<":"<",">":">","'":"'","/":"/"},xlsx:{defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},xls:{defaultClass:"xls",buttonContent:"Export to xls",separator:"\t",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},csv:{defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"text/csv",fileExtension:".csv"},txt:{defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return r.prototype.entityMap[t]})},dateNum:function(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},n={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){n.s.r>o&&(n.s.r=o),n.s.c>r&&(n.s.c=r),n.e.r<o&&(n.e.r=o),n.e.c<r&&(n.e.c=r);var s={v:t[o][r]};if(null!=s.v){var a=i.utils.encode_cell({c:r,r:o});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=i.SSF._table[14],s.v=this.dateNum(s.v)):s.t="s",e[a]=s}}return n.s.c<1e7&&(e["!ref"]=i.utils.encode_range(n)),e},Workbook:function(){this.SheetNames=[],this.Sheets={}},string2ArrayBuffer:function(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),o=0;o!=t.length;++o)n[o]=255&t.charCodeAt(o);return e},export2file:function(t,e,r,s){if(i&&".xls"==s.substr(0,4)){var a=new this.Workbook,p=this.createSheet(t);a.SheetNames.push(r),a.Sheets[r]=p;var f={bookType:s.substr(1,3)+(s.substr(4)||"m"),bookSST:!1,type:"binary"},l=i.write(a,f);t=this.string2ArrayBuffer(l)}o(new n([t],{type:e+";"+this.charset}),r+s,!0)},update:function(t){return new r(this.selectors,e.extend({},this.settings,t),(!0))},reset:function(){return new r(this.selectors,this.settings,(!0))},remove:function(){this.selectors.each(function(){e(this).find("caption:not(.head)").remove()})}},e.fn.tableExport=function(t,e){return new r(this,t,e)};for(var s in r.prototype)e.fn.tableExport[s]=r.prototype[s];return t["default"]=t.TableExport=r}); | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","blobjs","file-saverjs","xlsx-js"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("blobjs"),require("file-saverjs"),require("xlsx-js")):e(t,t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this||window,function(t,e,n,o,i){"use strict";var r=function(t,n,o){var s=this;s.settings=o?n:e.extend({},r.prototype.defaults,n),s.selectors=t;var a,p,f,l=r.prototype.rowDel,u=s.settings.ignoreRows instanceof Array?s.settings.ignoreRows:[s.settings.ignoreRows],c=s.settings.ignoreCols instanceof Array?s.settings.ignoreCols:[s.settings.ignoreCols],x=s.settings.ignoreCSS instanceof Array?s.settings.ignoreCSS.join(", "):s.settings.ignoreCSS,d=s.settings.emptyCSS instanceof Array?s.settings.emptyCSS.join(", "):s.settings.emptyCSS;return s.settings.bootstrap?(a=r.prototype.bootstrap[0]+" ",p=r.prototype.bootstrap[1]+" ",f=r.prototype.bootstrap[2]+" "):(a=r.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function t(t){return s.settings.trimWhitespace?t.trim():t}function n(t){var e=m.find("caption:not(.head)");e.length?e.append(t):m.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function y(t,e,o){var i="<button data-fileblob='"+t+"' class='"+a+p+o+"'>"+e+"</button>";n(i)}var m=e(this);o&&m.find("caption:not(.head)").remove();var g=m.find("tbody").find("tr"),g=s.settings.headings?g.add(m.find("thead>tr")):g,g=s.settings.footers?g.add(m.find("tfoot>tr")):g,b=s.settings.headings?m.find("thead>tr").length:0,v="id"===s.settings.fileName?m.attr("id")?m.attr("id"):r.prototype.defaultFileName:s.settings.fileName,h={xlsx:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(d))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xlsx.mimeType,fileExtension:r.prototype.xlsx.fileExtension})),p=r.prototype.xlsx.buttonContent,f=r.prototype.xlsx.defaultClass;y(a,p,f)},xlsm:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(d))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;y(a,p,f)},xls:function(n,o){var i=r.prototype.xls.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(d)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;y(a,p,f)},csv:function(n,o){var i=r.prototype.csv.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(d)?" ":'"'+t(e(o).text().replace(/"/g,'""'))+'"'}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.csv.mimeType,fileExtension:r.prototype.csv.fileExtension})),p=r.prototype.csv.buttonContent,f=r.prototype.csv.defaultClass;y(a,p,f)},txt:function(n,o){var i=r.prototype.txt.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(d)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.txt.mimeType,fileExtension:r.prototype.txt.fileExtension})),p=r.prototype.txt.buttonContent,f=r.prototype.txt.defaultClass;y(a,p,f)}};s.settings.formats.forEach(function(t){!(!i||"xls"!==t)&&(t="xlsm"),!i&&"xlsx"===t&&(t=null),t&&h[t](l,v)})}),e("button[data-fileblob]").off("click").on("click",function(){var t=e(this).data("fileblob"),n=t.data,o=t.fileName,i=t.mimeType,s=t.fileExtension;r.prototype.export2file(n,i,o,s)}),s};r.prototype={version:"3.3.10",defaults:{headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore",emptyCSS:".tableexport-empty",trimWhitespace:!1},charset:"charset=utf-8",defaultFileName:"myDownload",defaultButton:"button-default",bootstrap:["btn","btn-default","btn-toolbar"],rowDel:"\r\n",entityMap:{"&":"&","<":"<",">":">","'":"'","/":"/"},xlsx:{defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},xls:{defaultClass:"xls",buttonContent:"Export to xls",separator:"\t",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},csv:{defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"text/csv",fileExtension:".csv"},txt:{defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return r.prototype.entityMap[t]})},dateNum:function(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},n={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){n.s.r>o&&(n.s.r=o),n.s.c>r&&(n.s.c=r),n.e.r<o&&(n.e.r=o),n.e.c<r&&(n.e.c=r);var s={v:t[o][r]};if(null!=s.v){var a=i.utils.encode_cell({c:r,r:o});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=i.SSF._table[14],s.v=this.dateNum(s.v)):s.t="s",e[a]=s}}return n.s.c<1e7&&(e["!ref"]=i.utils.encode_range(n)),e},Workbook:function(){this.SheetNames=[],this.Sheets={}},string2ArrayBuffer:function(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),o=0;o!=t.length;++o)n[o]=255&t.charCodeAt(o);return e},export2file:function(t,e,r,s){if(i&&".xls"==s.substr(0,4)){var a=new this.Workbook,p=this.createSheet(t);a.SheetNames.push(r),a.Sheets[r]=p;var f={bookType:s.substr(1,3)+(s.substr(4)||"m"),bookSST:!1,type:"binary"},l=i.write(a,f);t=this.string2ArrayBuffer(l)}var u=new n([t],{type:e+";"+this.charset});"undefined"==typeof o&&"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?window.navigator.msSaveOrOpenBlob(u,r+s):o(u,r+s,!0)},update:function(t){return new r(this.selectors,e.extend({},this.settings,t),(!0))},reset:function(){return new r(this.selectors,this.settings,(!0))},remove:function(){this.selectors.each(function(){e(this).find("caption:not(.head)").remove()})}},e.fn.tableExport=function(t,e){return new r(this,t,e)};for(var s in r.prototype)e.fn.tableExport[s]=r.prototype[s];return t["default"]=t.TableExport=r}); |
{ | ||
"name": "tableexport", | ||
"version": "3.3.9", | ||
"version": "3.3.10", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "clarketm <travis.m.clarke@gmail.com>" |
@@ -7,2 +7,6 @@ [![Build Status](https://travis-ci.org/clarketm/TableExport.svg?branch=master)](https://travis-ci.org/clarketm/TableExport) | ||
> **Notice:** In May 2017, [v3.0.0](https://github.com/clarketm/TableExport/releases/tag/v3.3.9) will be superceded by [v4.0.0](https://github.com/clarketm/TableExport/releases/tag/v4.0.0-alpha.4). Althought this is a major version bump, fear not, because all changes will be 100% backwards-compatible. | ||
> **So why the major version bump you ask?** Well, the rationale for a major version bump is that due to a change in `TableExport`'s dependencies, in [v4.0.0](https://github.com/clarketm/TableExport/releases/tag/v4.0.0-alpha.4) forth, JQuery will no longer be a **required** dependency, instead it will be purely **optional**. So existing implementations *with* jQuery will continue to work unimpeded, now with the added benefit that new projets no longer need to rely on the overhead of such large library, unless of course you prefer jQuery or it is already part of your project. | ||
## Getting Started | ||
@@ -39,2 +43,11 @@ | ||
### [unpkg](https://unpkg.com/#/) | ||
| | uncompressed | compressed | | ||
| :------: | :----------: | :--------: | | ||
| __CSS__ | [🔗](https://unpkg.com/tableexport/dist/css/tableexport.css) | [🔗](https://unpkg.com/tableexport/dist/css/tableexport.min.css) | | ||
| __JS__ | [🔗](https://unpkg.com/tableexport/dist/js/tableexport.js) | [🔗](https://unpkg.com/tableexport/dist/js/tableexport.min.js) | | ||
| __Images__ | — | [🔗<sup>xlsx</sup>](https://unpkg.com/tableexport/dist/img/xlsx.svg)[🔗<sup>xls</sup>](https://unpkg.com/tableexport/dist/img/xls.svg)[🔗<sup>csv</sup>](https://unpkg.com/tableexport/dist/img/csv.svg)[🔗<sup>txt</sup>](https://unpkg.com/tableexport/dist/img/txt.svg) | | ||
### Dependencies | ||
@@ -134,3 +147,3 @@ | ||
tables.update({ | ||
filename: "newFile" // pass in a new set of properties | ||
fileName: "newFile" // pass in a new set of properties | ||
}); | ||
@@ -237,6 +250,6 @@ | ||
### Credits | ||
### :star: Credits | ||
Special thanks the the following contributors: | ||
* [John Resig](https://github.com/jeresig) - jQuery | ||
* [SheetJS](https://github.com/SheetJS) - js-xlsx | ||
* [Eli Grey](https://github.com/eligrey) - FileSaver.js & Blob.js |
/*! | ||
* TableExport.js v3.3.9 (https://www.travismclarke.com) | ||
* TableExport.js v3.3.10 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
@@ -312,3 +312,3 @@ * Licensed under the MIT license | ||
*/ | ||
version: "3.3.9", | ||
version: "3.3.10", | ||
/** | ||
@@ -506,5 +506,8 @@ * Default plugin options. | ||
} | ||
saveAs(new Blob([data], | ||
{type: mime + ";" + this.charset}), | ||
name + extension, true); | ||
var blob = new Blob([data], {type: mime + ";" + this.charset}); | ||
if (typeof saveAs === "undefined" && typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) { | ||
window.navigator.msSaveOrOpenBlob(blob, name + extension); | ||
} else { | ||
saveAs(blob, name + extension, true); | ||
} | ||
}, | ||
@@ -554,2 +557,2 @@ /** | ||
} | ||
)); | ||
)); |
/*! | ||
* TableExport.js v3.3.9 (https://www.travismclarke.com) | ||
* TableExport.js v3.3.10 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
* Licensed under the MIT license | ||
*/ | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","blobjs","file-saverjs","xlsx-js"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("blobjs"),require("file-saverjs"),require("xlsx-js")):e(t,t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this||window,function(t,e,n,o,i){"use strict";var r=function(t,n,o){var s=this;s.settings=o?n:e.extend({},r.prototype.defaults,n),s.selectors=t;var a,p,f,l=r.prototype.rowDel,u=s.settings.ignoreRows instanceof Array?s.settings.ignoreRows:[s.settings.ignoreRows],c=s.settings.ignoreCols instanceof Array?s.settings.ignoreCols:[s.settings.ignoreCols],x=s.settings.ignoreCSS instanceof Array?s.settings.ignoreCSS.join(", "):s.settings.ignoreCSS,y=s.settings.emptyCSS instanceof Array?s.settings.emptyCSS.join(", "):s.settings.emptyCSS;return s.settings.bootstrap?(a=r.prototype.bootstrap[0]+" ",p=r.prototype.bootstrap[1]+" ",f=r.prototype.bootstrap[2]+" "):(a=r.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function t(t){return s.settings.trimWhitespace?t.trim():t}function n(t){var e=m.find("caption:not(.head)");e.length?e.append(t):m.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function d(t,e,o){var i="<button data-fileblob='"+t+"' class='"+a+p+o+"'>"+e+"</button>";n(i)}var m=e(this);o&&m.find("caption:not(.head)").remove();var g=m.find("tbody").find("tr"),g=s.settings.headings?g.add(m.find("thead>tr")):g,g=s.settings.footers?g.add(m.find("tfoot>tr")):g,b=s.settings.headings?m.find("thead>tr").length:0,h="id"===s.settings.fileName?m.attr("id")?m.attr("id"):r.prototype.defaultFileName:s.settings.fileName,v={xlsx:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(y))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xlsx.mimeType,fileExtension:r.prototype.xlsx.fileExtension})),p=r.prototype.xlsx.buttonContent,f=r.prototype.xlsx.defaultClass;d(a,p,f)},xlsm:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(y))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;d(a,p,f)},xls:function(n,o){var i=r.prototype.xls.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(y)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;d(a,p,f)},csv:function(n,o){var i=r.prototype.csv.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(y)?" ":'"'+t(e(o).text().replace(/"/g,'""'))+'"'}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.csv.mimeType,fileExtension:r.prototype.csv.fileExtension})),p=r.prototype.csv.buttonContent,f=r.prototype.csv.defaultClass;d(a,p,f)},txt:function(n,o){var i=r.prototype.txt.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(y)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.txt.mimeType,fileExtension:r.prototype.txt.fileExtension})),p=r.prototype.txt.buttonContent,f=r.prototype.txt.defaultClass;d(a,p,f)}};s.settings.formats.forEach(function(t){!(!i||"xls"!==t)&&(t="xlsm"),!i&&"xlsx"===t&&(t=null),t&&v[t](l,h)})}),e("button[data-fileblob]").off("click").on("click",function(){var t=e(this).data("fileblob"),n=t.data,o=t.fileName,i=t.mimeType,s=t.fileExtension;r.prototype.export2file(n,i,o,s)}),s};r.prototype={version:"3.3.9",defaults:{headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore",emptyCSS:".tableexport-empty",trimWhitespace:!1},charset:"charset=utf-8",defaultFileName:"myDownload",defaultButton:"button-default",bootstrap:["btn","btn-default","btn-toolbar"],rowDel:"\r\n",entityMap:{"&":"&","<":"<",">":">","'":"'","/":"/"},xlsx:{defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},xls:{defaultClass:"xls",buttonContent:"Export to xls",separator:"\t",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},csv:{defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"text/csv",fileExtension:".csv"},txt:{defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return r.prototype.entityMap[t]})},dateNum:function(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},n={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){n.s.r>o&&(n.s.r=o),n.s.c>r&&(n.s.c=r),n.e.r<o&&(n.e.r=o),n.e.c<r&&(n.e.c=r);var s={v:t[o][r]};if(null!=s.v){var a=i.utils.encode_cell({c:r,r:o});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=i.SSF._table[14],s.v=this.dateNum(s.v)):s.t="s",e[a]=s}}return n.s.c<1e7&&(e["!ref"]=i.utils.encode_range(n)),e},Workbook:function(){this.SheetNames=[],this.Sheets={}},string2ArrayBuffer:function(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),o=0;o!=t.length;++o)n[o]=255&t.charCodeAt(o);return e},export2file:function(t,e,r,s){if(i&&".xls"==s.substr(0,4)){var a=new this.Workbook,p=this.createSheet(t);a.SheetNames.push(r),a.Sheets[r]=p;var f={bookType:s.substr(1,3)+(s.substr(4)||"m"),bookSST:!1,type:"binary"},l=i.write(a,f);t=this.string2ArrayBuffer(l)}o(new n([t],{type:e+";"+this.charset}),r+s,!0)},update:function(t){return new r(this.selectors,e.extend({},this.settings,t),(!0))},reset:function(){return new r(this.selectors,this.settings,(!0))},remove:function(){this.selectors.each(function(){e(this).find("caption:not(.head)").remove()})}},e.fn.tableExport=function(t,e){return new r(this,t,e)};for(var s in r.prototype)e.fn.tableExport[s]=r.prototype[s];return t["default"]=t.TableExport=r}); | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","blobjs","file-saverjs","xlsx-js"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("blobjs"),require("file-saverjs"),require("xlsx-js")):e(t,t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this||window,function(t,e,n,o,i){"use strict";var r=function(t,n,o){var s=this;s.settings=o?n:e.extend({},r.prototype.defaults,n),s.selectors=t;var a,p,f,l=r.prototype.rowDel,u=s.settings.ignoreRows instanceof Array?s.settings.ignoreRows:[s.settings.ignoreRows],c=s.settings.ignoreCols instanceof Array?s.settings.ignoreCols:[s.settings.ignoreCols],x=s.settings.ignoreCSS instanceof Array?s.settings.ignoreCSS.join(", "):s.settings.ignoreCSS,d=s.settings.emptyCSS instanceof Array?s.settings.emptyCSS.join(", "):s.settings.emptyCSS;return s.settings.bootstrap?(a=r.prototype.bootstrap[0]+" ",p=r.prototype.bootstrap[1]+" ",f=r.prototype.bootstrap[2]+" "):(a=r.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function t(t){return s.settings.trimWhitespace?t.trim():t}function n(t){var e=m.find("caption:not(.head)");e.length?e.append(t):m.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function y(t,e,o){var i="<button data-fileblob='"+t+"' class='"+a+p+o+"'>"+e+"</button>";n(i)}var m=e(this);o&&m.find("caption:not(.head)").remove();var g=m.find("tbody").find("tr"),g=s.settings.headings?g.add(m.find("thead>tr")):g,g=s.settings.footers?g.add(m.find("tfoot>tr")):g,b=s.settings.headings?m.find("thead>tr").length:0,v="id"===s.settings.fileName?m.attr("id")?m.attr("id"):r.prototype.defaultFileName:s.settings.fileName,h={xlsx:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(d))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xlsx.mimeType,fileExtension:r.prototype.xlsx.fileExtension})),p=r.prototype.xlsx.buttonContent,f=r.prototype.xlsx.defaultClass;y(a,p,f)},xlsm:function(n,o){var i={},s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return[r.map(function(o,r){if(!~c.indexOf(o)&&!e(r).is(x)){if(e(r).is(d))return" ";if(r.hasAttribute("colspan")&&(i[n]=i[n]||{},i[n][o+1]=r.getAttribute("colspan")-1),r.hasAttribute("rowspan"))for(var s=1;s<r.getAttribute("rowspan");s++)i[n+s]=i[n+s]||{},i[n+s][o]=1;if(i[n]){for(var a=o+1,p=0,f=0,s=0;s<=Math.max.apply(Math,Object.keys(i[n]))&&(i[n][s]?p=f>=o?p+i[n][s]:p:f++,f!==a);s++);return new Array(p).concat(e(r).text())}return t(e(r).text())}}).get()]}}).get(),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;y(a,p,f)},xls:function(n,o){var i=r.prototype.xls.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(d)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.xls.mimeType,fileExtension:r.prototype.xls.fileExtension})),p=r.prototype.xls.buttonContent,f=r.prototype.xls.defaultClass;y(a,p,f)},csv:function(n,o){var i=r.prototype.csv.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(d)?" ":'"'+t(e(o).text().replace(/"/g,'""'))+'"'}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.csv.mimeType,fileExtension:r.prototype.csv.fileExtension})),p=r.prototype.csv.buttonContent,f=r.prototype.csv.defaultClass;y(a,p,f)},txt:function(n,o){var i=r.prototype.txt.separator,s=g.map(function(n,o){if(!~u.indexOf(n-b)&&!e(o).is(x)){var r=e(o).find("th, td");return r.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x))return e(o).is(d)?" ":t(e(o).text())}).get().join(i)}}).get().join(n),a=r.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:r.prototype.txt.mimeType,fileExtension:r.prototype.txt.fileExtension})),p=r.prototype.txt.buttonContent,f=r.prototype.txt.defaultClass;y(a,p,f)}};s.settings.formats.forEach(function(t){!(!i||"xls"!==t)&&(t="xlsm"),!i&&"xlsx"===t&&(t=null),t&&h[t](l,v)})}),e("button[data-fileblob]").off("click").on("click",function(){var t=e(this).data("fileblob"),n=t.data,o=t.fileName,i=t.mimeType,s=t.fileExtension;r.prototype.export2file(n,i,o,s)}),s};r.prototype={version:"3.3.10",defaults:{headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore",emptyCSS:".tableexport-empty",trimWhitespace:!1},charset:"charset=utf-8",defaultFileName:"myDownload",defaultButton:"button-default",bootstrap:["btn","btn-default","btn-toolbar"],rowDel:"\r\n",entityMap:{"&":"&","<":"<",">":">","'":"'","/":"/"},xlsx:{defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},xls:{defaultClass:"xls",buttonContent:"Export to xls",separator:"\t",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},csv:{defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"text/csv",fileExtension:".csv"},txt:{defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return r.prototype.entityMap[t]})},dateNum:function(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},n={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){n.s.r>o&&(n.s.r=o),n.s.c>r&&(n.s.c=r),n.e.r<o&&(n.e.r=o),n.e.c<r&&(n.e.c=r);var s={v:t[o][r]};if(null!=s.v){var a=i.utils.encode_cell({c:r,r:o});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=i.SSF._table[14],s.v=this.dateNum(s.v)):s.t="s",e[a]=s}}return n.s.c<1e7&&(e["!ref"]=i.utils.encode_range(n)),e},Workbook:function(){this.SheetNames=[],this.Sheets={}},string2ArrayBuffer:function(t){for(var e=new ArrayBuffer(t.length),n=new Uint8Array(e),o=0;o!=t.length;++o)n[o]=255&t.charCodeAt(o);return e},export2file:function(t,e,r,s){if(i&&".xls"==s.substr(0,4)){var a=new this.Workbook,p=this.createSheet(t);a.SheetNames.push(r),a.Sheets[r]=p;var f={bookType:s.substr(1,3)+(s.substr(4)||"m"),bookSST:!1,type:"binary"},l=i.write(a,f);t=this.string2ArrayBuffer(l)}var u=new n([t],{type:e+";"+this.charset});"undefined"==typeof o&&"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?window.navigator.msSaveOrOpenBlob(u,r+s):o(u,r+s,!0)},update:function(t){return new r(this.selectors,e.extend({},this.settings,t),(!0))},reset:function(){return new r(this.selectors,this.settings,(!0))},remove:function(){this.selectors.each(function(){e(this).find("caption:not(.head)").remove()})}},e.fn.tableExport=function(t,e){return new r(this,t,e)};for(var s in r.prototype)e.fn.tableExport[s]=r.prototype[s];return t["default"]=t.TableExport=r}); |
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
7504622
167
51966
252