From 21a0bba84b16b4718d8e98b54af4c70efefb88b2 Mon Sep 17 00:00:00 2001 From: Travis Clarke Date: Wed, 17 Aug 2016 18:52:00 -0700 Subject: [PATCH] v3.2.8 - added basic colspan/rowspan support --- bower.json | 2 +- dist/css/tableexport.css | 2 +- dist/css/tableexport.min.css | 2 +- dist/js/tableexport.js | 47 +++++++++++++++++++++++------- dist/js/tableexport.min.js | 4 +-- package.json | 2 +- src/stable/css/tableexport.css | 2 +- src/stable/css/tableexport.min.css | 2 +- src/stable/js/tableexport.js | 47 +++++++++++++++++++++++------- src/stable/js/tableexport.min.js | 4 +-- 10 files changed, 84 insertions(+), 30 deletions(-) diff --git a/bower.json b/bower.json index 06aa250..ab4eb26 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tableexport.js", - "version": "3.2.7", + "version": "3.2.8", "authors": [ "clarketm " ], diff --git a/dist/css/tableexport.css b/dist/css/tableexport.css index 2a3e269..d8e9221 100644 --- a/dist/css/tableexport.css +++ b/dist/css/tableexport.css @@ -1,5 +1,5 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */ diff --git a/dist/css/tableexport.min.css b/dist/css/tableexport.min.css index 25279d7..051e508 100644 --- a/dist/css/tableexport.min.css +++ b/dist/css/tableexport.min.css @@ -1,5 +1,5 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */.top{caption-side:top}.bottom{caption-side:bottom}.button-default,.button-default:active,.button-default:focus,.button-default:hover{text-decoration:none}.button-default{font:700 12px sans-serif;color:#222;cursor:pointer;padding:5px;margin:5px}.button-default.csv:before,.button-default.txt:before,.button-default.xls:before,.button-default.xlsx:before{content:none}.csv:before,.txt:before,.xls:before,.xlsx:before{content:""}.csv,.txt,.xls,.xlsx{margin:4px 0}.csv:before,.txt:before,.xls:before,.xlsx:before{margin-right:10px;padding:11px 15px 12px;box-shadow:1px 1px 2px rgba(0,0,0,.2)}.xlsx:before{background:url(../img/xlsx.svg) center no-repeat #006400}.xls:before{background:url(../img/xls.svg) center no-repeat green}.csv:before{background:url(../img/csv.svg) center no-repeat #00f}.txt:before{background:url(../img/txt.svg) center no-repeat purple} \ No newline at end of file diff --git a/dist/js/tableexport.js b/dist/js/tableexport.js index 0e73a08..a833b49 100644 --- a/dist/js/tableexport.js +++ b/dist/js/tableexport.js @@ -1,5 +1,5 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */ @@ -69,15 +69,29 @@ fileName = self.settings.fileName === "id" ? ($el.attr('id') ? $el.attr('id') : TableExport.prototype.defaultFileName) : self.settings.fileName, exporters = { xlsx: function (rDel, name) { - var dataURL = $rows.map(function (i, val) { - if (!!~ignoreRows.indexOf(i - thAdj) || $(val).is(ignoreCSS)) { + var rcMap = {}, + dataURL = $rows.map(function (ir, val) { + if (!!~ignoreRows.indexOf(ir - thAdj) || $(val).is(ignoreCSS)) { return; } var $cols = $(val).find('th, td'); - return [$cols.map(function (i, val) { - if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { + return [$cols.map(function (ic, val) { + if (!!~ignoreCols.indexOf(ic) || $(val).is(ignoreCSS)) { return; } + if (rcMap[ir] && rcMap[ir][ic]) { + return new Array(rcMap[ir][ic]).concat($(val).text()); + } + if (val.hasAttribute('colspan')) { + rcMap[ir] = rcMap[ir] || {}; + rcMap[ir][ic+1] = val.getAttribute('colspan') - 1 + } + if (val.hasAttribute('rowspan')) { + for(var i = 1; i < val.getAttribute('rowspan'); i++) { + rcMap[ir+i] = rcMap[ir+i] || {}; + rcMap[ir+i][ic] = 1 + } + } return $(val).text(); }).get()]; }).get(), @@ -93,15 +107,29 @@ createObjButton(dataObject, myContent, myClass); }, xlsm: function (rDel, name) { - var dataURL = $rows.map(function (i, val) { - if (!!~ignoreRows.indexOf(i - thAdj) || $(val).is(ignoreCSS)) { + var rcMap = {}, + dataURL = $rows.map(function (ir, val) { + if (!!~ignoreRows.indexOf(ir - thAdj) || $(val).is(ignoreCSS)) { return; } var $cols = $(val).find('th, td'); - return [$cols.map(function (i, val) { - if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { + return [$cols.map(function (ic, val) { + if (!!~ignoreCols.indexOf(ic) || $(val).is(ignoreCSS)) { return; } + if (rcMap[ir] && rcMap[ir][ic]) { + return new Array(rcMap[ir][ic]).concat($(val).text()); + } + if (val.hasAttribute('colspan')) { + rcMap[ir] = rcMap[ir] || {}; + rcMap[ir][ic+1] = val.getAttribute('colspan') - 1 + } + if (val.hasAttribute('rowspan')) { + for(var i = 1; i < val.getAttribute('rowspan'); i++) { + rcMap[ir+i] = rcMap[ir+i] || {}; + rcMap[ir+i][ic] = 1 + } + } return $(val).text(); }).get()]; }).get(), @@ -198,7 +226,6 @@ XLSX && key === 'xls' ? key ='xlsm' : false; !XLSX && key === 'xlsx' ? key = null : false; key && exporters[key](rowD, fileName); - console.log(key); } ); diff --git a/dist/js/tableexport.min.js b/dist/js/tableexport.min.js index d7ef779..7371e58 100644 --- a/dist/js/tableexport.min.js +++ b/dist/js/tableexport.min.js @@ -1,6 +1,6 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */ -!function(t,e){"function"==typeof define&&define.amd?define(["jquery","file-saver","xlsx"],e):"object"==typeof exports?module.exports=function(t,o){return void 0===o&&(o="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(o,require("file-saver"),require("xlsx"))}:t.TableExport=e(t.jQuery,t.saveAs,t.XLSX)}(this,function(t,e,o){"use strict";var n=function(e,i,r){var s=this;s.settings=r?i:t.extend({},n.prototype.defaults,i),s.selectors=e;var a,p,f,l=n.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;return s.settings.bootstrap?(a=n.prototype.bootstrap[0]+" ",p=n.prototype.bootstrap[1]+" ",f=n.prototype.bootstrap[2]+" "):(a=n.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function e(t){var e=d.find("caption:not(.head)");e.length?e.append(t):d.prepend(''+t+"")}function i(t,o,n){var i="";e(i)}var d=t(this);r&&d.find("caption:not(.head)").remove();var y=d.find("tbody").find("tr"),y=s.settings.headings?y.add(d.find("thead>tr")):y,y=s.settings.footers?y.add(d.find("tfoot>tr")):y,m=s.settings.headings?d.find("thead>tr").length:0,g="id"===s.settings.fileName?d.attr("id")?d.attr("id"):n.prototype.defaultFileName:s.settings.fileName,v={xlsx:function(e,o){var r=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return[n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get()]}}).get(),s=n.prototype.escapeHtml(JSON.stringify({data:r,fileName:o,mimeType:n.prototype.xlsx.mimeType,fileExtension:n.prototype.xlsx.fileExtension})),a=n.prototype.xlsx.buttonContent,p=n.prototype.xlsx.defaultClass;i(s,a,p)},xlsm:function(e,o){var r=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return[n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get()]}}).get(),s=n.prototype.escapeHtml(JSON.stringify({data:r,fileName:o,mimeType:n.prototype.xls.mimeType,fileExtension:n.prototype.xls.fileExtension})),a=n.prototype.xls.buttonContent,p=n.prototype.xls.defaultClass;i(s,a,p)},xls:function(e,o){var r=n.prototype.xls.separator,s=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get().join(r)}}).get().join(e),a=n.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:n.prototype.xls.mimeType,fileExtension:n.prototype.xls.fileExtension})),p=n.prototype.xls.buttonContent,f=n.prototype.xls.defaultClass;i(a,p,f)},csv:function(e,o){var r=n.prototype.csv.separator,s=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get().join(r)}}).get().join(e),a=n.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:n.prototype.csv.mimeType,fileExtension:n.prototype.csv.fileExtension})),p=n.prototype.csv.buttonContent,f=n.prototype.csv.defaultClass;i(a,p,f)},txt:function(e,o){var r=n.prototype.txt.separator,s=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get().join(r)}}).get().join(e),a=n.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:n.prototype.txt.mimeType,fileExtension:n.prototype.txt.fileExtension})),p=n.prototype.txt.buttonContent,f=n.prototype.txt.defaultClass;i(a,p,f)}};s.settings.formats.forEach(function(t){o&&"xls"===t?t="xlsm":!1,o||"xlsx"!==t?!1:t=null,t&&v[t](l,g),console.log(t)})}),t("button[data-fileblob]").off("click").on("click",function(){var e=t(this).data("fileblob"),o=e.data,i=e.fileName,r=e.mimeType,s=e.fileExtension;n.prototype.export2file(o,r,i,s)}),s};n.prototype={defaults:{headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore"},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 n.prototype.entityMap[t]})},dateNum:function(t,e){e&&(t+=1462);var o=Date.parse(t);return(o-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'+t+"")}function i(t,n,o){var i="";e(i)}var d=t(this);r&&d.find("caption:not(.head)").remove();var y=d.find("tbody").find("tr"),y=s.settings.headings?y.add(d.find("thead>tr")):y,y=s.settings.footers?y.add(d.find("tfoot>tr")):y,m=s.settings.headings?d.find("thead>tr").length:0,g="id"===s.settings.fileName?d.attr("id")?d.attr("id"):o.prototype.defaultFileName:s.settings.fileName,v={xlsx:function(e,n){var r={},s=y.map(function(e,n){if(!~u.indexOf(e-m)&&!t(n).is(x)){var o=t(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!t(o).is(x)){if(r[e]&&r[e][n])return new Array(r[e][n]).concat(t(o).text());if(o.hasAttribute("colspan")&&(r[e]=r[e]||{},r[e][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var i=1;i":">","'":"'","/":"/"},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 o.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={},o={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){o.s.r>i&&(o.s.r=i),o.s.c>r&&(o.s.c=r),o.e.r" ], diff --git a/src/stable/css/tableexport.css b/src/stable/css/tableexport.css index 2a3e269..d8e9221 100644 --- a/src/stable/css/tableexport.css +++ b/src/stable/css/tableexport.css @@ -1,5 +1,5 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */ diff --git a/src/stable/css/tableexport.min.css b/src/stable/css/tableexport.min.css index 25279d7..051e508 100644 --- a/src/stable/css/tableexport.min.css +++ b/src/stable/css/tableexport.min.css @@ -1,5 +1,5 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */.top{caption-side:top}.bottom{caption-side:bottom}.button-default,.button-default:active,.button-default:focus,.button-default:hover{text-decoration:none}.button-default{font:700 12px sans-serif;color:#222;cursor:pointer;padding:5px;margin:5px}.button-default.csv:before,.button-default.txt:before,.button-default.xls:before,.button-default.xlsx:before{content:none}.csv:before,.txt:before,.xls:before,.xlsx:before{content:""}.csv,.txt,.xls,.xlsx{margin:4px 0}.csv:before,.txt:before,.xls:before,.xlsx:before{margin-right:10px;padding:11px 15px 12px;box-shadow:1px 1px 2px rgba(0,0,0,.2)}.xlsx:before{background:url(../img/xlsx.svg) center no-repeat #006400}.xls:before{background:url(../img/xls.svg) center no-repeat green}.csv:before{background:url(../img/csv.svg) center no-repeat #00f}.txt:before{background:url(../img/txt.svg) center no-repeat purple} \ No newline at end of file diff --git a/src/stable/js/tableexport.js b/src/stable/js/tableexport.js index 0e73a08..a833b49 100644 --- a/src/stable/js/tableexport.js +++ b/src/stable/js/tableexport.js @@ -1,5 +1,5 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */ @@ -69,15 +69,29 @@ fileName = self.settings.fileName === "id" ? ($el.attr('id') ? $el.attr('id') : TableExport.prototype.defaultFileName) : self.settings.fileName, exporters = { xlsx: function (rDel, name) { - var dataURL = $rows.map(function (i, val) { - if (!!~ignoreRows.indexOf(i - thAdj) || $(val).is(ignoreCSS)) { + var rcMap = {}, + dataURL = $rows.map(function (ir, val) { + if (!!~ignoreRows.indexOf(ir - thAdj) || $(val).is(ignoreCSS)) { return; } var $cols = $(val).find('th, td'); - return [$cols.map(function (i, val) { - if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { + return [$cols.map(function (ic, val) { + if (!!~ignoreCols.indexOf(ic) || $(val).is(ignoreCSS)) { return; } + if (rcMap[ir] && rcMap[ir][ic]) { + return new Array(rcMap[ir][ic]).concat($(val).text()); + } + if (val.hasAttribute('colspan')) { + rcMap[ir] = rcMap[ir] || {}; + rcMap[ir][ic+1] = val.getAttribute('colspan') - 1 + } + if (val.hasAttribute('rowspan')) { + for(var i = 1; i < val.getAttribute('rowspan'); i++) { + rcMap[ir+i] = rcMap[ir+i] || {}; + rcMap[ir+i][ic] = 1 + } + } return $(val).text(); }).get()]; }).get(), @@ -93,15 +107,29 @@ createObjButton(dataObject, myContent, myClass); }, xlsm: function (rDel, name) { - var dataURL = $rows.map(function (i, val) { - if (!!~ignoreRows.indexOf(i - thAdj) || $(val).is(ignoreCSS)) { + var rcMap = {}, + dataURL = $rows.map(function (ir, val) { + if (!!~ignoreRows.indexOf(ir - thAdj) || $(val).is(ignoreCSS)) { return; } var $cols = $(val).find('th, td'); - return [$cols.map(function (i, val) { - if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { + return [$cols.map(function (ic, val) { + if (!!~ignoreCols.indexOf(ic) || $(val).is(ignoreCSS)) { return; } + if (rcMap[ir] && rcMap[ir][ic]) { + return new Array(rcMap[ir][ic]).concat($(val).text()); + } + if (val.hasAttribute('colspan')) { + rcMap[ir] = rcMap[ir] || {}; + rcMap[ir][ic+1] = val.getAttribute('colspan') - 1 + } + if (val.hasAttribute('rowspan')) { + for(var i = 1; i < val.getAttribute('rowspan'); i++) { + rcMap[ir+i] = rcMap[ir+i] || {}; + rcMap[ir+i][ic] = 1 + } + } return $(val).text(); }).get()]; }).get(), @@ -198,7 +226,6 @@ XLSX && key === 'xls' ? key ='xlsm' : false; !XLSX && key === 'xlsx' ? key = null : false; key && exporters[key](rowD, fileName); - console.log(key); } ); diff --git a/src/stable/js/tableexport.min.js b/src/stable/js/tableexport.min.js index d7ef779..7371e58 100644 --- a/src/stable/js/tableexport.min.js +++ b/src/stable/js/tableexport.min.js @@ -1,6 +1,6 @@ /*! - * TableExport.js v3.2.7 (https://www.travismclarke.com) + * TableExport.js v3.2.8 (https://www.travismclarke.com) * Copyright 2016 Travis Clarke * Licensed under the MIT license */ -!function(t,e){"function"==typeof define&&define.amd?define(["jquery","file-saver","xlsx"],e):"object"==typeof exports?module.exports=function(t,o){return void 0===o&&(o="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(o,require("file-saver"),require("xlsx"))}:t.TableExport=e(t.jQuery,t.saveAs,t.XLSX)}(this,function(t,e,o){"use strict";var n=function(e,i,r){var s=this;s.settings=r?i:t.extend({},n.prototype.defaults,i),s.selectors=e;var a,p,f,l=n.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;return s.settings.bootstrap?(a=n.prototype.bootstrap[0]+" ",p=n.prototype.bootstrap[1]+" ",f=n.prototype.bootstrap[2]+" "):(a=n.prototype.defaultButton+" ",p=f=""),s.selectors.each(function(){function e(t){var e=d.find("caption:not(.head)");e.length?e.append(t):d.prepend(''+t+"")}function i(t,o,n){var i="";e(i)}var d=t(this);r&&d.find("caption:not(.head)").remove();var y=d.find("tbody").find("tr"),y=s.settings.headings?y.add(d.find("thead>tr")):y,y=s.settings.footers?y.add(d.find("tfoot>tr")):y,m=s.settings.headings?d.find("thead>tr").length:0,g="id"===s.settings.fileName?d.attr("id")?d.attr("id"):n.prototype.defaultFileName:s.settings.fileName,v={xlsx:function(e,o){var r=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return[n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get()]}}).get(),s=n.prototype.escapeHtml(JSON.stringify({data:r,fileName:o,mimeType:n.prototype.xlsx.mimeType,fileExtension:n.prototype.xlsx.fileExtension})),a=n.prototype.xlsx.buttonContent,p=n.prototype.xlsx.defaultClass;i(s,a,p)},xlsm:function(e,o){var r=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return[n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get()]}}).get(),s=n.prototype.escapeHtml(JSON.stringify({data:r,fileName:o,mimeType:n.prototype.xls.mimeType,fileExtension:n.prototype.xls.fileExtension})),a=n.prototype.xls.buttonContent,p=n.prototype.xls.defaultClass;i(s,a,p)},xls:function(e,o){var r=n.prototype.xls.separator,s=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get().join(r)}}).get().join(e),a=n.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:n.prototype.xls.mimeType,fileExtension:n.prototype.xls.fileExtension})),p=n.prototype.xls.buttonContent,f=n.prototype.xls.defaultClass;i(a,p,f)},csv:function(e,o){var r=n.prototype.csv.separator,s=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get().join(r)}}).get().join(e),a=n.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:n.prototype.csv.mimeType,fileExtension:n.prototype.csv.fileExtension})),p=n.prototype.csv.buttonContent,f=n.prototype.csv.defaultClass;i(a,p,f)},txt:function(e,o){var r=n.prototype.txt.separator,s=y.map(function(e,o){if(!~u.indexOf(e-m)&&!t(o).is(x)){var n=t(o).find("th, td");return n.map(function(e,o){return~c.indexOf(e)||t(o).is(x)?void 0:t(o).text()}).get().join(r)}}).get().join(e),a=n.prototype.escapeHtml(JSON.stringify({data:s,fileName:o,mimeType:n.prototype.txt.mimeType,fileExtension:n.prototype.txt.fileExtension})),p=n.prototype.txt.buttonContent,f=n.prototype.txt.defaultClass;i(a,p,f)}};s.settings.formats.forEach(function(t){o&&"xls"===t?t="xlsm":!1,o||"xlsx"!==t?!1:t=null,t&&v[t](l,g),console.log(t)})}),t("button[data-fileblob]").off("click").on("click",function(){var e=t(this).data("fileblob"),o=e.data,i=e.fileName,r=e.mimeType,s=e.fileExtension;n.prototype.export2file(o,r,i,s)}),s};n.prototype={defaults:{headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore"},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 n.prototype.entityMap[t]})},dateNum:function(t,e){e&&(t+=1462);var o=Date.parse(t);return(o-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'+t+"")}function i(t,n,o){var i="";e(i)}var d=t(this);r&&d.find("caption:not(.head)").remove();var y=d.find("tbody").find("tr"),y=s.settings.headings?y.add(d.find("thead>tr")):y,y=s.settings.footers?y.add(d.find("tfoot>tr")):y,m=s.settings.headings?d.find("thead>tr").length:0,g="id"===s.settings.fileName?d.attr("id")?d.attr("id"):o.prototype.defaultFileName:s.settings.fileName,v={xlsx:function(e,n){var r={},s=y.map(function(e,n){if(!~u.indexOf(e-m)&&!t(n).is(x)){var o=t(n).find("th, td");return[o.map(function(n,o){if(!~c.indexOf(n)&&!t(o).is(x)){if(r[e]&&r[e][n])return new Array(r[e][n]).concat(t(o).text());if(o.hasAttribute("colspan")&&(r[e]=r[e]||{},r[e][n+1]=o.getAttribute("colspan")-1),o.hasAttribute("rowspan"))for(var i=1;i":">","'":"'","/":"/"},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 o.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={},o={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){o.s.r>i&&(o.s.r=i),o.s.c>r&&(o.s.c=r),o.e.r