jquery.dgtable 0.6.6 → 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.6
2
+ * jquery.dgtable 0.6.8
3
3
  * git://github.com/danielgindi/jquery.dgtable.git
4
4
  */
5
5
  (function (global, factory) {
@@ -28,7 +28,7 @@
28
28
  descriptor.enumerable = descriptor.enumerable || false;
29
29
  descriptor.configurable = true;
30
30
  if ("value" in descriptor) descriptor.writable = true;
31
- Object.defineProperty(target, descriptor.key, descriptor);
31
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
32
32
  }
33
33
  }
34
34
  function _createClass(Constructor, protoProps, staticProps) {
@@ -39,6 +39,20 @@
39
39
  });
40
40
  return Constructor;
41
41
  }
42
+ function _toPrimitive(input, hint) {
43
+ if (typeof input !== "object" || input === null) return input;
44
+ var prim = input[Symbol.toPrimitive];
45
+ if (prim !== undefined) {
46
+ var res = prim.call(input, hint || "default");
47
+ if (typeof res !== "object") return res;
48
+ throw new TypeError("@@toPrimitive must return a primitive value.");
49
+ }
50
+ return (hint === "string" ? String : Number)(input);
51
+ }
52
+ function _toPropertyKey(arg) {
53
+ var key = _toPrimitive(arg, "string");
54
+ return typeof key === "symbol" ? key : String(key);
55
+ }
42
56
 
43
57
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
44
58
 
@@ -123,37 +137,27 @@
123
137
  var call$h = FunctionPrototype$2.call;
124
138
  var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$h, call$h);
125
139
 
126
- var functionUncurryThisRaw = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
140
+ var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
127
141
  return function () {
128
142
  return call$h.apply(fn, arguments);
129
143
  };
130
144
  };
131
145
 
132
- var uncurryThisRaw$1 = functionUncurryThisRaw;
146
+ var uncurryThis$w = functionUncurryThis;
133
147
 
134
- var toString$d = uncurryThisRaw$1({}.toString);
135
- var stringSlice$7 = uncurryThisRaw$1(''.slice);
148
+ var toString$d = uncurryThis$w({}.toString);
149
+ var stringSlice$7 = uncurryThis$w(''.slice);
136
150
 
137
151
  var classofRaw$2 = function (it) {
138
152
  return stringSlice$7(toString$d(it), 8, -1);
139
153
  };
140
154
 
141
- var classofRaw$1 = classofRaw$2;
142
- var uncurryThisRaw = functionUncurryThisRaw;
143
-
144
- var functionUncurryThis = function (fn) {
145
- // Nashorn bug:
146
- // https://github.com/zloirock/core-js/issues/1128
147
- // https://github.com/zloirock/core-js/issues/1130
148
- if (classofRaw$1(fn) === 'Function') return uncurryThisRaw(fn);
149
- };
150
-
151
- var uncurryThis$u = functionUncurryThis;
155
+ var uncurryThis$v = functionUncurryThis;
152
156
  var fails$q = fails$t;
153
157
  var classof$9 = classofRaw$2;
154
158
 
155
159
  var $Object$4 = Object;
156
- var split$3 = uncurryThis$u(''.split);
160
+ var split$3 = uncurryThis$v(''.split);
157
161
 
158
162
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
159
163
  var indexedObject = fails$q(function () {
@@ -233,9 +237,9 @@
233
237
  return arguments.length < 2 ? aFunction(global$l[namespace]) : global$l[namespace] && global$l[namespace][method];
234
238
  };
235
239
 
236
- var uncurryThis$t = functionUncurryThis;
240
+ var uncurryThis$u = functionUncurryThis;
237
241
 
238
- var objectIsPrototypeOf = uncurryThis$t({}.isPrototypeOf);
242
+ var objectIsPrototypeOf = uncurryThis$u({}.isPrototypeOf);
239
243
 
240
244
  var getBuiltIn$7 = getBuiltIn$8;
241
245
 
@@ -383,10 +387,10 @@
383
387
  (shared$7.exports = function (key, value) {
384
388
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
385
389
  })('versions', []).push({
386
- version: '3.26.0',
390
+ version: '3.26.1',
387
391
  mode: 'global',
388
392
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
389
- license: 'https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE',
393
+ license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
390
394
  source: 'https://github.com/zloirock/core-js'
391
395
  });
392
396
 
@@ -400,10 +404,10 @@
400
404
  return $Object$2(requireObjectCoercible$3(argument));
401
405
  };
