|
@@ -3219,13 +3219,13 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
var renderThrottle = -1;
|
|
var renderThrottle = -1;
|
|
|
-
|
|
|
|
|
var lastScrollTop = -1;
|
|
var lastScrollTop = -1;
|
|
|
var onScroll = function () {
|
|
var onScroll = function () {
|
|
|
- if (startIndex > incrementLimit && Math.abs(lastScrollTop - $container.scrollTop()) < (incrementLimit * options.minHeight)) {
|
|
|
|
|
|
|
+ var scrollTop = $container.data('scrollTop') || $container.scrollTop();
|
|
|
|
|
+ if (startIndex > incrementLimit && Math.abs(lastScrollTop - scrollTop) < (incrementLimit * options.minHeight)) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- lastScrollTop = $container.scrollTop();
|
|
|
|
|
|
|
+ lastScrollTop = scrollTop;
|
|
|
setStartAndEndFromScrollTop();
|
|
setStartAndEndFromScrollTop();
|
|
|
clearTimeout(renderThrottle);
|
|
clearTimeout(renderThrottle);
|
|
|
if (Math.abs($parentFVOwnerElement.data('startIndex') - startIndex) > incrementLimit ||
|
|
if (Math.abs($parentFVOwnerElement.data('startIndex') - startIndex) > incrementLimit ||
|
|
@@ -3324,8 +3324,9 @@
|
|
|
var render = function () {
|
|
var render = function () {
|
|
|
if ($parent.parents('.hueach').length === 0) {
|
|
if ($parent.parents('.hueach').length === 0) {
|
|
|
var heightCorrection = 0, fluidCorrection = 0;
|
|
var heightCorrection = 0, fluidCorrection = 0;
|
|
|
|
|
+ var scrollTop = wrappable.data('scrollTop') || $parent.parents(scrollable).scrollTop();
|
|
|
if (wrappable.is('table')) {
|
|
if (wrappable.is('table')) {
|
|
|
- if ($parent.parents(scrollable).scrollTop() < scrollableOffset + itemHeight) {
|
|
|
|
|
|
|
+ if (scrollTop < scrollableOffset + itemHeight) {
|
|
|
wrappable.find('thead').css('opacity', '1');
|
|
wrappable.find('thead').css('opacity', '1');
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
@@ -3345,7 +3346,7 @@
|
|
|
fluidCorrection = ko.utils.domData.get(element, 'heightCorrection') - 20;
|
|
fluidCorrection = ko.utils.domData.get(element, 'heightCorrection') - 20;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- startItem = Math.max(0, Math.floor(Math.max(1, ($parent.parents(scrollable).scrollTop() - heightCorrection - fluidCorrection - scrollableOffset)) / itemHeight) - 10);
|
|
|
|
|
|
|
+ startItem = Math.max(0, Math.floor(Math.max(1, (scrollTop - heightCorrection - fluidCorrection - scrollableOffset)) / itemHeight) - 10);
|
|
|
if (wrappable.is('table') && startItem % 2 == 1) {
|
|
if (wrappable.is('table') && startItem % 2 == 1) {
|
|
|
startItem--;
|
|
startItem--;
|
|
|
}
|
|
}
|
|
@@ -3361,6 +3362,7 @@
|
|
|
ko.bindingHandlers.foreach.update(element, valueAccessorBuilder, allBindings, viewModel, bindingContext);
|
|
ko.bindingHandlers.foreach.update(element, valueAccessorBuilder, allBindings, viewModel, bindingContext);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
$parent.parents(scrollable).off('scroll');
|
|
$parent.parents(scrollable).off('scroll');
|
|
|
$parent.parents(scrollable).on('scroll', render);
|
|
$parent.parents(scrollable).on('scroll', render);
|
|
|
|
|
|
|
@@ -3399,4 +3401,30 @@
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ ko.bindingHandlers.customScrollbar = {
|
|
|
|
|
+ init: function (element, valueAccessor, allBindings) {
|
|
|
|
|
+ $(element).mCustomScrollbar({
|
|
|
|
|
+ autoHideScrollbar: true,
|
|
|
|
|
+ theme: 'minimal-dark',
|
|
|
|
|
+ autoExpandScrollbar: true,
|
|
|
|
|
+ callbacks: {
|
|
|
|
|
+ onInit: function () {
|
|
|
|
|
+ huePubSub.publish('customScrollbar.init', {
|
|
|
|
|
+ element: element,
|
|
|
|
|
+ mcs: this.mcs
|
|
|
|
|
+ });
|
|
|
|
|
+ $(element).trigger('scroll');
|
|
|
|
|
+ },
|
|
|
|
|
+ whileScrolling: function () {
|
|
|
|
|
+ huePubSub.publish('customScrollbar.scroll', {
|
|
|
|
|
+ element: element,
|
|
|
|
|
+ mcs: this.mcs
|
|
|
|
|
+ });
|
|
|
|
|
+ $(element).trigger('scroll');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
}));
|
|
}));
|