irie 0.0.9__py3-none-any.whl → 0.0.10__py3-none-any.whl
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.
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-base.js +1069 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-base.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-lite.js +1378 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper-lite.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper.js +1927 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/cjs/popper.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/createPopper.js +258 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/contains.js +23 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getBoundingClientRect.js +28 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getClippingRect.js +70 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getCompositeRect.js +57 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getComputedStyle.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getDocumentElement.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getDocumentRect.js +29 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getHTMLElementScroll.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getLayoutRect.js +25 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getNodeName.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getNodeScroll.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getOffsetParent.js +64 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getParentNode.js +19 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getScrollParent.js +16 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getViewportRect.js +40 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindow.js +12 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindowScroll.js +10 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/getWindowScrollBarX.js +13 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/instanceOf.js +23 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/isScrollParent.js +10 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/isTableElement.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/dom-utils/listScrollParents.js +26 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/enums.js +31 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/index.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/applyStyles.js +84 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/arrow.js +101 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/computeStyles.js +155 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/eventListeners.js +49 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/flip.js +147 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/hide.js +61 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/index.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/offset.js +53 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/popperOffsets.js +25 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/modifiers/preventOverflow.js +123 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper-base.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper-lite.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/popper.js +20 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/types.js +0 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/computeAutoPlacement.js +47 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/computeOffsets.js +70 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/debounce.js +15 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/detectOverflow.js +64 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/expandToHashMap.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/format.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getAltAxis.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getAltLen.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getBasePlacement.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getFreshSideObject.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getMainAxisFromPlacement.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getOppositePlacement.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getOppositeVariationPlacement.js +9 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/getVariation.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/math.js +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/mergeByName.js +14 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/mergePaddingObject.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/orderModifiers.js +44 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/rectToClientRect.js +8 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/uniqueBy.js +11 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/validateModifiers.js +76 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/esm/utils/within.js +4 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-base.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-base.min.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-lite.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper-lite.min.js.flow +3 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper.min.js +6 -0
- irie/apps/static/assets/vendor/@popperjs/core/dist/umd/popper.min.js.flow +3 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-grid.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-grid.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-reboot.min.css +7 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +7 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-utilities.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/css/bootstrap.rtl.min.css +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.bundle.min.js +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.esm.min.js +6 -0
- irie/apps/static/assets/vendor/bootstrap/dist/js/bootstrap.min.js +6 -0
- irie/apps/static/assets/vendor/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.css +34 -0
- irie/apps/static/assets/vendor/chartist-plugin-tooltips/dist/chartist-plugin-tooltip.min.js +7 -0
- irie/apps/static/assets/vendor/notyf/notyf.es.js +441 -0
- irie/apps/static/assets/vendor/notyf/notyf.min.css +1 -0
- irie/apps/static/assets/vendor/notyf/notyf.min.js +1 -0
- irie/apps/static/assets/vendor/notyf/notyf.umd.js +449 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.css +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.js +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.min.mjs +1 -0
- irie/apps/static/assets/vendor/nouislider/distribute/nouislider.mjs +2238 -0
- irie/apps/static/assets/vendor/onscreen/dist/index.js +21 -0
- irie/apps/static/assets/vendor/onscreen/dist/on-screen.es6.js +404 -0
- irie/apps/static/assets/vendor/onscreen/dist/on-screen.umd.min.js +1 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar-core.esm.js +889 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.esm.js +994 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.min.css +1 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.min.js +10 -0
- irie/apps/static/assets/vendor/simplebar/dist/simplebar.umd.js +127 -0
- irie/apps/static/assets/vendor/smooth-scroll/dist/smooth-scroll.min.js +2 -0
- irie/apps/static/assets/vendor/smooth-scroll/dist/smooth-scroll.polyfills.min.js +2 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.all.min.js +2 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.min.css +1 -0
- irie/apps/static/assets/vendor/sweetalert2/dist/sweetalert2.min.js +1 -0
- irie/apps/static/assets/vendor/waypoints/lib/jquery.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/noframework.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/infinite.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/inview.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/shortcuts/sticky.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/lib/waypoints.debug.js +46 -0
- irie/apps/static/assets/vendor/waypoints/lib/zepto.waypoints.min.js +7 -0
- irie/apps/static/assets/vendor/waypoints/licenses.txt +23 -0
- irie/apps/static/assets/vendor/waypoints/testem.json +24 -0
- irie/init/hayward.zip +0 -0
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/METADATA +1 -1
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/RECORD +122 -5
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/WHEEL +0 -0
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/entry_points.txt +0 -0
- {irie-0.0.9.dist-info → irie-0.0.10.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,889 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SimpleBar.js - v5.3.5
|
|
3
|
+
* Scrollbars, simpler.
|
|
4
|
+
* https://grsmto.github.io/simplebar/
|
|
5
|
+
*
|
|
6
|
+
* Made by Adrien Denat from a fork by Jonathan Nicol
|
|
7
|
+
* Under MIT License
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import 'core-js/modules/es.array.filter';
|
|
11
|
+
import 'core-js/modules/es.array.for-each';
|
|
12
|
+
import 'core-js/modules/es.array.iterator';
|
|
13
|
+
import 'core-js/modules/es.object.assign';
|
|
14
|
+
import 'core-js/modules/es.object.to-string';
|
|
15
|
+
import 'core-js/modules/es.parse-int';
|
|
16
|
+
import 'core-js/modules/es.string.iterator';
|
|
17
|
+
import 'core-js/modules/es.weak-map';
|
|
18
|
+
import 'core-js/modules/web.dom-collections.iterator';
|
|
19
|
+
import throttle from 'lodash.throttle';
|
|
20
|
+
import debounce from 'lodash.debounce';
|
|
21
|
+
import memoize from 'lodash.memoize';
|
|
22
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
|
23
|
+
import canUseDOM from 'can-use-dom';
|
|
24
|
+
import 'core-js/modules/es.array.reduce';
|
|
25
|
+
import 'core-js/modules/es.function.name';
|
|
26
|
+
import 'core-js/modules/es.regexp.exec';
|
|
27
|
+
import 'core-js/modules/es.string.match';
|
|
28
|
+
import 'core-js/modules/es.string.replace';
|
|
29
|
+
|
|
30
|
+
function getElementWindow(element) {
|
|
31
|
+
if (!element || !element.ownerDocument || !element.ownerDocument.defaultView) {
|
|
32
|
+
return window;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return element.ownerDocument.defaultView;
|
|
36
|
+
}
|
|
37
|
+
function getElementDocument(element) {
|
|
38
|
+
if (!element || !element.ownerDocument) {
|
|
39
|
+
return document;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return element.ownerDocument;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var cachedScrollbarWidth = null;
|
|
46
|
+
var cachedDevicePixelRatio = null;
|
|
47
|
+
|
|
48
|
+
if (canUseDOM) {
|
|
49
|
+
window.addEventListener('resize', function () {
|
|
50
|
+
if (cachedDevicePixelRatio !== window.devicePixelRatio) {
|
|
51
|
+
cachedDevicePixelRatio = window.devicePixelRatio;
|
|
52
|
+
cachedScrollbarWidth = null;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function scrollbarWidth(el) {
|
|
58
|
+
if (cachedScrollbarWidth === null) {
|
|
59
|
+
var document = getElementDocument(el);
|
|
60
|
+
|
|
61
|
+
if (typeof document === 'undefined') {
|
|
62
|
+
cachedScrollbarWidth = 0;
|
|
63
|
+
return cachedScrollbarWidth;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var body = document.body;
|
|
67
|
+
var box = document.createElement('div');
|
|
68
|
+
box.classList.add('simplebar-hide-scrollbar');
|
|
69
|
+
body.appendChild(box);
|
|
70
|
+
var width = box.getBoundingClientRect().right;
|
|
71
|
+
body.removeChild(box);
|
|
72
|
+
cachedScrollbarWidth = width;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return cachedScrollbarWidth;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var SimpleBar =
|
|
79
|
+
/*#__PURE__*/
|
|
80
|
+
function () {
|
|
81
|
+
function SimpleBar(element, options) {
|
|
82
|
+
var _this = this;
|
|
83
|
+
|
|
84
|
+
this.onScroll = function () {
|
|
85
|
+
var elWindow = getElementWindow(_this.el);
|
|
86
|
+
|
|
87
|
+
if (!_this.scrollXTicking) {
|
|
88
|
+
elWindow.requestAnimationFrame(_this.scrollX);
|
|
89
|
+
_this.scrollXTicking = true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!_this.scrollYTicking) {
|
|
93
|
+
elWindow.requestAnimationFrame(_this.scrollY);
|
|
94
|
+
_this.scrollYTicking = true;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
this.scrollX = function () {
|
|
99
|
+
if (_this.axis.x.isOverflowing) {
|
|
100
|
+
_this.showScrollbar('x');
|
|
101
|
+
|
|
102
|
+
_this.positionScrollbar('x');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
_this.scrollXTicking = false;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
this.scrollY = function () {
|
|
109
|
+
if (_this.axis.y.isOverflowing) {
|
|
110
|
+
_this.showScrollbar('y');
|
|
111
|
+
|
|
112
|
+
_this.positionScrollbar('y');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_this.scrollYTicking = false;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
this.onMouseEnter = function () {
|
|
119
|
+
_this.showScrollbar('x');
|
|
120
|
+
|
|
121
|
+
_this.showScrollbar('y');
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
this.onMouseMove = function (e) {
|
|
125
|
+
_this.mouseX = e.clientX;
|
|
126
|
+
_this.mouseY = e.clientY;
|
|
127
|
+
|
|
128
|
+
if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
|
|
129
|
+
_this.onMouseMoveForAxis('x');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
|
|
133
|
+
_this.onMouseMoveForAxis('y');
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
this.onMouseLeave = function () {
|
|
138
|
+
_this.onMouseMove.cancel();
|
|
139
|
+
|
|
140
|
+
if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
|
|
141
|
+
_this.onMouseLeaveForAxis('x');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
|
|
145
|
+
_this.onMouseLeaveForAxis('y');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
_this.mouseX = -1;
|
|
149
|
+
_this.mouseY = -1;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
this.onWindowResize = function () {
|
|
153
|
+
// Recalculate scrollbarWidth in case it's a zoom
|
|
154
|
+
_this.scrollbarWidth = _this.getScrollbarWidth();
|
|
155
|
+
|
|
156
|
+
_this.hideNativeScrollbar();
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
this.hideScrollbars = function () {
|
|
160
|
+
_this.axis.x.track.rect = _this.axis.x.track.el.getBoundingClientRect();
|
|
161
|
+
_this.axis.y.track.rect = _this.axis.y.track.el.getBoundingClientRect();
|
|
162
|
+
|
|
163
|
+
if (!_this.isWithinBounds(_this.axis.y.track.rect)) {
|
|
164
|
+
_this.axis.y.scrollbar.el.classList.remove(_this.classNames.visible);
|
|
165
|
+
|
|
166
|
+
_this.axis.y.isVisible = false;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (!_this.isWithinBounds(_this.axis.x.track.rect)) {
|
|
170
|
+
_this.axis.x.scrollbar.el.classList.remove(_this.classNames.visible);
|
|
171
|
+
|
|
172
|
+
_this.axis.x.isVisible = false;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
this.onPointerEvent = function (e) {
|
|
177
|
+
var isWithinTrackXBounds, isWithinTrackYBounds;
|
|
178
|
+
_this.axis.x.track.rect = _this.axis.x.track.el.getBoundingClientRect();
|
|
179
|
+
_this.axis.y.track.rect = _this.axis.y.track.el.getBoundingClientRect();
|
|
180
|
+
|
|
181
|
+
if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
|
|
182
|
+
isWithinTrackXBounds = _this.isWithinBounds(_this.axis.x.track.rect);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
|
|
186
|
+
isWithinTrackYBounds = _this.isWithinBounds(_this.axis.y.track.rect);
|
|
187
|
+
} // If any pointer event is called on the scrollbar
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
if (isWithinTrackXBounds || isWithinTrackYBounds) {
|
|
191
|
+
// Preventing the event's default action stops text being
|
|
192
|
+
// selectable during the drag.
|
|
193
|
+
e.preventDefault(); // Prevent event leaking
|
|
194
|
+
|
|
195
|
+
e.stopPropagation();
|
|
196
|
+
|
|
197
|
+
if (e.type === 'mousedown') {
|
|
198
|
+
if (isWithinTrackXBounds) {
|
|
199
|
+
_this.axis.x.scrollbar.rect = _this.axis.x.scrollbar.el.getBoundingClientRect();
|
|
200
|
+
|
|
201
|
+
if (_this.isWithinBounds(_this.axis.x.scrollbar.rect)) {
|
|
202
|
+
_this.onDragStart(e, 'x');
|
|
203
|
+
} else {
|
|
204
|
+
_this.onTrackClick(e, 'x');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (isWithinTrackYBounds) {
|
|
209
|
+
_this.axis.y.scrollbar.rect = _this.axis.y.scrollbar.el.getBoundingClientRect();
|
|
210
|
+
|
|
211
|
+
if (_this.isWithinBounds(_this.axis.y.scrollbar.rect)) {
|
|
212
|
+
_this.onDragStart(e, 'y');
|
|
213
|
+
} else {
|
|
214
|
+
_this.onTrackClick(e, 'y');
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
this.drag = function (e) {
|
|
222
|
+
var eventOffset;
|
|
223
|
+
var track = _this.axis[_this.draggedAxis].track;
|
|
224
|
+
var trackSize = track.rect[_this.axis[_this.draggedAxis].sizeAttr];
|
|
225
|
+
var scrollbar = _this.axis[_this.draggedAxis].scrollbar;
|
|
226
|
+
var contentSize = _this.contentWrapperEl[_this.axis[_this.draggedAxis].scrollSizeAttr];
|
|
227
|
+
var hostSize = parseInt(_this.elStyles[_this.axis[_this.draggedAxis].sizeAttr], 10);
|
|
228
|
+
e.preventDefault();
|
|
229
|
+
e.stopPropagation();
|
|
230
|
+
|
|
231
|
+
if (_this.draggedAxis === 'y') {
|
|
232
|
+
eventOffset = e.pageY;
|
|
233
|
+
} else {
|
|
234
|
+
eventOffset = e.pageX;
|
|
235
|
+
} // Calculate how far the user's mouse is from the top/left of the scrollbar (minus the dragOffset).
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
var dragPos = eventOffset - track.rect[_this.axis[_this.draggedAxis].offsetAttr] - _this.axis[_this.draggedAxis].dragOffset; // Convert the mouse position into a percentage of the scrollbar height/width.
|
|
239
|
+
|
|
240
|
+
var dragPerc = dragPos / (trackSize - scrollbar.size); // Scroll the content by the same percentage.
|
|
241
|
+
|
|
242
|
+
var scrollPos = dragPerc * (contentSize - hostSize); // Fix browsers inconsistency on RTL
|
|
243
|
+
|
|
244
|
+
if (_this.draggedAxis === 'x') {
|
|
245
|
+
scrollPos = _this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollbarInverted ? scrollPos - (trackSize + scrollbar.size) : scrollPos;
|
|
246
|
+
scrollPos = _this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollingInverted ? -scrollPos : scrollPos;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
_this.contentWrapperEl[_this.axis[_this.draggedAxis].scrollOffsetAttr] = scrollPos;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
this.onEndDrag = function (e) {
|
|
253
|
+
var elDocument = getElementDocument(_this.el);
|
|
254
|
+
var elWindow = getElementWindow(_this.el);
|
|
255
|
+
e.preventDefault();
|
|
256
|
+
e.stopPropagation();
|
|
257
|
+
|
|
258
|
+
_this.el.classList.remove(_this.classNames.dragging);
|
|
259
|
+
|
|
260
|
+
elDocument.removeEventListener('mousemove', _this.drag, true);
|
|
261
|
+
elDocument.removeEventListener('mouseup', _this.onEndDrag, true);
|
|
262
|
+
_this.removePreventClickId = elWindow.setTimeout(function () {
|
|
263
|
+
// Remove these asynchronously so we still suppress click events
|
|
264
|
+
// generated simultaneously with mouseup.
|
|
265
|
+
elDocument.removeEventListener('click', _this.preventClick, true);
|
|
266
|
+
elDocument.removeEventListener('dblclick', _this.preventClick, true);
|
|
267
|
+
_this.removePreventClickId = null;
|
|
268
|
+
});
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
this.preventClick = function (e) {
|
|
272
|
+
e.preventDefault();
|
|
273
|
+
e.stopPropagation();
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
this.el = element;
|
|
277
|
+
this.minScrollbarWidth = 20;
|
|
278
|
+
this.options = Object.assign({}, SimpleBar.defaultOptions, {}, options);
|
|
279
|
+
this.classNames = Object.assign({}, SimpleBar.defaultOptions.classNames, {}, this.options.classNames);
|
|
280
|
+
this.axis = {
|
|
281
|
+
x: {
|
|
282
|
+
scrollOffsetAttr: 'scrollLeft',
|
|
283
|
+
sizeAttr: 'width',
|
|
284
|
+
scrollSizeAttr: 'scrollWidth',
|
|
285
|
+
offsetSizeAttr: 'offsetWidth',
|
|
286
|
+
offsetAttr: 'left',
|
|
287
|
+
overflowAttr: 'overflowX',
|
|
288
|
+
dragOffset: 0,
|
|
289
|
+
isOverflowing: true,
|
|
290
|
+
isVisible: false,
|
|
291
|
+
forceVisible: false,
|
|
292
|
+
track: {},
|
|
293
|
+
scrollbar: {}
|
|
294
|
+
},
|
|
295
|
+
y: {
|
|
296
|
+
scrollOffsetAttr: 'scrollTop',
|
|
297
|
+
sizeAttr: 'height',
|
|
298
|
+
scrollSizeAttr: 'scrollHeight',
|
|
299
|
+
offsetSizeAttr: 'offsetHeight',
|
|
300
|
+
offsetAttr: 'top',
|
|
301
|
+
overflowAttr: 'overflowY',
|
|
302
|
+
dragOffset: 0,
|
|
303
|
+
isOverflowing: true,
|
|
304
|
+
isVisible: false,
|
|
305
|
+
forceVisible: false,
|
|
306
|
+
track: {},
|
|
307
|
+
scrollbar: {}
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
this.removePreventClickId = null; // Don't re-instantiate over an existing one
|
|
311
|
+
|
|
312
|
+
if (SimpleBar.instances.has(this.el)) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
this.recalculate = throttle(this.recalculate.bind(this), 64);
|
|
317
|
+
this.onMouseMove = throttle(this.onMouseMove.bind(this), 64);
|
|
318
|
+
this.hideScrollbars = debounce(this.hideScrollbars.bind(this), this.options.timeout);
|
|
319
|
+
this.onWindowResize = debounce(this.onWindowResize.bind(this), 64, {
|
|
320
|
+
leading: true
|
|
321
|
+
});
|
|
322
|
+
SimpleBar.getRtlHelpers = memoize(SimpleBar.getRtlHelpers);
|
|
323
|
+
this.init();
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Static properties
|
|
327
|
+
*/
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Helper to fix browsers inconsistency on RTL:
|
|
331
|
+
* - Firefox inverts the scrollbar initial position
|
|
332
|
+
* - IE11 inverts both scrollbar position and scrolling offset
|
|
333
|
+
* Directly inspired by @KingSora's OverlayScrollbars https://github.com/KingSora/OverlayScrollbars/blob/master/js/OverlayScrollbars.js#L1634
|
|
334
|
+
*/
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
SimpleBar.getRtlHelpers = function getRtlHelpers() {
|
|
338
|
+
var dummyDiv = document.createElement('div');
|
|
339
|
+
dummyDiv.innerHTML = '<div class="hs-dummy-scrollbar-size"><div style="height: 200%; width: 200%; margin: 10px 0;"></div></div>';
|
|
340
|
+
var scrollbarDummyEl = dummyDiv.firstElementChild;
|
|
341
|
+
document.body.appendChild(scrollbarDummyEl);
|
|
342
|
+
var dummyContainerChild = scrollbarDummyEl.firstElementChild;
|
|
343
|
+
scrollbarDummyEl.scrollLeft = 0;
|
|
344
|
+
var dummyContainerOffset = SimpleBar.getOffset(scrollbarDummyEl);
|
|
345
|
+
var dummyContainerChildOffset = SimpleBar.getOffset(dummyContainerChild);
|
|
346
|
+
scrollbarDummyEl.scrollLeft = 999;
|
|
347
|
+
var dummyContainerScrollOffsetAfterScroll = SimpleBar.getOffset(dummyContainerChild);
|
|
348
|
+
return {
|
|
349
|
+
// determines if the scrolling is responding with negative values
|
|
350
|
+
isRtlScrollingInverted: dummyContainerOffset.left !== dummyContainerChildOffset.left && dummyContainerChildOffset.left - dummyContainerScrollOffsetAfterScroll.left !== 0,
|
|
351
|
+
// determines if the origin scrollbar position is inverted or not (positioned on left or right)
|
|
352
|
+
isRtlScrollbarInverted: dummyContainerOffset.left !== dummyContainerChildOffset.left
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
SimpleBar.getOffset = function getOffset(el) {
|
|
357
|
+
var rect = el.getBoundingClientRect();
|
|
358
|
+
var elDocument = getElementDocument(el);
|
|
359
|
+
var elWindow = getElementWindow(el);
|
|
360
|
+
return {
|
|
361
|
+
top: rect.top + (elWindow.pageYOffset || elDocument.documentElement.scrollTop),
|
|
362
|
+
left: rect.left + (elWindow.pageXOffset || elDocument.documentElement.scrollLeft)
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
var _proto = SimpleBar.prototype;
|
|
367
|
+
|
|
368
|
+
_proto.init = function init() {
|
|
369
|
+
// Save a reference to the instance, so we know this DOM node has already been instancied
|
|
370
|
+
SimpleBar.instances.set(this.el, this); // We stop here on server-side
|
|
371
|
+
|
|
372
|
+
if (canUseDOM) {
|
|
373
|
+
this.initDOM();
|
|
374
|
+
this.scrollbarWidth = this.getScrollbarWidth();
|
|
375
|
+
this.recalculate();
|
|
376
|
+
this.initListeners();
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
_proto.initDOM = function initDOM() {
|
|
381
|
+
var _this2 = this;
|
|
382
|
+
|
|
383
|
+
// make sure this element doesn't have the elements yet
|
|
384
|
+
if (Array.prototype.filter.call(this.el.children, function (child) {
|
|
385
|
+
return child.classList.contains(_this2.classNames.wrapper);
|
|
386
|
+
}).length) {
|
|
387
|
+
// assume that element has his DOM already initiated
|
|
388
|
+
this.wrapperEl = this.el.querySelector("." + this.classNames.wrapper);
|
|
389
|
+
this.contentWrapperEl = this.options.scrollableNode || this.el.querySelector("." + this.classNames.contentWrapper);
|
|
390
|
+
this.contentEl = this.options.contentNode || this.el.querySelector("." + this.classNames.contentEl);
|
|
391
|
+
this.offsetEl = this.el.querySelector("." + this.classNames.offset);
|
|
392
|
+
this.maskEl = this.el.querySelector("." + this.classNames.mask);
|
|
393
|
+
this.placeholderEl = this.findChild(this.wrapperEl, "." + this.classNames.placeholder);
|
|
394
|
+
this.heightAutoObserverWrapperEl = this.el.querySelector("." + this.classNames.heightAutoObserverWrapperEl);
|
|
395
|
+
this.heightAutoObserverEl = this.el.querySelector("." + this.classNames.heightAutoObserverEl);
|
|
396
|
+
this.axis.x.track.el = this.findChild(this.el, "." + this.classNames.track + "." + this.classNames.horizontal);
|
|
397
|
+
this.axis.y.track.el = this.findChild(this.el, "." + this.classNames.track + "." + this.classNames.vertical);
|
|
398
|
+
} else {
|
|
399
|
+
// Prepare DOM
|
|
400
|
+
this.wrapperEl = document.createElement('div');
|
|
401
|
+
this.contentWrapperEl = document.createElement('div');
|
|
402
|
+
this.offsetEl = document.createElement('div');
|
|
403
|
+
this.maskEl = document.createElement('div');
|
|
404
|
+
this.contentEl = document.createElement('div');
|
|
405
|
+
this.placeholderEl = document.createElement('div');
|
|
406
|
+
this.heightAutoObserverWrapperEl = document.createElement('div');
|
|
407
|
+
this.heightAutoObserverEl = document.createElement('div');
|
|
408
|
+
this.wrapperEl.classList.add(this.classNames.wrapper);
|
|
409
|
+
this.contentWrapperEl.classList.add(this.classNames.contentWrapper);
|
|
410
|
+
this.offsetEl.classList.add(this.classNames.offset);
|
|
411
|
+
this.maskEl.classList.add(this.classNames.mask);
|
|
412
|
+
this.contentEl.classList.add(this.classNames.contentEl);
|
|
413
|
+
this.placeholderEl.classList.add(this.classNames.placeholder);
|
|
414
|
+
this.heightAutoObserverWrapperEl.classList.add(this.classNames.heightAutoObserverWrapperEl);
|
|
415
|
+
this.heightAutoObserverEl.classList.add(this.classNames.heightAutoObserverEl);
|
|
416
|
+
|
|
417
|
+
while (this.el.firstChild) {
|
|
418
|
+
this.contentEl.appendChild(this.el.firstChild);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
this.contentWrapperEl.appendChild(this.contentEl);
|
|
422
|
+
this.offsetEl.appendChild(this.contentWrapperEl);
|
|
423
|
+
this.maskEl.appendChild(this.offsetEl);
|
|
424
|
+
this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl);
|
|
425
|
+
this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl);
|
|
426
|
+
this.wrapperEl.appendChild(this.maskEl);
|
|
427
|
+
this.wrapperEl.appendChild(this.placeholderEl);
|
|
428
|
+
this.el.appendChild(this.wrapperEl);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
if (!this.axis.x.track.el || !this.axis.y.track.el) {
|
|
432
|
+
var track = document.createElement('div');
|
|
433
|
+
var scrollbar = document.createElement('div');
|
|
434
|
+
track.classList.add(this.classNames.track);
|
|
435
|
+
scrollbar.classList.add(this.classNames.scrollbar);
|
|
436
|
+
track.appendChild(scrollbar);
|
|
437
|
+
this.axis.x.track.el = track.cloneNode(true);
|
|
438
|
+
this.axis.x.track.el.classList.add(this.classNames.horizontal);
|
|
439
|
+
this.axis.y.track.el = track.cloneNode(true);
|
|
440
|
+
this.axis.y.track.el.classList.add(this.classNames.vertical);
|
|
441
|
+
this.el.appendChild(this.axis.x.track.el);
|
|
442
|
+
this.el.appendChild(this.axis.y.track.el);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
this.axis.x.scrollbar.el = this.axis.x.track.el.querySelector("." + this.classNames.scrollbar);
|
|
446
|
+
this.axis.y.scrollbar.el = this.axis.y.track.el.querySelector("." + this.classNames.scrollbar);
|
|
447
|
+
|
|
448
|
+
if (!this.options.autoHide) {
|
|
449
|
+
this.axis.x.scrollbar.el.classList.add(this.classNames.visible);
|
|
450
|
+
this.axis.y.scrollbar.el.classList.add(this.classNames.visible);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
this.el.setAttribute('data-simplebar', 'init');
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
_proto.initListeners = function initListeners() {
|
|
457
|
+
var _this3 = this;
|
|
458
|
+
|
|
459
|
+
var elWindow = getElementWindow(this.el); // Event listeners
|
|
460
|
+
|
|
461
|
+
if (this.options.autoHide) {
|
|
462
|
+
this.el.addEventListener('mouseenter', this.onMouseEnter);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
['mousedown', 'click', 'dblclick'].forEach(function (e) {
|
|
466
|
+
_this3.el.addEventListener(e, _this3.onPointerEvent, true);
|
|
467
|
+
});
|
|
468
|
+
['touchstart', 'touchend', 'touchmove'].forEach(function (e) {
|
|
469
|
+
_this3.el.addEventListener(e, _this3.onPointerEvent, {
|
|
470
|
+
capture: true,
|
|
471
|
+
passive: true
|
|
472
|
+
});
|
|
473
|
+
});
|
|
474
|
+
this.el.addEventListener('mousemove', this.onMouseMove);
|
|
475
|
+
this.el.addEventListener('mouseleave', this.onMouseLeave);
|
|
476
|
+
this.contentWrapperEl.addEventListener('scroll', this.onScroll); // Browser zoom triggers a window resize
|
|
477
|
+
|
|
478
|
+
elWindow.addEventListener('resize', this.onWindowResize); // Hack for https://github.com/WICG/ResizeObserver/issues/38
|
|
479
|
+
|
|
480
|
+
var resizeObserverStarted = false;
|
|
481
|
+
var resizeObserver = elWindow.ResizeObserver || ResizeObserver;
|
|
482
|
+
this.resizeObserver = new resizeObserver(function () {
|
|
483
|
+
if (!resizeObserverStarted) return;
|
|
484
|
+
|
|
485
|
+
_this3.recalculate();
|
|
486
|
+
});
|
|
487
|
+
this.resizeObserver.observe(this.el);
|
|
488
|
+
this.resizeObserver.observe(this.contentEl);
|
|
489
|
+
elWindow.requestAnimationFrame(function () {
|
|
490
|
+
resizeObserverStarted = true;
|
|
491
|
+
}); // This is required to detect horizontal scroll. Vertical scroll only needs the resizeObserver.
|
|
492
|
+
|
|
493
|
+
this.mutationObserver = new elWindow.MutationObserver(this.recalculate);
|
|
494
|
+
this.mutationObserver.observe(this.contentEl, {
|
|
495
|
+
childList: true,
|
|
496
|
+
subtree: true,
|
|
497
|
+
characterData: true
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
_proto.recalculate = function recalculate() {
|
|
502
|
+
var elWindow = getElementWindow(this.el);
|
|
503
|
+
this.elStyles = elWindow.getComputedStyle(this.el);
|
|
504
|
+
this.isRtl = this.elStyles.direction === 'rtl';
|
|
505
|
+
var isHeightAuto = this.heightAutoObserverEl.offsetHeight <= 1;
|
|
506
|
+
var isWidthAuto = this.heightAutoObserverEl.offsetWidth <= 1;
|
|
507
|
+
var contentElOffsetWidth = this.contentEl.offsetWidth;
|
|
508
|
+
var contentWrapperElOffsetWidth = this.contentWrapperEl.offsetWidth;
|
|
509
|
+
var elOverflowX = this.elStyles.overflowX;
|
|
510
|
+
var elOverflowY = this.elStyles.overflowY;
|
|
511
|
+
this.contentEl.style.padding = this.elStyles.paddingTop + " " + this.elStyles.paddingRight + " " + this.elStyles.paddingBottom + " " + this.elStyles.paddingLeft;
|
|
512
|
+
this.wrapperEl.style.margin = "-" + this.elStyles.paddingTop + " -" + this.elStyles.paddingRight + " -" + this.elStyles.paddingBottom + " -" + this.elStyles.paddingLeft;
|
|
513
|
+
var contentElScrollHeight = this.contentEl.scrollHeight;
|
|
514
|
+
var contentElScrollWidth = this.contentEl.scrollWidth;
|
|
515
|
+
this.contentWrapperEl.style.height = isHeightAuto ? 'auto' : '100%'; // Determine placeholder size
|
|
516
|
+
|
|
517
|
+
this.placeholderEl.style.width = isWidthAuto ? contentElOffsetWidth + "px" : 'auto';
|
|
518
|
+
this.placeholderEl.style.height = contentElScrollHeight + "px";
|
|
519
|
+
var contentWrapperElOffsetHeight = this.contentWrapperEl.offsetHeight;
|
|
520
|
+
this.axis.x.isOverflowing = contentElScrollWidth > contentElOffsetWidth;
|
|
521
|
+
this.axis.y.isOverflowing = contentElScrollHeight > contentWrapperElOffsetHeight; // Set isOverflowing to false if user explicitely set hidden overflow
|
|
522
|
+
|
|
523
|
+
this.axis.x.isOverflowing = elOverflowX === 'hidden' ? false : this.axis.x.isOverflowing;
|
|
524
|
+
this.axis.y.isOverflowing = elOverflowY === 'hidden' ? false : this.axis.y.isOverflowing;
|
|
525
|
+
this.axis.x.forceVisible = this.options.forceVisible === 'x' || this.options.forceVisible === true;
|
|
526
|
+
this.axis.y.forceVisible = this.options.forceVisible === 'y' || this.options.forceVisible === true;
|
|
527
|
+
this.hideNativeScrollbar(); // Set isOverflowing to false if scrollbar is not necessary (content is shorter than offset)
|
|
528
|
+
|
|
529
|
+
var offsetForXScrollbar = this.axis.x.isOverflowing ? this.scrollbarWidth : 0;
|
|
530
|
+
var offsetForYScrollbar = this.axis.y.isOverflowing ? this.scrollbarWidth : 0;
|
|
531
|
+
this.axis.x.isOverflowing = this.axis.x.isOverflowing && contentElScrollWidth > contentWrapperElOffsetWidth - offsetForYScrollbar;
|
|
532
|
+
this.axis.y.isOverflowing = this.axis.y.isOverflowing && contentElScrollHeight > contentWrapperElOffsetHeight - offsetForXScrollbar;
|
|
533
|
+
this.axis.x.scrollbar.size = this.getScrollbarSize('x');
|
|
534
|
+
this.axis.y.scrollbar.size = this.getScrollbarSize('y');
|
|
535
|
+
this.axis.x.scrollbar.el.style.width = this.axis.x.scrollbar.size + "px";
|
|
536
|
+
this.axis.y.scrollbar.el.style.height = this.axis.y.scrollbar.size + "px";
|
|
537
|
+
this.positionScrollbar('x');
|
|
538
|
+
this.positionScrollbar('y');
|
|
539
|
+
this.toggleTrackVisibility('x');
|
|
540
|
+
this.toggleTrackVisibility('y');
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Calculate scrollbar size
|
|
544
|
+
*/
|
|
545
|
+
;
|
|
546
|
+
|
|
547
|
+
_proto.getScrollbarSize = function getScrollbarSize(axis) {
|
|
548
|
+
if (axis === void 0) {
|
|
549
|
+
axis = 'y';
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
if (!this.axis[axis].isOverflowing) {
|
|
553
|
+
return 0;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
var contentSize = this.contentEl[this.axis[axis].scrollSizeAttr];
|
|
557
|
+
var trackSize = this.axis[axis].track.el[this.axis[axis].offsetSizeAttr];
|
|
558
|
+
var scrollbarSize;
|
|
559
|
+
var scrollbarRatio = trackSize / contentSize; // Calculate new height/position of drag handle.
|
|
560
|
+
|
|
561
|
+
scrollbarSize = Math.max(~~(scrollbarRatio * trackSize), this.options.scrollbarMinSize);
|
|
562
|
+
|
|
563
|
+
if (this.options.scrollbarMaxSize) {
|
|
564
|
+
scrollbarSize = Math.min(scrollbarSize, this.options.scrollbarMaxSize);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
return scrollbarSize;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
_proto.positionScrollbar = function positionScrollbar(axis) {
|
|
571
|
+
if (axis === void 0) {
|
|
572
|
+
axis = 'y';
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
if (!this.axis[axis].isOverflowing) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
var contentSize = this.contentWrapperEl[this.axis[axis].scrollSizeAttr];
|
|
580
|
+
var trackSize = this.axis[axis].track.el[this.axis[axis].offsetSizeAttr];
|
|
581
|
+
var hostSize = parseInt(this.elStyles[this.axis[axis].sizeAttr], 10);
|
|
582
|
+
var scrollbar = this.axis[axis].scrollbar;
|
|
583
|
+
var scrollOffset = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr];
|
|
584
|
+
scrollOffset = axis === 'x' && this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollingInverted ? -scrollOffset : scrollOffset;
|
|
585
|
+
var scrollPourcent = scrollOffset / (contentSize - hostSize);
|
|
586
|
+
var handleOffset = ~~((trackSize - scrollbar.size) * scrollPourcent);
|
|
587
|
+
handleOffset = axis === 'x' && this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollbarInverted ? handleOffset + (trackSize - scrollbar.size) : handleOffset;
|
|
588
|
+
scrollbar.el.style.transform = axis === 'x' ? "translate3d(" + handleOffset + "px, 0, 0)" : "translate3d(0, " + handleOffset + "px, 0)";
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
_proto.toggleTrackVisibility = function toggleTrackVisibility(axis) {
|
|
592
|
+
if (axis === void 0) {
|
|
593
|
+
axis = 'y';
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
var track = this.axis[axis].track.el;
|
|
597
|
+
var scrollbar = this.axis[axis].scrollbar.el;
|
|
598
|
+
|
|
599
|
+
if (this.axis[axis].isOverflowing || this.axis[axis].forceVisible) {
|
|
600
|
+
track.style.visibility = 'visible';
|
|
601
|
+
this.contentWrapperEl.style[this.axis[axis].overflowAttr] = 'scroll';
|
|
602
|
+
} else {
|
|
603
|
+
track.style.visibility = 'hidden';
|
|
604
|
+
this.contentWrapperEl.style[this.axis[axis].overflowAttr] = 'hidden';
|
|
605
|
+
} // Even if forceVisible is enabled, scrollbar itself should be hidden
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
if (this.axis[axis].isOverflowing) {
|
|
609
|
+
scrollbar.style.display = 'block';
|
|
610
|
+
} else {
|
|
611
|
+
scrollbar.style.display = 'none';
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
_proto.hideNativeScrollbar = function hideNativeScrollbar() {
|
|
616
|
+
this.offsetEl.style[this.isRtl ? 'left' : 'right'] = this.axis.y.isOverflowing || this.axis.y.forceVisible ? "-" + this.scrollbarWidth + "px" : 0;
|
|
617
|
+
this.offsetEl.style.bottom = this.axis.x.isOverflowing || this.axis.x.forceVisible ? "-" + this.scrollbarWidth + "px" : 0;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* On scroll event handling
|
|
621
|
+
*/
|
|
622
|
+
;
|
|
623
|
+
|
|
624
|
+
_proto.onMouseMoveForAxis = function onMouseMoveForAxis(axis) {
|
|
625
|
+
if (axis === void 0) {
|
|
626
|
+
axis = 'y';
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
this.axis[axis].track.rect = this.axis[axis].track.el.getBoundingClientRect();
|
|
630
|
+
this.axis[axis].scrollbar.rect = this.axis[axis].scrollbar.el.getBoundingClientRect();
|
|
631
|
+
var isWithinScrollbarBoundsX = this.isWithinBounds(this.axis[axis].scrollbar.rect);
|
|
632
|
+
|
|
633
|
+
if (isWithinScrollbarBoundsX) {
|
|
634
|
+
this.axis[axis].scrollbar.el.classList.add(this.classNames.hover);
|
|
635
|
+
} else {
|
|
636
|
+
this.axis[axis].scrollbar.el.classList.remove(this.classNames.hover);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
if (this.isWithinBounds(this.axis[axis].track.rect)) {
|
|
640
|
+
this.showScrollbar(axis);
|
|
641
|
+
this.axis[axis].track.el.classList.add(this.classNames.hover);
|
|
642
|
+
} else {
|
|
643
|
+
this.axis[axis].track.el.classList.remove(this.classNames.hover);
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
_proto.onMouseLeaveForAxis = function onMouseLeaveForAxis(axis) {
|
|
648
|
+
if (axis === void 0) {
|
|
649
|
+
axis = 'y';
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
this.axis[axis].track.el.classList.remove(this.classNames.hover);
|
|
653
|
+
this.axis[axis].scrollbar.el.classList.remove(this.classNames.hover);
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Show scrollbar
|
|
658
|
+
*/
|
|
659
|
+
_proto.showScrollbar = function showScrollbar(axis) {
|
|
660
|
+
if (axis === void 0) {
|
|
661
|
+
axis = 'y';
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
var scrollbar = this.axis[axis].scrollbar.el;
|
|
665
|
+
|
|
666
|
+
if (!this.axis[axis].isVisible) {
|
|
667
|
+
scrollbar.classList.add(this.classNames.visible);
|
|
668
|
+
this.axis[axis].isVisible = true;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
if (this.options.autoHide) {
|
|
672
|
+
this.hideScrollbars();
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Hide Scrollbar
|
|
677
|
+
*/
|
|
678
|
+
;
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* on scrollbar handle drag movement starts
|
|
682
|
+
*/
|
|
683
|
+
_proto.onDragStart = function onDragStart(e, axis) {
|
|
684
|
+
if (axis === void 0) {
|
|
685
|
+
axis = 'y';
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
var elDocument = getElementDocument(this.el);
|
|
689
|
+
var elWindow = getElementWindow(this.el);
|
|
690
|
+
var scrollbar = this.axis[axis].scrollbar; // Measure how far the user's mouse is from the top of the scrollbar drag handle.
|
|
691
|
+
|
|
692
|
+
var eventOffset = axis === 'y' ? e.pageY : e.pageX;
|
|
693
|
+
this.axis[axis].dragOffset = eventOffset - scrollbar.rect[this.axis[axis].offsetAttr];
|
|
694
|
+
this.draggedAxis = axis;
|
|
695
|
+
this.el.classList.add(this.classNames.dragging);
|
|
696
|
+
elDocument.addEventListener('mousemove', this.drag, true);
|
|
697
|
+
elDocument.addEventListener('mouseup', this.onEndDrag, true);
|
|
698
|
+
|
|
699
|
+
if (this.removePreventClickId === null) {
|
|
700
|
+
elDocument.addEventListener('click', this.preventClick, true);
|
|
701
|
+
elDocument.addEventListener('dblclick', this.preventClick, true);
|
|
702
|
+
} else {
|
|
703
|
+
elWindow.clearTimeout(this.removePreventClickId);
|
|
704
|
+
this.removePreventClickId = null;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Drag scrollbar handle
|
|
709
|
+
*/
|
|
710
|
+
;
|
|
711
|
+
|
|
712
|
+
_proto.onTrackClick = function onTrackClick(e, axis) {
|
|
713
|
+
var _this4 = this;
|
|
714
|
+
|
|
715
|
+
if (axis === void 0) {
|
|
716
|
+
axis = 'y';
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
if (!this.options.clickOnTrack) return;
|
|
720
|
+
var elWindow = getElementWindow(this.el);
|
|
721
|
+
this.axis[axis].scrollbar.rect = this.axis[axis].scrollbar.el.getBoundingClientRect();
|
|
722
|
+
var scrollbar = this.axis[axis].scrollbar;
|
|
723
|
+
var scrollbarOffset = scrollbar.rect[this.axis[axis].offsetAttr];
|
|
724
|
+
var hostSize = parseInt(this.elStyles[this.axis[axis].sizeAttr], 10);
|
|
725
|
+
var scrolled = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr];
|
|
726
|
+
var t = axis === 'y' ? this.mouseY - scrollbarOffset : this.mouseX - scrollbarOffset;
|
|
727
|
+
var dir = t < 0 ? -1 : 1;
|
|
728
|
+
var scrollSize = dir === -1 ? scrolled - hostSize : scrolled + hostSize;
|
|
729
|
+
|
|
730
|
+
var scrollTo = function scrollTo() {
|
|
731
|
+
if (dir === -1) {
|
|
732
|
+
if (scrolled > scrollSize) {
|
|
733
|
+
var _this4$contentWrapper;
|
|
734
|
+
|
|
735
|
+
scrolled -= _this4.options.clickOnTrackSpeed;
|
|
736
|
+
|
|
737
|
+
_this4.contentWrapperEl.scrollTo((_this4$contentWrapper = {}, _this4$contentWrapper[_this4.axis[axis].offsetAttr] = scrolled, _this4$contentWrapper));
|
|
738
|
+
|
|
739
|
+
elWindow.requestAnimationFrame(scrollTo);
|
|
740
|
+
}
|
|
741
|
+
} else {
|
|
742
|
+
if (scrolled < scrollSize) {
|
|
743
|
+
var _this4$contentWrapper2;
|
|
744
|
+
|
|
745
|
+
scrolled += _this4.options.clickOnTrackSpeed;
|
|
746
|
+
|
|
747
|
+
_this4.contentWrapperEl.scrollTo((_this4$contentWrapper2 = {}, _this4$contentWrapper2[_this4.axis[axis].offsetAttr] = scrolled, _this4$contentWrapper2));
|
|
748
|
+
|
|
749
|
+
elWindow.requestAnimationFrame(scrollTo);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
scrollTo();
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Getter for content element
|
|
758
|
+
*/
|
|
759
|
+
;
|
|
760
|
+
|
|
761
|
+
_proto.getContentElement = function getContentElement() {
|
|
762
|
+
return this.contentEl;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Getter for original scrolling element
|
|
766
|
+
*/
|
|
767
|
+
;
|
|
768
|
+
|
|
769
|
+
_proto.getScrollElement = function getScrollElement() {
|
|
770
|
+
return this.contentWrapperEl;
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
_proto.getScrollbarWidth = function getScrollbarWidth() {
|
|
774
|
+
// Try/catch for FF 56 throwing on undefined computedStyles
|
|
775
|
+
try {
|
|
776
|
+
// Detect browsers supporting CSS scrollbar styling and do not calculate
|
|
777
|
+
if (getComputedStyle(this.contentWrapperEl, '::-webkit-scrollbar').display === 'none' || 'scrollbarWidth' in document.documentElement.style || '-ms-overflow-style' in document.documentElement.style) {
|
|
778
|
+
return 0;
|
|
779
|
+
} else {
|
|
780
|
+
return scrollbarWidth(this.el);
|
|
781
|
+
}
|
|
782
|
+
} catch (e) {
|
|
783
|
+
return scrollbarWidth(this.el);
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
_proto.removeListeners = function removeListeners() {
|
|
788
|
+
var _this5 = this;
|
|
789
|
+
|
|
790
|
+
var elWindow = getElementWindow(this.el); // Event listeners
|
|
791
|
+
|
|
792
|
+
if (this.options.autoHide) {
|
|
793
|
+
this.el.removeEventListener('mouseenter', this.onMouseEnter);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
['mousedown', 'click', 'dblclick'].forEach(function (e) {
|
|
797
|
+
_this5.el.removeEventListener(e, _this5.onPointerEvent, true);
|
|
798
|
+
});
|
|
799
|
+
['touchstart', 'touchend', 'touchmove'].forEach(function (e) {
|
|
800
|
+
_this5.el.removeEventListener(e, _this5.onPointerEvent, {
|
|
801
|
+
capture: true,
|
|
802
|
+
passive: true
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
this.el.removeEventListener('mousemove', this.onMouseMove);
|
|
806
|
+
this.el.removeEventListener('mouseleave', this.onMouseLeave);
|
|
807
|
+
|
|
808
|
+
if (this.contentWrapperEl) {
|
|
809
|
+
this.contentWrapperEl.removeEventListener('scroll', this.onScroll);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
elWindow.removeEventListener('resize', this.onWindowResize);
|
|
813
|
+
|
|
814
|
+
if (this.mutationObserver) {
|
|
815
|
+
this.mutationObserver.disconnect();
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
if (this.resizeObserver) {
|
|
819
|
+
this.resizeObserver.disconnect();
|
|
820
|
+
} // Cancel all debounced functions
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
this.recalculate.cancel();
|
|
824
|
+
this.onMouseMove.cancel();
|
|
825
|
+
this.hideScrollbars.cancel();
|
|
826
|
+
this.onWindowResize.cancel();
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* UnMount mutation observer and delete SimpleBar instance from DOM element
|
|
830
|
+
*/
|
|
831
|
+
;
|
|
832
|
+
|
|
833
|
+
_proto.unMount = function unMount() {
|
|
834
|
+
this.removeListeners();
|
|
835
|
+
SimpleBar.instances.delete(this.el);
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Check if mouse is within bounds
|
|
839
|
+
*/
|
|
840
|
+
;
|
|
841
|
+
|
|
842
|
+
_proto.isWithinBounds = function isWithinBounds(bbox) {
|
|
843
|
+
return this.mouseX >= bbox.left && this.mouseX <= bbox.left + bbox.width && this.mouseY >= bbox.top && this.mouseY <= bbox.top + bbox.height;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Find element children matches query
|
|
847
|
+
*/
|
|
848
|
+
;
|
|
849
|
+
|
|
850
|
+
_proto.findChild = function findChild(el, query) {
|
|
851
|
+
var matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
|
|
852
|
+
return Array.prototype.filter.call(el.children, function (child) {
|
|
853
|
+
return matches.call(child, query);
|
|
854
|
+
})[0];
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
return SimpleBar;
|
|
858
|
+
}();
|
|
859
|
+
|
|
860
|
+
SimpleBar.defaultOptions = {
|
|
861
|
+
autoHide: true,
|
|
862
|
+
forceVisible: false,
|
|
863
|
+
clickOnTrack: true,
|
|
864
|
+
clickOnTrackSpeed: 40,
|
|
865
|
+
classNames: {
|
|
866
|
+
contentEl: 'simplebar-content',
|
|
867
|
+
contentWrapper: 'simplebar-content-wrapper',
|
|
868
|
+
offset: 'simplebar-offset',
|
|
869
|
+
mask: 'simplebar-mask',
|
|
870
|
+
wrapper: 'simplebar-wrapper',
|
|
871
|
+
placeholder: 'simplebar-placeholder',
|
|
872
|
+
scrollbar: 'simplebar-scrollbar',
|
|
873
|
+
track: 'simplebar-track',
|
|
874
|
+
heightAutoObserverWrapperEl: 'simplebar-height-auto-observer-wrapper',
|
|
875
|
+
heightAutoObserverEl: 'simplebar-height-auto-observer',
|
|
876
|
+
visible: 'simplebar-visible',
|
|
877
|
+
horizontal: 'simplebar-horizontal',
|
|
878
|
+
vertical: 'simplebar-vertical',
|
|
879
|
+
hover: 'simplebar-hover',
|
|
880
|
+
dragging: 'simplebar-dragging'
|
|
881
|
+
},
|
|
882
|
+
scrollbarMinSize: 25,
|
|
883
|
+
scrollbarMaxSize: 0,
|
|
884
|
+
timeout: 1000
|
|
885
|
+
};
|
|
886
|
+
SimpleBar.instances = new WeakMap();
|
|
887
|
+
|
|
888
|
+
export default SimpleBar;
|
|
889
|
+
//# sourceMappingURL=simplebar-core.esm.js.map
|