diff --git a/README.md b/README.md index 6733a78..347b150 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The simple, easy-to-implement plugin to export HTML tables to xlsx, xls, csv, an [TableExport](https://www.travismclarke.com/tableexport/) demo **--** [TableExport + RequireJS](https://github.com/clarketm/tableexport_requirejs_app) skeleton **--** [TableExport + Flask](https://github.com/clarketm/tableexport_flask_app) skeleton. -## [`v4.0.0-rc.4`](https://github.com/clarketm/TableExport/releases/tag/v4.0.0-rc.4) Release Candidate: +## [`v4.0.0-rc.5`](https://github.com/clarketm/TableExport/releases/tag/v4.0.0-rc.5) Release Candidate: > **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.5). 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.5) 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. diff --git a/bower.json b/bower.json index 8a4de26..fd3d4ca 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tableexport.js", - "version": "4.0.0-rc.4", + "version": "4.0.0-rc.5", "authors": [ "clarketm " ], diff --git a/dist/css/tableexport.css b/dist/css/tableexport.css index cbe4fe4..bb233fb 100644 --- a/dist/css/tableexport.css +++ b/dist/css/tableexport.css @@ -1,5 +1,5 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 Travis Clarke * Licensed under the MIT license */ diff --git a/dist/css/tableexport.min.css b/dist/css/tableexport.min.css index 300653f..11b1564 100644 --- a/dist/css/tableexport.min.css +++ b/dist/css/tableexport.min.css @@ -1,5 +1,5 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 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,.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{content:"";background:#006400 url(../img/xlsx.svg) no-repeat center}.xls:before{content:"";background:green url(../img/xls.svg) no-repeat center}.csv:before{content:"";background:#00f url(../img/csv.svg) no-repeat center}.txt:before{content:"";background:purple url(../img/txt.svg) no-repeat center} \ No newline at end of file diff --git a/dist/js/tableexport.js b/dist/js/tableexport.js index d00ec7e..0f38508 100644 --- a/dist/js/tableexport.js +++ b/dist/js/tableexport.js @@ -1,5 +1,5 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 Travis Clarke * Licensed under the MIT license */ @@ -45,7 +45,7 @@ settings.ignoreCSS = self.ignoreCSS instanceof Array ? self.ignoreCSS.join(', ') : self.ignoreCSS; settings.emptyCSS = self.emptyCSS instanceof Array ? self.emptyCSS.join(', ') : self.emptyCSS; settings.formatValue = self.formatValue.bind(this, settings.trimWhitespace); - settings.bootstrapSettings = _getBootstrapSettings(self.bootstrap, self.bootstrapConfig, self.defaultButton); + settings.bootstrapSettings = _getBootstrapSettings(settings.bootstrap, self.bootstrapConfig, self.defaultButton); var _exportData = {}; self.getExportData = function () { @@ -113,7 +113,7 @@ * Version. * @memberof TableExport.prototype */ - version: '4.0.0-rc.4', + version: '4.0.0-rc.5', /** * Default plugin options. * @memberof TableExport.prototype @@ -832,12 +832,12 @@ return el.classList ? el.classList.contains(cls) : new RegExp('(^| )' + cls + '( |$)', 'gi').test(el.cls); } - function _getBootstrapSettings(bootstrap, boostrapConfig, defaultButton) { + function _getBootstrapSettings(bootstrap, bootstrapConfig, defaultButton) { var config = {}; if (bootstrap) { - config.bootstrapClass = bootstrap[0] + ' '; - config.bootstrapTheme = bootstrap[1] + ' '; - config.bootstrapSpacing = bootstrap[2] + ' '; + config.bootstrapClass = bootstrapConfig[0] + ' '; + config.bootstrapTheme = bootstrapConfig[1] + ' '; + config.bootstrapSpacing = bootstrapConfig[2] + ' '; } else { config.bootstrapClass = defaultButton + ' '; config.bootstrapTheme = ''; diff --git a/dist/js/tableexport.min.js b/dist/js/tableexport.min.js index 2f8c98e..63dc09e 100644 --- a/dist/js/tableexport.min.js +++ b/dist/js/tableexport.min.js @@ -1,6 +1,6 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 Travis Clarke * Licensed under the MIT license */ -!function(t,e){"function"==typeof define&&define.amd?define(["jquery","blobjs","file-saverjs","xlsx"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?module.exports=e(require("jquery"),require("blobjs"),require("file-saverjs"),require("xlsx")):t.TableExport=e(t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this,function(t,e,r,n){"use strict";function o(){for(var t=arguments,e=1;e tr")),e.rows=l.headers?s(t.querySelectorAll("thead > tr")).concat(e.rows):e.rows,e.rows=l.footers?e.rows.concat(s(t.querySelectorAll("tfoot > tr"))):e.rows,e.thAdj=l.headers?t.querySelectorAll("thead > tr").length:0,e.filename="id"===l.filename?t.getAttribute("id")?t.getAttribute("id"):i.defaultFilename:l.filename?l.filename:i.defaultFilename,e.uuid=p(t),e.checkCaption=function(e){var r=t.querySelectorAll("caption:not(.head)");r.length?r[0].appendChild(e):(r=document.createElement("caption"),r.className=l.bootstrapSettings.bootstrapSpacing+l.position,r.appendChild(e),t.insertBefore(r,t.firstChild))},e.setExportData=function(){return function(t){var r=u.getInstance().getItem(t),n=t.substring(t.indexOf("-")+1);f[e.uuid]=f[e.uuid]||{},f[e.uuid][n]=JSON.parse(r)}}(),l.formats.forEach(function(t){!(!n||"xls"!==t)&&(t="xlsm"),!n&&"xlsx"===t&&(t=null),t&&e.setExportData(i.exporters[t].call(i,e))})});var m=document.querySelectorAll("button[tableexport-id]");return c(m,"click",i.downloadHandler,i),i};l.prototype={version:"4.0.0-rc.4",defaults:{headers:!0,footers:!0,formats:["xls","csv","txt"],filename:"id",bootstrap:!1,exportButtons:!0,position:"bottom",ignoreRows:null,ignoreCols:null,trimWhitespace:!0},charset:"charset=utf-8",defaultFilename:"myDownload",defaultButton:"button-default",ignoreCSS:"tableexport-ignore",emptyCSS:"tableexport-empty",bootstrapConfig:["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"},types:{string:{defaultClass:"tableexport-string"},number:{defaultClass:"tableexport-number",assert:function(t){return!isNaN(t.replace(/,/g,""))}},"boolean":{defaultClass:"tableexport-boolean",assert:function(t){return"true"===t.toLowerCase()||"false"===t.toLowerCase()}},date:{defaultClass:"tableexport-date",assert:function(t){return!isNaN(Date.parse(t))}}},exporters:{xlsx:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xlsx.mimeType,fileExtension:l.prototype.xlsx.fileExtension})),p=l.prototype.xlsx.buttonContent,c=l.prototype.xlsx.defaultClass,m=f({uuid:t.uuid,type:"xlsx"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xlsm:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xls:function(t){var e=this,r=e.settings,n=l.prototype.xls.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":t.textContent}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},csv:function(t){var e=this,r=e.settings,n=l.prototype.csv.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":'"'+r.formatValue(t.textContent.replace(/"/g,'""'))+'"'}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.csv.mimeType,fileExtension:l.prototype.csv.fileExtension})),p=l.prototype.csv.buttonContent,c=l.prototype.csv.defaultClass,m=f({uuid:t.uuid,type:"csv"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},txt:function(t){var e=this,r=e.settings,n=l.prototype.txt.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":r.formatValue(t.textContent)}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.txt.mimeType,fileExtension:l.prototype.txt.fileExtension})),p=l.prototype.txt.buttonContent,c=l.prototype.txt.defaultClass,m=f({uuid:t.uuid,type:"txt"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m}},createObjButton:function(t,e,r,n,o){var s=document.createElement("button");return s.setAttribute("tableexport-id",t),s.className=o.bootstrapClass+o.bootstrapTheme+n,s.textContent=r,s},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.prototype.entityMap[t]})},formatValue:function(t,e){return t?e.trim():e},getType:function(t){if(!t)return"";var e=l.prototype.types;return~t.indexOf(e.string.defaultClass)?"s":~t.indexOf(e.number.defaultClass)?"n":~t.indexOf(e["boolean"].defaultClass)?"b":~t.indexOf(e.date.defaultClass)?"d":""},dateNum:function(t,e){e&&(t+=1462);var r=Date.parse(t);return(r-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},r={s:{c:1e7,r:1e7},e:{c:0,r:0}},o=l.prototype.types,s=0;s!==t.length;++s)for(var i=0;i!==t[s].length;++i){r.s.r>s&&(r.s.r=s),r.s.c>i&&(r.s.c=i),r.e.r tr")),e.rows=l.headers?s(t.querySelectorAll("thead > tr")).concat(e.rows):e.rows,e.rows=l.footers?e.rows.concat(s(t.querySelectorAll("tfoot > tr"))):e.rows,e.thAdj=l.headers?t.querySelectorAll("thead > tr").length:0,e.filename="id"===l.filename?t.getAttribute("id")?t.getAttribute("id"):i.defaultFilename:l.filename?l.filename:i.defaultFilename,e.uuid=p(t),e.checkCaption=function(e){var r=t.querySelectorAll("caption:not(.head)");r.length?r[0].appendChild(e):(r=document.createElement("caption"),r.className=l.bootstrapSettings.bootstrapSpacing+l.position,r.appendChild(e),t.insertBefore(r,t.firstChild))},e.setExportData=function(){return function(t){var r=u.getInstance().getItem(t),n=t.substring(t.indexOf("-")+1);f[e.uuid]=f[e.uuid]||{},f[e.uuid][n]=JSON.parse(r)}}(),l.formats.forEach(function(t){!(!n||"xls"!==t)&&(t="xlsm"),!n&&"xlsx"===t&&(t=null),t&&e.setExportData(i.exporters[t].call(i,e))})});var m=document.querySelectorAll("button[tableexport-id]");return c(m,"click",i.downloadHandler,i),i};l.prototype={version:"4.0.0-rc.5",defaults:{headers:!0,footers:!0,formats:["xls","csv","txt"],filename:"id",bootstrap:!1,exportButtons:!0,position:"bottom",ignoreRows:null,ignoreCols:null,trimWhitespace:!0},charset:"charset=utf-8",defaultFilename:"myDownload",defaultButton:"button-default",ignoreCSS:"tableexport-ignore",emptyCSS:"tableexport-empty",bootstrapConfig:["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"},types:{string:{defaultClass:"tableexport-string"},number:{defaultClass:"tableexport-number",assert:function(t){return!isNaN(t.replace(/,/g,""))}},"boolean":{defaultClass:"tableexport-boolean",assert:function(t){return"true"===t.toLowerCase()||"false"===t.toLowerCase()}},date:{defaultClass:"tableexport-date",assert:function(t){return!isNaN(Date.parse(t))}}},exporters:{xlsx:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xlsx.mimeType,fileExtension:l.prototype.xlsx.fileExtension})),p=l.prototype.xlsx.buttonContent,c=l.prototype.xlsx.defaultClass,m=f({uuid:t.uuid,type:"xlsx"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xlsm:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xls:function(t){var e=this,r=e.settings,n=l.prototype.xls.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":t.textContent}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},csv:function(t){var e=this,r=e.settings,n=l.prototype.csv.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":'"'+r.formatValue(t.textContent.replace(/"/g,'""'))+'"'}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.csv.mimeType,fileExtension:l.prototype.csv.fileExtension})),p=l.prototype.csv.buttonContent,c=l.prototype.csv.defaultClass,m=f({uuid:t.uuid,type:"csv"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},txt:function(t){var e=this,r=e.settings,n=l.prototype.txt.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":r.formatValue(t.textContent)}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.txt.mimeType,fileExtension:l.prototype.txt.fileExtension})),p=l.prototype.txt.buttonContent,c=l.prototype.txt.defaultClass,m=f({uuid:t.uuid,type:"txt"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m}},createObjButton:function(t,e,r,n,o){var s=document.createElement("button");return s.setAttribute("tableexport-id",t),s.className=o.bootstrapClass+o.bootstrapTheme+n,s.textContent=r,s},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.prototype.entityMap[t]})},formatValue:function(t,e){return t?e.trim():e},getType:function(t){if(!t)return"";var e=l.prototype.types;return~t.indexOf(e.string.defaultClass)?"s":~t.indexOf(e.number.defaultClass)?"n":~t.indexOf(e["boolean"].defaultClass)?"b":~t.indexOf(e.date.defaultClass)?"d":""},dateNum:function(t,e){e&&(t+=1462);var r=Date.parse(t);return(r-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},r={s:{c:1e7,r:1e7},e:{c:0,r:0}},o=l.prototype.types,s=0;s!==t.length;++s)for(var i=0;i!==t[s].length;++i){r.s.r>s&&(r.s.r=s),r.s.c>i&&(r.s.c=i),r.e.r" ], diff --git a/src/stable/css/tableexport.css b/src/stable/css/tableexport.css index cbe4fe4..bb233fb 100644 --- a/src/stable/css/tableexport.css +++ b/src/stable/css/tableexport.css @@ -1,5 +1,5 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 Travis Clarke * Licensed under the MIT license */ diff --git a/src/stable/css/tableexport.min.css b/src/stable/css/tableexport.min.css index 300653f..11b1564 100644 --- a/src/stable/css/tableexport.min.css +++ b/src/stable/css/tableexport.min.css @@ -1,5 +1,5 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 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,.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{content:"";background:#006400 url(../img/xlsx.svg) no-repeat center}.xls:before{content:"";background:green url(../img/xls.svg) no-repeat center}.csv:before{content:"";background:#00f url(../img/csv.svg) no-repeat center}.txt:before{content:"";background:purple url(../img/txt.svg) no-repeat center} \ No newline at end of file diff --git a/src/stable/js/tableexport.js b/src/stable/js/tableexport.js index d00ec7e..0f38508 100644 --- a/src/stable/js/tableexport.js +++ b/src/stable/js/tableexport.js @@ -1,5 +1,5 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 Travis Clarke * Licensed under the MIT license */ @@ -45,7 +45,7 @@ settings.ignoreCSS = self.ignoreCSS instanceof Array ? self.ignoreCSS.join(', ') : self.ignoreCSS; settings.emptyCSS = self.emptyCSS instanceof Array ? self.emptyCSS.join(', ') : self.emptyCSS; settings.formatValue = self.formatValue.bind(this, settings.trimWhitespace); - settings.bootstrapSettings = _getBootstrapSettings(self.bootstrap, self.bootstrapConfig, self.defaultButton); + settings.bootstrapSettings = _getBootstrapSettings(settings.bootstrap, self.bootstrapConfig, self.defaultButton); var _exportData = {}; self.getExportData = function () { @@ -113,7 +113,7 @@ * Version. * @memberof TableExport.prototype */ - version: '4.0.0-rc.4', + version: '4.0.0-rc.5', /** * Default plugin options. * @memberof TableExport.prototype @@ -832,12 +832,12 @@ return el.classList ? el.classList.contains(cls) : new RegExp('(^| )' + cls + '( |$)', 'gi').test(el.cls); } - function _getBootstrapSettings(bootstrap, boostrapConfig, defaultButton) { + function _getBootstrapSettings(bootstrap, bootstrapConfig, defaultButton) { var config = {}; if (bootstrap) { - config.bootstrapClass = bootstrap[0] + ' '; - config.bootstrapTheme = bootstrap[1] + ' '; - config.bootstrapSpacing = bootstrap[2] + ' '; + config.bootstrapClass = bootstrapConfig[0] + ' '; + config.bootstrapTheme = bootstrapConfig[1] + ' '; + config.bootstrapSpacing = bootstrapConfig[2] + ' '; } else { config.bootstrapClass = defaultButton + ' '; config.bootstrapTheme = ''; diff --git a/src/stable/js/tableexport.min.js b/src/stable/js/tableexport.min.js index 2f8c98e..63dc09e 100644 --- a/src/stable/js/tableexport.min.js +++ b/src/stable/js/tableexport.min.js @@ -1,6 +1,6 @@ /*! - * TableExport.js 4.0.0-rc.4 (https://www.travismclarke.com) + * TableExport.js 4.0.0-rc.5 (https://www.travismclarke.com) * Copyright 2017 Travis Clarke * Licensed under the MIT license */ -!function(t,e){"function"==typeof define&&define.amd?define(["jquery","blobjs","file-saverjs","xlsx"],e):"object"==typeof exports&&"string"!=typeof exports.nodeName?module.exports=e(require("jquery"),require("blobjs"),require("file-saverjs"),require("xlsx")):t.TableExport=e(t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this,function(t,e,r,n){"use strict";function o(){for(var t=arguments,e=1;e tr")),e.rows=l.headers?s(t.querySelectorAll("thead > tr")).concat(e.rows):e.rows,e.rows=l.footers?e.rows.concat(s(t.querySelectorAll("tfoot > tr"))):e.rows,e.thAdj=l.headers?t.querySelectorAll("thead > tr").length:0,e.filename="id"===l.filename?t.getAttribute("id")?t.getAttribute("id"):i.defaultFilename:l.filename?l.filename:i.defaultFilename,e.uuid=p(t),e.checkCaption=function(e){var r=t.querySelectorAll("caption:not(.head)");r.length?r[0].appendChild(e):(r=document.createElement("caption"),r.className=l.bootstrapSettings.bootstrapSpacing+l.position,r.appendChild(e),t.insertBefore(r,t.firstChild))},e.setExportData=function(){return function(t){var r=u.getInstance().getItem(t),n=t.substring(t.indexOf("-")+1);f[e.uuid]=f[e.uuid]||{},f[e.uuid][n]=JSON.parse(r)}}(),l.formats.forEach(function(t){!(!n||"xls"!==t)&&(t="xlsm"),!n&&"xlsx"===t&&(t=null),t&&e.setExportData(i.exporters[t].call(i,e))})});var m=document.querySelectorAll("button[tableexport-id]");return c(m,"click",i.downloadHandler,i),i};l.prototype={version:"4.0.0-rc.4",defaults:{headers:!0,footers:!0,formats:["xls","csv","txt"],filename:"id",bootstrap:!1,exportButtons:!0,position:"bottom",ignoreRows:null,ignoreCols:null,trimWhitespace:!0},charset:"charset=utf-8",defaultFilename:"myDownload",defaultButton:"button-default",ignoreCSS:"tableexport-ignore",emptyCSS:"tableexport-empty",bootstrapConfig:["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"},types:{string:{defaultClass:"tableexport-string"},number:{defaultClass:"tableexport-number",assert:function(t){return!isNaN(t.replace(/,/g,""))}},"boolean":{defaultClass:"tableexport-boolean",assert:function(t){return"true"===t.toLowerCase()||"false"===t.toLowerCase()}},date:{defaultClass:"tableexport-date",assert:function(t){return!isNaN(Date.parse(t))}}},exporters:{xlsx:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xlsx.mimeType,fileExtension:l.prototype.xlsx.fileExtension})),p=l.prototype.xlsx.buttonContent,c=l.prototype.xlsx.defaultClass,m=f({uuid:t.uuid,type:"xlsx"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xlsm:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xls:function(t){var e=this,r=e.settings,n=l.prototype.xls.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":t.textContent}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},csv:function(t){var e=this,r=e.settings,n=l.prototype.csv.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":'"'+r.formatValue(t.textContent.replace(/"/g,'""'))+'"'}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.csv.mimeType,fileExtension:l.prototype.csv.fileExtension})),p=l.prototype.csv.buttonContent,c=l.prototype.csv.defaultClass,m=f({uuid:t.uuid,type:"csv"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},txt:function(t){var e=this,r=e.settings,n=l.prototype.txt.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":r.formatValue(t.textContent)}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.txt.mimeType,fileExtension:l.prototype.txt.fileExtension})),p=l.prototype.txt.buttonContent,c=l.prototype.txt.defaultClass,m=f({uuid:t.uuid,type:"txt"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m}},createObjButton:function(t,e,r,n,o){var s=document.createElement("button");return s.setAttribute("tableexport-id",t),s.className=o.bootstrapClass+o.bootstrapTheme+n,s.textContent=r,s},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.prototype.entityMap[t]})},formatValue:function(t,e){return t?e.trim():e},getType:function(t){if(!t)return"";var e=l.prototype.types;return~t.indexOf(e.string.defaultClass)?"s":~t.indexOf(e.number.defaultClass)?"n":~t.indexOf(e["boolean"].defaultClass)?"b":~t.indexOf(e.date.defaultClass)?"d":""},dateNum:function(t,e){e&&(t+=1462);var r=Date.parse(t);return(r-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},r={s:{c:1e7,r:1e7},e:{c:0,r:0}},o=l.prototype.types,s=0;s!==t.length;++s)for(var i=0;i!==t[s].length;++i){r.s.r>s&&(r.s.r=s),r.s.c>i&&(r.s.c=i),r.e.r tr")),e.rows=l.headers?s(t.querySelectorAll("thead > tr")).concat(e.rows):e.rows,e.rows=l.footers?e.rows.concat(s(t.querySelectorAll("tfoot > tr"))):e.rows,e.thAdj=l.headers?t.querySelectorAll("thead > tr").length:0,e.filename="id"===l.filename?t.getAttribute("id")?t.getAttribute("id"):i.defaultFilename:l.filename?l.filename:i.defaultFilename,e.uuid=p(t),e.checkCaption=function(e){var r=t.querySelectorAll("caption:not(.head)");r.length?r[0].appendChild(e):(r=document.createElement("caption"),r.className=l.bootstrapSettings.bootstrapSpacing+l.position,r.appendChild(e),t.insertBefore(r,t.firstChild))},e.setExportData=function(){return function(t){var r=u.getInstance().getItem(t),n=t.substring(t.indexOf("-")+1);f[e.uuid]=f[e.uuid]||{},f[e.uuid][n]=JSON.parse(r)}}(),l.formats.forEach(function(t){!(!n||"xls"!==t)&&(t="xlsm"),!n&&"xlsx"===t&&(t=null),t&&e.setExportData(i.exporters[t].call(i,e))})});var m=document.querySelectorAll("button[tableexport-id]");return c(m,"click",i.downloadHandler,i),i};l.prototype={version:"4.0.0-rc.5",defaults:{headers:!0,footers:!0,formats:["xls","csv","txt"],filename:"id",bootstrap:!1,exportButtons:!0,position:"bottom",ignoreRows:null,ignoreCols:null,trimWhitespace:!0},charset:"charset=utf-8",defaultFilename:"myDownload",defaultButton:"button-default",ignoreCSS:"tableexport-ignore",emptyCSS:"tableexport-empty",bootstrapConfig:["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"},types:{string:{defaultClass:"tableexport-string"},number:{defaultClass:"tableexport-number",assert:function(t){return!isNaN(t.replace(/,/g,""))}},"boolean":{defaultClass:"tableexport-boolean",assert:function(t){return"true"===t.toLowerCase()||"false"===t.toLowerCase()}},date:{defaultClass:"tableexport-date",assert:function(t){return!isNaN(Date.parse(t))}}},exporters:{xlsx:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xlsx.mimeType,fileExtension:l.prototype.xlsx.fileExtension})),p=l.prototype.xlsx.buttonContent,c=l.prototype.xlsx.defaultClass,m=f({uuid:t.uuid,type:"xlsx"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xlsm:function(t){var e=this,r=e.settings,n={},o=s(t.rows).map(function(o,a){if(!~r.ignoreRows.indexOf(a-t.thAdj)&&!i(o,r.ignoreCSS)){var l=o.querySelectorAll("th, td");return s(l).map(function(t,o){if(!~r.ignoreCols.indexOf(o)&&!i(t,r.ignoreCSS)){if(i(t,r.emptyCSS))return" ";if(t.hasAttribute("colspan")&&(n[a]=n[a]||{},n[a][o+1]=t.getAttribute("colspan")-1),t.hasAttribute("rowspan"))for(var s=1;s=o?u+n[a][s]:u:p++,p!==l);s++);return new Array(u).concat({v:r.formatValue(t.textContent),t:e.getType(t.className)})}return{v:r.formatValue(t.textContent),t:e.getType(t.className)}}}).filter(function(t){return t})}}).map(function(t){return t&&[].concat.apply([],t)}).filter(function(t){return t}),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},xls:function(t){var e=this,r=e.settings,n=l.prototype.xls.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":t.textContent}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.xls.mimeType,fileExtension:l.prototype.xls.fileExtension})),p=l.prototype.xls.buttonContent,c=l.prototype.xls.defaultClass,m=f({uuid:t.uuid,type:"xls"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},csv:function(t){var e=this,r=e.settings,n=l.prototype.csv.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":'"'+r.formatValue(t.textContent.replace(/"/g,'""'))+'"'}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.csv.mimeType,fileExtension:l.prototype.csv.fileExtension})),p=l.prototype.csv.buttonContent,c=l.prototype.csv.defaultClass,m=f({uuid:t.uuid,type:"csv"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m},txt:function(t){var e=this,r=e.settings,n=l.prototype.txt.separator,o=s(t.rows).map(function(e,o){if(!~r.ignoreRows.indexOf(o-t.thAdj)&&!i(e,r.ignoreCSS)){var a=e.querySelectorAll("th, td");return s(a).map(function(t,e){if(!~r.ignoreCols.indexOf(e)&&!i(t,r.ignoreCSS))return i(t,r.emptyCSS)?" ":r.formatValue(t.textContent)}).join(n)}}).join(e.rowDel),a=l.prototype.escapeHtml(JSON.stringify({data:o,filename:t.filename,mimeType:l.prototype.txt.mimeType,fileExtension:l.prototype.txt.fileExtension})),p=l.prototype.txt.buttonContent,c=l.prototype.txt.defaultClass,m=f({uuid:t.uuid,type:"txt"}),x=r.exportButtons&&l.prototype.createObjButton(m,a,p,c,r.bootstrapSettings);return x&&t.checkCaption(x),u.getInstance().setItem(m,a,!0),m}},createObjButton:function(t,e,r,n,o){var s=document.createElement("button");return s.setAttribute("tableexport-id",t),s.className=o.bootstrapClass+o.bootstrapTheme+n,s.textContent=r,s},escapeHtml:function(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.prototype.entityMap[t]})},formatValue:function(t,e){return t?e.trim():e},getType:function(t){if(!t)return"";var e=l.prototype.types;return~t.indexOf(e.string.defaultClass)?"s":~t.indexOf(e.number.defaultClass)?"n":~t.indexOf(e["boolean"].defaultClass)?"b":~t.indexOf(e.date.defaultClass)?"d":""},dateNum:function(t,e){e&&(t+=1462);var r=Date.parse(t);return(r-new Date(Date.UTC(1899,11,30)))/864e5},createSheet:function(t){for(var e={},r={s:{c:1e7,r:1e7},e:{c:0,r:0}},o=l.prototype.types,s=0;s!==t.length;++s)for(var i=0;i!==t[s].length;++i){r.s.r>s&&(r.s.r=s),r.s.c>i&&(r.s.c=i),r.e.r