402
406
 
403
- var uncurryThis$s = functionUncurryThis;
407
+ var uncurryThis$t = functionUncurryThis;
404
408
  var toObject$9 = toObject$a;
405
409
 
406
- var hasOwnProperty$2 = uncurryThis$s({}.hasOwnProperty);
410
+ var hasOwnProperty$2 = uncurryThis$t({}.hasOwnProperty);
407
411
 
408
412
  // `HasOwnProperty` abstract operation
409
413
  // https://tc39.es/ecma262/#sec-hasownproperty
@@ -412,11 +416,11 @@
412
416
  return hasOwnProperty$2(toObject$9(it), key);
413
417
  };
414
418
 
415
- var uncurryThis$r = functionUncurryThis;
419
+ var uncurryThis$s = functionUncurryThis;
416
420
 
417
421
  var id = 0;
418
422
  var postfix = Math.random();
419
- var toString$c = uncurryThis$r(1.0.toString);
423
+ var toString$c = uncurryThis$s(1.0.toString);
420
424
 
421
425
  var uid$3 = function (key) {
422
426
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$c(++id + postfix, 36);
@@ -630,11 +634,11 @@
630
634
  CONFIGURABLE: CONFIGURABLE
631
635
  };
632
636
 
633
- var uncurryThis$q = functionUncurryThis;
637
+ var uncurryThis$r = functionUncurryThis;
634
638
  var isCallable$g = isCallable$m;
635
639
  var store$1 = sharedStore;
636
640
 
637
- var functionToString = uncurryThis$q(Function.toString);
641
+ var functionToString = uncurryThis$r(Function.toString);
638
642
 
639
643
  // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
640
644
  if (!isCallable$g(store$1.inspectSource)) {
@@ -899,13 +903,13 @@
899
903
  indexOf: createMethod$3(false)
900
904
  };
901
905
 
902
- var uncurryThis$p = functionUncurryThis;
906
+ var uncurryThis$q = functionUncurryThis;
903
907
  var hasOwn$c = hasOwnProperty_1;
904
908
  var toIndexedObject$5 = toIndexedObject$8;
905
909
  var indexOf$2 = arrayIncludes.indexOf;
906
910
  var hiddenKeys$3 = hiddenKeys$5;
907
911
 
908
- var push$7 = uncurryThis$p([].push);
912
+ var push$7 = uncurryThis$q([].push);
909
913
 
910
914
  var objectKeysInternal = function (object, names) {
911
915
  var O = toIndexedObject$5(object);
@@ -949,12 +953,12 @@
949
953
  objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
950
954
 
951
955
  var getBuiltIn$5 = getBuiltIn$8;
952
- var uncurryThis$o = functionUncurryThis;
956
+ var uncurryThis$p = functionUncurryThis;
953
957
  var getOwnPropertyNamesModule$1 = objectGetOwnPropertyNames;
954
958
  var getOwnPropertySymbolsModule$3 = objectGetOwnPropertySymbols;
955
959
  var anObject$c = anObject$e;
956
960
 
957
- var concat$2 = uncurryThis$o([].concat);
961
+ var concat$2 = uncurryThis$p([].concat);
958
962
 
959
963
  // all object keys, includes non-enumerable and symbols
960
964
  var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
@@ -1058,6 +1062,16 @@
1058
1062
  }
1059
1063
  };
1060
1064
 
