Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tableexport

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tableexport - npm Package Compare versions

Comparing version 3.2.3 to 3.2.5

5

bower.json
{
"name": "tableexport.js",
"version": "3.2.3",
"version": "3.2.5",
"authors": [

@@ -12,4 +12,3 @@ "clarketm <travis.m.clarke@gmail.com>"

"export",
"table",
"export",
"tableexport",
"Excel",

@@ -16,0 +15,0 @@ "xlsx",

35

dist/js/tableexport.js
/*!
* TableExport.js v3.2.3 (http://www.clarketravis.com)
* Copyright 2015 Travis Clarke
* TableExport.js v3.2.5 (http://www.clarketravis.com)
* Copyright 2016 Travis Clarke
* Licensed under the MIT license

@@ -12,5 +12,6 @@ */

$.fn.tableExport = function (options) {
$.fn.tableExport = function (options, isUpdate) {
var settings = $.extend({}, $.fn.tableExport.defaults, options),
var $this = this,
settings = isUpdate ? options : $.extend({}, $.fn.tableExport.defaults, options),
rowD = $.fn.tableExport.rowDel,

@@ -31,7 +32,8 @@ ignoreRows = settings.ignoreRows instanceof Array ? settings.ignoreRows : [settings.ignoreRows],

this.each(function () {
var $el = $(this),
$rows = $el.find('tbody').find('tr'),
$this.each(function () {
var $el = $(this);
if (isUpdate) { $el.find('caption:not(.head)').remove();}
var $rows = $el.find('tbody').find('tr'),
$rows = settings.headings ? $rows.add($el.find('thead>tr')) : $rows,
$rows = settings.footers ? $rows.add($el.find('tfoor>tr')) : $rows,
$rows = settings.footers ? $rows.add($el.find('tfoot>tr')) : $rows,
thAdj = settings.headings ? $el.find('thead>tr').length : 0,

@@ -46,3 +48,2 @@ fileName = settings.fileName === "id" ? ($el.attr('id') ? $el.attr('id') : $.fn.tableExport.defaultFileName) : settings.fileName,

if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { return;}
console.log($(val).is(ignoreCSS));
return $(val).text();

@@ -154,2 +155,18 @@ }).get()];

});
$.fn.tableExport.update = function (options) {
$this.tableExport($.extend({}, settings, options), true)
};
$.fn.tableExport.reset = function (options) {
$this.tableExport(settings, true)
};
$.fn.tableExport.remove = function (options) {
$this.each(function () {
$(this).find('caption:not(.head)').remove();
});
};
return $this;
};

@@ -156,0 +173,0 @@

/*!
* TableExport.js v3.2.3 (http://www.clarketravis.com)
* Copyright 2015 Travis Clarke
* TableExport.js v3.2.5 (http://www.clarketravis.com)
* Copyright 2016 Travis Clarke
* Licensed under the MIT license
*/
!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={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){a.s.r>i&&(a.s.r=i),a.s.c>r&&(a.s.c=r),a.e.r<i&&(a.e.r=i),a.e.c<r&&(a.e.c=r);var f={v:t[i][r]};if(null!=f.v){var l=XLSX.utils.encode_cell({c:r,r:i});"number"==typeof f.v?f.t="n":"boolean"==typeof f.v?f.t="b":f.v instanceof Date?(f.t="n",f.z=XLSX.SSF._table[14],f.v=o(f.v)):f.t="s",n[l]=f}}return a.s.c<1e7&&(n["!ref"]=XLSX.utils.encode_range(a)),n}function i(){return this instanceof i?(this.SheetNames=[],void(this.Sheets={})):new i}function r(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}function f(t,e,n,o){if(".xlsx"===o){var f=new i,s=a(t);f.SheetNames.push(n),f.Sheets[n]=s;var x={bookType:"xlsx",bookSST:!1,type:"binary"},p=XLSX.write(f,x);t=r(p)}saveAs(new Blob([t],{type:e+";"+l.fn.tableExport.charset}),n+o)}var l=t.jQuery;l.fn.tableExport=function(t){var e,o,a,i=l.extend({},l.fn.tableExport.defaults,t),r=l.fn.tableExport.rowDel,s=i.ignoreRows instanceof Array?i.ignoreRows:[i.ignoreRows],x=i.ignoreCols instanceof Array?i.ignoreCols:[i.ignoreCols],p=i.ignoreCSS instanceof Array?i.ignoreCSS.join(", "):i.ignoreCSS;i.bootstrap?(e=l.fn.tableExport.bootstrap[0]+" ",o=l.fn.tableExport.bootstrap[1]+" ",a=l.fn.tableExport.bootstrap[2]+" "):(e=l.fn.tableExport.defaultButton+" ",o=a=""),this.each(function(){function t(t){var e=u.find("caption:not(.head)");e.length?e.append(t):u.prepend('<caption class="'+a+i.position+'">'+t+"</caption>")}function f(n,a,i){var r="<button data-fileblob='"+n+"' class='"+e+o+i+"'>"+a+"</button>";t(r)}var u=l(this),b=u.find("tbody").find("tr"),b=i.headings?b.add(u.find("thead>tr")):b,b=i.footers?b.add(u.find("tfoor>tr")):b,d=i.headings?u.find("thead>tr").length:0,c="id"===i.fileName?u.attr("id")?u.attr("id"):l.fn.tableExport.defaultFileName:i.fileName,E={xlsx:function(t,e){var o=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:(console.log(l(e).is(p)),l(e).text())}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),i=l.fn.tableExport.xlsx.buttonContent,r=l.fn.tableExport.xlsx.defaultClass;f(a,i,r)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),r=l.fn.tableExport.xls.buttonContent,u=l.fn.tableExport.xls.defaultClass;f(i,r,u)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),r=l.fn.tableExport.csv.buttonContent,u=l.fn.tableExport.csv.defaultClass;f(i,r,u)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),r=l.fn.tableExport.txt.buttonContent,u=l.fn.tableExport.txt.defaultClass;f(i,r,u)}};i.formats.forEach(function(t){E[t](r,c)})}),l("button[data-fileblob]").off("click").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore"},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&#38;","<":"&#60;",">":"&#62;","'":"&#39;","/":"&#47"}}(window);
!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={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){a.s.r>i&&(a.s.r=i),a.s.c>r&&(a.s.c=r),a.e.r<i&&(a.e.r=i),a.e.c<r&&(a.e.c=r);var f={v:t[i][r]};if(null!=f.v){var l=XLSX.utils.encode_cell({c:r,r:i});"number"==typeof f.v?f.t="n":"boolean"==typeof f.v?f.t="b":f.v instanceof Date?(f.t="n",f.z=XLSX.SSF._table[14],f.v=o(f.v)):f.t="s",n[l]=f}}return a.s.c<1e7&&(n["!ref"]=XLSX.utils.encode_range(a)),n}function i(){return this instanceof i?(this.SheetNames=[],void(this.Sheets={})):new i}function r(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}function f(t,e,n,o){if(".xlsx"===o){var f=new i,s=a(t);f.SheetNames.push(n),f.Sheets[n]=s;var x={bookType:"xlsx",bookSST:!1,type:"binary"},p=XLSX.write(f,x);t=r(p)}saveAs(new Blob([t],{type:e+";"+l.fn.tableExport.charset}),n+o)}var l=t.jQuery;l.fn.tableExport=function(t,e){var o,a,i,r=this,s=e?t:l.extend({},l.fn.tableExport.defaults,t),x=l.fn.tableExport.rowDel,p=s.ignoreRows instanceof Array?s.ignoreRows:[s.ignoreRows],u=s.ignoreCols instanceof Array?s.ignoreCols:[s.ignoreCols],b=s.ignoreCSS instanceof Array?s.ignoreCSS.join(", "):s.ignoreCSS;return s.bootstrap?(o=l.fn.tableExport.bootstrap[0]+" ",a=l.fn.tableExport.bootstrap[1]+" ",i=l.fn.tableExport.bootstrap[2]+" "):(o=l.fn.tableExport.defaultButton+" ",a=i=""),r.each(function(){function t(t){var e=f.find("caption:not(.head)");e.length?e.append(t):f.prepend('<caption class="'+i+s.position+'">'+t+"</caption>")}function r(e,n,i){var r="<button data-fileblob='"+e+"' class='"+o+a+i+"'>"+n+"</button>";t(r)}var f=l(this);e&&f.find("caption:not(.head)").remove();var d=f.find("tbody").find("tr"),d=s.headings?d.add(f.find("thead>tr")):d,d=s.footers?d.add(f.find("tfoot>tr")):d,c=s.headings?f.find("thead>tr").length:0,E="id"===s.fileName?f.attr("id")?f.attr("id"):l.fn.tableExport.defaultFileName:s.fileName,m={xlsx:function(t,e){var o=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),i=l.fn.tableExport.xlsx.buttonContent,f=l.fn.tableExport.xlsx.defaultClass;r(a,i,f)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),f=l.fn.tableExport.xls.buttonContent,s=l.fn.tableExport.xls.defaultClass;r(i,f,s)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),f=l.fn.tableExport.csv.buttonContent,s=l.fn.tableExport.csv.defaultClass;r(i,f,s)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),f=l.fn.tableExport.txt.buttonContent,s=l.fn.tableExport.txt.defaultClass;r(i,f,s)}};s.formats.forEach(function(t){m[t](x,E)})}),l("button[data-fileblob]").off("click").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)}),l.fn.tableExport.update=function(t){r.tableExport(l.extend({},s,t),!0)},l.fn.tableExport.reset=function(t){r.tableExport(s,!0)},l.fn.tableExport.remove=function(t){r.each(function(){l(this).find("caption:not(.head)").remove()})},r},l.fn.tableExport.defaults={headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore"},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&#38;","<":"&#60;",">":"&#62;","'":"&#39;","/":"&#47"}}(window);
The MIT License (MIT)
Copyright (c) 2015 - Travis Clarke - http://clarketravis.com
Copyright (c) 2016 - Travis Clarke - http://clarketravis.com

