crestapps-tableexport
Version:
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files
19 lines (17 loc) • 18.8 kB
JavaScript
/*!
* TableExport.js v5.2.5 (https://www.travismclarke.com)
*
* Copyright (c) 2018 - Travis Clarke - https://www.travismclarke.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
!function(t,r){if("function"==typeof define&&define.amd)define(function(t){var e;try{e=t("jquery")}catch(t){}return r(e,t("blobjs"),t("file-saverjs"),t("xlsx"))});else if("object"==typeof exports&&"string"!=typeof exports.nodeName){var e;try{e=require("jquery")}catch(t){}module.exports=r(e,require("blobjs"),require("file-saverjs"),require("xlsx"))}else t.TableExport=r(t.jQuery,t.Blob,t.saveAs,t.XLSX)}(this,function(e,l,c,f){"use strict";var o=function(t,e){var a=this;if(!t)return S('"selectors" is required. \nUsage: TableExport(selectors, options)');if(!a)return a=new o(t,e);a.settings=x({},a.defaults,e),a.selectors=C(t),a.contexts=[];var s=a.settings;s.ignoreRows=s.ignoreRows instanceof Array?s.ignoreRows:[s.ignoreRows],s.ignoreCols=s.ignoreCols instanceof Array?s.ignoreCols:[s.ignoreCols],s.ignoreCSS=a.ignoreCSS instanceof Array?a.ignoreCSS:[a.ignoreCSS],s.emptyCSS=a.emptyCSS instanceof Array?a.emptyCSS:[a.emptyCSS],s.formatValue=a.formatValue.bind(this,s.trimWhitespace),s.bootstrapSettings=function(t,e,r){var o={bootstrapClass:r+" ",bootstrapTheme:"",bootstrapSpacing:""};t&&(o.bootstrapClass=e[0]+" ",o.bootstrapTheme=e[1]+" ",o.bootstrapSpacing=e[2]+" ");return o}(s.bootstrap,a.bootstrapConfig,a.defaultButton),Array.isArray(s.formats)||(s.formats=[s.formats]),a.processAll=function(){a.contexts.forEach(function(t){t.processAllData()})},a.processByKey=function(t,e){var r=b(t),o=a.contexts[r];o&&o.processDataByKey(e)};var i={};a.getExportData=function(){return a.processAll(),i},a.selectors.forEach(function(r){var o={},t=r.querySelectorAll("thead > tr");o.rows=C(r.querySelectorAll("tbody > tr")),s.headers&&(o.rows=C(t).concat(o.rows)),s.footers&&(o.rows=C(r.querySelectorAll("tfoot > tr")).concat(o.rows)),o.thAdj=s.headers?t.length:0,o.filename=("id"===s.filename?r.getAttribute("id"):s.filename)||a.defaultFilename,o.sheetname=("id"===s.sheetname?r.getAttribute("id"):s.sheetname)||a.defaultSheetname,o.uuid=b(r),o.checkCaption=function(t){var e=r.querySelectorAll("caption."+a.defaultCaptionClass);e.length?e[0].appendChild(t):((e=document.createElement("caption")).className=s.bootstrapSettings.bootstrapSpacing+a.defaultCaptionClass,e.style.cssText="caption-side: "+s.position,e.appendChild(t),r.insertBefore(e,r.firstChild))},o.setExportData=function(t){var e=u.getInstance().getItem(t),r=t.substring(t.indexOf("-")+1);i[o.uuid]=i[o.uuid]||{},i[o.uuid][r]=JSON.parse(e)},o.rcMap=function(){return(new p).build(o,s)};var n=g.reduce(function(t,e){return t[e]=0,t},{});o.processDataByKey=function(t){if(e=t,!~g.indexOf(e))return S('"'+t+'" is not a valid format. \nFormats: '+g.join(", "));var e;if(!function(t){var e;switch(t){case d.TXT:case d.CSV:case d.XLS:e=!0;break;default:e=m(t)}return e}(t))return S('"'+t+'" requires "js-xlsx".');if(!n[t]){var r=a.exporters.build.call(a,o,t);o.setExportData(r),n[t]++}},o.processAllData=function(){return s.formats.forEach(function(t){o.processDataByKey(t)})},s.exportButtons&&s.formats.forEach(function(t){var e=a.formatConfig[t],r=v({uuid:o.uuid,type:t});o.checkCaption(a.createObjButton(r,e.buttonContent,e.defaultClass,s.bootstrapSettings))}),a.contexts[o.uuid]=o});var r=document.querySelectorAll("button["+a.storageKey+"]");return n(r,"click",a.downloadHandler,a),a};o.prototype={version:"5.2.5",defaults:{headers:!0,footers:!0,formats:["xlsx","csv","txt"],filename:"id",bootstrap:!1,exportButtons:!0,position:"bottom",ignoreRows:null,ignoreCols:null,trimWhitespace:!0,RTL:!1,sheetname:"id"},CONSTANTS:{FORMAT:{XLSX:"xlsx",XLSM:"xlsm",XLSB:"xlsb",BIFF2:"biff2",XLS:"xls",CSV:"csv",TXT:"txt"},TYPE:{STRING:"s",NUMBER:"n",BOOLEAN:"b",DATE:"d"}},charset:"charset=utf-8",defaultFilename:"myDownload",defaultSheetname:"myWorksheet",defaultButton:"button-default",defaultCaptionClass:"tableexport-caption",defaultNamespace:"tableexport-",tableKey:"tableexport-key",storageKey:"tableexport-id",ignoreCSS:".tableexport-ignore",emptyCSS:".tableexport-empty",bootstrapConfig:["btn","btn-default","btn-toolbar"],rowDel:"\r\n",entityMap:{"&":"&","<":"<",">":">","'":"'","/":"/"},formatConfig:{xlsx:{defaultClass:"export-type-xlsx xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},xlsm:{defaultClass:"export-type-xlsm xlsm",buttonContent:"Export to xlsm",mimeType:"application/vnd.ms-excel.sheet.macroEnabled.main+xml",fileExtension:".xlsm"},xlsb:{defaultClass:"export-type-xlsb xlsb",buttonContent:"Export to xlsb",mimeType:"application/vnd.ms-excel.sheet.binary.macroEnabled.main",fileExtension:".xlsb"},xls:{defaultClass:"export-type-xls xls",buttonContent:"Export to xls",separator:"\t",mimeType:"application/vnd.ms-excel",fileExtension:".xls",enforceStrictRFC4180:!1},csv:{defaultClass:"export-type-csv csv",buttonContent:"Export to csv",separator:",",mimeType:"text/csv",fileExtension:".csv",enforceStrictRFC4180:!0},txt:{defaultClass:"export-type-txt txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt",enforceStrictRFC4180:!0}},typeConfig:{string:{defaultClass:"tableexport-string"},number:{defaultClass:"tableexport-number",assert:function(t){return!isNaN(t)}},boolean:{defaultClass:"tableexport-boolean",assert:function(t){return"true"===t.toLowerCase()||"false"===t.toLowerCase()}},date:{defaultClass:"tableexport-date",assert:function(t){return!/.*%/.test(t)&&!isNaN(Date.parse(t))}}},exporters:{build:function(t,n){var a=this,s=a.settings,e=a.formatConfig[n],i=e.separator,p=t.rcMap(),r=C(t.rows).map(function(t,o){return p.isIgnore(o)?p.handleRowColMapProp(p.TYPE.IGNORE):p.isEmpty(o)?p.handleRowColMapProp(p.TYPE.EMPTY):C(t.querySelectorAll("th, td")).map(function(t,e){var r=function(t){if(m(n))return{v:s.formatValue(t.textContent),t:a.getType(t.className)};switch(n){case d.CSV:return'"'+s.formatValue(t.textContent.replace(/"/g,'""'))+'"';default:return s.formatValue(t.textContent)}}(t);return p.isIgnore(o,e)?p.handleRowColMapProp(p.TYPE.IGNORE):p.isEmpty(o,e)?p.handleRowColMapProp(p.TYPE.EMPTY):p.handleRowColMapProp(p.TYPE.DEFAULT,o,e,n,r,i)}).processCols(n,i)}).processRows(n,a.rowDel),o=JSON.stringify({data:r,filename:t.filename,mimeType:e.mimeType,fileExtension:e.fileExtension,merges:p.merges,RTL:s.RTL,sheetname:s.sheetname}),l=v({uuid:t.uuid,type:n});return u.getInstance().setItem(l,o,!0)}},createObjButton:function(t,e,r,o){var n=document.createElement("button");return n.setAttribute("type","button"),n.setAttribute(this.storageKey,t),n.className=o.bootstrapClass+o.bootstrapTheme+r,n.textContent=e,n},escapeHtml:function(t){var e=this;return String(t).replace(/[&<>'\/]/g,function(t){return e.entityMap[t]})},unescapeHtml:function(t){var e=String(t);for(var r in this.entityMap)e=e.replace(RegExp(this.entityMap[r],"g"),r);return e},formatValue:function(t,e){return t?e.trim():e},getType:function(t){if(!t)return"";var e=this.typeConfig;return~t.indexOf(e.string.defaultClass)?y.STRING:~t.indexOf(e.number.defaultClass)?y.NUMBER:~t.indexOf(e.boolean.defaultClass)?y.BOOLEAN:~t.indexOf(e.date.defaultClass)?y.DATE:""},dateNum:function(t,e){e&&(t+=1462);var r=(Date.parse(t)-new Date(Date.UTC(1899,11,30)))/864e5;return Math.floor(r)},createSheet:function(t,e){for(var r={},o={s:{c:1e7,r:1e7},e:{c:0,r:0}},n=this.typeConfig,a=0;a!==t.length;++a)for(var s=0;s!==t[a].length;++s){o.s.r>a&&(o.s.r=a),o.s.c>s&&(o.s.c=s),o.e.r<a&&(o.e.r=a),o.e.c<s&&(o.e.c=s);var i=t[a][s];if(i&&i.v){var p=f.utils.encode_cell({c:s,r:a});i.t||(n.number.assert(i.v)?i.t=y.NUMBER:n.boolean.assert(i.v)?i.t=y.BOOLEAN:n.date.assert(i.v)?i.t=y.DATE:i.t=y.STRING),i.t===y.DATE&&(i.t=y.NUMBER,i.z=f.SSF._table[14],i.v=this.dateNum(i.v)),r[p]=i}}return r["!merges"]=e,o.s.c<1e7&&(r["!ref"]=f.utils.encode_range(o)),r},downloadHandler:function(e){e.target.disabled=!0;var t=e.target.innerHTML;e.target.innerHTML="Exporting...";var r=e.target.className.split(" ").filter(function(t){return t.startsWith("export-type-")});if(r.length){try{var o=e.target.getAttribute(this.storageKey),n=r[0].substring(12);e.target.getAttribute("is-exported")&&u.getInstance().exists(o)||(this.processByKey(e.target.closest("caption").parentNode,n),e.target.setAttribute("is-exported",!0));var a=JSON.parse(u.getInstance().getItem(o));this.export2file(a.data,a.mimeType,a.filename,a.fileExtension,a.merges,a.RTL,a.sheetname)}catch(t){e.target.removeAttribute("is-exported"),console.log("Something went wrong during the export "+t.message)}e.target.innerHTML=t,e.target.disabled=!1}else console.log("Unable to find the export type. Ensure that the buttons have class to identify the exportable type. For example export-type-xls or export-type-csv")},Workbook:function(){this.Workbook={Views:[]},this.SheetNames=[],this.Sheets={}},string2ArrayBuffer:function(t){for(var e=new ArrayBuffer(t.length),r=new Uint8Array(e),o=0;o!==t.length;++o)r[o]=255&t.charCodeAt(o);return e},export2file:function(t,e,r,o,n,a,s){var i=o.slice(1);if(t=this.getRawData(t,o,r,n,a,s),!h||i!==d.CSV&&i!==d.TXT)c(new l([t],{type:e+";"+this.charset}),r+o,!0);else{var p="data:"+e+";"+this.charset+","+t;this.downloadDataURI(p,r,o)}},downloadDataURI:function(t,e,r){var o=encodeURI(t),n=document.createElement("a");n.setAttribute("href",o),n.setAttribute("download",e+r),document.body.appendChild(n),n.click()},getBookType:function(t){switch(t){case d.XLS:return d.BIFF2;default:return t}},getRawData:function(t,e,r,o,n,a){var s=e.substring(1);if(m(s)){var i=new this.Workbook,p=this.createSheet(t,o),l=this.getBookType(s);a=a||"",i.SheetNames.push(a),i.Sheets[a]=p;var c={bookType:l,bookSST:!(i.Workbook.Views[0]={RTL:n}),type:"binary"},u=f.write(i,c);t=this.string2ArrayBuffer(u)}return t},getFileSize:function(t,e){var r=this.getRawData(t,e);return r instanceof ArrayBuffer?r.byteLength:this.string2ArrayBuffer(r).byteLength},update:function(t){return this.remove(),new o(this.selectors,x({},this.defaults,t))},reset:function(){return this.remove(),new o(this.selectors,this.settings)},remove:function(){var r=this;this.selectors.forEach(function(t){var e=t.querySelector("caption."+r.defaultCaptionClass);e&&t.removeChild(e)})}};var u=function(){this._instance=null,this.store=sessionStorage,this.namespace=o.prototype.defaultNamespace,this.getKey=function(t){return this.namespace+t},this.setItem=function(t,e,r){console.log("Starting the save to store");var o=this.getKey(t);if(!this.exists(t)||r)return"string"!=typeof e?S('"value" must be a string.'):(this.store.setItem(o,e),console.log("Ended the save to store"),t)},this.getItem=function(t){var e=this.getKey(t);return this.store.getItem(e)},this.exists=function(t){var e=this.getKey(t);return null!==this.store.getItem(e)},this.removeItem=function(t){var e=this.getKey(t);return this.store.removeItem(e)}};u.getInstance=function(){return this._instance||(this._instance=new u),this._instance};var p=function(){this.rcMap=[],this.merges=[],this.isIgnore=function(t,e){return this.getRowColMapProp(t,e,p.prototype.TYPE.IGNORE)},this.isEmpty=function(t,e){return this.getRowColMapProp(t,e,p.prototype.TYPE.EMPTY)},this.isRowSpan=function(t){return this.getRowColMapProp(t,void 0,p.prototype.TYPE.ROWSPAN)},this.isColSpan=function(t){return this.getRowColMapProp(t,void 0,p.prototype.TYPE.COLSPAN)},this.isSpan=function(t){return this.isRowSpan(t)||this.isColSpan(t)},this.isMerge=function(t){return 0<this.merges.length},this.addMerge=function(t,e){this.merges.push(e),this.setRowColMapProp(t,void 0,p.prototype.TYPE.MERGE,this.merges)},this.getRowColMapProp=function(t,e,r){if(this.rcMap[t]){if(i(r))return this.rcMap[t][e];if(i(e))return this.rcMap[t][r];if(this.rcMap[t][e])return this.rcMap[t][e][r]}},this.setRowColMapProp=function(t,e,r,o){if(this.rcMap[t]=this.rcMap[t]||[],!i(r)||!i(e))return a(e)&&i(r)?this.rcMap[t][e]=o:i(e)&&a(r)?this.rcMap[t][r]=o:(this.rcMap[t][e]=this.rcMap[t][e]||[],this.rcMap[t][e][r]=o)},this.generateTotal=function(t,e){var r=p.prototype.TYPE.VALUE,o=0;return this.isRowSpan(t)&&this.isColSpan(t)?o=this.getRowColMapProp(t,e,r)||0:this.getRowColMapProp(t,e,r)&&(o=this.getRowColMapProp(t,e,r)),o},this.convertSpanToArray=function(t,e,r,o,n){if(this.rcMap[t]&&this.isSpan(t)){var a=this.generateTotal(t,e);return m(r)?new Array(a).concat(o):new Array(a).concat(o).join(n)}return o},this.handleRowColMapProp=function(t,e,r,o,n,a){switch(t){case p.prototype.TYPE.IGNORE:return;case p.prototype.TYPE.EMPTY:return" ";case p.prototype.TYPE.DEFAULT:default:return this.convertSpanToArray(e,r,o,n,a)}}};p.prototype={OFFSET:1,TYPE:{IGNORE:"ignore",EMPTY:"empty",MERGE:"merge",ROWSPAN:"rowspan",ROWSPANTOTAL:"rowspantotal",COLSPAN:"colspan",COLSPANTOTAL:"colspantotal",DEFAULT:"default",VALUE:"value"},build:function(e,o){var g=this,f=g.OFFSET,y=g.rowLength=e.rows.length,n=function(t,e){g.setRowColMapProp(t,e,g.TYPE.IGNORE,!0)},a=function(t,e){g.setRowColMapProp(t,e,g.TYPE.EMPTY,!0)},b=function(t,e,r,o,n){var a,s,i,p,l=+t.getAttribute("colspan"),c=g.getRowColMapProp(e,void 0,g.TYPE.COLSPAN)||0,u=g.getRowColMapProp(e,void 0,g.TYPE.COLSPANTOTAL)||0;return!(l<2)&&(g.setRowColMapProp(e,void 0,g.TYPE.COLSPAN,c+1),g.setRowColMapProp(e,void 0,g.TYPE.COLSPANTOTAL,u+l),o?(g.setRowColMapProp(e,r-c,g.TYPE.VALUE,l),!0):(s=(a=e)+(n||1)-f,p=(i=r+u-c)+(l-f),g.setRowColMapProp(e,r+f,g.TYPE.VALUE,l-f),void v(a,i,s,p)))},v=function(t,e,r,o){var n={s:{r:t,c:e},e:{r:r,c:o}};return g.addMerge(t,n)};return e.rows.map(function(t,r){return(~o.ignoreRows.indexOf(r-e.thAdj)||t.matches(o.ignoreCSS))&&n(r),t.matches(o.emptyCSS)&&a(r),C(t.querySelectorAll("th, td")).map(function(t,e){(~o.ignoreCols.indexOf(e)||t.matches(o.ignoreCSS))&&n(r,e),t.matches(o.emptyCSS)&&a(r,e),t.hasAttribute("rowspan")?function(t,e,r){for(var o,n,a,s,i,p,l,c=+t.getAttribute("rowspan"),u=+t.getAttribute("colspan"),f=0;f<c;f++){if(y<=f+e)return;if(u&&(o=b(t,f+e,r,0<f,c)),c<2)return;var h=g.rcMap["c"+(r-1)]?g.rcMap["c"+(r-1)][f+e]:0;if(h&&(g.rcMap["c"+r]=g.rcMap["c"+r]||[],g.rcMap["c"+r][f+e]=(g.rcMap["c"+r][f+e]||0)+h),c&&0===f&&1<u)for(var m=0;m<c;m++)g.rcMap["c"+(r+1)]=g.rcMap["c"+(r+1)]||[],g.rcMap["c"+(r+1)][f+e+m]=(g.rcMap["c"+(r+1)][f+e+m]||0)+Math.max(1,u);if(1<=f&&(n=g.getRowColMapProp(f+e,void 0,g.TYPE.ROWSPAN)||0,g.setRowColMapProp(f+e,void 0,g.TYPE.ROWSPAN,n+1),!o&&(a=g.getRowColMapProp(f+e,r-n,g.TYPE.VALUE)||0,g.setRowColMapProp(f+e,r-n,g.TYPE.VALUE,a+1),1<c&&1===f))){var d=g.rcMap["c"+r]&&g.rcMap["c"+r][f+e];i=(s=e)+c-1,l=(p=r+(g.getRowColMapProp(e,void 0,g.TYPE.COLSPANTOTAL)||0)-(g.getRowColMapProp(e,void 0,g.TYPE.COLSPAN)||0)+(d||0))+Math.max(1,u)-1,v(s,p,i,l)}}}(t,r,e):t.hasAttribute("colspan")&&b(t,r,e)})}),g}};var t,h=(t=navigator.userAgent||navigator.vendor||window.opera,/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substring(0,4))),m=function(t){return f&&!o.prototype.formatConfig[t].enforceStrictRFC4180},d=o.prototype.CONSTANTS.FORMAT,g=Object.keys(d).map(function(t){return d[t]}),y=o.prototype.CONSTANTS.TYPE;Object.defineProperty(Array.prototype,"processRows",{enumerable:!1,value:function(t,e){return m(t)?this.map(w).filter(a):this.filter(a).join(e)}}),Object.defineProperty(Array.prototype,"processCols",{enumerable:!1,value:function(t,e){return m(t)?this.filter(a):this.filter(a).join(e)}});var r,s,b=(r=0,function(t){var e=t.getAttribute(o.prototype.tableKey);return e||(e=t.id?t.id:o.prototype.defaultNamespace+ ++r,t.setAttribute(o.prototype.tableKey,e)),e}),v=function(t){var e,r=0,o=t.type;if(0===(t=JSON.stringify(t)).length)return r;for(e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return r.toString(16).substring(1)+"-"+o},n=(s=null,function(t,e,r,o){for(var n=r.bind(o),a=0;a<t.length;++a)s&&t[a].removeEventListener(e,s,!1),t[a].addEventListener(e,n,!1);s=n});function x(){for(var t=arguments,e=1;e<t.length;e++)for(var r in t[e])t[e].hasOwnProperty(r)&&(t[0][r]=t[e][r]);return t[0]}function C(t){return i(t.length)?[].concat(t):[].slice.call(t)}function a(t){return void 0!==t}function i(t){return void 0===t}function w(t){return t instanceof Array?[].concat.apply([],t):t}function S(t){return console.error(t),new Error(t)}if(e)for(var E in e.fn.tableExport=function(t){return o.call(x({},o.prototype,e.fn.tableExport),this,t)},o.prototype)e.fn.tableExport[E]=o.prototype[E];return o.TableExport=o});