1065
+ var classofRaw$1 = classofRaw$2;
1066
+ var uncurryThis$o = functionUncurryThis;
1067
+
1068
+ var functionUncurryThisClause = function (fn) {
1069
+ // Nashorn bug:
1070
+ // https://github.com/zloirock/core-js/issues/1128
1071
+ // https://github.com/zloirock/core-js/issues/1130
1072
+ if (classofRaw$1(fn) === 'Function') return uncurryThis$o(fn);
1073
+ };
1074
+
1061
1075
  var fails$k = fails$t;
1062
1076
 
1063
1077
  var arrayMethodIsStrict$2 = function (METHOD_NAME, argument) {
@@ -1070,7 +1084,7 @@
1070
1084
 
1071
1085
  /* eslint-disable es/no-array-prototype-indexof -- required for testing */
1072
1086
  var $$k = _export;
1073
- var uncurryThis$n = functionUncurryThis;
1087
+ var uncurryThis$n = functionUncurryThisClause;
1074
1088
  var $indexOf = arrayIncludes.indexOf;
1075
1089
  var arrayMethodIsStrict$1 = arrayMethodIsStrict$2;
1076
1090
 
@@ -1439,7 +1453,7 @@
1439
1453
  }
1440
1454
  };
1441
1455
 
1442
- var uncurryThis$k = functionUncurryThis;
1456
+ var uncurryThis$k = functionUncurryThisClause;
1443
1457
  var aCallable$2 = aCallable$4;
1444
1458
  var NATIVE_BIND$1 = functionBindNative;
1445
1459
 
@@ -5104,7 +5118,7 @@
5104
5118
 
5105
5119
  // TODO: Remove from `core-js@4` since it's moved to entry points
5106
5120
 
5107
- var uncurryThis$4 = functionUncurryThis;
5121
+ var uncurryThis$4 = functionUncurryThisClause;
5108
5122
  var defineBuiltIn$2 = defineBuiltIn$c;
5109
5123
  var regexpExec$1 = regexpExec$2;
5110
5124
  var fails$3 = fails$t;
@@ -5982,6 +5996,7 @@
5982
5996
  * @property {VirtualListHelper~ItemElementCreatorFunction} [itemElementCreatorFn] an optional function for providing fresh item elements (default creates `<li />`s)
5983
5997
  * @property {VirtualListHelper~ItemRenderFunction} [onItemRender] a function for rendering element content based on item index
5984
5998
  * @property {VirtualListHelper~ItemUnrenderFunction} [onItemUnrender] a function for freeing resources in an item element
5999
+ * @property {function(height: number)} [onScrollHeightChange] a function to be notified when scroll height changes
5985
6000
  *
5986
6001
  */
5987
6002
 
@@ -6058,6 +6073,8 @@
6058
6073
  /** @type VirtualListHelper~ItemUnrenderFunction|null */
6059
6074
  onItemUnrender: null,
6060
6075
 
6076
+ onScrollHeightChange: opts.onScrollHeightChange,
6077
+
6061
6078
  // internal:
6062
6079
 
6063
6080
  /** @type Element|null */
@@ -6324,6 +6341,17 @@
6324
6341
  return this;
6325
6342
  }
6326
6343
 
