jquery.dgtable 0.6.7 → 0.6.9
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/dist/jquery.dgtable.cjs.js +61 -32
- package/dist/jquery.dgtable.cjs.js.map +1 -1
- package/dist/jquery.dgtable.cjs.min.js +2 -2
- package/dist/jquery.dgtable.cjs.min.js.map +1 -1
- package/dist/jquery.dgtable.es6.js +61 -32
- package/dist/jquery.dgtable.es6.js.map +1 -1
- package/dist/jquery.dgtable.es6.min.js +2 -2
- package/dist/jquery.dgtable.es6.min.js.map +1 -1
- package/dist/jquery.dgtable.umd.js +120 -67
- package/dist/jquery.dgtable.umd.js.map +1 -1
- package/dist/jquery.dgtable.umd.min.js +2 -2
- package/dist/jquery.dgtable.umd.min.js.map +1 -1
- package/package.json +12 -12
- package/src/index.js +19 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* jquery.dgtable 0.6.
|
|
2
|
+
* jquery.dgtable 0.6.9
|
|
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
|
|
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
|
|
100
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
101
101
|
|
|
102
|
-
var toString$4 =
|
|
103
|
-
var stringSlice$1 =
|
|
102
|
+
var toString$4 = uncurryThis$9({}.toString);
|
|
103
|
+
var stringSlice$1 = uncurryThis$9(''.slice);
|
|
104
104
|
|
|
105
|
-
var classofRaw$
|
|
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$
|
|
111
|
+
var classof$2 = classofRaw$1;
|
|
122
112
|
|
|
123
113
|
var $Object$3 = Object;
|
|
124
114
|
var split = uncurryThis$8(''.split);
|
|
@@ -321,7 +311,11 @@ var ordinaryToPrimitive$1 = function (input, pref) {
|
|
|
321
311
|
throw $TypeError$4("Can't convert object to primitive value");
|
|
322
312
|
};
|
|
323
313
|
|
|
324
|
-
var
|
|
314
|
+
var sharedExports = {};
|
|
315
|
+
var shared$3 = {
|
|
316
|
+
get exports(){ return sharedExports; },
|
|
317
|
+
set exports(v){ sharedExports = v; },
|
|
318
|
+
};
|
|
325
319
|
|
|
326
320
|
var global$8 = global$b;
|
|
327
321
|
|
|
@@ -349,10 +343,10 @@ var store$2 = sharedStore;
|
|
|
349
343
|
(shared$3.exports = function (key, value) {
|
|
350
344
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
351
345
|
})('versions', []).push({
|
|
352
|
-
version: '3.26.
|
|
346
|
+
version: '3.26.1',
|
|
353
347
|
mode: 'global',
|
|
354
348
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
355
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.26.
|
|
349
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
|
|
356
350
|
source: 'https://github.com/zloirock/core-js'
|
|
357
351
|
});
|
|
358
352
|
|
|
@@ -389,7 +383,7 @@ var uid$2 = function (key) {
|
|
|
389
383
|
};
|
|
390
384
|
|
|
391
385
|
var global$6 = global$b;
|
|
392
|
-
var shared$2 =
|
|
386
|
+
var shared$2 = sharedExports;
|
|
393
387
|
var hasOwn$7 = hasOwnProperty_1;
|
|
394
388
|
var uid$1 = uid$2;
|
|
395
389
|
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
@@ -576,7 +570,11 @@ var createNonEnumerableProperty$2 = DESCRIPTORS$3 ? function (object, key, value
|
|
|
576
570
|
return object;
|
|
577
571
|
};
|
|
578
572
|
|
|
579
|
-
var
|
|
573
|
+
var makeBuiltInExports = {};
|
|
574
|
+
var makeBuiltIn$2 = {
|
|
575
|
+
get exports(){ return makeBuiltInExports; },
|
|
576
|
+
set exports(v){ makeBuiltInExports = v; },
|
|
577
|
+
};
|
|
580
578
|
|
|
581
579
|
var DESCRIPTORS$2 = descriptors;
|
|
582
580
|
var hasOwn$5 = hasOwnProperty_1;
|
|
@@ -618,7 +616,7 @@ var WeakMap$1 = global$4.WeakMap;
|
|
|
618
616
|
|
|
619
617
|
var weakMapBasicDetection = isCallable$5(WeakMap$1) && /native code/.test(String(WeakMap$1));
|
|
620
618
|
|
|
621
|
-
var shared$1 =
|
|
619
|
+
var shared$1 = sharedExports;
|
|
622
620
|
var uid = uid$2;
|
|
623
621
|
|
|
624
622
|
var keys = shared$1('keys');
|
|
@@ -752,7 +750,7 @@ Function.prototype.toString = makeBuiltIn$1(function toString() {
|
|
|
752
750
|
|
|
753
751
|
var isCallable$3 = isCallable$c;
|
|
754
752
|
var definePropertyModule$2 = objectDefineProperty;
|
|
755
|
-
var makeBuiltIn =
|
|
753
|
+
var makeBuiltIn = makeBuiltInExports;
|
|
756
754
|
var defineGlobalProperty$1 = defineGlobalProperty$3;
|
|
757
755
|
|
|
758
756
|
var defineBuiltIn$1 = function (O, key, value, options) {
|
|
@@ -1035,7 +1033,7 @@ var toStringTagSupport = String(test$1) === '[object z]';
|
|
|
1035
1033
|
|
|
1036
1034
|
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1037
1035
|
var isCallable$1 = isCallable$c;
|
|
1038
|
-
var classofRaw = classofRaw$
|
|
1036
|
+
var classofRaw = classofRaw$1;
|
|
1039
1037
|
var wellKnownSymbol = wellKnownSymbol$3;
|
|
1040
1038
|
|
|
1041
1039
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
@@ -1779,6 +1777,7 @@ class SelectionHelper {
|
|
|
1779
1777
|
* @property {VirtualListHelper~ItemElementCreatorFunction} [itemElementCreatorFn] an optional function for providing fresh item elements (default creates `<li />`s)
|
|
1780
1778
|
* @property {VirtualListHelper~ItemRenderFunction} [onItemRender] a function for rendering element content based on item index
|
|
1781
1779
|
* @property {VirtualListHelper~ItemUnrenderFunction} [onItemUnrender] a function for freeing resources in an item element
|
|
1780
|
+
* @property {function(height: number)} [onScrollHeightChange] a function to be notified when scroll height changes
|
|
1782
1781
|
*
|
|
1783
1782
|
*/
|
|
1784
1783
|
|
|
@@ -1855,6 +1854,8 @@ class VirtualListHelper {
|
|
|
1855
1854
|
/** @type VirtualListHelper~ItemUnrenderFunction|null */
|
|
1856
1855
|
onItemUnrender: null,
|
|
1857
1856
|
|
|
1857
|
+
onScrollHeightChange: opts.onScrollHeightChange,
|
|
1858
|
+
|
|
1858
1859
|
// internal:
|
|
1859
1860
|
|
|
1860
1861
|
/** @type Element|null */
|
|
@@ -2121,6 +2122,17 @@ class VirtualListHelper {
|
|
|
2121
2122
|
return this;
|
|
2122
2123
|
}
|
|
2123
2124
|
|
|
2125
|
+
/**
|
|
2126
|
+
* The `onScrollHeightChange` is a function called when the scroll height changes.
|
|
2127
|
+
* @param {function(height: number)} fn
|
|
2128
|
+
* @returns {VirtualListHelper}
|
|
2129
|
+
*/
|
|
2130
|
+
setOnScrollHeightChange(fn) {
|
|
2131
|
+
const p = this._p;
|
|
2132
|
+
p.onScrollHeightChange = fn;
|
|
2133
|
+
return this;
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2124
2136
|
/**
|
|
2125
2137
|
* Estimates the full scroll height. This gets better as more renderings occur.
|
|
2126
2138
|
* @returns {number}
|
|
@@ -2335,7 +2347,12 @@ class VirtualListHelper {
|
|
|
2335
2347
|
|
|
2336
2348
|
// Calculate up-to-date scroll height
|
|
2337
2349
|
let scrollHeight = this.estimateFullHeight();
|
|
2338
|
-
|
|
2350
|
+
let scrollHeightPx = scrollHeight + 'px';
|
|
2351
|
+
|
|
2352
|
+
if (virtualWrapper.style.height !== scrollHeightPx) {var _p$onScrollHeightChan;
|
|
2353
|
+
p.virtualWrapper.style.height = scrollHeightPx;
|
|
2354
|
+
(_p$onScrollHeightChan = p.onScrollHeightChange) === null || _p$onScrollHeightChan === void 0 ? void 0 : _p$onScrollHeightChan.call(p, scrollHeight);
|
|
2355
|
+
}
|
|
2339
2356
|
|
|
2340
2357
|
if (originalWidth !== list.clientWidth)
|
|
2341
2358
|
this.render();
|
|
@@ -3500,6 +3517,9 @@ DGTable.prototype.initialize = function (options) {
|
|
|
3500
3517
|
* @field {RowCollection} _filteredRows */
|
|
3501
3518
|
p.filteredRows = null;
|
|
3502
3519
|
|
|
3520
|
+
p.scrollbarWidth = 0;
|
|
3521
|
+
p.lastVirtualScrollHeight = 0;
|
|
3522
|
+
|
|
3503
3523
|
this._setupHovers();
|
|
3504
3524
|
};
|
|
3505
3525
|
|
|
@@ -3657,6 +3677,15 @@ DGTable.prototype._setupVirtualTable = function () {var _p$filteredRows;
|
|
|
3657
3677
|
that._unbindCellEventsForRow(row);
|
|
3658
3678
|
|
|
3659
3679
|
that.trigger('rowdestroy', row);
|
|
3680
|
+
},
|
|
3681
|
+
|
|
3682
|
+
onScrollHeightChange: (height) => {
|
|
3683
|
+
// only recalculate scrollbar width if height increased. we reset it in other situations.
|
|
3684
|
+
if (height > p._lastVirtualScrollHeight && !p.scrollbarWidth) {
|
|
3685
|
+
this._updateLastCellWidthFromScrollbar();
|
|
3686
|
+
}
|
|
3687
|
+
|
|
3688
|
+
p._lastVirtualScrollHeight = height;
|
|
3660
3689
|
}
|
|
3661
3690
|
});
|
|
3662
3691
|
|
|
@@ -3965,8 +3994,8 @@ DGTable.prototype.render = function () {
|
|
|
3965
3994
|
|
|
3966
3995
|
p.virtualListHelper.setCount(((_p$filteredRows2 = p.filteredRows) !== null && _p$filteredRows2 !== void 0 ? _p$filteredRows2 : p.rows).length);
|
|
3967
3996
|
|
|
3997
|
+
this._updateVirtualHeight();
|
|
3968
3998
|
this._updateLastCellWidthFromScrollbar(true);
|
|
3969
|
-
|
|
3970
3999
|
this._updateTableWidth(true);
|
|
3971
4000
|
|
|
3972
4001
|
// Show sort arrows
|
|
@@ -4379,8 +4408,7 @@ DGTable.prototype.moveColumn = function (src, dest, visibleOnly = true) {
|
|
|
4379
4408
|
this._ensureVisibleColumns();
|
|
4380
4409
|
|
|
4381
4410
|
if (o.virtualTable) {
|
|
4382
|
-
this.clearAndRender()
|
|
4383
|
-
_updateLastCellWidthFromScrollbar(true);
|
|
4411
|
+
this.clearAndRender();
|
|
4384
4412
|
} else {
|
|
4385
4413
|
let headerCell = p.$headerRow.find('>div.' + o.tableClassName + '-header-cell');
|
|
4386
4414
|
let beforePos = srcOrder < destOrder ? destOrder + 1 : destOrder,
|
|
@@ -4485,6 +4513,7 @@ DGTable.prototype.sort = function (column, descending, add) {
|
|
|
4485
4513
|
}
|
|
4486
4514
|
}
|
|
4487
4515
|
|
|
4516
|
+
if (p.virtualListHelper)
|
|
4488
4517
|
p.virtualListHelper.invalidate().render();
|
|
4489
4518
|
|
|
4490
4519
|
// Build output for event, with option names that will survive compilers
|
|
@@ -5473,8 +5502,6 @@ DGTable.prototype.removeRows = function (physicalRowIndex, count, render) {
|
|
|
5473
5502
|
_updateLastCellWidthFromScrollbar().
|
|
5474
5503
|
render().
|
|
5475
5504
|
_updateTableWidth(false); // Update table width to suit the required width considering vertical scrollbar
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
5505
|
} else {
|
|
5479
5506
|
this.render().
|
|
5480
5507
|
_updateLastCellWidthFromScrollbar().
|
|
@@ -6648,7 +6675,9 @@ DGTable.prototype._updateVirtualHeight = function () {
|
|
|
6648
6675
|
return this;
|
|
6649
6676
|
|
|
6650
6677
|
if (o.virtualTable) {
|
|
6651
|
-
|
|
6678
|
+
const virtualHeight = p.virtualListHelper.estimateFullHeight();
|
|
6679
|
+
p.lastVirtualScrollHeight = virtualHeight;
|
|
6680
|
+
p.tbody.style.height = virtualHeight + 'px';
|
|
6652
6681
|
} else {
|
|
6653
6682
|
p.tbody.style.height = '';
|
|
6654
6683
|
}
|