tableexport
Advanced tools
Comparing version 3.2.15 to 3.3.0
{ | ||
"name": "tableexport.js", | ||
"version": "3.2.15", | ||
"version": "3.3.0", | ||
"authors": [ | ||
@@ -22,7 +22,7 @@ "clarketm <travis.m.clarke@gmail.com>" | ||
"dependencies": { | ||
"Blob": "*", | ||
"bootstrap": "~3.3.5", | ||
"file-saver.js": "1.20150507.2", | ||
"jquery": "~1.11.3", | ||
"js-xlsx": "0.8.0" | ||
"js-xlsx": "0.8.0", | ||
"file-saver": "^1.3.3", | ||
"blobjs": "^1.0.0" | ||
}, | ||
@@ -37,3 +37,6 @@ "license": "MIT", | ||
"tests" | ||
] | ||
], | ||
"devDependencies": { | ||
"parallax.js": "^1.4.2" | ||
} | ||
} |
/*! | ||
* TableExport.js v3.2.15 (https://www.travismclarke.com) | ||
* TableExport.js 3.3.0 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
@@ -10,11 +10,11 @@ * Licensed under the MIT license | ||
// AMD. Register as an anonymous module. | ||
define(['exports', 'jquery', 'file-saver', 'xlsx'], factory); | ||
define(['exports', 'jquery', 'blobjs', 'file-saver', 'xlsx'], factory); | ||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { | ||
// CommonJS | ||
factory(exports, require('jquery'), require('file-saver'), require('xlsx')); | ||
factory(exports, require('jquery'), require('blobjs'), require('file-saver'), require('xlsx')); | ||
} else { | ||
// Browser globals | ||
factory(root, root.jQuery, root.saveAs, root.XLSX); | ||
factory(root, root.jQuery, root.Blob, root.saveAs, root.XLSX); | ||
} | ||
}(this, function (exports, $, saveAs, XLSX) { | ||
}(this, function (exports, $, Blob, saveAs, XLSX) { | ||
'use strict'; | ||
@@ -191,3 +191,3 @@ /** | ||
} | ||
return $(val).text(); | ||
return '"' + $(val).text().replace(/"/g, '""') + '"'; | ||
}).get().join(colD); | ||
@@ -194,0 +194,0 @@ }).get().join(rdel), |
/*! | ||
* TableExport.js v3.2.15 (https://www.travismclarke.com) | ||
* TableExport.js 3.3.0 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
* Licensed under the MIT license | ||
*/ | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","file-saver","xlsx"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("file-saver"),require("xlsx")):e(t,t.jQuery,t.saveAs,t.XLSX)}(this,function(t,e,n,o){"use strict";var i=function(t,n,r){var s=this;s.settings=r?n:e.extend({},i.prototype.defaults,n),s.selectors=t;var a,p,f,l=i.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=i.prototype.bootstrap[0]+" ",p=i.prototype.bootstrap[1]+" ",f=i.prototype.bootstrap[2]+" "):(a=i.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function t(t){var e=y.find("caption:not(.head)");e.length?e.append(t):y.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function n(e,n,o){var i="<button data-fileblob='"+e+"' class='"+a+p+o+"'>"+n+"</button>";t(i)}var y=e(this);r&&y.find("caption:not(.head)").remove();var m=y.find("tbody").find("tr"),m=s.settings.headings?m.add(y.find("thead>tr")):m,m=s.settings.footers?m.add(y.find("tfoot>tr")):m,g=s.settings.headings?y.find("thead>tr").length:0,v="id"===s.settings.fileName?y.attr("id")?y.attr("id"):i.prototype.defaultFileName:s.settings.fileName,b={xlsx:function(t,o){var r={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(r[t]=r[t]||{},r[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var i=1;i<o.getAttribute("rowspan");i++)r[t+i]=r[t+i]||{},r[t+i][n]=1;return r[t]&&r[t][n]?new Array(r[t][n]).concat(e(o).text()):e(o).text()}}).get()]}}).get(),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.xlsx.mimeType,fileExtension:i.prototype.xlsx.fileExtension})),p=i.prototype.xlsx.buttonContent,f=i.prototype.xlsx.defaultClass;n(a,p,f)},xlsm:function(t,o){var r={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(r[t]=r[t]||{},r[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var i=1;i<o.getAttribute("rowspan");i++)r[t+i]=r[t+i]||{},r[t+i][n]=1;return r[t]&&r[t][n]?new Array(r[t][n]).concat(e(o).text()):e(o).text()}}).get()]}}).get(),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.xls.mimeType,fileExtension:i.prototype.xls.fileExtension})),p=i.prototype.xls.buttonContent,f=i.prototype.xls.defaultClass;n(a,p,f)},xls:function(t,o){var r=i.prototype.xls.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){return~c.indexOf(t)||e(n).is(x)?void 0:e(n).is(d)?" ":e(n).text()}).get().join(r)}}).get().join(t),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.xls.mimeType,fileExtension:i.prototype.xls.fileExtension})),p=i.prototype.xls.buttonContent,f=i.prototype.xls.defaultClass;n(a,p,f)},csv:function(t,o){var r=i.prototype.csv.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){return~c.indexOf(t)||e(n).is(x)?void 0:e(n).is(d)?" ":e(n).text()}).get().join(r)}}).get().join(t),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.csv.mimeType,fileExtension:i.prototype.csv.fileExtension})),p=i.prototype.csv.buttonContent,f=i.prototype.csv.defaultClass;n(a,p,f)},txt:function(t,o){var r=i.prototype.txt.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){return~c.indexOf(t)||e(n).is(x)?void 0:e(n).is(d)?" ":e(n).text()}).get().join(r)}}).get().join(t),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.txt.mimeType,fileExtension:i.prototype.txt.fileExtension})),p=i.prototype.txt.buttonContent,f=i.prototype.txt.defaultClass;n(a,p,f)}};s.settings.formats.forEach(function(t){o&&"xls"===t?t="xlsm":!1,o||"xlsx"!==t?!1:t=null,t&&b[t](l,v)})}),e("button[data-fileblob]").off("click").on("click",function(){var t=e(this).data("fileblob"),n=t.data,o=t.fileName,r=t.mimeType,s=t.fileExtension;i.prototype.export2file(n,r,o,s)}),s};i.prototype={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"},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:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},csv:{defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/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 i.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}},i=0;i!=t.length;++i)for(var r=0;r!=t[i].length;++r){n.s.r>i&&(n.s.r=i),n.s.c>r&&(n.s.c=r),n.e.r<i&&(n.e.r=i),n.e.c<r&&(n.e.c=r);var s={v:t[i][r]};if(null!=s.v){var a=o.utils.encode_cell({c:r,r:i});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=o.SSF._table[14],s.v=this.dateNum(s.v)):s.t="s",e[a]=s}}return n.s.c<1e7&&(e["!ref"]=o.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,i,r){if(o&&r.startsWith(".xls")){var s=new this.Workbook,a=this.createSheet(t);s.SheetNames.push(i),s.Sheets[i]=a;var p={bookType:r.substr(1,3)+(r.substr(4)||"m"),bookSST:!1,type:"binary"},f=o.write(s,p);t=this.string2ArrayBuffer(f)}n(new Blob([t],{type:e+";"+this.charset}),i+r)},update:function(t){return new i(this.selectors,e.extend({},this.settings,t),!0)},reset:function(){return new i(this.selectors,settings,!0)},remove:function(){this.selectors.each(function(){e(this).find("caption:not(.head)").remove()})}},e.fn.tableExport=function(t,e){return new i(this,t,e)};for(var r in i.prototype)e.fn.tableExport[r]=i.prototype[r];t["default"]=t.TableExport=i}); | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","blobjs","file-saver","xlsx"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("blobjs"),require("file-saver"),require("xlsx")):e(t,t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this,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){var e=y.find("caption:not(.head)");e.length?e.append(t):y.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function n(e,n,o){var i="<button data-fileblob='"+e+"' class='"+a+p+o+"'>"+n+"</button>";t(i)}var y=e(this);o&&y.find("caption:not(.head)").remove();var m=y.find("tbody").find("tr"),m=s.settings.headings?m.add(y.find("thead>tr")):m,m=s.settings.footers?m.add(y.find("tfoot>tr")):m,g=s.settings.headings?y.find("thead>tr").length:0,b="id"===s.settings.fileName?y.attr("id")?y.attr("id"):r.prototype.defaultFileName:s.settings.fileName,h={xlsx:function(t,o){var i={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(i[t]=i[t]||{},i[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var r=1;r<o.getAttribute("rowspan");r++)i[t+r]=i[t+r]||{},i[t+r][n]=1;return i[t]&&i[t][n]?new Array(i[t][n]).concat(e(o).text()):e(o).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;n(a,p,f)},xlsm:function(t,o){var i={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(i[t]=i[t]||{},i[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var r=1;r<o.getAttribute("rowspan");r++)i[t+r]=i[t+r]||{},i[t+r][n]=1;return i[t]&&i[t][n]?new Array(i[t][n]).concat(e(o).text()):e(o).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;n(a,p,f)},xls:function(t,o){var i=r.prototype.xls.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){if(!~c.indexOf(t)&&!e(n).is(x))return e(n).is(d)?" ":e(n).text()}).get().join(i)}}).get().join(t),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;n(a,p,f)},csv:function(t,o){var i=r.prototype.csv.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){if(!~c.indexOf(t)&&!e(n).is(x))return e(n).is(d)?" ":'"'+e(n).text().replace(/"/g,'""')+'"'}).get().join(i)}}).get().join(t),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;n(a,p,f)},txt:function(t,o){var i=r.prototype.txt.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){if(!~c.indexOf(t)&&!e(n).is(x))return e(n).is(d)?" ":e(n).text()}).get().join(i)}}).get().join(t),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;n(a,p,f)}};s.settings.formats.forEach(function(t){!(!i||"xls"!==t)&&(t="xlsm"),!i&&"xlsx"===t&&(t=null),t&&h[t](l,b)})}),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={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"},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:"application/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&&s.startsWith(".xls")){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)},update:function(t){return new r(this.selectors,e.extend({},this.settings,t),(!0))},reset:function(){return new r(this.selectors,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];t["default"]=t.TableExport=r}); |
@@ -1,237 +0,236 @@ | ||
declare module 'tableexport' { | ||
/** | ||
* TableExport main plugin constructor | ||
* | ||
* @class TableExport | ||
* | ||
* @param selectors {jQuery} jQuery selector(s) | ||
* @param options {Object} TableExport configuration options | ||
* @param isUpdate {Boolean} | ||
* @constructor | ||
*/ | ||
export class TableExport { | ||
constructor(selectors: string|string[], options: Defaults, isUpdate: boolean); | ||
/** | ||
* TableExport main plugin constructor | ||
* | ||
* @class TableExport | ||
* | ||
* @param selectors {jQuery} jQuery selector(s) | ||
* @param options {Object} TableExport configuration options | ||
* @param isUpdate {Boolean} | ||
* @constructor | ||
* Default plugin options. | ||
* @memberof TableExport.prototype | ||
*/ | ||
export class TableExport { | ||
defaults: Defaults; | ||
constructor(selectors: string|string[], options: Defaults, isUpdate: boolean); | ||
/** | ||
* TableExport configuration options (user-defined w/ default fallback) | ||
*/ | ||
settings: any; | ||
/** | ||
* Default plugin options. | ||
* @memberof TableExport.prototype | ||
*/ | ||
defaults: Defaults; | ||
/** | ||
* jQuery selectors (tables) to apply the plugin to | ||
*/ | ||
selectors: any; | ||
/** | ||
* TableExport configuration options (user-defined w/ default fallback) | ||
*/ | ||
settings: any; | ||
/** | ||
* Character set (character encoding) of the HTML. | ||
* @memberof TableExport.prototype | ||
*/ | ||
charset: string; | ||
/** | ||
* jQuery selectors (tables) to apply the plugin to | ||
*/ | ||
selectors: any; | ||
/** | ||
* Filename fallback for exported files. | ||
* @memberof TableExport.prototype | ||
*/ | ||
defaultFileName: string; | ||
/** | ||
* Character set (character encoding) of the HTML. | ||
* @memberof TableExport.prototype | ||
*/ | ||
charset: string; | ||
/** | ||
* Class applied to each export button element. | ||
* @memberof TableExport.prototype | ||
*/ | ||
defaultButton: string; | ||
/** | ||
* Filename fallback for exported files. | ||
* @memberof TableExport.prototype | ||
*/ | ||
defaultFileName: string; | ||
/** | ||
* Bootstrap configuration classes ["base", "theme", "container"]. | ||
* @memberof TableExport.prototype | ||
*/ | ||
bootstrap: string[]; | ||
/** | ||
* Class applied to each export button element. | ||
* @memberof TableExport.prototype | ||
*/ | ||
defaultButton: string; | ||
/** | ||
* Row delimeter | ||
* @memberof TableExport.prototype | ||
*/ | ||
rowDel: string; | ||
/** | ||
* Bootstrap configuration classes ["base", "theme", "container"]. | ||
* @memberof TableExport.prototype | ||
*/ | ||
bootstrap: string[]; | ||
/** | ||
* HTML entity mapping for special characters. | ||
* @memberof TableExport.prototype | ||
*/ | ||
entityMap: Object; | ||
/** | ||
* Row delimeter | ||
* @memberof TableExport.prototype | ||
*/ | ||
rowDel: string; | ||
/** | ||
* XLSX (Open XML spreadsheet) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
xlsx: XLSX; | ||
/** | ||
* HTML entity mapping for special characters. | ||
* @memberof TableExport.prototype | ||
*/ | ||
entityMap: Object; | ||
/** | ||
* XLS (Binary spreadsheet) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
xls: XLS; | ||
/** | ||
* XLSX (Open XML spreadsheet) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
xlsx: XLSX; | ||
/** | ||
* CSV (Comma Separated Values) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
csv: CSV; | ||
/** | ||
* XLS (Binary spreadsheet) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
xls: XLS; | ||
/** | ||
* CSV (Comma Separated Values) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
csv: CSV; | ||
/** | ||
* TXT (Plain Text) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
txt: TXT; | ||
/** | ||
* Escapes special characters with HTML entities | ||
* @memberof TableExport.prototype | ||
* @param string {String} | ||
* @returns {String} escaped string | ||
*/ | ||
escapeHtml: (string: string) => string; | ||
/** | ||
* Formats datetimes for compatibility with Excel | ||
* @memberof TableExport.prototype | ||
* @param v {Number} | ||
* @param date1904 {Date} | ||
* @returns {Number} epoch time | ||
*/ | ||
dateNum: (v: number, date1904: Date) => number; | ||
/** | ||
* Creates an Excel spreadsheet from a data string | ||
* @memberof TableExport.prototype | ||
* @param data {String} | ||
* @returns {Number} epoch time | ||
*/ | ||
createSheet: (data: string) => number; | ||
/** | ||
* Converts a string to an arraybuffer | ||
* @memberof TableExport.prototype | ||
* @returns {ArrayBuffer} | ||
*/ | ||
string2ArrayBuffer: (s: string) => ArrayBuffer; | ||
/** | ||
* Exports and downloads the file | ||
* @memberof TableExport.prototype | ||
* @param data {String} | ||
* @param mime {String} mime type | ||
* @param name {String} filename | ||
* @param extension {String} file extension | ||
*/ | ||
export2file: (data: string, mime: string, name: string, extension: String) => void; | ||
/** | ||
* Updates the plugin instance with new/updated options | ||
* @param options {Object} TableExport configuration options | ||
* @returns {TableExport} updated TableExport instance | ||
*/ | ||
update: (options: any) => TableExport; | ||
/** | ||
* Reset the plugin instance to its original state | ||
* @returns {TableExport} original TableExport instance | ||
*/ | ||
reset: () => TableExport; | ||
/** | ||
* Remove the instance (i.e. caption containing the export buttons) | ||
*/ | ||
remove: () => void; | ||
} | ||
/** | ||
* Excel Workbook constructor | ||
* TXT (Plain Text) file extension configuration | ||
* @memberof TableExport.prototype | ||
* @constructor | ||
*/ | ||
export interface Workbook { | ||
SheetNames: any[]; | ||
Sheets: Object; | ||
} | ||
txt: TXT; | ||
/** | ||
* Default plugin options. | ||
* Escapes special characters with HTML entities | ||
* @memberof TableExport.prototype | ||
* @param string {String} | ||
* @returns {String} escaped string | ||
*/ | ||
export interface Defaults { | ||
headings: boolean; | ||
footers: boolean; | ||
formats: string[]; | ||
fileName: string; | ||
bootstrap: boolean; | ||
position: string; | ||
ignoreRows: number[]; | ||
ignoreCols: number[]; | ||
ignoreCSS: string; | ||
emptyCSS: string; | ||
} | ||
escapeHtml: (string: string) => string; | ||
/** | ||
* XLSX (Open XML spreadsheet) file extension configuration | ||
* Formats datetimes for compatibility with Excel | ||
* @memberof TableExport.prototype | ||
* @param v {Number} | ||
* @param date1904 {Date} | ||
* @returns {Number} epoch time | ||
*/ | ||
export interface XLSX { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
fileExtension: string; | ||
} | ||
dateNum: (v: number, date1904: Date) => number; | ||
/** | ||
* XLS (Binary spreadsheet) file extension configuration | ||
* Creates an Excel spreadsheet from a data string | ||
* @memberof TableExport.prototype | ||
* @param data {String} | ||
* @returns {Number} epoch time | ||
*/ | ||
export interface XLS { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
fileExtension: string; | ||
} | ||
createSheet: (data: string) => number; | ||
/** | ||
* CSV (Comma Separated Values) file extension configuration | ||
* Converts a string to an arraybuffer | ||
* @memberof TableExport.prototype | ||
* @returns {ArrayBuffer} | ||
*/ | ||
export interface CSV { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
fileExtension: string; | ||
} | ||
string2ArrayBuffer: (s: string) => ArrayBuffer; | ||
/** | ||
* TXT (Plain Text) file extension configuration | ||
* Exports and downloads the file | ||
* @memberof TableExport.prototype | ||
* @param data {String} | ||
* @param mime {String} mime type | ||
* @param name {String} filename | ||
* @param extension {String} file extension | ||
*/ | ||
export interface TXT { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
fileExtension: string; | ||
} | ||
export2file: (data: string, mime: string, name: string, extension: String) => void; | ||
interface JQuery { | ||
/** | ||
* Updates the plugin instance with new/updated options | ||
* @param options {Object} TableExport configuration options | ||
* @returns {TableExport} updated TableExport instance | ||
*/ | ||
update: (options: any) => TableExport; | ||
/** | ||
* TableExport main plugin constructor | ||
* | ||
* @param options {Object} TableExport configuration options | ||
* @param isUpdate {Boolean} | ||
*/ | ||
tableexport(options: Defaults, isUpdate: boolean): TableExport; | ||
} | ||
/** | ||
* Reset the plugin instance to its original state | ||
* @returns {TableExport} original TableExport instance | ||
*/ | ||
reset: () => TableExport; | ||
/** | ||
* Remove the instance (i.e. caption containing the export buttons) | ||
*/ | ||
remove: () => void; | ||
} | ||
/** | ||
* Excel Workbook constructor | ||
* @memberof TableExport.prototype | ||
* @constructor | ||
*/ | ||
export interface Workbook { | ||
SheetNames: any[]; | ||
Sheets: Object; | ||
} | ||
/** | ||
* Default plugin options. | ||
* @memberof TableExport.prototype | ||
*/ | ||
export interface Defaults { | ||
headings: boolean; | ||
footers: boolean; | ||
formats: string[]; | ||
fileName: string; | ||
bootstrap: boolean; | ||
position: string; | ||
ignoreRows: number[]; | ||
ignoreCols: number[]; | ||
ignoreCSS: string; | ||
emptyCSS: string; | ||
} | ||
/** | ||
* XLSX (Open XML spreadsheet) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
export interface XLSX { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
} | ||
/** | ||
* XLS (Binary spreadsheet) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
export interface XLS { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
} | ||
/** | ||
* CSV (Comma Separated Values) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
export interface CSV { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
} | ||
/** | ||
* TXT (Plain Text) file extension configuration | ||
* @memberof TableExport.prototype | ||
*/ | ||
export interface TXT { | ||
defaultClass: string; | ||
buttonContent: string; | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
} | ||
interface JQuery { | ||
/** | ||
* TableExport main plugin constructor | ||
* | ||
* @param options {Object} TableExport configuration options | ||
* @param isUpdate {Boolean} | ||
*/ | ||
tableexport(options: Defaults, isUpdate: boolean): TableExport; | ||
} |
{ | ||
"name": "tableexport", | ||
"version": "3.2.15", | ||
"version": "3.3.0", | ||
"authors": [ | ||
@@ -37,3 +37,3 @@ "clarketm <travis.m.clarke@gmail.com>" | ||
"dependencies": { | ||
"Blob": "*", | ||
"blobjs": "^1.0.0", | ||
"bootstrap": "~3.3.5", | ||
@@ -40,0 +40,0 @@ "file-saver": "^1.3.2", |
@@ -59,7 +59,7 @@ [![Build Status](https://travis-ci.org/clarketm/TableExport.svg?branch=master)](https://travis-ci.org/clarketm/TableExport) | ||
To support older browsers ( **Firefox** < 20, **Opera** < 15, **Safari** < 6 ) also include [Blob.js](https://github.com/eligrey/Blob.js/) before the [FileSaver.js](https://github.com/eligrey/FileSaver.js/) script. | ||
To support older browsers ( **Firefox** < 20, **Opera** < 15 ) or **Safari** also include [Blob.js](https://github.com/clarketm/Blob.js/) before the [FileSaver.js](https://github.com/eligrey/FileSaver.js/) script. | ||
```html | ||
<script src="xlsx-core.js"></script> | ||
<script src="blob.js"></script> | ||
<script src="Blob.js"></script> | ||
<script src="filesaver.js"></script> | ||
@@ -208,10 +208,10 @@ ... | ||
| | Chrome | Firefox | IE * | Opera | Safari | | ||
| | Chrome | Firefox | IE * | Opera | Safari * | | ||
| :------: | :------: | :-------: | :---: | :-----: | :------: | | ||
| __Android__ * | ✓ | ✓ | - | ✓ | - | | ||
| __iOS__ * | ✓ | - | - | - | ✓ | | ||
| __Android__ | ✓ | ✓ | - | ✓ | - | | ||
| __iOS__ | ✓ | - | - | - | ✓ | | ||
| **Mac OSX**| ✓ | ✓ | - | ✓ | ✓ | | ||
| **Windows** | ✓ | ✓ | ✓ | ✓ | ✓ | | ||
*requires third-party dependencies | ||
*requires third-party dependencies ([Blob.js](https://github.com/clarketm/Blob.js/)) | ||
@@ -218,0 +218,0 @@ ### Live Demo |
/*! | ||
* TableExport.js v3.2.15 (https://www.travismclarke.com) | ||
* TableExport.js 3.3.0 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
@@ -10,11 +10,11 @@ * Licensed under the MIT license | ||
// AMD. Register as an anonymous module. | ||
define(['exports', 'jquery', 'file-saver', 'xlsx'], factory); | ||
define(['exports', 'jquery', 'blobjs', 'file-saver', 'xlsx'], factory); | ||
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { | ||
// CommonJS | ||
factory(exports, require('jquery'), require('file-saver'), require('xlsx')); | ||
factory(exports, require('jquery'), require('blobjs'), require('file-saver'), require('xlsx')); | ||
} else { | ||
// Browser globals | ||
factory(root, root.jQuery, root.saveAs, root.XLSX); | ||
factory(root, root.jQuery, root.Blob, root.saveAs, root.XLSX); | ||
} | ||
}(this, function (exports, $, saveAs, XLSX) { | ||
}(this, function (exports, $, Blob, saveAs, XLSX) { | ||
'use strict'; | ||
@@ -191,3 +191,3 @@ /** | ||
} | ||
return $(val).text(); | ||
return '"' + $(val).text().replace(/"/g, '""') + '"'; | ||
}).get().join(colD); | ||
@@ -194,0 +194,0 @@ }).get().join(rdel), |
/*! | ||
* TableExport.js v3.2.15 (https://www.travismclarke.com) | ||
* TableExport.js 3.3.0 (https://www.travismclarke.com) | ||
* Copyright 2016 Travis Clarke | ||
* Licensed under the MIT license | ||
*/ | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","file-saver","xlsx"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("file-saver"),require("xlsx")):e(t,t.jQuery,t.saveAs,t.XLSX)}(this,function(t,e,n,o){"use strict";var i=function(t,n,r){var s=this;s.settings=r?n:e.extend({},i.prototype.defaults,n),s.selectors=t;var a,p,f,l=i.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=i.prototype.bootstrap[0]+" ",p=i.prototype.bootstrap[1]+" ",f=i.prototype.bootstrap[2]+" "):(a=i.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function t(t){var e=y.find("caption:not(.head)");e.length?e.append(t):y.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function n(e,n,o){var i="<button data-fileblob='"+e+"' class='"+a+p+o+"'>"+n+"</button>";t(i)}var y=e(this);r&&y.find("caption:not(.head)").remove();var m=y.find("tbody").find("tr"),m=s.settings.headings?m.add(y.find("thead>tr")):m,m=s.settings.footers?m.add(y.find("tfoot>tr")):m,g=s.settings.headings?y.find("thead>tr").length:0,v="id"===s.settings.fileName?y.attr("id")?y.attr("id"):i.prototype.defaultFileName:s.settings.fileName,b={xlsx:function(t,o){var r={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(r[t]=r[t]||{},r[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var i=1;i<o.getAttribute("rowspan");i++)r[t+i]=r[t+i]||{},r[t+i][n]=1;return r[t]&&r[t][n]?new Array(r[t][n]).concat(e(o).text()):e(o).text()}}).get()]}}).get(),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.xlsx.mimeType,fileExtension:i.prototype.xlsx.fileExtension})),p=i.prototype.xlsx.buttonContent,f=i.prototype.xlsx.defaultClass;n(a,p,f)},xlsm:function(t,o){var r={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(r[t]=r[t]||{},r[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var i=1;i<o.getAttribute("rowspan");i++)r[t+i]=r[t+i]||{},r[t+i][n]=1;return r[t]&&r[t][n]?new Array(r[t][n]).concat(e(o).text()):e(o).text()}}).get()]}}).get(),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.xls.mimeType,fileExtension:i.prototype.xls.fileExtension})),p=i.prototype.xls.buttonContent,f=i.prototype.xls.defaultClass;n(a,p,f)},xls:function(t,o){var r=i.prototype.xls.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){return~c.indexOf(t)||e(n).is(x)?void 0:e(n).is(d)?" ":e(n).text()}).get().join(r)}}).get().join(t),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.xls.mimeType,fileExtension:i.prototype.xls.fileExtension})),p=i.prototype.xls.buttonContent,f=i.prototype.xls.defaultClass;n(a,p,f)},csv:function(t,o){var r=i.prototype.csv.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){return~c.indexOf(t)||e(n).is(x)?void 0:e(n).is(d)?" ":e(n).text()}).get().join(r)}}).get().join(t),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.csv.mimeType,fileExtension:i.prototype.csv.fileExtension})),p=i.prototype.csv.buttonContent,f=i.prototype.csv.defaultClass;n(a,p,f)},txt:function(t,o){var r=i.prototype.txt.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){return~c.indexOf(t)||e(n).is(x)?void 0:e(n).is(d)?" ":e(n).text()}).get().join(r)}}).get().join(t),a=i.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:i.prototype.txt.mimeType,fileExtension:i.prototype.txt.fileExtension})),p=i.prototype.txt.buttonContent,f=i.prototype.txt.defaultClass;n(a,p,f)}};s.settings.formats.forEach(function(t){o&&"xls"===t?t="xlsm":!1,o||"xlsx"!==t?!1:t=null,t&&b[t](l,v)})}),e("button[data-fileblob]").off("click").on("click",function(){var t=e(this).data("fileblob"),n=t.data,o=t.fileName,r=t.mimeType,s=t.fileExtension;i.prototype.export2file(n,r,o,s)}),s};i.prototype={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"},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:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},csv:{defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/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 i.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}},i=0;i!=t.length;++i)for(var r=0;r!=t[i].length;++r){n.s.r>i&&(n.s.r=i),n.s.c>r&&(n.s.c=r),n.e.r<i&&(n.e.r=i),n.e.c<r&&(n.e.c=r);var s={v:t[i][r]};if(null!=s.v){var a=o.utils.encode_cell({c:r,r:i});"number"==typeof s.v?s.t="n":"boolean"==typeof s.v?s.t="b":s.v instanceof Date?(s.t="n",s.z=o.SSF._table[14],s.v=this.dateNum(s.v)):s.t="s",e[a]=s}}return n.s.c<1e7&&(e["!ref"]=o.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,i,r){if(o&&r.startsWith(".xls")){var s=new this.Workbook,a=this.createSheet(t);s.SheetNames.push(i),s.Sheets[i]=a;var p={bookType:r.substr(1,3)+(r.substr(4)||"m"),bookSST:!1,type:"binary"},f=o.write(s,p);t=this.string2ArrayBuffer(f)}n(new Blob([t],{type:e+";"+this.charset}),i+r)},update:function(t){return new i(this.selectors,e.extend({},this.settings,t),!0)},reset:function(){return new i(this.selectors,settings,!0)},remove:function(){this.selectors.each(function(){e(this).find("caption:not(.head)").remove()})}},e.fn.tableExport=function(t,e){return new i(this,t,e)};for(var r in i.prototype)e.fn.tableExport[r]=i.prototype[r];t["default"]=t.TableExport=i}); | ||
!function(t,e){"function"==typeof define&&define.amd?define(["exports","jquery","blobjs","file-saver","xlsx"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?e(exports,require("jquery"),require("blobjs"),require("file-saver"),require("xlsx")):e(t,t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this,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){var e=y.find("caption:not(.head)");e.length?e.append(t):y.prepend('<caption class="'+f+s.settings.position+'">'+t+"</caption>")}function n(e,n,o){var i="<button data-fileblob='"+e+"' class='"+a+p+o+"'>"+n+"</button>";t(i)}var y=e(this);o&&y.find("caption:not(.head)").remove();var m=y.find("tbody").find("tr"),m=s.settings.headings?m.add(y.find("thead>tr")):m,m=s.settings.footers?m.add(y.find("tfoot>tr")):m,g=s.settings.headings?y.find("thead>tr").length:0,b="id"===s.settings.fileName?y.attr("id")?y.attr("id"):r.prototype.defaultFileName:s.settings.fileName,h={xlsx:function(t,o){var i={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(i[t]=i[t]||{},i[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var r=1;r<o.getAttribute("rowspan");r++)i[t+r]=i[t+r]||{},i[t+r][n]=1;return i[t]&&i[t][n]?new Array(i[t][n]).concat(e(o).text()):e(o).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;n(a,p,f)},xlsm:function(t,o){var i={},s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!e(o).is(x)){if(e(o).is(d))return" ";if(o.hasAttribute("colspan")&&(i[t]=i[t]||{},i[t][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var r=1;r<o.getAttribute("rowspan");r++)i[t+r]=i[t+r]||{},i[t+r][n]=1;return i[t]&&i[t][n]?new Array(i[t][n]).concat(e(o).text()):e(o).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;n(a,p,f)},xls:function(t,o){var i=r.prototype.xls.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){if(!~c.indexOf(t)&&!e(n).is(x))return e(n).is(d)?" ":e(n).text()}).get().join(i)}}).get().join(t),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;n(a,p,f)},csv:function(t,o){var i=r.prototype.csv.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){if(!~c.indexOf(t)&&!e(n).is(x))return e(n).is(d)?" ":'"'+e(n).text().replace(/"/g,'""')+'"'}).get().join(i)}}).get().join(t),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;n(a,p,f)},txt:function(t,o){var i=r.prototype.txt.separator,s=m.map(function(t,n){if(!~u.indexOf(t-g)&&!e(n).is(x)){var o=e(n).find("th, td");return o.map(function(t,n){if(!~c.indexOf(t)&&!e(n).is(x))return e(n).is(d)?" ":e(n).text()}).get().join(i)}}).get().join(t),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;n(a,p,f)}};s.settings.formats.forEach(function(t){!(!i||"xls"!==t)&&(t="xlsm"),!i&&"xlsx"===t&&(t=null),t&&h[t](l,b)})}),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={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"},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:"application/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&&s.startsWith(".xls")){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)},update:function(t){return new r(this.selectors,e.extend({},this.settings,t),(!0))},reset:function(){return new r(this.selectors,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];t["default"]=t.TableExport=r}); |
@@ -187,2 +187,3 @@ /** | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
@@ -199,2 +200,3 @@ } | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
@@ -211,2 +213,3 @@ } | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
@@ -223,2 +226,3 @@ } | ||
mimeType: string; | ||
separator: string; | ||
fileExtension: string; | ||
@@ -225,0 +229,0 @@ } |
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
51861
0
7494628
166
+ Addedblobjs@^1.0.0
+ Addedblobjs@1.1.1(transitive)
- RemovedBlob@*
- RemovedBlob@0.10.0(transitive)