Bump Plugin DataTables from 2.1.8 to 2.2.1

This commit is contained in:
johnnyq
2025-01-24 22:23:20 -05:00
parent b47c79d90a
commit 79d1914fe8
4 changed files with 332 additions and 119 deletions

View File

@@ -4,10 +4,10 @@
* *
* To rebuild or modify this file with the latest versions of the included * To rebuild or modify this file with the latest versions of the included
* software please visit: * software please visit:
* https://datatables.net/download/#bs4/dt-2.1.8 * https://datatables.net/download/#bs4/dt-2.2.1
* *
* Included libraries: * Included libraries:
* DataTables 2.1.8 * DataTables 2.2.1
*/ */
@charset "UTF-8"; @charset "UTF-8";
@@ -43,6 +43,9 @@ table.dataTable tr.dt-hasChild td.dt-control:before {
border-bottom: 0px solid transparent; border-bottom: 0px solid transparent;
border-right: 5px solid transparent; border-right: 5px solid transparent;
} }
table.dataTable tfoot:empty {
display: none;
}
html.dark table.dataTable td.dt-control:before, html.dark table.dataTable td.dt-control:before,
:root[data-bs-theme=dark] table.dataTable td.dt-control:before, :root[data-bs-theme=dark] table.dataTable td.dt-control:before,
@@ -251,6 +254,11 @@ table.dataTable th,
table.dataTable td { table.dataTable td {
box-sizing: border-box; box-sizing: border-box;
} }
table.dataTable th.dt-type-numeric, table.dataTable th.dt-type-date,
table.dataTable td.dt-type-numeric,
table.dataTable td.dt-type-date {
text-align: right;
}
table.dataTable th.dt-left, table.dataTable th.dt-left,
table.dataTable td.dt-left { table.dataTable td.dt-left {
text-align: left; text-align: left;
@@ -276,11 +284,6 @@ table.dataTable td.dt-empty {
text-align: center; text-align: center;
vertical-align: top; vertical-align: top;
} }
table.dataTable th.dt-type-numeric, table.dataTable th.dt-type-date,
table.dataTable td.dt-type-numeric,
table.dataTable td.dt-type-date {
text-align: right;
}
table.dataTable thead th, table.dataTable thead th,
table.dataTable thead td, table.dataTable thead td,
table.dataTable tfoot th, table.dataTable tfoot th,

View File

@@ -4,34 +4,16 @@
* *
* To rebuild or modify this file with the latest versions of the included * To rebuild or modify this file with the latest versions of the included
* software please visit: * software please visit:
* https://datatables.net/download/#bs4/dt-2.1.8 * https://datatables.net/download/#bs4/dt-2.2.1
* *
* Included libraries: * Included libraries:
* DataTables 2.1.8 * DataTables 2.2.1
*/ */
/*! DataTables 2.1.8 /*! DataTables 2.2.1
* © SpryMedia Ltd - datatables.net/license * © SpryMedia Ltd - datatables.net/license
*/ */
/**
* @summary DataTables
* @description Paginate, search and order HTML tables
* @version 2.1.8
* @author SpryMedia Ltd
* @contact www.datatables.net
* @copyright SpryMedia Ltd.
*
* This source file is free software, available under the following license:
* MIT license - https://datatables.net/license
*
* This source file is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
*
* For details please refer to: https://www.datatables.net
*/
(function( factory ) { (function( factory ) {
"use strict"; "use strict";
@@ -441,7 +423,6 @@
thead = $('<thead/>').appendTo($this); thead = $('<thead/>').appendTo($this);
} }
oSettings.nTHead = thead[0]; oSettings.nTHead = thead[0];
$('tr', thead).addClass(oClasses.thead.row);
var tbody = $this.children('tbody'); var tbody = $this.children('tbody');
if ( tbody.length === 0 ) { if ( tbody.length === 0 ) {
@@ -456,7 +437,6 @@
tfoot = $('<tfoot/>').appendTo($this); tfoot = $('<tfoot/>').appendTo($this);
} }
oSettings.nTFoot = tfoot[0]; oSettings.nTFoot = tfoot[0];
$('tr', tfoot).addClass(oClasses.tfoot.row);
// Copy the data index array // Copy the data index array
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice(); oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
@@ -539,7 +519,7 @@
* *
* @type string * @type string
*/ */
builder: "bs4/dt-2.1.8", builder: "bs4/dt-2.2.1",
/** /**
@@ -2173,6 +2153,10 @@
var width = _fnColumnsSumWidth(settings, [i], false, false); var width = _fnColumnsSumWidth(settings, [i], false, false);
cols[i].colEl.css('width', width); cols[i].colEl.css('width', width);
if (settings.oScroll.sX) {
cols[i].colEl.css('min-width', width);
}
} }
} }
@@ -3240,9 +3224,13 @@
// Add the number of cells needed to make up to the number of columns // Add the number of cells needed to make up to the number of columns
if (row.length === 1) { if (row.length === 1) {
var cells = $('td, th', row); var cellCount = 0;
$('td, th', row).each(function () {
cellCount += this.colSpan;
});
for ( i=cells.length, ien=columns.length ; i<ien ; i++ ) { for ( i=cellCount, ien=columns.length ; i<ien ; i++ ) {
$('<th/>') $('<th/>')
.html( columns[i][titleProp] || '' ) .html( columns[i][titleProp] || '' )
.appendTo( row ); .appendTo( row );
@@ -3254,9 +3242,11 @@
if (side === 'header') { if (side === 'header') {
settings.aoHeader = detected; settings.aoHeader = detected;
$('tr', target).addClass(classes.thead.row);
} }
else { else {
settings.aoFooter = detected; settings.aoFooter = detected;
$('tr', target).addClass(classes.tfoot.row);
} }
// Every cell needs to be passed through the renderer // Every cell needs to be passed through the renderer
@@ -4519,7 +4509,7 @@
// So the array reference doesn't break set the results into the // So the array reference doesn't break set the results into the
// existing array // existing array
displayRows.length = 0; displayRows.length = 0;
displayRows.push.apply(displayRows, rows); _fnArrayApply(displayRows, rows);
} }
} }
@@ -5247,8 +5237,11 @@
// [].find, but it wasn't supported in Chrome until Sept 2015, and DT has 10 year // [].find, but it wasn't supported in Chrome until Sept 2015, and DT has 10 year
// browser support // browser support
var firstTr = null; var firstTr = null;
var start = _fnDataSource( settings ) !== 'ssp'
? settings._iDisplayStart
: 0;
for (i=settings._iDisplayStart ; i<settings.aiDisplay.length ; i++) { for (i=start ; i<start + settings.aiDisplay.length ; i++) {
var idx = settings.aiDisplay[i]; var idx = settings.aiDisplay[i];
var tr = settings.aoData[idx].nTr; var tr = settings.aoData[idx].nTr;
@@ -5263,7 +5256,7 @@
return { return {
idx: _fnVisibleToColumnIndex(settings, vis), idx: _fnVisibleToColumnIndex(settings, vis),
width: $(this).outerWidth() width: $(this).outerWidth()
} };
}); });
// Check against what the colgroup > col is set to and correct if needed // Check against what the colgroup > col is set to and correct if needed
@@ -5273,6 +5266,10 @@
if (colWidth !== colSizes[i].width) { if (colWidth !== colSizes[i].width) {
colEl.style.width = colSizes[i].width + 'px'; colEl.style.width = colSizes[i].width + 'px';
if (scroll.sX) {
colEl.style.minWidth = colSizes[i].width + 'px';
}
} }
} }
} }
@@ -5365,6 +5362,14 @@
i, column, columnIdx; i, column, columnIdx;
var styleWidth = table.style.width; var styleWidth = table.style.width;
var containerWidth = _fnWrapperWidth(settings);
// Don't re-run for the same width as the last time
if (containerWidth === settings.containerWidth) {
return false;
}
settings.containerWidth = containerWidth;
// If there is no width applied as a CSS style or as an attribute, we assume that // If there is no width applied as a CSS style or as an attribute, we assume that
// the width is intended to be 100%, which is usually is in CSS, but it is very // the width is intended to be 100%, which is usually is in CSS, but it is very
@@ -5422,6 +5427,8 @@
// browser will collapse it. If this width is smaller than the // browser will collapse it. If this width is smaller than the
// width the column requires, then it will have no effect // width the column requires, then it will have no effect
if ( scrollX ) { if ( scrollX ) {
this.style.minWidth = width;
$( this ).append( $('<div/>').css( { $( this ).append( $('<div/>').css( {
width: width, width: width,
margin: 0, margin: 0,
@@ -5490,15 +5497,15 @@
// If there is no width attribute or style, then allow the table to // If there is no width attribute or style, then allow the table to
// collapse // collapse
if ( tmpTable.width() < tableContainer.clientWidth && tableWidthAttr ) { if ( tmpTable.outerWidth() < tableContainer.clientWidth && tableWidthAttr ) {
tmpTable.width( tableContainer.clientWidth ); tmpTable.outerWidth( tableContainer.clientWidth );
} }
} }
else if ( scrollY ) { else if ( scrollY ) {
tmpTable.width( tableContainer.clientWidth ); tmpTable.outerWidth( tableContainer.clientWidth );
} }
else if ( tableWidthAttr ) { else if ( tableWidthAttr ) {
tmpTable.width( tableWidthAttr ); tmpTable.outerWidth( tableWidthAttr );
} }
// Get the width of each column in the constructed table // Get the width of each column in the constructed table
@@ -5531,20 +5538,55 @@
} }
if ( (tableWidthAttr || scrollX) && ! settings._reszEvt ) { if ( (tableWidthAttr || scrollX) && ! settings._reszEvt ) {
var bindResize = function () { var resize = DataTable.util.throttle( function () {
$(window).on('resize.DT-'+settings.sInstance, DataTable.util.throttle( function () { var newWidth = _fnWrapperWidth(settings);
if (! settings.bDestroying) {
_fnAdjustColumnSizing( settings );
}
} ) );
};
bindResize(); // Don't do it if destroying or the container width is 0
if (! settings.bDestroying && newWidth !== 0) {
_fnAdjustColumnSizing( settings );
}
} );
// For browsers that support it (~2020 onwards for wide support) we can watch for the
// container changing width.
if (window.ResizeObserver) {
// This is a tricky beast - if the element is visible when `.observe()` is called,
// then the callback is immediately run. Which we don't want. If the element isn't
// visible, then it isn't run, but we want it to run when it is then made visible.
// This flag allows the above to be satisfied.
var first = $(settings.nTableWrapper).is(':visible');
settings.resizeObserver = new ResizeObserver(function (e) {
if (first) {
first = false;
}
else {
resize();
}
});
settings.resizeObserver.observe(settings.nTableWrapper);
}
else {
// For old browsers, the best we can do is listen for a window resize
$(window).on('resize.DT-'+settings.sInstance, resize);
}
settings._reszEvt = true; settings._reszEvt = true;
} }
} }
/**
* Get the width of the DataTables wrapper element
*
* @param {*} settings DataTables settings object
* @returns Width
*/
function _fnWrapperWidth(settings) {
return $(settings.nTableWrapper).is(':visible')
? $(settings.nTableWrapper).width()
: 0;
}
/** /**
* Get the maximum strlen for each data column * Get the maximum strlen for each data column
@@ -6153,15 +6195,26 @@
return; return;
} }
// Sort state saving uses [[idx, order]] structure.
var sorting = [];
_fnSortResolve(settings, sorting, settings.aaSorting );
/* Store the interesting variables */ /* Store the interesting variables */
var columns = settings.aoColumns;
var state = { var state = {
time: +new Date(), time: +new Date(),
start: settings._iDisplayStart, start: settings._iDisplayStart,
length: settings._iDisplayLength, length: settings._iDisplayLength,
order: $.extend( true, [], settings.aaSorting ), order: sorting.map(function (sort) {
// If a column name is available, use it
return columns[sort[0]] && columns[sort[0]].sName
? [ columns[sort[0]].sName, sort[1] ]
: sort.slice();
} ),
search: $.extend({}, settings.oPreviousSearch), search: $.extend({}, settings.oPreviousSearch),
columns: settings.aoColumns.map( function ( col, i ) { columns: settings.aoColumns.map( function ( col, i ) {
return { return {
name: col.sName,
visible: col.bVisible, visible: col.bVisible,
search: $.extend({}, settings.aoPreSearchCols[i]) search: $.extend({}, settings.aoPreSearchCols[i])
}; };
@@ -6209,6 +6262,8 @@
function _fnImplementState ( settings, s, callback) { function _fnImplementState ( settings, s, callback) {
var i, ien; var i, ien;
var columns = settings.aoColumns; var columns = settings.aoColumns;
var currentNames = _pluck(settings.aoColumns, 'sName');
settings._bLoadingState = true; settings._bLoadingState = true;
// When StateRestore was introduced the state could now be implemented at any time // When StateRestore was introduced the state could now be implemented at any time
@@ -6238,13 +6293,6 @@
return; return;
} }
// Number of columns have changed - all bets are off, no restore of settings
if ( s.columns && columns.length !== s.columns.length ) {
settings._bLoadingState = false;
callback();
return;
}
// Store the saved state so it might be accessed at any time // Store the saved state so it might be accessed at any time
settings.oLoadedState = $.extend( true, {}, s ); settings.oLoadedState = $.extend( true, {}, s );
@@ -6278,10 +6326,23 @@
if ( s.order !== undefined ) { if ( s.order !== undefined ) {
settings.aaSorting = []; settings.aaSorting = [];
$.each( s.order, function ( i, col ) { $.each( s.order, function ( i, col ) {
settings.aaSorting.push( col[0] >= columns.length ? var set = [ col[0], col[1] ];
[ 0, col[1] ] :
col // A column name was stored and should be used for restore
); if (typeof col[0] === 'string') {
var idx = currentNames.indexOf(col[0]);
// Find the name from the current list of column names, or fallback to index 0
set[0] = idx >= 0
? idx
: 0;
}
else if (set[0] >= columns.length) {
// If a column name, but it is out of bounds, set to 0
set[0] = 0;
}
settings.aaSorting.push(set);
} ); } );
} }
@@ -6292,31 +6353,65 @@
// Columns // Columns
if ( s.columns ) { if ( s.columns ) {
for ( i=0, ien=s.columns.length ; i<ien ; i++ ) { var set = s.columns;
var col = s.columns[i]; var incoming = _pluck(s.columns, 'name');
// Visibility // Check if it is a 2.2 style state object with a `name` property for the columns, and if
if ( col.visible !== undefined ) { // the name was defined. If so, then create a new array that will map the state object
// If the api is defined, the table has been initialised so we need to use it rather than internal settings // given, to the current columns (don't bother if they are already matching tho).
if (api) { if (incoming.join('').length && incoming.join('') !== currentNames.join('')) {
// Don't redraw the columns on every iteration of this loop, we will do this at the end instead set = [];
api.column(i).visible(col.visible, false);
// For each column, try to find the name in the incoming array
for (i=0 ; i<currentNames.length ; i++) {
if (currentNames[i] != '') {
var idx = incoming.indexOf(currentNames[i]);
if (idx >= 0) {
set.push(s.columns[idx]);
}
else {
// No matching column name in the state's columns, so this might be a new
// column and thus can't have a state already.
set.push({});
}
} }
else { else {
columns[i].bVisible = col.visible; // If no name, but other columns did have a name, then there is no knowing
// where this one came from originally so it can't be restored.
set.push({});
}
}
}
// If the number of columns to restore is different from current, then all bets are off.
if (set.length === columns.length) {
for ( i=0, ien=set.length ; i<ien ; i++ ) {
var col = set[i];
// Visibility
if ( col.visible !== undefined ) {
// If the api is defined, the table has been initialised so we need to use it rather than internal settings
if (api) {
// Don't redraw the columns on every iteration of this loop, we will do this at the end instead
api.column(i).visible(col.visible, false);
}
else {
columns[i].bVisible = col.visible;
}
}
// Search
if ( col.search !== undefined ) {
$.extend( settings.aoPreSearchCols[i], col.search );
} }
} }
// Search // If the api is defined then we need to adjust the columns once the visibility has been changed
if ( col.search !== undefined ) { if (api) {
$.extend( settings.aoPreSearchCols[i], col.search ); api.columns.adjust();
} }
} }
// If the api is defined then we need to adjust the columns once the visibility has been changed
if (api) {
api.columns.adjust();
}
} }
settings._bLoadingState = false; settings._bLoadingState = false;
@@ -6633,6 +6728,30 @@
replace(/_ENTRIES-TOTAL_/g, settings.api.i18n('entries', '', vis) ); replace(/_ENTRIES-TOTAL_/g, settings.api.i18n('entries', '', vis) );
} }
/**
* Add elements to an array as quickly as possible, but stack stafe.
*
* @param {*} arr Array to add the data to
* @param {*} data Data array that is to be added
* @returns
*/
function _fnArrayApply(arr, data) {
if (! data) {
return;
}
// Chrome can throw a max stack error if apply is called with
// too large an array, but apply is faster.
if (data.length < 10000) {
arr.push.apply(arr, data);
}
else {
for (i=0 ; i<data.length ; i++) {
arr.push(data[i]);
}
}
}
/** /**
@@ -6825,18 +6944,7 @@
: settings; : settings;
// Initial data // Initial data
if ( data ) { _fnArrayApply(this, data);
// Chrome can throw a max stack error if apply is called with
// too large an array, but apply is faster.
if (data.length < 10000) {
this.push.apply(this, data);
}
else {
for (i=0 ; i<data.length ; i++) {
this.push(data[i]);
}
}
}
// selector // selector
this.selector = { this.selector = {
@@ -7217,7 +7325,7 @@
selector.forEach(function (sel) { selector.forEach(function (sel) {
var inner = __table_selector(sel, a); var inner = __table_selector(sel, a);
result.push.apply(result, inner); _fnArrayApply(result, inner);
}); });
return result.filter( function (item) { return result.filter( function (item) {
@@ -8071,7 +8179,7 @@
// Return an Api.rows() extended instance, so rows().nodes() etc can be used // Return an Api.rows() extended instance, so rows().nodes() etc can be used
var modRows = this.rows( -1 ); var modRows = this.rows( -1 );
modRows.pop(); modRows.pop();
modRows.push.apply(modRows, newRows); _fnArrayApply(modRows, newRows);
return modRows; return modRows;
} ); } );
@@ -8584,7 +8692,10 @@
.map( function () { .map( function () {
return _fnColumnsFromHeader( this ); // `nodes` is column index complete and in order return _fnColumnsFromHeader( this ); // `nodes` is column index complete and in order
} ) } )
.toArray(); .toArray()
.sort(function (a, b) {
return a - b;
});
if ( jqResult.length || ! s.nodeName ) { if ( jqResult.length || ! s.nodeName ) {
return jqResult; return jqResult;
@@ -8838,6 +8949,10 @@
_api_register( 'columns.adjust()', function () { _api_register( 'columns.adjust()', function () {
return this.iterator( 'table', function ( settings ) { return this.iterator( 'table', function ( settings ) {
// Force a column sizing to happen with a manual call - otherwise it can skip
// if the size hasn't changed
settings.containerWidth = -1;
_fnAdjustColumnSizing( settings ); _fnAdjustColumnSizing( settings );
}, 1 ); }, 1 );
} ); } );
@@ -9403,6 +9518,10 @@
} ); } );
} ); } );
// Can be assigned in DateTable.use() - note luxon and moment vars are in helpers.js
var __bootstrap;
var __foundation;
/** /**
* Set the libraries that DataTables uses, or the global objects. * Set the libraries that DataTables uses, or the global objects.
* Note that the arguments can be either way around (legacy support) * Note that the arguments can be either way around (legacy support)
@@ -9436,6 +9555,14 @@
case 'moment': case 'moment':
return __moment; return __moment;
case 'bootstrap':
// Use local if set, otherwise try window, which could be undefined
return __bootstrap || window.bootstrap;
case 'foundation':
// Ditto
return __foundation || window.Foundation;
default: default:
return null; return null;
} }
@@ -9445,7 +9572,7 @@
if (type === 'lib' || type === 'jq' || (module && module.fn && module.fn.jquery)) { if (type === 'lib' || type === 'jq' || (module && module.fn && module.fn.jquery)) {
$ = module; $ = module;
} }
else if (type == 'win' || (module && module.document)) { else if (type === 'win' || (module && module.document)) {
window = module; window = module;
document = module.document; document = module.document;
} }
@@ -9458,6 +9585,14 @@
else if (type === 'moment' || (module && module.isMoment)) { else if (type === 'moment' || (module && module.isMoment)) {
__moment = module; __moment = module;
} }
else if (type === 'bootstrap' || (module && module.Modal && module.Modal.NAME === 'modal'))
{
// This is currently for BS5 only. BS3/4 attach to jQuery, so no need to use `.use()`
__bootstrap = module;
}
else if (type === 'foundation' || (module && module.Reveal)) {
__foundation = module;
}
} }
/** /**
@@ -9748,6 +9883,11 @@
new _Api( settings ).columns().visible( true ); new _Api( settings ).columns().visible( true );
} }
// Container width change listener
if (settings.resizeObserver) {
settings.resizeObserver.disconnect();
}
// Blitz all `DT` namespaced events (these are internal events, the // Blitz all `DT` namespaced events (these are internal events, the
// lowercase, `dt` events are user subscribed and they are responsible // lowercase, `dt` events are user subscribed and they are responsible
// for removing them // for removing them
@@ -9866,7 +10006,7 @@
* @type string * @type string
* @default Version number * @default Version number
*/ */
DataTable.version = "2.1.8"; DataTable.version = "2.2.1";
/** /**
* Private data store, containing all of the settings objects that are * Private data store, containing all of the settings objects that are
@@ -11969,7 +12109,13 @@
deferLoading: null, deferLoading: null,
/** Allow auto type detection */ /** Allow auto type detection */
typeDetect: true typeDetect: true,
/** ResizeObserver for the container div */
resizeObserver: null,
/** Keep a record of the last size of the container, so we can skip duplicates */
containerWidth: -1
}; };
/** /**
@@ -12111,8 +12257,8 @@
var __mlWarning = false; var __mlWarning = false;
var __luxon; // Can be assigned in DateTeble.use() var __luxon; // Can be assigned in DateTable.use()
var __moment; // Can be assigned in DateTeble.use() var __moment; // Can be assigned in DateTable.use()
/** /**
* *
@@ -12148,7 +12294,7 @@
return null; return null;
} }
dt.setLocale(locale); dt = dt.setLocale(locale);
} }
else if (! format) { else if (! format) {
// No format given, must be ISO // No format given, must be ISO
@@ -12531,6 +12677,13 @@
}); });
} }
var __diacriticHtmlSort = function (a, b) {
a = _stripHtml(a);
b = _stripHtml(b);
return __diacriticSort(a, b);
}
// //
// Built in data types // Built in data types
// //
@@ -12601,6 +12754,31 @@
}); });
DataTable.type('html-utf8', {
detect: {
allOf: function ( d ) {
return _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1);
},
oneOf: function ( d ) {
// At least one data point must contain a `<` and a non-ASCII character
// eslint-disable-next-line compat/compat
return navigator.languages &&
! _empty( d ) &&
typeof d === 'string' &&
d.indexOf('<') !== -1 &&
typeof d === 'string' && d.match(/[^\x00-\x7F]/);
}
},
order: {
asc: __diacriticHtmlSort,
desc: function (a, b) {
return __diacriticHtmlSort(a, b) * -1;
}
},
search: _filterString(true, true)
});
DataTable.type('date', { DataTable.type('date', {
className: 'dt-type-date', className: 'dt-type-date',
detect: { detect: {
@@ -12811,6 +12989,7 @@
var indexes = columns.indexes(); var indexes = columns.indexes();
var sortDirs = columns.orderable(true).flatten(); var sortDirs = columns.orderable(true).flatten();
var orderedColumns = _pluck(sorting, 'col'); var orderedColumns = _pluck(sorting, 'col');
var tabIndex = settings.iTabIndex;
cell cell
.removeClass( .removeClass(
@@ -12875,8 +13054,13 @@
// Make the headers tab-able for keyboard navigation // Make the headers tab-able for keyboard navigation
if (orderable) { if (orderable) {
cell.find('.dt-column-title').attr('role', 'button'); var orderSpan = cell.find('.dt-column-order');
cell.attr('tabindex', 0)
orderSpan.attr('role', 'button');
if (tabIndex !== -1) {
orderSpan.attr('tabindex', tabIndex);
}
} }
} ); } );
} }
@@ -12890,7 +13074,7 @@
.addClass(items.className || classes.row) .addClass(items.className || classes.row)
.appendTo( container ); .appendTo( container );
$.each( items, function (key, val) { DataTable.ext.renderer.layout._forLayoutRow(items, function (key, val) {
if (key === 'id' || key === 'className') { if (key === 'id' || key === 'className') {
return; return;
} }
@@ -12921,7 +13105,31 @@
}) })
.append( val.contents ) .append( val.contents )
.appendTo( row ); .appendTo( row );
} ); });
},
// Shared for use by the styling frameworks
_forLayoutRow: function (items, fn) {
// As we are inserting dom elements, we need start / end in a
// specific order, this function is used for sorting the layout
// keys.
var layoutEnum = function (x) {
switch (x) {
case '': return 0;
case 'start': return 1;
case 'end': return 2;
default: return 3;
}
};
Object
.keys(items)
.sort(function (a, b) {
return layoutEnum(a) - layoutEnum(b);
})
.forEach(function (key) {
fn(key, items[key]);
});
} }
} }
} ); } );
@@ -13273,7 +13481,7 @@
'data-dt-idx': button, 'data-dt-idx': button,
'tabIndex': btnInfo.disabled 'tabIndex': btnInfo.disabled
? -1 ? -1
: settings.iTabIndex : settings.iTabIndex && btn.clicker[0].nodeName.toLowerCase() !== 'span'
? settings.iTabIndex ? settings.iTabIndex
: null, // `0` doesn't need a tabIndex since it is the default : null, // `0` doesn't need a tabIndex since it is the default
}); });
@@ -13307,12 +13515,16 @@
// Responsive - check if the buttons are over two lines based on the // Responsive - check if the buttons are over two lines based on the
// height of the buttons and the container. // height of the buttons and the container.
if ( if (buttonEls.length) {
buttonEls.length && // any buttons var outerHeight = $(buttonEls[0]).outerHeight();
opts.buttons > 1 && // prevent infinite
$(host).height() >= ($(buttonEls[0]).outerHeight() * 2) - 10 if (
) { opts.buttons > 1 && // prevent infinite
_pagingDraw(settings, host, $.extend({}, opts, { buttons: opts.buttons - 2 })); outerHeight > 0 && // will be 0 if hidden
$(host).height() >= (outerHeight * 2) - 10
) {
_pagingDraw(settings, host, $.extend({}, opts, { buttons: opts.buttons - 2 }));
}
} }
} }
@@ -13336,7 +13548,6 @@
switch ( button ) { switch ( button ) {
case 'ellipsis': case 'ellipsis':
o.display = '&#x2026;'; o.display = '&#x2026;';
o.disabled = true;
break; break;
case 'first': case 'first':
@@ -13523,7 +13734,7 @@
// Save text node content for macro updating // Save text node content for macro updating
var textNodes = []; var textNodes = [];
Array.from(div.find('label')[0].childNodes).forEach(function (el) { Array.prototype.slice.call(div.find('label')[0].childNodes).forEach(function (el) {
if (el.nodeType === Node.TEXT_NODE) { if (el.nodeType === Node.TEXT_NODE) {
textNodes.push({ textNodes.push({
el: el, el: el,
@@ -13541,7 +13752,6 @@
// Next, the select itself, along with the options // Next, the select itself, along with the options
var select = $('<select/>', { var select = $('<select/>', {
'name': tableId+'_length',
'aria-controls': tableId, 'aria-controls': tableId,
'class': classes.select 'class': classes.select
} ); } );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long