Socket
Socket
Sign inDemoInstall

datatables.net-responsive

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datatables.net-responsive - npm Package Compare versions

Comparing version 2.4.1 to 2.5.0

1124

js/dataTables.responsive.js

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

/*! Responsive 2.4.1
/*! Responsive 2.5.0
* © SpryMedia Ltd - datatables.net/license

@@ -21,3 +21,3 @@ */

if (typeof window !== 'undefined') {
if (typeof window === 'undefined') {
module.exports = function (root, $) {

@@ -56,5 +56,4 @@ if ( ! root ) {

* @description Responsive tables plug-in for DataTables
* @version 2.4.1
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact
* @version 2.5.0
* @author SpryMedia Ltd
* @copyright SpryMedia Ltd.

@@ -117,5 +116,5 @@ *

*/
var Responsive = function ( settings, opts ) {
var Responsive = function (settings, opts) {
// Sanity check that we are using DataTables 1.10 or newer
if ( ! DataTable.versionCheck || ! DataTable.versionCheck( '1.10.10' ) ) {
if (!DataTable.versionCheck || !DataTable.versionCheck('1.10.10')) {
throw 'DataTables Responsive requires DataTables 1.10.10 or newer';

@@ -128,7 +127,7 @@ }

current: [],
dt: new DataTable.Api( settings )
dt: new DataTable.Api(settings)
};
// Check if responsive has already been initialised on this table
if ( this.s.dt.settings()[0].responsive ) {
if (this.s.dt.settings()[0].responsive) {
return;

@@ -139,13 +138,13 @@ }

// or a boolean
if ( opts && typeof opts.details === 'string' ) {
if (opts && typeof opts.details === 'string') {
opts.details = { type: opts.details };
}
else if ( opts && opts.details === false ) {
else if (opts && opts.details === false) {
opts.details = { type: false };
}
else if ( opts && opts.details === true ) {
else if (opts && opts.details === true) {
opts.details = { type: 'inline' };
}
this.c = $.extend( true, {}, Responsive.defaults, DataTable.defaults.responsive, opts );
this.c = $.extend(true, {}, Responsive.defaults, DataTable.defaults.responsive, opts);
settings.responsive = this;

@@ -155,3 +154,3 @@ this._constructor();

$.extend( Responsive.prototype, {
$.extend(Responsive.prototype, {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

@@ -166,4 +165,3 @@ * Constructor

*/
_constructor: function ()
{
_constructor: function () {
var that = this;

@@ -178,12 +176,15 @@ var dt = this.s.dt;

// resize
$(window).on( 'resize.dtr orientationchange.dtr', DataTable.util.throttle( function () {
// iOS has a bug whereby resize can fire when only scrolling
// See: http://stackoverflow.com/questions/8898412
var width = $(window).innerWidth();
$(window).on(
'resize.dtr orientationchange.dtr',
DataTable.util.throttle(function () {
// iOS has a bug whereby resize can fire when only scrolling
// See: http://stackoverflow.com/questions/8898412
var width = $(window).innerWidth();
if ( width !== oldWindowWidth ) {
that._resize();
oldWindowWidth = width;
}
} ) );
if (width !== oldWindowWidth) {
that._resize();
oldWindowWidth = width;
}
})
);

@@ -193,35 +194,38 @@ // DataTables doesn't currently trigger an event when a row is added, so

// new data is added
dtPrivateSettings.oApi._fnCallbackReg( dtPrivateSettings, 'aoRowCreatedCallback', function (tr, data, idx) {
if ( $.inArray( false, that.s.current ) !== -1 ) {
$('>td, >th', tr).each( function ( i ) {
var idx = dt.column.index( 'toData', i );
dtPrivateSettings.oApi._fnCallbackReg(
dtPrivateSettings,
'aoRowCreatedCallback',
function (tr, data, idx) {
if ($.inArray(false, that.s.current) !== -1) {
$('>td, >th', tr).each(function (i) {
var idx = dt.column.index('toData', i);
if ( that.s.current[idx] === false ) {
$(this).css('display', 'none');
}
} );
if (that.s.current[idx] === false) {
$(this).css('display', 'none');
}
});
}
}
} );
);
// Destroy event handler
dt.on( 'destroy.dtr', function () {
dt.off( '.dtr' );
$( dt.table().body() ).off( '.dtr' );
$(window).off( 'resize.dtr orientationchange.dtr' );
dt.on('destroy.dtr', function () {
dt.off('.dtr');
$(dt.table().body()).off('.dtr');
$(window).off('resize.dtr orientationchange.dtr');
dt.cells('.dtr-control').nodes().to$().removeClass('dtr-control');
// Restore the columns that we've hidden
$.each( that.s.current, function ( i, val ) {
if ( val === false ) {
that._setColumnVis( i, true );
$.each(that.s.current, function (i, val) {
if (val === false) {
that._setColumnVis(i, true);
}
} );
} );
});
});
// Reorder the breakpoints array here in case they have been added out
// of order
this.c.breakpoints.sort( function (a, b) {
return a.width < b.width ? 1 :
a.width > b.width ? -1 : 0;
} );
this.c.breakpoints.sort(function (a, b) {
return a.width < b.width ? 1 : a.width > b.width ? -1 : 0;
});

@@ -234,3 +238,3 @@ this._classLogic();

if ( details.type !== false ) {
if (details.type !== false) {
that._detailsInit();

@@ -240,9 +244,9 @@

// hides individually
dt.on( 'column-visibility.dtr', function () {
dt.on('column-visibility.dtr', function () {
// Use a small debounce to allow multiple columns to be set together
if ( that._timer ) {
clearTimeout( that._timer );
if (that._timer) {
clearTimeout(that._timer);
}
that._timer = setTimeout( function () {
that._timer = setTimeout(function () {
that._timer = null;

@@ -255,4 +259,4 @@

that._redrawChildren();
}, 100 );
} );
}, 100);
});

@@ -262,17 +266,17 @@ // Redraw the details box on each draw which will happen if the data

// `updated` event for rows
dt.on( 'draw.dtr', function () {
dt.on('draw.dtr', function () {
that._redrawChildren();
} );
});
$(dt.table().node()).addClass( 'dtr-'+details.type );
$(dt.table().node()).addClass('dtr-' + details.type);
}
dt.on( 'column-reorder.dtr', function (e, settings, details) {
dt.on('column-reorder.dtr', function (e, settings, details) {
that._classLogic();
that._resizeAuto();
that._resize(true);
} );
});
// Change in column sizes means we need to calc
dt.on( 'column-sizing.dtr', function () {
dt.on('column-sizing.dtr', function () {
that._resizeAuto();

@@ -283,6 +287,6 @@ that._resize();

// DT2 let's us tell it if we are hiding columns
dt.on( 'column-calc.dt', function (e, d) {
dt.on('column-calc.dt', function (e, d) {
var curr = that.s.current;
for (var i=0 ; i<curr.length ; i++) {
for (var i = 0; i < curr.length; i++) {
var idx = d.visible.indexOf(i);

@@ -294,42 +298,40 @@

}
} );
});
// On Ajax reload we want to reopen any child rows which are displayed
// by responsive
dt.on( 'preXhr.dtr', function () {
dt.on('preXhr.dtr', function () {
var rowIds = [];
dt.rows().every( function () {
if ( this.child.isShown() ) {
rowIds.push( this.id(true) );
dt.rows().every(function () {
if (this.child.isShown()) {
rowIds.push(this.id(true));
}
} );
});
dt.one( 'draw.dtr', function () {
dt.one('draw.dtr', function () {
that._resizeAuto();
that._resize();
dt.rows( rowIds ).every( function () {
that._detailsDisplay( this, false );
} );
} );
dt.rows(rowIds).every(function () {
that._detailsDisplay(this, false);
});
});
});
dt
.on( 'draw.dtr', function () {
that._controlClass();
})
.on( 'init.dtr', function (e, settings, details) {
if ( e.namespace !== 'dt' ) {
return;
}
dt.on('draw.dtr', function () {
that._controlClass();
}).on('init.dtr', function (e, settings, details) {
if (e.namespace !== 'dt') {
return;
}
that._resizeAuto();
that._resize();
that._resizeAuto();
that._resize();
// If columns were hidden, then DataTables needs to adjust the
// column sizing
if ( $.inArray( false, that.s.current ) ) {
dt.columns.adjust();
}
} );
// If columns were hidden, then DataTables needs to adjust the
// column sizing
if ($.inArray(false, that.s.current)) {
dt.columns.adjust();
}
});

@@ -340,3 +342,2 @@ // First pass - draw the table for the current viewport size

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

@@ -353,7 +354,7 @@ * Private methods

*/
_childNodes: function( dt, row, col ) {
var name = row+'-'+col;
_childNodes: function (dt, row, col) {
var name = row + '-' + col;
if ( this.s.childNodeStore[ name ] ) {
return this.s.childNodeStore[ name ];
if (this.s.childNodeStore[name]) {
return this.s.childNodeStore[name];
}

@@ -363,8 +364,8 @@

var nodes = [];
var children = dt.cell( row, col ).node().childNodes;
for ( var i=0, ien=children.length ; i<ien ; i++ ) {
nodes.push( children[i] );
var children = dt.cell(row, col).node().childNodes;
for (var i = 0, ien = children.length; i < ien; i++) {
nodes.push(children[i]);
}
this.s.childNodeStore[ name ] = nodes;
this.s.childNodeStore[name] = nodes;

@@ -381,11 +382,11 @@ return nodes;

*/
_childNodesRestore: function( dt, row, col ) {
var name = row+'-'+col;
_childNodesRestore: function (dt, row, col) {
var name = row + '-' + col;
if ( ! this.s.childNodeStore[ name ] ) {
if (!this.s.childNodeStore[name]) {
return;
}
var node = dt.cell( row, col ).node();
var store = this.s.childNodeStore[ name ];
var node = dt.cell(row, col).node();
var store = this.s.childNodeStore[name];
var parent = store[0].parentNode;

@@ -395,11 +396,11 @@ var parentChildren = parent.childNodes;

for ( var i=0, ien=parentChildren.length ; i<ien ; i++ ) {
a.push( parentChildren[i] );
for (var i = 0, ien = parentChildren.length; i < ien; i++) {
a.push(parentChildren[i]);
}
for ( var j=0, jen=a.length ; j<jen ; j++ ) {
node.appendChild( a[j] );
for (var j = 0, jen = a.length; j < jen; j++) {
node.appendChild(a[j]);
}
this.s.childNodeStore[ name ] = undefined;
this.s.childNodeStore[name] = undefined;
},

@@ -419,4 +420,3 @@

*/
_columnsVisiblity: function ( breakpoint )
{
_columnsVisiblity: function (breakpoint) {
var dt = this.s.dt;

@@ -430,3 +430,3 @@ var columns = this.s.columns;

var order = columns
.map( function ( col, idx ) {
.map(function (col, idx) {
return {

@@ -436,9 +436,9 @@ columnIdx: idx,

};
} )
.sort( function ( a, b ) {
if ( a.priority !== b.priority ) {
})
.sort(function (a, b) {
if (a.priority !== b.priority) {
return a.priority - b.priority;
}
return a.columnIdx - b.columnIdx;
} );
});

@@ -448,12 +448,12 @@ // Class logic - determine which columns are in this breakpoint based

// to indicate this to the rest of the function
var display = $.map( columns, function ( col, i ) {
if ( dt.column(i).visible() === false ) {
var display = $.map(columns, function (col, i) {
if (dt.column(i).visible() === false) {
return 'not-visible';
}
return col.auto && col.minWidth === null ?
false :
col.auto === true ?
'-' :
$.inArray( breakpoint, col.includeIn ) !== -1;
} );
return col.auto && col.minWidth === null
? false
: col.auto === true
? '-'
: $.inArray(breakpoint, col.includeIn) !== -1;
});

@@ -463,4 +463,4 @@ // Auto column control - first pass: how much width is taken by the

var requiredWidth = 0;
for ( i=0, ien=display.length ; i<ien ; i++ ) {
if ( display[i] === true ) {
for (i = 0, ien = display.length; i < ien; i++) {
if (display[i] === true) {
requiredWidth += columns[i].minWidth;

@@ -485,4 +485,4 @@ }

// columns, since the control column might not be the first one shown
for ( i=0, ien=display.length ; i<ien ; i++ ) {
if ( columns[i].control ) {
for (i = 0, ien = display.length; i < ien; i++) {
if (columns[i].control) {
usedWidth -= columns[i].minWidth;

@@ -495,10 +495,10 @@ }

var empty = false;
for ( i=0, ien=order.length ; i<ien ; i++ ) {
for (i = 0, ien = order.length; i < ien; i++) {
var colIdx = order[i].columnIdx;
if ( display[colIdx] === '-' && ! columns[colIdx].control && columns[colIdx].minWidth ) {
if (display[colIdx] === '-' && !columns[colIdx].control && columns[colIdx].minWidth) {
// Once we've found a column that won't fit we don't let any
// others display either, or columns might disappear in the
// middle of the table
if ( empty || usedWidth - columns[colIdx].minWidth < 0 ) {
if (empty || usedWidth - columns[colIdx].minWidth < 0) {
empty = true;

@@ -522,4 +522,4 @@ display[colIdx] = false;

for ( i=0, ien=columns.length ; i<ien ; i++ ) {
if ( ! columns[i].control && ! columns[i].never && display[i] === false ) {
for (i = 0, ien = columns.length; i < ien; i++) {
if (!columns[i].control && !columns[i].never && display[i] === false) {
showControl = true;

@@ -530,4 +530,4 @@ break;

for ( i=0, ien=columns.length ; i<ien ; i++ ) {
if ( columns[i].control ) {
for (i = 0, ien = columns.length; i < ien; i++) {
if (columns[i].control) {
display[i] = showControl;

@@ -537,3 +537,3 @@ }

// Replace not visible string with false from the control column detection above
if ( display[i] === 'not-visible' ) {
if (display[i] === 'not-visible') {
display[i] = false;

@@ -545,3 +545,3 @@ }

// is visible
if ( $.inArray( true, display ) === -1 ) {
if ($.inArray(true, display) === -1) {
display[0] = true;

@@ -553,3 +553,2 @@ }

/**

@@ -563,4 +562,3 @@ * Create the internal `columns` array with information about the columns

*/
_classLogic: function ()
{
_classLogic: function () {
var that = this;

@@ -570,65 +568,69 @@ var calc = {};

var dt = this.s.dt;
var columns = dt.columns().eq(0).map( function (i) {
var column = this.column(i);
var className = column.header().className;
var priority = dt.settings()[0].aoColumns[i].responsivePriority;
var dataPriority = column.header().getAttribute('data-priority');
var columns = dt
.columns()
.eq(0)
.map(function (i) {
var column = this.column(i);
var className = column.header().className;
var priority = dt.settings()[0].aoColumns[i].responsivePriority;
var dataPriority = column.header().getAttribute('data-priority');
if ( priority === undefined ) {
priority = dataPriority === undefined || dataPriority === null?
10000 :
dataPriority * 1;
}
if (priority === undefined) {
priority =
dataPriority === undefined || dataPriority === null
? 10000
: dataPriority * 1;
}
return {
className: className,
includeIn: [],
auto: false,
control: false,
never: className.match(/\b(dtr\-)?never\b/) ? true : false,
priority: priority
};
} );
return {
className: className,
includeIn: [],
auto: false,
control: false,
never: className.match(/\b(dtr\-)?never\b/) ? true : false,
priority: priority
};
});
// Simply add a breakpoint to `includeIn` array, ensuring that there are
// no duplicates
var add = function ( colIdx, name ) {
var includeIn = columns[ colIdx ].includeIn;
var add = function (colIdx, name) {
var includeIn = columns[colIdx].includeIn;
if ( $.inArray( name, includeIn ) === -1 ) {
includeIn.push( name );
if ($.inArray(name, includeIn) === -1) {
includeIn.push(name);
}
};
var column = function ( colIdx, name, operator, matched ) {
var column = function (colIdx, name, operator, matched) {
var size, i, ien;
if ( ! operator ) {
columns[ colIdx ].includeIn.push( name );
if (!operator) {
columns[colIdx].includeIn.push(name);
}
else if ( operator === 'max-' ) {
else if (operator === 'max-') {
// Add this breakpoint and all smaller
size = that._find( name ).width;
size = that._find(name).width;
for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
if ( breakpoints[i].width <= size ) {
add( colIdx, breakpoints[i].name );
for (i = 0, ien = breakpoints.length; i < ien; i++) {
if (breakpoints[i].width <= size) {
add(colIdx, breakpoints[i].name);
}
}
}
else if ( operator === 'min-' ) {
else if (operator === 'min-') {
// Add this breakpoint and all larger
size = that._find( name ).width;
size = that._find(name).width;
for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
if ( breakpoints[i].width >= size ) {
add( colIdx, breakpoints[i].name );
for (i = 0, ien = breakpoints.length; i < ien; i++) {
if (breakpoints[i].width >= size) {
add(colIdx, breakpoints[i].name);
}
}
}
else if ( operator === 'not-' ) {
else if (operator === 'not-') {
// Add all but this breakpoint
for ( i=0, ien=breakpoints.length ; i<ien ; i++ ) {
if ( breakpoints[i].name.indexOf( matched ) === -1 ) {
add( colIdx, breakpoints[i].name );
for (i = 0, ien = breakpoints.length; i < ien; i++) {
if (breakpoints[i].name.indexOf(matched) === -1) {
add(colIdx, breakpoints[i].name);
}

@@ -641,3 +643,3 @@ }

// class
columns.each( function ( col, i ) {
columns.each(function (col, i) {
var classNames = col.className.split(' ');

@@ -647,14 +649,14 @@ var hasClass = false;

// Split the class name up so multiple rules can be applied if needed
for ( var k=0, ken=classNames.length ; k<ken ; k++ ) {
for (var k = 0, ken = classNames.length; k < ken; k++) {
var className = classNames[k].trim();
if ( className === 'all' || className === 'dtr-all' ) {
if (className === 'all' || className === 'dtr-all') {
// Include in all
hasClass = true;
col.includeIn = $.map( breakpoints, function (a) {
col.includeIn = $.map(breakpoints, function (a) {
return a.name;
} );
});
return;
}
else if ( className === 'none' || className === 'dtr-none' || col.never ) {
else if (className === 'none' || className === 'dtr-none' || col.never) {
// Include in none (default) and no auto

@@ -664,3 +666,3 @@ hasClass = true;

}
else if ( className === 'control' || className === 'dtr-control' ) {
else if (className === 'control' || className === 'dtr-control') {
// Special column that is only visible, when one of the other

@@ -673,28 +675,30 @@ // columns is hidden. This is used for the details control

$.each( breakpoints, function ( j, breakpoint ) {
$.each(breakpoints, function (j, breakpoint) {
// Does this column have a class that matches this breakpoint?
var brokenPoint = breakpoint.name.split('-');
var re = new RegExp( '(min\\-|max\\-|not\\-)?('+brokenPoint[0]+')(\\-[_a-zA-Z0-9])?' );
var match = className.match( re );
var re = new RegExp(
'(min\\-|max\\-|not\\-)?(' + brokenPoint[0] + ')(\\-[_a-zA-Z0-9])?'
);
var match = className.match(re);
if ( match ) {
if (match) {
hasClass = true;
if ( match[2] === brokenPoint[0] && match[3] === '-'+brokenPoint[1] ) {
if (match[2] === brokenPoint[0] && match[3] === '-' + brokenPoint[1]) {
// Class name matches breakpoint name fully
column( i, breakpoint.name, match[1], match[2]+match[3] );
column(i, breakpoint.name, match[1], match[2] + match[3]);
}
else if ( match[2] === brokenPoint[0] && ! match[3] ) {
else if (match[2] === brokenPoint[0] && !match[3]) {
// Class name matched primary breakpoint name with no qualifier
column( i, breakpoint.name, match[1], match[2] );
column(i, breakpoint.name, match[1], match[2]);
}
}
} );
});
}
// If there was no control class, then automatic sizing is used
if ( ! hasClass ) {
if (!hasClass) {
col.auto = true;
}
} );
});

@@ -708,5 +712,4 @@ this.s.columns = columns;

*/
_controlClass: function ()
{
if ( this.c.details.type === 'inline' ) {
_controlClass: function () {
if (this.c.details.type === 'inline') {
var dt = this.s.dt;

@@ -719,6 +722,6 @@ var columnsVis = this.s.current;

null,
function(idx) {
function (idx) {
return idx !== firstVisible;
},
{page: 'current'}
{ page: 'current' }
)

@@ -730,6 +733,3 @@ .nodes()

dt.cells(null, firstVisible, {page: 'current'})
.nodes()
.to$()
.addClass('dtr-control');
dt.cells(null, firstVisible, { page: 'current' }).nodes().to$().addClass('dtr-control');
}

@@ -745,21 +745,30 @@ },

*/
_detailsDisplay: function ( row, update )
{
_detailsDisplay: function (row, update) {
var that = this;
var dt = this.s.dt;
var details = this.c.details;
var event = function (res) {
$(row.node()).toggleClass('parent', res !== false);
$(dt.table().node()).triggerHandler('responsive-display.dt', [dt, row, res, update]);
};
if ( details && details.type !== false ) {
var renderer = typeof details.renderer === 'string'
? Responsive.renderer[details.renderer]()
: details.renderer;
if (details && details.type !== false) {
var renderer =
typeof details.renderer === 'string'
? Responsive.renderer[details.renderer]()
: details.renderer;
var res = details.display( row, update, function () {
return renderer.call(
that, dt, row[0], that._detailsObj(row[0])
);
} );
var res = details.display(
row,
update,
function () {
return renderer.call(that, dt, row[0], that._detailsObj(row[0]));
},
function () {
event(false);
}
);
if ( res === true || res === false ) {
$(dt.table().node()).triggerHandler( 'responsive-display.dt', [dt, row, res, update] );
if (typeof res === 'boolean') {
event(res);
}

@@ -769,3 +778,2 @@ }

/**

@@ -776,10 +784,9 @@ * Initialisation for the details handler

*/
_detailsInit: function ()
{
var that = this;
var dt = this.s.dt;
_detailsInit: function () {
var that = this;
var dt = this.s.dt;
var details = this.c.details;
// The inline type always uses the first child as the target
if ( details.type === 'inline' ) {
if (details.type === 'inline') {
details.target = 'td.dtr-control, th.dtr-control';

@@ -789,67 +796,63 @@ }

// Keyboard accessibility
dt.on( 'draw.dtr', function () {
dt.on('draw.dtr', function () {
that._tabIndexes();
} );
});
that._tabIndexes(); // Initial draw has already happened
$( dt.table().body() ).on( 'keyup.dtr', 'td, th', function (e) {
if ( e.keyCode === 13 && $(this).data('dtr-keyboard') ) {
$(dt.table().body()).on('keyup.dtr', 'td, th', function (e) {
if (e.keyCode === 13 && $(this).data('dtr-keyboard')) {
$(this).click();
}
} );
});
// type.target can be a string jQuery selector or a column index
var target = details.target;
var target = details.target;
var selector = typeof target === 'string' ? target : 'td, th';
if ( target !== undefined || target !== null ) {
if (target !== undefined || target !== null) {
// Click handler to show / hide the details rows when they are available
$( dt.table().body() )
.on( 'click.dtr mousedown.dtr mouseup.dtr', selector, function (e) {
// If the table is not collapsed (i.e. there is no hidden columns)
// then take no action
if ( ! $(dt.table().node()).hasClass('collapsed' ) ) {
return;
}
$(dt.table().body()).on('click.dtr mousedown.dtr mouseup.dtr', selector, function (e) {
// If the table is not collapsed (i.e. there is no hidden columns)
// then take no action
if (!$(dt.table().node()).hasClass('collapsed')) {
return;
}
// Check that the row is actually a DataTable's controlled node
if ( $.inArray( $(this).closest('tr').get(0), dt.rows().nodes().toArray() ) === -1 ) {
return;
}
// Check that the row is actually a DataTable's controlled node
if ($.inArray($(this).closest('tr').get(0), dt.rows().nodes().toArray()) === -1) {
return;
}
// For column index, we determine if we should act or not in the
// handler - otherwise it is already okay
if ( typeof target === 'number' ) {
var targetIdx = target < 0 ?
dt.columns().eq(0).length + target :
target;
// For column index, we determine if we should act or not in the
// handler - otherwise it is already okay
if (typeof target === 'number') {
var targetIdx = target < 0 ? dt.columns().eq(0).length + target : target;
if ( dt.cell( this ).index().column !== targetIdx ) {
return;
}
if (dt.cell(this).index().column !== targetIdx) {
return;
}
}
// $().closest() includes itself in its check
var row = dt.row( $(this).closest('tr') );
// $().closest() includes itself in its check
var row = dt.row($(this).closest('tr'));
// Check event type to do an action
if ( e.type === 'click' ) {
// The renderer is given as a function so the caller can execute it
// only when they need (i.e. if hiding there is no point is running
// the renderer)
that._detailsDisplay( row, false );
}
else if ( e.type === 'mousedown' ) {
// For mouse users, prevent the focus ring from showing
$(this).css('outline', 'none');
}
else if ( e.type === 'mouseup' ) {
// And then re-allow at the end of the click
$(this).trigger('blur').css('outline', '');
}
} );
// Check event type to do an action
if (e.type === 'click') {
// The renderer is given as a function so the caller can execute it
// only when they need (i.e. if hiding there is no point is running
// the renderer)
that._detailsDisplay(row, false);
}
else if (e.type === 'mousedown') {
// For mouse users, prevent the focus ring from showing
$(this).css('outline', 'none');
}
else if (e.type === 'mouseup') {
// And then re-allow at the end of the click
$(this).trigger('blur').css('outline', '');
}
});
}
},
/**

@@ -860,29 +863,25 @@ * Get the details to pass to a renderer for a row

*/
_detailsObj: function ( rowIdx )
{
_detailsObj: function (rowIdx) {
var that = this;
var dt = this.s.dt;
return $.map( this.s.columns, function( col, i ) {
return $.map(this.s.columns, function (col, i) {
// Never and control columns should not be passed to the renderer
if ( col.never || col.control ) {
if (col.never || col.control) {
return;
}
var dtCol = dt.settings()[0].aoColumns[ i ];
var dtCol = dt.settings()[0].aoColumns[i];
return {
className: dtCol.sClass,
className: dtCol.sClass,
columnIndex: i,
data: dt.cell( rowIdx, i ).render( that.c.orthogonal ),
hidden: dt.column( i ).visible() && !that.s.current[ i ],
rowIndex: rowIdx,
title: dtCol.sTitle !== null ?
dtCol.sTitle :
$(dt.column(i).header()).text()
data: dt.cell(rowIdx, i).render(that.c.orthogonal),
hidden: dt.column(i).visible() && !that.s.current[i],
rowIndex: rowIdx,
title: dtCol.sTitle !== null ? dtCol.sTitle : $(dt.column(i).header()).text()
};
} );
});
},
/**

@@ -895,8 +894,7 @@ * Find a breakpoint object from a name

*/
_find: function ( name )
{
_find: function (name) {
var breakpoints = this.c.breakpoints;
for ( var i=0, ien=breakpoints.length ; i<ien ; i++ ) {
if ( breakpoints[i].name === name ) {
for (var i = 0, ien = breakpoints.length; i < ien; i++) {
if (breakpoints[i].name === name) {
return breakpoints[i];

@@ -907,3 +905,2 @@ }

/**

@@ -915,15 +912,11 @@ * Re-create the contents of the child rows as the display has changed in

*/
_redrawChildren: function ()
{
_redrawChildren: function () {
var that = this;
var dt = this.s.dt;
dt.rows( {page: 'current'} ).iterator( 'row', function ( settings, idx ) {
var row = dt.row( idx );
that._detailsDisplay( dt.row( idx ), true );
} );
dt.rows({ page: 'current' }).iterator('row', function (settings, idx) {
that._detailsDisplay(dt.row(idx), true);
});
},
/**

@@ -937,4 +930,3 @@ * Alter the table display for a resized viewport. This involves first

*/
_resize: function (forceRedraw)
{
_resize: function (forceRedraw) {
var that = this;

@@ -950,4 +942,4 @@ var dt = this.s.dt;

// Determine what breakpoint we are currently at
for ( i=breakpoints.length-1 ; i>=0 ; i-- ) {
if ( width <= breakpoints[i].width ) {
for (i = breakpoints.length - 1; i >= 0; i--) {
if (width <= breakpoints[i].width) {
breakpoint = breakpoints[i].name;

@@ -957,5 +949,5 @@ break;

}
// Show the columns for that break point
var columnsVis = this._columnsVisiblity( breakpoint );
var columnsVis = this._columnsVisiblity(breakpoint);
this.s.current = columnsVis;

@@ -967,5 +959,10 @@

var collapsedClass = false;
for ( i=0, ien=columns.length ; i<ien ; i++ ) {
if ( columnsVis[i] === false && ! columns[i].never && ! columns[i].control && ! dt.column(i).visible() === false ) {
for (i = 0, ien = columns.length; i < ien; i++) {
if (
columnsVis[i] === false &&
!columns[i].never &&
!columns[i].control &&
!dt.column(i).visible() === false
) {
collapsedClass = true;

@@ -976,3 +973,3 @@ break;

$( dt.table().node() ).toggleClass( 'collapsed', collapsedClass );
$(dt.table().node()).toggleClass('collapsed', collapsedClass);

@@ -982,12 +979,14 @@ var changed = false;

dt.columns().eq(0).each( function ( colIdx, i ) {
if ( columnsVis[i] === true ) {
visible++;
}
dt.columns()
.eq(0)
.each(function (colIdx, i) {
if (columnsVis[i] === true) {
visible++;
}
if ( forceRedraw || columnsVis[i] !== oldVis[i] ) {
changed = true;
that._setColumnVis( colIdx, columnsVis[i] );
}
} );
if (forceRedraw || columnsVis[i] !== oldVis[i]) {
changed = true;
that._setColumnVis(colIdx, columnsVis[i]);
}
});

@@ -998,8 +997,8 @@ // Always need to update the display, regardless of if it has changed or not, so nodes

if ( changed ) {
if (changed) {
// Inform listeners of the change
$(dt.table().node()).trigger( 'responsive-resize.dt', [dt, this.s.current] );
$(dt.table().node()).trigger('responsive-resize.dt', [dt, this.s.current]);
// If no records, update the "No records" display element
if ( dt.page.info().recordsDisplay === 0 ) {
if (dt.page.info().recordsDisplay === 0) {
$('td', dt.table().body()).eq(0).attr('colspan', visible);

@@ -1012,3 +1011,2 @@ }

/**

@@ -1022,4 +1020,3 @@ * Determine the width of each column in the table so the auto column hiding

*/
_resizeAuto: function ()
{
_resizeAuto: function () {
var dt = this.s.dt;

@@ -1030,3 +1027,3 @@ var columns = this.s.columns;

// Are we allowed to do auto sizing?
if ( ! this.c.auto ) {
if (!this.c.auto) {
return;

@@ -1037,3 +1034,10 @@ }

// have classes defined
if ( $.inArray( true, $.map( columns, function (c) { return c.auto; } ) ) === -1 ) {
if (
$.inArray(
true,
$.map(columns, function (c) {
return c.auto;
})
) === -1
) {
return;

@@ -1043,16 +1047,16 @@ }

// Need to restore all children. They will be reinstated by a re-render
if ( ! $.isEmptyObject( this.s.childNodeStore ) ) {
$.each( this.s.childNodeStore, function ( key ) {
if (!$.isEmptyObject(this.s.childNodeStore)) {
$.each(this.s.childNodeStore, function (key) {
var idx = key.split('-');
that._childNodesRestore( dt, idx[0]*1, idx[1]*1 );
} );
that._childNodesRestore(dt, idx[0] * 1, idx[1] * 1);
});
}
// Clone the table with the current data in it
var tableWidth = dt.table().node().offsetWidth;
var tableWidth = dt.table().node().offsetWidth;
var columnWidths = dt.columns;
var clonedTable = dt.table().node().cloneNode( false );
var clonedHeader = $( dt.table().header().cloneNode( false ) ).appendTo( clonedTable );
var clonedBody = $( dt.table().body() ).clone( false, false ).empty().appendTo( clonedTable ); // use jQuery because of IE8
var clonedTable = dt.table().node().cloneNode(false);
var clonedHeader = $(dt.table().header().cloneNode(false)).appendTo(clonedTable);
var clonedBody = $(dt.table().body()).clone(false, false).empty().appendTo(clonedTable); // use jQuery because of IE8

@@ -1062,12 +1066,13 @@ clonedTable.style.width = 'auto';

// Header
var headerCells = dt.columns()
var headerCells = dt
.columns()
.header()
.filter( function (idx) {
.filter(function (idx) {
return dt.column(idx).visible();
} )
})
.to$()
.clone( false )
.css( 'display', 'table-cell' )
.css( 'width', 'auto' )
.css( 'min-width', 0 );
.clone(false)
.css('display', 'table-cell')
.css('width', 'auto')
.css('min-width', 0);

@@ -1077,26 +1082,24 @@ // Body rows - we don't need to take account of DataTables' column

$(clonedBody)
.append( $(dt.rows( { page: 'current' } ).nodes()).clone( false ) )
.find( 'th, td' ).css( 'display', '' );
.append($(dt.rows({ page: 'current' }).nodes()).clone(false))
.find('th, td')
.css('display', '');
// Footer
var footer = dt.table().footer();
if ( footer ) {
var clonedFooter = $( footer.cloneNode( false ) ).appendTo( clonedTable );
var footerCells = dt.columns()
if (footer) {
var clonedFooter = $(footer.cloneNode(false)).appendTo(clonedTable);
var footerCells = dt
.columns()
.footer()
.filter( function (idx) {
.filter(function (idx) {
return dt.column(idx).visible();
} )
})
.to$()
.clone( false )
.css( 'display', 'table-cell' );
.clone(false)
.css('display', 'table-cell');
$('<tr/>')
.append( footerCells )
.appendTo( clonedFooter );
$('<tr/>').append(footerCells).appendTo(clonedFooter);
}
$('<tr/>')
.append( headerCells )
.appendTo( clonedHeader );
$('<tr/>').append(headerCells).appendTo(clonedHeader);

@@ -1106,17 +1109,17 @@ // In the inline case extra padding is applied to the first column to

// calculation
if ( this.c.details.type === 'inline' ) {
$(clonedTable).addClass( 'dtr-inline collapsed' );
if (this.c.details.type === 'inline') {
$(clonedTable).addClass('dtr-inline collapsed');
}
// It is unsafe to insert elements with the same name into the DOM
// multiple times. For example, cloning and inserting a checked radio
// clears the chcecked state of the original radio.
$( clonedTable ).find( '[name]' ).removeAttr( 'name' );
$(clonedTable).find('[name]').removeAttr('name');
// A position absolute table would take the table out of the flow of
// our container element, bypassing the height and width (Scroller)
$( clonedTable ).css( 'position', 'relative' )
$(clonedTable).css('position', 'relative');
var inserted = $('<div/>')
.css( {
.css({
width: 1,

@@ -1126,12 +1129,12 @@ height: 1,

clear: 'both'
} )
.append( clonedTable );
})
.append(clonedTable);
inserted.insertBefore( dt.table().node() );
inserted.insertBefore(dt.table().node());
// The cloned header now contains the smallest that each column can be
headerCells.each( function (i) {
var idx = dt.column.index( 'fromVisible', i );
columns[ idx ].minWidth = this.offsetWidth || 0;
} );
headerCells.each(function (i) {
var idx = dt.column.index('fromVisible', i);
columns[idx].minWidth = this.offsetWidth || 0;
});

@@ -1144,14 +1147,13 @@ inserted.remove();

*/
_responsiveOnlyHidden: function ()
{
_responsiveOnlyHidden: function () {
var dt = this.s.dt;
return $.map( this.s.current, function (v, i) {
return $.map(this.s.current, function (v, i) {
// If the column is hidden by DataTables then it can't be hidden by
// Responsive!
if ( dt.column(i).visible() === false ) {
if (dt.column(i).visible() === false) {
return true;
}
return v;
} );
});
},

@@ -1171,4 +1173,3 @@

*/
_setColumnVis: function ( col, showHide )
{
_setColumnVis: function (col, showHide) {
var that = this;

@@ -1178,23 +1179,18 @@ var dt = this.s.dt;

$( dt.column( col ).header() )
.css( 'display', display )
.toggleClass('dtr-hidden', !showHide);
$(dt.column(col).header()).css('display', display).toggleClass('dtr-hidden', !showHide);
$( dt.column( col ).footer() )
.css( 'display', display )
.toggleClass('dtr-hidden', !showHide);
$(dt.column(col).footer()).css('display', display).toggleClass('dtr-hidden', !showHide);
dt.column( col ).nodes().to$()
.css( 'display', display )
.toggleClass('dtr-hidden', !showHide);
dt.column(col).nodes().to$().css('display', display).toggleClass('dtr-hidden', !showHide);
// If the are child nodes stored, we might need to reinsert them
if ( ! $.isEmptyObject( this.s.childNodeStore ) ) {
dt.cells( null, col ).indexes().each( function (idx) {
that._childNodesRestore( dt, idx.row, idx.column );
} );
if (!$.isEmptyObject(this.s.childNodeStore)) {
dt.cells(null, col)
.indexes()
.each(function (idx) {
that._childNodesRestore(dt, idx.row, idx.column);
});
}
},
/**

@@ -1209,15 +1205,16 @@ * Update the cell tab indexes for keyboard accessibility. This is called on

*/
_tabIndexes: function ()
{
_tabIndexes: function () {
var dt = this.s.dt;
var cells = dt.cells( { page: 'current' } ).nodes().to$();
var cells = dt.cells({ page: 'current' }).nodes().to$();
var ctx = dt.settings()[0];
var target = this.c.details.target;
cells.filter( '[data-dtr-keyboard]' ).removeData( '[data-dtr-keyboard]' );
cells.filter('[data-dtr-keyboard]').removeData('[data-dtr-keyboard]');
if ( typeof target === 'number' ) {
dt.cells( null, target, { page: 'current' } ).nodes().to$()
.attr( 'tabIndex', ctx.iTabIndex )
.data( 'dtr-keyboard', 1 );
if (typeof target === 'number') {
dt.cells(null, target, { page: 'current' })
.nodes()
.to$()
.attr('tabIndex', ctx.iTabIndex)
.data('dtr-keyboard', 1);
}

@@ -1227,14 +1224,13 @@ else {

// those of this table
if ( target === 'td:first-child, th:first-child' ) {
if (target === 'td:first-child, th:first-child') {
target = '>td:first-child, >th:first-child';
}
$( target, dt.rows( { page: 'current' } ).nodes() )
.attr( 'tabIndex', ctx.iTabIndex )
.data( 'dtr-keyboard', 1 );
$(target, dt.rows({ page: 'current' }).nodes())
.attr('tabIndex', ctx.iTabIndex)
.data('dtr-keyboard', 1);
}
}
} );
});
/**

@@ -1251,3 +1247,3 @@ * List of default breakpoints. Each item in the array is an object with two

Responsive.breakpoints = [
{ name: 'desktop', width: Infinity },
{ name: 'desktop', width: Infinity },
{ name: 'tablet-l', width: 1024 },

@@ -1259,3 +1255,2 @@ { name: 'tablet-p', width: 768 },

/**

@@ -1270,6 +1265,6 @@ * Display methods - functions which define how the hidden data should be shown

Responsive.display = {
childRow: function ( row, update, render ) {
if ( update ) {
if ( $(row.node()).hasClass('parent') ) {
row.child( render(), 'child' ).show();
childRow: function (row, update, render) {
if (update) {
if ($(row.node()).hasClass('parent')) {
row.child(render(), 'child').show();

@@ -1280,5 +1275,4 @@ return true;

else {
if ( ! row.child.isShown() ) {
row.child( render(), 'child' ).show();
$( row.node() ).addClass( 'parent' );
if (!row.child.isShown()) {
row.child(render(), 'child').show();

@@ -1288,4 +1282,3 @@ return true;

else {
row.child( false );
$( row.node() ).removeClass( 'parent' );
row.child(false);

@@ -1297,7 +1290,6 @@ return false;

childRowImmediate: function ( row, update, render ) {
if ( (! update && row.child.isShown()) || ! row.responsive.hasHidden() ) {
childRowImmediate: function (row, update, render) {
if ((!update && row.child.isShown()) || !row.responsive.hasHidden()) {
// User interaction and the row is show, or nothing to show
row.child( false );
$( row.node() ).removeClass( 'parent' );
row.child(false);

@@ -1308,4 +1300,3 @@ return false;

// Display
row.child( render(), 'child' ).show();
$( row.node() ).addClass( 'parent' );
row.child(render(), 'child').show();

@@ -1319,31 +1310,39 @@ return true;

// function but it is for consistency in the `modal` name
modal: function ( options ) {
return function ( row, update, render ) {
if ( ! update ) {
modal: function (options) {
return function (row, update, render, closeCallback) {
if (!update) {
// Show a modal
var close = function () {
modal.remove(); // will tidy events for us
$(document).off( 'keypress.dtr' );
$(document).off('keypress.dtr');
$(row.node()).removeClass('parent');
closeCallback();
};
var modal = $('<div class="dtr-modal"/>')
.append( $('<div class="dtr-modal-display"/>')
.append( $('<div class="dtr-modal-content"/>')
.append( render() )
)
.append( $('<div class="dtr-modal-close">&times;</div>' )
.click( function () {
close();
} )
)
.append(
$('<div class="dtr-modal-display"/>')
.append(
$('<div class="dtr-modal-content"/>')
.data('dtr-row-idx', row.index())
.append(render())
)
.append(
$('<div class="dtr-modal-close">&times;</div>').click(function () {
close();
})
)
)
.append( $('<div class="dtr-modal-background"/>')
.click( function () {
.append(
$('<div class="dtr-modal-background"/>').click(function () {
close();
} )
})
)
.appendTo( 'body' );
.appendTo('body');
$(document).on( 'keyup.dtr', function (e) {
if ( e.keyCode === 27 ) {
$(row.node()).addClass('parent');
$(document).on('keyup.dtr', function (e) {
if (e.keyCode === 27) {
e.stopPropagation();

@@ -1353,15 +1352,21 @@

}
} );
});
}
else {
$('div.dtr-modal-content')
.empty()
.append( render() );
var modal = $('div.dtr-modal-content');
if (modal.length && row.index() === modal.data('dtr-row-idx')) {
modal.empty().append(render());
}
else {
// Modal not shown, nothing to update
return null;
}
}
if ( options && options.header ) {
$('div.dtr-modal-content').prepend(
'<h2>'+options.header( row )+'</h2>'
);
if (options && options.header) {
$('div.dtr-modal-content').prepend('<h2>' + options.header(row) + '</h2>');
}
return true;
};

@@ -1371,3 +1376,2 @@ }

/**

@@ -1383,30 +1387,38 @@ * Display methods - functions which define how the hidden data should be shown

listHiddenNodes: function () {
return function ( api, rowIdx, columns ) {
return function (api, rowIdx, columns) {
var that = this;
var ul = $('<ul data-dtr-index="'+rowIdx+'" class="dtr-details"/>');
var ul = $('<ul data-dtr-index="' + rowIdx + '" class="dtr-details"/>');
var found = false;
var data = $.each( columns, function ( i, col ) {
if ( col.hidden ) {
var klass = col.className ?
'class="'+ col.className +'"' :
'';
var data = $.each(columns, function (i, col) {
if (col.hidden) {
var klass = col.className ? 'class="' + col.className + '"' : '';
$(
'<li '+klass+' data-dtr-index="'+col.columnIndex+'" data-dt-row="'+col.rowIndex+'" data-dt-column="'+col.columnIndex+'">'+
'<span class="dtr-title">'+
col.title+
'</span> '+
'</li>'
'<li ' +
klass +
' data-dtr-index="' +
col.columnIndex +
'" data-dt-row="' +
col.rowIndex +
'" data-dt-column="' +
col.columnIndex +
'">' +
'<span class="dtr-title">' +
col.title +
'</span> ' +
'</li>'
)
.append( $('<span class="dtr-data"/>').append( that._childNodes( api, col.rowIndex, col.columnIndex ) ) )// api.cell( col.rowIndex, col.columnIndex ).node().childNodes ) )
.appendTo( ul );
.append(
$('<span class="dtr-data"/>').append(
that._childNodes(api, col.rowIndex, col.columnIndex)
)
) // api.cell( col.rowIndex, col.columnIndex ).node().childNodes ) )
.appendTo(ul);
found = true;
}
} );
});
return found ?
ul :
false;
return found ? ul : false;
};

@@ -1416,45 +1428,67 @@ },

listHidden: function () {
return function ( api, rowIdx, columns ) {
var data = $.map( columns, function ( col ) {
var klass = col.className ?
'class="'+ col.className +'"' :
'';
return function (api, rowIdx, columns) {
var data = $.map(columns, function (col) {
var klass = col.className ? 'class="' + col.className + '"' : '';
return col.hidden ?
'<li '+klass+' data-dtr-index="'+col.columnIndex+'" data-dt-row="'+col.rowIndex+'" data-dt-column="'+col.columnIndex+'">'+
'<span class="dtr-title">'+
col.title+
'</span> '+
'<span class="dtr-data">'+
col.data+
'</span>'+
'</li>' :
'';
} ).join('');
return col.hidden
? '<li ' +
klass +
' data-dtr-index="' +
col.columnIndex +
'" data-dt-row="' +
col.rowIndex +
'" data-dt-column="' +
col.columnIndex +
'">' +
'<span class="dtr-title">' +
col.title +
'</span> ' +
'<span class="dtr-data">' +
col.data +
'</span>' +
'</li>'
: '';
}).join('');
return data ?
$('<ul data-dtr-index="'+rowIdx+'" class="dtr-details"/>').append( data ) :
false;
}
return data
? $('<ul data-dtr-index="' + rowIdx + '" class="dtr-details"/>').append(data)
: false;
};
},
tableAll: function ( options ) {
options = $.extend( {
tableClass: ''
}, options );
tableAll: function (options) {
options = $.extend(
{
tableClass: ''
},
options
);
return function ( api, rowIdx, columns ) {
var data = $.map( columns, function ( col ) {
var klass = col.className ?
'class="'+ col.className +'"' :
'';
return function (api, rowIdx, columns) {
var data = $.map(columns, function (col) {
var klass = col.className ? 'class="' + col.className + '"' : '';
return '<tr '+klass+' data-dt-row="'+col.rowIndex+'" data-dt-column="'+col.columnIndex+'">'+
'<td>'+col.title+':'+'</td> '+
'<td>'+col.data+'</td>'+
'</tr>';
} ).join('');
return (
'<tr ' +
klass +
' data-dt-row="' +
col.rowIndex +
'" data-dt-column="' +
col.columnIndex +
'">' +
'<td>' +
col.title +
':' +
'</td> ' +
'<td>' +
col.data +
'</td>' +
'</tr>'
);
}).join('');
return $('<table class="'+options.tableClass+' dtr-details" width="100%"/>').append( data );
}
return $('<table class="' + options.tableClass + ' dtr-details" width="100%"/>').append(
data
);
};
}

@@ -1527,3 +1561,2 @@ };

/*

@@ -1535,7 +1568,7 @@ * API

// Doesn't do anything - work around for a bug in DT... Not documented
Api.register( 'responsive()', function () {
Api.register('responsive()', function () {
return this;
} );
});
Api.register( 'responsive.index()', function ( li ) {
Api.register('responsive.index()', function (li) {
li = $(li);

@@ -1545,40 +1578,43 @@

column: li.data('dtr-index'),
row: li.parent().data('dtr-index')
row: li.parent().data('dtr-index')
};
} );
});
Api.register( 'responsive.rebuild()', function () {
return this.iterator( 'table', function ( ctx ) {
if ( ctx._responsive ) {
Api.register('responsive.rebuild()', function () {
return this.iterator('table', function (ctx) {
if (ctx._responsive) {
ctx._responsive._classLogic();
}
} );
} );
});
});
Api.register( 'responsive.recalc()', function () {
return this.iterator( 'table', function ( ctx ) {
if ( ctx._responsive ) {
Api.register('responsive.recalc()', function () {
return this.iterator('table', function (ctx) {
if (ctx._responsive) {
ctx._responsive._resizeAuto();
ctx._responsive._resize();
}
} );
} );
});
});
Api.register( 'responsive.hasHidden()', function () {
Api.register('responsive.hasHidden()', function () {
var ctx = this.context[0];
return ctx._responsive ?
$.inArray( false, ctx._responsive._responsiveOnlyHidden() ) !== -1 :
false;
} );
return ctx._responsive
? $.inArray(false, ctx._responsive._responsiveOnlyHidden()) !== -1
: false;
});
Api.registerPlural( 'columns().responsiveHidden()', 'column().responsiveHidden()', function () {
return this.iterator( 'column', function ( settings, column ) {
return settings._responsive ?
settings._responsive._responsiveOnlyHidden()[ column ] :
false;
}, 1 );
} );
Api.registerPlural('columns().responsiveHidden()', 'column().responsiveHidden()', function () {
return this.iterator(
'column',
function (settings, column) {
return settings._responsive
? settings._responsive._responsiveOnlyHidden()[column]
: false;
},
1
);
});
/**

@@ -1590,5 +1626,4 @@ * Version information

*/
Responsive.version = '2.4.1';
Responsive.version = '2.5.0';
$.fn.dataTable.Responsive = Responsive;

@@ -1599,19 +1634,20 @@ $.fn.DataTable.Responsive = Responsive;

// events so we can automatically initialise
$(document).on( 'preInit.dt.dtr', function (e, settings, json) {
if ( e.namespace !== 'dt' ) {
$(document).on('preInit.dt.dtr', function (e, settings, json) {
if (e.namespace !== 'dt') {
return;
}
if ( $(settings.nTable).hasClass( 'responsive' ) ||
$(settings.nTable).hasClass( 'dt-responsive' ) ||
settings.oInit.responsive ||
DataTable.defaults.responsive
if (
$(settings.nTable).hasClass('responsive') ||
$(settings.nTable).hasClass('dt-responsive') ||
settings.oInit.responsive ||
DataTable.defaults.responsive
) {
var init = settings.oInit.responsive;
if ( init !== false ) {
new Responsive( settings, $.isPlainObject( init ) ? init : {} );
if (init !== false) {
new Responsive(settings, $.isPlainObject(init) ? init : {});
}
}
} );
});

@@ -1618,0 +1654,0 @@

@@ -1,4 +0,4 @@

/*! Responsive 2.4.1
/*! Responsive 2.5.0
* © SpryMedia Ltd - datatables.net/license
*/
!function(n){var i,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?(i=require("jquery"),r=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"!=typeof window?module.exports=function(e,t){return e=e||window,t=t||i(e),r(e,t),n(t,e,e.document)}:(r(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(f,m,o,h){"use strict";function d(e,t){if(!r.versionCheck||!r.versionCheck("1.10.10"))throw"DataTables Responsive requires DataTables 1.10.10 or newer";this.s={childNodeStore:{},columns:[],current:[],dt:new r.Api(e)},this.s.dt.settings()[0].responsive||(t&&"string"==typeof t.details?t.details={type:t.details}:t&&!1===t.details?t.details={type:!1}:t&&!0===t.details&&(t.details={type:"inline"}),this.c=f.extend(!0,{},d.defaults,r.defaults.responsive,t),(e.responsive=this)._constructor())}var r=f.fn.dataTable,e=(f.extend(d.prototype,{_constructor:function(){var s=this,i=this.s.dt,e=i.settings()[0],t=f(m).innerWidth(),e=(i.settings()[0]._responsive=this,f(m).on("resize.dtr orientationchange.dtr",r.util.throttle(function(){var e=f(m).innerWidth();e!==t&&(s._resize(),t=e)})),e.oApi._fnCallbackReg(e,"aoRowCreatedCallback",function(e,t,n){-1!==f.inArray(!1,s.s.current)&&f(">td, >th",e).each(function(e){e=i.column.index("toData",e);!1===s.s.current[e]&&f(this).css("display","none")})}),i.on("destroy.dtr",function(){i.off(".dtr"),f(i.table().body()).off(".dtr"),f(m).off("resize.dtr orientationchange.dtr"),i.cells(".dtr-control").nodes().to$().removeClass("dtr-control"),f.each(s.s.current,function(e,t){!1===t&&s._setColumnVis(e,!0)})}),this.c.breakpoints.sort(function(e,t){return e.width<t.width?1:e.width>t.width?-1:0}),this._classLogic(),this._resizeAuto(),this.c.details);!1!==e.type&&(s._detailsInit(),i.on("column-visibility.dtr",function(){s._timer&&clearTimeout(s._timer),s._timer=setTimeout(function(){s._timer=null,s._classLogic(),s._resizeAuto(),s._resize(!0),s._redrawChildren()},100)}),i.on("draw.dtr",function(){s._redrawChildren()}),f(i.table().node()).addClass("dtr-"+e.type)),i.on("column-reorder.dtr",function(e,t,n){s._classLogic(),s._resizeAuto(),s._resize(!0)}),i.on("column-sizing.dtr",function(){s._resizeAuto(),s._resize()}),i.on("column-calc.dt",function(e,t){for(var n=s.s.current,i=0;i<n.length;i++){var r=t.visible.indexOf(i);!1===n[i]&&0<=r&&t.visible.splice(r,1)}}),i.on("preXhr.dtr",function(){var e=[];i.rows().every(function(){this.child.isShown()&&e.push(this.id(!0))}),i.one("draw.dtr",function(){s._resizeAuto(),s._resize(),i.rows(e).every(function(){s._detailsDisplay(this,!1)})})}),i.on("draw.dtr",function(){s._controlClass()}).on("init.dtr",function(e,t,n){"dt"===e.namespace&&(s._resizeAuto(),s._resize(),f.inArray(!1,s.s.current)&&i.columns.adjust())}),this._resize()},_childNodes:function(e,t,n){var i=t+"-"+n;if(this.s.childNodeStore[i])return this.s.childNodeStore[i];for(var r=[],s=e.cell(t,n).node().childNodes,o=0,d=s.length;o<d;o++)r.push(s[o]);return this.s.childNodeStore[i]=r},_childNodesRestore:function(e,t,n){var i=t+"-"+n;if(this.s.childNodeStore[i]){for(var r=e.cell(t,n).node(),s=this.s.childNodeStore[i][0].parentNode.childNodes,o=[],d=0,a=s.length;d<a;d++)o.push(s[d]);for(var l=0,c=o.length;l<c;l++)r.appendChild(o[l]);this.s.childNodeStore[i]=h}},_columnsVisiblity:function(n){for(var i=this.s.dt,e=this.s.columns,t=e.map(function(e,t){return{columnIdx:t,priority:e.priority}}).sort(function(e,t){return e.priority!==t.priority?e.priority-t.priority:e.columnIdx-t.columnIdx}),r=f.map(e,function(e,t){return!1===i.column(t).visible()?"not-visible":(!e.auto||null!==e.minWidth)&&(!0===e.auto?"-":-1!==f.inArray(n,e.includeIn))}),s=0,o=0,d=r.length;o<d;o++)!0===r[o]&&(s+=e[o].minWidth);var a=i.settings()[0].oScroll,a=a.sY||a.sX?a.iBarWidth:0,l=i.table().container().offsetWidth-a-s;for(o=0,d=r.length;o<d;o++)e[o].control&&(l-=e[o].minWidth);var c=!1;for(o=0,d=t.length;o<d;o++){var u=t[o].columnIdx;"-"===r[u]&&!e[u].control&&e[u].minWidth&&(c||l-e[u].minWidth<0?r[u]=!(c=!0):r[u]=!0,l-=e[u].minWidth)}var h=!1;for(o=0,d=e.length;o<d;o++)if(!e[o].control&&!e[o].never&&!1===r[o]){h=!0;break}for(o=0,d=e.length;o<d;o++)e[o].control&&(r[o]=h),"not-visible"===r[o]&&(r[o]=!1);return-1===f.inArray(!0,r)&&(r[0]=!0),r},_classLogic:function(){function d(e,t,n,i){var r,s,o;if(n){if("max-"===n)for(r=a._find(t).width,s=0,o=l.length;s<o;s++)l[s].width<=r&&u(e,l[s].name);else if("min-"===n)for(r=a._find(t).width,s=0,o=l.length;s<o;s++)l[s].width>=r&&u(e,l[s].name);else if("not-"===n)for(s=0,o=l.length;s<o;s++)-1===l[s].name.indexOf(i)&&u(e,l[s].name)}else c[e].includeIn.push(t)}var a=this,l=this.c.breakpoints,i=this.s.dt,c=i.columns().eq(0).map(function(e){var t=this.column(e),n=t.header().className,e=i.settings()[0].aoColumns[e].responsivePriority,t=t.header().getAttribute("data-priority");return e===h&&(e=t===h||null===t?1e4:+t),{className:n,includeIn:[],auto:!1,control:!1,never:!!n.match(/\b(dtr\-)?never\b/),priority:e}}),u=function(e,t){e=c[e].includeIn;-1===f.inArray(t,e)&&e.push(t)};c.each(function(e,r){for(var t=e.className.split(" "),s=!1,n=0,i=t.length;n<i;n++){var o=t[n].trim();if("all"===o||"dtr-all"===o)return s=!0,void(e.includeIn=f.map(l,function(e){return e.name}));if("none"===o||"dtr-none"===o||e.never)return void(s=!0);if("control"===o||"dtr-control"===o)return s=!0,void(e.control=!0);f.each(l,function(e,t){var n=t.name.split("-"),i=new RegExp("(min\\-|max\\-|not\\-)?("+n[0]+")(\\-[_a-zA-Z0-9])?"),i=o.match(i);i&&(s=!0,i[2]===n[0]&&i[3]==="-"+n[1]?d(r,t.name,i[1],i[2]+i[3]):i[2]!==n[0]||i[3]||d(r,t.name,i[1],i[2]))})}s||(e.auto=!0)}),this.s.columns=c},_controlClass:function(){var e,t,n;"inline"===this.c.details.type&&(e=this.s.dt,t=this.s.current,n=f.inArray(!0,t),e.cells(null,function(e){return e!==n},{page:"current"}).nodes().to$().filter(".dtr-control").removeClass("dtr-control"),e.cells(null,n,{page:"current"}).nodes().to$().addClass("dtr-control"))},_detailsDisplay:function(e,t){var n,i=this,r=this.s.dt,s=this.c.details;s&&!1!==s.type&&(n="string"==typeof s.renderer?d.renderer[s.renderer]():s.renderer,!0!==(s=s.display(e,t,function(){return n.call(i,r,e[0],i._detailsObj(e[0]))}))&&!1!==s||f(r.table().node()).triggerHandler("responsive-display.dt",[r,e,s,t]))},_detailsInit:function(){var n=this,i=this.s.dt,e=this.c.details,r=("inline"===e.type&&(e.target="td.dtr-control, th.dtr-control"),i.on("draw.dtr",function(){n._tabIndexes()}),n._tabIndexes(),f(i.table().body()).on("keyup.dtr","td, th",function(e){13===e.keyCode&&f(this).data("dtr-keyboard")&&f(this).click()}),e.target),e="string"==typeof r?r:"td, th";r===h&&null===r||f(i.table().body()).on("click.dtr mousedown.dtr mouseup.dtr",e,function(e){if(f(i.table().node()).hasClass("collapsed")&&-1!==f.inArray(f(this).closest("tr").get(0),i.rows().nodes().toArray())){if("number"==typeof r){var t=r<0?i.columns().eq(0).length+r:r;if(i.cell(this).index().column!==t)return}t=i.row(f(this).closest("tr"));"click"===e.type?n._detailsDisplay(t,!1):"mousedown"===e.type?f(this).css("outline","none"):"mouseup"===e.type&&f(this).trigger("blur").css("outline","")}})},_detailsObj:function(n){var i=this,r=this.s.dt;return f.map(this.s.columns,function(e,t){if(!e.never&&!e.control)return{className:(e=r.settings()[0].aoColumns[t]).sClass,columnIndex:t,data:r.cell(n,t).render(i.c.orthogonal),hidden:r.column(t).visible()&&!i.s.current[t],rowIndex:n,title:null!==e.sTitle?e.sTitle:f(r.column(t).header()).text()}})},_find:function(e){for(var t=this.c.breakpoints,n=0,i=t.length;n<i;n++)if(t[n].name===e)return t[n]},_redrawChildren:function(){var n=this,i=this.s.dt;i.rows({page:"current"}).iterator("row",function(e,t){i.row(t);n._detailsDisplay(i.row(t),!0)})},_resize:function(n){for(var e,i=this,t=this.s.dt,r=f(m).innerWidth(),s=this.c.breakpoints,o=s[0].name,d=this.s.columns,a=this.s.current.slice(),l=s.length-1;0<=l;l--)if(r<=s[l].width){o=s[l].name;break}var c=this._columnsVisiblity(o),u=(this.s.current=c,!1);for(l=0,e=d.length;l<e;l++)if(!1===c[l]&&!d[l].never&&!d[l].control&&!1==!t.column(l).visible()){u=!0;break}f(t.table().node()).toggleClass("collapsed",u);var h=!1,p=0;t.columns().eq(0).each(function(e,t){!0===c[t]&&p++,!n&&c[t]===a[t]||(h=!0,i._setColumnVis(e,c[t]))}),this._redrawChildren(),h&&(f(t.table().node()).trigger("responsive-resize.dt",[t,this.s.current]),0===t.page.info().recordsDisplay&&f("td",t.table().body()).eq(0).attr("colspan",p)),i._controlClass()},_resizeAuto:function(){var e,t,n,i,r,s=this.s.dt,o=this.s.columns,d=this;this.c.auto&&-1!==f.inArray(!0,f.map(o,function(e){return e.auto}))&&(f.isEmptyObject(this.s.childNodeStore)||f.each(this.s.childNodeStore,function(e){e=e.split("-");d._childNodesRestore(s,+e[0],+e[1])}),s.table().node().offsetWidth,s.columns,e=s.table().node().cloneNode(!1),t=f(s.table().header().cloneNode(!1)).appendTo(e),i=f(s.table().body()).clone(!1,!1).empty().appendTo(e),e.style.width="auto",n=s.columns().header().filter(function(e){return s.column(e).visible()}).to$().clone(!1).css("display","table-cell").css("width","auto").css("min-width",0),f(i).append(f(s.rows({page:"current"}).nodes()).clone(!1)).find("th, td").css("display",""),(i=s.table().footer())&&(i=f(i.cloneNode(!1)).appendTo(e),r=s.columns().footer().filter(function(e){return s.column(e).visible()}).to$().clone(!1).css("display","table-cell"),f("<tr/>").append(r).appendTo(i)),f("<tr/>").append(n).appendTo(t),"inline"===this.c.details.type&&f(e).addClass("dtr-inline collapsed"),f(e).find("[name]").removeAttr("name"),f(e).css("position","relative"),(r=f("<div/>").css({width:1,height:1,overflow:"hidden",clear:"both"}).append(e)).insertBefore(s.table().node()),n.each(function(e){e=s.column.index("fromVisible",e);o[e].minWidth=this.offsetWidth||0}),r.remove())},_responsiveOnlyHidden:function(){var n=this.s.dt;return f.map(this.s.current,function(e,t){return!1===n.column(t).visible()||e})},_setColumnVis:function(e,t){var n=this,i=this.s.dt,r=t?"":"none";f(i.column(e).header()).css("display",r).toggleClass("dtr-hidden",!t),f(i.column(e).footer()).css("display",r).toggleClass("dtr-hidden",!t),i.column(e).nodes().to$().css("display",r).toggleClass("dtr-hidden",!t),f.isEmptyObject(this.s.childNodeStore)||i.cells(null,e).indexes().each(function(e){n._childNodesRestore(i,e.row,e.column)})},_tabIndexes:function(){var e=this.s.dt,t=e.cells({page:"current"}).nodes().to$(),n=e.settings()[0],i=this.c.details.target;t.filter("[data-dtr-keyboard]").removeData("[data-dtr-keyboard]"),("number"==typeof i?e.cells(null,i,{page:"current"}).nodes().to$():f(i="td:first-child, th:first-child"===i?">td:first-child, >th:first-child":i,e.rows({page:"current"}).nodes())).attr("tabIndex",n.iTabIndex).data("dtr-keyboard",1)}}),d.defaults={breakpoints:d.breakpoints=[{name:"desktop",width:1/0},{name:"tablet-l",width:1024},{name:"tablet-p",width:768},{name:"mobile-l",width:480},{name:"mobile-p",width:320}],auto:!0,details:{display:(d.display={childRow:function(e,t,n){return t?f(e.node()).hasClass("parent")?(e.child(n(),"child").show(),!0):void 0:e.child.isShown()?(e.child(!1),f(e.node()).removeClass("parent"),!1):(e.child(n(),"child").show(),f(e.node()).addClass("parent"),!0)},childRowImmediate:function(e,t,n){return!t&&e.child.isShown()||!e.responsive.hasHidden()?(e.child(!1),f(e.node()).removeClass("parent"),!1):(e.child(n(),"child").show(),f(e.node()).addClass("parent"),!0)},modal:function(s){return function(e,t,n){var i,r;t?f("div.dtr-modal-content").empty().append(n()):(i=function(){r.remove(),f(o).off("keypress.dtr")},r=f('<div class="dtr-modal"/>').append(f('<div class="dtr-modal-display"/>').append(f('<div class="dtr-modal-content"/>').append(n())).append(f('<div class="dtr-modal-close">&times;</div>').click(function(){i()}))).append(f('<div class="dtr-modal-background"/>').click(function(){i()})).appendTo("body"),f(o).on("keyup.dtr",function(e){27===e.keyCode&&(e.stopPropagation(),i())})),s&&s.header&&f("div.dtr-modal-content").prepend("<h2>"+s.header(e)+"</h2>")}}}).childRow,renderer:(d.renderer={listHiddenNodes:function(){return function(i,e,t){var r=this,s=f('<ul data-dtr-index="'+e+'" class="dtr-details"/>'),o=!1;f.each(t,function(e,t){var n;t.hidden&&(n=t.className?'class="'+t.className+'"':"",f("<li "+n+' data-dtr-index="'+t.columnIndex+'" data-dt-row="'+t.rowIndex+'" data-dt-column="'+t.columnIndex+'"><span class="dtr-title">'+t.title+"</span> </li>").append(f('<span class="dtr-data"/>').append(r._childNodes(i,t.rowIndex,t.columnIndex))).appendTo(s),o=!0)});return!!o&&s}},listHidden:function(){return function(e,t,n){n=f.map(n,function(e){var t=e.className?'class="'+e.className+'"':"";return e.hidden?"<li "+t+' data-dtr-index="'+e.columnIndex+'" data-dt-row="'+e.rowIndex+'" data-dt-column="'+e.columnIndex+'"><span class="dtr-title">'+e.title+'</span> <span class="dtr-data">'+e.data+"</span></li>":""}).join("");return!!n&&f('<ul data-dtr-index="'+t+'" class="dtr-details"/>').append(n)}},tableAll:function(i){return i=f.extend({tableClass:""},i),function(e,t,n){n=f.map(n,function(e){return"<tr "+(e.className?'class="'+e.className+'"':"")+' data-dt-row="'+e.rowIndex+'" data-dt-column="'+e.columnIndex+'"><td>'+e.title+":</td> <td>"+e.data+"</td></tr>"}).join("");return f('<table class="'+i.tableClass+' dtr-details" width="100%"/>').append(n)}}}).listHidden(),target:0,type:"inline"},orthogonal:"display"},f.fn.dataTable.Api);return e.register("responsive()",function(){return this}),e.register("responsive.index()",function(e){return{column:(e=f(e)).data("dtr-index"),row:e.parent().data("dtr-index")}}),e.register("responsive.rebuild()",function(){return this.iterator("table",function(e){e._responsive&&e._responsive._classLogic()})}),e.register("responsive.recalc()",function(){return this.iterator("table",function(e){e._responsive&&(e._responsive._resizeAuto(),e._responsive._resize())})}),e.register("responsive.hasHidden()",function(){var e=this.context[0];return!!e._responsive&&-1!==f.inArray(!1,e._responsive._responsiveOnlyHidden())}),e.registerPlural("columns().responsiveHidden()","column().responsiveHidden()",function(){return this.iterator("column",function(e,t){return!!e._responsive&&e._responsive._responsiveOnlyHidden()[t]},1)}),d.version="2.4.1",f.fn.dataTable.Responsive=d,f.fn.DataTable.Responsive=d,f(o).on("preInit.dt.dtr",function(e,t,n){"dt"===e.namespace&&(f(t.nTable).hasClass("responsive")||f(t.nTable).hasClass("dt-responsive")||t.oInit.responsive||r.defaults.responsive)&&!1!==(e=t.oInit.responsive)&&new d(t,f.isPlainObject(e)?e:{})}),r});
!function(n){var i,r;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return n(e,window,document)}):"object"==typeof exports?(i=require("jquery"),r=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||i(e),r(e,t),n(t,e,e.document)}:(r(window,i),module.exports=n(i,window,window.document))):n(jQuery,window,document)}(function(f,m,d,h){"use strict";function a(e,t){if(!r.versionCheck||!r.versionCheck("1.10.10"))throw"DataTables Responsive requires DataTables 1.10.10 or newer";this.s={childNodeStore:{},columns:[],current:[],dt:new r.Api(e)},this.s.dt.settings()[0].responsive||(t&&"string"==typeof t.details?t.details={type:t.details}:t&&!1===t.details?t.details={type:!1}:t&&!0===t.details&&(t.details={type:"inline"}),this.c=f.extend(!0,{},a.defaults,r.defaults.responsive,t),(e.responsive=this)._constructor())}var r=f.fn.dataTable,e=(f.extend(a.prototype,{_constructor:function(){var s=this,i=this.s.dt,e=i.settings()[0],t=f(m).innerWidth(),e=(i.settings()[0]._responsive=this,f(m).on("resize.dtr orientationchange.dtr",r.util.throttle(function(){var e=f(m).innerWidth();e!==t&&(s._resize(),t=e)})),e.oApi._fnCallbackReg(e,"aoRowCreatedCallback",function(e,t,n){-1!==f.inArray(!1,s.s.current)&&f(">td, >th",e).each(function(e){e=i.column.index("toData",e);!1===s.s.current[e]&&f(this).css("display","none")})}),i.on("destroy.dtr",function(){i.off(".dtr"),f(i.table().body()).off(".dtr"),f(m).off("resize.dtr orientationchange.dtr"),i.cells(".dtr-control").nodes().to$().removeClass("dtr-control"),f.each(s.s.current,function(e,t){!1===t&&s._setColumnVis(e,!0)})}),this.c.breakpoints.sort(function(e,t){return e.width<t.width?1:e.width>t.width?-1:0}),this._classLogic(),this._resizeAuto(),this.c.details);!1!==e.type&&(s._detailsInit(),i.on("column-visibility.dtr",function(){s._timer&&clearTimeout(s._timer),s._timer=setTimeout(function(){s._timer=null,s._classLogic(),s._resizeAuto(),s._resize(!0),s._redrawChildren()},100)}),i.on("draw.dtr",function(){s._redrawChildren()}),f(i.table().node()).addClass("dtr-"+e.type)),i.on("column-reorder.dtr",function(e,t,n){s._classLogic(),s._resizeAuto(),s._resize(!0)}),i.on("column-sizing.dtr",function(){s._resizeAuto(),s._resize()}),i.on("column-calc.dt",function(e,t){for(var n=s.s.current,i=0;i<n.length;i++){var r=t.visible.indexOf(i);!1===n[i]&&0<=r&&t.visible.splice(r,1)}}),i.on("preXhr.dtr",function(){var e=[];i.rows().every(function(){this.child.isShown()&&e.push(this.id(!0))}),i.one("draw.dtr",function(){s._resizeAuto(),s._resize(),i.rows(e).every(function(){s._detailsDisplay(this,!1)})})}),i.on("draw.dtr",function(){s._controlClass()}).on("init.dtr",function(e,t,n){"dt"===e.namespace&&(s._resizeAuto(),s._resize(),f.inArray(!1,s.s.current)&&i.columns.adjust())}),this._resize()},_childNodes:function(e,t,n){var i=t+"-"+n;if(this.s.childNodeStore[i])return this.s.childNodeStore[i];for(var r=[],s=e.cell(t,n).node().childNodes,o=0,d=s.length;o<d;o++)r.push(s[o]);return this.s.childNodeStore[i]=r},_childNodesRestore:function(e,t,n){var i=t+"-"+n;if(this.s.childNodeStore[i]){for(var r=e.cell(t,n).node(),s=this.s.childNodeStore[i][0].parentNode.childNodes,o=[],d=0,a=s.length;d<a;d++)o.push(s[d]);for(var l=0,c=o.length;l<c;l++)r.appendChild(o[l]);this.s.childNodeStore[i]=h}},_columnsVisiblity:function(n){for(var i=this.s.dt,e=this.s.columns,t=e.map(function(e,t){return{columnIdx:t,priority:e.priority}}).sort(function(e,t){return e.priority!==t.priority?e.priority-t.priority:e.columnIdx-t.columnIdx}),r=f.map(e,function(e,t){return!1===i.column(t).visible()?"not-visible":(!e.auto||null!==e.minWidth)&&(!0===e.auto?"-":-1!==f.inArray(n,e.includeIn))}),s=0,o=0,d=r.length;o<d;o++)!0===r[o]&&(s+=e[o].minWidth);var a=i.settings()[0].oScroll,a=a.sY||a.sX?a.iBarWidth:0,l=i.table().container().offsetWidth-a-s;for(o=0,d=r.length;o<d;o++)e[o].control&&(l-=e[o].minWidth);var c=!1;for(o=0,d=t.length;o<d;o++){var u=t[o].columnIdx;"-"===r[u]&&!e[u].control&&e[u].minWidth&&(c||l-e[u].minWidth<0?r[u]=!(c=!0):r[u]=!0,l-=e[u].minWidth)}var h=!1;for(o=0,d=e.length;o<d;o++)if(!e[o].control&&!e[o].never&&!1===r[o]){h=!0;break}for(o=0,d=e.length;o<d;o++)e[o].control&&(r[o]=h),"not-visible"===r[o]&&(r[o]=!1);return-1===f.inArray(!0,r)&&(r[0]=!0),r},_classLogic:function(){function d(e,t,n,i){var r,s,o;if(n){if("max-"===n)for(r=a._find(t).width,s=0,o=l.length;s<o;s++)l[s].width<=r&&u(e,l[s].name);else if("min-"===n)for(r=a._find(t).width,s=0,o=l.length;s<o;s++)l[s].width>=r&&u(e,l[s].name);else if("not-"===n)for(s=0,o=l.length;s<o;s++)-1===l[s].name.indexOf(i)&&u(e,l[s].name)}else c[e].includeIn.push(t)}var a=this,l=this.c.breakpoints,i=this.s.dt,c=i.columns().eq(0).map(function(e){var t=this.column(e),n=t.header().className,e=i.settings()[0].aoColumns[e].responsivePriority,t=t.header().getAttribute("data-priority");return e===h&&(e=t===h||null===t?1e4:+t),{className:n,includeIn:[],auto:!1,control:!1,never:!!n.match(/\b(dtr\-)?never\b/),priority:e}}),u=function(e,t){e=c[e].includeIn;-1===f.inArray(t,e)&&e.push(t)};c.each(function(e,r){for(var t=e.className.split(" "),s=!1,n=0,i=t.length;n<i;n++){var o=t[n].trim();if("all"===o||"dtr-all"===o)return s=!0,void(e.includeIn=f.map(l,function(e){return e.name}));if("none"===o||"dtr-none"===o||e.never)return void(s=!0);if("control"===o||"dtr-control"===o)return s=!0,void(e.control=!0);f.each(l,function(e,t){var n=t.name.split("-"),i=new RegExp("(min\\-|max\\-|not\\-)?("+n[0]+")(\\-[_a-zA-Z0-9])?"),i=o.match(i);i&&(s=!0,i[2]===n[0]&&i[3]==="-"+n[1]?d(r,t.name,i[1],i[2]+i[3]):i[2]!==n[0]||i[3]||d(r,t.name,i[1],i[2]))})}s||(e.auto=!0)}),this.s.columns=c},_controlClass:function(){var e,t,n;"inline"===this.c.details.type&&(e=this.s.dt,t=this.s.current,n=f.inArray(!0,t),e.cells(null,function(e){return e!==n},{page:"current"}).nodes().to$().filter(".dtr-control").removeClass("dtr-control"),e.cells(null,n,{page:"current"}).nodes().to$().addClass("dtr-control"))},_detailsDisplay:function(t,n){function e(e){f(t.node()).toggleClass("parent",!1!==e),f(s.table().node()).triggerHandler("responsive-display.dt",[s,t,e,n])}var i,r=this,s=this.s.dt,o=this.c.details;o&&!1!==o.type&&(i="string"==typeof o.renderer?a.renderer[o.renderer]():o.renderer,"boolean"==typeof(o=o.display(t,n,function(){return i.call(r,s,t[0],r._detailsObj(t[0]))},function(){e(!1)}))&&e(o))},_detailsInit:function(){var n=this,i=this.s.dt,e=this.c.details,r=("inline"===e.type&&(e.target="td.dtr-control, th.dtr-control"),i.on("draw.dtr",function(){n._tabIndexes()}),n._tabIndexes(),f(i.table().body()).on("keyup.dtr","td, th",function(e){13===e.keyCode&&f(this).data("dtr-keyboard")&&f(this).click()}),e.target),e="string"==typeof r?r:"td, th";r===h&&null===r||f(i.table().body()).on("click.dtr mousedown.dtr mouseup.dtr",e,function(e){if(f(i.table().node()).hasClass("collapsed")&&-1!==f.inArray(f(this).closest("tr").get(0),i.rows().nodes().toArray())){if("number"==typeof r){var t=r<0?i.columns().eq(0).length+r:r;if(i.cell(this).index().column!==t)return}t=i.row(f(this).closest("tr"));"click"===e.type?n._detailsDisplay(t,!1):"mousedown"===e.type?f(this).css("outline","none"):"mouseup"===e.type&&f(this).trigger("blur").css("outline","")}})},_detailsObj:function(n){var i=this,r=this.s.dt;return f.map(this.s.columns,function(e,t){if(!e.never&&!e.control)return{className:(e=r.settings()[0].aoColumns[t]).sClass,columnIndex:t,data:r.cell(n,t).render(i.c.orthogonal),hidden:r.column(t).visible()&&!i.s.current[t],rowIndex:n,title:null!==e.sTitle?e.sTitle:f(r.column(t).header()).text()}})},_find:function(e){for(var t=this.c.breakpoints,n=0,i=t.length;n<i;n++)if(t[n].name===e)return t[n]},_redrawChildren:function(){var n=this,i=this.s.dt;i.rows({page:"current"}).iterator("row",function(e,t){n._detailsDisplay(i.row(t),!0)})},_resize:function(n){for(var e,i=this,t=this.s.dt,r=f(m).innerWidth(),s=this.c.breakpoints,o=s[0].name,d=this.s.columns,a=this.s.current.slice(),l=s.length-1;0<=l;l--)if(r<=s[l].width){o=s[l].name;break}var c=this._columnsVisiblity(o),u=(this.s.current=c,!1);for(l=0,e=d.length;l<e;l++)if(!1===c[l]&&!d[l].never&&!d[l].control&&!1==!t.column(l).visible()){u=!0;break}f(t.table().node()).toggleClass("collapsed",u);var h=!1,p=0;t.columns().eq(0).each(function(e,t){!0===c[t]&&p++,!n&&c[t]===a[t]||(h=!0,i._setColumnVis(e,c[t]))}),this._redrawChildren(),h&&(f(t.table().node()).trigger("responsive-resize.dt",[t,this.s.current]),0===t.page.info().recordsDisplay&&f("td",t.table().body()).eq(0).attr("colspan",p)),i._controlClass()},_resizeAuto:function(){var e,t,n,i,r,s=this.s.dt,o=this.s.columns,d=this;this.c.auto&&-1!==f.inArray(!0,f.map(o,function(e){return e.auto}))&&(f.isEmptyObject(this.s.childNodeStore)||f.each(this.s.childNodeStore,function(e){e=e.split("-");d._childNodesRestore(s,+e[0],+e[1])}),s.table().node().offsetWidth,s.columns,e=s.table().node().cloneNode(!1),t=f(s.table().header().cloneNode(!1)).appendTo(e),i=f(s.table().body()).clone(!1,!1).empty().appendTo(e),e.style.width="auto",n=s.columns().header().filter(function(e){return s.column(e).visible()}).to$().clone(!1).css("display","table-cell").css("width","auto").css("min-width",0),f(i).append(f(s.rows({page:"current"}).nodes()).clone(!1)).find("th, td").css("display",""),(i=s.table().footer())&&(i=f(i.cloneNode(!1)).appendTo(e),r=s.columns().footer().filter(function(e){return s.column(e).visible()}).to$().clone(!1).css("display","table-cell"),f("<tr/>").append(r).appendTo(i)),f("<tr/>").append(n).appendTo(t),"inline"===this.c.details.type&&f(e).addClass("dtr-inline collapsed"),f(e).find("[name]").removeAttr("name"),f(e).css("position","relative"),(r=f("<div/>").css({width:1,height:1,overflow:"hidden",clear:"both"}).append(e)).insertBefore(s.table().node()),n.each(function(e){e=s.column.index("fromVisible",e);o[e].minWidth=this.offsetWidth||0}),r.remove())},_responsiveOnlyHidden:function(){var n=this.s.dt;return f.map(this.s.current,function(e,t){return!1===n.column(t).visible()||e})},_setColumnVis:function(e,t){var n=this,i=this.s.dt,r=t?"":"none";f(i.column(e).header()).css("display",r).toggleClass("dtr-hidden",!t),f(i.column(e).footer()).css("display",r).toggleClass("dtr-hidden",!t),i.column(e).nodes().to$().css("display",r).toggleClass("dtr-hidden",!t),f.isEmptyObject(this.s.childNodeStore)||i.cells(null,e).indexes().each(function(e){n._childNodesRestore(i,e.row,e.column)})},_tabIndexes:function(){var e=this.s.dt,t=e.cells({page:"current"}).nodes().to$(),n=e.settings()[0],i=this.c.details.target;t.filter("[data-dtr-keyboard]").removeData("[data-dtr-keyboard]"),("number"==typeof i?e.cells(null,i,{page:"current"}).nodes().to$():f(i="td:first-child, th:first-child"===i?">td:first-child, >th:first-child":i,e.rows({page:"current"}).nodes())).attr("tabIndex",n.iTabIndex).data("dtr-keyboard",1)}}),a.defaults={breakpoints:a.breakpoints=[{name:"desktop",width:1/0},{name:"tablet-l",width:1024},{name:"tablet-p",width:768},{name:"mobile-l",width:480},{name:"mobile-p",width:320}],auto:!0,details:{display:(a.display={childRow:function(e,t,n){return t?f(e.node()).hasClass("parent")?(e.child(n(),"child").show(),!0):void 0:e.child.isShown()?(e.child(!1),!1):(e.child(n(),"child").show(),!0)},childRowImmediate:function(e,t,n){return!t&&e.child.isShown()||!e.responsive.hasHidden()?(e.child(!1),!1):(e.child(n(),"child").show(),!0)},modal:function(o){return function(e,t,n,i){if(t){if(!(s=f("div.dtr-modal-content")).length||e.index()!==s.data("dtr-row-idx"))return null;s.empty().append(n())}else{var r=function(){s.remove(),f(d).off("keypress.dtr"),f(e.node()).removeClass("parent"),i()},s=f('<div class="dtr-modal"/>').append(f('<div class="dtr-modal-display"/>').append(f('<div class="dtr-modal-content"/>').data("dtr-row-idx",e.index()).append(n())).append(f('<div class="dtr-modal-close">&times;</div>').click(function(){r()}))).append(f('<div class="dtr-modal-background"/>').click(function(){r()})).appendTo("body");f(e.node()).addClass("parent"),f(d).on("keyup.dtr",function(e){27===e.keyCode&&(e.stopPropagation(),r())})}return o&&o.header&&f("div.dtr-modal-content").prepend("<h2>"+o.header(e)+"</h2>"),!0}}}).childRow,renderer:(a.renderer={listHiddenNodes:function(){return function(i,e,t){var r=this,s=f('<ul data-dtr-index="'+e+'" class="dtr-details"/>'),o=!1;f.each(t,function(e,t){var n;t.hidden&&(n=t.className?'class="'+t.className+'"':"",f("<li "+n+' data-dtr-index="'+t.columnIndex+'" data-dt-row="'+t.rowIndex+'" data-dt-column="'+t.columnIndex+'"><span class="dtr-title">'+t.title+"</span> </li>").append(f('<span class="dtr-data"/>').append(r._childNodes(i,t.rowIndex,t.columnIndex))).appendTo(s),o=!0)});return!!o&&s}},listHidden:function(){return function(e,t,n){n=f.map(n,function(e){var t=e.className?'class="'+e.className+'"':"";return e.hidden?"<li "+t+' data-dtr-index="'+e.columnIndex+'" data-dt-row="'+e.rowIndex+'" data-dt-column="'+e.columnIndex+'"><span class="dtr-title">'+e.title+'</span> <span class="dtr-data">'+e.data+"</span></li>":""}).join("");return!!n&&f('<ul data-dtr-index="'+t+'" class="dtr-details"/>').append(n)}},tableAll:function(i){return i=f.extend({tableClass:""},i),function(e,t,n){n=f.map(n,function(e){return"<tr "+(e.className?'class="'+e.className+'"':"")+' data-dt-row="'+e.rowIndex+'" data-dt-column="'+e.columnIndex+'"><td>'+e.title+":</td> <td>"+e.data+"</td></tr>"}).join("");return f('<table class="'+i.tableClass+' dtr-details" width="100%"/>').append(n)}}}).listHidden(),target:0,type:"inline"},orthogonal:"display"},f.fn.dataTable.Api);return e.register("responsive()",function(){return this}),e.register("responsive.index()",function(e){return{column:(e=f(e)).data("dtr-index"),row:e.parent().data("dtr-index")}}),e.register("responsive.rebuild()",function(){return this.iterator("table",function(e){e._responsive&&e._responsive._classLogic()})}),e.register("responsive.recalc()",function(){return this.iterator("table",function(e){e._responsive&&(e._responsive._resizeAuto(),e._responsive._resize())})}),e.register("responsive.hasHidden()",function(){var e=this.context[0];return!!e._responsive&&-1!==f.inArray(!1,e._responsive._responsiveOnlyHidden())}),e.registerPlural("columns().responsiveHidden()","column().responsiveHidden()",function(){return this.iterator("column",function(e,t){return!!e._responsive&&e._responsive._responsiveOnlyHidden()[t]},1)}),a.version="2.5.0",f.fn.dataTable.Responsive=a,f.fn.DataTable.Responsive=a,f(d).on("preInit.dt.dtr",function(e,t,n){"dt"===e.namespace&&(f(t.nTable).hasClass("responsive")||f(t.nTable).hasClass("dt-responsive")||t.oInit.responsive||r.defaults.responsive)&&!1!==(e=t.oInit.responsive)&&new a(t,f.isPlainObject(e)?e:{})}),r});

@@ -7,3 +7,3 @@ {

"types": "./types/types.d.ts",
"version": "2.4.1",
"version": "2.5.0",
"files": [

@@ -23,3 +23,3 @@ "js/**/*.js",

"dependencies": {
"datatables.net": ">=1.12.1",
"datatables.net": ">=1.13.4",
"jquery": ">=1.7"

@@ -26,0 +26,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc