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

datatables.net-buttons

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datatables.net-buttons - npm Package Compare versions

Comparing version 1.5.6 to 1.6.0

17

js/buttons.colVis.js

@@ -120,4 +120,2 @@ /*!

.on( 'column-reorder.dt'+conf.namespace, function (e, settings, details) {
// Don't rename buttons based on column name if the button
// controls more than one column!
if ( dt.columns( conf.columns ).count() !== 1 ) {

@@ -127,13 +125,8 @@ return;

conf.columns = $.inArray( conf.columns, details.mapping );
button.attr( 'data-cv-idx', conf.columns );
// This button controls the same column index but the text for the column has
// changed
button.text( conf._columnText( dt, conf ) );
// Reorder buttons for new table order
button
.parent()
.children('[data-cv-idx]')
.sort( function (a, b) {
return (a.getAttribute('data-cv-idx')*1) - (b.getAttribute('data-cv-idx')*1);
} )
.appendTo(button.parent());
// Since its a different column, we need to check its visibility
that.active( dt.column( conf.columns ).visible() );
} );

@@ -140,0 +133,0 @@

@@ -1,6 +0,6 @@

(function(f){"function"===typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(c){return f(c,window,document)}):"object"===typeof exports?module.exports=function(c,e){c||(c=window);if(!e||!e.fn.dataTable)e=require("datatables.net")(c,e).$;e.fn.dataTable.Buttons||require("datatables.net-buttons")(c,e);return f(e,c,c.document)}:f(jQuery,window,document)})(function(f,c,e,h){c=f.fn.dataTable;f.extend(c.ext.buttons,{colvis:function(b,a){return{extend:"collection",
text:function(a){return a.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",buttons:[{extend:"columnsToggle",columns:a.columns,columnText:a.columnText}]}},columnsToggle:function(b,a){return b.columns(a.columns).indexes().map(function(b){return{extend:"columnToggle",columns:b,columnText:a.columnText}}).toArray()},columnToggle:function(b,a){return{extend:"columnVisibility",columns:a.columns,columnText:a.columnText}},columnsVisibility:function(b,a){return b.columns(a.columns).indexes().map(function(b){return{extend:"columnVisibility",
columns:b,visibility:a.visibility,columnText:a.columnText}}).toArray()},columnVisibility:{columns:h,text:function(b,a,d){return d._columnText(b,d)},className:"buttons-columnVisibility",action:function(b,a,d,g){b=a.columns(g.columns);a=b.visible();b.visible(g.visibility!==h?g.visibility:!(a.length&&a[0]))},init:function(b,a,d){var g=this;a.attr("data-cv-idx",d.columns);b.on("column-visibility.dt"+d.namespace,function(a,c){!c.bDestroying&&c.nTable==b.settings()[0].nTable&&g.active(b.column(d.columns).visible())}).on("column-reorder.dt"+
d.namespace,function(c,g,e){1===b.columns(d.columns).count()&&(d.columns=f.inArray(d.columns,e.mapping),a.attr("data-cv-idx",d.columns),a.parent().children("[data-cv-idx]").sort(function(a,b){return 1*a.getAttribute("data-cv-idx")-1*b.getAttribute("data-cv-idx")}).appendTo(a.parent()))});this.active(b.column(d.columns).visible())},destroy:function(b,a,d){b.off("column-visibility.dt"+d.namespace).off("column-reorder.dt"+d.namespace)},_columnText:function(b,a){var d=b.column(a.columns).index(),c=b.settings()[0].aoColumns[d].sTitle.replace(/\n/g,
" ").replace(/<br\s*\/?>/gi," ").replace(/<select(.*?)<\/select>/g,"").replace(/<!\-\-.*?\-\->/g,"").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,"");return a.columnText?a.columnText(b,d,c):c}},colvisRestore:{className:"buttons-colvisRestore",text:function(b){return b.i18n("buttons.colvisRestore","Restore visibility")},init:function(b,a,d){d._visOriginal=b.columns().indexes().map(function(a){return b.column(a).visible()}).toArray()},action:function(b,a,d,c){a.columns().every(function(b){b=a.colReorder&&
a.colReorder.transpose?a.colReorder.transpose(b,"toOriginal"):b;this.visible(c._visOriginal[b])})}},colvisGroup:{className:"buttons-colvisGroup",action:function(b,a,d,c){a.columns(c.show).visible(!0,!1);a.columns(c.hide).visible(!1,!1);a.columns.adjust()},show:[],hide:[]}});return c.Buttons});
(function(g){"function"===typeof define&&define.amd?define(["jquery","datatables.net","datatables.net-buttons"],function(d){return g(d,window,document)}):"object"===typeof exports?module.exports=function(d,f){d||(d=window);if(!f||!f.fn.dataTable)f=require("datatables.net")(d,f).$;f.fn.dataTable.Buttons||require("datatables.net-buttons")(d,f);return g(f,d,d.document)}:g(jQuery,window,document)})(function(g,d,f,h){d=g.fn.dataTable;g.extend(d.ext.buttons,{colvis:function(a,b){return{extend:"collection",
text:function(b){return b.i18n("buttons.colvis","Column visibility")},className:"buttons-colvis",buttons:[{extend:"columnsToggle",columns:b.columns,columnText:b.columnText}]}},columnsToggle:function(a,b){return a.columns(b.columns).indexes().map(function(a){return{extend:"columnToggle",columns:a,columnText:b.columnText}}).toArray()},columnToggle:function(a,b){return{extend:"columnVisibility",columns:b.columns,columnText:b.columnText}},columnsVisibility:function(a,b){return a.columns(b.columns).indexes().map(function(a){return{extend:"columnVisibility",
columns:a,visibility:b.visibility,columnText:b.columnText}}).toArray()},columnVisibility:{columns:h,text:function(a,b,c){return c._columnText(a,c)},className:"buttons-columnVisibility",action:function(a,b,c,e){a=b.columns(e.columns);b=a.visible();a.visible(e.visibility!==h?e.visibility:!(b.length&&b[0]))},init:function(a,b,c){var e=this;b.attr("data-cv-idx",c.columns);a.on("column-visibility.dt"+c.namespace,function(b,d){!d.bDestroying&&d.nTable==a.settings()[0].nTable&&e.active(a.column(c.columns).visible())}).on("column-reorder.dt"+
c.namespace,function(){1===a.columns(c.columns).count()&&(b.text(c._columnText(a,c)),e.active(a.column(c.columns).visible()))});this.active(a.column(c.columns).visible())},destroy:function(a,b,c){a.off("column-visibility.dt"+c.namespace).off("column-reorder.dt"+c.namespace)},_columnText:function(a,b){var c=a.column(b.columns).index(),e=a.settings()[0].aoColumns[c].sTitle.replace(/\n/g," ").replace(/<br\s*\/?>/gi," ").replace(/<select(.*?)<\/select>/g,"").replace(/<!\-\-.*?\-\->/g,"").replace(/<.*?>/g,
"").replace(/^\s+|\s+$/g,"");return b.columnText?b.columnText(a,c,e):e}},colvisRestore:{className:"buttons-colvisRestore",text:function(a){return a.i18n("buttons.colvisRestore","Restore visibility")},init:function(a,b,c){c._visOriginal=a.columns().indexes().map(function(b){return a.column(b).visible()}).toArray()},action:function(a,b,c,d){b.columns().every(function(a){a=b.colReorder&&b.colReorder.transpose?b.colReorder.transpose(a,"toOriginal"):a;this.visible(d._visOriginal[a])})}},colvisGroup:{className:"buttons-colvisGroup",
action:function(a,b,c,d){b.columns(d.show).visible(!0,!1);b.columns(d.hide).visible(!1,!1);b.columns.adjust()},show:[],hide:[]}});return d.Buttons});

@@ -1,2 +0,2 @@

/*! Buttons for DataTables 1.5.6
/*! Buttons for DataTables 1.6.0
* ©2016-2019 SpryMedia Ltd - datatables.net/license

@@ -169,3 +169,3 @@ */

this._expandButton( buttons, config, false, idx );
this._expandButton( buttons, config, base !== undefined, idx );
this._draw();

@@ -277,2 +277,3 @@

* Set / get a processing class on the selected button
* @param {element} node Triggering button node
* @param {boolean} flag true to add, false to remove, undefined to get

@@ -283,2 +284,3 @@ * @return {boolean|Buttons} Getter value or this if a setter.

{
var dt = this.s.dt;
var button = this._nodeToButton( node );

@@ -292,2 +294,6 @@

$(dt.table().node()).triggerHandler( 'buttons-processing.dt', [
flag, dt.button( node ), dt, $(node), button.conf
] );
return this;

@@ -506,6 +512,3 @@ },

if ( built.conf.buttons ) {
var collectionDom = this.c.dom.collection;
built.collection = $('<'+collectionDom.tag+'/>')
.addClass( collectionDom.className )
.attr( 'role', 'menu' ) ;
built.collection = $('<div/>');
built.conf._collection = built.collection;

@@ -922,2 +925,177 @@

return conf;
},
/**
* Display (and replace if there is an existing one) a popover attached to a button
* @param {string|node} content Content to show
* @param {DataTable.Api} hostButton DT API instance of the button
* @param {object} inOpts Options (see object below for all options)
*/
_popover: function ( content, hostButton, inOpts ) {
var dt = hostButton;
var buttonsSettings = this.c;
var options = $.extend( {
align: 'button-left', // button-right, dt-container
autoClose: false,
background: true,
backgroundClassName: 'dt-button-background',
contentClassName: buttonsSettings.dom.collection.className,
collectionLayout: '',
collectionTitle: '',
dropup: false,
fade: 400,
rightAlignClassName: 'dt-button-right',
tag: buttonsSettings.dom.collection.tag
}, inOpts );
var hostNode = hostButton.node();
var close = function () {
$('.dt-button-collection').stop().fadeOut( options.fade, function () {
$(this).detach();
} );
$(dt.buttons( '[aria-haspopup="true"][aria-expanded="true"]' ).nodes())
.attr('aria-expanded', 'false');
$('div.dt-button-background').off( 'click.dtb-collection' );
Buttons.background( false, options.backgroundClassName, options.fade, hostNode );
$('body').off( '.dtb-collection' );
dt.off( 'buttons-action.b-internal' );
};
if (content === false) {
close();
}
var existingExpanded = $(dt.buttons( '[aria-haspopup="true"][aria-expanded="true"]' ).nodes());
if ( existingExpanded.length ) {
hostNode = existingExpanded.eq(0);
close();
}
content = $(content);
var tableContainer = $( hostButton.table().container() );
hostNode.attr( 'aria-expanded', 'true' );
if ( hostNode.parents('body')[0] !== document.body ) {
hostNode = document.body.lastChild;
}
var display = $('<' + options.tag + '/>')
.addClass(options.contentClassName)
.attr('role', 'menu');
if ( options.collectionTitle ) {
display.prepend('<div class="dt-button-collection-title">'+options.collectionTitle+'</div>');
}
display
.addClass( options.collectionLayout )
.css( 'display', 'none' )
.append( content )
.insertAfter( hostNode )
.stop()
.fadeIn( options.fade );
var position = display.css( 'position' );
if ( options.align === 'dt-container' ) {
hostNode = hostNode.parent();
display.css('width', tableContainer.width());
}
if ( position === 'absolute' ) {
var hostPosition = hostNode.position();
display.css( {
top: hostPosition.top + hostNode.outerHeight(),
left: hostPosition.left
} );
// calculate overflow when positioned beneath
var collectionHeight = display.outerHeight();
var collectionWidth = display.outerWidth();
var tableBottom = tableContainer.offset().top + tableContainer.height();
var listBottom = hostPosition.top + hostNode.outerHeight() + collectionHeight;
var bottomOverflow = listBottom - tableBottom;
// calculate overflow when positioned above
var listTop = hostPosition.top - collectionHeight;
var tableTop = tableContainer.offset().top;
var topOverflow = tableTop - listTop;
// if bottom overflow is larger, move to the top because it fits better, or if dropup is requested
var moveTop = hostPosition.top - collectionHeight - 5;
if ( (bottomOverflow > topOverflow || options.dropup) && -moveTop < tableTop ) {
display.css( 'top', moveTop);
}
// Right alignment is enabled on a class, e.g. bootstrap:
// $.fn.dataTable.Buttons.defaults.dom.collection.className += " dropdown-menu-right";
if ( display.hasClass( options.rightAlignClassName ) || options.align === 'button-right' ) {
display.css( 'left', hostPosition.left + hostNode.outerWidth() - collectionWidth );
}
// Right alignment in table container
var listRight = hostPosition.left + collectionWidth;
var tableRight = tableContainer.offset().left + tableContainer.width();
if ( listRight > tableRight ) {
display.css( 'left', hostPosition.left - ( listRight - tableRight ) );
}
// Right alignment to window
var listOffsetRight = hostNode.offset().left + collectionWidth;
if ( listOffsetRight > $(window).width() ) {
display.css( 'left', hostPosition.left - (listOffsetRight-$(window).width()) );
}
}
else {
// Fix position - centre on screen
var top = display.height() / 2;
if ( top > $(window).height() / 2 ) {
top = $(window).height() / 2;
}
display.css( 'marginTop', top*-1 );
}
if ( options.background ) {
Buttons.background( true, options.backgroundClassName, options.fade, hostNode );
}
// This is bonkers, but if we don't have a click listener on the
// background element, iOS Safari will ignore the body click
// listener below. An empty function here is all that is
// required to make it work...
$('div.dt-button-background').on( 'click.dtb-collection', function () {} );
$('body')
.on( 'click.dtb-collection', function (e) {
// andSelf is deprecated in jQ1.8, but we want 1.7 compat
var back = $.fn.addBack ? 'addBack' : 'andSelf';
if ( ! $(e.target).parents()[back]().filter( content ).length ) {
close();
}
} )
.on( 'keyup.dtb-collection', function (e) {
if ( e.keyCode === 27 ) {
close();
}
} );
if ( options.autoClose ) {
setTimeout( function () {
dt.on( 'buttons-action.b-internal', function (e, btn, dt, node) {
if ( node[0] === hostNode[0] ) {
return;
}
close();
} );
}, 0);
}
}

@@ -979,3 +1157,3 @@ } );

{
if ( ! group ) {
if ( group === undefined || group === null ) {
return $.map( buttons, function ( v ) {

@@ -1202,3 +1380,3 @@ return v.inst;

*/
Buttons.version = '1.5.6';
Buttons.version = '1.6.0';

@@ -1216,161 +1394,15 @@

action: function ( e, dt, button, config ) {
var close = function () {
dt.buttons( '[aria-haspopup="true"][aria-expanded="true"]' ).nodes().each( function() {
var collection = $(this).siblings('.dt-button-collection');
e.stopPropagation();
if ( collection.length ) {
collection.stop().fadeOut( config.fade, function () {
collection.detach();
} );
}
$(this).attr( 'aria-expanded', 'false' );
});
$('div.dt-button-background').off( 'click.dtb-collection' );
Buttons.background( false, config.backgroundClassName, config.fade, insertPoint );
$('body').off( '.dtb-collection' );
dt.off( 'buttons-action.b-internal' );
};
var wasExpanded = button.attr( 'aria-expanded' ) === 'true';
close();
if (!wasExpanded) {
var host = button;
var collectionParent = $(button).parents('div.dt-button-collection');
var hostPosition = host.position();
var tableContainer = $( dt.table().container() );
var multiLevel = false;
var insertPoint = host;
button.attr( 'aria-expanded', 'true' );
// Remove any old collection
if ( collectionParent.length ) {
multiLevel = $('.dt-button-collection').position();
insertPoint = collectionParent;
$('body').trigger( 'click.dtb-collection' );
}
if ( insertPoint.parents('body')[0] !== document.body ) {
insertPoint = document.body.lastChild;
}
config._collection.find('.dt-button-collection-title').remove();
config._collection.prepend('<div class="dt-button-collection-title">'+config.collectionTitle+'</div>');
config._collection
.addClass( config.collectionLayout )
.css( 'display', 'none' )
.insertAfter( insertPoint )
.stop()
.fadeIn( config.fade );
var position = config._collection.css( 'position' );
if ( multiLevel && position === 'absolute' ) {
config._collection.css( {
top: multiLevel.top,
left: multiLevel.left
} );
}
else if ( position === 'absolute' ) {
config._collection.css( {
top: hostPosition.top + host.outerHeight(),
left: hostPosition.left
} );
// calculate overflow when positioned beneath
var tableBottom = tableContainer.offset().top + tableContainer.height();
var listBottom = hostPosition.top + host.outerHeight() + config._collection.outerHeight();
var bottomOverflow = listBottom - tableBottom;
// calculate overflow when positioned above
var listTop = hostPosition.top - config._collection.outerHeight();
var tableTop = tableContainer.offset().top;
var topOverflow = tableTop - listTop;
// if bottom overflow is larger, move to the top because it fits better, or if dropup is requested
if (bottomOverflow > topOverflow || config.dropup) {
config._collection.css( 'top', hostPosition.top - config._collection.outerHeight() - 5);
}
// Right alignment is enabled on a class, e.g. bootstrap:
// $.fn.dataTable.Buttons.defaults.dom.collection.className += " dropdown-menu-right";
if ( config._collection.hasClass( config.rightAlignClassName ) ) {
config._collection.css( 'left', hostPosition.left + host.outerWidth() - config._collection.outerWidth() );
}
// Right alignment in table container
var listRight = hostPosition.left + config._collection.outerWidth();
var tableRight = tableContainer.offset().left + tableContainer.width();
if ( listRight > tableRight ) {
config._collection.css( 'left', hostPosition.left - ( listRight - tableRight ) );
}
// Right alignment to window
var listOffsetRight = host.offset().left + config._collection.outerWidth();
if ( listOffsetRight > $(window).width() ) {
config._collection.css( 'left', hostPosition.left - (listOffsetRight-$(window).width()) );
}
}
else {
// Fix position - centre on screen
var top = config._collection.height() / 2;
if ( top > $(window).height() / 2 ) {
top = $(window).height() / 2;
}
config._collection.css( 'marginTop', top*-1 );
}
if ( config.background ) {
Buttons.background( true, config.backgroundClassName, config.fade, insertPoint );
}
// Need to break the 'thread' for the collection button being
// activated by a click - it would also trigger this event
setTimeout( function () {
// This is bonkers, but if we don't have a click listener on the
// background element, iOS Safari will ignore the body click
// listener below. An empty function here is all that is
// required to make it work...
$('div.dt-button-background').on( 'click.dtb-collection', function () {} );
$('body')
.on( 'click.dtb-collection', function (e) {
// andSelf is deprecated in jQ1.8, but we want 1.7 compat
var back = $.fn.addBack ? 'addBack' : 'andSelf';
if ( ! $(e.target).parents()[back]().filter( config._collection ).length ) {
close();
}
} )
.on( 'keyup.dtb-collection', function (e) {
if ( e.keyCode === 27 ) {
close();
}
} );
if ( config.autoClose ) {
dt.on( 'buttons-action.b-internal', function () {
close();
} );
}
}, 10 );
if ( config._collection.parents('body').length ) {
this.popover(false, config);
}
else {
this.popover(config._collection, config);
}
},
background: true,
collectionLayout: '',
collectionTitle: '',
backgroundClassName: 'dt-button-background',
rightAlignClassName: 'dt-button-right',
autoClose: false,
fade: 400,
attr: {
'aria-haspopup': true
}
// Also the popover options, defined in Buttons.popover
},

@@ -1590,4 +1622,11 @@ copy: function ( dt, conf ) {

// Button resolver to the popover
DataTable.Api.register( 'button().popover()', function (content, options) {
return this.map( function ( set ) {
return set.inst._popover( content, this.button(this[0].node), options );
} );
} );
// Get the container elements
DataTable.Api.registerPlural( 'buttons().containers()', 'buttons().container()', function () {
DataTable.Api.register( 'buttons().containers()', function () {
var jq = $();

@@ -1611,2 +1650,7 @@ var groupSelector = this._groupSelector;

DataTable.Api.register( 'buttons().container()', function () {
// API level of nesting is `buttons()` so we can zip into the containers method
return this.containers().eq(0);
} );
// Add a new button

@@ -1652,2 +1696,3 @@ DataTable.Api.register( 'button().add()', function ( idx, conf ) {

if ( title === false ) {
this.off('destroy.btn-info');
$('#datatables_buttons_info').fadeOut( function () {

@@ -1685,2 +1730,6 @@ $(this).remove();

this.on('destroy.btn-info', function () {
that.buttons.info(false);
});
return this;

@@ -1687,0 +1736,0 @@ } );

/*!
Buttons for DataTables 1.5.6
Buttons for DataTables 1.6.0
©2016-2019 SpryMedia Ltd - datatables.net/license
*/
(function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(p){return d(p,window,document)}):"object"===typeof exports?module.exports=function(p,o){p||(p=window);if(!o||!o.fn.dataTable)o=require("datatables.net")(p,o).$;return d(o,p,p.document)}:d(jQuery,window,document)})(function(d,p,o,n){function t(a){var a=new j.Api(a),b=a.init().buttons||j.defaults.buttons;return(new m(a,b)).container()}var j=d.fn.dataTable,x=0,y=0,l=j.ext.buttons,m=function(a,b){if(!(this instanceof
m))return function(b){return(new m(b,a)).container()};"undefined"===typeof b&&(b={});!0===b&&(b={});d.isArray(b)&&(b={buttons:b});this.c=d.extend(!0,{},m.defaults,b);b.buttons&&(this.c.buttons=b.buttons);this.s={dt:new j.Api(a),buttons:[],listenKeys:"",namespace:"dtb"+x++};this.dom={container:d("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)};this._constructor()};d.extend(m.prototype,{action:function(a,b){var c=this._nodeToButton(a);if(b===n)return c.conf.action;c.conf.action=
b;return this},active:function(a,b){var c=this._nodeToButton(a),e=this.c.dom.button.active,c=d(c.node);if(b===n)return c.hasClass(e);c.toggleClass(e,b===n?!0:b);return this},add:function(a,b){var c=this.s.buttons;if("string"===typeof b){for(var e=b.split("-"),c=this.s,d=0,g=e.length-1;d<g;d++)c=c.buttons[1*e[d]];c=c.buttons;b=1*e[e.length-1]}this._expandButton(c,a,!1,b);this._draw();return this},container:function(){return this.dom.container},disable:function(a){a=this._nodeToButton(a);d(a.node).addClass(this.c.dom.button.disabled);
(function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(q){return d(q,window,document)}):"object"===typeof exports?module.exports=function(q,p){q||(q=window);if(!p||!p.fn.dataTable)p=require("datatables.net")(q,p).$;return d(p,q,q.document)}:d(jQuery,window,document)})(function(d,q,p,m){function t(a){var a=new i.Api(a),b=a.init().buttons||i.defaults.buttons;return(new n(a,b)).container()}var i=d.fn.dataTable,w=0,x=0,k=i.ext.buttons,n=function(a,b){if(!(this instanceof
n))return function(b){return(new n(b,a)).container()};"undefined"===typeof b&&(b={});!0===b&&(b={});d.isArray(b)&&(b={buttons:b});this.c=d.extend(!0,{},n.defaults,b);b.buttons&&(this.c.buttons=b.buttons);this.s={dt:new i.Api(a),buttons:[],listenKeys:"",namespace:"dtb"+w++};this.dom={container:d("<"+this.c.dom.container.tag+"/>").addClass(this.c.dom.container.className)};this._constructor()};d.extend(n.prototype,{action:function(a,b){var c=this._nodeToButton(a);if(b===m)return c.conf.action;c.conf.action=
b;return this},active:function(a,b){var c=this._nodeToButton(a),e=this.c.dom.button.active,c=d(c.node);if(b===m)return c.hasClass(e);c.toggleClass(e,b===m?!0:b);return this},add:function(a,b){var c=this.s.buttons;if("string"===typeof b){for(var e=b.split("-"),d=this.s,c=0,f=e.length-1;c<f;c++)d=d.buttons[1*e[c]];c=d.buttons;b=1*e[e.length-1]}this._expandButton(c,a,d!==m,b);this._draw();return this},container:function(){return this.dom.container},disable:function(a){a=this._nodeToButton(a);d(a.node).addClass(this.c.dom.button.disabled);
return this},destroy:function(){d("body").off("keyup."+this.s.namespace);var a=this.s.buttons.slice(),b,c;b=0;for(c=a.length;b<c;b++)this.remove(a[b].node);this.dom.container.remove();a=this.s.dt.settings()[0];b=0;for(c=a.length;b<c;b++)if(a.inst===this){a.splice(b,1);break}return this},enable:function(a,b){if(!1===b)return this.disable(a);var c=this._nodeToButton(a);d(c.node).removeClass(this.c.dom.button.disabled);return this},name:function(){return this.c.name},node:function(a){if(!a)return this.dom.container;
a=this._nodeToButton(a);return d(a.node)},processing:function(a,b){var c=this._nodeToButton(a);if(b===n)return d(c.node).hasClass("processing");d(c.node).toggleClass("processing",b);return this},remove:function(a){var b=this._nodeToButton(a),c=this._nodeToHost(a),e=this.s.dt;if(b.buttons.length)for(var i=b.buttons.length-1;0<=i;i--)this.remove(b.buttons[i].node);b.conf.destroy&&b.conf.destroy.call(e.button(a),e,d(a),b.conf);this._removeKey(b.conf);d(b.node).remove();a=d.inArray(b,c);c.splice(a,1);
return this},text:function(a,b){var c=this._nodeToButton(a),e=this.c.dom.collection.buttonLiner,e=c.inCollection&&e&&e.tag?e.tag:this.c.dom.buttonLiner.tag,i=this.s.dt,g=d(c.node),f=function(a){return"function"===typeof a?a(i,g,c.conf):a};if(b===n)return f(c.conf.text);c.conf.text=b;e?g.children(e).html(f(b)):g.html(f(b));return this},_constructor:function(){var a=this,b=this.s.dt,c=b.settings()[0],e=this.c.buttons;c._buttons||(c._buttons=[]);c._buttons.push({inst:this,name:this.c.name});for(var i=
0,g=e.length;i<g;i++)this.add(e[i]);b.on("destroy",function(b,e){e===c&&a.destroy()});d("body").on("keyup."+this.s.namespace,function(b){if(!o.activeElement||o.activeElement===o.body){var c=String.fromCharCode(b.keyCode).toLowerCase();a.s.listenKeys.toLowerCase().indexOf(c)!==-1&&a._keypress(c,b)}})},_addKey:function(a){a.key&&(this.s.listenKeys+=d.isPlainObject(a.key)?a.key.key:a.key)},_draw:function(a,b){a||(a=this.dom.container,b=this.s.buttons);a.children().detach();for(var c=0,e=b.length;c<e;c++)a.append(b[c].inserter),
a.append(" "),b[c].buttons&&b[c].buttons.length&&this._draw(b[c].collection,b[c].buttons)},_expandButton:function(a,b,c,e){for(var i=this.s.dt,g=0,b=!d.isArray(b)?[b]:b,f=0,k=b.length;f<k;f++){var r=this._resolveExtends(b[f]);if(r)if(d.isArray(r))this._expandButton(a,r,c,e);else{var h=this._buildButton(r,c);if(h){e!==n?(a.splice(e,0,h),e++):a.push(h);if(h.conf.buttons){var u=this.c.dom.collection;h.collection=d("<"+u.tag+"/>").addClass(u.className).attr("role","menu");h.conf._collection=h.collection;
this._expandButton(h.buttons,h.conf.buttons,!0,e)}r.init&&r.init.call(i.button(h.node),i,d(h.node),r);g++}}}},_buildButton:function(a,b){var c=this.c.dom.button,e=this.c.dom.buttonLiner,i=this.c.dom.collection,g=this.s.dt,f=function(b){return"function"===typeof b?b(g,h,a):b};b&&i.button&&(c=i.button);b&&i.buttonLiner&&(e=i.buttonLiner);if(a.available&&!a.available(g,a))return!1;var k=function(a,b,c,e){e.action.call(b.button(c),a,b,c,e);d(b.table().node()).triggerHandler("buttons-action.dt",[b.button(c),
b,c,e])},i=a.tag||c.tag,r=a.clickBlurs===n?!0:a.clickBlurs,h=d("<"+i+"/>").addClass(c.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(b){b.preventDefault();!h.hasClass(c.disabled)&&a.action&&k(b,g,h,a);r&&h.blur()}).on("keyup.dtb",function(b){b.keyCode===13&&!h.hasClass(c.disabled)&&a.action&&k(b,g,h,a)});"a"===i.toLowerCase()&&h.attr("href","#");"button"===i.toLowerCase()&&h.attr("type","button");e.tag?(i=d("<"+
e.tag+"/>").html(f(a.text)).addClass(e.className),"a"===e.tag.toLowerCase()&&i.attr("href","#"),h.append(i)):h.html(f(a.text));!1===a.enabled&&h.addClass(c.disabled);a.className&&h.addClass(a.className);a.titleAttr&&h.attr("title",f(a.titleAttr));a.attr&&h.attr(a.attr);a.namespace||(a.namespace=".dt-button-"+y++);e=(e=this.c.dom.buttonContainer)&&e.tag?d("<"+e.tag+"/>").addClass(e.className).append(h):h;this._addKey(a);this.c.buttonCreated&&(e=this.c.buttonCreated(a,e));return{conf:a,node:h.get(0),
inserter:e,buttons:[],inCollection:b,collection:null}},_nodeToButton:function(a,b){b||(b=this.s.buttons);for(var c=0,e=b.length;c<e;c++){if(b[c].node===a)return b[c];if(b[c].buttons.length){var d=this._nodeToButton(a,b[c].buttons);if(d)return d}}},_nodeToHost:function(a,b){b||(b=this.s.buttons);for(var c=0,e=b.length;c<e;c++){if(b[c].node===a)return b;if(b[c].buttons.length){var d=this._nodeToHost(a,b[c].buttons);if(d)return d}}},_keypress:function(a,b){if(!b._buttonsHandled){var c=function(e){for(var i=
0,g=e.length;i<g;i++){var f=e[i].conf,k=e[i].node;if(f.key)if(f.key===a)b._buttonsHandled=!0,d(k).click();else if(d.isPlainObject(f.key)&&f.key.key===a&&(!f.key.shiftKey||b.shiftKey))if(!f.key.altKey||b.altKey)if(!f.key.ctrlKey||b.ctrlKey)if(!f.key.metaKey||b.metaKey)b._buttonsHandled=!0,d(k).click();e[i].buttons.length&&c(e[i].buttons)}};c(this.s.buttons)}},_removeKey:function(a){if(a.key){var b=d.isPlainObject(a.key)?a.key.key:a.key,a=this.s.listenKeys.split(""),b=d.inArray(b,a);a.splice(b,1);this.s.listenKeys=
a.join("")}},_resolveExtends:function(a){for(var b=this.s.dt,c,e,i=function(c){for(var e=0;!d.isPlainObject(c)&&!d.isArray(c);){if(c===n)return;if("function"===typeof c){if(c=c(b,a),!c)return!1}else if("string"===typeof c){if(!l[c])throw"Unknown button type: "+c;c=l[c]}e++;if(30<e)throw"Buttons: Too many iterations";}return d.isArray(c)?c:d.extend({},c)},a=i(a);a&&a.extend;){if(!l[a.extend])throw"Cannot extend unknown button type: "+a.extend;var g=i(l[a.extend]);if(d.isArray(g))return g;if(!g)return!1;
c=g.className;a=d.extend({},g,a);c&&a.className!==c&&(a.className=c+" "+a.className);var f=a.postfixButtons;if(f){a.buttons||(a.buttons=[]);c=0;for(e=f.length;c<e;c++)a.buttons.push(f[c]);a.postfixButtons=null}if(f=a.prefixButtons){a.buttons||(a.buttons=[]);c=0;for(e=f.length;c<e;c++)a.buttons.splice(c,0,f[c]);a.prefixButtons=null}a.extend=g.extend}return a}});m.background=function(a,b,c,e){c===n&&(c=400);e||(e=o.body);a?d("<div/>").addClass(b).css("display","none").insertAfter(e).stop().fadeIn(c):
d("div."+b).stop().fadeOut(c,function(){d(this).removeClass(b).remove()})};m.instanceSelector=function(a,b){if(!a)return d.map(b,function(a){return a.inst});var c=[],e=d.map(b,function(a){return a.name}),i=function(a){if(d.isArray(a))for(var f=0,k=a.length;f<k;f++)i(a[f]);else"string"===typeof a?-1!==a.indexOf(",")?i(a.split(",")):(a=d.inArray(d.trim(a),e),-1!==a&&c.push(b[a].inst)):"number"===typeof a&&c.push(b[a].inst)};i(a);return c};m.buttonSelector=function(a,b){for(var c=[],e=function(a,b,c){for(var d,
g,f=0,i=b.length;f<i;f++)if(d=b[f])g=c!==n?c+f:f+"",a.push({node:d.node,name:d.conf.name,idx:g}),d.buttons&&e(a,d.buttons,g+"-")},i=function(a,b){var h,g,f=[];e(f,b.s.buttons);h=d.map(f,function(a){return a.node});if(d.isArray(a)||a instanceof d){h=0;for(g=a.length;h<g;h++)i(a[h],b)}else if(null===a||a===n||"*"===a){h=0;for(g=f.length;h<g;h++)c.push({inst:b,node:f[h].node})}else if("number"===typeof a)c.push({inst:b,node:b.s.buttons[a].node});else if("string"===typeof a)if(-1!==a.indexOf(",")){f=
a.split(",");h=0;for(g=f.length;h<g;h++)i(d.trim(f[h]),b)}else if(a.match(/^\d+(\-\d+)*$/))h=d.map(f,function(a){return a.idx}),c.push({inst:b,node:f[d.inArray(a,h)].node});else if(-1!==a.indexOf(":name")){var j=a.replace(":name","");h=0;for(g=f.length;h<g;h++)f[h].name===j&&c.push({inst:b,node:f[h].node})}else d(h).filter(a).each(function(){c.push({inst:b,node:this})});else"object"===typeof a&&a.nodeName&&(f=d.inArray(a,h),-1!==f&&c.push({inst:b,node:h[f]}))},g=0,f=a.length;g<f;g++)i(b,a[g]);return c};
m.defaults={buttons:["copy","excel","csv","pdf","print"],name:"main",tabIndex:0,dom:{container:{tag:"div",className:"dt-buttons"},collection:{tag:"div",className:"dt-button-collection"},button:{tag:"ActiveXObject"in p?"a":"button",className:"dt-button",active:"active",disabled:"disabled"},buttonLiner:{tag:"span",className:""}}};m.version="1.5.6";d.extend(l,{collection:{text:function(a){return a.i18n("buttons.collection","Collection")},className:"buttons-collection",init:function(a,b){b.attr("aria-expanded",
!1)},action:function(a,b,c,e){var i=function(){b.buttons('[aria-haspopup="true"][aria-expanded="true"]').nodes().each(function(){var a=d(this).siblings(".dt-button-collection");a.length&&a.stop().fadeOut(e.fade,function(){a.detach()});d(this).attr("aria-expanded","false")});d("div.dt-button-background").off("click.dtb-collection");m.background(!1,e.backgroundClassName,e.fade,j);d("body").off(".dtb-collection");b.off("buttons-action.b-internal")},a="true"===c.attr("aria-expanded");i();if(!a){var g=
d(c).parents("div.dt-button-collection"),a=c.position(),f=d(b.table().container()),k=!1,j=c;c.attr("aria-expanded","true");g.length&&(k=d(".dt-button-collection").position(),j=g,d("body").trigger("click.dtb-collection"));j.parents("body")[0]!==o.body&&(j=o.body.lastChild);e._collection.find(".dt-button-collection-title").remove();e._collection.prepend('<div class="dt-button-collection-title">'+e.collectionTitle+"</div>");e._collection.addClass(e.collectionLayout).css("display","none").insertAfter(j).stop().fadeIn(e.fade);
g=e._collection.css("position");k&&"absolute"===g?e._collection.css({top:k.top,left:k.left}):"absolute"===g?(e._collection.css({top:a.top+c.outerHeight(),left:a.left}),k=f.offset().top+f.height(),k=a.top+c.outerHeight()+e._collection.outerHeight()-k,g=a.top-e._collection.outerHeight(),g=f.offset().top-g,(k>g||e.dropup)&&e._collection.css("top",a.top-e._collection.outerHeight()-5),e._collection.hasClass(e.rightAlignClassName)&&e._collection.css("left",a.left+c.outerWidth()-e._collection.outerWidth()),
k=a.left+e._collection.outerWidth(),f=f.offset().left+f.width(),k>f&&e._collection.css("left",a.left-(k-f)),c=c.offset().left+e._collection.outerWidth(),c>d(p).width()&&e._collection.css("left",a.left-(c-d(p).width()))):(c=e._collection.height()/2,c>d(p).height()/2&&(c=d(p).height()/2),e._collection.css("marginTop",-1*c));e.background&&m.background(!0,e.backgroundClassName,e.fade,j);setTimeout(function(){d("div.dt-button-background").on("click.dtb-collection",function(){});d("body").on("click.dtb-collection",
function(a){var b=d.fn.addBack?"addBack":"andSelf";d(a.target).parents()[b]().filter(e._collection).length||i()}).on("keyup.dtb-collection",function(a){a.keyCode===27&&i()});if(e.autoClose)b.on("buttons-action.b-internal",function(){i()})},10)}},background:!0,collectionLayout:"",collectionTitle:"",backgroundClassName:"dt-button-background",rightAlignClassName:"dt-button-right",autoClose:!1,fade:400,attr:{"aria-haspopup":!0}},copy:function(a,b){if(l.copyHtml5)return"copyHtml5";if(l.copyFlash&&l.copyFlash.available(a,
b))return"copyFlash"},csv:function(a,b){if(l.csvHtml5&&l.csvHtml5.available(a,b))return"csvHtml5";if(l.csvFlash&&l.csvFlash.available(a,b))return"csvFlash"},excel:function(a,b){if(l.excelHtml5&&l.excelHtml5.available(a,b))return"excelHtml5";if(l.excelFlash&&l.excelFlash.available(a,b))return"excelFlash"},pdf:function(a,b){if(l.pdfHtml5&&l.pdfHtml5.available(a,b))return"pdfHtml5";if(l.pdfFlash&&l.pdfFlash.available(a,b))return"pdfFlash"},pageLength:function(a){var a=a.settings()[0].aLengthMenu,b=d.isArray(a[0])?
a[0]:a,c=d.isArray(a[0])?a[1]:a;return{extend:"collection",text:function(a){return a.i18n("buttons.pageLength",{"-1":"Show all rows",_:"Show %d rows"},a.page.len())},className:"buttons-page-length",autoClose:!0,buttons:d.map(b,function(a,b){return{text:c[b],className:"button-page-length",action:function(b,c){c.page.len(a).draw()},init:function(b,c,d){var i=this,c=function(){i.active(b.page.len()===a)};b.on("length.dt"+d.namespace,c);c()},destroy:function(a,b,c){a.off("length.dt"+c.namespace)}}}),
init:function(a,b,c){var d=this;a.on("length.dt"+c.namespace,function(){d.text(c.text)})},destroy:function(a,b,c){a.off("length.dt"+c.namespace)}}}});j.Api.register("buttons()",function(a,b){b===n&&(b=a,a=n);this.selector.buttonGroup=a;var c=this.iterator(!0,"table",function(c){if(c._buttons)return m.buttonSelector(m.instanceSelector(a,c._buttons),b)},!0);c._groupSelector=a;return c});j.Api.register("button()",function(a,b){var c=this.buttons(a,b);1<c.length&&c.splice(1,c.length);return c});j.Api.registerPlural("buttons().active()",
"button().active()",function(a){return a===n?this.map(function(a){return a.inst.active(a.node)}):this.each(function(b){b.inst.active(b.node,a)})});j.Api.registerPlural("buttons().action()","button().action()",function(a){return a===n?this.map(function(a){return a.inst.action(a.node)}):this.each(function(b){b.inst.action(b.node,a)})});j.Api.register(["buttons().enable()","button().enable()"],function(a){return this.each(function(b){b.inst.enable(b.node,a)})});j.Api.register(["buttons().disable()",
"button().disable()"],function(){return this.each(function(a){a.inst.disable(a.node)})});j.Api.registerPlural("buttons().nodes()","button().node()",function(){var a=d();d(this.each(function(b){a=a.add(b.inst.node(b.node))}));return a});j.Api.registerPlural("buttons().processing()","button().processing()",function(a){return a===n?this.map(function(a){return a.inst.processing(a.node)}):this.each(function(b){b.inst.processing(b.node,a)})});j.Api.registerPlural("buttons().text()","button().text()",function(a){return a===
n?this.map(function(a){return a.inst.text(a.node)}):this.each(function(b){b.inst.text(b.node,a)})});j.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(a){a.inst.node(a.node).trigger("click")})});j.Api.registerPlural("buttons().containers()","buttons().container()",function(){var a=d(),b=this._groupSelector;this.iterator(!0,"table",function(c){if(c._buttons)for(var c=m.instanceSelector(b,c._buttons),d=0,i=c.length;d<i;d++)a=a.add(c[d].container())});
return a});j.Api.register("button().add()",function(a,b){var c=this.context;c.length&&(c=m.instanceSelector(this._groupSelector,c[0]._buttons),c.length&&c[0].add(b,a));return this.button(this._groupSelector,a)});j.Api.register("buttons().destroy()",function(){this.pluck("inst").unique().each(function(a){a.destroy()});return this});j.Api.registerPlural("buttons().remove()","buttons().remove()",function(){this.each(function(a){a.inst.remove(a.node)});return this});var q;j.Api.register("buttons.info()",
function(a,b,c){var e=this;if(!1===a)return d("#datatables_buttons_info").fadeOut(function(){d(this).remove()}),clearTimeout(q),q=null,this;q&&clearTimeout(q);d("#datatables_buttons_info").length&&d("#datatables_buttons_info").remove();d('<div id="datatables_buttons_info" class="dt-button-info"/>').html(a?"<h2>"+a+"</h2>":"").append(d("<div/>")["string"===typeof b?"html":"append"](b)).css("display","none").appendTo("body").fadeIn();c!==n&&0!==c&&(q=setTimeout(function(){e.buttons.info(!1)},c));return this});
j.Api.register("buttons.exportData()",function(a){if(this.context.length){var b=new j.Api(this.context[0]),c=d.extend(!0,{},{rows:null,columns:"",modifier:{search:"applied",order:"applied"},orthogonal:"display",stripHtml:!0,stripNewlines:!0,decodeEntities:!0,trim:!0,format:{header:function(a){return e(a)},footer:function(a){return e(a)},body:function(a){return e(a)}},customizeData:null},a),e=function(a){if("string"!==typeof a)return a;a=a.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
"");a=a.replace(/<!\-\-.*?\-\->/g,"");c.stripHtml&&(a=a.replace(/<[^>]*>/g,""));c.trim&&(a=a.replace(/^\s+|\s+$/g,""));c.stripNewlines&&(a=a.replace(/\n/g," "));c.decodeEntities&&(v.innerHTML=a,a=v.value);return a},a=b.columns(c.columns).indexes().map(function(a){var d=b.column(a).header();return c.format.header(d.innerHTML,a,d)}).toArray(),i=b.table().footer()?b.columns(c.columns).indexes().map(function(a){var d=b.column(a).footer();return c.format.footer(d?d.innerHTML:"",a,d)}).toArray():null,g=
d.extend({},c.modifier);b.select&&"function"===typeof b.select.info&&g.selected===n&&b.rows(c.rows,d.extend({selected:!0},g)).any()&&d.extend(g,{selected:!0});for(var g=b.rows(c.rows,g).indexes().toArray(),f=b.cells(g,c.columns),g=f.render(c.orthogonal).toArray(),f=f.nodes().toArray(),k=a.length,m=[],h=0,l=0,p=0<k?g.length/k:0;l<p;l++){for(var o=[k],q=0;q<k;q++)o[q]=c.format.body(g[h],l,q,f[h]),h++;m[l]=o}a={header:a,footer:i,body:m};c.customizeData&&c.customizeData(a);return a}});j.Api.register("buttons.exportInfo()",
function(a){a||(a={});var b;var c=a;b="*"===c.filename&&"*"!==c.title&&c.title!==n&&null!==c.title&&""!==c.title?c.title:c.filename;"function"===typeof b&&(b=b());b===n||null===b?b=null:(-1!==b.indexOf("*")&&(b=d.trim(b.replace("*",d("head > title").text()))),b=b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""),(c=s(c.extension))||(c=""),b+=c);c=s(a.title);c=null===c?null:-1!==c.indexOf("*")?c.replace("*",d("head > title").text()||"Exported data"):c;return{filename:b,title:c,messageTop:w(this,
a.message||a.messageTop,"top"),messageBottom:w(this,a.messageBottom,"bottom")}});var s=function(a){return null===a||a===n?null:"function"===typeof a?a():a},w=function(a,b,c){b=s(b);if(null===b)return null;a=d("caption",a.table().container()).eq(0);return"*"===b?a.css("caption-side")!==c?null:a.length?a.text():"":b},v=d("<textarea/>")[0];d.fn.dataTable.Buttons=m;d.fn.DataTable.Buttons=m;d(o).on("init.dt plugin-init.dt",function(a,b){if("dt"===a.namespace){var c=b.oInit.buttons||j.defaults.buttons;
c&&!b._buttons&&(new m(b,c)).container()}});j.ext.feature.push({fnInit:t,cFeature:"B"});j.ext.features&&j.ext.features.register("buttons",t);return m});
a=this._nodeToButton(a);return d(a.node)},processing:function(a,b){var c=this.s.dt,e=this._nodeToButton(a);if(b===m)return d(e.node).hasClass("processing");d(e.node).toggleClass("processing",b);d(c.table().node()).triggerHandler("buttons-processing.dt",[b,c.button(a),c,d(a),e.conf]);return this},remove:function(a){var b=this._nodeToButton(a),c=this._nodeToHost(a),e=this.s.dt;if(b.buttons.length)for(var g=b.buttons.length-1;0<=g;g--)this.remove(b.buttons[g].node);b.conf.destroy&&b.conf.destroy.call(e.button(a),
e,d(a),b.conf);this._removeKey(b.conf);d(b.node).remove();a=d.inArray(b,c);c.splice(a,1);return this},text:function(a,b){var c=this._nodeToButton(a),e=this.c.dom.collection.buttonLiner,e=c.inCollection&&e&&e.tag?e.tag:this.c.dom.buttonLiner.tag,g=this.s.dt,f=d(c.node),h=function(a){return"function"===typeof a?a(g,f,c.conf):a};if(b===m)return h(c.conf.text);c.conf.text=b;e?f.children(e).html(h(b)):f.html(h(b));return this},_constructor:function(){var a=this,b=this.s.dt,c=b.settings()[0],e=this.c.buttons;
c._buttons||(c._buttons=[]);c._buttons.push({inst:this,name:this.c.name});for(var g=0,f=e.length;g<f;g++)this.add(e[g]);b.on("destroy",function(b,e){e===c&&a.destroy()});d("body").on("keyup."+this.s.namespace,function(b){if(!p.activeElement||p.activeElement===p.body){var c=String.fromCharCode(b.keyCode).toLowerCase();a.s.listenKeys.toLowerCase().indexOf(c)!==-1&&a._keypress(c,b)}})},_addKey:function(a){a.key&&(this.s.listenKeys+=d.isPlainObject(a.key)?a.key.key:a.key)},_draw:function(a,b){a||(a=this.dom.container,
b=this.s.buttons);a.children().detach();for(var c=0,e=b.length;c<e;c++)a.append(b[c].inserter),a.append(" "),b[c].buttons&&b[c].buttons.length&&this._draw(b[c].collection,b[c].buttons)},_expandButton:function(a,b,c,e){for(var g=this.s.dt,f=0,b=!d.isArray(b)?[b]:b,h=0,l=b.length;h<l;h++){var o=this._resolveExtends(b[h]);if(o)if(d.isArray(o))this._expandButton(a,o,c,e);else{var j=this._buildButton(o,c);j&&(e!==m?(a.splice(e,0,j),e++):a.push(j),j.conf.buttons&&(j.collection=d("<div/>"),j.conf._collection=
j.collection,this._expandButton(j.buttons,j.conf.buttons,!0,e)),o.init&&o.init.call(g.button(j.node),g,d(j.node),o),f++)}}},_buildButton:function(a,b){var c=this.c.dom.button,e=this.c.dom.buttonLiner,g=this.c.dom.collection,f=this.s.dt,h=function(b){return"function"===typeof b?b(f,j,a):b};b&&g.button&&(c=g.button);b&&g.buttonLiner&&(e=g.buttonLiner);if(a.available&&!a.available(f,a))return!1;var l=function(a,b,c,e){e.action.call(b.button(c),a,b,c,e);d(b.table().node()).triggerHandler("buttons-action.dt",
[b.button(c),b,c,e])},g=a.tag||c.tag,o=a.clickBlurs===m?!0:a.clickBlurs,j=d("<"+g+"/>").addClass(c.className).attr("tabindex",this.s.dt.settings()[0].iTabIndex).attr("aria-controls",this.s.dt.table().node().id).on("click.dtb",function(b){b.preventDefault();!j.hasClass(c.disabled)&&a.action&&l(b,f,j,a);o&&j.blur()}).on("keyup.dtb",function(b){b.keyCode===13&&!j.hasClass(c.disabled)&&a.action&&l(b,f,j,a)});"a"===g.toLowerCase()&&j.attr("href","#");"button"===g.toLowerCase()&&j.attr("type","button");
e.tag?(g=d("<"+e.tag+"/>").html(h(a.text)).addClass(e.className),"a"===e.tag.toLowerCase()&&g.attr("href","#"),j.append(g)):j.html(h(a.text));!1===a.enabled&&j.addClass(c.disabled);a.className&&j.addClass(a.className);a.titleAttr&&j.attr("title",h(a.titleAttr));a.attr&&j.attr(a.attr);a.namespace||(a.namespace=".dt-button-"+x++);e=(e=this.c.dom.buttonContainer)&&e.tag?d("<"+e.tag+"/>").addClass(e.className).append(j):j;this._addKey(a);this.c.buttonCreated&&(e=this.c.buttonCreated(a,e));return{conf:a,
node:j.get(0),inserter:e,buttons:[],inCollection:b,collection:null}},_nodeToButton:function(a,b){b||(b=this.s.buttons);for(var c=0,e=b.length;c<e;c++){if(b[c].node===a)return b[c];if(b[c].buttons.length){var d=this._nodeToButton(a,b[c].buttons);if(d)return d}}},_nodeToHost:function(a,b){b||(b=this.s.buttons);for(var c=0,e=b.length;c<e;c++){if(b[c].node===a)return b;if(b[c].buttons.length){var d=this._nodeToHost(a,b[c].buttons);if(d)return d}}},_keypress:function(a,b){if(!b._buttonsHandled){var c=
function(e){for(var g=0,f=e.length;g<f;g++){var h=e[g].conf,l=e[g].node;if(h.key)if(h.key===a)b._buttonsHandled=!0,d(l).click();else if(d.isPlainObject(h.key)&&h.key.key===a&&(!h.key.shiftKey||b.shiftKey))if(!h.key.altKey||b.altKey)if(!h.key.ctrlKey||b.ctrlKey)if(!h.key.metaKey||b.metaKey)b._buttonsHandled=!0,d(l).click();e[g].buttons.length&&c(e[g].buttons)}};c(this.s.buttons)}},_removeKey:function(a){if(a.key){var b=d.isPlainObject(a.key)?a.key.key:a.key,a=this.s.listenKeys.split(""),b=d.inArray(b,
a);a.splice(b,1);this.s.listenKeys=a.join("")}},_resolveExtends:function(a){for(var b=this.s.dt,c,e,g=function(c){for(var e=0;!d.isPlainObject(c)&&!d.isArray(c);){if(c===m)return;if("function"===typeof c){if(c=c(b,a),!c)return!1}else if("string"===typeof c){if(!k[c])throw"Unknown button type: "+c;c=k[c]}e++;if(30<e)throw"Buttons: Too many iterations";}return d.isArray(c)?c:d.extend({},c)},a=g(a);a&&a.extend;){if(!k[a.extend])throw"Cannot extend unknown button type: "+a.extend;var f=g(k[a.extend]);
if(d.isArray(f))return f;if(!f)return!1;c=f.className;a=d.extend({},f,a);c&&a.className!==c&&(a.className=c+" "+a.className);var h=a.postfixButtons;if(h){a.buttons||(a.buttons=[]);c=0;for(e=h.length;c<e;c++)a.buttons.push(h[c]);a.postfixButtons=null}if(h=a.prefixButtons){a.buttons||(a.buttons=[]);c=0;for(e=h.length;c<e;c++)a.buttons.splice(c,0,h[c]);a.prefixButtons=null}a.extend=f.extend}return a},_popover:function(a,b,c){var e=this.c,g=d.extend({align:"button-left",autoClose:!1,background:!0,backgroundClassName:"dt-button-background",
contentClassName:e.dom.collection.className,collectionLayout:"",collectionTitle:"",dropup:!1,fade:400,rightAlignClassName:"dt-button-right",tag:e.dom.collection.tag},c),f=b.node(),h=function(){d(".dt-button-collection").stop().fadeOut(g.fade,function(){d(this).detach()});d(b.buttons('[aria-haspopup="true"][aria-expanded="true"]').nodes()).attr("aria-expanded","false");d("div.dt-button-background").off("click.dtb-collection");n.background(!1,g.backgroundClassName,g.fade,f);d("body").off(".dtb-collection");
b.off("buttons-action.b-internal")};!1===a&&h();c=d(b.buttons('[aria-haspopup="true"][aria-expanded="true"]').nodes());c.length&&(f=c.eq(0),h());var a=d(a),l=d(b.table().container());f.attr("aria-expanded","true");f.parents("body")[0]!==p.body&&(f=p.body.lastChild);c=d("<"+g.tag+"/>").addClass(g.contentClassName).attr("role","menu");g.collectionTitle&&c.prepend('<div class="dt-button-collection-title">'+g.collectionTitle+"</div>");c.addClass(g.collectionLayout).css("display","none").append(a).insertAfter(f).stop().fadeIn(g.fade);
e=c.css("position");"dt-container"===g.align&&(f=f.parent(),c.css("width",l.width()));if("absolute"===e){e=f.position();c.css({top:e.top+f.outerHeight(),left:e.left});var o=c.outerHeight(),j=c.outerWidth(),i=l.offset().top+l.height(),i=e.top+f.outerHeight()+o-i,m=e.top-o,k=l.offset().top,o=e.top-o-5;(i>k-m||g.dropup)&&-o<k&&c.css("top",o);(c.hasClass(g.rightAlignClassName)||"button-right"===g.align)&&c.css("left",e.left+f.outerWidth()-j);o=e.left+j;l=l.offset().left+l.width();o>l&&c.css("left",e.left-
(o-l));l=f.offset().left+j;l>d(q).width()&&c.css("left",e.left-(l-d(q).width()))}else e=c.height()/2,e>d(q).height()/2&&(e=d(q).height()/2),c.css("marginTop",-1*e);g.background&&n.background(!0,g.backgroundClassName,g.fade,f);d("div.dt-button-background").on("click.dtb-collection",function(){});d("body").on("click.dtb-collection",function(b){var c=d.fn.addBack?"addBack":"andSelf";d(b.target).parents()[c]().filter(a).length||h()}).on("keyup.dtb-collection",function(a){a.keyCode===27&&h()});g.autoClose&&
setTimeout(function(){b.on("buttons-action.b-internal",function(a,b,c,e){e[0]!==f[0]&&h()})},0)}});n.background=function(a,b,c,e){c===m&&(c=400);e||(e=p.body);a?d("<div/>").addClass(b).css("display","none").insertAfter(e).stop().fadeIn(c):d("div."+b).stop().fadeOut(c,function(){d(this).removeClass(b).remove()})};n.instanceSelector=function(a,b){if(a===m||null===a)return d.map(b,function(a){return a.inst});var c=[],e=d.map(b,function(a){return a.name}),g=function(a){if(d.isArray(a))for(var h=0,l=a.length;h<
l;h++)g(a[h]);else"string"===typeof a?-1!==a.indexOf(",")?g(a.split(",")):(a=d.inArray(d.trim(a),e),-1!==a&&c.push(b[a].inst)):"number"===typeof a&&c.push(b[a].inst)};g(a);return c};n.buttonSelector=function(a,b){for(var c=[],e=function(a,b,c){for(var d,g,f=0,h=b.length;f<h;f++)if(d=b[f])g=c!==m?c+f:f+"",a.push({node:d.node,name:d.conf.name,idx:g}),d.buttons&&e(a,d.buttons,g+"-")},g=function(a,b){var f,h,i=[];e(i,b.s.buttons);f=d.map(i,function(a){return a.node});if(d.isArray(a)||a instanceof d){f=
0;for(h=a.length;f<h;f++)g(a[f],b)}else if(null===a||a===m||"*"===a){f=0;for(h=i.length;f<h;f++)c.push({inst:b,node:i[f].node})}else if("number"===typeof a)c.push({inst:b,node:b.s.buttons[a].node});else if("string"===typeof a)if(-1!==a.indexOf(",")){i=a.split(",");f=0;for(h=i.length;f<h;f++)g(d.trim(i[f]),b)}else if(a.match(/^\d+(\-\d+)*$/))f=d.map(i,function(a){return a.idx}),c.push({inst:b,node:i[d.inArray(a,f)].node});else if(-1!==a.indexOf(":name")){var k=a.replace(":name","");f=0;for(h=i.length;f<
h;f++)i[f].name===k&&c.push({inst:b,node:i[f].node})}else d(f).filter(a).each(function(){c.push({inst:b,node:this})});else"object"===typeof a&&a.nodeName&&(i=d.inArray(a,f),-1!==i&&c.push({inst:b,node:f[i]}))},f=0,h=a.length;f<h;f++)g(b,a[f]);return c};n.defaults={buttons:["copy","excel","csv","pdf","print"],name:"main",tabIndex:0,dom:{container:{tag:"div",className:"dt-buttons"},collection:{tag:"div",className:"dt-button-collection"},button:{tag:"ActiveXObject"in q?"a":"button",className:"dt-button",
active:"active",disabled:"disabled"},buttonLiner:{tag:"span",className:""}}};n.version="1.6.0";d.extend(k,{collection:{text:function(a){return a.i18n("buttons.collection","Collection")},className:"buttons-collection",init:function(a,b){b.attr("aria-expanded",!1)},action:function(a,b,c,e){a.stopPropagation();e._collection.parents("body").length?this.popover(!1,e):this.popover(e._collection,e)},attr:{"aria-haspopup":!0}},copy:function(a,b){if(k.copyHtml5)return"copyHtml5";if(k.copyFlash&&k.copyFlash.available(a,
b))return"copyFlash"},csv:function(a,b){if(k.csvHtml5&&k.csvHtml5.available(a,b))return"csvHtml5";if(k.csvFlash&&k.csvFlash.available(a,b))return"csvFlash"},excel:function(a,b){if(k.excelHtml5&&k.excelHtml5.available(a,b))return"excelHtml5";if(k.excelFlash&&k.excelFlash.available(a,b))return"excelFlash"},pdf:function(a,b){if(k.pdfHtml5&&k.pdfHtml5.available(a,b))return"pdfHtml5";if(k.pdfFlash&&k.pdfFlash.available(a,b))return"pdfFlash"},pageLength:function(a){var a=a.settings()[0].aLengthMenu,b=d.isArray(a[0])?
a[0]:a,c=d.isArray(a[0])?a[1]:a;return{extend:"collection",text:function(a){return a.i18n("buttons.pageLength",{"-1":"Show all rows",_:"Show %d rows"},a.page.len())},className:"buttons-page-length",autoClose:!0,buttons:d.map(b,function(a,b){return{text:c[b],className:"button-page-length",action:function(b,c){c.page.len(a).draw()},init:function(b,c,d){var g=this,c=function(){g.active(b.page.len()===a)};b.on("length.dt"+d.namespace,c);c()},destroy:function(a,b,c){a.off("length.dt"+c.namespace)}}}),
init:function(a,b,c){var d=this;a.on("length.dt"+c.namespace,function(){d.text(c.text)})},destroy:function(a,b,c){a.off("length.dt"+c.namespace)}}}});i.Api.register("buttons()",function(a,b){b===m&&(b=a,a=m);this.selector.buttonGroup=a;var c=this.iterator(!0,"table",function(c){if(c._buttons)return n.buttonSelector(n.instanceSelector(a,c._buttons),b)},!0);c._groupSelector=a;return c});i.Api.register("button()",function(a,b){var c=this.buttons(a,b);1<c.length&&c.splice(1,c.length);return c});i.Api.registerPlural("buttons().active()",
"button().active()",function(a){return a===m?this.map(function(a){return a.inst.active(a.node)}):this.each(function(b){b.inst.active(b.node,a)})});i.Api.registerPlural("buttons().action()","button().action()",function(a){return a===m?this.map(function(a){return a.inst.action(a.node)}):this.each(function(b){b.inst.action(b.node,a)})});i.Api.register(["buttons().enable()","button().enable()"],function(a){return this.each(function(b){b.inst.enable(b.node,a)})});i.Api.register(["buttons().disable()",
"button().disable()"],function(){return this.each(function(a){a.inst.disable(a.node)})});i.Api.registerPlural("buttons().nodes()","button().node()",function(){var a=d();d(this.each(function(b){a=a.add(b.inst.node(b.node))}));return a});i.Api.registerPlural("buttons().processing()","button().processing()",function(a){return a===m?this.map(function(a){return a.inst.processing(a.node)}):this.each(function(b){b.inst.processing(b.node,a)})});i.Api.registerPlural("buttons().text()","button().text()",function(a){return a===
m?this.map(function(a){return a.inst.text(a.node)}):this.each(function(b){b.inst.text(b.node,a)})});i.Api.registerPlural("buttons().trigger()","button().trigger()",function(){return this.each(function(a){a.inst.node(a.node).trigger("click")})});i.Api.register("button().popover()",function(a,b){return this.map(function(c){return c.inst._popover(a,this.button(this[0].node),b)})});i.Api.register("buttons().containers()",function(){var a=d(),b=this._groupSelector;this.iterator(!0,"table",function(c){if(c._buttons)for(var c=
n.instanceSelector(b,c._buttons),d=0,g=c.length;d<g;d++)a=a.add(c[d].container())});return a});i.Api.register("buttons().container()",function(){return this.containers().eq(0)});i.Api.register("button().add()",function(a,b){var c=this.context;c.length&&(c=n.instanceSelector(this._groupSelector,c[0]._buttons),c.length&&c[0].add(b,a));return this.button(this._groupSelector,a)});i.Api.register("buttons().destroy()",function(){this.pluck("inst").unique().each(function(a){a.destroy()});return this});i.Api.registerPlural("buttons().remove()",
"buttons().remove()",function(){this.each(function(a){a.inst.remove(a.node)});return this});var r;i.Api.register("buttons.info()",function(a,b,c){var e=this;if(!1===a)return this.off("destroy.btn-info"),d("#datatables_buttons_info").fadeOut(function(){d(this).remove()}),clearTimeout(r),r=null,this;r&&clearTimeout(r);d("#datatables_buttons_info").length&&d("#datatables_buttons_info").remove();d('<div id="datatables_buttons_info" class="dt-button-info"/>').html(a?"<h2>"+a+"</h2>":"").append(d("<div/>")["string"===
typeof b?"html":"append"](b)).css("display","none").appendTo("body").fadeIn();c!==m&&0!==c&&(r=setTimeout(function(){e.buttons.info(!1)},c));this.on("destroy.btn-info",function(){e.buttons.info(!1)});return this});i.Api.register("buttons.exportData()",function(a){if(this.context.length){var b=new i.Api(this.context[0]),c=d.extend(!0,{},{rows:null,columns:"",modifier:{search:"applied",order:"applied"},orthogonal:"display",stripHtml:!0,stripNewlines:!0,decodeEntities:!0,trim:!0,format:{header:function(a){return e(a)},
footer:function(a){return e(a)},body:function(a){return e(a)}},customizeData:null},a),e=function(a){if("string"!==typeof a)return a;a=a.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"");a=a.replace(/<!\-\-.*?\-\->/g,"");c.stripHtml&&(a=a.replace(/<[^>]*>/g,""));c.trim&&(a=a.replace(/^\s+|\s+$/g,""));c.stripNewlines&&(a=a.replace(/\n/g," "));c.decodeEntities&&(u.innerHTML=a,a=u.value);return a},a=b.columns(c.columns).indexes().map(function(a){var d=b.column(a).header();return c.format.header(d.innerHTML,
a,d)}).toArray(),g=b.table().footer()?b.columns(c.columns).indexes().map(function(a){var d=b.column(a).footer();return c.format.footer(d?d.innerHTML:"",a,d)}).toArray():null,f=d.extend({},c.modifier);b.select&&"function"===typeof b.select.info&&f.selected===m&&b.rows(c.rows,d.extend({selected:!0},f)).any()&&d.extend(f,{selected:!0});for(var f=b.rows(c.rows,f).indexes().toArray(),h=b.cells(f,c.columns),f=h.render(c.orthogonal).toArray(),h=h.nodes().toArray(),l=a.length,k=[],j=0,n=0,q=0<l?f.length/
l:0;n<q;n++){for(var p=[l],r=0;r<l;r++)p[r]=c.format.body(f[j],n,r,h[j]),j++;k[n]=p}a={header:a,footer:g,body:k};c.customizeData&&c.customizeData(a);return a}});i.Api.register("buttons.exportInfo()",function(a){a||(a={});var b;var c=a;b="*"===c.filename&&"*"!==c.title&&c.title!==m&&null!==c.title&&""!==c.title?c.title:c.filename;"function"===typeof b&&(b=b());b===m||null===b?b=null:(-1!==b.indexOf("*")&&(b=d.trim(b.replace("*",d("head > title").text()))),b=b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,
""),(c=s(c.extension))||(c=""),b+=c);c=s(a.title);c=null===c?null:-1!==c.indexOf("*")?c.replace("*",d("head > title").text()||"Exported data"):c;return{filename:b,title:c,messageTop:v(this,a.message||a.messageTop,"top"),messageBottom:v(this,a.messageBottom,"bottom")}});var s=function(a){return null===a||a===m?null:"function"===typeof a?a():a},v=function(a,b,c){b=s(b);if(null===b)return null;a=d("caption",a.table().container()).eq(0);return"*"===b?a.css("caption-side")!==c?null:a.length?a.text():"":
b},u=d("<textarea/>")[0];d.fn.dataTable.Buttons=n;d.fn.DataTable.Buttons=n;d(p).on("init.dt plugin-init.dt",function(a,b){if("dt"===a.namespace){var c=b.oInit.buttons||i.defaults.buttons;c&&!b._buttons&&(new n(b,c)).container()}});i.ext.feature.push({fnInit:t,cFeature:"B"});i.ext.features&&i.ext.features.register("buttons",t);return n});
{
"name": "datatables.net-buttons",
"version": "1.5.6",
"version": "1.6.0",
"description": "Buttons for DataTables ",

@@ -5,0 +5,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc