@ntlab/ntjs-assets 2.17.0 → 2.19.0

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.
@@ -1,4 +1,4 @@
1
- /*! DataTables 2.2.0
1
+ /*! DataTables 2.2.1
2
2
  * © SpryMedia Ltd - datatables.net/license
3
3
  */
4
4
 
@@ -5350,6 +5350,14 @@
5350
5350
  i, column, columnIdx;
5351
5351
 
5352
5352
  var styleWidth = table.style.width;
5353
+ var containerWidth = _fnWrapperWidth(settings);
5354
+
5355
+ // Don't re-run for the same width as the last time
5356
+ if (containerWidth === settings.containerWidth) {
5357
+ return false;
5358
+ }
5359
+
5360
+ settings.containerWidth = containerWidth;
5353
5361
 
5354
5362
  // If there is no width applied as a CSS style or as an attribute, we assume that
5355
5363
  // the width is intended to be 100%, which is usually is in CSS, but it is very
@@ -5477,15 +5485,15 @@
5477
5485
 
5478
5486
  // If there is no width attribute or style, then allow the table to
5479
5487
  // collapse
5480
- if ( tmpTable.width() < tableContainer.clientWidth && tableWidthAttr ) {
5481
- tmpTable.width( tableContainer.clientWidth );
5488
+ if ( tmpTable.outerWidth() < tableContainer.clientWidth && tableWidthAttr ) {
5489
+ tmpTable.outerWidth( tableContainer.clientWidth );
5482
5490
  }
5483
5491
  }
5484
5492
  else if ( scrollY ) {
5485
- tmpTable.width( tableContainer.clientWidth );
5493
+ tmpTable.outerWidth( tableContainer.clientWidth );
5486
5494
  }
5487
5495
  else if ( tableWidthAttr ) {
5488
- tmpTable.width( tableWidthAttr );
5496
+ tmpTable.outerWidth( tableWidthAttr );
5489
5497
  }
5490
5498
 
5491
5499
  // Get the width of each column in the constructed table
@@ -5518,46 +5526,33 @@
5518
5526
  }
5519
5527
 
5520
5528
  if ( (tableWidthAttr || scrollX) && ! settings._reszEvt ) {
5521
- var wrapperWidth = function () {
5522
- return $(settings.nTableWrapper).is(':visible')
5523
- ? $(settings.nTableWrapper).width()
5524
- : 0;
5525
- }
5526
-
5527
- settings.containerWidth = wrapperWidth();
5528
-
5529
5529
  var resize = DataTable.util.throttle( function () {
5530
- var newWidth = wrapperWidth();
5530
+ var newWidth = _fnWrapperWidth(settings);
5531
5531
 
5532
- // Don't do it if destroying, is the same size as last time, or the container
5533
- // width is 0
5534
- if (
5535
- ! settings.bDestroying &&
5536
- settings.containerWidth !== newWidth &&
5537
- newWidth !== 0
5538
- ) {
5539
- // Do a resize
5532
+ // Don't do it if destroying or the container width is 0
5533
+ if (! settings.bDestroying && newWidth !== 0) {
5540
5534
  _fnAdjustColumnSizing( settings );
5541
- settings.containerWidth = newWidth;
5542
5535
  }
5543
5536
  } );
5544
5537
 
5545
5538
  // For browsers that support it (~2020 onwards for wide support) we can watch for the
5546
5539
  // container changing width.
5547
5540
  if (window.ResizeObserver) {
5548
- settings.resizeObserver = new ResizeObserver(function (e) {
5549
- var box = e[0].contentBoxSize;
5550
- var size = Array.isArray(box)
5551
- ? box[0].inlineSize // Spec
5552
- : box.inlineSize; // Old Firefox
5541
+ // This is a tricky beast - if the element is visible when `.observe()` is called,
5542
+ // then the callback is immediately run. Which we don't want. If the element isn't
5543
+ // visible, then it isn't run, but we want it to run when it is then made visible.
5544
+ // This flag allows the above to be satisfied.
5545
+ var first = $(settings.nTableWrapper).is(':visible');
5553
5546
 
5554
- // Under this condition a resize will trigger its own resize, causing an error.
5555
- if (size < settings.containerWidth) {
5556
- return;
5547
+ settings.resizeObserver = new ResizeObserver(function (e) {
5548
+ if (first) {
5549
+ first = false;
5550
+ }
5551
+ else {
5552
+ resize();
5557
5553
  }
5558
-
5559
- resize();
5560
5554
  });
5555
+
5561
5556
  settings.resizeObserver.observe(settings.nTableWrapper);
5562
5557
  }
5563
5558
  else {
@@ -5569,6 +5564,17 @@
5569
5564
  }
5570
5565
  }
5571
5566
 
5567
+ /**
5568
+ * Get the width of the DataTables wrapper element
5569
+ *
5570
+ * @param {*} settings DataTables settings object
5571
+ * @returns Width
5572
+ */
5573
+ function _fnWrapperWidth(settings) {
5574
+ return $(settings.nTableWrapper).is(':visible')
5575
+ ? $(settings.nTableWrapper).width()
5576
+ : 0;
5577
+ }
5572
5578
 
5573
5579
  /**
5574
5580
  * Get the maximum strlen for each data column
@@ -8931,6 +8937,10 @@
8931
8937
 
8932
8938
  _api_register( 'columns.adjust()', function () {
8933
8939
  return this.iterator( 'table', function ( settings ) {
8940
+ // Force a column sizing to happen with a manual call - otherwise it can skip
8941
+ // if the size hasn't changed
8942
+ settings.containerWidth = -1;
8943
+
8934
8944
  _fnAdjustColumnSizing( settings );
8935
8945
  }, 1 );
8936
8946
  } );
@@ -9984,7 +9994,7 @@
9984
9994
  * @type string
9985
9995
  * @default Version number
9986
9996
  */
9987
- DataTable.version = "2.2.0";
9997
+ DataTable.version = "2.2.1";
9988
9998
 
9989
9999
  /**
9990
10000
  * Private data store, containing all of the settings objects that are
@@ -12093,7 +12103,7 @@
12093
12103
  resizeObserver: null,
12094
12104
 
12095
12105
  /** Keep a record of the last size of the container, so we can skip duplicates */
12096
- containerWidth: 0
12106
+ containerWidth: -1
12097
12107
  };
12098
12108
 
12099
12109
  /**