@@ -21,2 +21,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
{
"name": "tableexport",
"version": "3.2.3",
"version": "3.2.5",
"authors": [

@@ -5,0 +5,0 @@ "clarketm <travis.m.clarke@gmail.com>"

@@ -104,2 +104,22 @@ [![Build Status](https://travis-ci.org/clarketm/TableExport.svg?branch=master)](https://travis-ci.org/clarketm/TableExport)

TableExport supports additional methods (**update**, **reset** and **remove**) to control it after creation.
```js
/* Run plugin and save it to a variable */
var tables = $("table").tableExport();
```
```js
/* update */
tables.tableExport.update({
filename: "newFile" // pass in a new set of properties
});
/* reset */
tables.tableExport.reset(); // useful for a dynamically altered table
/* remove */
tables.tableExport.remove(); // removes caption and buttons
```
### Properties

@@ -111,3 +131,8 @@

### Methods
A table of available methods and their usage can be found here:
##### [www.clarketravis.com/tableexport](http://www.clarketravis.com/tableexport/#methods)
### Settings

@@ -114,0 +139,0 @@

/*!
* TableExport.js v3.2.3 (http://www.clarketravis.com)
* Copyright 2015 Travis Clarke
* TableExport.js v3.2.5 (http://www.clarketravis.com)
* Copyright 2016 Travis Clarke
* Licensed under the MIT license

@@ -12,5 +12,6 @@ */

$.fn.tableExport = function (options) {
$.fn.tableExport = function (options, isUpdate) {
var settings = $.extend({}, $.fn.tableExport.defaults, options),
var $this = this,
settings = isUpdate ? options : $.extend({}, $.fn.tableExport.defaults, options),
rowD = $.fn.tableExport.rowDel,

@@ -31,7 +32,8 @@ ignoreRows = settings.ignoreRows instanceof Array ? settings.ignoreRows : [settings.ignoreRows],

this.each(function () {
var $el = $(this),
$rows = $el.find('tbody').find('tr'),
$this.each(function () {
var $el = $(this);
if (isUpdate) { $el.find('caption:not(.head)').remove();}
var $rows = $el.find('tbody').find('tr'),
$rows = settings.headings ? $rows.add($el.find('thead>tr')) : $rows,
$rows = settings.footers ? $rows.add($el.find('tfoor>tr')) : $rows,
$rows = settings.footers ? $rows.add($el.find('tfoot>tr')) : $rows,
thAdj = settings.headings ? $el.find('thead>tr').length : 0,

@@ -46,3 +48,2 @@ fileName = settings.fileName === "id" ? ($el.attr('id') ? $el.attr('id') : $.fn.tableExport.defaultFileName) : settings.fileName,

if (!!~ignoreCols.indexOf(i) || $(val).is(ignoreCSS)) { return;}
console.log($(val).is(ignoreCSS));
return $(val).text();

@@ -154,2 +155,18 @@ }).get()];

});
$.fn.tableExport.update = function (options) {
$this.tableExport($.extend({}, settings, options), true)
};
$.fn.tableExport.reset = function (options) {
$this.tableExport(settings, true)
};
$.fn.tableExport.remove = function (options) {
$this.each(function () {
$(this).find('caption:not(.head)').remove();
});
};
return $this;
};

@@ -156,0 +173,0 @@

/*!
* TableExport.js v3.2.3 (http://www.clarketravis.com)
* Copyright 2015 Travis Clarke
* TableExport.js v3.2.5 (http://www.clarketravis.com)
* Copyright 2016 Travis Clarke
* Licensed under the MIT license
*/
!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={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){a.s.r>i&&(a.s.r=i),a.s.c>r&&(a.s.c=r),a.e.r<i&&(a.e.r=i),a.e.c<r&&(a.e.c=r);var f={v:t[i][r]};if(null!=f.v){var l=XLSX.utils.encode_cell({c:r,r:i});"number"==typeof f.v?f.t="n":"boolean"==typeof f.v?f.t="b":f.v instanceof Date?(f.t="n",f.z=XLSX.SSF._table[14],f.v=o(f.v)):f.t="s",n[l]=f}}return a.s.c<1e7&&(n["!ref"]=XLSX.utils.encode_range(a)),n}function i(){return this instanceof i?(this.SheetNames=[],void(this.Sheets={})):new i}function r(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}function f(t,e,n,o){if(".xlsx"===o){var f=new i,s=a(t);f.SheetNames.push(n),f.Sheets[n]=s;var x={bookType:"xlsx",bookSST:!1,type:"binary"},p=XLSX.write(f,x);t=r(p)}saveAs(new Blob([t],{type:e+";"+l.fn.tableExport.charset}),n+o)}var l=t.jQuery;l.fn.tableExport=function(t){var e,o,a,i=l.extend({},l.fn.tableExport.defaults,t),r=l.fn.tableExport.rowDel,s=i.ignoreRows instanceof Array?i.ignoreRows:[i.ignoreRows],x=i.ignoreCols instanceof Array?i.ignoreCols:[i.ignoreCols],p=i.ignoreCSS instanceof Array?i.ignoreCSS.join(", "):i.ignoreCSS;i.bootstrap?(e=l.fn.tableExport.bootstrap[0]+" ",o=l.fn.tableExport.bootstrap[1]+" ",a=l.fn.tableExport.bootstrap[2]+" "):(e=l.fn.tableExport.defaultButton+" ",o=a=""),this.each(function(){function t(t){var e=u.find("caption:not(.head)");e.length?e.append(t):u.prepend('<caption class="'+a+i.position+'">'+t+"</caption>")}function f(n,a,i){var r="<button data-fileblob='"+n+"' class='"+e+o+i+"'>"+a+"</button>";t(r)}var u=l(this),b=u.find("tbody").find("tr"),b=i.headings?b.add(u.find("thead>tr")):b,b=i.footers?b.add(u.find("tfoor>tr")):b,d=i.headings?u.find("thead>tr").length:0,c="id"===i.fileName?u.attr("id")?u.attr("id"):l.fn.tableExport.defaultFileName:i.fileName,E={xlsx:function(t,e){var o=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return[n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:(console.log(l(e).is(p)),l(e).text())}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),i=l.fn.tableExport.xlsx.buttonContent,r=l.fn.tableExport.xlsx.defaultClass;f(a,i,r)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),r=l.fn.tableExport.xls.buttonContent,u=l.fn.tableExport.xls.defaultClass;f(i,r,u)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),r=l.fn.tableExport.csv.buttonContent,u=l.fn.tableExport.csv.defaultClass;f(i,r,u)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=b.map(function(t,e){if(!~s.indexOf(t-d)&&!l(e).is(p)){var n=l(e).find("th, td");return n.map(function(t,e){return~x.indexOf(t)||l(e).is(p)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),r=l.fn.tableExport.txt.buttonContent,u=l.fn.tableExport.txt.defaultClass;f(i,r,u)}};i.formats.forEach(function(t){E[t](r,c)})}),l("button[data-fileblob]").off("click").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)})},l.fn.tableExport.defaults={headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore"},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&#38;","<":"&#60;",">":"&#62;","'":"&#39;","/":"&#47"}}(window);
!function(t,e){function n(t){return String(t).replace(/[&<>'\/]/g,function(t){return l.fn.tableExport.entityMap[t]})}function o(t,e){e&&(t+=1462);var n=Date.parse(t);return(n-new Date(Date.UTC(1899,11,30)))/864e5}function a(t,e){for(var n={},a={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){a.s.r>i&&(a.s.r=i),a.s.c>r&&(a.s.c=r),a.e.r<i&&(a.e.r=i),a.e.c<r&&(a.e.c=r);var f={v:t[i][r]};if(null!=f.v){var l=XLSX.utils.encode_cell({c:r,r:i});"number"==typeof f.v?f.t="n":"boolean"==typeof f.v?f.t="b":f.v instanceof Date?(f.t="n",f.z=XLSX.SSF._table[14],f.v=o(f.v)):f.t="s",n[l]=f}}return a.s.c<1e7&&(n["!ref"]=XLSX.utils.encode_range(a)),n}function i(){return this instanceof i?(this.SheetNames=[],void(this.Sheets={})):new i}function r(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}function f(t,e,n,o){if(".xlsx"===o){var f=new i,s=a(t);f.SheetNames.push(n),f.Sheets[n]=s;var x={bookType:"xlsx",bookSST:!1,type:"binary"},p=XLSX.write(f,x);t=r(p)}saveAs(new Blob([t],{type:e+";"+l.fn.tableExport.charset}),n+o)}var l=t.jQuery;l.fn.tableExport=function(t,e){var o,a,i,r=this,s=e?t:l.extend({},l.fn.tableExport.defaults,t),x=l.fn.tableExport.rowDel,p=s.ignoreRows instanceof Array?s.ignoreRows:[s.ignoreRows],u=s.ignoreCols instanceof Array?s.ignoreCols:[s.ignoreCols],b=s.ignoreCSS instanceof Array?s.ignoreCSS.join(", "):s.ignoreCSS;return s.bootstrap?(o=l.fn.tableExport.bootstrap[0]+" ",a=l.fn.tableExport.bootstrap[1]+" ",i=l.fn.tableExport.bootstrap[2]+" "):(o=l.fn.tableExport.defaultButton+" ",a=i=""),r.each(function(){function t(t){var e=f.find("caption:not(.head)");e.length?e.append(t):f.prepend('<caption class="'+i+s.position+'">'+t+"</caption>")}function r(e,n,i){var r="<button data-fileblob='"+e+"' class='"+o+a+i+"'>"+n+"</button>";t(r)}var f=l(this);e&&f.find("caption:not(.head)").remove();var d=f.find("tbody").find("tr"),d=s.headings?d.add(f.find("thead>tr")):d,d=s.footers?d.add(f.find("tfoot>tr")):d,c=s.headings?f.find("thead>tr").length:0,E="id"===s.fileName?f.attr("id")?f.attr("id"):l.fn.tableExport.defaultFileName:s.fileName,m={xlsx:function(t,e){var o=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return[n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get()]}}).get(),a=n(JSON.stringify({data:o,fileName:e,mimeType:l.fn.tableExport.xlsx.mimeType,fileExtension:l.fn.tableExport.xlsx.fileExtension})),i=l.fn.tableExport.xlsx.buttonContent,f=l.fn.tableExport.xlsx.defaultClass;r(a,i,f)},xls:function(t,e){var o=l.fn.tableExport.xls.separator,a=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.xls.mimeType,fileExtension:l.fn.tableExport.xls.fileExtension})),f=l.fn.tableExport.xls.buttonContent,s=l.fn.tableExport.xls.defaultClass;r(i,f,s)},csv:function(t,e){var o=l.fn.tableExport.csv.separator,a=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.csv.mimeType,fileExtension:l.fn.tableExport.csv.fileExtension})),f=l.fn.tableExport.csv.buttonContent,s=l.fn.tableExport.csv.defaultClass;r(i,f,s)},txt:function(t,e){var o=l.fn.tableExport.txt.separator,a=d.map(function(t,e){if(!~p.indexOf(t-c)&&!l(e).is(b)){var n=l(e).find("th, td");return n.map(function(t,e){return~u.indexOf(t)||l(e).is(b)?void 0:l(e).text()}).get().join(o)}}).get().join(t),i=n(JSON.stringify({data:a,fileName:e,mimeType:l.fn.tableExport.txt.mimeType,fileExtension:l.fn.tableExport.txt.fileExtension})),f=l.fn.tableExport.txt.buttonContent,s=l.fn.tableExport.txt.defaultClass;r(i,f,s)}};s.formats.forEach(function(t){m[t](x,E)})}),l("button[data-fileblob]").off("click").on("click",function(){var t=l(this).data("fileblob"),e=t.data,n=t.fileName,o=t.mimeType,a=t.fileExtension;f(e,o,n,a)}),l.fn.tableExport.update=function(t){r.tableExport(l.extend({},s,t),!0)},l.fn.tableExport.reset=function(t){r.tableExport(s,!0)},l.fn.tableExport.remove=function(t){r.each(function(){l(this).find("caption:not(.head)").remove()})},r},l.fn.tableExport.defaults={headings:!0,footers:!0,formats:["xls","csv","txt"],fileName:"id",bootstrap:!0,position:"bottom",ignoreRows:null,ignoreCols:null,ignoreCSS:".tableexport-ignore"},l.fn.tableExport.charset="charset=utf-8",l.fn.tableExport.xlsx={defaultClass:"xlsx",buttonContent:"Export to xlsx",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",fileExtension:".xlsx"},l.fn.tableExport.xls={defaultClass:"xls",buttonContent:"Export to xls",separator:" ",mimeType:"application/vnd.ms-excel",fileExtension:".xls"},l.fn.tableExport.csv={defaultClass:"csv",buttonContent:"Export to csv",separator:",",mimeType:"application/csv",fileExtension:".csv"},l.fn.tableExport.txt={defaultClass:"txt",buttonContent:"Export to txt",separator:" ",mimeType:"text/plain",fileExtension:".txt"},l.fn.tableExport.defaultFileName="myDownload",l.fn.tableExport.defaultButton="button-default",l.fn.tableExport.bootstrap=["btn","btn-default","btn-toolbar"],l.fn.tableExport.rowDel="\r\n",l.fn.tableExport.entityMap={"&":"&#38;","<":"&#60;",">":"&#62;","'":"&#39;","/":"&#47"}}(window);

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc