jquery.dgtable 0.6.7 → 0.6.8

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,5 +1,5 @@
1
1
  /*!
2
- * jquery.dgtable 0.6.7
2
+ * jquery.dgtable 0.6.8
3
3
  * git://github.com/danielgindi/jquery.dgtable.git
4
4
  */
5
5
  'use strict';
@@ -91,34 +91,24 @@ var FunctionPrototype$1 = Function.prototype;
91
91
  var call$3 = FunctionPrototype$1.call;
92
92
  var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype$1.bind.bind(call$3, call$3);
93
93
 
94
- var functionUncurryThisRaw = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
94
+ var functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
95
95
  return function () {
96
96
  return call$3.apply(fn, arguments);
97
97
  };
98
98
  };
99
99
 
100
- var uncurryThisRaw$1 = functionUncurryThisRaw;
100
+ var uncurryThis$9 = functionUncurryThis;
101
101
 
102
- var toString$4 = uncurryThisRaw$1({}.toString);
103
- var stringSlice$1 = uncurryThisRaw$1(''.slice);
102
+ var toString$4 = uncurryThis$9({}.toString);
103
+ var stringSlice$1 = uncurryThis$9(''.slice);
104
104
 
105
- var classofRaw$2 = function (it) {
105
+ var classofRaw$1 = function (it) {
106
106
  return stringSlice$1(toString$4(it), 8, -1);
107
107
  };
108
108
 
109
- var classofRaw$1 = classofRaw$2;
110
- var uncurryThisRaw = functionUncurryThisRaw;
111
-
112
- var functionUncurryThis = function (fn) {
113
- // Nashorn bug:
114
- // https://github.com/zloirock/core-js/issues/1128
115
- // https://github.com/zloirock/core-js/issues/1130
116
- if (classofRaw$1(fn) === 'Function') return uncurryThisRaw(fn);
117
- };
118
-
119
109
  var uncurryThis$8 = functionUncurryThis;
120
110
  var fails$7 = fails$a;
121
- var classof$2 = classofRaw$2;
111
+ var classof$2 = classofRaw$1;
122
112
 
123
113
  var $Object$3 = Object;
124
114
  var split = uncurryThis$8(''.split);
@@ -349,10 +339,10 @@ var store$2 = sharedStore;
349
339
  (shared$3.exports = function (key, value) {
350
340
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
351
341
  })('versions', []).push({
352
- version: '3.26.0',
342
+ version: '3.26.1',
353
343
  mode: 'global',
354
344
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
355
- license: 'https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE',
345
+ license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
356
346
  source: 'https://github.com/zloirock/core-js'
357
347
  });
358
348
 
@@ -1035,7 +1025,7 @@ var toStringTagSupport = String(test$1) === '[object z]';
1035
1025
 
1036
1026
  var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1037
1027
  var isCallable$1 = isCallable$c;
1038
- var classofRaw = classofRaw$2;
1028
+ var classofRaw = classofRaw$1;
1039
1029
  var wellKnownSymbol = wellKnownSymbol$3;
1040
1030
 
1041
1031
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
@@ -1779,6 +1769,7 @@ class SelectionHelper {
1779
1769
  * @property {VirtualListHelper~ItemElementCreatorFunction} [itemElementCreatorFn] an optional function for providing fresh item elements (default creates `<li />`s)
1780
1770
  * @property {VirtualListHelper~ItemRenderFunction} [onItemRender] a function for rendering element content based on item index
1781
1771
  * @property {VirtualListHelper~ItemUnrenderFunction} [onItemUnrender] a function for freeing resources in an item element
1772
+ * @property {function(height: number)} [onScrollHeightChange] a function to be notified when scroll height changes
1782
1773
  *
1783
1774
  */
1784
1775
 
@@ -1855,6 +1846,8 @@ class VirtualListHelper {
1855
1846
  /** @type VirtualListHelper~ItemUnrenderFunction|null */
1856
1847
  onItemUnrender: null,
1857
1848
 
1849
+ onScrollHeightChange: opts.onScrollHeightChange,
1850
+
1858
1851
  // internal:
1859
1852
 
1860
1853
  /** @type Element|null */
@@ -2121,6 +2114,17 @@ class VirtualListHelper {
2121
2114
  return this;
2122
2115
  }
2123
2116
 
2117
+ /**
2118
+ * The `onScrollHeightChange` is a function called when the scroll height changes.
2119
+ * @param {function(height: number)} fn
2120
+ * @returns {VirtualListHelper}
2121
+ */
2122
+ setOnScrollHeightChange(fn) {
2123
+ const p = this._p;
2124
+ p.onScrollHeightChange = fn;
2125
+ return this;
2126
+ }
2127
+
2124
2128
  /**
2125
2129
  * Estimates the full scroll height. This gets better as more renderings occur.
2126
2130
  * @returns {number}
@@ -2335,7 +2339,12 @@ class VirtualListHelper {
2335
2339
 
2336
2340
  // Calculate up-to-date scroll height
2337
2341
  let scrollHeight = this.estimateFullHeight();
2338
- p.virtualWrapper.style.height = scrollHeight + 'px';
2342
+ let scrollHeightPx = scrollHeight + 'px';
2343
+
2344
+ if (virtualWrapper.style.height !== scrollHeightPx) {var _p$onScrollHeightChan;
2345
+ p.virtualWrapper.style.height = scrollHeightPx;
2346
+ (_p$onScrollHeightChan = p.onScrollHeightChange) === null || _p$onScrollHeightChan === void 0 ? void 0 : _p$onScrollHeightChan.call(p, scrollHeight);
2347
+ }
2339
2348
 
2340
2349
  if (originalWidth !== list.clientWidth)
2341
2350
  this.render();
@@ -3500,6 +3509,9 @@ DGTable.prototype.initialize = function (options) {
3500
3509
  * @field {RowCollection} _filteredRows */
3501
3510
  p.filteredRows = null;
3502
3511
 
3512
+ p.scrollbarWidth = 0;
3513
+ p.lastVirtualScrollHeight = 0;
3514
+
3503
3515
  this._setupHovers();
3504
3516
  };
3505
3517
 
@@ -3657,6 +3669,15 @@ DGTable.prototype._setupVirtualTable = function () {var _p$filteredRows;
3657
3669
  that._unbindCellEventsForRow(row);
3658
3670
 
3659
3671
  that.trigger('rowdestroy', row);
3672
+ },
3673
+
3674
+ onScrollHeightChange: (height) => {
3675
+ // only recalculate scrollbar width if height increased. we reset it in other situations.
3676
+ if (height > p._lastVirtualScrollHeight && !p.scrollbarWidth) {
3677
+ this._updateLastCellWidthFromScrollbar();
3678
+ }
3679
+
3680
+ p._lastVirtualScrollHeight = height;
3660
3681
  }
3661
3682
  });
