datatables.net-buttons
Advanced tools
Comparing version 2.4.2 to 3.0.0
@@ -51,3 +51,3 @@ /*! | ||
} | ||
}(function( $, window, document, undefined ) { | ||
}(function( $, window, document ) { | ||
'use strict'; | ||
@@ -82,3 +82,3 @@ var DataTable = $.fn.dataTable; | ||
// Rebuild the collection with the new column structure if columns are reordered | ||
dt.on('column-reorder.dt' + conf.namespace, function (e, settings, details) { | ||
dt.on('column-reorder.dt' + conf.namespace, function () { | ||
dt.button(null, dt.button(null, node).node()).collectionRebuild([ | ||
@@ -163,3 +163,3 @@ { | ||
} | ||
}).on('column-reorder.dt' + conf.namespace, function (e, settings, details) { | ||
}).on('column-reorder.dt' + conf.namespace, function () { | ||
// Button has been removed from the DOM | ||
@@ -191,2 +191,6 @@ if (conf.destroying) { | ||
_columnText: function (dt, conf) { | ||
if (typeof conf.text === 'string') { | ||
return conf.text; | ||
} | ||
// Use DataTables' internal data structure until this is presented | ||
@@ -223,9 +227,11 @@ // is a public API. The other option is to use | ||
init: function (dt, button, conf) { | ||
conf._visOriginal = dt | ||
.columns() | ||
.indexes() | ||
.map(function (idx) { | ||
return dt.column(idx).visible(); | ||
}) | ||
.toArray(); | ||
// Use a private parameter on the column. This gets moved around with the | ||
// column if ColReorder changes the order | ||
dt.columns().every(function () { | ||
var init = this.init(); | ||
if (init.__visOriginal === undefined) { | ||
init.__visOriginal = this.visible(); | ||
} | ||
}); | ||
}, | ||
@@ -235,10 +241,5 @@ | ||
dt.columns().every(function (i) { | ||
// Take into account that ColReorder might have disrupted our | ||
// indexes | ||
var idx = | ||
dt.colReorder && dt.colReorder.transpose | ||
? dt.colReorder.transpose(i, 'toOriginal') | ||
: i; | ||
var init = this.init(); | ||
this.visible(conf._visOriginal[idx]); | ||
this.visible(init.__visOriginal); | ||
}); | ||
@@ -245,0 +246,0 @@ } |
@@ -5,2 +5,2 @@ /*! | ||
*/ | ||
!function(t){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(n){return t(n,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(n,e){e.fn.dataTable||require("datatables.net")(n,e),e.fn.dataTable.Buttons||require("datatables.net-buttons")(n,e)},"undefined"==typeof window?module.exports=function(n,e){return n=n||window,e=e||o(n),i(n,e),t(e,0,n.document)}:(i(window,o),module.exports=t(o,window,window.document))):t(jQuery,window,document)}(function(n,e,t,l){"use strict";var o=n.fn.dataTable;return n.extend(o.ext.buttons,{colvis:function(o,i){var l=null,n={extend:"collection",init:function(n,e){l=e},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}]};return o.on("column-reorder.dt"+i.namespace,function(n,e,t){o.button(null,o.button(null,l).node()).collectionRebuild([{extend:"columnsToggle",columns:i.columns,columnText:i.columnText}])}),n},columnsToggle:function(n,e){return n.columns(e.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:e.columnText}}).toArray()},columnToggle:function(n,e){return{extend:"columnVisibility",columns:e.columns,columnText:e.columnText}},columnsVisibility:function(n,e){return n.columns(e.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:e.visibility,columnText:e.columnText}}).toArray()},columnVisibility:{columns:l,text:function(n,e,t){return t._columnText(n,t)},className:"buttons-columnVisibility",action:function(n,e,t,o){var e=e.columns(o.columns),i=e.visible();e.visible(o.visibility!==l?o.visibility:!(i.length&&i[0]))},init:function(o,n,i){var l=this;n.attr("data-cv-idx",i.columns),o.on("column-visibility.dt"+i.namespace,function(n,e){e.bDestroying||e.nTable!=o.settings()[0].nTable||l.active(o.column(i.columns).visible())}).on("column-reorder.dt"+i.namespace,function(n,e,t){i.destroying||1===o.columns(i.columns).count()&&(l.text(i._columnText(o,i)),l.active(o.column(i.columns).visible()))}),this.active(o.column(i.columns).visible())},destroy:function(n,e,t){n.off("column-visibility.dt"+t.namespace).off("column-reorder.dt"+t.namespace)},_columnText:function(n,e){var t=n.column(e.columns).index(),o=n.settings()[0].aoColumns[t].sTitle;return o=(o=o||n.column(t).header().innerHTML).replace(/\n/g," ").replace(/<br\s*\/?>/gi," ").replace(/<select(.*?)<\/select>/g,"").replace(/<!\-\-.*?\-\->/g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),e.columnText?e.columnText(n,t,o):o}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(e,n,t){t._visOriginal=e.columns().indexes().map(function(n){return e.column(n).visible()}).toArray()},action:function(n,e,t,o){e.columns().every(function(n){n=e.colReorder&&e.colReorder.transpose?e.colReorder.transpose(n,"toOriginal"):n;this.visible(o._visOriginal[n])})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,e,t,o){e.columns(o.show).visible(!0,!1),e.columns(o.hide).visible(!1,!1),e.columns.adjust()},show:[],hide:[]}}),o}); | ||
!function(e){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(n){return e(n,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(n,t){t.fn.dataTable||require("datatables.net")(n,t),t.fn.dataTable.Buttons||require("datatables.net-buttons")(n,t)},"undefined"==typeof window?module.exports=function(n,t){return n=n||window,t=t||o(n),i(n,t),e(t,0,n.document)}:(i(window,o),module.exports=e(o,window,window.document))):e(jQuery,window,document)}(function(n,t,e){"use strict";var o=n.fn.dataTable;return n.extend(o.ext.buttons,{colvis:function(n,t){var e=null,o={extend:"collection",init:function(n,t){e=t},text:function(n){return n.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",closeButton:!1,buttons:[{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}]};return n.on("column-reorder.dt"+t.namespace,function(){n.button(null,n.button(null,e).node()).collectionRebuild([{extend:"columnsToggle",columns:t.columns,columnText:t.columnText}])}),o},columnsToggle:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnToggle",columns:n,columnText:t.columnText}}).toArray()},columnToggle:function(n,t){return{extend:"columnVisibility",columns:t.columns,columnText:t.columnText}},columnsVisibility:function(n,t){return n.columns(t.columns).indexes().map(function(n){return{extend:"columnVisibility",columns:n,visibility:t.visibility,columnText:t.columnText}}).toArray()},columnVisibility:{columns:void 0,text:function(n,t,e){return e._columnText(n,e)},className:"buttons-columnVisibility",action:function(n,t,e,o){var t=t.columns(o.columns),i=t.visible();t.visible(void 0!==o.visibility?o.visibility:!(i.length&&i[0]))},init:function(e,n,o){var i=this;n.attr("data-cv-idx",o.columns),e.on("column-visibility.dt"+o.namespace,function(n,t){t.bDestroying||t.nTable!=e.settings()[0].nTable||i.active(e.column(o.columns).visible())}).on("column-reorder.dt"+o.namespace,function(){o.destroying||1===e.columns(o.columns).count()&&(i.text(o._columnText(e,o)),i.active(e.column(o.columns).visible()))}),this.active(e.column(o.columns).visible())},destroy:function(n,t,e){n.off("column-visibility.dt"+e.namespace).off("column-reorder.dt"+e.namespace)},_columnText:function(n,t){var e,o;return"string"==typeof t.text?t.text:(e=n.column(t.columns).index(),o=(o=(o=n.settings()[0].aoColumns[e].sTitle)||n.column(e).header().innerHTML).replace(/\n/g," ").replace(/<br\s*\/?>/gi," ").replace(/<select(.*?)<\/select>/g,"").replace(/<!\-\-.*?\-\->/g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),t.columnText?t.columnText(n,e,o):o)}},colvisRestore:{className:"buttons-colvisRestore",text:function(n){return n.i18n("buttons.colvisRestore","Restore visibility")},init:function(n,t,e){n.columns().every(function(){var n=this.init();void 0===n.__visOriginal&&(n.__visOriginal=this.visible())})},action:function(n,t,e,o){t.columns().every(function(n){var t=this.init();this.visible(t.__visOriginal)})}},colvisGroup:{className:"buttons-colvisGroup",action:function(n,t,e,o){t.columns(o.show).visible(!0,!1),t.columns(o.hide).visible(!1,!1),t.columns.adjust()},show:[],hide:[]}}),o}); |
@@ -30,3 +30,3 @@ /*! | ||
if (typeof window === 'undefined') { | ||
module.exports = function (root, $, jszip, pdfmake) { | ||
module.exports = function (root, $) { | ||
if ( ! root ) { | ||
@@ -43,3 +43,3 @@ // CommonJS environments without a window global must pass a | ||
cjsRequires( root, $ ); | ||
return factory( $, root, root.document, jszip, pdfmake ); | ||
return factory( $, root, root.document ); | ||
}; | ||
@@ -56,3 +56,3 @@ } | ||
} | ||
}(function( $, window, document, jszip, pdfmake, undefined ) { | ||
}(function( $, window, document ) { | ||
'use strict'; | ||
@@ -100,3 +100,4 @@ var DataTable = $.fn.dataTable; | ||
typeof view === 'undefined' || | ||
(typeof navigator !== 'undefined' && /MSIE [1-9]\./.test(navigator.userAgent)) | ||
(typeof navigator !== 'undefined' && | ||
/MSIE [1-9]\./.test(navigator.userAgent)) | ||
) { | ||
@@ -161,3 +162,5 @@ return; | ||
) { | ||
return new Blob([String.fromCharCode(0xfeff), blob], { type: blob.type }); | ||
return new Blob([String.fromCharCode(0xfeff), blob], { | ||
type: blob.type | ||
}); | ||
} | ||
@@ -176,7 +179,13 @@ return blob; | ||
dispatch_all = function () { | ||
dispatch(filesaver, 'writestart progress write writeend'.split(' ')); | ||
dispatch( | ||
filesaver, | ||
'writestart progress write writeend'.split(' ') | ||
); | ||
}, | ||
// on any filesys errors revert to saving with object URLs | ||
fs_error = function () { | ||
if ((is_chrome_ios || (force && is_safari)) && view.FileReader) { | ||
if ( | ||
(is_chrome_ios || (force && is_safari)) && | ||
view.FileReader | ||
) { | ||
// Safari doesn't allow downloading of blob urls | ||
@@ -187,3 +196,6 @@ var reader = new FileReader(); | ||
? reader.result | ||
: reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;'); | ||
: reader.result.replace( | ||
/^data:[^;]*;/, | ||
'data:attachment/file;' | ||
); | ||
var popup = view.open(url, '_blank'); | ||
@@ -236,3 +248,7 @@ if (!popup) view.location.href = url; | ||
saveAs = function (blob, name, no_auto_bom) { | ||
return new FileSaver(blob, name || blob.name || 'download', no_auto_bom); | ||
return new FileSaver( | ||
blob, | ||
name || blob.name || 'download', | ||
no_auto_bom | ||
); | ||
}; | ||
@@ -302,3 +318,7 @@ // IE 10+ (native saveAs) | ||
var _newLine = function (config) { | ||
return config.newline ? config.newline : navigator.userAgent.match(/Windows/) ? '\r\n' : '\n'; | ||
return config.newline | ||
? config.newline | ||
: navigator.userAgent.match(/Windows/) | ||
? '\r\n' | ||
: '\n'; | ||
}; | ||
@@ -332,3 +352,5 @@ | ||
s += boundary | ||
? boundary + ('' + a[i]).replace(reBoundary, escapeChar + boundary) + boundary | ||
? boundary + | ||
('' + a[i]).replace(reBoundary, escapeChar + boundary) + | ||
boundary | ||
: a[i]; | ||
@@ -340,6 +362,32 @@ } | ||
var header = config.header ? join(data.header) + newLine : ''; | ||
var footer = config.footer && data.footer ? newLine + join(data.footer) : ''; | ||
var header = ''; | ||
var footer = ''; | ||
var body = []; | ||
if (config.header) { | ||
header = | ||
data.headerStructure | ||
.map(function (row) { | ||
return join( | ||
row.map(function (cell) { | ||
return cell ? cell.title : ''; | ||
}) | ||
); | ||
}) | ||
.join(newLine) + newLine; | ||
} | ||
if (config.footer && data.footer) { | ||
footer = | ||
data.footerStructure | ||
.map(function (row) { | ||
return join( | ||
row.map(function (cell) { | ||
return cell ? cell.title : ''; | ||
}) | ||
); | ||
}) | ||
.join(newLine) + newLine; | ||
} | ||
for (var i = 0, ien = data.body.length; i < ien; i++) { | ||
@@ -401,3 +449,5 @@ body.push(join(data.body[i])); | ||
var _ieExcel; | ||
} catch (t) {} | ||
} catch (t) { | ||
// noop | ||
} | ||
@@ -469,3 +519,5 @@ /** | ||
if (str.indexOf('<?xml') === -1) { | ||
str = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + str; | ||
str = | ||
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + | ||
str; | ||
} | ||
@@ -620,3 +672,3 @@ | ||
'<numFmts count="6">' + | ||
'<numFmt numFmtId="164" formatCode="#,##0.00_- [$$-45C]"/>' + | ||
'<numFmt numFmtId="164" formatCode="[$$-409]#,##0.00;-[$$-409]#,##0.00"/>' + | ||
'<numFmt numFmtId="165" formatCode=""£"#,##0.00"/>' + | ||
@@ -854,2 +906,21 @@ '<numFmt numFmtId="166" formatCode="[$€-2] #,##0.00"/>' + | ||
var _excelMergeCells = function (rels, row, column, rowspan, colspan) { | ||
var mergeCells = $('mergeCells', rels); | ||
mergeCells[0].appendChild( | ||
_createNode(rels, 'mergeCell', { | ||
attr: { | ||
ref: | ||
createCellPos(column) + | ||
row + | ||
':' + | ||
createCellPos(column + colspan - 1) + | ||
(row + rowspan - 1) | ||
} | ||
}) | ||
); | ||
mergeCells.attr('count', parseFloat(mergeCells.attr('count')) + 1); | ||
}; | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -869,6 +940,3 @@ * Buttons | ||
action: function (e, dt, button, config) { | ||
this.processing(true); | ||
var that = this; | ||
action: function (e, dt, button, config, cb) { | ||
var exportData = _exportData(dt, config); | ||
@@ -903,3 +971,5 @@ var info = dt.buttons.exportInfo(config); | ||
var textarea = $('<textarea readonly/>').val(output).appendTo(hiddenDiv); | ||
var textarea = $('<textarea readonly/>') | ||
.val(output) | ||
.appendTo(hiddenDiv); | ||
@@ -930,6 +1000,8 @@ // For browsers that support the copy execCommand, try to use it | ||
this.processing(false); | ||
cb(); | ||
return; | ||
} | ||
} catch (t) {} | ||
} catch (t) { | ||
// noop | ||
} | ||
} | ||
@@ -948,3 +1020,7 @@ | ||
dt.buttons.info(dt.i18n('buttons.copyTitle', 'Copy to clipboard'), message, 0); | ||
dt.buttons.info( | ||
dt.i18n('buttons.copyTitle', 'Copy to clipboard'), | ||
message, | ||
0 | ||
); | ||
@@ -970,3 +1046,3 @@ // Select the text so when the user activates their system clipboard | ||
close(); | ||
that.processing(false); | ||
cb(); | ||
} | ||
@@ -976,6 +1052,8 @@ }) | ||
close(); | ||
that.processing(false); | ||
cb(); | ||
}); | ||
}, | ||
async: 100, | ||
exportOptions: {}, | ||
@@ -1014,5 +1092,3 @@ | ||
action: function (e, dt, button, config) { | ||
this.processing(true); | ||
action: function (e, dt, button, config, cb) { | ||
// Set the text | ||
@@ -1044,7 +1120,13 @@ var output = _exportData(dt, config).str; | ||
_saveAs(new Blob([output], { type: 'text/csv' + charset }), info.filename, true); | ||
_saveAs( | ||
new Blob([output], { type: 'text/csv' + charset }), | ||
info.filename, | ||
true | ||
); | ||
this.processing(false); | ||
cb(); | ||
}, | ||
async: 100, | ||
filename: '*', | ||
@@ -1088,6 +1170,3 @@ | ||
action: function (e, dt, button, config) { | ||
this.processing(true); | ||
var that = this; | ||
action: function (e, dt, button, config, cb) { | ||
var rowPos = 0; | ||
@@ -1144,3 +1223,4 @@ var dataStartRow, dataEndRow; | ||
var originalContent = row[i]; | ||
row[i] = typeof row[i].trim === 'function' ? row[i].trim() : row[i]; | ||
row[i] = | ||
typeof row[i].trim === 'function' ? row[i].trim() : row[i]; | ||
@@ -1154,3 +1234,7 @@ // Special number formatting options | ||
// assumed to be a number | ||
if (row[i].match && !row[i].match(/^0\d+/) && row[i].match(special.match)) { | ||
if ( | ||
row[i].match && | ||
!row[i].match(/^0\d+/) && | ||
row[i].match(special.match) | ||
) { | ||
var val = row[i].replace(/[^\d\.\-]/g, ''); | ||
@@ -1193,5 +1277,9 @@ | ||
// String output - replace non standard characters for text output | ||
/*eslint no-control-regex: "off"*/ | ||
var text = !originalContent.replace | ||
? originalContent | ||
: originalContent.replace(/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, ''); | ||
: originalContent.replace( | ||
/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, | ||
'' | ||
); | ||
@@ -1226,2 +1314,27 @@ cell = _createNode(rels, 'c', { | ||
var addHeader = function (structure) { | ||
structure.forEach(function (row) { | ||
addRow( | ||
row.map(function (cell) { | ||
return cell ? cell.title : ''; | ||
}), | ||
rowPos | ||
); | ||
$('row:last c', rels).attr('s', '2'); // bold | ||
// Add any merge cells | ||
row.forEach(function (cell, columnCounter) { | ||
if (cell && (cell.colSpan > 1 || cell.rowSpan > 1)) { | ||
_excelMergeCells( | ||
rels, | ||
rowPos, | ||
columnCounter, | ||
cell.rowSpan, | ||
cell.colSpan | ||
); | ||
} | ||
}); | ||
}); | ||
}; | ||
if (config.customizeData) { | ||
@@ -1231,16 +1344,2 @@ config.customizeData(data); | ||
var mergeCells = function (row, colspan) { | ||
var mergeCells = $('mergeCells', rels); | ||
mergeCells[0].appendChild( | ||
_createNode(rels, 'mergeCell', { | ||
attr: { | ||
ref: 'A' + row + ':' + createCellPos(colspan) + row | ||
} | ||
}) | ||
); | ||
mergeCells.attr('count', parseFloat(mergeCells.attr('count')) + 1); | ||
$('row:eq(' + (row - 1) + ') c', rels).attr('s', '51'); // centre | ||
}; | ||
// Title and top messages | ||
@@ -1250,3 +1349,4 @@ var exportInfo = dt.buttons.exportInfo(config); | ||
addRow([exportInfo.title], rowPos); | ||
mergeCells(rowPos, data.header.length - 1); | ||
_excelMergeCells(rels, rowPos, 0, 1, data.header.length); | ||
$('row:last c', rels).attr('s', '51'); // centre | ||
} | ||
@@ -1256,9 +1356,8 @@ | ||
addRow([exportInfo.messageTop], rowPos); | ||
mergeCells(rowPos, data.header.length - 1); | ||
_excelMergeCells(rels, rowPos, 0, 1, data.header.length); | ||
} | ||
// Table itself | ||
// Table header | ||
if (config.header) { | ||
addRow(data.header, rowPos); | ||
$('row:last c', rels).attr('s', '2'); // bold | ||
addHeader(data.headerStructure); | ||
} | ||
@@ -1268,2 +1367,3 @@ | ||
// Table body | ||
for (var n = 0, ie = data.body.length; n < ie; n++) { | ||
@@ -1275,5 +1375,5 @@ addRow(data.body[n], rowPos); | ||
// Table footer | ||
if (config.footer && data.footer) { | ||
addRow(data.footer, rowPos); | ||
$('row:last c', rels).attr('s', '2'); // bold | ||
addHeader(data.footerStructure); | ||
} | ||
@@ -1284,3 +1384,3 @@ | ||
addRow([exportInfo.messageBottom], rowPos); | ||
mergeCells(rowPos, data.header.length - 1); | ||
_excelMergeCells(rels, rowPos, 0, 1, data.header.length); | ||
} | ||
@@ -1358,3 +1458,4 @@ | ||
type: 'blob', | ||
mimeType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | ||
mimeType: | ||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' | ||
}; | ||
@@ -1377,3 +1478,3 @@ | ||
_saveAs(blob, filename); | ||
that.processing(false); | ||
cb(); | ||
}); | ||
@@ -1384,6 +1485,8 @@ } | ||
_saveAs(zip.generate(zipConfig), filename); | ||
this.processing(false); | ||
cb(); | ||
} | ||
}, | ||
async: 100, | ||
filename: '*', | ||
@@ -1397,3 +1500,3 @@ | ||
footer: false, | ||
footer: true, | ||
@@ -1427,6 +1530,3 @@ title: '*', | ||
action: function (e, dt, button, config) { | ||
this.processing(true); | ||
var that = this; | ||
action: function (e, dt, button, config, cb) { | ||
var data = dt.buttons.exportData(config.exportOptions); | ||
@@ -1437,10 +1537,16 @@ var info = dt.buttons.exportInfo(config); | ||
if (config.header) { | ||
rows.push( | ||
$.map(data.header, function (d) { | ||
return { | ||
text: typeof d === 'string' ? d : d + '', | ||
style: 'tableHeader' | ||
}; | ||
}) | ||
); | ||
data.headerStructure.forEach(function (row) { | ||
rows.push( | ||
row.map(function (cell) { | ||
return cell | ||
? { | ||
text: cell.title, | ||
colSpan: cell.colspan, | ||
rowSpan: cell.rowspan, | ||
style: 'tableHeader' | ||
} | ||
: {}; | ||
}) | ||
); | ||
}); | ||
} | ||
@@ -1450,9 +1556,10 @@ | ||
rows.push( | ||
$.map(data.body[i], function (d) { | ||
if (d === null || d === undefined) { | ||
d = ''; | ||
} | ||
data.body[i].map(function (d) { | ||
return { | ||
text: typeof d === 'string' ? d : d + '', | ||
style: i % 2 ? 'tableBodyEven' : 'tableBodyOdd' | ||
text: | ||
d === null || d === undefined | ||
? '' | ||
: typeof d === 'string' | ||
? d | ||
: d.toString() | ||
}; | ||
@@ -1463,11 +1570,17 @@ }) | ||
if (config.footer && data.footer) { | ||
rows.push( | ||
$.map(data.footer, function (d) { | ||
return { | ||
text: typeof d === 'string' ? d : d + '', | ||
style: 'tableFooter' | ||
}; | ||
}) | ||
); | ||
if (config.footer) { | ||
data.footerStructure.forEach(function (row) { | ||
rows.push( | ||
row.map(function (cell) { | ||
return cell | ||
? { | ||
text: cell.title, | ||
colSpan: cell.colspan, | ||
rowSpan: cell.rowspan, | ||
style: 'tableHeader' | ||
} | ||
: {}; | ||
}) | ||
); | ||
}); | ||
} | ||
@@ -1480,7 +1593,39 @@ | ||
{ | ||
style: 'table', | ||
table: { | ||
headerRows: 1, | ||
headerRows: data.headerStructure.length, | ||
footerRows: data.footerStructure.length, // Used for styling, doesn't do anything in pdfmake | ||
body: rows | ||
}, | ||
layout: 'noBorders' | ||
layout: { | ||
hLineWidth: function (i, node) { | ||
if (i === 0 || i === node.table.body.length) { | ||
return 0; | ||
} | ||
return 0.5; | ||
}, | ||
vLineWidth: function () { | ||
return 0; | ||
}, | ||
hLineColor: function (i, node) { | ||
return i === node.table.headerRows || | ||
i === | ||
node.table.body.length - | ||
node.table.footerRows | ||
? '#333' | ||
: '#ddd'; | ||
}, | ||
fillColor: function (rowIndex) { | ||
if (rowIndex < data.headerStructure.length) { | ||
return '#fff'; | ||
} | ||
return rowIndex % 2 === 0 ? '#f3f3f3' : null; | ||
}, | ||
paddingTop: function () { | ||
return 5; | ||
}, | ||
paddingBottom: function () { | ||
return 5; | ||
} | ||
} | ||
} | ||
@@ -1492,19 +1637,14 @@ ], | ||
fontSize: 11, | ||
color: 'white', | ||
fillColor: '#2d4154', | ||
alignment: 'center' | ||
}, | ||
tableBodyEven: {}, | ||
tableBodyOdd: { | ||
fillColor: '#f3f3f3' | ||
}, | ||
tableFooter: { | ||
bold: true, | ||
fontSize: 11, | ||
color: 'white', | ||
fillColor: '#2d4154' | ||
fontSize: 11 | ||
}, | ||
table: { | ||
margin: [0, 5, 0, 5] | ||
}, | ||
title: { | ||
alignment: 'center', | ||
fontSize: 15 | ||
fontSize: 13 | ||
}, | ||
@@ -1555,5 +1695,7 @@ message: {} | ||
this.processing(false); | ||
cb(); | ||
}, | ||
async: 100, | ||
title: '*', | ||
@@ -1569,7 +1711,11 @@ | ||
pageSize: 'A4', | ||
// This isn't perfect, but it is close | ||
pageSize: | ||
navigator.language === 'en-US' || navigator.language === 'en-CA' | ||
? 'LETTER' | ||
: 'A4', | ||
header: true, | ||
footer: false, | ||
footer: true, | ||
@@ -1576,0 +1722,0 @@ messageTop: '*', |
@@ -8,2 +8,2 @@ /*! | ||
*/ | ||
!function(n){var r,a;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(t){return n(t,window,document)}):"object"==typeof exports?(r=require("jquery"),a=function(t,e){e.fn.dataTable||require("datatables.net")(t,e),e.fn.dataTable.Buttons||require("datatables.net-buttons")(t,e)},"undefined"==typeof window?module.exports=function(t,e,o,l){return t=t||window,e=e||r(t),a(t,e),n(e,t,t.document)}:(a(window,r),module.exports=n(r,window,window.document))):n(jQuery,window,document)}(function(C,T,y,t,e,k){"use strict";var o,l,n=C.fn.dataTable;function S(){return o||T.JSZip}function s(){return l||T.pdfMake}n.Buttons.pdfMake=function(t){if(!t)return s();l=t},n.Buttons.jszip=function(t){if(!t)return S();o=t};function N(t){var e="Sheet1";return e=t.sheetName?t.sheetName.replace(/[\[\]\*\/\\\?\:]/g,""):e}function u(t,e){for(var o=c(e),l=t.buttons.exportData(e.exportOptions),n=e.fieldBoundary,r=e.fieldSeparator,a=new RegExp(n,"g"),d=e.escapeChar!==k?e.escapeChar:"\\",p=function(t){for(var e="",o=0,l=t.length;o<l;o++)0<o&&(e+=r),e+=n?n+(""+t[o]).replace(a,d+n)+n:t[o];return e},t=e.header?p(l.header)+o:"",e=e.footer&&l.footer?o+p(l.footer):"",i=[],s=0,f=l.body.length;s<f;s++)i.push(p(l.body[s]));return{str:t+i.join(o)+e,rows:i.length}}function f(){var t;return-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")&&-1===navigator.userAgent.indexOf("Opera")&&!!((t=navigator.userAgent.match(/AppleWebKit\/(\d+\.\d+)/))&&1<t.length&&+t[1]<603.1)}var O=function(d){var p,i,s,f,m,y,e,u,c,l,t;if(!(void 0===d||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent)))return t=d.document,p=function(){return d.URL||d.webkitURL||d},i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),s="download"in i,f=/constructor/i.test(d.HTMLElement)||d.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent),y=function(t){(d.setImmediate||d.setTimeout)(function(){throw t},0)},e=4e4,u=function(t){setTimeout(function(){"string"==typeof t?p().revokeObjectURL(t):t.remove()},e)},c=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},t=(l=function(t,o,e){e||(t=c(t));var l,n,r=this,e="application/octet-stream"===t.type,a=function(){for(var t=r,e="writestart progress write writeend".split(" "),o=void 0,l=(e=[].concat(e)).length;l--;){var n=t["on"+e[l]];if("function"==typeof n)try{n.call(t,o||t)}catch(t){y(t)}}};r.readyState=r.INIT,s?(l=p().createObjectURL(t),setTimeout(function(){var t,e;i.href=l,i.download=o,t=i,e=new MouseEvent("click"),t.dispatchEvent(e),a(),u(l),r.readyState=r.DONE})):(m||e&&f)&&d.FileReader?((n=new FileReader).onloadend=function(){var t=m?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");d.open(t,"_blank")||(d.location.href=t),t=k,r.readyState=r.DONE,a()},n.readAsDataURL(t),r.readyState=r.INIT):(l=l||p().createObjectURL(t),!e&&d.open(l,"_blank")||(d.location.href=l),r.readyState=r.DONE,a(),u(l))}).prototype,"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,o){return e=e||t.name||"download",o||(t=c(t)),navigator.msSaveOrOpenBlob(t,e)}:(t.abort=function(){},t.readyState=t.INIT=0,t.WRITING=1,t.DONE=2,t.error=t.onwritestart=t.onprogress=t.onwrite=t.onabort=t.onerror=t.onwriteend=null,function(t,e,o){return new l(t,e||t.name||"download",o)})}("undefined"!=typeof self&&self||void 0!==T&&T||this.content),c=(n.fileSave=O,function(t){return t.newline||(navigator.userAgent.match(/Windows/)?"\r\n":"\n")});function z(t){for(var e="A".charCodeAt(0),o="Z".charCodeAt(0)-e+1,l="";0<=t;)l=String.fromCharCode(t%o+e)+l,t=Math.floor(t/o)-1;return l}try{var D,A=new XMLSerializer}catch(t){}function E(t,e,o){var l=t.createElement(e);return o&&(o.attr&&C(l).attr(o.attr),o.children&&C.each(o.children,function(t,e){l.appendChild(e)}),null!==o.text&&o.text!==k&&l.appendChild(t.createTextNode(o.text))),l}var _={"_rels/.rels":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>',"xl/_rels/workbook.xml.rels":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>',"[Content_Types].xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml" /><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="jpeg" ContentType="image/jpeg" /><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" /><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" /><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" /></Types>',"xl/workbook.xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="5" lowestEdited="5" rupBuild="24816"/><workbookPr showInkAnnotation="0" autoCompressPictures="0"/><bookViews><workbookView xWindow="0" yWindow="0" windowWidth="25600" windowHeight="19020" tabRatio="500"/></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets><definedNames/></workbook>',"xl/worksheets/sheet1.xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><sheetData/><mergeCells count="0"/></worksheet>',"xl/styles.xml":'<?xml version="1.0" encoding="UTF-8"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><numFmts count="6"><numFmt numFmtId="164" formatCode="#,##0.00_- [$$-45C]"/><numFmt numFmtId="165" formatCode=""£"#,##0.00"/><numFmt numFmtId="166" formatCode="[$€-2] #,##0.00"/><numFmt numFmtId="167" formatCode="0.0%"/><numFmt numFmtId="168" formatCode="#,##0;(#,##0)"/><numFmt numFmtId="169" formatCode="#,##0.00;(#,##0.00)"/></numFmts><fonts count="5" x14ac:knownFonts="1"><font><sz val="11" /><name val="Calibri" /></font><font><sz val="11" /><name val="Calibri" /><color rgb="FFFFFFFF" /></font><font><sz val="11" /><name val="Calibri" /><b /></font><font><sz val="11" /><name val="Calibri" /><i /></font><font><sz val="11" /><name val="Calibri" /><u /></font></fonts><fills count="6"><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="solid"><fgColor rgb="FFD9D9D9" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="FFD99795" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="ffc6efce" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="ffc6cfef" /><bgColor indexed="64" /></patternFill></fill></fills><borders count="2"><border><left /><right /><top /><bottom /><diagonal /></border><border diagonalUp="false" diagonalDown="false"><left style="thin"><color auto="1" /></left><right style="thin"><color auto="1" /></right><top style="thin"><color auto="1" /></top><bottom style="thin"><color auto="1" /></bottom><diagonal /></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" /></cellStyleXfs><cellXfs count="68"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="left"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="center"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="right"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="fill"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment textRotation="90"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment wrapText="1"/></xf><xf numFmtId="9" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="164" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="165" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="166" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="167" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="168" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="169" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="3" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="4" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="1" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="2" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="14" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0" /></cellStyles><dxfs count="0" /><tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4" /></styleSheet>'},R=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(t){return t/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(t){return t/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\-?\d+$/,style:65},{match:/^\-?\d+\.\d{2}$/,style:66},{match:/^\([\d,]+\)$/,style:61,fmt:function(t){return-1*t.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(t){return-1*t.replace(/[\(\)]/g,"")}},{match:/^\-?[\d,]+$/,style:63},{match:/^\-?[\d,]+\.\d{2}$/,style:64},{match:/^[\d]{4}\-[01][\d]\-[0123][\d]$/,style:67,fmt:function(t){return Math.round(25569+Date.parse(t)/864e5)}}];return n.ext.buttons.copyHtml5={className:"buttons-copy buttons-html5",text:function(t){return t.i18n("buttons.copy","Copy")},action:function(t,e,o,l){this.processing(!0);var n=this,r=u(e,l),a=e.buttons.exportInfo(l),d=c(l),p=r.str,i=C("<div/>").css({height:1,width:1,overflow:"hidden",position:"fixed",top:0,left:0}),d=(a.title&&(p=a.title+d+d+p),a.messageTop&&(p=a.messageTop+d+d+p),a.messageBottom&&(p=p+d+d+a.messageBottom),l.customize&&(p=l.customize(p,l,e)),C("<textarea readonly/>").val(p).appendTo(i));if(y.queryCommandSupported("copy")){i.appendTo(e.table().container()),d[0].focus(),d[0].select();try{var s=y.execCommand("copy");if(i.remove(),s)return e.buttons.info(e.i18n("buttons.copyTitle","Copy to clipboard"),e.i18n("buttons.copySuccess",{1:"Copied one row to clipboard",_:"Copied %d rows to clipboard"},r.rows),2e3),void this.processing(!1)}catch(t){}}function f(){m.off("click.buttons-copy"),C(y).off(".buttons-copy"),e.buttons.info(!1)}var a=C("<span>"+e.i18n("buttons.copyKeys","Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.")+"</span>").append(i),m=(e.buttons.info(e.i18n("buttons.copyTitle","Copy to clipboard"),a,0),d[0].focus(),d[0].select(),C(a).closest(".dt-button-info"));m.on("click.buttons-copy",f),C(y).on("keydown.buttons-copy",function(t){27===t.keyCode&&(f(),n.processing(!1))}).on("copy.buttons-copy cut.buttons-copy",function(){f(),n.processing(!1)})},exportOptions:{},fieldSeparator:"\t",fieldBoundary:"",header:!0,footer:!1,title:"*",messageTop:"*",messageBottom:"*"},n.ext.buttons.csvHtml5={bom:!1,className:"buttons-csv buttons-html5",available:function(){return T.FileReader!==k&&T.Blob},text:function(t){return t.i18n("buttons.csv","CSV")},action:function(t,e,o,l){this.processing(!0);var n=u(e,l).str,r=e.buttons.exportInfo(l),a=l.charset;l.customize&&(n=l.customize(n,l,e)),a=!1!==a?(a=a||y.characterSet||y.charset)&&";charset="+a:"",l.bom&&(n=String.fromCharCode(65279)+n),O(new Blob([n],{type:"text/csv"+a}),r.filename,!0),this.processing(!1)},filename:"*",extension:".csv",exportOptions:{},fieldSeparator:",",fieldBoundary:'"',escapeChar:'"',charset:null,header:!0,footer:!1},n.ext.buttons.excelHtml5={className:"buttons-excel buttons-html5",available:function(){return T.FileReader!==k&&S()!==k&&!f()&&A},text:function(t){return t.i18n("buttons.excel","Excel")},action:function(t,e,o,s){this.processing(!0);function l(t){return t=_[t],C.parseXML(t)}function n(t){m=E(u,"row",{attr:{r:f=y+1}});for(var e=0,o=t.length;e<o;e++){var l=z(e)+""+f,n=null;if(null===t[e]||t[e]===k||""===t[e]){if(!0!==s.createEmptyCells)continue;t[e]=""}var r=t[e];t[e]="function"==typeof t[e].trim?t[e].trim():t[e];for(var a=0,d=R.length;a<d;a++){var p=R[a];if(t[e].match&&!t[e].match(/^0\d+/)&&t[e].match(p.match)){var i=t[e].replace(/[^\d\.\-]/g,"");p.fmt&&(i=p.fmt(i)),n=E(u,"c",{attr:{r:l,s:p.style},children:[E(u,"v",{text:i})]});break}}n=n||("number"==typeof t[e]||t[e].match&&t[e].match(/^-?\d+(\.\d+)?([eE]\-?\d+)?$/)&&!t[e].match(/^0\d+/)?E(u,"c",{attr:{t:"n",r:l},children:[E(u,"v",{text:t[e]})]}):(r=r.replace?r.replace(/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,""):r,E(u,"c",{attr:{t:"inlineStr",r:l},children:{row:E(u,"is",{children:{row:E(u,"t",{text:r,attr:{"xml:space":"preserve"}})}})}}))),m.appendChild(n)}c.appendChild(m),y++}function r(t,e){var o=C("mergeCells",u);o[0].appendChild(E(u,"mergeCell",{attr:{ref:"A"+t+":"+z(e)+t}})),o.attr("count",parseFloat(o.attr("count"))+1),C("row:eq("+(t-1)+") c",u).attr("s","51")}var a,f,m,d=this,y=0,u=l("xl/worksheets/sheet1.xml"),c=u.getElementsByTagName("sheetData")[0],p={_rels:{".rels":l("_rels/.rels")},xl:{_rels:{"workbook.xml.rels":l("xl/_rels/workbook.xml.rels")},"workbook.xml":l("xl/workbook.xml"),"styles.xml":l("xl/styles.xml"),worksheets:{"sheet1.xml":u}},"[Content_Types].xml":l("[Content_Types].xml")},i=e.buttons.exportData(s.exportOptions),I=(s.customizeData&&s.customizeData(i),e.buttons.exportInfo(s));I.title&&(n([I.title]),r(y,i.header.length-1)),I.messageTop&&(n([I.messageTop]),r(y,i.header.length-1)),s.header&&(n(i.header),C("row:last c",u).attr("s","2"));for(var F=y,x=0,h=i.body.length;x<h;x++)n(i.body[x]);a=y,s.footer&&i.footer&&(n(i.footer),C("row:last c",u).attr("s","2")),I.messageBottom&&(n([I.messageBottom]),r(y,i.header.length-1));var b=E(u,"cols");C("worksheet",u).prepend(b);for(var g=0,v=i.header.length;g<v;g++)b.appendChild(E(u,"col",{attr:{min:g+1,max:g+1,width:function(t,e){var o=t.header[e].length;t.footer&&t.footer[e].length>o&&(o=t.footer[e].length);for(var l=0,n=t.body.length;l<n;l++){var r,a=t.body[l][e];if(40<(o=o<(r=(-1!==(a=null!==a&&a!==k?a.toString():"").indexOf("\n")?((r=a.split("\n")).sort(function(t,e){return e.length-t.length}),r[0]):a).length)?r:o))return 54}return 6<(o*=1.35)?o:6}(i,g),customWidth:1}}));var w=p.xl["workbook.xml"];C("sheets sheet",w).attr("name",N(s)),s.autoFilter&&(C("mergeCells",u).before(E(u,"autoFilter",{attr:{ref:"A"+F+":"+z(i.header.length-1)+a}})),C("definedNames",w).append(E(w,"definedName",{attr:{name:"_xlnm._FilterDatabase",localSheetId:"0",hidden:1},text:N(s)+"!$A$"+F+":"+z(i.header.length-1)+a}))),s.customize&&s.customize(p,s,e),0===C("mergeCells",u).children().length&&C("mergeCells",u).remove();var w=new(S()),F={compression:"DEFLATE",type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},B=(!function s(f,t){D===k&&(D=-1===A.serializeToString((new T.DOMParser).parseFromString(_["xl/worksheets/sheet1.xml"],"text/xml")).indexOf("xmlns:r")),C.each(t,function(t,e){if(C.isPlainObject(e))s(f.folder(t),e);else{if(D){for(var o,l=e.childNodes[0],n=[],r=l.attributes.length-1;0<=r;r--){var a=l.attributes[r].nodeName,d=l.attributes[r].nodeValue;-1!==a.indexOf(":")&&(n.push({name:a,value:d}),l.removeAttribute(a))}for(r=0,o=n.length;r<o;r++){var p=e.createAttribute(n[r].name.replace(":","_dt_b_namespace_token_"));p.value=n[r].value,l.setAttributeNode(p)}}var i=A.serializeToString(e),i=(i=D?(i=(i=-1===i.indexOf("<?xml")?'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+i:i).replace(/_dt_b_namespace_token_/g,":")).replace(/xmlns:NS[\d]+="" NS[\d]+:/g,""):i).replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");f.file(t,i)}})}(w,p),I.filename);175<B&&(B=B.substr(0,175)),w.generateAsync?w.generateAsync(F).then(function(t){O(t,B),d.processing(!1)}):(O(w.generate(F),B),this.processing(!1))},filename:"*",extension:".xlsx",exportOptions:{},header:!0,footer:!1,title:"*",messageTop:"*",messageBottom:"*",createEmptyCells:!1,autoFilter:!1,sheetName:""},n.ext.buttons.pdfHtml5={className:"buttons-pdf buttons-html5",available:function(){return T.FileReader!==k&&s()},text:function(t){return t.i18n("buttons.pdf","PDF")},action:function(t,e,o,l){this.processing(!0);var n=e.buttons.exportData(l.exportOptions),r=e.buttons.exportInfo(l),a=[];l.header&&a.push(C.map(n.header,function(t){return{text:"string"==typeof t?t:t+"",style:"tableHeader"}}));for(var d=0,p=n.body.length;d<p;d++)a.push(C.map(n.body[d],function(t){return{text:"string"==typeof(t=null!==t&&t!==k?t:"")?t:t+"",style:d%2?"tableBodyEven":"tableBodyOdd"}}));l.footer&&n.footer&&a.push(C.map(n.footer,function(t){return{text:"string"==typeof t?t:t+"",style:"tableFooter"}}));var i={pageSize:l.pageSize,pageOrientation:l.orientation,content:[{table:{headerRows:1,body:a},layout:"noBorders"}],styles:{tableHeader:{bold:!0,fontSize:11,color:"white",fillColor:"#2d4154",alignment:"center"},tableBodyEven:{},tableBodyOdd:{fillColor:"#f3f3f3"},tableFooter:{bold:!0,fontSize:11,color:"white",fillColor:"#2d4154"},title:{alignment:"center",fontSize:15},message:{}},defaultStyle:{fontSize:10}},e=(r.messageTop&&i.content.unshift({text:r.messageTop,style:"message",margin:[0,0,0,12]}),r.messageBottom&&i.content.push({text:r.messageBottom,style:"message",margin:[0,0,0,12]}),r.title&&i.content.unshift({text:r.title,style:"title",margin:[0,0,0,12]}),l.customize&&l.customize(i,l,e),s().createPdf(i));"open"!==l.download||f()?e.download(r.filename):e.open(),this.processing(!1)},title:"*",filename:"*",extension:".pdf",exportOptions:{},orientation:"portrait",pageSize:"A4",header:!0,footer:!1,messageTop:"*",messageBottom:"*",customize:null,download:"download"},n}); | ||
!function(o){var l,n;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(t){return o(t,window,document)}):"object"==typeof exports?(l=require("jquery"),n=function(t,e){e.fn.dataTable||require("datatables.net")(t,e),e.fn.dataTable.Buttons||require("datatables.net-buttons")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||l(t),n(t,e),o(e,t,t.document)}:(n(window,l),module.exports=o(l,window,window.document))):o(jQuery,window,document)}(function(S,C,u){"use strict";var e,o,t=S.fn.dataTable;function T(){return e||C.JSZip}function m(){return o||C.pdfMake}t.Buttons.pdfMake=function(t){if(!t)return m();o=t},t.Buttons.jszip=function(t){if(!t)return T();e=t};function k(t){var e="Sheet1";return e=t.sheetName?t.sheetName.replace(/[\[\]\*\/\\\?\:]/g,""):e}function c(t,e){function o(t){for(var e="",o=0,l=t.length;o<l;o++)0<o&&(e+=a),e+=r?r+(""+t[o]).replace(d,p+r)+r:t[o];return e}var l=y(e),n=t.buttons.exportData(e.exportOptions),r=e.fieldBoundary,a=e.fieldSeparator,d=new RegExp(r,"g"),p=void 0!==e.escapeChar?e.escapeChar:"\\",t="",i="",f=[];e.header&&(t=n.headerStructure.map(function(t){return o(t.map(function(t){return t?t.title:""}))}).join(l)+l),e.footer&&n.footer&&(i=n.footerStructure.map(function(t){return o(t.map(function(t){return t?t.title:""}))}).join(l)+l);for(var m=0,s=n.body.length;m<s;m++)f.push(o(n.body[m]));return{str:t+f.join(l)+i,rows:f.length}}function s(){var t;return-1!==navigator.userAgent.indexOf("Safari")&&-1===navigator.userAgent.indexOf("Chrome")&&-1===navigator.userAgent.indexOf("Opera")&&!!((t=navigator.userAgent.match(/AppleWebKit\/(\d+\.\d+)/))&&1<t.length&&+t[1]<603.1)}var N=function(d){var p,i,f,m,s,u,e,c,y,l,t;if(!(void 0===d||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent)))return t=d.document,p=function(){return d.URL||d.webkitURL||d},i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),f="download"in i,m=/constructor/i.test(d.HTMLElement)||d.safari,s=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(d.setImmediate||d.setTimeout)(function(){throw t},0)},e=4e4,c=function(t){setTimeout(function(){"string"==typeof t?p().revokeObjectURL(t):t.remove()},e)},y=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},t=(l=function(t,o,e){e||(t=y(t));var l,n,r=this,e="application/octet-stream"===t.type,a=function(){for(var t=r,e="writestart progress write writeend".split(" "),o=void 0,l=(e=[].concat(e)).length;l--;){var n=t["on"+e[l]];if("function"==typeof n)try{n.call(t,o||t)}catch(t){u(t)}}};r.readyState=r.INIT,f?(l=p().createObjectURL(t),setTimeout(function(){var t,e;i.href=l,i.download=o,t=i,e=new MouseEvent("click"),t.dispatchEvent(e),a(),c(l),r.readyState=r.DONE})):(s||e&&m)&&d.FileReader?((n=new FileReader).onloadend=function(){var t=s?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");d.open(t,"_blank")||(d.location.href=t),r.readyState=r.DONE,a()},n.readAsDataURL(t),r.readyState=r.INIT):(l=l||p().createObjectURL(t),!e&&d.open(l,"_blank")||(d.location.href=l),r.readyState=r.DONE,a(),c(l))}).prototype,"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,o){return e=e||t.name||"download",o||(t=y(t)),navigator.msSaveOrOpenBlob(t,e)}:(t.abort=function(){},t.readyState=t.INIT=0,t.WRITING=1,t.DONE=2,t.error=t.onwritestart=t.onprogress=t.onwrite=t.onabort=t.onerror=t.onwriteend=null,function(t,e,o){return new l(t,e||t.name||"download",o)})}("undefined"!=typeof self&&self||void 0!==C&&C||this.content),y=(t.fileSave=N,function(t){return t.newline||(navigator.userAgent.match(/Windows/)?"\r\n":"\n")});function O(t){for(var e="A".charCodeAt(0),o="Z".charCodeAt(0)-e+1,l="";0<=t;)l=String.fromCharCode(t%o+e)+l,t=Math.floor(t/o)-1;return l}try{var z,D=new XMLSerializer}catch(t){}function E(t,e,o){var l=t.createElement(e);return o&&(o.attr&&S(l).attr(o.attr),o.children&&S.each(o.children,function(t,e){l.appendChild(e)}),null!==o.text)&&void 0!==o.text&&l.appendChild(t.createTextNode(o.text)),l}function A(t,e,o,l,n){var r=S("mergeCells",t);r[0].appendChild(E(t,"mergeCell",{attr:{ref:O(o)+e+":"+O(o+n-1)+(e+l-1)}})),r.attr("count",parseFloat(r.attr("count"))+1)}var R={"_rels/.rels":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>',"xl/_rels/workbook.xml.rels":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>',"[Content_Types].xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="xml" ContentType="application/xml" /><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /><Default Extension="jpeg" ContentType="image/jpeg" /><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" /><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" /><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" /></Types>',"xl/workbook.xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="5" lowestEdited="5" rupBuild="24816"/><workbookPr showInkAnnotation="0" autoCompressPictures="0"/><bookViews><workbookView xWindow="0" yWindow="0" windowWidth="25600" windowHeight="19020" tabRatio="500"/></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/></sheets><definedNames/></workbook>',"xl/worksheets/sheet1.xml":'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><sheetData/><mergeCells count="0"/></worksheet>',"xl/styles.xml":'<?xml version="1.0" encoding="UTF-8"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"><numFmts count="6"><numFmt numFmtId="164" formatCode="[$$-409]#,##0.00;-[$$-409]#,##0.00"/><numFmt numFmtId="165" formatCode=""£"#,##0.00"/><numFmt numFmtId="166" formatCode="[$€-2] #,##0.00"/><numFmt numFmtId="167" formatCode="0.0%"/><numFmt numFmtId="168" formatCode="#,##0;(#,##0)"/><numFmt numFmtId="169" formatCode="#,##0.00;(#,##0.00)"/></numFmts><fonts count="5" x14ac:knownFonts="1"><font><sz val="11" /><name val="Calibri" /></font><font><sz val="11" /><name val="Calibri" /><color rgb="FFFFFFFF" /></font><font><sz val="11" /><name val="Calibri" /><b /></font><font><sz val="11" /><name val="Calibri" /><i /></font><font><sz val="11" /><name val="Calibri" /><u /></font></fonts><fills count="6"><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="solid"><fgColor rgb="FFD9D9D9" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="FFD99795" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="ffc6efce" /><bgColor indexed="64" /></patternFill></fill><fill><patternFill patternType="solid"><fgColor rgb="ffc6cfef" /><bgColor indexed="64" /></patternFill></fill></fills><borders count="2"><border><left /><right /><top /><bottom /><diagonal /></border><border diagonalUp="false" diagonalDown="false"><left style="thin"><color auto="1" /></left><right style="thin"><color auto="1" /></right><top style="thin"><color auto="1" /></top><bottom style="thin"><color auto="1" /></bottom><diagonal /></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" /></cellStyleXfs><cellXfs count="68"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="2" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="3" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="4" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="5" borderId="0" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="0" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="2" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="3" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="4" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="1" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="2" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="3" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="4" fillId="5" borderId="1" applyFont="1" applyFill="1" applyBorder="1"/><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="left"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="center"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="right"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment horizontal="fill"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment textRotation="90"/></xf><xf numFmtId="0" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyAlignment="1"><alignment wrapText="1"/></xf><xf numFmtId="9" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="164" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="165" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="166" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="167" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="168" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="169" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="3" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="4" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="1" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="2" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/><xf numFmtId="14" fontId="0" fillId="0" borderId="0" applyFont="1" applyFill="1" applyBorder="1" xfId="0" applyNumberFormat="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0" /></cellStyles><dxfs count="0" /><tableStyles count="0" defaultTableStyle="TableStyleMedium9" defaultPivotStyle="PivotStyleMedium4" /></styleSheet>'},_=[{match:/^\-?\d+\.\d%$/,style:60,fmt:function(t){return t/100}},{match:/^\-?\d+\.?\d*%$/,style:56,fmt:function(t){return t/100}},{match:/^\-?\$[\d,]+.?\d*$/,style:57},{match:/^\-?£[\d,]+.?\d*$/,style:58},{match:/^\-?€[\d,]+.?\d*$/,style:59},{match:/^\-?\d+$/,style:65},{match:/^\-?\d+\.\d{2}$/,style:66},{match:/^\([\d,]+\)$/,style:61,fmt:function(t){return-1*t.replace(/[\(\)]/g,"")}},{match:/^\([\d,]+\.\d{2}\)$/,style:62,fmt:function(t){return-1*t.replace(/[\(\)]/g,"")}},{match:/^\-?[\d,]+$/,style:63},{match:/^\-?[\d,]+\.\d{2}$/,style:64},{match:/^[\d]{4}\-[01][\d]\-[0123][\d]$/,style:67,fmt:function(t){return Math.round(25569+Date.parse(t)/864e5)}}];return t.ext.buttons.copyHtml5={className:"buttons-copy buttons-html5",text:function(t){return t.i18n("buttons.copy","Copy")},action:function(t,e,o,l,n){var r=c(e,l),a=e.buttons.exportInfo(l),d=y(l),p=r.str,i=S("<div/>").css({height:1,width:1,overflow:"hidden",position:"fixed",top:0,left:0}),d=(a.title&&(p=a.title+d+d+p),a.messageTop&&(p=a.messageTop+d+d+p),a.messageBottom&&(p=p+d+d+a.messageBottom),l.customize&&(p=l.customize(p,l,e)),S("<textarea readonly/>").val(p).appendTo(i));if(u.queryCommandSupported("copy")){i.appendTo(e.table().container()),d[0].focus(),d[0].select();try{var f=u.execCommand("copy");if(i.remove(),f)return e.buttons.info(e.i18n("buttons.copyTitle","Copy to clipboard"),e.i18n("buttons.copySuccess",{1:"Copied one row to clipboard",_:"Copied %d rows to clipboard"},r.rows),2e3),void n()}catch(t){}}function m(){s.off("click.buttons-copy"),S(u).off(".buttons-copy"),e.buttons.info(!1)}var a=S("<span>"+e.i18n("buttons.copyKeys","Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.")+"</span>").append(i),s=(e.buttons.info(e.i18n("buttons.copyTitle","Copy to clipboard"),a,0),d[0].focus(),d[0].select(),S(a).closest(".dt-button-info"));s.on("click.buttons-copy",m),S(u).on("keydown.buttons-copy",function(t){27===t.keyCode&&(m(),n())}).on("copy.buttons-copy cut.buttons-copy",function(){m(),n()})},async:100,exportOptions:{},fieldSeparator:"\t",fieldBoundary:"",header:!0,footer:!1,title:"*",messageTop:"*",messageBottom:"*"},t.ext.buttons.csvHtml5={bom:!1,className:"buttons-csv buttons-html5",available:function(){return void 0!==C.FileReader&&C.Blob},text:function(t){return t.i18n("buttons.csv","CSV")},action:function(t,e,o,l,n){var r=c(e,l).str,a=e.buttons.exportInfo(l),d=l.charset;l.customize&&(r=l.customize(r,l,e)),d=!1!==d?(d=d||u.characterSet||u.charset)&&";charset="+d:"",l.bom&&(r=String.fromCharCode(65279)+r),N(new Blob([r],{type:"text/csv"+d}),a.filename,!0),n()},async:100,filename:"*",extension:".csv",exportOptions:{},fieldSeparator:",",fieldBoundary:'"',escapeChar:'"',charset:null,header:!0,footer:!1},t.ext.buttons.excelHtml5={className:"buttons-excel buttons-html5",available:function(){return void 0!==C.FileReader&&void 0!==T()&&!s()&&D},text:function(t){return t.i18n("buttons.excel","Excel")},action:function(t,e,o,f,l){function n(t){return t=R[t],S.parseXML(t)}function r(t){s=E(c,"row",{attr:{r:m=u+1}});for(var e=0,o=t.length;e<o;e++){var l=O(e)+""+m,n=null;if(null===t[e]||void 0===t[e]||""===t[e]){if(!0!==f.createEmptyCells)continue;t[e]=""}var r=t[e];t[e]="function"==typeof t[e].trim?t[e].trim():t[e];for(var a=0,d=_.length;a<d;a++){var p=_[a];if(t[e].match&&!t[e].match(/^0\d+/)&&t[e].match(p.match)){var i=t[e].replace(/[^\d\.\-]/g,"");p.fmt&&(i=p.fmt(i)),n=E(c,"c",{attr:{r:l,s:p.style},children:[E(c,"v",{text:i})]});break}}n=n||("number"==typeof t[e]||t[e].match&&t[e].match(/^-?\d+(\.\d+)?([eE]\-?\d+)?$/)&&!t[e].match(/^0\d+/)?E(c,"c",{attr:{t:"n",r:l},children:[E(c,"v",{text:t[e]})]}):(r=r.replace?r.replace(/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F-\x9F]/g,""):r,E(c,"c",{attr:{t:"inlineStr",r:l},children:{row:E(c,"is",{children:{row:E(c,"t",{text:r,attr:{"xml:space":"preserve"}})}})}}))),s.appendChild(n)}y.appendChild(s),u++}function a(t){t.forEach(function(t){r(t.map(function(t){return t?t.title:""})),S("row:last c",c).attr("s","2"),t.forEach(function(t,e){t&&(1<t.colSpan||1<t.rowSpan)&&A(c,u,e,t.rowSpan,t.colSpan)})})}var d,m,s,u=0,c=n("xl/worksheets/sheet1.xml"),y=c.getElementsByTagName("sheetData")[0],p={_rels:{".rels":n("_rels/.rels")},xl:{_rels:{"workbook.xml.rels":n("xl/_rels/workbook.xml.rels")},"workbook.xml":n("xl/workbook.xml"),"styles.xml":n("xl/styles.xml"),worksheets:{"sheet1.xml":c}},"[Content_Types].xml":n("[Content_Types].xml")},i=e.buttons.exportData(f.exportOptions),I=(f.customizeData&&f.customizeData(i),e.buttons.exportInfo(f));I.title&&(r([I.title]),A(c,u,0,1,i.header.length),S("row:last c",c).attr("s","51")),I.messageTop&&(r([I.messageTop]),A(c,u,0,1,i.header.length)),f.header&&a(i.headerStructure);for(var F=u,x=0,h=i.body.length;x<h;x++)r(i.body[x]);d=u,f.footer&&i.footer&&a(i.footerStructure),I.messageBottom&&(r([I.messageBottom]),A(c,u,0,1,i.header.length));var b=E(c,"cols");S("worksheet",c).prepend(b);for(var g=0,v=i.header.length;g<v;g++)b.appendChild(E(c,"col",{attr:{min:g+1,max:g+1,width:function(t,e){var o=t.header[e].length;t.footer&&t.footer[e].length>o&&(o=t.footer[e].length);for(var l=0,n=t.body.length;l<n;l++){var r,a=t.body[l][e];if(40<(o=o<(r=(-1!==(a=null!=a?a.toString():"").indexOf("\n")?((r=a.split("\n")).sort(function(t,e){return e.length-t.length}),r[0]):a).length)?r:o))return 54}return 6<(o*=1.35)?o:6}(i,g),customWidth:1}}));var w=p.xl["workbook.xml"];S("sheets sheet",w).attr("name",k(f)),f.autoFilter&&(S("mergeCells",c).before(E(c,"autoFilter",{attr:{ref:"A"+F+":"+O(i.header.length-1)+d}})),S("definedNames",w).append(E(w,"definedName",{attr:{name:"_xlnm._FilterDatabase",localSheetId:"0",hidden:1},text:k(f)+"!$A$"+F+":"+O(i.header.length-1)+d}))),f.customize&&f.customize(p,f,e),0===S("mergeCells",c).children().length&&S("mergeCells",c).remove();var w=new(T()),F={compression:"DEFLATE",type:"blob",mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},B=(!function f(m,t){void 0===z&&(z=-1===D.serializeToString((new C.DOMParser).parseFromString(R["xl/worksheets/sheet1.xml"],"text/xml")).indexOf("xmlns:r")),S.each(t,function(t,e){if(S.isPlainObject(e))f(m.folder(t),e);else{if(z){for(var o,l=e.childNodes[0],n=[],r=l.attributes.length-1;0<=r;r--){var a=l.attributes[r].nodeName,d=l.attributes[r].nodeValue;-1!==a.indexOf(":")&&(n.push({name:a,value:d}),l.removeAttribute(a))}for(r=0,o=n.length;r<o;r++){var p=e.createAttribute(n[r].name.replace(":","_dt_b_namespace_token_"));p.value=n[r].value,l.setAttributeNode(p)}}var i=D.serializeToString(e),i=(i=z?(i=(i=-1===i.indexOf("<?xml")?'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+i:i).replace(/_dt_b_namespace_token_/g,":")).replace(/xmlns:NS[\d]+="" NS[\d]+:/g,""):i).replace(/<([^<>]*?) xmlns=""([^<>]*?)>/g,"<$1 $2>");m.file(t,i)}})}(w,p),I.filename);175<B&&(B=B.substr(0,175)),w.generateAsync?w.generateAsync(F).then(function(t){N(t,B),l()}):(N(w.generate(F),B),l())},async:100,filename:"*",extension:".xlsx",exportOptions:{},header:!0,footer:!0,title:"*",messageTop:"*",messageBottom:"*",createEmptyCells:!1,autoFilter:!1,sheetName:""},t.ext.buttons.pdfHtml5={className:"buttons-pdf buttons-html5",available:function(){return void 0!==C.FileReader&&m()},text:function(t){return t.i18n("buttons.pdf","PDF")},action:function(t,e,o,l,n){var r=e.buttons.exportData(l.exportOptions),a=e.buttons.exportInfo(l),d=[];l.header&&r.headerStructure.forEach(function(t){d.push(t.map(function(t){return t?{text:t.title,colSpan:t.colspan,rowSpan:t.rowspan,style:"tableHeader"}:{}}))});for(var p=0,i=r.body.length;p<i;p++)d.push(r.body[p].map(function(t){return{text:null==t?"":"string"==typeof t?t:t.toString()}}));l.footer&&r.footerStructure.forEach(function(t){d.push(t.map(function(t){return t?{text:t.title,colSpan:t.colspan,rowSpan:t.rowspan,style:"tableHeader"}:{}}))});var f={pageSize:l.pageSize,pageOrientation:l.orientation,content:[{style:"table",table:{headerRows:r.headerStructure.length,footerRows:r.footerStructure.length,body:d},layout:{hLineWidth:function(t,e){return 0===t||t===e.table.body.length?0:.5},vLineWidth:function(){return 0},hLineColor:function(t,e){return t===e.table.headerRows||t===e.table.body.length-e.table.footerRows?"#333":"#ddd"},fillColor:function(t){return t<r.headerStructure.length?"#fff":t%2==0?"#f3f3f3":null},paddingTop:function(){return 5},paddingBottom:function(){return 5}}}],styles:{tableHeader:{bold:!0,fontSize:11,alignment:"center"},tableFooter:{bold:!0,fontSize:11},table:{margin:[0,5,0,5]},title:{alignment:"center",fontSize:13},message:{}},defaultStyle:{fontSize:10}},e=(a.messageTop&&f.content.unshift({text:a.messageTop,style:"message",margin:[0,0,0,12]}),a.messageBottom&&f.content.push({text:a.messageBottom,style:"message",margin:[0,0,0,12]}),a.title&&f.content.unshift({text:a.title,style:"title",margin:[0,0,0,12]}),l.customize&&l.customize(f,l,e),m().createPdf(f));"open"!==l.download||s()?e.download(a.filename):e.open(),n()},async:100,title:"*",filename:"*",extension:".pdf",exportOptions:{},orientation:"portrait",pageSize:"en-US"===navigator.language||"en-CA"===navigator.language?"LETTER":"A4",header:!0,footer:!0,messageTop:"*",messageBottom:"*",customize:null,download:"download"},t}); |
@@ -51,3 +51,3 @@ /*! | ||
} | ||
}(function( $, window, document, undefined ) { | ||
}(function( $, window, document ) { | ||
'use strict'; | ||
@@ -67,5 +67,3 @@ var DataTable = $.fn.dataTable; | ||
var _styleToAbs = function (el) { | ||
var url; | ||
var clone = $(el).clone()[0]; | ||
var linkHost; | ||
@@ -107,3 +105,3 @@ if (clone.nodeName.toLowerCase() === 'link') { | ||
action: function (e, dt, button, config) { | ||
action: function (e, dt, button, config, cb) { | ||
var data = dt.buttons.exportData( | ||
@@ -113,7 +111,9 @@ $.extend({ decodeEntities: false }, config.exportOptions) // XSS protection | ||
var exportInfo = dt.buttons.exportInfo(config); | ||
// Get the classes for the columns from the header cells | ||
var columnClasses = dt | ||
.columns(config.exportOptions.columns) | ||
.flatten() | ||
.map(function (idx) { | ||
return dt.settings()[0].aoColumns[dt.column(idx).index()].sClass; | ||
.nodes() | ||
.map(function (n) { | ||
return n.className; | ||
}) | ||
@@ -128,5 +128,16 @@ .toArray(); | ||
var dataOut = d[i] === null || d[i] === undefined ? '' : d[i]; | ||
var classAttr = columnClasses[i] ? 'class="' + columnClasses[i] + '"' : ''; | ||
var classAttr = columnClasses[i] | ||
? 'class="' + columnClasses[i] + '"' | ||
: ''; | ||
str += '<' + tag + ' ' + classAttr + '>' + dataOut + '</' + tag + '>'; | ||
str += | ||
'<' + | ||
tag + | ||
' ' + | ||
classAttr + | ||
'>' + | ||
dataOut + | ||
'</' + | ||
tag + | ||
'>'; | ||
} | ||
@@ -141,3 +152,23 @@ | ||
if (config.header) { | ||
html += '<thead>' + addRow(data.header, 'th') + '</thead>'; | ||
var headerRows = data.headerStructure.map(function (row) { | ||
return ( | ||
'<tr>' + | ||
row | ||
.map(function (cell) { | ||
return cell | ||
? '<th colspan="' + | ||
cell.colspan + | ||
'" rowspan="' + | ||
cell.rowspan + | ||
'">' + | ||
cell.title + | ||
'</th>' | ||
: ''; | ||
}) | ||
.join('') + | ||
'</tr>' | ||
); | ||
}); | ||
html += '<thead>' + headerRows.join('') + '</thead>'; | ||
} | ||
@@ -152,3 +183,23 @@ | ||
if (config.footer && data.footer) { | ||
html += '<tfoot>' + addRow(data.footer, 'th') + '</tfoot>'; | ||
var footerRows = data.footerStructure.map(function (row) { | ||
return ( | ||
'<tr>' + | ||
row | ||
.map(function (cell) { | ||
return cell | ||
? '<th colspan="' + | ||
cell.colspan + | ||
'" rowspan="' + | ||
cell.rowspan + | ||
'">' + | ||
cell.title + | ||
'</th>' | ||
: ''; | ||
}) | ||
.join('') + | ||
'</tr>' | ||
); | ||
}); | ||
html += '<tfoot>' + footerRows.join('') + '</tfoot>'; | ||
} | ||
@@ -221,11 +272,9 @@ html += '</table>'; | ||
if (navigator.userAgent.match(/Trident\/\d.\d/)) { | ||
// IE needs to call this without a setTimeout | ||
autoPrint(); | ||
} | ||
else { | ||
win.setTimeout(autoPrint, 1000); | ||
} | ||
win.setTimeout(autoPrint, 1000); | ||
cb(); | ||
}, | ||
async: 100, | ||
title: '*', | ||
@@ -232,0 +281,0 @@ |
@@ -5,2 +5,2 @@ /*! | ||
*/ | ||
!function(n){var o,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(t){return n(t,window,document)}):"object"==typeof exports?(o=require("jquery"),r=function(t,e){e.fn.dataTable||require("datatables.net")(t,e),e.fn.dataTable.Buttons||require("datatables.net-buttons")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||o(t),r(t,e),n(e,t,t.document)}:(r(window,o),module.exports=n(o,window,window.document))):n(jQuery,window,document)}(function(m,b,t,p){"use strict";function h(t){return n.href=t,-1===(t=n.host).indexOf("/")&&0!==n.pathname.indexOf("/")&&(t+="/"),n.protocol+"//"+t+n.pathname+n.search}var e=m.fn.dataTable,n=t.createElement("a");return e.ext.buttons.print={className:"buttons-print",text:function(t){return t.i18n("buttons.print","Print")},action:function(t,e,n,o){function r(t,e){for(var n="<tr>",o=0,r=t.length;o<r;o++){var i=null===t[o]||t[o]===p?"":t[o];n+="<"+e+" "+(s[o]?'class="'+s[o]+'"':"")+">"+i+"</"+e+">"}return n+"</tr>"}var i=e.buttons.exportData(m.extend({decodeEntities:!1},o.exportOptions)),a=e.buttons.exportInfo(o),s=e.columns(o.exportOptions.columns).flatten().map(function(t){return e.settings()[0].aoColumns[e.column(t).index()].sClass}).toArray(),u='<table class="'+e.table().node().className+'">';o.header&&(u+="<thead>"+r(i.header,"th")+"</thead>"),u+="<tbody>";for(var d=0,c=i.body.length;d<c;d++)u+=r(i.body[d],"td");u+="</tbody>",o.footer&&i.footer&&(u+="<tfoot>"+r(i.footer,"th")+"</tfoot>"),u+="</table>";var l=b.open("","");if(l){l.document.close();var f="<title>"+a.title+"</title>";m("style, link").each(function(){f+=function(t){t=m(t).clone()[0];return"link"===t.nodeName.toLowerCase()&&(t.href=h(t.href)),t.outerHTML}(this)});try{l.document.head.innerHTML=f}catch(t){m(l.document.head).html(f)}l.document.body.innerHTML="<h1>"+a.title+"</h1><div>"+(a.messageTop||"")+"</div>"+u+"<div>"+(a.messageBottom||"")+"</div>",m(l.document.body).addClass("dt-print-view"),m("img",l.document.body).each(function(t,e){e.setAttribute("src",h(e.getAttribute("src")))}),o.customize&&o.customize(l,o,e);a=function(){o.autoPrint&&(l.print(),l.close())};navigator.userAgent.match(/Trident\/\d.\d/)?a():l.setTimeout(a,1e3)}else e.buttons.info(e.i18n("buttons.printErrorTitle","Unable to open print view"),e.i18n("buttons.printErrorMsg","Please allow popups in your browser for this site to be able to view the print view."),5e3)},title:"*",messageTop:"*",messageBottom:"*",exportOptions:{},header:!0,footer:!1,autoPrint:!0,customize:null},e}); | ||
!function(n){var o,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(t){return n(t,window,document)}):"object"==typeof exports?(o=require("jquery"),r=function(t,e){e.fn.dataTable||require("datatables.net")(t,e),e.fn.dataTable.Buttons||require("datatables.net-buttons")(t,e)},"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||o(t),r(t,e),n(e,t,t.document)}:(r(window,o),module.exports=n(o,window,window.document))):n(jQuery,window,document)}(function(p,m,t){"use strict";function b(t){return n.href=t,-1===(t=n.host).indexOf("/")&&0!==n.pathname.indexOf("/")&&(t+="/"),n.protocol+"//"+t+n.pathname+n.search}var e=p.fn.dataTable,n=t.createElement("a");return e.ext.buttons.print={className:"buttons-print",text:function(t){return t.i18n("buttons.print","Print")},action:function(t,e,n,o,r){var i=e.buttons.exportData(p.extend({decodeEntities:!1},o.exportOptions)),a=e.buttons.exportInfo(o),u=e.columns(o.exportOptions.columns).nodes().map(function(t){return t.className}).toArray(),s='<table class="'+e.table().node().className+'">';o.header&&(s+="<thead>"+i.headerStructure.map(function(t){return"<tr>"+t.map(function(t){return t?'<th colspan="'+t.colspan+'" rowspan="'+t.rowspan+'">'+t.title+"</th>":""}).join("")+"</tr>"}).join("")+"</thead>"),s+="<tbody>";for(var d=0,c=i.body.length;d<c;d++)s+=function(t,e){for(var n="<tr>",o=0,r=t.length;o<r;o++){var i=null===t[o]||void 0===t[o]?"":t[o];n+="<"+e+" "+(u[o]?'class="'+u[o]+'"':"")+">"+i+"</"+e+">"}return n+"</tr>"}(i.body[d],"td");s+="</tbody>",o.footer&&i.footer&&(s+="<tfoot>"+i.footerStructure.map(function(t){return"<tr>"+t.map(function(t){return t?'<th colspan="'+t.colspan+'" rowspan="'+t.rowspan+'">'+t.title+"</th>":""}).join("")+"</tr>"}).join("")+"</tfoot>"),s+="</table>";var l=m.open("","");if(l){l.document.close();var f="<title>"+a.title+"</title>";p("style, link").each(function(){f+=function(t){t=p(t).clone()[0];return"link"===t.nodeName.toLowerCase()&&(t.href=b(t.href)),t.outerHTML}(this)});try{l.document.head.innerHTML=f}catch(t){p(l.document.head).html(f)}l.document.body.innerHTML="<h1>"+a.title+"</h1><div>"+(a.messageTop||"")+"</div>"+s+"<div>"+(a.messageBottom||"")+"</div>",p(l.document.body).addClass("dt-print-view"),p("img",l.document.body).each(function(t,e){e.setAttribute("src",b(e.getAttribute("src")))}),o.customize&&o.customize(l,o,e);l.setTimeout(function(){o.autoPrint&&(l.print(),l.close())},1e3),r()}else e.buttons.info(e.i18n("buttons.printErrorTitle","Unable to open print view"),e.i18n("buttons.printErrorMsg","Please allow popups in your browser for this site to be able to view the print view."),5e3)},async:100,title:"*",messageTop:"*",messageBottom:"*",exportOptions:{},header:!0,footer:!1,autoPrint:!0,customize:null},e}); |
@@ -1,2 +0,2 @@ | ||
/*! Buttons for DataTables 2.4.2 | ||
/*! Buttons for DataTables 3.0.0 | ||
* © SpryMedia Ltd - datatables.net/license | ||
@@ -46,3 +46,3 @@ */ | ||
} | ||
}(function( $, window, document, undefined ) { | ||
}(function( $, window, document ) { | ||
'use strict'; | ||
@@ -98,2 +98,6 @@ var DataTable = $.fn.dataTable; | ||
var Buttons = function (dt, config) { | ||
if (!DataTable.versionCheck('2')) { | ||
throw 'Warning: Buttons requires DataTables 2 or newer'; | ||
} | ||
// If not created with a `new` keyword then we return a wrapper function that | ||
@@ -138,3 +142,5 @@ // will take the settings object for a DT. This allows easy use of new instances | ||
this.dom = { | ||
container: $('<' + this.c.dom.container.tag + '/>').addClass(this.c.dom.container.className) | ||
container: $('<' + this.c.dom.container.tag + '/>').addClass( | ||
this.c.dom.container.className | ||
) | ||
}; | ||
@@ -228,3 +234,5 @@ | ||
config !== undefined ? config.split : undefined, | ||
(config === undefined || config.split === undefined || config.split.length === 0) && | ||
(config === undefined || | ||
config.split === undefined || | ||
config.split.length === 0) && | ||
base !== undefined, | ||
@@ -274,3 +282,4 @@ false, | ||
true, | ||
newBtn.parentConf !== undefined && newBtn.parentConf.split !== undefined, | ||
newBtn.parentConf !== undefined && | ||
newBtn.parentConf.split !== undefined, | ||
null, | ||
@@ -301,3 +310,5 @@ newBtn.parentConf | ||
$(button.node).addClass(this.c.dom.button.disabled).prop('disabled', true); | ||
$(button.node) | ||
.addClass(this.c.dom.button.disabled) | ||
.prop('disabled', true); | ||
@@ -353,3 +364,5 @@ return this; | ||
var button = this._nodeToButton(node); | ||
$(button.node).removeClass(this.c.dom.button.disabled).prop('disabled', false); | ||
$(button.node) | ||
.removeClass(this.c.dom.button.disabled) | ||
.prop('disabled', false); | ||
@@ -490,3 +503,5 @@ return this; | ||
var text = function (opt) { | ||
return typeof opt === 'function' ? opt(dt, jqNode, button.conf) : opt; | ||
return typeof opt === 'function' | ||
? opt(dt, jqNode, button.conf) | ||
: opt; | ||
}; | ||
@@ -539,3 +554,6 @@ | ||
$('body').on('keyup.' + this.s.namespace, function (e) { | ||
if (!document.activeElement || document.activeElement === document.body) { | ||
if ( | ||
!document.activeElement || | ||
document.activeElement === document.body | ||
) { | ||
// SUse a string of characters for fast lookup of if we need to | ||
@@ -563,3 +581,5 @@ // handle this | ||
if (conf.key) { | ||
this.s.listenKeys += $.isPlainObject(conf.key) ? conf.key.key : conf.key; | ||
this.s.listenKeys += $.isPlainObject(conf.key) | ||
? conf.key.key | ||
: conf.key; | ||
} | ||
@@ -632,3 +652,5 @@ }, | ||
conf, | ||
built !== undefined && built.conf !== undefined ? built.conf.split : undefined, | ||
built !== undefined && built.conf !== undefined | ||
? built.conf.split | ||
: undefined, | ||
inCollection, | ||
@@ -646,3 +668,4 @@ parentConf !== undefined && parentConf.split !== undefined, | ||
conf.split !== undefined || | ||
(conf.config !== undefined && conf.config.split !== undefined), | ||
(conf.config !== undefined && | ||
conf.config.split !== undefined), | ||
inSplit | ||
@@ -664,3 +687,5 @@ ); | ||
if (built.conf.buttons) { | ||
built.collection = $('<' + domCollection.container.content.tag + '/>'); | ||
built.collection = $( | ||
'<' + domCollection.container.content.tag + '/>' | ||
); | ||
built.conf._collection = built.collection; | ||
@@ -735,2 +760,3 @@ | ||
_buildButton: function (config, inCollection, isSplit, inSplit) { | ||
var that = this; | ||
var configDom = this.c.dom; | ||
@@ -761,3 +787,8 @@ var textNode; | ||
var spacer = $('<' + dom.spacer.tag + '/>') | ||
.addClass('dt-button-spacer ' + config.style + ' ' + dom.spacer.className) | ||
.addClass( | ||
'dt-button-spacer ' + | ||
config.style + | ||
' ' + | ||
dom.spacer.className | ||
) | ||
.html(text(config.text)); | ||
@@ -779,3 +810,7 @@ | ||
// it has. For example, PDF button require pdfmake | ||
if (config.available && !config.available(dt, config) && !config.hasOwnProperty('html')) { | ||
if ( | ||
config.available && | ||
!config.available(dt, config) && | ||
!config.html | ||
) { | ||
return false; | ||
@@ -786,5 +821,5 @@ } | ||
if (!config.hasOwnProperty('html')) { | ||
var action = function (e, dt, button, config) { | ||
config.action.call(dt.button(button), e, dt, button, config); | ||
if (!config.html) { | ||
var run = function (e, dt, button, config, done) { | ||
config.action.call(dt.button(button), e, dt, button, config, done); | ||
@@ -799,4 +834,20 @@ $(dt.table().node()).triggerHandler('buttons-action.dt', [ | ||
var action = function(e, dt, button, config) { | ||
if (config.async) { | ||
that.processing(button[0], true); | ||
setTimeout(function () { | ||
run(e, dt, button, config, function () { | ||
that.processing(button[0], false); | ||
}); | ||
}, config.async); | ||
} | ||
else { | ||
run(e, dt, button, config, function () {}); | ||
} | ||
} | ||
var tag = config.tag || dom.tag; | ||
var clickBlurs = config.clickBlurs === undefined ? true : config.clickBlurs; | ||
var clickBlurs = | ||
config.clickBlurs === undefined ? true : config.clickBlurs; | ||
@@ -930,3 +981,9 @@ button = $('<' + tag + '/>') | ||
var splitAction = function (e, dt, button, config) { | ||
_dtButtons.split.action.call(dt.button(splitDiv), e, dt, button, config); | ||
_dtButtons.split.action.call( | ||
dt.button(splitDiv), | ||
e, | ||
dt, | ||
button, | ||
config | ||
); | ||
@@ -943,3 +1000,5 @@ $(dt.table().node()).triggerHandler('buttons-action.dt', [ | ||
var dropButton = $( | ||
'<button class="' + dropdownConf.dropdown.className + ' dt-button"></button>' | ||
'<button class="' + | ||
dropdownConf.dropdown.className + | ||
' dt-button"></button>' | ||
) | ||
@@ -1244,3 +1303,3 @@ .html(dropdownConf.dropdown.dropHtml) | ||
*/ | ||
_popover: function (content, hostButton, inOpts, e) { | ||
_popover: function (content, hostButton, inOpts) { | ||
var dt = hostButton; | ||
@@ -1269,3 +1328,4 @@ var c = this.c; | ||
var containerSelector = options.tag + '.' + options.containerClassName.replace(/ /g, '.'); | ||
var containerSelector = | ||
options.tag + '.' + options.containerClassName.replace(/ /g, '.'); | ||
var hostNode = hostButton.node(); | ||
@@ -1280,9 +1340,15 @@ | ||
$(dt.buttons('[aria-haspopup="dialog"][aria-expanded="true"]').nodes()).attr( | ||
'aria-expanded', | ||
'false' | ||
); | ||
$( | ||
dt | ||
.buttons('[aria-haspopup="dialog"][aria-expanded="true"]') | ||
.nodes() | ||
).attr('aria-expanded', 'false'); | ||
$('div.dt-button-background').off('click.dtb-collection'); | ||
Buttons.background(false, options.backgroundClassName, options.fade, hostNode); | ||
Buttons.background( | ||
false, | ||
options.backgroundClassName, | ||
options.fade, | ||
hostNode | ||
); | ||
@@ -1350,3 +1416,5 @@ $(window).off('resize.resize.dtb-collection'); | ||
display.prepend( | ||
'<div class="dt-button-collection-title">' + options.popoverTitle + '</div>' | ||
'<div class="dt-button-collection-title">' + | ||
options.popoverTitle + | ||
'</div>' | ||
); | ||
@@ -1356,3 +1424,5 @@ } | ||
display.prepend( | ||
'<div class="dt-button-collection-title">' + options.collectionTitle + '</div>' | ||
'<div class="dt-button-collection-title">' + | ||
options.collectionTitle + | ||
'</div>' | ||
); | ||
@@ -1389,3 +1459,4 @@ } | ||
tableSizes.height = offsetParent.outerHeight(); | ||
tableSizes.width = offsetParent.width() + parseFloat(computed.paddingLeft); | ||
tableSizes.width = | ||
offsetParent.width() + parseFloat(computed.paddingLeft); | ||
tableSizes.right = tableSizes.left + tableSizes.width; | ||
@@ -1423,21 +1494,32 @@ tableSizes.bottom = tableSizes.top + tableSizes.height; | ||
if (options.align === 'button-right' || display.hasClass(options.rightAlignClassName)) { | ||
left = buttonPosition.left - popoverSizes.width + hostNode.outerWidth(); | ||
if ( | ||
options.align === 'button-right' || | ||
display.hasClass(options.rightAlignClassName) | ||
) { | ||
left = | ||
buttonPosition.left - | ||
popoverSizes.width + | ||
hostNode.outerWidth(); | ||
} | ||
// Container alignment - make sure it doesn't overflow the table container | ||
if (options.align === 'dt-container' || options.align === 'container') { | ||
if ( | ||
options.align === 'dt-container' || | ||
options.align === 'container' | ||
) { | ||
if (left < buttonPosition.left) { | ||
left = -buttonPosition.left; | ||
} | ||
if (left + popoverSizes.width > tableSizes.width) { | ||
left = tableSizes.width - popoverSizes.width; | ||
} | ||
} | ||
// Window adjustment | ||
if (containerPosition.left + left + popoverSizes.width > $(window).width()) { | ||
if ( | ||
containerPosition.left + left + popoverSizes.width > | ||
$(window).width() | ||
) { | ||
// Overflowing the document to the right | ||
left = $(window).width() - popoverSizes.width - containerPosition.left; | ||
left = | ||
$(window).width() - | ||
popoverSizes.width - | ||
containerPosition.left; | ||
} | ||
@@ -1475,3 +1557,3 @@ | ||
// Fix position - centre on screen | ||
var position = function () { | ||
var place = function () { | ||
var half = $(window).height() / 2; | ||
@@ -1487,6 +1569,6 @@ | ||
position(); | ||
place(); | ||
$(window).on('resize.dtb-collection', function () { | ||
position(); | ||
place(); | ||
}); | ||
@@ -1508,3 +1590,6 @@ } | ||
// required to make it work... | ||
$('div.dt-button-background').on('click.dtb-collection', function () {}); | ||
$('div.dt-button-background').on( | ||
'click.dtb-collection', | ||
function () {} | ||
); | ||
@@ -1539,3 +1624,4 @@ if (options.autoClose) { | ||
if ( | ||
(!$(e.target).parents()[back]().filter(content).length && | ||
(!$(e.target).parents()[back]().filter(content) | ||
.length && | ||
!$(parent).hasClass('dt-buttons')) || | ||
@@ -1606,3 +1692,6 @@ $(e.target).hasClass('dt-button-background') | ||
_fadeIn( | ||
$('<div/>').addClass(className).css('display', 'none').insertAfter(insertPoint), | ||
$('<div/>') | ||
.addClass(className) | ||
.css('display', 'none') | ||
.insertAfter(insertPoint), | ||
fade | ||
@@ -1825,3 +1914,6 @@ ); | ||
// Always remove script tags | ||
str = str.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); | ||
str = str.replace( | ||
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, | ||
'' | ||
); | ||
@@ -1863,3 +1955,3 @@ // Always remove comments | ||
_entityDecoder = fn; | ||
} | ||
}; | ||
@@ -1941,3 +2033,3 @@ /** | ||
*/ | ||
Buttons.version = '2.4.2'; | ||
Buttons.version = '3.0.0'; | ||
@@ -1951,3 +2043,3 @@ $.extend(_dtButtons, { | ||
closeButton: false, | ||
init: function (dt, button, config) { | ||
init: function (dt, button) { | ||
button.attr('aria-expanded', false); | ||
@@ -1980,3 +2072,3 @@ }, | ||
closeButton: false, | ||
init: function (dt, button, config) { | ||
init: function (dt, button) { | ||
return button.attr('aria-expanded', false); | ||
@@ -1992,3 +2084,3 @@ }, | ||
}, | ||
copy: function (dt, conf) { | ||
copy: function () { | ||
if (_dtButtons.copyHtml5) { | ||
@@ -2004,3 +2096,6 @@ return 'copyHtml5'; | ||
excel: function (dt, conf) { | ||
if (_dtButtons.excelHtml5 && _dtButtons.excelHtml5.available(dt, conf)) { | ||
if ( | ||
_dtButtons.excelHtml5 && | ||
_dtButtons.excelHtml5.available(dt, conf) | ||
) { | ||
return 'excelHtml5'; | ||
@@ -2144,27 +2239,35 @@ } | ||
// Active buttons | ||
DataTable.Api.registerPlural('buttons().active()', 'button().active()', function (flag) { | ||
if (flag === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.active(set.node); | ||
DataTable.Api.registerPlural( | ||
'buttons().active()', | ||
'button().active()', | ||
function (flag) { | ||
if (flag === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.active(set.node); | ||
}); | ||
} | ||
return this.each(function (set) { | ||
set.inst.active(set.node, flag); | ||
}); | ||
} | ||
); | ||
return this.each(function (set) { | ||
set.inst.active(set.node, flag); | ||
}); | ||
}); | ||
// Get / set button action | ||
DataTable.Api.registerPlural( | ||
'buttons().action()', | ||
'button().action()', | ||
function (action) { | ||
if (action === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.action(set.node); | ||
}); | ||
} | ||
// Get / set button action | ||
DataTable.Api.registerPlural('buttons().action()', 'button().action()', function (action) { | ||
if (action === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.action(set.node); | ||
return this.each(function (set) { | ||
set.inst.action(set.node, action); | ||
}); | ||
} | ||
); | ||
return this.each(function (set) { | ||
set.inst.action(set.node, action); | ||
}); | ||
}); | ||
// Collection control | ||
@@ -2187,14 +2290,20 @@ DataTable.Api.registerPlural( | ||
// Enable / disable buttons | ||
DataTable.Api.register(['buttons().enable()', 'button().enable()'], function (flag) { | ||
return this.each(function (set) { | ||
set.inst.enable(set.node, flag); | ||
}); | ||
}); | ||
DataTable.Api.register( | ||
['buttons().enable()', 'button().enable()'], | ||
function (flag) { | ||
return this.each(function (set) { | ||
set.inst.enable(set.node, flag); | ||
}); | ||
} | ||
); | ||
// Disable buttons | ||
DataTable.Api.register(['buttons().disable()', 'button().disable()'], function () { | ||
return this.each(function (set) { | ||
set.inst.disable(set.node); | ||
}); | ||
}); | ||
DataTable.Api.register( | ||
['buttons().disable()', 'button().disable()'], | ||
function () { | ||
return this.each(function (set) { | ||
set.inst.disable(set.node); | ||
}); | ||
} | ||
); | ||
@@ -2217,47 +2326,63 @@ // Button index | ||
// Get button nodes | ||
DataTable.Api.registerPlural('buttons().nodes()', 'button().node()', function () { | ||
var jq = $(); | ||
DataTable.Api.registerPlural( | ||
'buttons().nodes()', | ||
'button().node()', | ||
function () { | ||
var jq = $(); | ||
// jQuery will automatically reduce duplicates to a single entry | ||
$( | ||
this.each(function (set) { | ||
jq = jq.add(set.inst.node(set.node)); | ||
}) | ||
); | ||
// jQuery will automatically reduce duplicates to a single entry | ||
$( | ||
this.each(function (set) { | ||
jq = jq.add(set.inst.node(set.node)); | ||
}) | ||
); | ||
return jq; | ||
}); | ||
return jq; | ||
} | ||
); | ||
// Get / set button processing state | ||
DataTable.Api.registerPlural('buttons().processing()', 'button().processing()', function (flag) { | ||
if (flag === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.processing(set.node); | ||
DataTable.Api.registerPlural( | ||
'buttons().processing()', | ||
'button().processing()', | ||
function (flag) { | ||
if (flag === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.processing(set.node); | ||
}); | ||
} | ||
return this.each(function (set) { | ||
set.inst.processing(set.node, flag); | ||
}); | ||
} | ||
); | ||
return this.each(function (set) { | ||
set.inst.processing(set.node, flag); | ||
}); | ||
}); | ||
// Get / set button text (i.e. the button labels) | ||
DataTable.Api.registerPlural( | ||
'buttons().text()', | ||
'button().text()', | ||
function (label) { | ||
if (label === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.text(set.node); | ||
}); | ||
} | ||
// Get / set button text (i.e. the button labels) | ||
DataTable.Api.registerPlural('buttons().text()', 'button().text()', function (label) { | ||
if (label === undefined) { | ||
return this.map(function (set) { | ||
return set.inst.text(set.node); | ||
return this.each(function (set) { | ||
set.inst.text(set.node, label); | ||
}); | ||
} | ||
); | ||
return this.each(function (set) { | ||
set.inst.text(set.node, label); | ||
}); | ||
}); | ||
// Trigger a button's action | ||
DataTable.Api.registerPlural('buttons().trigger()', 'button().trigger()', function () { | ||
return this.each(function (set) { | ||
set.inst.node(set.node).trigger('click'); | ||
}); | ||
}); | ||
DataTable.Api.registerPlural( | ||
'buttons().trigger()', | ||
'button().trigger()', | ||
function () { | ||
return this.each(function (set) { | ||
set.inst.node(set.node).trigger('click'); | ||
}); | ||
} | ||
); | ||
@@ -2302,3 +2427,6 @@ // Button resolver to the popover | ||
if (ctx.length) { | ||
var inst = Buttons.instanceSelector(this._groupSelector, ctx[0]._buttons); | ||
var inst = Buttons.instanceSelector( | ||
this._groupSelector, | ||
ctx[0]._buttons | ||
); | ||
@@ -2325,9 +2453,13 @@ if (inst.length) { | ||
// Remove a button | ||
DataTable.Api.registerPlural('buttons().remove()', 'buttons().remove()', function () { | ||
this.each(function (set) { | ||
set.inst.remove(set.node); | ||
}); | ||
DataTable.Api.registerPlural( | ||
'buttons().remove()', | ||
'buttons().remove()', | ||
function () { | ||
this.each(function (set) { | ||
set.inst.remove(set.node); | ||
}); | ||
return this; | ||
}); | ||
return this; | ||
} | ||
); | ||
@@ -2363,3 +2495,7 @@ // Information box that can be used by buttons | ||
.html(title) | ||
.append($('<div/>')[typeof message === 'string' ? 'html' : 'append'](message)) | ||
.append( | ||
$('<div/>')[typeof message === 'string' ? 'html' : 'append']( | ||
message | ||
) | ||
) | ||
.css('display', 'none') | ||
@@ -2398,6 +2534,6 @@ .appendTo('body') | ||
return { | ||
filename: _filename(conf), | ||
title: _title(conf), | ||
messageTop: _message(this, conf.message || conf.messageTop, 'top'), | ||
messageBottom: _message(this, conf.messageBottom, 'bottom') | ||
filename: _filename(conf, this), | ||
title: _title(conf, this), | ||
messageTop: _message(this, conf, conf.message || conf.messageTop, 'top'), | ||
messageBottom: _message(this, conf, conf.messageBottom, 'bottom') | ||
}; | ||
@@ -2409,6 +2545,6 @@ }); | ||
* | ||
* @param {object} config Button configuration | ||
* @param {boolean} incExtension Include the file name extension | ||
* @param {object} config Button configuration | ||
* @param {object} dt DataTable instance | ||
*/ | ||
var _filename = function (config) { | ||
var _filename = function (config, dt) { | ||
// Backwards compatibility | ||
@@ -2425,3 +2561,3 @@ var filename = | ||
if (typeof filename === 'function') { | ||
filename = filename(); | ||
filename = filename(config, dt); | ||
} | ||
@@ -2440,3 +2576,3 @@ | ||
var extension = _stringOrFunction(config.extension); | ||
var extension = _stringOrFunction(config.extension, config, dt); | ||
if (!extension) { | ||
@@ -2455,3 +2591,3 @@ extension = ''; | ||
*/ | ||
var _stringOrFunction = function (option) { | ||
var _stringOrFunction = function (option, config, dt) { | ||
if (option === null || option === undefined) { | ||
@@ -2461,3 +2597,3 @@ return null; | ||
else if (typeof option === 'function') { | ||
return option(); | ||
return option(config, dt); | ||
} | ||
@@ -2472,4 +2608,4 @@ return option; | ||
*/ | ||
var _title = function (config) { | ||
var title = _stringOrFunction(config.title); | ||
var _title = function (config, dt) { | ||
var title = _stringOrFunction(config.title, config, dt); | ||
@@ -2483,4 +2619,4 @@ return title === null | ||
var _message = function (dt, option, position) { | ||
var message = _stringOrFunction(option); | ||
var _message = function (dt, config, option, position) { | ||
var message = _stringOrFunction(option, config, dt); | ||
if (message === null) { | ||
@@ -2540,4 +2676,4 @@ return null; | ||
.map(function (idx) { | ||
var el = dt.column(idx).header(); | ||
return config.format.header(el.innerHTML, idx, el); | ||
var col = dt.column(idx); | ||
return config.format.header(col.title(), idx, col.header()); | ||
}) | ||
@@ -2552,3 +2688,7 @@ .toArray(); | ||
var el = dt.column(idx).footer(); | ||
return config.format.footer(el ? el.innerHTML : '', idx, el); | ||
return config.format.footer( | ||
el ? $('.dt-column-title', el).html() : '', | ||
idx, | ||
el | ||
); | ||
}) | ||
@@ -2562,4 +2702,10 @@ .toArray() | ||
var modifier = $.extend({}, config.modifier); | ||
if (dt.select && typeof dt.select.info === 'function' && modifier.selected === undefined) { | ||
if (dt.rows(config.rows, $.extend({ selected: true }, modifier)).any()) { | ||
if ( | ||
dt.select && | ||
typeof dt.select.info === 'function' && | ||
modifier.selected === undefined | ||
) { | ||
if ( | ||
dt.rows(config.rows, $.extend({ selected: true }, modifier)).any() | ||
) { | ||
$.extend(modifier, { selected: true }); | ||
@@ -2570,5 +2716,8 @@ } | ||
var rowIndexes = dt.rows(config.rows, modifier).indexes().toArray(); | ||
var selectedCells = dt.cells(rowIndexes, config.columns); | ||
var selectedCells = dt.cells(rowIndexes, config.columns, { | ||
order: modifier.order | ||
}); | ||
var cells = selectedCells.render(config.orthogonal).toArray(); | ||
var cellNodes = selectedCells.nodes().toArray(); | ||
var cellIndexes = selectedCells.indexes().toArray(); | ||
@@ -2584,3 +2733,8 @@ var columns = header.length; | ||
for (var j = 0; j < columns; j++) { | ||
row[j] = config.format.body(cells[cellCounter], i, j, cellNodes[cellCounter]); | ||
row[j] = config.format.body( | ||
cells[cellCounter], | ||
cellIndexes[i + j].row, | ||
cellIndexes[i + j].column, | ||
cellNodes[cellCounter] | ||
); | ||
cellCounter++; | ||
@@ -2594,3 +2748,5 @@ } | ||
header: header, | ||
headerStructure: dt.table().header.structure(config.columns), | ||
footer: footer, | ||
footerStructure: dt.table().footer.structure(config.columns), | ||
body: body | ||
@@ -2633,3 +2789,5 @@ }; | ||
var api = new DataTable.Api(settings); | ||
var opts = options ? options : api.init().buttons || DataTable.defaults.buttons; | ||
var opts = options | ||
? options | ||
: api.init().buttons || DataTable.defaults.buttons; | ||
@@ -2639,3 +2797,3 @@ return new Buttons(api, opts).container(); | ||
// DataTables `dom` feature option | ||
// DataTables 1 `dom` feature option | ||
DataTable.ext.feature.push({ | ||
@@ -2647,4 +2805,4 @@ fnInit: _init, | ||
// DataTables 2 layout feature | ||
if (DataTable.ext.features) { | ||
DataTable.ext.features.register('buttons', _init); | ||
if (DataTable.feature) { | ||
DataTable.feature.register('buttons', _init); | ||
} | ||
@@ -2651,0 +2809,0 @@ |
@@ -1,4 +0,4 @@ | ||
/*! Buttons for DataTables 2.4.2 | ||
/*! Buttons for DataTables 3.0.0 | ||
* © SpryMedia Ltd - datatables.net/license | ||
*/ | ||
!function(e){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return e(t,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(t,n){n.fn.dataTable||require("datatables.net")(t,n)},"undefined"==typeof window?module.exports=function(t,n){return t=t||window,n=n||o(t),i(t,n),e(n,t,t.document)}:(i(window,o),module.exports=e(o,window,window.document))):e(jQuery,window,document)}(function(y,v,x,w){"use strict";var e=y.fn.dataTable,o=0,C=0,_=e.ext.buttons,i=null;function A(t,n,e){y.fn.animate?t.stop().fadeIn(n,e):(t.css("display","block"),e&&e.call(t))}function k(t,n,e){y.fn.animate?t.stop().fadeOut(n,e):(t.css("display","none"),e&&e.call(t))}function B(n,t){if(!(this instanceof B))return function(t){return new B(t,n).container()};!0===(t=void 0===t?{}:t)&&(t={}),Array.isArray(t)&&(t={buttons:t}),this.c=y.extend(!0,{},B.defaults,t),t.buttons&&(this.c.buttons=t.buttons),this.s={dt:new e.Api(n),buttons:[],listenKeys:"",namespace:"dtb"+o++},this.dom={container:y("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)},this._constructor()}y.extend(B.prototype,{action:function(t,n){t=this._nodeToButton(t);return n===w?t.conf.action:(t.conf.action=n,this)},active:function(t,n){var t=this._nodeToButton(t),e=this.c.dom.button.active,o=y(t.node);return t.inCollection&&this.c.dom.collection.button&&this.c.dom.collection.button.active!==w&&(e=this.c.dom.collection.button.active),n===w?o.hasClass(e):(o.toggleClass(e,n===w||n),this)},add:function(t,n,e){var o=this.s.buttons;if("string"==typeof n){for(var i=n.split("-"),s=this.s,a=0,r=i.length-1;a<r;a++)s=s.buttons[+i[a]];o=s.buttons,n=+i[i.length-1]}return this._expandButton(o,t,t!==w?t.split:w,(t===w||t.split===w||0===t.split.length)&&s!==w,!1,n),e!==w&&!0!==e||this._draw(),this},collectionRebuild:function(t,n){var e=this._nodeToButton(t);if(n!==w){for(var o=e.buttons.length-1;0<=o;o--)this.remove(e.buttons[o].node);for(e.conf.prefixButtons&&n.unshift.apply(n,e.conf.prefixButtons),e.conf.postfixButtons&&n.push.apply(n,e.conf.postfixButtons),o=0;o<n.length;o++){var i=n[o];this._expandButton(e.buttons,i,i!==w&&i.config!==w&&i.config.split!==w,!0,i.parentConf!==w&&i.parentConf.split!==w,null,i.parentConf)}}this._draw(e.collection,e.buttons)},container:function(){return this.dom.container},disable:function(t){t=this._nodeToButton(t);return y(t.node).addClass(this.c.dom.button.disabled).prop("disabled",!0),this},destroy:function(){y("body").off("keyup."+this.s.namespace);for(var t=this.s.buttons.slice(),n=0,e=t.length;n<e;n++)this.remove(t[n].node);this.dom.container.remove();var o=this.s.dt.settings()[0];for(n=0,e=o.length;n<e;n++)if(o.inst===this){o.splice(n,1);break}return this},enable:function(t,n){return!1===n?this.disable(t):(n=this._nodeToButton(t),y(n.node).removeClass(this.c.dom.button.disabled).prop("disabled",!1),this)},index:function(t,n,e){n||(n="",e=this.s.buttons);for(var o=0,i=e.length;o<i;o++){var s=e[o].buttons;if(e[o].node===t)return n+o;if(s&&s.length){s=this.index(t,o+"-",s);if(null!==s)return s}}return null},name:function(){return this.c.name},node:function(t){return t?(t=this._nodeToButton(t),y(t.node)):this.dom.container},processing:function(t,n){var e=this.s.dt,o=this._nodeToButton(t);return n===w?y(o.node).hasClass("processing"):(y(o.node).toggleClass("processing",n),y(e.table().node()).triggerHandler("buttons-processing.dt",[n,e.button(t),e,y(t),o.conf]),this)},remove:function(t){var n=this._nodeToButton(t),e=this._nodeToHost(t),o=this.s.dt;if(n.buttons.length)for(var i=n.buttons.length-1;0<=i;i--)this.remove(n.buttons[i].node);n.conf.destroying=!0,n.conf.destroy&&n.conf.destroy.call(o.button(t),o,y(t),n.conf),this._removeKey(n.conf),y(n.node).remove();o=y.inArray(n,e);return e.splice(o,1),this},text:function(t,n){function e(t){return"function"==typeof t?t(i,s,o.conf):t}var o=this._nodeToButton(t),t=o.textNode,i=this.s.dt,s=y(o.node);return n===w?e(o.conf.text):(o.conf.text=n,t.html(e(n)),this)},_constructor:function(){var e=this,t=this.s.dt,o=t.settings()[0],n=this.c.buttons;o._buttons||(o._buttons=[]),o._buttons.push({inst:this,name:this.c.name});for(var i=0,s=n.length;i<s;i++)this.add(n[i]);t.on("destroy",function(t,n){n===o&&e.destroy()}),y("body").on("keyup."+this.s.namespace,function(t){var n;x.activeElement&&x.activeElement!==x.body||(n=String.fromCharCode(t.keyCode).toLowerCase(),-1!==e.s.listenKeys.toLowerCase().indexOf(n)&&e._keypress(n,t))})},_addKey:function(t){t.key&&(this.s.listenKeys+=(y.isPlainObject(t.key)?t.key:t).key)},_draw:function(t,n){t||(t=this.dom.container,n=this.s.buttons),t.children().detach();for(var e=0,o=n.length;e<o;e++)t.append(n[e].inserter),t.append(" "),n[e].buttons&&n[e].buttons.length&&this._draw(n[e].collection,n[e].buttons)},_expandButton:function(t,n,e,o,i,s,a){for(var r,l=this.s.dt,c=this.c.dom.collection,u=Array.isArray(n)?n:[n],d=0,f=(u=n===w?Array.isArray(e)?e:[e]:u).length;d<f;d++){var p=this._resolveExtends(u[d]);if(p)if(r=!(!p.config||!p.config.split),Array.isArray(p))this._expandButton(t,p,h!==w&&h.conf!==w?h.conf.split:w,o,a!==w&&a.split!==w,s,a);else{var h=this._buildButton(p,o,p.split!==w||p.config!==w&&p.config.split!==w,i);if(h){if(s!==w&&null!==s?(t.splice(s,0,h),s++):t.push(h),h.conf.buttons&&(h.collection=y("<"+c.container.content.tag+"/>"),h.conf._collection=h.collection,y(h.node).append(c.action.dropHtml),this._expandButton(h.buttons,h.conf.buttons,h.conf.split,!r,r,s,h.conf)),h.conf.split){h.collection=y("<"+c.container.tag+"/>"),h.conf._collection=h.collection;for(var b=0;b<h.conf.split.length;b++){var g=h.conf.split[b];"object"==typeof g&&(g.parent=a,g.collectionLayout===w&&(g.collectionLayout=h.conf.collectionLayout),g.dropup===w&&(g.dropup=h.conf.dropup),g.fade===w&&(g.fade=h.conf.fade))}this._expandButton(h.buttons,h.conf.buttons,h.conf.split,!r,r,s,h.conf)}h.conf.parent=a,p.init&&p.init.call(l.button(h.node),l,y(h.node),p)}}}},_buildButton:function(n,t,e,o){function i(t){return"function"==typeof t?t(u,l,n):t}var s,a,r,l,c=this.c.dom,u=this.s.dt,d=y.extend(!0,{},c.button);if(t&&e&&c.collection.split?y.extend(!0,d,c.collection.split.action):o||t?y.extend(!0,d,c.collection.button):e&&y.extend(!0,d,c.split.button),n.spacer)return c=y("<"+d.spacer.tag+"/>").addClass("dt-button-spacer "+n.style+" "+d.spacer.className).html(i(n.text)),{conf:n,node:c,inserter:c,buttons:[],inCollection:t,isSplit:e,collection:null,textNode:c};if(n.available&&!n.available(u,n)&&!n.hasOwnProperty("html"))return!1;n.hasOwnProperty("html")?l=y(n.html):(a=function(t,n,e,o){o.action.call(n.button(e),t,n,e,o),y(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o])},c=n.tag||d.tag,r=n.clickBlurs===w||n.clickBlurs,l=y("<"+c+"/>").addClass(d.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(t){t.preventDefault(),!l.hasClass(d.disabled)&&n.action&&a(t,u,l,n),r&&l.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),!l.hasClass(d.disabled)&&n.action&&a(t,u,l,n))}),"a"===c.toLowerCase()&&l.attr("href","#"),"button"===c.toLowerCase()&&l.attr("type","button"),s=d.liner.tag?(c=y("<"+d.liner.tag+"/>").html(i(n.text)).addClass(d.liner.className),"a"===d.liner.tag.toLowerCase()&&c.attr("href","#"),l.append(c),c):(l.html(i(n.text)),l),!1===n.enabled&&l.addClass(d.disabled),n.className&&l.addClass(n.className),n.titleAttr&&l.attr("title",i(n.titleAttr)),n.attr&&l.attr(n.attr),n.namespace||(n.namespace=".dt-button-"+C++),n.config!==w&&n.config.split&&(n.split=n.config.split));var f,p,h,b,g,m,c=this.c.dom.buttonContainer,c=c&&c.tag?y("<"+c.tag+"/>").addClass(c.className).append(l):l;return this._addKey(n),this.c.buttonCreated&&(c=this.c.buttonCreated(n,c)),e&&(p=(f=t?y.extend(!0,this.c.dom.split,this.c.dom.collection.split):this.c.dom.split).wrapper,h=y("<"+p.tag+"/>").addClass(p.className).append(l),b=y.extend(n,{align:f.dropdown.align,attr:{"aria-haspopup":"dialog","aria-expanded":!1},className:f.dropdown.className,closeButton:!1,splitAlignClass:f.dropdown.splitAlignClass,text:f.dropdown.text}),this._addKey(b),g=function(t,n,e,o){_.split.action.call(n.button(h),t,n,e,o),y(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o]),e.attr("aria-expanded",!0)},m=y('<button class="'+f.dropdown.className+' dt-button"></button>').html(f.dropdown.dropHtml).on("click.dtb",function(t){t.preventDefault(),t.stopPropagation(),m.hasClass(d.disabled)||g(t,u,m,b),r&&m.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),m.hasClass(d.disabled)||g(t,u,m,b))}),0===n.split.length&&m.addClass("dtb-hide-drop"),h.append(m).attr(b.attr)),{conf:n,node:(e?h:l).get(0),inserter:e?h:c,buttons:[],inCollection:t,isSplit:e,inSplit:o,collection:null,textNode:s}},_nodeToButton:function(t,n){for(var e=0,o=(n=n||this.s.buttons).length;e<o;e++){if(n[e].node===t)return n[e];if(n[e].buttons.length){var i=this._nodeToButton(t,n[e].buttons);if(i)return i}}},_nodeToHost:function(t,n){for(var e=0,o=(n=n||this.s.buttons).length;e<o;e++){if(n[e].node===t)return n;if(n[e].buttons.length){var i=this._nodeToHost(t,n[e].buttons);if(i)return i}}},_keypress:function(s,a){var r;a._buttonsHandled||(r=function(t){for(var n,e,o=0,i=t.length;o<i;o++)n=t[o].conf,e=t[o].node,!n.key||n.key!==s&&(!y.isPlainObject(n.key)||n.key.key!==s||n.key.shiftKey&&!a.shiftKey||n.key.altKey&&!a.altKey||n.key.ctrlKey&&!a.ctrlKey||n.key.metaKey&&!a.metaKey)||(a._buttonsHandled=!0,y(e).click()),t[o].buttons.length&&r(t[o].buttons)})(this.s.buttons)},_removeKey:function(t){var n;t.key&&(t=(y.isPlainObject(t.key)?t.key:t).key,n=this.s.listenKeys.split(""),t=y.inArray(t,n),n.splice(t,1),this.s.listenKeys=n.join(""))},_resolveExtends:function(e){function t(t){for(var n=0;!y.isPlainObject(t)&&!Array.isArray(t);){if(t===w)return;if("function"==typeof t){if(!(t=t.call(i,s,e)))return!1}else if("string"==typeof t){if(!_[t])return{html:t};t=_[t]}if(30<++n)throw"Buttons: Too many iterations"}return Array.isArray(t)?t:y.extend({},t)}var n,o,i=this,s=this.s.dt;for(e=t(e);e&&e.extend;){if(!_[e.extend])throw"Cannot extend unknown button type: "+e.extend;var a=t(_[e.extend]);if(Array.isArray(a))return a;if(!a)return!1;var r=a.className;e.config!==w&&a.config!==w&&(e.config=y.extend({},a.config,e.config)),e=y.extend({},a,e),r&&e.className!==r&&(e.className=r+" "+e.className),e.extend=a.extend}var l=e.postfixButtons;if(l)for(e.buttons||(e.buttons=[]),n=0,o=l.length;n<o;n++)e.buttons.push(l[n]);var c=e.prefixButtons;if(c)for(e.buttons||(e.buttons=[]),n=0,o=c.length;n<o;n++)e.buttons.splice(n,0,c[n]);return e},_popover:function(o,t,n,e){function i(){h=!0,k(y(g),b.fade,function(){y(this).detach()}),y(f.buttons('[aria-haspopup="dialog"][aria-expanded="true"]').nodes()).attr("aria-expanded","false"),y("div.dt-button-background").off("click.dtb-collection"),B.background(!1,b.backgroundClassName,b.fade,m),y(v).off("resize.resize.dtb-collection"),y("body").off(".dtb-collection"),f.off("buttons-action.b-internal"),f.off("destroy")}var s,a,r,l,c,u,d,f=t,p=this.c,h=!1,b=y.extend({align:"button-left",autoClose:!1,background:!0,backgroundClassName:"dt-button-background",closeButton:!0,containerClassName:p.dom.collection.container.className,contentClassName:p.dom.collection.container.content.className,collectionLayout:"",collectionTitle:"",dropup:!1,fade:400,popoverTitle:"",rightAlignClassName:"dt-button-right",tag:p.dom.collection.container.tag},n),g=b.tag+"."+b.containerClassName.replace(/ /g,"."),m=t.node();!1===o?i():((p=y(f.buttons('[aria-haspopup="dialog"][aria-expanded="true"]').nodes())).length&&(m.closest(g).length&&(m=p.eq(0)),i()),n=y(".dt-button",o).length,p="",3===n?p="dtb-b3":2===n?p="dtb-b2":1===n&&(p="dtb-b1"),s=y("<"+b.tag+"/>").addClass(b.containerClassName).addClass(b.collectionLayout).addClass(b.splitAlignClass).addClass(p).css("display","none").attr({"aria-modal":!0,role:"dialog"}),o=y(o).addClass(b.contentClassName).attr("role","menu").appendTo(s),m.attr("aria-expanded","true"),m.parents("body")[0]!==x.body&&(m=x.body.lastChild),b.popoverTitle?s.prepend('<div class="dt-button-collection-title">'+b.popoverTitle+"</div>"):b.collectionTitle&&s.prepend('<div class="dt-button-collection-title">'+b.collectionTitle+"</div>"),b.closeButton&&s.prepend('<div class="dtb-popover-close">×</div>').addClass("dtb-collection-closeable"),A(s.insertAfter(m),b.fade),n=y(t.table().container()),d=s.css("position"),"container"!==b.span&&"dt-container"!==b.align||(m=m.parent(),s.css("width",n.width())),"absolute"===d?(p=y(m[0].offsetParent),t=m.position(),n=m.offset(),a=p.offset(),r=p.position(),l=v.getComputedStyle(p[0]),a.height=p.outerHeight(),a.width=p.width()+parseFloat(l.paddingLeft),a.right=a.left+a.width,a.bottom=a.top+a.height,p=t.top+m.outerHeight(),c=t.left,s.css({top:p,left:c}),l=v.getComputedStyle(s[0]),(u=s.offset()).height=s.outerHeight(),u.width=s.outerWidth(),u.right=u.left+u.width,u.bottom=u.top+u.height,u.marginTop=parseFloat(l.marginTop),u.marginBottom=parseFloat(l.marginBottom),b.dropup&&(p=t.top-u.height-u.marginTop-u.marginBottom),"button-right"!==b.align&&!s.hasClass(b.rightAlignClassName)||(c=t.left-u.width+m.outerWidth()),"dt-container"!==b.align&&"container"!==b.align||(c=c<t.left?-t.left:c)+u.width>a.width&&(c=a.width-u.width),r.left+c+u.width>y(v).width()&&(c=y(v).width()-u.width-r.left),n.left+c<0&&(c=-n.left),r.top+p+u.height>y(v).height()+y(v).scrollTop()&&(p=t.top-u.height-u.marginTop-u.marginBottom),r.top+p<y(v).scrollTop()&&(p=t.top+m.outerHeight()),s.css({top:p,left:c})):((d=function(){var t=y(v).height()/2,n=s.height()/2;s.css("marginTop",-1*(n=t<n?t:n))})(),y(v).on("resize.dtb-collection",function(){d()})),b.background&&B.background(!0,b.backgroundClassName,b.fade,b.backgroundHost||m),y("div.dt-button-background").on("click.dtb-collection",function(){}),b.autoClose&&setTimeout(function(){f.on("buttons-action.b-internal",function(t,n,e,o){o[0]!==m[0]&&i()})},0),y(s).trigger("buttons-popover.dt"),f.on("destroy",i),setTimeout(function(){h=!1,y("body").on("click.dtb-collection",function(t){var n,e;h||(n=y.fn.addBack?"addBack":"andSelf",e=y(t.target).parent()[0],(y(t.target).parents()[n]().filter(o).length||y(e).hasClass("dt-buttons"))&&!y(t.target).hasClass("dt-button-background")||i())}).on("keyup.dtb-collection",function(t){27===t.keyCode&&i()}).on("keydown.dtb-collection",function(t){var n=y("a, button",o),e=x.activeElement;9===t.keyCode&&(-1===n.index(e)?(n.first().focus(),t.preventDefault()):t.shiftKey?e===n[0]&&(n.last().focus(),t.preventDefault()):e===n.last()[0]&&(n.first().focus(),t.preventDefault()))})},0))}}),B.background=function(t,n,e,o){e===w&&(e=400),o=o||x.body,t?A(y("<div/>").addClass(n).css("display","none").insertAfter(o),e):k(y("div."+n),e,function(){y(this).removeClass(n).remove()})},B.instanceSelector=function(t,i){var s,a,r;return t===w||null===t?y.map(i,function(t){return t.inst}):(s=[],a=y.map(i,function(t){return t.name}),(r=function(t){var n;if(Array.isArray(t))for(var e=0,o=t.length;e<o;e++)r(t[e]);else"string"==typeof t?-1!==t.indexOf(",")?r(t.split(",")):-1!==(n=y.inArray(t.trim(),a))&&s.push(i[n].inst):"number"==typeof t?s.push(i[t].inst):"object"==typeof t&&s.push(t)})(t),s)},B.buttonSelector=function(t,n){for(var c=[],u=function(t,n,e){for(var o,i,s=0,a=n.length;s<a;s++)(o=n[s])&&(t.push({node:o.node,name:o.conf.name,idx:i=e!==w?e+s:s+""}),o.buttons&&u(t,o.buttons,i+"-"))},d=function(t,n){var e=[],o=(u(e,n.s.buttons),y.map(e,function(t){return t.node}));if(Array.isArray(t)||t instanceof y)for(s=0,a=t.length;s<a;s++)d(t[s],n);else if(null===t||t===w||"*"===t)for(s=0,a=e.length;s<a;s++)c.push({inst:n,node:e[s].node});else if("number"==typeof t)n.s.buttons[t]&&c.push({inst:n,node:n.s.buttons[t].node});else if("string"==typeof t)if(-1!==t.indexOf(","))for(var i=t.split(","),s=0,a=i.length;s<a;s++)d(i[s].trim(),n);else if(t.match(/^\d+(\-\d+)*$/)){var r=y.map(e,function(t){return t.idx});c.push({inst:n,node:e[y.inArray(t,r)].node})}else if(-1!==t.indexOf(":name")){var l=t.replace(":name","");for(s=0,a=e.length;s<a;s++)e[s].name===l&&c.push({inst:n,node:e[s].node})}else y(o).filter(t).each(function(){c.push({inst:n,node:this})});else"object"!=typeof t||!t.nodeName||-1!==(r=y.inArray(t,o))&&c.push({inst:n,node:o[r]})},e=0,o=t.length;e<o;e++){var i=t[e];d(n,i)}return c},B.stripData=function(t,n){return"string"==typeof t&&(t=(t=t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"")).replace(/<!\-\-.*?\-\->/g,""),n&&!n.stripHtml||(t=t.replace(/<[^>]*>/g,"")),n&&!n.trim||(t=t.replace(/^\s+|\s+$/g,"")),n&&!n.stripNewlines||(t=t.replace(/\n/g," ")),n&&!n.decodeEntities||(t=i?i(t):(c.innerHTML=t,c.value))),t},B.entityDecoder=function(t){i=t},B.defaults={buttons:["copy","excel","csv","pdf","print"],name:"main",tabIndex:0,dom:{container:{tag:"div",className:"dt-buttons"},collection:{action:{dropHtml:'<span class="dt-button-down-arrow">▼</span>'},container:{className:"dt-button-collection",content:{className:"",tag:"div"},tag:"div"}},button:{tag:"button",className:"dt-button",active:"dt-button-active",disabled:"disabled",spacer:{className:"dt-button-spacer",tag:"span"},liner:{tag:"span",className:""}},split:{action:{className:"dt-button-split-drop-button dt-button",tag:"button"},dropdown:{align:"split-right",className:"dt-button-split-drop",dropHtml:'<span class="dt-button-down-arrow">▼</span>',splitAlignClass:"dt-button-split-left",tag:"button"},wrapper:{className:"dt-button-split",tag:"div"}}}},y.extend(_,{collection:{text:function(t){return t.i18n("buttons.collection","Collection")},className:"buttons-collection",closeButton:!(B.version="2.4.2"),init:function(t,n,e){n.attr("aria-expanded",!1)},action:function(t,n,e,o){o._collection.parents("body").length?this.popover(!1,o):this.popover(o._collection,o),"keypress"===t.type&&y("a, button",o._collection).eq(0).focus()},attr:{"aria-haspopup":"dialog"}},split:{text:function(t){return t.i18n("buttons.split","Split")},className:"buttons-split",closeButton:!1,init:function(t,n,e){return n.attr("aria-expanded",!1)},action:function(t,n,e,o){this.popover(o._collection,o)},attr:{"aria-haspopup":"dialog"}},copy:function(t,n){if(_.copyHtml5)return"copyHtml5"},csv:function(t,n){if(_.csvHtml5&&_.csvHtml5.available(t,n))return"csvHtml5"},excel:function(t,n){if(_.excelHtml5&&_.excelHtml5.available(t,n))return"excelHtml5"},pdf:function(t,n){if(_.pdfHtml5&&_.pdfHtml5.available(t,n))return"pdfHtml5"},pageLength:function(t){var n=t.settings()[0].aLengthMenu,e=[],o=[];if(Array.isArray(n[0]))e=n[0],o=n[1];else for(var i=0;i<n.length;i++){var s=n[i];y.isPlainObject(s)?(e.push(s.value),o.push(s.label)):(e.push(s),o.push(s))}return{extend:"collection",text:function(t){return t.i18n("buttons.pageLength",{"-1":"Show all rows",_:"Show %d rows"},t.page.len())},className:"buttons-page-length",autoClose:!0,buttons:y.map(e,function(s,t){return{text:o[t],className:"button-page-length",action:function(t,n){n.page.len(s).draw()},init:function(t,n,e){function o(){i.active(t.page.len()===s)}var i=this;t.on("length.dt"+e.namespace,o),o()},destroy:function(t,n,e){t.off("length.dt"+e.namespace)}}}),init:function(t,n,e){var o=this;t.on("length.dt"+e.namespace,function(){o.text(e.text)})},destroy:function(t,n,e){t.off("length.dt"+e.namespace)}}},spacer:{style:"empty",spacer:!0,text:function(t){return t.i18n("buttons.spacer","")}}}),e.Api.register("buttons()",function(n,e){e===w&&(e=n,n=w),this.selector.buttonGroup=n;var t=this.iterator(!0,"table",function(t){if(t._buttons)return B.buttonSelector(B.instanceSelector(n,t._buttons),e)},!0);return t._groupSelector=n,t}),e.Api.register("button()",function(t,n){t=this.buttons(t,n);return 1<t.length&&t.splice(1,t.length),t}),e.Api.registerPlural("buttons().active()","button().active()",function(n){return n===w?this.map(function(t){return t.inst.active(t.node)}):this.each(function(t){t.inst.active(t.node,n)})}),e.Api.registerPlural("buttons().action()","button().action()",function(n){return n===w?this.map(function(t){return t.inst.action(t.node)}):this.each(function(t){t.inst.action(t.node,n)})}),e.Api.registerPlural("buttons().collectionRebuild()","button().collectionRebuild()",function(e){return this.each(function(t){for(var n=0;n<e.length;n++)"object"==typeof e[n]&&(e[n].parentConf=t);t.inst.collectionRebuild(t.node,e)})}),e.Api.register(["buttons().enable()","button().enable()"],function(n){return this.each(function(t){t.inst.enable(t.node,n)})}),e.Api.register(["buttons().disable()","button().disable()"],function(){return this.each(function(t){t.inst.disable(t.node)})}),e.Api.register("button().index()",function(){var n=null;return this.each(function(t){t=t.inst.index(t.node);null!==t&&(n=t)}),n}),e.Api.registerPlural("buttons().nodes()","button().node()",function(){var n=y();return y(this.each(function(t){n=n.add(t.inst.node(t.node))})),n}),e.Api.registerPlural("buttons().processing()","button().processing()",function(n){return n===w?this.map(function(t){return t.inst.processing(t.node)}):this.each(function(t){t.inst.processing(t.node,n)})}),e.Api.registerPlural("buttons().text()","button().text()",function(n){return n===w?this.map(function(t){return t.inst.text(t.node)}):this.each(function(t){t.inst.text(t.node,n)})}),e.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(t){t.inst.node(t.node).trigger("click")})}),e.Api.register("button().popover()",function(n,e){return this.map(function(t){return t.inst._popover(n,this.button(this[0].node),e)})}),e.Api.register("buttons().containers()",function(){var i=y(),s=this._groupSelector;return this.iterator(!0,"table",function(t){if(t._buttons)for(var n=B.instanceSelector(s,t._buttons),e=0,o=n.length;e<o;e++)i=i.add(n[e].container())}),i}),e.Api.register("buttons().container()",function(){return this.containers().eq(0)}),e.Api.register("button().add()",function(t,n,e){var o=this.context;return o.length&&(o=B.instanceSelector(this._groupSelector,o[0]._buttons)).length&&o[0].add(n,t,e),this.button(this._groupSelector,t)}),e.Api.register("buttons().destroy()",function(){return this.pluck("inst").unique().each(function(t){t.destroy()}),this}),e.Api.registerPlural("buttons().remove()","buttons().remove()",function(){return this.each(function(t){t.inst.remove(t.node)}),this}),e.Api.register("buttons.info()",function(t,n,e){var o=this;return!1===t?(this.off("destroy.btn-info"),k(y("#datatables_buttons_info"),400,function(){y(this).remove()}),clearTimeout(s),s=null):(s&&clearTimeout(s),y("#datatables_buttons_info").length&&y("#datatables_buttons_info").remove(),t=t?"<h2>"+t+"</h2>":"",A(y('<div id="datatables_buttons_info" class="dt-button-info"/>').html(t).append(y("<div/>")["string"==typeof n?"html":"append"](n)).css("display","none").appendTo("body")),e!==w&&0!==e&&(s=setTimeout(function(){o.buttons.info(!1)},e)),this.on("destroy.btn-info",function(){o.buttons.info(!1)})),this}),e.Api.register("buttons.exportData()",function(t){if(this.context.length)return u(new e.Api(this.context[0]),t)}),e.Api.register("buttons.exportInfo()",function(t){return{filename:n(t=t||{}),title:r(t),messageTop:l(this,t.message||t.messageTop,"top"),messageBottom:l(this,t.messageBottom,"bottom")}});var s,n=function(t){var n;return(n="function"==typeof(n="*"===t.filename&&"*"!==t.title&&t.title!==w&&null!==t.title&&""!==t.title?t.title:t.filename)?n():n)===w||null===n?null:(n=(n=-1!==n.indexOf("*")?n.replace("*",y("head > title").text()).trim():n).replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""))+(a(t.extension)||"")},a=function(t){return null===t||t===w?null:"function"==typeof t?t():t},r=function(t){t=a(t.title);return null===t?null:-1!==t.indexOf("*")?t.replace("*",y("head > title").text()||"Exported data"):t},l=function(t,n,e){n=a(n);return null===n?null:(t=y("caption",t.table().container()).eq(0),"*"===n?t.css("caption-side")!==e?null:t.length?t.text():"":n)},c=y("<textarea/>")[0],u=function(e,t){for(var o=y.extend(!0,{},{rows:null,columns:"",modifier:{search:"applied",order:"applied"},orthogonal:"display",stripHtml:!0,stripNewlines:!0,decodeEntities:!0,trim:!0,format:{header:function(t){return B.stripData(t,o)},footer:function(t){return B.stripData(t,o)},body:function(t){return B.stripData(t,o)}},customizeData:null},t),t=e.columns(o.columns).indexes().map(function(t){var n=e.column(t).header();return o.format.header(n.innerHTML,t,n)}).toArray(),n=e.table().footer()?e.columns(o.columns).indexes().map(function(t){var n=e.column(t).footer();return o.format.footer(n?n.innerHTML:"",t,n)}).toArray():null,i=y.extend({},o.modifier),i=(e.select&&"function"==typeof e.select.info&&i.selected===w&&e.rows(o.rows,y.extend({selected:!0},i)).any()&&y.extend(i,{selected:!0}),e.rows(o.rows,i).indexes().toArray()),i=e.cells(i,o.columns),s=i.render(o.orthogonal).toArray(),a=i.nodes().toArray(),r=t.length,l=[],c=0,u=0,d=0<r?s.length/r:0;u<d;u++){for(var f=[r],p=0;p<r;p++)f[p]=o.format.body(s[c],u,p,a[c]),c++;l[u]=f}i={header:t,footer:n,body:l};return o.customizeData&&o.customizeData(i),i};function t(t,n){t=new e.Api(t),n=n||t.init().buttons||e.defaults.buttons;return new B(t,n).container()}return y.fn.dataTable.Buttons=B,y.fn.DataTable.Buttons=B,y(x).on("init.dt plugin-init.dt",function(t,n){"dt"===t.namespace&&(t=n.oInit.buttons||e.defaults.buttons)&&!n._buttons&&new B(n,t).container()}),e.ext.feature.push({fnInit:t,cFeature:"B"}),e.ext.features&&e.ext.features.register("buttons",t),e}); | ||
!function(e){var o,i;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(t){return e(t,window,document)}):"object"==typeof exports?(o=require("jquery"),i=function(t,n){n.fn.dataTable||require("datatables.net")(t,n)},"undefined"==typeof window?module.exports=function(t,n){return t=t||window,n=n||o(t),i(t,n),e(n,t,t.document)}:(i(window,o),module.exports=e(o,window,window.document))):e(jQuery,window,document)}(function(x,g,m){"use strict";var e=x.fn.dataTable,o=0,C=0,w=e.ext.buttons,i=null;function v(t,n,e){x.fn.animate?t.stop().fadeIn(n,e):(t.css("display","block"),e&&e.call(t))}function y(t,n,e){x.fn.animate?t.stop().fadeOut(n,e):(t.css("display","none"),e&&e.call(t))}function _(n,t){if(!e.versionCheck("2"))throw"Warning: Buttons requires DataTables 2 or newer";if(!(this instanceof _))return function(t){return new _(t,n).container()};!0===(t=void 0===t?{}:t)&&(t={}),Array.isArray(t)&&(t={buttons:t}),this.c=x.extend(!0,{},_.defaults,t),t.buttons&&(this.c.buttons=t.buttons),this.s={dt:new e.Api(n),buttons:[],listenKeys:"",namespace:"dtb"+o++},this.dom={container:x("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)},this._constructor()}x.extend(_.prototype,{action:function(t,n){t=this._nodeToButton(t);return void 0===n?t.conf.action:(t.conf.action=n,this)},active:function(t,n){var t=this._nodeToButton(t),e=this.c.dom.button.active,o=x(t.node);return t.inCollection&&this.c.dom.collection.button&&void 0!==this.c.dom.collection.button.active&&(e=this.c.dom.collection.button.active),void 0===n?o.hasClass(e):(o.toggleClass(e,void 0===n||n),this)},add:function(t,n,e){var o=this.s.buttons;if("string"==typeof n){for(var i=n.split("-"),s=this.s,a=0,r=i.length-1;a<r;a++)s=s.buttons[+i[a]];o=s.buttons,n=+i[i.length-1]}return this._expandButton(o,t,void 0!==t?t.split:void 0,(void 0===t||void 0===t.split||0===t.split.length)&&void 0!==s,!1,n),void 0!==e&&!0!==e||this._draw(),this},collectionRebuild:function(t,n){var e=this._nodeToButton(t);if(void 0!==n){for(var o=e.buttons.length-1;0<=o;o--)this.remove(e.buttons[o].node);for(e.conf.prefixButtons&&n.unshift.apply(n,e.conf.prefixButtons),e.conf.postfixButtons&&n.push.apply(n,e.conf.postfixButtons),o=0;o<n.length;o++){var i=n[o];this._expandButton(e.buttons,i,void 0!==i&&void 0!==i.config&&void 0!==i.config.split,!0,void 0!==i.parentConf&&void 0!==i.parentConf.split,null,i.parentConf)}}this._draw(e.collection,e.buttons)},container:function(){return this.dom.container},disable:function(t){t=this._nodeToButton(t);return x(t.node).addClass(this.c.dom.button.disabled).prop("disabled",!0),this},destroy:function(){x("body").off("keyup."+this.s.namespace);for(var t=this.s.buttons.slice(),n=0,e=t.length;n<e;n++)this.remove(t[n].node);this.dom.container.remove();var o=this.s.dt.settings()[0];for(n=0,e=o.length;n<e;n++)if(o.inst===this){o.splice(n,1);break}return this},enable:function(t,n){return!1===n?this.disable(t):(n=this._nodeToButton(t),x(n.node).removeClass(this.c.dom.button.disabled).prop("disabled",!1),this)},index:function(t,n,e){n||(n="",e=this.s.buttons);for(var o=0,i=e.length;o<i;o++){var s=e[o].buttons;if(e[o].node===t)return n+o;if(s&&s.length){s=this.index(t,o+"-",s);if(null!==s)return s}}return null},name:function(){return this.c.name},node:function(t){return t?(t=this._nodeToButton(t),x(t.node)):this.dom.container},processing:function(t,n){var e=this.s.dt,o=this._nodeToButton(t);return void 0===n?x(o.node).hasClass("processing"):(x(o.node).toggleClass("processing",n),x(e.table().node()).triggerHandler("buttons-processing.dt",[n,e.button(t),e,x(t),o.conf]),this)},remove:function(t){var n=this._nodeToButton(t),e=this._nodeToHost(t),o=this.s.dt;if(n.buttons.length)for(var i=n.buttons.length-1;0<=i;i--)this.remove(n.buttons[i].node);n.conf.destroying=!0,n.conf.destroy&&n.conf.destroy.call(o.button(t),o,x(t),n.conf),this._removeKey(n.conf),x(n.node).remove();o=x.inArray(n,e);return e.splice(o,1),this},text:function(t,n){function e(t){return"function"==typeof t?t(i,s,o.conf):t}var o=this._nodeToButton(t),t=o.textNode,i=this.s.dt,s=x(o.node);return void 0===n?e(o.conf.text):(o.conf.text=n,t.html(e(n)),this)},_constructor:function(){var e=this,t=this.s.dt,o=t.settings()[0],n=this.c.buttons;o._buttons||(o._buttons=[]),o._buttons.push({inst:this,name:this.c.name});for(var i=0,s=n.length;i<s;i++)this.add(n[i]);t.on("destroy",function(t,n){n===o&&e.destroy()}),x("body").on("keyup."+this.s.namespace,function(t){var n;m.activeElement&&m.activeElement!==m.body||(n=String.fromCharCode(t.keyCode).toLowerCase(),-1!==e.s.listenKeys.toLowerCase().indexOf(n)&&e._keypress(n,t))})},_addKey:function(t){t.key&&(this.s.listenKeys+=(x.isPlainObject(t.key)?t.key:t).key)},_draw:function(t,n){t||(t=this.dom.container,n=this.s.buttons),t.children().detach();for(var e=0,o=n.length;e<o;e++)t.append(n[e].inserter),t.append(" "),n[e].buttons&&n[e].buttons.length&&this._draw(n[e].collection,n[e].buttons)},_expandButton:function(t,n,e,o,i,s,a){for(var r,l=this.s.dt,c=this.c.dom.collection,u=Array.isArray(n)?n:[n],d=0,f=(u=void 0===n?Array.isArray(e)?e:[e]:u).length;d<f;d++){var p=this._resolveExtends(u[d]);if(p)if(r=!(!p.config||!p.config.split),Array.isArray(p))this._expandButton(t,p,void 0!==h&&void 0!==h.conf?h.conf.split:void 0,o,void 0!==a&&void 0!==a.split,s,a);else{var h=this._buildButton(p,o,void 0!==p.split||void 0!==p.config&&void 0!==p.config.split,i);if(h){if(null!=s?(t.splice(s,0,h),s++):t.push(h),h.conf.buttons&&(h.collection=x("<"+c.container.content.tag+"/>"),h.conf._collection=h.collection,x(h.node).append(c.action.dropHtml),this._expandButton(h.buttons,h.conf.buttons,h.conf.split,!r,r,s,h.conf)),h.conf.split){h.collection=x("<"+c.container.tag+"/>"),h.conf._collection=h.collection;for(var b=0;b<h.conf.split.length;b++){var g=h.conf.split[b];"object"==typeof g&&(g.parent=a,void 0===g.collectionLayout&&(g.collectionLayout=h.conf.collectionLayout),void 0===g.dropup&&(g.dropup=h.conf.dropup),void 0===g.fade)&&(g.fade=h.conf.fade)}this._expandButton(h.buttons,h.conf.buttons,h.conf.split,!r,r,s,h.conf)}h.conf.parent=a,p.init&&p.init.call(l.button(h.node),l,x(h.node),p)}}}},_buildButton:function(n,t,e,o){function i(t){return"function"==typeof t?t(f,c,n):t}var s,a,r,l,c,u=this,d=this.c.dom,f=this.s.dt,p=x.extend(!0,{},d.button);if(t&&e&&d.collection.split?x.extend(!0,p,d.collection.split.action):o||t?x.extend(!0,p,d.collection.button):e&&x.extend(!0,p,d.split.button),n.spacer)return d=x("<"+p.spacer.tag+"/>").addClass("dt-button-spacer "+n.style+" "+p.spacer.className).html(i(n.text)),{conf:n,node:d,inserter:d,buttons:[],inCollection:t,isSplit:e,collection:null,textNode:d};if(n.available&&!n.available(f,n)&&!n.html)return!1;n.html?c=x(n.html):(a=function(t,n,e,o,i){o.action.call(n.button(e),t,n,e,o,i),x(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o])},r=function(t,n,e,o){o.async?(u.processing(e[0],!0),setTimeout(function(){a(t,n,e,o,function(){u.processing(e[0],!1)})},o.async)):a(t,n,e,o,function(){})},d=n.tag||p.tag,l=void 0===n.clickBlurs||n.clickBlurs,c=x("<"+d+"/>").addClass(p.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(t){t.preventDefault(),!c.hasClass(p.disabled)&&n.action&&r(t,f,c,n),l&&c.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),!c.hasClass(p.disabled))&&n.action&&r(t,f,c,n)}),"a"===d.toLowerCase()&&c.attr("href","#"),"button"===d.toLowerCase()&&c.attr("type","button"),s=p.liner.tag?(d=x("<"+p.liner.tag+"/>").html(i(n.text)).addClass(p.liner.className),"a"===p.liner.tag.toLowerCase()&&d.attr("href","#"),c.append(d),d):(c.html(i(n.text)),c),!1===n.enabled&&c.addClass(p.disabled),n.className&&c.addClass(n.className),n.titleAttr&&c.attr("title",i(n.titleAttr)),n.attr&&c.attr(n.attr),n.namespace||(n.namespace=".dt-button-"+C++),void 0!==n.config&&n.config.split&&(n.split=n.config.split));var h,b,g,m,v,y,d=this.c.dom.buttonContainer,d=d&&d.tag?x("<"+d.tag+"/>").addClass(d.className).append(c):c;return this._addKey(n),this.c.buttonCreated&&(d=this.c.buttonCreated(n,d)),e&&(b=(h=t?x.extend(!0,this.c.dom.split,this.c.dom.collection.split):this.c.dom.split).wrapper,g=x("<"+b.tag+"/>").addClass(b.className).append(c),m=x.extend(n,{align:h.dropdown.align,attr:{"aria-haspopup":"dialog","aria-expanded":!1},className:h.dropdown.className,closeButton:!1,splitAlignClass:h.dropdown.splitAlignClass,text:h.dropdown.text}),this._addKey(m),v=function(t,n,e,o){w.split.action.call(n.button(g),t,n,e,o),x(n.table().node()).triggerHandler("buttons-action.dt",[n.button(e),n,e,o]),e.attr("aria-expanded",!0)},y=x('<button class="'+h.dropdown.className+' dt-button"></button>').html(h.dropdown.dropHtml).on("click.dtb",function(t){t.preventDefault(),t.stopPropagation(),y.hasClass(p.disabled)||v(t,f,y,m),l&&y.trigger("blur")}).on("keypress.dtb",function(t){13===t.keyCode&&(t.preventDefault(),y.hasClass(p.disabled)||v(t,f,y,m))}),0===n.split.length&&y.addClass("dtb-hide-drop"),g.append(y).attr(m.attr)),{conf:n,node:(e?g:c).get(0),inserter:e?g:d,buttons:[],inCollection:t,isSplit:e,inSplit:o,collection:null,textNode:s}},_nodeToButton:function(t,n){for(var e=0,o=(n=n||this.s.buttons).length;e<o;e++){if(n[e].node===t)return n[e];if(n[e].buttons.length){var i=this._nodeToButton(t,n[e].buttons);if(i)return i}}},_nodeToHost:function(t,n){for(var e=0,o=(n=n||this.s.buttons).length;e<o;e++){if(n[e].node===t)return n;if(n[e].buttons.length){var i=this._nodeToHost(t,n[e].buttons);if(i)return i}}},_keypress:function(s,a){var r;a._buttonsHandled||(r=function(t){for(var n,e,o=0,i=t.length;o<i;o++)n=t[o].conf,e=t[o].node,!n.key||n.key!==s&&(!x.isPlainObject(n.key)||n.key.key!==s||n.key.shiftKey&&!a.shiftKey||n.key.altKey&&!a.altKey||n.key.ctrlKey&&!a.ctrlKey||n.key.metaKey&&!a.metaKey)||(a._buttonsHandled=!0,x(e).click()),t[o].buttons.length&&r(t[o].buttons)})(this.s.buttons)},_removeKey:function(t){var n;t.key&&(t=(x.isPlainObject(t.key)?t.key:t).key,n=this.s.listenKeys.split(""),t=x.inArray(t,n),n.splice(t,1),this.s.listenKeys=n.join(""))},_resolveExtends:function(e){function t(t){for(var n=0;!x.isPlainObject(t)&&!Array.isArray(t);){if(void 0===t)return;if("function"==typeof t){if(!(t=t.call(i,s,e)))return!1}else if("string"==typeof t){if(!w[t])return{html:t};t=w[t]}if(30<++n)throw"Buttons: Too many iterations"}return Array.isArray(t)?t:x.extend({},t)}var n,o,i=this,s=this.s.dt;for(e=t(e);e&&e.extend;){if(!w[e.extend])throw"Cannot extend unknown button type: "+e.extend;var a=t(w[e.extend]);if(Array.isArray(a))return a;if(!a)return!1;var r=a.className;void 0!==e.config&&void 0!==a.config&&(e.config=x.extend({},a.config,e.config)),e=x.extend({},a,e),r&&e.className!==r&&(e.className=r+" "+e.className),e.extend=a.extend}var l=e.postfixButtons;if(l)for(e.buttons||(e.buttons=[]),n=0,o=l.length;n<o;n++)e.buttons.push(l[n]);var c=e.prefixButtons;if(c)for(e.buttons||(e.buttons=[]),n=0,o=c.length;n<o;n++)e.buttons.splice(n,0,c[n]);return e},_popover:function(o,t,n){function i(){f=!0,y(x(h),p.fade,function(){x(this).detach()}),x(u.buttons('[aria-haspopup="dialog"][aria-expanded="true"]').nodes()).attr("aria-expanded","false"),x("div.dt-button-background").off("click.dtb-collection"),_.background(!1,p.backgroundClassName,p.fade,b),x(g).off("resize.resize.dtb-collection"),x("body").off(".dtb-collection"),u.off("buttons-action.b-internal"),u.off("destroy")}var e,s,a,r,l,c,u=t,d=this.c,f=!1,p=x.extend({align:"button-left",autoClose:!1,background:!0,backgroundClassName:"dt-button-background",closeButton:!0,containerClassName:d.dom.collection.container.className,contentClassName:d.dom.collection.container.content.className,collectionLayout:"",collectionTitle:"",dropup:!1,fade:400,popoverTitle:"",rightAlignClassName:"dt-button-right",tag:d.dom.collection.container.tag},n),h=p.tag+"."+p.containerClassName.replace(/ /g,"."),b=t.node();!1===o?i():((d=x(u.buttons('[aria-haspopup="dialog"][aria-expanded="true"]').nodes())).length&&(b.closest(h).length&&(b=d.eq(0)),i()),n=x(".dt-button",o).length,d="",3===n?d="dtb-b3":2===n?d="dtb-b2":1===n&&(d="dtb-b1"),e=x("<"+p.tag+"/>").addClass(p.containerClassName).addClass(p.collectionLayout).addClass(p.splitAlignClass).addClass(d).css("display","none").attr({"aria-modal":!0,role:"dialog"}),o=x(o).addClass(p.contentClassName).attr("role","menu").appendTo(e),b.attr("aria-expanded","true"),b.parents("body")[0]!==m.body&&(b=m.body.lastChild),p.popoverTitle?e.prepend('<div class="dt-button-collection-title">'+p.popoverTitle+"</div>"):p.collectionTitle&&e.prepend('<div class="dt-button-collection-title">'+p.collectionTitle+"</div>"),p.closeButton&&e.prepend('<div class="dtb-popover-close">×</div>').addClass("dtb-collection-closeable"),v(e.insertAfter(b),p.fade),n=x(t.table().container()),d=e.css("position"),"container"!==p.span&&"dt-container"!==p.align||(b=b.parent(),e.css("width",n.width())),"absolute"===d?(t=x(b[0].offsetParent),n=b.position(),d=b.offset(),r=t.offset(),s=t.position(),a=g.getComputedStyle(t[0]),r.height=t.outerHeight(),r.width=t.width()+parseFloat(a.paddingLeft),r.right=r.left+r.width,r.bottom=r.top+r.height,t=n.top+b.outerHeight(),r=n.left,e.css({top:t,left:r}),a=g.getComputedStyle(e[0]),(l=e.offset()).height=e.outerHeight(),l.width=e.outerWidth(),l.right=l.left+l.width,l.bottom=l.top+l.height,l.marginTop=parseFloat(a.marginTop),l.marginBottom=parseFloat(a.marginBottom),p.dropup&&(t=n.top-l.height-l.marginTop-l.marginBottom),"button-right"!==p.align&&!e.hasClass(p.rightAlignClassName)||(r=n.left-l.width+b.outerWidth()),"dt-container"!==p.align&&"container"!==p.align||r<n.left&&(r=-n.left),s.left+r+l.width>x(g).width()&&(r=x(g).width()-l.width-s.left),d.left+r<0&&(r=-d.left),s.top+t+l.height>x(g).height()+x(g).scrollTop()&&(t=n.top-l.height-l.marginTop-l.marginBottom),s.top+t<x(g).scrollTop()&&(t=n.top+b.outerHeight()),e.css({top:t,left:r})):((c=function(){var t=x(g).height()/2,n=e.height()/2;e.css("marginTop",-1*(n=t<n?t:n))})(),x(g).on("resize.dtb-collection",function(){c()})),p.background&&_.background(!0,p.backgroundClassName,p.fade,p.backgroundHost||b),x("div.dt-button-background").on("click.dtb-collection",function(){}),p.autoClose&&setTimeout(function(){u.on("buttons-action.b-internal",function(t,n,e,o){o[0]!==b[0]&&i()})},0),x(e).trigger("buttons-popover.dt"),u.on("destroy",i),setTimeout(function(){f=!1,x("body").on("click.dtb-collection",function(t){var n,e;!f&&(n=x.fn.addBack?"addBack":"andSelf",e=x(t.target).parent()[0],!x(t.target).parents()[n]().filter(o).length&&!x(e).hasClass("dt-buttons")||x(t.target).hasClass("dt-button-background"))&&i()}).on("keyup.dtb-collection",function(t){27===t.keyCode&&i()}).on("keydown.dtb-collection",function(t){var n=x("a, button",o),e=m.activeElement;9===t.keyCode&&(-1===n.index(e)?(n.first().focus(),t.preventDefault()):t.shiftKey?e===n[0]&&(n.last().focus(),t.preventDefault()):e===n.last()[0]&&(n.first().focus(),t.preventDefault()))})},0))}}),_.background=function(t,n,e,o){void 0===e&&(e=400),o=o||m.body,t?v(x("<div/>").addClass(n).css("display","none").insertAfter(o),e):y(x("div."+n),e,function(){x(this).removeClass(n).remove()})},_.instanceSelector=function(t,i){var s,a,r;return null==t?x.map(i,function(t){return t.inst}):(s=[],a=x.map(i,function(t){return t.name}),(r=function(t){var n;if(Array.isArray(t))for(var e=0,o=t.length;e<o;e++)r(t[e]);else"string"==typeof t?-1!==t.indexOf(",")?r(t.split(",")):-1!==(n=x.inArray(t.trim(),a))&&s.push(i[n].inst):"number"==typeof t?s.push(i[t].inst):"object"==typeof t&&s.push(t)})(t),s)},_.buttonSelector=function(t,n){for(var c=[],u=function(t,n,e){for(var o,i,s=0,a=n.length;s<a;s++)(o=n[s])&&(t.push({node:o.node,name:o.conf.name,idx:i=void 0!==e?e+s:s+""}),o.buttons)&&u(t,o.buttons,i+"-")},d=function(t,n){var e=[],o=(u(e,n.s.buttons),x.map(e,function(t){return t.node}));if(Array.isArray(t)||t instanceof x)for(s=0,a=t.length;s<a;s++)d(t[s],n);else if(null==t||"*"===t)for(s=0,a=e.length;s<a;s++)c.push({inst:n,node:e[s].node});else if("number"==typeof t)n.s.buttons[t]&&c.push({inst:n,node:n.s.buttons[t].node});else if("string"==typeof t)if(-1!==t.indexOf(","))for(var i=t.split(","),s=0,a=i.length;s<a;s++)d(i[s].trim(),n);else if(t.match(/^\d+(\-\d+)*$/)){var r=x.map(e,function(t){return t.idx});c.push({inst:n,node:e[x.inArray(t,r)].node})}else if(-1!==t.indexOf(":name")){var l=t.replace(":name","");for(s=0,a=e.length;s<a;s++)e[s].name===l&&c.push({inst:n,node:e[s].node})}else x(o).filter(t).each(function(){c.push({inst:n,node:this})});else"object"==typeof t&&t.nodeName&&-1!==(r=x.inArray(t,o))&&c.push({inst:n,node:o[r]})},e=0,o=t.length;e<o;e++){var i=t[e];d(n,i)}return c},_.stripData=function(t,n){return t="string"==typeof t&&(t=(t=t.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"")).replace(/<!\-\-.*?\-\->/g,""),n&&!n.stripHtml||(t=t.replace(/<[^>]*>/g,"")),n&&!n.trim||(t=t.replace(/^\s+|\s+$/g,"")),n&&!n.stripNewlines||(t=t.replace(/\n/g," ")),!n||n.decodeEntities)?i?i(t):(c.innerHTML=t,c.value):t},_.entityDecoder=function(t){i=t},_.defaults={buttons:["copy","excel","csv","pdf","print"],name:"main",tabIndex:0,dom:{container:{tag:"div",className:"dt-buttons"},collection:{action:{dropHtml:'<span class="dt-button-down-arrow">▼</span>'},container:{className:"dt-button-collection",content:{className:"",tag:"div"},tag:"div"}},button:{tag:"button",className:"dt-button",active:"dt-button-active",disabled:"disabled",spacer:{className:"dt-button-spacer",tag:"span"},liner:{tag:"span",className:""}},split:{action:{className:"dt-button-split-drop-button dt-button",tag:"button"},dropdown:{align:"split-right",className:"dt-button-split-drop",dropHtml:'<span class="dt-button-down-arrow">▼</span>',splitAlignClass:"dt-button-split-left",tag:"button"},wrapper:{className:"dt-button-split",tag:"div"}}}},x.extend(w,{collection:{text:function(t){return t.i18n("buttons.collection","Collection")},className:"buttons-collection",closeButton:!(_.version="3.0.0"),init:function(t,n){n.attr("aria-expanded",!1)},action:function(t,n,e,o){o._collection.parents("body").length?this.popover(!1,o):this.popover(o._collection,o),"keypress"===t.type&&x("a, button",o._collection).eq(0).focus()},attr:{"aria-haspopup":"dialog"}},split:{text:function(t){return t.i18n("buttons.split","Split")},className:"buttons-split",closeButton:!1,init:function(t,n){return n.attr("aria-expanded",!1)},action:function(t,n,e,o){this.popover(o._collection,o)},attr:{"aria-haspopup":"dialog"}},copy:function(){if(w.copyHtml5)return"copyHtml5"},csv:function(t,n){if(w.csvHtml5&&w.csvHtml5.available(t,n))return"csvHtml5"},excel:function(t,n){if(w.excelHtml5&&w.excelHtml5.available(t,n))return"excelHtml5"},pdf:function(t,n){if(w.pdfHtml5&&w.pdfHtml5.available(t,n))return"pdfHtml5"},pageLength:function(t){var n=t.settings()[0].aLengthMenu,e=[],o=[];if(Array.isArray(n[0]))e=n[0],o=n[1];else for(var i=0;i<n.length;i++){var s=n[i];x.isPlainObject(s)?(e.push(s.value),o.push(s.label)):(e.push(s),o.push(s))}return{extend:"collection",text:function(t){return t.i18n("buttons.pageLength",{"-1":"Show all rows",_:"Show %d rows"},t.page.len())},className:"buttons-page-length",autoClose:!0,buttons:x.map(e,function(s,t){return{text:o[t],className:"button-page-length",action:function(t,n){n.page.len(s).draw()},init:function(t,n,e){function o(){i.active(t.page.len()===s)}var i=this;t.on("length.dt"+e.namespace,o),o()},destroy:function(t,n,e){t.off("length.dt"+e.namespace)}}}),init:function(t,n,e){var o=this;t.on("length.dt"+e.namespace,function(){o.text(e.text)})},destroy:function(t,n,e){t.off("length.dt"+e.namespace)}}},spacer:{style:"empty",spacer:!0,text:function(t){return t.i18n("buttons.spacer","")}}}),e.Api.register("buttons()",function(n,e){void 0===e&&(e=n,n=void 0),this.selector.buttonGroup=n;var t=this.iterator(!0,"table",function(t){if(t._buttons)return _.buttonSelector(_.instanceSelector(n,t._buttons),e)},!0);return t._groupSelector=n,t}),e.Api.register("button()",function(t,n){t=this.buttons(t,n);return 1<t.length&&t.splice(1,t.length),t}),e.Api.registerPlural("buttons().active()","button().active()",function(n){return void 0===n?this.map(function(t){return t.inst.active(t.node)}):this.each(function(t){t.inst.active(t.node,n)})}),e.Api.registerPlural("buttons().action()","button().action()",function(n){return void 0===n?this.map(function(t){return t.inst.action(t.node)}):this.each(function(t){t.inst.action(t.node,n)})}),e.Api.registerPlural("buttons().collectionRebuild()","button().collectionRebuild()",function(e){return this.each(function(t){for(var n=0;n<e.length;n++)"object"==typeof e[n]&&(e[n].parentConf=t);t.inst.collectionRebuild(t.node,e)})}),e.Api.register(["buttons().enable()","button().enable()"],function(n){return this.each(function(t){t.inst.enable(t.node,n)})}),e.Api.register(["buttons().disable()","button().disable()"],function(){return this.each(function(t){t.inst.disable(t.node)})}),e.Api.register("button().index()",function(){var n=null;return this.each(function(t){t=t.inst.index(t.node);null!==t&&(n=t)}),n}),e.Api.registerPlural("buttons().nodes()","button().node()",function(){var n=x();return x(this.each(function(t){n=n.add(t.inst.node(t.node))})),n}),e.Api.registerPlural("buttons().processing()","button().processing()",function(n){return void 0===n?this.map(function(t){return t.inst.processing(t.node)}):this.each(function(t){t.inst.processing(t.node,n)})}),e.Api.registerPlural("buttons().text()","button().text()",function(n){return void 0===n?this.map(function(t){return t.inst.text(t.node)}):this.each(function(t){t.inst.text(t.node,n)})}),e.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(t){t.inst.node(t.node).trigger("click")})}),e.Api.register("button().popover()",function(n,e){return this.map(function(t){return t.inst._popover(n,this.button(this[0].node),e)})}),e.Api.register("buttons().containers()",function(){var i=x(),s=this._groupSelector;return this.iterator(!0,"table",function(t){if(t._buttons)for(var n=_.instanceSelector(s,t._buttons),e=0,o=n.length;e<o;e++)i=i.add(n[e].container())}),i}),e.Api.register("buttons().container()",function(){return this.containers().eq(0)}),e.Api.register("button().add()",function(t,n,e){var o=this.context;return o.length&&(o=_.instanceSelector(this._groupSelector,o[0]._buttons)).length&&o[0].add(n,t,e),this.button(this._groupSelector,t)}),e.Api.register("buttons().destroy()",function(){return this.pluck("inst").unique().each(function(t){t.destroy()}),this}),e.Api.registerPlural("buttons().remove()","buttons().remove()",function(){return this.each(function(t){t.inst.remove(t.node)}),this}),e.Api.register("buttons.info()",function(t,n,e){var o=this;return!1===t?(this.off("destroy.btn-info"),y(x("#datatables_buttons_info"),400,function(){x(this).remove()}),clearTimeout(s),s=null):(s&&clearTimeout(s),x("#datatables_buttons_info").length&&x("#datatables_buttons_info").remove(),t=t?"<h2>"+t+"</h2>":"",v(x('<div id="datatables_buttons_info" class="dt-button-info"/>').html(t).append(x("<div/>")["string"==typeof n?"html":"append"](n)).css("display","none").appendTo("body")),void 0!==e&&0!==e&&(s=setTimeout(function(){o.buttons.info(!1)},e)),this.on("destroy.btn-info",function(){o.buttons.info(!1)})),this}),e.Api.register("buttons.exportData()",function(t){if(this.context.length)return u(new e.Api(this.context[0]),t)}),e.Api.register("buttons.exportInfo()",function(t){return{filename:n(t=t||{},this),title:r(t,this),messageTop:l(this,t,t.message||t.messageTop,"top"),messageBottom:l(this,t,t.messageBottom,"bottom")}});var s,n=function(t,n){var e;return null==(e="function"==typeof(e="*"===t.filename&&"*"!==t.title&&void 0!==t.title&&null!==t.title&&""!==t.title?t.title:t.filename)?e(t,n):e)?null:(e=(e=-1!==e.indexOf("*")?e.replace("*",x("head > title").text()).trim():e).replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""))+(a(t.extension,t,n)||"")},a=function(t,n,e){return null==t?null:"function"==typeof t?t(n,e):t},r=function(t,n){t=a(t.title,t,n);return null===t?null:-1!==t.indexOf("*")?t.replace("*",x("head > title").text()||"Exported data"):t},l=function(t,n,e,o){e=a(e,n,t);return null===e?null:(n=x("caption",t.table().container()).eq(0),"*"===e?n.css("caption-side")!==o?null:n.length?n.text():"":e)},c=x("<textarea/>")[0],u=function(e,t){for(var o=x.extend(!0,{},{rows:null,columns:"",modifier:{search:"applied",order:"applied"},orthogonal:"display",stripHtml:!0,stripNewlines:!0,decodeEntities:!0,trim:!0,format:{header:function(t){return _.stripData(t,o)},footer:function(t){return _.stripData(t,o)},body:function(t){return _.stripData(t,o)}},customizeData:null},t),t=e.columns(o.columns).indexes().map(function(t){var n=e.column(t);return o.format.header(n.title(),t,n.header())}).toArray(),n=e.table().footer()?e.columns(o.columns).indexes().map(function(t){var n=e.column(t).footer();return o.format.footer(n?x(".dt-column-title",n).html():"",t,n)}).toArray():null,i=x.extend({},o.modifier),s=(e.select&&"function"==typeof e.select.info&&void 0===i.selected&&e.rows(o.rows,x.extend({selected:!0},i)).any()&&x.extend(i,{selected:!0}),e.rows(o.rows,i).indexes().toArray()),s=e.cells(s,o.columns,{order:i.order}),a=s.render(o.orthogonal).toArray(),r=s.nodes().toArray(),l=s.indexes().toArray(),c=t.length,u=[],d=0,f=0,p=0<c?a.length/c:0;f<p;f++){for(var h=[c],b=0;b<c;b++)h[b]=o.format.body(a[d],l[f+b].row,l[f+b].column,r[d]),d++;u[f]=h}i={header:t,headerStructure:e.table().header.structure(o.columns),footer:n,footerStructure:e.table().footer.structure(o.columns),body:u};return o.customizeData&&o.customizeData(i),i};function t(t,n){t=new e.Api(t),n=n||t.init().buttons||e.defaults.buttons;return new _(t,n).container()}return x.fn.dataTable.Buttons=_,x.fn.DataTable.Buttons=_,x(m).on("init.dt plugin-init.dt",function(t,n){"dt"===t.namespace&&(t=n.oInit.buttons||e.defaults.buttons)&&!n._buttons&&new _(n,t).container()}),e.ext.feature.push({fnInit:t,cFeature:"B"}),e.feature&&e.feature.register("buttons",t),e}); |
@@ -7,3 +7,3 @@ { | ||
"types": "./types/types.d.ts", | ||
"version": "2.4.2", | ||
"version": "3.0.0", | ||
"files": [ | ||
@@ -28,3 +28,3 @@ "js/**/*.js", | ||
"dependencies": { | ||
"datatables.net": ">=1.13.4", | ||
"datatables.net": ">=2.0.0", | ||
"jquery": ">=1.7" | ||
@@ -31,0 +31,0 @@ }, |
@@ -55,3 +55,3 @@ // Type definitions for DataTables Buttons | ||
*/ | ||
new (dt: Api<any>, settings: boolean | ConfigButtons | Array<string | ButtonConfig>); | ||
new (dt: Api<any>, settings: boolean | ConfigButtons | Array<string | ButtonConfig>): DataTablesStatic['Buttons']; | ||
@@ -67,7 +67,21 @@ /** | ||
defaults: ConfigButtons; | ||
/** | ||
* Set the JSZip library that Buttons should use for Excel export | ||
* @param jszip JSZip library | ||
*/ | ||
jszip: (jszip: any) => void; | ||
/** | ||
* Set the PDFMake library that Buttons should use for PDF export | ||
* @param pdfMake PDFMake library | ||
*/ | ||
pdfMake: (pdfMake: any) => void; | ||
} | ||
} | ||
interface DataTablesStaticExt { | ||
buttons: ExtButtons; | ||
interface DataTablesStaticExtButtons { | ||
[name: string]: ButtonConfigCommon; | ||
collection: ButtonCollection; | ||
} | ||
@@ -224,3 +238,3 @@ | ||
interface ApiButtonsMethods<T> extends Api<T> { | ||
interface ApiButtonsMethods<T> extends Omit<Api<T>, 'trigger'> { | ||
/** | ||
@@ -424,2 +438,7 @@ * Get the action function for the selected button. | ||
/** | ||
* Define spacer button style | ||
*/ | ||
style?: string; | ||
/** | ||
* Initialisation function that can be used to add events specific to this button | ||
@@ -480,8 +499,2 @@ */ | ||
interface ExtButtons { | ||
[name: string]: ButtonConfigCommon; | ||
collection: ButtonCollection; | ||
} | ||
/** | ||
@@ -488,0 +501,0 @@ * Collection button |
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
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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
450720
10331
Updateddatatables.net@>=2.0.0