6344
+ /**
6345
+ * The `onScrollHeightChange` is a function called when the scroll height changes.
6346
+ * @param {function(height: number)} fn
6347
+ * @returns {VirtualListHelper}
6348
+ */ }, { key: "setOnScrollHeightChange", value:
6349
+ function setOnScrollHeightChange(fn) {
6350
+ var p = this._p;
6351
+ p.onScrollHeightChange = fn;
6352
+ return this;
6353
+ }
6354
+
6327
6355
  /**
6328
6356
  * Estimates the full scroll height. This gets better as more renderings occur.
6329
6357
  * @returns {number}
@@ -6538,7 +6566,12 @@
6538
6566
 
6539
6567
  // Calculate up-to-date scroll height
6540
6568
  var scrollHeight = this.estimateFullHeight();
6541
- p.virtualWrapper.style.height = scrollHeight + 'px';
6569
+ var scrollHeightPx = scrollHeight + 'px';
6570
+
6571
+ if (virtualWrapper.style.height !== scrollHeightPx) {var _p$onScrollHeightChan;
6572
+ p.virtualWrapper.style.height = scrollHeightPx;
6573
+ (_p$onScrollHeightChan = p.onScrollHeightChange) === null || _p$onScrollHeightChan === void 0 ? void 0 : _p$onScrollHeightChan.call(p, scrollHeight);
6574
+ }
6542
6575
 
6543
6576
  if (originalWidth !== list.clientWidth)
6544
6577
  this.render();
@@ -7703,6 +7736,9 @@
7703
7736
  * @field {RowCollection} _filteredRows */
7704
7737
  p.filteredRows = null;
7705
7738
 
7739
+ p.scrollbarWidth = 0;
7740
+ p.lastVirtualScrollHeight = 0;
7741
+
7706
7742
  this._setupHovers();
7707
7743
  };
7708
7744
 
@@ -7860,6 +7896,15 @@
7860
7896
  that._unbindCellEventsForRow(row);
7861
7897
 
7862
7898
  that.trigger('rowdestroy', row);
7899
+ },
7900
+
7901
+ onScrollHeightChange: function onScrollHeightChange(height) {
7902
+ // only recalculate scrollbar width if height increased. we reset it in other situations.
7903
+ if (height > p._lastVirtualScrollHeight && !p.scrollbarWidth) {
7904
+ _this._updateLastCellWidthFromScrollbar();
7905
+ }
7906
+
7907
+ p._lastVirtualScrollHeight = height;
7863
7908
  }
7864
7909
  });
7865
7910
 
@@ -8060,8 +8105,6 @@
8060
8105
 
8061
8106
  this._destroyHeaderCells();
8062
8107
 
8063
- p.virtualListHelper.destroy();
8064
-
8065
8108
  if (p.$table) {
8066
8109
  p.$table.empty();
8067
8110
  }
@@ -8170,8 +8213,8 @@
8170
8213
 
8171
8214
  p.virtualListHelper.setCount(((_p$filteredRows2 = p.filteredRows) !== null && _p$filteredRows2 !== void 0 ? _p$filteredRows2 : p.rows).length);
8172
8215
 
8216
+ this._updateVirtualHeight();
8173
8217
  this._updateLastCellWidthFromScrollbar(true);
8174
-
8175
8218
  this._updateTableWidth(true);
8176
8219
 
8177
8220
  // Show sort arrows
@@ -8584,8 +8627,7 @@
8584
8627
  this._ensureVisibleColumns();
8585
8628
 
8586
8629
  if (o.virtualTable) {
8587
- this.clearAndRender().
8588
- _updateLastCellWidthFromScrollbar(true);
8630
+ this.clearAndRender();
8589
8631
  } else {
8590
8632
  var headerCell = p.$headerRow.find('>div.' + o.tableClassName + '-header-cell');
8591
8633
  var beforePos = srcOrder < destOrder ? destOrder + 1 : destOrder,
@@ -9678,8 +9720,6 @@
9678
9720
  _updateLastCellWidthFromScrollbar().
9679
9721
  render().
9680
9722
  _updateTableWidth(false); // Update table width to suit the required width considering vertical scrollbar
9681
-
9682
-
9683
9723
  } else {
9684
9724
  this.render().
9685
9725
  _updateLastCellWidthFromScrollbar().
@@ -10853,7 +10893,9 @@
10853
10893
  return this;
10854
10894
 
10855
10895
  if (o.virtualTable) {
10856
- p.tbody.style.height = p.virtualListHelper.estimateFullHeight() + 'px';
10896
+ var virtualHeight = p.virtualListHelper.estimateFullHeight();
10897
+ p.lastVirtualScrollHeight = virtualHeight;
10898
+ p.tbody.style.height = virtualHeight + 'px';
10857
10899
  } else {
10858
10900
  p.tbody.style.height = '';
10859
10901
  }