3662
3683
 
@@ -3965,8 +3986,8 @@ DGTable.prototype.render = function () {
3965
3986
 
3966
3987
  p.virtualListHelper.setCount(((_p$filteredRows2 = p.filteredRows) !== null && _p$filteredRows2 !== void 0 ? _p$filteredRows2 : p.rows).length);
3967
3988
 
3989
+ this._updateVirtualHeight();
3968
3990
  this._updateLastCellWidthFromScrollbar(true);
3969
-
3970
3991
  this._updateTableWidth(true);
3971
3992
 
3972
3993
  // Show sort arrows
@@ -4379,8 +4400,7 @@ DGTable.prototype.moveColumn = function (src, dest, visibleOnly = true) {
4379
4400
  this._ensureVisibleColumns();
4380
4401
 
4381
4402
  if (o.virtualTable) {
4382
- this.clearAndRender().
4383
- _updateLastCellWidthFromScrollbar(true);
4403
+ this.clearAndRender();
4384
4404
  } else {
4385
4405
  let headerCell = p.$headerRow.find('>div.' + o.tableClassName + '-header-cell');
4386
4406
  let beforePos = srcOrder < destOrder ? destOrder + 1 : destOrder,
@@ -5473,8 +5493,6 @@ DGTable.prototype.removeRows = function (physicalRowIndex, count, render) {
5473
5493
  _updateLastCellWidthFromScrollbar().
5474
5494
  render().
5475
5495
  _updateTableWidth(false); // Update table width to suit the required width considering vertical scrollbar
5476
-
5477
-
5478
5496
  } else {
5479
5497
  this.render().
5480
5498
  _updateLastCellWidthFromScrollbar().
@@ -6648,7 +6666,9 @@ DGTable.prototype._updateVirtualHeight = function () {
6648
6666
  return this;
6649
6667
 
6650
6668
  if (o.virtualTable) {
6651
- p.tbody.style.height = p.virtualListHelper.estimateFullHeight() + 'px';
6669
+ const virtualHeight = p.virtualListHelper.estimateFullHeight();
6670
+ p.lastVirtualScrollHeight = virtualHeight;
6671
+ p.tbody.style.height = virtualHeight + 'px';
6652
6672
  } else {
6653
6673
  p.tbody.style.height = '';
6654
6674
  }