datatables.net 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/dataTables.js +45 -35
- package/js/dataTables.min.js +2 -2
- package/js/dataTables.min.mjs +2 -2
- package/js/dataTables.mjs +45 -35
- package/package.json +1 -1
package/js/dataTables.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DataTables 2.2.
|
|
1
|
+
/*! DataTables 2.2.1
|
|
2
2
|
* © SpryMedia Ltd - datatables.net/license
|
|
3
3
|
*/
|
|
4
4
|
|
|
@@ -5315,6 +5315,14 @@ function _fnCalculateColumnWidths ( settings )
|
|
|
5315
5315
|
i, column, columnIdx;
|
|
5316
5316
|
|
|
5317
5317
|
var styleWidth = table.style.width;
|
|
5318
|
+
var containerWidth = _fnWrapperWidth(settings);
|
|
5319
|
+
|
|
5320
|
+
// Don't re-run for the same width as the last time
|
|
5321
|
+
if (containerWidth === settings.containerWidth) {
|
|
5322
|
+
return false;
|
|
5323
|
+
}
|
|
5324
|
+
|
|
5325
|
+
settings.containerWidth = containerWidth;
|
|
5318
5326
|
|
|
5319
5327
|
// If there is no width applied as a CSS style or as an attribute, we assume that
|
|
5320
5328
|
// the width is intended to be 100%, which is usually is in CSS, but it is very
|
|
@@ -5442,15 +5450,15 @@ function _fnCalculateColumnWidths ( settings )
|
|
|
5442
5450
|
|
|
5443
5451
|
// If there is no width attribute or style, then allow the table to
|
|
5444
5452
|
// collapse
|
|
5445
|
-
if ( tmpTable.
|
|
5446
|
-
tmpTable.
|
|
5453
|
+
if ( tmpTable.outerWidth() < tableContainer.clientWidth && tableWidthAttr ) {
|
|
5454
|
+
tmpTable.outerWidth( tableContainer.clientWidth );
|
|
5447
5455
|
}
|
|
5448
5456
|
}
|
|
5449
5457
|
else if ( scrollY ) {
|
|
5450
|
-
tmpTable.
|
|
5458
|
+
tmpTable.outerWidth( tableContainer.clientWidth );
|
|
5451
5459
|
}
|
|
5452
5460
|
else if ( tableWidthAttr ) {
|
|
5453
|
-
tmpTable.
|
|
5461
|
+
tmpTable.outerWidth( tableWidthAttr );
|
|
5454
5462
|
}
|
|
5455
5463
|
|
|
5456
5464
|
// Get the width of each column in the constructed table
|
|
@@ -5483,46 +5491,33 @@ function _fnCalculateColumnWidths ( settings )
|
|
|
5483
5491
|
}
|
|
5484
5492
|
|
|
5485
5493
|
if ( (tableWidthAttr || scrollX) && ! settings._reszEvt ) {
|
|
5486
|
-
var wrapperWidth = function () {
|
|
5487
|
-
return $(settings.nTableWrapper).is(':visible')
|
|
5488
|
-
? $(settings.nTableWrapper).width()
|
|
5489
|
-
: 0;
|
|
5490
|
-
}
|
|
5491
|
-
|
|
5492
|
-
settings.containerWidth = wrapperWidth();
|
|
5493
|
-
|
|
5494
5494
|
var resize = DataTable.util.throttle( function () {
|
|
5495
|
-
var newWidth =
|
|
5495
|
+
var newWidth = _fnWrapperWidth(settings);
|
|
5496
5496
|
|
|
5497
|
-
// Don't do it if destroying
|
|
5498
|
-
|
|
5499
|
-
if (
|
|
5500
|
-
! settings.bDestroying &&
|
|
5501
|
-
settings.containerWidth !== newWidth &&
|
|
5502
|
-
newWidth !== 0
|
|
5503
|
-
) {
|
|
5504
|
-
// Do a resize
|
|
5497
|
+
// Don't do it if destroying or the container width is 0
|
|
5498
|
+
if (! settings.bDestroying && newWidth !== 0) {
|
|
5505
5499
|
_fnAdjustColumnSizing( settings );
|
|
5506
|
-
settings.containerWidth = newWidth;
|
|
5507
5500
|
}
|
|
5508
5501
|
} );
|
|
5509
5502
|
|
|
5510
5503
|
// For browsers that support it (~2020 onwards for wide support) we can watch for the
|
|
5511
5504
|
// container changing width.
|
|
5512
5505
|
if (window.ResizeObserver) {
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5506
|
+
// This is a tricky beast - if the element is visible when `.observe()` is called,
|
|
5507
|
+
// then the callback is immediately run. Which we don't want. If the element isn't
|
|
5508
|
+
// visible, then it isn't run, but we want it to run when it is then made visible.
|
|
5509
|
+
// This flag allows the above to be satisfied.
|
|
5510
|
+
var first = $(settings.nTableWrapper).is(':visible');
|
|
5518
5511
|
|
|
5519
|
-
|
|
5520
|
-
if (
|
|
5521
|
-
|
|
5512
|
+
settings.resizeObserver = new ResizeObserver(function (e) {
|
|
5513
|
+
if (first) {
|
|
5514
|
+
first = false;
|
|
5515
|
+
}
|
|
5516
|
+
else {
|
|
5517
|
+
resize();
|
|
5522
5518
|
}
|
|
5523
|
-
|
|
5524
|
-
resize();
|
|
5525
5519
|
});
|
|
5520
|
+
|
|
5526
5521
|
settings.resizeObserver.observe(settings.nTableWrapper);
|
|
5527
5522
|
}
|
|
5528
5523
|
else {
|
|
@@ -5534,6 +5529,17 @@ function _fnCalculateColumnWidths ( settings )
|
|
|
5534
5529
|
}
|
|
5535
5530
|
}
|
|
5536
5531
|
|
|
5532
|
+
/**
|
|
5533
|
+
* Get the width of the DataTables wrapper element
|
|
5534
|
+
*
|
|
5535
|
+
* @param {*} settings DataTables settings object
|
|
5536
|
+
* @returns Width
|
|
5537
|
+
*/
|
|
5538
|
+
function _fnWrapperWidth(settings) {
|
|
5539
|
+
return $(settings.nTableWrapper).is(':visible')
|
|
5540
|
+
? $(settings.nTableWrapper).width()
|
|
5541
|
+
: 0;
|
|
5542
|
+
}
|
|
5537
5543
|
|
|
5538
5544
|
/**
|
|
5539
5545
|
* Get the maximum strlen for each data column
|
|
@@ -8896,6 +8902,10 @@ _api_registerPlural( 'columns().indexes()', 'column().index()', function ( type
|
|
|
8896
8902
|
|
|
8897
8903
|
_api_register( 'columns.adjust()', function () {
|
|
8898
8904
|
return this.iterator( 'table', function ( settings ) {
|
|
8905
|
+
// Force a column sizing to happen with a manual call - otherwise it can skip
|
|
8906
|
+
// if the size hasn't changed
|
|
8907
|
+
settings.containerWidth = -1;
|
|
8908
|
+
|
|
8899
8909
|
_fnAdjustColumnSizing( settings );
|
|
8900
8910
|
}, 1 );
|
|
8901
8911
|
} );
|
|
@@ -9949,7 +9959,7 @@ _api_register( 'i18n()', function ( token, def, plural ) {
|
|
|
9949
9959
|
* @type string
|
|
9950
9960
|
* @default Version number
|
|
9951
9961
|
*/
|
|
9952
|
-
DataTable.version = "2.2.
|
|
9962
|
+
DataTable.version = "2.2.1";
|
|
9953
9963
|
|
|
9954
9964
|
/**
|
|
9955
9965
|
* Private data store, containing all of the settings objects that are
|
|
@@ -12058,7 +12068,7 @@ DataTable.models.oSettings = {
|
|
|
12058
12068
|
resizeObserver: null,
|
|
12059
12069
|
|
|
12060
12070
|
/** Keep a record of the last size of the container, so we can skip duplicates */
|
|
12061
|
-
containerWidth:
|
|
12071
|
+
containerWidth: -1
|
|
12062
12072
|
};
|
|
12063
12073
|
|
|
12064
12074
|
/**
|