@component-hook/picker 0.1.0
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/README.md +231 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +106 -0
- package/dist/picker.es.js +1874 -0
- package/dist/picker.umd.js +23 -0
- package/package.json +55 -0
|
@@ -0,0 +1,1874 @@
|
|
|
1
|
+
import "./index.css";
|
|
2
|
+
import { ref as L, computed as C, watch as bt, nextTick as ne, defineComponent as se, openBlock as z, createElementBlock as K, Fragment as ct, createVNode as Pt, Transition as Et, withCtx as Ct, withDirectives as Dt, createElementVNode as P, unref as A, vShow as Bt, normalizeClass as ht, normalizeStyle as ut, toDisplayString as U, renderList as xt, pushScopeId as ae, popScopeId as le } from "vue";
|
|
3
|
+
/*!
|
|
4
|
+
* better-scroll / core
|
|
5
|
+
* (c) 2016-2023 ustbhuangyi
|
|
6
|
+
* Released under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
/*! *****************************************************************************
|
|
9
|
+
Copyright (c) Microsoft Corporation.
|
|
10
|
+
|
|
11
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
12
|
+
purpose with or without fee is hereby granted.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
15
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
16
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
17
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
18
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
19
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
+
***************************************************************************** */
|
|
22
|
+
var mt = function(o, t) {
|
|
23
|
+
return mt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
24
|
+
e.__proto__ = r;
|
|
25
|
+
} || function(e, r) {
|
|
26
|
+
for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
|
|
27
|
+
}, mt(o, t);
|
|
28
|
+
};
|
|
29
|
+
function it(o, t) {
|
|
30
|
+
mt(o, t);
|
|
31
|
+
function e() {
|
|
32
|
+
this.constructor = o;
|
|
33
|
+
}
|
|
34
|
+
o.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
35
|
+
}
|
|
36
|
+
var N = function() {
|
|
37
|
+
return N = Object.assign || function(t) {
|
|
38
|
+
for (var e, r = 1, i = arguments.length; r < i; r++) {
|
|
39
|
+
e = arguments[r];
|
|
40
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
|
|
41
|
+
}
|
|
42
|
+
return t;
|
|
43
|
+
}, N.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
function Nt() {
|
|
46
|
+
for (var o = 0, t = 0, e = arguments.length; t < e; t++) o += arguments[t].length;
|
|
47
|
+
for (var r = Array(o), i = 0, t = 0; t < e; t++)
|
|
48
|
+
for (var n = arguments[t], s = 0, l = n.length; s < l; s++, i++)
|
|
49
|
+
r[i] = n[s];
|
|
50
|
+
return r;
|
|
51
|
+
}
|
|
52
|
+
var ce = [
|
|
53
|
+
{
|
|
54
|
+
sourceKey: "scroller.scrollBehaviorX.currentPos",
|
|
55
|
+
key: "x"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
sourceKey: "scroller.scrollBehaviorY.currentPos",
|
|
59
|
+
key: "y"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
sourceKey: "scroller.scrollBehaviorX.hasScroll",
|
|
63
|
+
key: "hasHorizontalScroll"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
sourceKey: "scroller.scrollBehaviorY.hasScroll",
|
|
67
|
+
key: "hasVerticalScroll"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
sourceKey: "scroller.scrollBehaviorX.contentSize",
|
|
71
|
+
key: "scrollerWidth"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
sourceKey: "scroller.scrollBehaviorY.contentSize",
|
|
75
|
+
key: "scrollerHeight"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
sourceKey: "scroller.scrollBehaviorX.maxScrollPos",
|
|
79
|
+
key: "maxScrollX"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
sourceKey: "scroller.scrollBehaviorY.maxScrollPos",
|
|
83
|
+
key: "maxScrollY"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
sourceKey: "scroller.scrollBehaviorX.minScrollPos",
|
|
87
|
+
key: "minScrollX"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
sourceKey: "scroller.scrollBehaviorY.minScrollPos",
|
|
91
|
+
key: "minScrollY"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
sourceKey: "scroller.scrollBehaviorX.movingDirection",
|
|
95
|
+
key: "movingDirectionX"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
sourceKey: "scroller.scrollBehaviorY.movingDirection",
|
|
99
|
+
key: "movingDirectionY"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
sourceKey: "scroller.scrollBehaviorX.direction",
|
|
103
|
+
key: "directionX"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
sourceKey: "scroller.scrollBehaviorY.direction",
|
|
107
|
+
key: "directionY"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
sourceKey: "scroller.actions.enabled",
|
|
111
|
+
key: "enabled"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
sourceKey: "scroller.animater.pending",
|
|
115
|
+
key: "pending"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
sourceKey: "scroller.animater.stop",
|
|
119
|
+
key: "stop"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
sourceKey: "scroller.scrollTo",
|
|
123
|
+
key: "scrollTo"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
sourceKey: "scroller.scrollBy",
|
|
127
|
+
key: "scrollBy"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
sourceKey: "scroller.scrollToElement",
|
|
131
|
+
key: "scrollToElement"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
sourceKey: "scroller.resetPosition",
|
|
135
|
+
key: "resetPosition"
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
function tt(o) {
|
|
139
|
+
console.error("[BScroll warn]: " + o);
|
|
140
|
+
}
|
|
141
|
+
var D = typeof window < "u", W = D && navigator.userAgent.toLowerCase(), he = !!(W && /wechatdevtools/.test(W)), ue = W && W.indexOf("android") > 0, pe = function() {
|
|
142
|
+
if (typeof W == "string") {
|
|
143
|
+
var o = /os (\d\d?_\d(_\d)?)/, t = o.exec(W);
|
|
144
|
+
if (!t)
|
|
145
|
+
return !1;
|
|
146
|
+
var e = t[1].split("_").map(function(r) {
|
|
147
|
+
return parseInt(r, 10);
|
|
148
|
+
});
|
|
149
|
+
return e[0] === 13 && e[1] >= 4;
|
|
150
|
+
}
|
|
151
|
+
return !1;
|
|
152
|
+
}(), Rt = !1;
|
|
153
|
+
if (D) {
|
|
154
|
+
var fe = "test-passive";
|
|
155
|
+
try {
|
|
156
|
+
var At = {};
|
|
157
|
+
Object.defineProperty(At, "passive", {
|
|
158
|
+
get: function() {
|
|
159
|
+
Rt = !0;
|
|
160
|
+
}
|
|
161
|
+
}), window.addEventListener(fe, function() {
|
|
162
|
+
}, At);
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function O() {
|
|
167
|
+
return window.performance && window.performance.now && window.performance.timing ? window.performance.now() + window.performance.timing.navigationStart : +/* @__PURE__ */ new Date();
|
|
168
|
+
}
|
|
169
|
+
var yt = function(o, t) {
|
|
170
|
+
for (var e in t)
|
|
171
|
+
o[e] = t[e];
|
|
172
|
+
return o;
|
|
173
|
+
};
|
|
174
|
+
function gt(o) {
|
|
175
|
+
return o == null;
|
|
176
|
+
}
|
|
177
|
+
function Mt(o, t, e) {
|
|
178
|
+
return o < t ? t : o > e ? e : o;
|
|
179
|
+
}
|
|
180
|
+
var Tt = D && document.createElement("div").style, H = function() {
|
|
181
|
+
if (!D)
|
|
182
|
+
return !1;
|
|
183
|
+
for (var o = [
|
|
184
|
+
{
|
|
185
|
+
key: "standard",
|
|
186
|
+
value: "transform"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
key: "webkit",
|
|
190
|
+
value: "webkitTransform"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
key: "Moz",
|
|
194
|
+
value: "MozTransform"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
key: "O",
|
|
198
|
+
value: "OTransform"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
key: "ms",
|
|
202
|
+
value: "msTransform"
|
|
203
|
+
}
|
|
204
|
+
], t = 0, e = o; t < e.length; t++) {
|
|
205
|
+
var r = e[t];
|
|
206
|
+
if (Tt[r.value] !== void 0)
|
|
207
|
+
return r.key;
|
|
208
|
+
}
|
|
209
|
+
return !1;
|
|
210
|
+
}();
|
|
211
|
+
function B(o) {
|
|
212
|
+
return H === !1 ? o : H === "standard" ? o === "transitionEnd" ? "transitionend" : o : H + o.charAt(0).toUpperCase() + o.substr(1);
|
|
213
|
+
}
|
|
214
|
+
function Vt(o) {
|
|
215
|
+
return typeof o == "string" ? document.querySelector(o) : o;
|
|
216
|
+
}
|
|
217
|
+
function ve(o, t, e, r) {
|
|
218
|
+
var i = Rt ? {
|
|
219
|
+
passive: !1,
|
|
220
|
+
capture: !!r
|
|
221
|
+
} : !!r;
|
|
222
|
+
o.addEventListener(t, e, i);
|
|
223
|
+
}
|
|
224
|
+
function de(o, t, e, r) {
|
|
225
|
+
o.removeEventListener(t, e, {
|
|
226
|
+
capture: !!r
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function $t(o) {
|
|
230
|
+
o.cancelable && o.preventDefault();
|
|
231
|
+
}
|
|
232
|
+
function Yt(o) {
|
|
233
|
+
for (var t = 0, e = 0; o; )
|
|
234
|
+
t -= o.offsetLeft, e -= o.offsetTop, o = o.offsetParent;
|
|
235
|
+
return {
|
|
236
|
+
left: t,
|
|
237
|
+
top: e
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
H && H !== "standard" && "" + H.toLowerCase();
|
|
241
|
+
var me = B("transform"), jt = B("transition"), ye = D && B("perspective") in Tt, Xt = D && ("ontouchstart" in window || he), ge = D && jt in Tt, _ = {
|
|
242
|
+
transform: me,
|
|
243
|
+
transition: jt,
|
|
244
|
+
transitionTimingFunction: B("transitionTimingFunction"),
|
|
245
|
+
transitionDuration: B("transitionDuration"),
|
|
246
|
+
transitionDelay: B("transitionDelay"),
|
|
247
|
+
transformOrigin: B("transformOrigin"),
|
|
248
|
+
transitionEnd: B("transitionEnd"),
|
|
249
|
+
transitionProperty: B("transitionProperty")
|
|
250
|
+
}, pt = {
|
|
251
|
+
touchstart: 1,
|
|
252
|
+
touchmove: 1,
|
|
253
|
+
touchend: 1,
|
|
254
|
+
touchcancel: 1,
|
|
255
|
+
mousedown: 2,
|
|
256
|
+
mousemove: 2,
|
|
257
|
+
mouseup: 2
|
|
258
|
+
};
|
|
259
|
+
function _t(o) {
|
|
260
|
+
if (o instanceof window.SVGElement) {
|
|
261
|
+
var t = o.getBoundingClientRect();
|
|
262
|
+
return {
|
|
263
|
+
top: t.top,
|
|
264
|
+
left: t.left,
|
|
265
|
+
width: t.width,
|
|
266
|
+
height: t.height
|
|
267
|
+
};
|
|
268
|
+
} else
|
|
269
|
+
return {
|
|
270
|
+
top: o.offsetTop,
|
|
271
|
+
left: o.offsetLeft,
|
|
272
|
+
width: o.offsetWidth,
|
|
273
|
+
height: o.offsetHeight
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function R(o, t) {
|
|
277
|
+
for (var e in t)
|
|
278
|
+
if (t[e].test(o[e]))
|
|
279
|
+
return !0;
|
|
280
|
+
return !1;
|
|
281
|
+
}
|
|
282
|
+
var ke = R;
|
|
283
|
+
function Te(o, t) {
|
|
284
|
+
var e = document.createEvent("Event");
|
|
285
|
+
e.initEvent(t, !0, !0), e.pageX = o.pageX, e.pageY = o.pageY, o.target.dispatchEvent(e);
|
|
286
|
+
}
|
|
287
|
+
function Ut(o, t) {
|
|
288
|
+
t === void 0 && (t = "click");
|
|
289
|
+
var e;
|
|
290
|
+
o.type === "mouseup" ? e = o : (o.type === "touchend" || o.type === "touchcancel") && (e = o.changedTouches[0]);
|
|
291
|
+
var r = {};
|
|
292
|
+
e && (r.screenX = e.screenX || 0, r.screenY = e.screenY || 0, r.clientX = e.clientX || 0, r.clientY = e.clientY || 0);
|
|
293
|
+
var i, n = !0, s = !0, l = o.ctrlKey, c = o.shiftKey, a = o.altKey, h = o.metaKey, u = {
|
|
294
|
+
ctrlKey: l,
|
|
295
|
+
shiftKey: c,
|
|
296
|
+
altKey: a,
|
|
297
|
+
metaKey: h
|
|
298
|
+
};
|
|
299
|
+
if (typeof MouseEvent < "u")
|
|
300
|
+
try {
|
|
301
|
+
i = new MouseEvent(t, yt(N({
|
|
302
|
+
bubbles: n,
|
|
303
|
+
cancelable: s
|
|
304
|
+
}, u), r));
|
|
305
|
+
} catch {
|
|
306
|
+
f();
|
|
307
|
+
}
|
|
308
|
+
else
|
|
309
|
+
f();
|
|
310
|
+
function f() {
|
|
311
|
+
i = document.createEvent("Event"), i.initEvent(t, n, s), yt(i, r);
|
|
312
|
+
}
|
|
313
|
+
i.forwardedTouchEvent = !0, i._constructed = !0, o.target.dispatchEvent(i);
|
|
314
|
+
}
|
|
315
|
+
function Se(o) {
|
|
316
|
+
Ut(o, "dblclick");
|
|
317
|
+
}
|
|
318
|
+
var X = {
|
|
319
|
+
// easeOutQuint
|
|
320
|
+
swipe: {
|
|
321
|
+
style: "cubic-bezier(0.23, 1, 0.32, 1)",
|
|
322
|
+
fn: function(o) {
|
|
323
|
+
return 1 + --o * o * o * o * o;
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
// easeOutQuard
|
|
327
|
+
swipeBounce: {
|
|
328
|
+
style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
|
|
329
|
+
fn: function(o) {
|
|
330
|
+
return o * (2 - o);
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
// easeOutQuart
|
|
334
|
+
bounce: {
|
|
335
|
+
style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
336
|
+
fn: function(o) {
|
|
337
|
+
return 1 - --o * o * o * o;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}, we = 1e3 / 60, M = D && window;
|
|
341
|
+
function qt() {
|
|
342
|
+
}
|
|
343
|
+
var Gt = function() {
|
|
344
|
+
return D ? M.requestAnimationFrame || M.webkitRequestAnimationFrame || M.mozRequestAnimationFrame || M.oRequestAnimationFrame || // if all else fails, use setTimeout
|
|
345
|
+
function(o) {
|
|
346
|
+
return window.setTimeout(o, o.interval || we);
|
|
347
|
+
} : qt;
|
|
348
|
+
}(), I = function() {
|
|
349
|
+
return D ? M.cancelAnimationFrame || M.webkitCancelAnimationFrame || M.mozCancelAnimationFrame || M.oCancelAnimationFrame || function(o) {
|
|
350
|
+
window.clearTimeout(o);
|
|
351
|
+
} : qt;
|
|
352
|
+
}(), Ot = function(o) {
|
|
353
|
+
}, ft = {
|
|
354
|
+
enumerable: !0,
|
|
355
|
+
configurable: !0,
|
|
356
|
+
get: Ot,
|
|
357
|
+
set: Ot
|
|
358
|
+
}, be = function(o, t) {
|
|
359
|
+
for (var e = t.split("."), r = 0; r < e.length - 1; r++)
|
|
360
|
+
if (o = o[e[r]], typeof o != "object" || !o)
|
|
361
|
+
return;
|
|
362
|
+
var i = e.pop();
|
|
363
|
+
return typeof o[i] == "function" ? function() {
|
|
364
|
+
return o[i].apply(o, arguments);
|
|
365
|
+
} : o[i];
|
|
366
|
+
}, Pe = function(o, t, e) {
|
|
367
|
+
for (var r = t.split("."), i, n = 0; n < r.length - 1; n++)
|
|
368
|
+
i = r[n], o[i] || (o[i] = {}), o = o[i];
|
|
369
|
+
o[r.pop()] = e;
|
|
370
|
+
};
|
|
371
|
+
function Ee(o, t, e) {
|
|
372
|
+
ft.get = function() {
|
|
373
|
+
return be(this, t);
|
|
374
|
+
}, ft.set = function(i) {
|
|
375
|
+
Pe(this, t, i);
|
|
376
|
+
}, Object.defineProperty(o, e, ft);
|
|
377
|
+
}
|
|
378
|
+
var Y = (
|
|
379
|
+
/** @class */
|
|
380
|
+
function() {
|
|
381
|
+
function o(t) {
|
|
382
|
+
this.events = {}, this.eventTypes = {}, this.registerType(t);
|
|
383
|
+
}
|
|
384
|
+
return o.prototype.on = function(t, e, r) {
|
|
385
|
+
return r === void 0 && (r = this), this.hasType(t), this.events[t] || (this.events[t] = []), this.events[t].push([e, r]), this;
|
|
386
|
+
}, o.prototype.once = function(t, e, r) {
|
|
387
|
+
var i = this;
|
|
388
|
+
r === void 0 && (r = this), this.hasType(t);
|
|
389
|
+
var n = function() {
|
|
390
|
+
for (var s = [], l = 0; l < arguments.length; l++)
|
|
391
|
+
s[l] = arguments[l];
|
|
392
|
+
i.off(t, n);
|
|
393
|
+
var c = e.apply(r, s);
|
|
394
|
+
if (c === !0)
|
|
395
|
+
return c;
|
|
396
|
+
};
|
|
397
|
+
return n.fn = e, this.on(t, n), this;
|
|
398
|
+
}, o.prototype.off = function(t, e) {
|
|
399
|
+
if (!t && !e)
|
|
400
|
+
return this.events = {}, this;
|
|
401
|
+
if (t) {
|
|
402
|
+
if (this.hasType(t), !e)
|
|
403
|
+
return this.events[t] = [], this;
|
|
404
|
+
var r = this.events[t];
|
|
405
|
+
if (!r)
|
|
406
|
+
return this;
|
|
407
|
+
for (var i = r.length; i--; )
|
|
408
|
+
(r[i][0] === e || r[i][0] && r[i][0].fn === e) && r.splice(i, 1);
|
|
409
|
+
return this;
|
|
410
|
+
}
|
|
411
|
+
}, o.prototype.trigger = function(t) {
|
|
412
|
+
for (var e = [], r = 1; r < arguments.length; r++)
|
|
413
|
+
e[r - 1] = arguments[r];
|
|
414
|
+
this.hasType(t);
|
|
415
|
+
var i = this.events[t];
|
|
416
|
+
if (i)
|
|
417
|
+
for (var n = i.length, s = Nt(i), l, c = 0; c < n; c++) {
|
|
418
|
+
var a = s[c], h = a[0], u = a[1];
|
|
419
|
+
if (h && (l = h.apply(u, e), l === !0))
|
|
420
|
+
return l;
|
|
421
|
+
}
|
|
422
|
+
}, o.prototype.registerType = function(t) {
|
|
423
|
+
var e = this;
|
|
424
|
+
t.forEach(function(r) {
|
|
425
|
+
e.eventTypes[r] = r;
|
|
426
|
+
});
|
|
427
|
+
}, o.prototype.destroy = function() {
|
|
428
|
+
this.events = {}, this.eventTypes = {};
|
|
429
|
+
}, o.prototype.hasType = function(t) {
|
|
430
|
+
var e = this.eventTypes, r = e[t] === t;
|
|
431
|
+
r || tt('EventEmitter has used unknown event type: "' + t + '", should be oneof [' + ("" + Object.keys(e).map(function(i) {
|
|
432
|
+
return JSON.stringify(i);
|
|
433
|
+
})) + "]");
|
|
434
|
+
}, o;
|
|
435
|
+
}()
|
|
436
|
+
), et = (
|
|
437
|
+
/** @class */
|
|
438
|
+
function() {
|
|
439
|
+
function o(t, e) {
|
|
440
|
+
this.wrapper = t, this.events = e, this.addDOMEvents();
|
|
441
|
+
}
|
|
442
|
+
return o.prototype.destroy = function() {
|
|
443
|
+
this.removeDOMEvents(), this.events = [];
|
|
444
|
+
}, o.prototype.addDOMEvents = function() {
|
|
445
|
+
this.handleDOMEvents(ve);
|
|
446
|
+
}, o.prototype.removeDOMEvents = function() {
|
|
447
|
+
this.handleDOMEvents(de);
|
|
448
|
+
}, o.prototype.handleDOMEvents = function(t) {
|
|
449
|
+
var e = this, r = this.wrapper;
|
|
450
|
+
this.events.forEach(function(i) {
|
|
451
|
+
t(r, i.name, e, !!i.capture);
|
|
452
|
+
});
|
|
453
|
+
}, o.prototype.handleEvent = function(t) {
|
|
454
|
+
var e = t.type;
|
|
455
|
+
this.events.some(function(r) {
|
|
456
|
+
return r.name === e ? (r.handler(t), !0) : !1;
|
|
457
|
+
});
|
|
458
|
+
}, o;
|
|
459
|
+
}()
|
|
460
|
+
), Ce = (
|
|
461
|
+
/** @class */
|
|
462
|
+
/* @__PURE__ */ function() {
|
|
463
|
+
function o() {
|
|
464
|
+
}
|
|
465
|
+
return o;
|
|
466
|
+
}()
|
|
467
|
+
), De = (
|
|
468
|
+
/** @class */
|
|
469
|
+
function(o) {
|
|
470
|
+
it(t, o);
|
|
471
|
+
function t() {
|
|
472
|
+
var e = o.call(this) || this;
|
|
473
|
+
return e.startX = 0, e.startY = 0, e.scrollX = !1, e.scrollY = !0, e.freeScroll = !1, e.directionLockThreshold = 0, e.eventPassthrough = "", e.click = !1, e.dblclick = !1, e.tap = "", e.bounce = {
|
|
474
|
+
top: !0,
|
|
475
|
+
bottom: !0,
|
|
476
|
+
left: !0,
|
|
477
|
+
right: !0
|
|
478
|
+
}, e.bounceTime = 800, e.momentum = !0, e.momentumLimitTime = 300, e.momentumLimitDistance = 15, e.swipeTime = 2500, e.swipeBounceTime = 500, e.deceleration = 15e-4, e.flickLimitTime = 200, e.flickLimitDistance = 100, e.resizePolling = 60, e.probeType = 0, e.stopPropagation = !1, e.preventDefault = !0, e.preventDefaultException = {
|
|
479
|
+
tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/
|
|
480
|
+
}, e.tagException = {
|
|
481
|
+
tagName: /^TEXTAREA$/
|
|
482
|
+
}, e.HWCompositing = !0, e.useTransition = !0, e.bindToWrapper = !1, e.bindToTarget = !1, e.disableMouse = Xt, e.disableTouch = !Xt, e.autoBlur = !0, e.autoEndDistance = 5, e.outOfBoundaryDampingFactor = 1 / 3, e.specifiedIndexAsContent = 0, e.quadrant = 1, e;
|
|
483
|
+
}
|
|
484
|
+
return t.prototype.merge = function(e) {
|
|
485
|
+
if (!e)
|
|
486
|
+
return this;
|
|
487
|
+
for (var r in e) {
|
|
488
|
+
if (r === "bounce") {
|
|
489
|
+
this.bounce = this.resolveBounce(e[r]);
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
this[r] = e[r];
|
|
493
|
+
}
|
|
494
|
+
return this;
|
|
495
|
+
}, t.prototype.process = function() {
|
|
496
|
+
return this.translateZ = this.HWCompositing && ye ? " translateZ(1px)" : "", this.useTransition = this.useTransition && ge, this.preventDefault = !this.eventPassthrough && this.preventDefault, this.scrollX = this.eventPassthrough === "horizontal" ? !1 : this.scrollX, this.scrollY = this.eventPassthrough === "vertical" ? !1 : this.scrollY, this.freeScroll = this.freeScroll && !this.eventPassthrough, this.scrollX = this.freeScroll ? !0 : this.scrollX, this.scrollY = this.freeScroll ? !0 : this.scrollY, this.directionLockThreshold = this.eventPassthrough ? 0 : this.directionLockThreshold, this;
|
|
497
|
+
}, t.prototype.resolveBounce = function(e) {
|
|
498
|
+
var r = {
|
|
499
|
+
top: !0,
|
|
500
|
+
right: !0,
|
|
501
|
+
bottom: !0,
|
|
502
|
+
left: !0
|
|
503
|
+
}, i = {
|
|
504
|
+
top: !1,
|
|
505
|
+
right: !1,
|
|
506
|
+
bottom: !1,
|
|
507
|
+
left: !1
|
|
508
|
+
}, n;
|
|
509
|
+
return typeof e == "object" ? n = yt(r, e) : n = e ? r : i, n;
|
|
510
|
+
}, t;
|
|
511
|
+
}(Ce)
|
|
512
|
+
), Be = (
|
|
513
|
+
/** @class */
|
|
514
|
+
function() {
|
|
515
|
+
function o(t, e) {
|
|
516
|
+
this.wrapper = t, this.options = e, this.hooks = new Y([
|
|
517
|
+
"beforeStart",
|
|
518
|
+
"start",
|
|
519
|
+
"move",
|
|
520
|
+
"end",
|
|
521
|
+
"click"
|
|
522
|
+
]), this.handleDOMEvents();
|
|
523
|
+
}
|
|
524
|
+
return o.prototype.handleDOMEvents = function() {
|
|
525
|
+
var t = this.options, e = t.bindToWrapper, r = t.disableMouse, i = t.disableTouch, n = t.click, s = this.wrapper, l = e ? s : window, c = [], a = [], h = !i, u = !r;
|
|
526
|
+
n && c.push({
|
|
527
|
+
name: "click",
|
|
528
|
+
handler: this.click.bind(this),
|
|
529
|
+
capture: !0
|
|
530
|
+
}), h && (c.push({
|
|
531
|
+
name: "touchstart",
|
|
532
|
+
handler: this.start.bind(this)
|
|
533
|
+
}), a.push({
|
|
534
|
+
name: "touchmove",
|
|
535
|
+
handler: this.move.bind(this)
|
|
536
|
+
}, {
|
|
537
|
+
name: "touchend",
|
|
538
|
+
handler: this.end.bind(this)
|
|
539
|
+
}, {
|
|
540
|
+
name: "touchcancel",
|
|
541
|
+
handler: this.end.bind(this)
|
|
542
|
+
})), u && (c.push({
|
|
543
|
+
name: "mousedown",
|
|
544
|
+
handler: this.start.bind(this)
|
|
545
|
+
}), a.push({
|
|
546
|
+
name: "mousemove",
|
|
547
|
+
handler: this.move.bind(this)
|
|
548
|
+
}, {
|
|
549
|
+
name: "mouseup",
|
|
550
|
+
handler: this.end.bind(this)
|
|
551
|
+
})), this.wrapperEventRegister = new et(s, c), this.targetEventRegister = new et(l, a);
|
|
552
|
+
}, o.prototype.beforeHandler = function(t, e) {
|
|
553
|
+
var r = this.options, i = r.preventDefault, n = r.stopPropagation, s = r.preventDefaultException, l = {
|
|
554
|
+
start: function() {
|
|
555
|
+
return i && !R(t.target, s);
|
|
556
|
+
},
|
|
557
|
+
end: function() {
|
|
558
|
+
return i && !R(t.target, s);
|
|
559
|
+
},
|
|
560
|
+
move: function() {
|
|
561
|
+
return i;
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
l[e]() && t.preventDefault(), n && t.stopPropagation();
|
|
565
|
+
}, o.prototype.setInitiated = function(t) {
|
|
566
|
+
t === void 0 && (t = 0), this.initiated = t;
|
|
567
|
+
}, o.prototype.start = function(t) {
|
|
568
|
+
var e = pt[t.type];
|
|
569
|
+
if (!(this.initiated && this.initiated !== e)) {
|
|
570
|
+
if (this.setInitiated(e), ke(t.target, this.options.tagException)) {
|
|
571
|
+
this.setInitiated();
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (!(e === 2 && t.button !== 0) && !this.hooks.trigger(this.hooks.eventTypes.beforeStart, t)) {
|
|
575
|
+
this.beforeHandler(t, "start");
|
|
576
|
+
var r = t.touches ? t.touches[0] : t;
|
|
577
|
+
this.pointX = r.pageX, this.pointY = r.pageY, this.hooks.trigger(this.hooks.eventTypes.start, t);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
}, o.prototype.move = function(t) {
|
|
581
|
+
if (pt[t.type] === this.initiated) {
|
|
582
|
+
this.beforeHandler(t, "move");
|
|
583
|
+
var e = t.touches ? t.touches[0] : t, r = e.pageX - this.pointX, i = e.pageY - this.pointY;
|
|
584
|
+
if (this.pointX = e.pageX, this.pointY = e.pageY, !this.hooks.trigger(this.hooks.eventTypes.move, {
|
|
585
|
+
deltaX: r,
|
|
586
|
+
deltaY: i,
|
|
587
|
+
e: t
|
|
588
|
+
})) {
|
|
589
|
+
var n = document.documentElement.scrollLeft || window.pageXOffset || document.body.scrollLeft, s = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop, l = this.pointX - n, c = this.pointY - s, a = this.options.autoEndDistance;
|
|
590
|
+
(l > document.documentElement.clientWidth - a || c > document.documentElement.clientHeight - a || l < a || c < a) && this.end(t);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}, o.prototype.end = function(t) {
|
|
594
|
+
pt[t.type] === this.initiated && (this.setInitiated(), this.beforeHandler(t, "end"), this.hooks.trigger(this.hooks.eventTypes.end, t));
|
|
595
|
+
}, o.prototype.click = function(t) {
|
|
596
|
+
this.hooks.trigger(this.hooks.eventTypes.click, t);
|
|
597
|
+
}, o.prototype.setContent = function(t) {
|
|
598
|
+
t !== this.wrapper && (this.wrapper = t, this.rebindDOMEvents());
|
|
599
|
+
}, o.prototype.rebindDOMEvents = function() {
|
|
600
|
+
this.wrapperEventRegister.destroy(), this.targetEventRegister.destroy(), this.handleDOMEvents();
|
|
601
|
+
}, o.prototype.destroy = function() {
|
|
602
|
+
this.wrapperEventRegister.destroy(), this.targetEventRegister.destroy(), this.hooks.destroy();
|
|
603
|
+
}, o;
|
|
604
|
+
}()
|
|
605
|
+
), vt = {
|
|
606
|
+
x: ["translateX", "px"],
|
|
607
|
+
y: ["translateY", "px"]
|
|
608
|
+
}, xe = (
|
|
609
|
+
/** @class */
|
|
610
|
+
function() {
|
|
611
|
+
function o(t) {
|
|
612
|
+
this.setContent(t), this.hooks = new Y(["beforeTranslate", "translate"]);
|
|
613
|
+
}
|
|
614
|
+
return o.prototype.getComputedPosition = function() {
|
|
615
|
+
var t = window.getComputedStyle(this.content, null), e = t[_.transform].split(")")[0].split(", "), r = +(e[12] || e[4]) || 0, i = +(e[13] || e[5]) || 0;
|
|
616
|
+
return {
|
|
617
|
+
x: r,
|
|
618
|
+
y: i
|
|
619
|
+
};
|
|
620
|
+
}, o.prototype.translate = function(t) {
|
|
621
|
+
var e = [];
|
|
622
|
+
Object.keys(t).forEach(function(r) {
|
|
623
|
+
if (vt[r]) {
|
|
624
|
+
var i = vt[r][0];
|
|
625
|
+
if (i) {
|
|
626
|
+
var n = vt[r][1], s = t[r];
|
|
627
|
+
e.push(i + "(" + s + n + ")");
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}), this.hooks.trigger(this.hooks.eventTypes.beforeTranslate, e, t), this.style[_.transform] = e.join(" "), this.hooks.trigger(this.hooks.eventTypes.translate, t);
|
|
631
|
+
}, o.prototype.setContent = function(t) {
|
|
632
|
+
this.content !== t && (this.content = t, this.style = t.style);
|
|
633
|
+
}, o.prototype.destroy = function() {
|
|
634
|
+
this.hooks.destroy();
|
|
635
|
+
}, o;
|
|
636
|
+
}()
|
|
637
|
+
), Zt = (
|
|
638
|
+
/** @class */
|
|
639
|
+
function() {
|
|
640
|
+
function o(t, e, r) {
|
|
641
|
+
this.translater = e, this.options = r, this.timer = 0, this.hooks = new Y([
|
|
642
|
+
"move",
|
|
643
|
+
"end",
|
|
644
|
+
"beforeForceStop",
|
|
645
|
+
"forceStop",
|
|
646
|
+
"callStop",
|
|
647
|
+
"time",
|
|
648
|
+
"timeFunction"
|
|
649
|
+
]), this.setContent(t);
|
|
650
|
+
}
|
|
651
|
+
return o.prototype.translate = function(t) {
|
|
652
|
+
this.translater.translate(t);
|
|
653
|
+
}, o.prototype.setPending = function(t) {
|
|
654
|
+
this.pending = t;
|
|
655
|
+
}, o.prototype.setForceStopped = function(t) {
|
|
656
|
+
this.forceStopped = t;
|
|
657
|
+
}, o.prototype.setCallStop = function(t) {
|
|
658
|
+
this.callStopWhenPending = t;
|
|
659
|
+
}, o.prototype.setContent = function(t) {
|
|
660
|
+
this.content !== t && (this.content = t, this.style = t.style, this.stop());
|
|
661
|
+
}, o.prototype.clearTimer = function() {
|
|
662
|
+
this.timer && (I(this.timer), this.timer = 0);
|
|
663
|
+
}, o.prototype.destroy = function() {
|
|
664
|
+
this.hooks.destroy(), I(this.timer);
|
|
665
|
+
}, o;
|
|
666
|
+
}()
|
|
667
|
+
), Ae = function(o, t, e, r) {
|
|
668
|
+
var i = function(a, h) {
|
|
669
|
+
var u = a - h, f = u > 0 ? -1 : u < 0 ? 1 : 0;
|
|
670
|
+
return f;
|
|
671
|
+
}, n = i(t.x, o.x), s = i(t.y, o.y), l = e.x - r.x, c = e.y - r.y;
|
|
672
|
+
return n * l <= 0 && s * c <= 0;
|
|
673
|
+
}, Me = (
|
|
674
|
+
/** @class */
|
|
675
|
+
function(o) {
|
|
676
|
+
it(t, o);
|
|
677
|
+
function t() {
|
|
678
|
+
return o !== null && o.apply(this, arguments) || this;
|
|
679
|
+
}
|
|
680
|
+
return t.prototype.startProbe = function(e, r) {
|
|
681
|
+
var i = this, n = e, s = function() {
|
|
682
|
+
var l = i.translater.getComputedPosition();
|
|
683
|
+
Ae(e, r, l, n) && i.hooks.trigger(i.hooks.eventTypes.move, l), i.pending || (i.callStopWhenPending ? i.callStopWhenPending = !1 : i.hooks.trigger(i.hooks.eventTypes.end, l)), n = l, i.pending && (i.timer = Gt(s));
|
|
684
|
+
};
|
|
685
|
+
this.callStopWhenPending && this.setCallStop(!1), I(this.timer), s();
|
|
686
|
+
}, t.prototype.transitionTime = function(e) {
|
|
687
|
+
e === void 0 && (e = 0), this.style[_.transitionDuration] = e + "ms", this.hooks.trigger(this.hooks.eventTypes.time, e);
|
|
688
|
+
}, t.prototype.transitionTimingFunction = function(e) {
|
|
689
|
+
this.style[_.transitionTimingFunction] = e, this.hooks.trigger(this.hooks.eventTypes.timeFunction, e);
|
|
690
|
+
}, t.prototype.transitionProperty = function() {
|
|
691
|
+
this.style[_.transitionProperty] = _.transform;
|
|
692
|
+
}, t.prototype.move = function(e, r, i, n) {
|
|
693
|
+
this.setPending(i > 0), this.transitionTimingFunction(n), this.transitionProperty(), this.transitionTime(i), this.translate(r);
|
|
694
|
+
var s = this.options.probeType === 3;
|
|
695
|
+
i && s && this.startProbe(e, r), i || (this._reflow = this.content.offsetHeight, s && this.hooks.trigger(this.hooks.eventTypes.move, r), this.hooks.trigger(this.hooks.eventTypes.end, r));
|
|
696
|
+
}, t.prototype.doStop = function() {
|
|
697
|
+
var e = this.pending;
|
|
698
|
+
if (this.setForceStopped(!1), this.setCallStop(!1), e) {
|
|
699
|
+
this.setPending(!1), I(this.timer);
|
|
700
|
+
var r = this.translater.getComputedPosition(), i = r.x, n = r.y;
|
|
701
|
+
this.transitionTime(), this.translate({ x: i, y: n }), this.setForceStopped(!0), this.setCallStop(!0), this.hooks.trigger(this.hooks.eventTypes.forceStop, { x: i, y: n });
|
|
702
|
+
}
|
|
703
|
+
return e;
|
|
704
|
+
}, t.prototype.stop = function() {
|
|
705
|
+
var e = this.doStop();
|
|
706
|
+
e && this.hooks.trigger(this.hooks.eventTypes.callStop);
|
|
707
|
+
}, t;
|
|
708
|
+
}(Zt)
|
|
709
|
+
), Ye = (
|
|
710
|
+
/** @class */
|
|
711
|
+
function(o) {
|
|
712
|
+
it(t, o);
|
|
713
|
+
function t() {
|
|
714
|
+
return o !== null && o.apply(this, arguments) || this;
|
|
715
|
+
}
|
|
716
|
+
return t.prototype.move = function(e, r, i, n) {
|
|
717
|
+
if (!i) {
|
|
718
|
+
this.translate(r), this.options.probeType === 3 && this.hooks.trigger(this.hooks.eventTypes.move, r), this.hooks.trigger(this.hooks.eventTypes.end, r);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
this.animate(e, r, i, n);
|
|
722
|
+
}, t.prototype.animate = function(e, r, i, n) {
|
|
723
|
+
var s = this, l = O(), c = l + i, a = this.options.probeType === 3, h = function() {
|
|
724
|
+
var u = O();
|
|
725
|
+
if (u >= c) {
|
|
726
|
+
s.translate(r), a && s.hooks.trigger(s.hooks.eventTypes.move, r), s.hooks.trigger(s.hooks.eventTypes.end, r);
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
u = (u - l) / i;
|
|
730
|
+
var f = n(u), y = {};
|
|
731
|
+
Object.keys(r).forEach(function(v) {
|
|
732
|
+
var T = e[v], g = r[v];
|
|
733
|
+
y[v] = (g - T) * f + T;
|
|
734
|
+
}), s.translate(y), a && s.hooks.trigger(s.hooks.eventTypes.move, y), s.pending && (s.timer = Gt(h)), s.pending || (s.callStopWhenPending ? s.callStopWhenPending = !1 : s.hooks.trigger(s.hooks.eventTypes.end, r));
|
|
735
|
+
};
|
|
736
|
+
this.setPending(!0), this.callStopWhenPending && this.setCallStop(!1), I(this.timer), h();
|
|
737
|
+
}, t.prototype.doStop = function() {
|
|
738
|
+
var e = this.pending;
|
|
739
|
+
if (this.setForceStopped(!1), this.setCallStop(!1), e) {
|
|
740
|
+
this.setPending(!1), I(this.timer);
|
|
741
|
+
var r = this.translater.getComputedPosition();
|
|
742
|
+
this.setForceStopped(!0), this.setCallStop(!0), this.hooks.trigger(this.hooks.eventTypes.forceStop, r);
|
|
743
|
+
}
|
|
744
|
+
return e;
|
|
745
|
+
}, t.prototype.stop = function() {
|
|
746
|
+
var e = this.doStop();
|
|
747
|
+
e && this.hooks.trigger(this.hooks.eventTypes.callStop);
|
|
748
|
+
}, t;
|
|
749
|
+
}(Zt)
|
|
750
|
+
);
|
|
751
|
+
function Xe(o, t, e) {
|
|
752
|
+
var r = e.useTransition, i = {};
|
|
753
|
+
return Object.defineProperty(i, "probeType", {
|
|
754
|
+
enumerable: !0,
|
|
755
|
+
configurable: !1,
|
|
756
|
+
get: function() {
|
|
757
|
+
return e.probeType;
|
|
758
|
+
}
|
|
759
|
+
}), r ? new Me(o, t, i) : new Ye(o, t, i);
|
|
760
|
+
}
|
|
761
|
+
var It = (
|
|
762
|
+
/** @class */
|
|
763
|
+
function() {
|
|
764
|
+
function o(t, e, r) {
|
|
765
|
+
this.wrapper = t, this.options = r, this.hooks = new Y([
|
|
766
|
+
"beforeComputeBoundary",
|
|
767
|
+
"computeBoundary",
|
|
768
|
+
"momentum",
|
|
769
|
+
"end",
|
|
770
|
+
"ignoreHasScroll"
|
|
771
|
+
]), this.refresh(e);
|
|
772
|
+
}
|
|
773
|
+
return o.prototype.start = function() {
|
|
774
|
+
this.dist = 0, this.setMovingDirection(
|
|
775
|
+
0
|
|
776
|
+
/* Default */
|
|
777
|
+
), this.setDirection(
|
|
778
|
+
0
|
|
779
|
+
/* Default */
|
|
780
|
+
);
|
|
781
|
+
}, o.prototype.move = function(t) {
|
|
782
|
+
return t = this.hasScroll ? t : 0, this.setMovingDirection(t), this.performDampingAlgorithm(t, this.options.outOfBoundaryDampingFactor);
|
|
783
|
+
}, o.prototype.setMovingDirection = function(t) {
|
|
784
|
+
this.movingDirection = t > 0 ? -1 : t < 0 ? 1 : 0;
|
|
785
|
+
}, o.prototype.setDirection = function(t) {
|
|
786
|
+
this.direction = t > 0 ? -1 : t < 0 ? 1 : 0;
|
|
787
|
+
}, o.prototype.performDampingAlgorithm = function(t, e) {
|
|
788
|
+
var r = this.currentPos + t;
|
|
789
|
+
return (r > this.minScrollPos || r < this.maxScrollPos) && (r > this.minScrollPos && this.options.bounces[0] || r < this.maxScrollPos && this.options.bounces[1] ? r = this.currentPos + t * e : r = r > this.minScrollPos ? this.minScrollPos : this.maxScrollPos), r;
|
|
790
|
+
}, o.prototype.end = function(t) {
|
|
791
|
+
var e = {
|
|
792
|
+
duration: 0
|
|
793
|
+
}, r = Math.abs(this.currentPos - this.startPos);
|
|
794
|
+
if (this.options.momentum && t < this.options.momentumLimitTime && r > this.options.momentumLimitDistance) {
|
|
795
|
+
var i = this.direction === -1 && this.options.bounces[0] || this.direction === 1 && this.options.bounces[1] ? this.wrapperSize : 0;
|
|
796
|
+
e = this.hasScroll ? this.momentum(this.currentPos, this.startPos, t, this.maxScrollPos, this.minScrollPos, i, this.options) : { destination: this.currentPos, duration: 0 };
|
|
797
|
+
} else
|
|
798
|
+
this.hooks.trigger(this.hooks.eventTypes.end, e);
|
|
799
|
+
return e;
|
|
800
|
+
}, o.prototype.momentum = function(t, e, r, i, n, s, l) {
|
|
801
|
+
l === void 0 && (l = this.options);
|
|
802
|
+
var c = t - e, a = Math.abs(c) / r, h = l.deceleration, u = l.swipeBounceTime, f = l.swipeTime, y = Math.min(f, a * 2 / h), v = {
|
|
803
|
+
destination: t + a * a / h * (c < 0 ? -1 : 1),
|
|
804
|
+
duration: y,
|
|
805
|
+
rate: 15
|
|
806
|
+
};
|
|
807
|
+
return this.hooks.trigger(this.hooks.eventTypes.momentum, v, c), v.destination < i ? (v.destination = s ? Math.max(i - s / 4, i - s / v.rate * a) : i, v.duration = u) : v.destination > n && (v.destination = s ? Math.min(n + s / 4, n + s / v.rate * a) : n, v.duration = u), v.destination = Math.round(v.destination), v;
|
|
808
|
+
}, o.prototype.updateDirection = function() {
|
|
809
|
+
var t = this.currentPos - this.absStartPos;
|
|
810
|
+
this.setDirection(t);
|
|
811
|
+
}, o.prototype.refresh = function(t) {
|
|
812
|
+
var e = this.options.rect, r = e.size, i = e.position, n = window.getComputedStyle(this.wrapper, null).position === "static", s = _t(this.wrapper);
|
|
813
|
+
this.wrapperSize = this.wrapper[r === "width" ? "clientWidth" : "clientHeight"], this.setContent(t);
|
|
814
|
+
var l = _t(this.content);
|
|
815
|
+
this.contentSize = l[r], this.relativeOffset = l[i], n && (this.relativeOffset -= s[i]), this.computeBoundary(), this.setDirection(
|
|
816
|
+
0
|
|
817
|
+
/* Default */
|
|
818
|
+
);
|
|
819
|
+
}, o.prototype.setContent = function(t) {
|
|
820
|
+
t !== this.content && (this.content = t, this.resetState());
|
|
821
|
+
}, o.prototype.resetState = function() {
|
|
822
|
+
this.currentPos = 0, this.startPos = 0, this.dist = 0, this.setDirection(
|
|
823
|
+
0
|
|
824
|
+
/* Default */
|
|
825
|
+
), this.setMovingDirection(
|
|
826
|
+
0
|
|
827
|
+
/* Default */
|
|
828
|
+
), this.resetStartPos();
|
|
829
|
+
}, o.prototype.computeBoundary = function() {
|
|
830
|
+
this.hooks.trigger(this.hooks.eventTypes.beforeComputeBoundary);
|
|
831
|
+
var t = {
|
|
832
|
+
minScrollPos: 0,
|
|
833
|
+
maxScrollPos: this.wrapperSize - this.contentSize
|
|
834
|
+
};
|
|
835
|
+
t.maxScrollPos < 0 && (t.maxScrollPos -= this.relativeOffset, this.options.specifiedIndexAsContent === 0 && (t.minScrollPos = -this.relativeOffset)), this.hooks.trigger(this.hooks.eventTypes.computeBoundary, t), this.minScrollPos = t.minScrollPos, this.maxScrollPos = t.maxScrollPos, this.hasScroll = this.options.scrollable && this.maxScrollPos < this.minScrollPos, !this.hasScroll && this.minScrollPos < this.maxScrollPos && (this.maxScrollPos = this.minScrollPos, this.contentSize = this.wrapperSize);
|
|
836
|
+
}, o.prototype.updatePosition = function(t) {
|
|
837
|
+
this.currentPos = t;
|
|
838
|
+
}, o.prototype.getCurrentPos = function() {
|
|
839
|
+
return this.currentPos;
|
|
840
|
+
}, o.prototype.checkInBoundary = function() {
|
|
841
|
+
var t = this.adjustPosition(this.currentPos), e = t === this.getCurrentPos();
|
|
842
|
+
return {
|
|
843
|
+
position: t,
|
|
844
|
+
inBoundary: e
|
|
845
|
+
};
|
|
846
|
+
}, o.prototype.adjustPosition = function(t) {
|
|
847
|
+
return !this.hasScroll && !this.hooks.trigger(this.hooks.eventTypes.ignoreHasScroll) ? t = this.minScrollPos : t > this.minScrollPos ? t = this.minScrollPos : t < this.maxScrollPos && (t = this.maxScrollPos), t;
|
|
848
|
+
}, o.prototype.updateStartPos = function() {
|
|
849
|
+
this.startPos = this.currentPos;
|
|
850
|
+
}, o.prototype.updateAbsStartPos = function() {
|
|
851
|
+
this.absStartPos = this.currentPos;
|
|
852
|
+
}, o.prototype.resetStartPos = function() {
|
|
853
|
+
this.updateStartPos(), this.updateAbsStartPos();
|
|
854
|
+
}, o.prototype.getAbsDist = function(t) {
|
|
855
|
+
return this.dist += t, Math.abs(this.dist);
|
|
856
|
+
}, o.prototype.destroy = function() {
|
|
857
|
+
this.hooks.destroy();
|
|
858
|
+
}, o;
|
|
859
|
+
}()
|
|
860
|
+
), q, G, Z, J, Lt = (q = {}, q.yes = function(o) {
|
|
861
|
+
return !0;
|
|
862
|
+
}, q.no = function(o) {
|
|
863
|
+
return $t(o), !1;
|
|
864
|
+
}, q), _e = (G = {}, G.horizontal = (Z = {}, Z.yes = "horizontal", Z.no = "vertical", Z), G.vertical = (J = {}, J.yes = "vertical", J.no = "horizontal", J), G), Oe = (
|
|
865
|
+
/** @class */
|
|
866
|
+
function() {
|
|
867
|
+
function o(t, e, r) {
|
|
868
|
+
this.directionLockThreshold = t, this.freeScroll = e, this.eventPassthrough = r, this.reset();
|
|
869
|
+
}
|
|
870
|
+
return o.prototype.reset = function() {
|
|
871
|
+
this.directionLocked = "";
|
|
872
|
+
}, o.prototype.checkMovingDirection = function(t, e, r) {
|
|
873
|
+
return this.computeDirectionLock(t, e), this.handleEventPassthrough(r);
|
|
874
|
+
}, o.prototype.adjustDelta = function(t, e) {
|
|
875
|
+
return this.directionLocked === "horizontal" ? e = 0 : this.directionLocked === "vertical" && (t = 0), {
|
|
876
|
+
deltaX: t,
|
|
877
|
+
deltaY: e
|
|
878
|
+
};
|
|
879
|
+
}, o.prototype.computeDirectionLock = function(t, e) {
|
|
880
|
+
this.directionLocked === "" && !this.freeScroll && (t > e + this.directionLockThreshold ? this.directionLocked = "horizontal" : e >= t + this.directionLockThreshold ? this.directionLocked = "vertical" : this.directionLocked = "none");
|
|
881
|
+
}, o.prototype.handleEventPassthrough = function(t) {
|
|
882
|
+
var e = _e[this.directionLocked];
|
|
883
|
+
if (e) {
|
|
884
|
+
if (this.eventPassthrough === e.yes)
|
|
885
|
+
return Lt.yes(t);
|
|
886
|
+
if (this.eventPassthrough === e.no)
|
|
887
|
+
return Lt.no(t);
|
|
888
|
+
}
|
|
889
|
+
return !1;
|
|
890
|
+
}, o;
|
|
891
|
+
}()
|
|
892
|
+
), Ie = function(o, t, e) {
|
|
893
|
+
return e === 2 ? [t, -o] : e === 3 ? [-o, -t] : e === 4 ? [-t, o] : [o, t];
|
|
894
|
+
}, Le = (
|
|
895
|
+
/** @class */
|
|
896
|
+
function() {
|
|
897
|
+
function o(t, e, r, i, n) {
|
|
898
|
+
this.hooks = new Y([
|
|
899
|
+
"start",
|
|
900
|
+
"beforeMove",
|
|
901
|
+
"scrollStart",
|
|
902
|
+
"scroll",
|
|
903
|
+
"beforeEnd",
|
|
904
|
+
"end",
|
|
905
|
+
"scrollEnd",
|
|
906
|
+
"contentNotMoved",
|
|
907
|
+
"detectMovingDirection",
|
|
908
|
+
"coordinateTransformation"
|
|
909
|
+
]), this.scrollBehaviorX = t, this.scrollBehaviorY = e, this.actionsHandler = r, this.animater = i, this.options = n, this.directionLockAction = new Oe(n.directionLockThreshold, n.freeScroll, n.eventPassthrough), this.enabled = !0, this.bindActionsHandler();
|
|
910
|
+
}
|
|
911
|
+
return o.prototype.bindActionsHandler = function() {
|
|
912
|
+
var t = this;
|
|
913
|
+
this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start, function(e) {
|
|
914
|
+
return t.enabled ? t.handleStart(e) : !0;
|
|
915
|
+
}), this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move, function(e) {
|
|
916
|
+
var r = e.deltaX, i = e.deltaY, n = e.e;
|
|
917
|
+
if (!t.enabled)
|
|
918
|
+
return !0;
|
|
919
|
+
var s = Ie(r, i, t.options.quadrant), l = s[0], c = s[1], a = {
|
|
920
|
+
deltaX: l,
|
|
921
|
+
deltaY: c
|
|
922
|
+
};
|
|
923
|
+
return t.hooks.trigger(t.hooks.eventTypes.coordinateTransformation, a), t.handleMove(a.deltaX, a.deltaY, n);
|
|
924
|
+
}), this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end, function(e) {
|
|
925
|
+
return t.enabled ? t.handleEnd(e) : !0;
|
|
926
|
+
}), this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click, function(e) {
|
|
927
|
+
t.enabled && !e._constructed && t.handleClick(e);
|
|
928
|
+
});
|
|
929
|
+
}, o.prototype.handleStart = function(t) {
|
|
930
|
+
var e = O();
|
|
931
|
+
this.fingerMoved = !1, this.contentMoved = !1, this.startTime = e, this.directionLockAction.reset(), this.scrollBehaviorX.start(), this.scrollBehaviorY.start(), this.animater.doStop(), this.scrollBehaviorX.resetStartPos(), this.scrollBehaviorY.resetStartPos(), this.hooks.trigger(this.hooks.eventTypes.start, t);
|
|
932
|
+
}, o.prototype.handleMove = function(t, e, r) {
|
|
933
|
+
if (!this.hooks.trigger(this.hooks.eventTypes.beforeMove, r)) {
|
|
934
|
+
var i = this.scrollBehaviorX.getAbsDist(t), n = this.scrollBehaviorY.getAbsDist(e), s = O();
|
|
935
|
+
if (this.checkMomentum(i, n, s))
|
|
936
|
+
return !0;
|
|
937
|
+
if (this.directionLockAction.checkMovingDirection(i, n, r))
|
|
938
|
+
return this.actionsHandler.setInitiated(), !0;
|
|
939
|
+
var l = this.directionLockAction.adjustDelta(t, e), c = this.scrollBehaviorX.getCurrentPos(), a = this.scrollBehaviorX.move(l.deltaX), h = this.scrollBehaviorY.getCurrentPos(), u = this.scrollBehaviorY.move(l.deltaY);
|
|
940
|
+
if (!this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)) {
|
|
941
|
+
this.fingerMoved || (this.fingerMoved = !0);
|
|
942
|
+
var f = a !== c || u !== h;
|
|
943
|
+
!this.contentMoved && !f && this.hooks.trigger(this.hooks.eventTypes.contentNotMoved), !this.contentMoved && f && (this.contentMoved = !0, this.hooks.trigger(this.hooks.eventTypes.scrollStart)), this.contentMoved && f && (this.animater.translate({
|
|
944
|
+
x: a,
|
|
945
|
+
y: u
|
|
946
|
+
}), this.dispatchScroll(s));
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}, o.prototype.dispatchScroll = function(t) {
|
|
950
|
+
t - this.startTime > this.options.momentumLimitTime && (this.startTime = t, this.scrollBehaviorX.updateStartPos(), this.scrollBehaviorY.updateStartPos(), this.options.probeType === 1 && this.hooks.trigger(this.hooks.eventTypes.scroll, this.getCurrentPos())), this.options.probeType > 1 && this.hooks.trigger(this.hooks.eventTypes.scroll, this.getCurrentPos());
|
|
951
|
+
}, o.prototype.checkMomentum = function(t, e, r) {
|
|
952
|
+
return r - this.endTime > this.options.momentumLimitTime && e < this.options.momentumLimitDistance && t < this.options.momentumLimitDistance;
|
|
953
|
+
}, o.prototype.handleEnd = function(t) {
|
|
954
|
+
if (!this.hooks.trigger(this.hooks.eventTypes.beforeEnd, t)) {
|
|
955
|
+
var e = this.getCurrentPos();
|
|
956
|
+
if (this.scrollBehaviorX.updateDirection(), this.scrollBehaviorY.updateDirection(), this.hooks.trigger(this.hooks.eventTypes.end, t, e))
|
|
957
|
+
return !0;
|
|
958
|
+
e = this.ensureIntegerPos(e), this.animater.translate(e), this.endTime = O();
|
|
959
|
+
var r = this.endTime - this.startTime;
|
|
960
|
+
this.hooks.trigger(this.hooks.eventTypes.scrollEnd, e, r);
|
|
961
|
+
}
|
|
962
|
+
}, o.prototype.ensureIntegerPos = function(t) {
|
|
963
|
+
this.ensuringInteger = !0;
|
|
964
|
+
var e = t.x, r = t.y, i = this.scrollBehaviorX, n = i.minScrollPos, s = i.maxScrollPos, l = this.scrollBehaviorY, c = l.minScrollPos, a = l.maxScrollPos;
|
|
965
|
+
return e = e > 0 ? Math.ceil(e) : Math.floor(e), r = r > 0 ? Math.ceil(r) : Math.floor(r), e = Mt(e, s, n), r = Mt(r, a, c), { x: e, y: r };
|
|
966
|
+
}, o.prototype.handleClick = function(t) {
|
|
967
|
+
R(t.target, this.options.preventDefaultException) || ($t(t), t.stopPropagation());
|
|
968
|
+
}, o.prototype.getCurrentPos = function() {
|
|
969
|
+
return {
|
|
970
|
+
x: this.scrollBehaviorX.getCurrentPos(),
|
|
971
|
+
y: this.scrollBehaviorY.getCurrentPos()
|
|
972
|
+
};
|
|
973
|
+
}, o.prototype.refresh = function() {
|
|
974
|
+
this.endTime = 0;
|
|
975
|
+
}, o.prototype.destroy = function() {
|
|
976
|
+
this.hooks.destroy();
|
|
977
|
+
}, o;
|
|
978
|
+
}()
|
|
979
|
+
);
|
|
980
|
+
function He(o) {
|
|
981
|
+
var t = [
|
|
982
|
+
"click",
|
|
983
|
+
"bindToWrapper",
|
|
984
|
+
"disableMouse",
|
|
985
|
+
"disableTouch",
|
|
986
|
+
"preventDefault",
|
|
987
|
+
"stopPropagation",
|
|
988
|
+
"tagException",
|
|
989
|
+
"preventDefaultException",
|
|
990
|
+
"autoEndDistance"
|
|
991
|
+
].reduce(function(e, r) {
|
|
992
|
+
return e[r] = o[r], e;
|
|
993
|
+
}, {});
|
|
994
|
+
return t;
|
|
995
|
+
}
|
|
996
|
+
function Ht(o, t, e, r) {
|
|
997
|
+
var i = [
|
|
998
|
+
"momentum",
|
|
999
|
+
"momentumLimitTime",
|
|
1000
|
+
"momentumLimitDistance",
|
|
1001
|
+
"deceleration",
|
|
1002
|
+
"swipeBounceTime",
|
|
1003
|
+
"swipeTime",
|
|
1004
|
+
"outOfBoundaryDampingFactor",
|
|
1005
|
+
"specifiedIndexAsContent"
|
|
1006
|
+
].reduce(function(n, s) {
|
|
1007
|
+
return n[s] = o[s], n;
|
|
1008
|
+
}, {});
|
|
1009
|
+
return i.scrollable = !!o[t], i.bounces = e, i.rect = r, i;
|
|
1010
|
+
}
|
|
1011
|
+
function kt(o, t, e) {
|
|
1012
|
+
e.forEach(function(r) {
|
|
1013
|
+
var i, n;
|
|
1014
|
+
typeof r == "string" ? i = n = r : (i = r.source, n = r.target), o.on(i, function() {
|
|
1015
|
+
for (var s = [], l = 0; l < arguments.length; l++)
|
|
1016
|
+
s[l] = arguments[l];
|
|
1017
|
+
return t.trigger.apply(t, Nt([n], s));
|
|
1018
|
+
});
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
function Fe(o, t) {
|
|
1022
|
+
for (var e = Object.keys(o), r = 0, i = e; r < i.length; r++) {
|
|
1023
|
+
var n = i[r];
|
|
1024
|
+
if (o[n] !== t[n])
|
|
1025
|
+
return !1;
|
|
1026
|
+
}
|
|
1027
|
+
return !0;
|
|
1028
|
+
}
|
|
1029
|
+
var Ft = 1, We = (
|
|
1030
|
+
/** @class */
|
|
1031
|
+
function() {
|
|
1032
|
+
function o(t, e, r) {
|
|
1033
|
+
this.wrapper = t, this.content = e, this.resizeTimeout = 0, this.hooks = new Y([
|
|
1034
|
+
"beforeStart",
|
|
1035
|
+
"beforeMove",
|
|
1036
|
+
"beforeScrollStart",
|
|
1037
|
+
"scrollStart",
|
|
1038
|
+
"scroll",
|
|
1039
|
+
"beforeEnd",
|
|
1040
|
+
"scrollEnd",
|
|
1041
|
+
"resize",
|
|
1042
|
+
"touchEnd",
|
|
1043
|
+
"end",
|
|
1044
|
+
"flick",
|
|
1045
|
+
"scrollCancel",
|
|
1046
|
+
"momentum",
|
|
1047
|
+
"scrollTo",
|
|
1048
|
+
"minDistanceScroll",
|
|
1049
|
+
"scrollToElement",
|
|
1050
|
+
"beforeRefresh"
|
|
1051
|
+
]), this.options = r;
|
|
1052
|
+
var i = this.options.bounce, n = i.left, s = i.right, l = i.top, c = i.bottom;
|
|
1053
|
+
this.scrollBehaviorX = new It(t, e, Ht(r, "scrollX", [n, s], {
|
|
1054
|
+
size: "width",
|
|
1055
|
+
position: "left"
|
|
1056
|
+
})), this.scrollBehaviorY = new It(t, e, Ht(r, "scrollY", [l, c], {
|
|
1057
|
+
size: "height",
|
|
1058
|
+
position: "top"
|
|
1059
|
+
})), this.translater = new xe(this.content), this.animater = Xe(this.content, this.translater, this.options), this.actionsHandler = new Be(this.options.bindToTarget ? this.content : t, He(this.options)), this.actions = new Le(this.scrollBehaviorX, this.scrollBehaviorY, this.actionsHandler, this.animater, this.options);
|
|
1060
|
+
var a = this.resize.bind(this);
|
|
1061
|
+
this.resizeRegister = new et(window, [
|
|
1062
|
+
{
|
|
1063
|
+
name: "orientationchange",
|
|
1064
|
+
handler: a
|
|
1065
|
+
},
|
|
1066
|
+
{
|
|
1067
|
+
name: "resize",
|
|
1068
|
+
handler: a
|
|
1069
|
+
}
|
|
1070
|
+
]), this.registerTransitionEnd(), this.init();
|
|
1071
|
+
}
|
|
1072
|
+
return o.prototype.init = function() {
|
|
1073
|
+
var t = this;
|
|
1074
|
+
this.bindTranslater(), this.bindAnimater(), this.bindActions(), this.hooks.on(this.hooks.eventTypes.scrollEnd, function() {
|
|
1075
|
+
t.togglePointerEvents(!0);
|
|
1076
|
+
});
|
|
1077
|
+
}, o.prototype.registerTransitionEnd = function() {
|
|
1078
|
+
this.transitionEndRegister = new et(this.content, [
|
|
1079
|
+
{
|
|
1080
|
+
name: _.transitionEnd,
|
|
1081
|
+
handler: this.transitionEnd.bind(this)
|
|
1082
|
+
}
|
|
1083
|
+
]);
|
|
1084
|
+
}, o.prototype.bindTranslater = function() {
|
|
1085
|
+
var t = this, e = this.translater.hooks;
|
|
1086
|
+
e.on(e.eventTypes.beforeTranslate, function(r) {
|
|
1087
|
+
t.options.translateZ && r.push(t.options.translateZ);
|
|
1088
|
+
}), e.on(e.eventTypes.translate, function(r) {
|
|
1089
|
+
var i = t.getCurrentPos();
|
|
1090
|
+
if (t.updatePositions(r), t.actions.ensuringInteger === !0) {
|
|
1091
|
+
t.actions.ensuringInteger = !1;
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
(r.x !== i.x || r.y !== i.y) && t.togglePointerEvents(!1);
|
|
1095
|
+
});
|
|
1096
|
+
}, o.prototype.bindAnimater = function() {
|
|
1097
|
+
var t = this;
|
|
1098
|
+
this.animater.hooks.on(this.animater.hooks.eventTypes.end, function(e) {
|
|
1099
|
+
t.resetPosition(t.options.bounceTime) || (t.animater.setPending(!1), t.hooks.trigger(t.hooks.eventTypes.scrollEnd, e));
|
|
1100
|
+
}), kt(this.animater.hooks, this.hooks, [
|
|
1101
|
+
{
|
|
1102
|
+
source: this.animater.hooks.eventTypes.move,
|
|
1103
|
+
target: this.hooks.eventTypes.scroll
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
source: this.animater.hooks.eventTypes.forceStop,
|
|
1107
|
+
target: this.hooks.eventTypes.scrollEnd
|
|
1108
|
+
}
|
|
1109
|
+
]);
|
|
1110
|
+
}, o.prototype.bindActions = function() {
|
|
1111
|
+
var t = this, e = this.actions;
|
|
1112
|
+
kt(e.hooks, this.hooks, [
|
|
1113
|
+
{
|
|
1114
|
+
source: e.hooks.eventTypes.start,
|
|
1115
|
+
target: this.hooks.eventTypes.beforeStart
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
source: e.hooks.eventTypes.start,
|
|
1119
|
+
target: this.hooks.eventTypes.beforeScrollStart
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
source: e.hooks.eventTypes.beforeMove,
|
|
1123
|
+
target: this.hooks.eventTypes.beforeMove
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
source: e.hooks.eventTypes.scrollStart,
|
|
1127
|
+
target: this.hooks.eventTypes.scrollStart
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
source: e.hooks.eventTypes.scroll,
|
|
1131
|
+
target: this.hooks.eventTypes.scroll
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
source: e.hooks.eventTypes.beforeEnd,
|
|
1135
|
+
target: this.hooks.eventTypes.beforeEnd
|
|
1136
|
+
}
|
|
1137
|
+
]), e.hooks.on(e.hooks.eventTypes.end, function(r, i) {
|
|
1138
|
+
if (t.hooks.trigger(t.hooks.eventTypes.touchEnd, i), t.hooks.trigger(t.hooks.eventTypes.end, i) || !e.fingerMoved && (t.hooks.trigger(t.hooks.eventTypes.scrollCancel), t.checkClick(r)))
|
|
1139
|
+
return !0;
|
|
1140
|
+
if (t.resetPosition(t.options.bounceTime, X.bounce))
|
|
1141
|
+
return t.animater.setForceStopped(!1), !0;
|
|
1142
|
+
}), e.hooks.on(e.hooks.eventTypes.scrollEnd, function(r, i) {
|
|
1143
|
+
var n = Math.abs(r.x - t.scrollBehaviorX.startPos), s = Math.abs(r.y - t.scrollBehaviorY.startPos);
|
|
1144
|
+
if (t.checkFlick(i, n, s)) {
|
|
1145
|
+
t.animater.setForceStopped(!1), t.hooks.trigger(t.hooks.eventTypes.flick);
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
if (t.momentum(r, i)) {
|
|
1149
|
+
t.animater.setForceStopped(!1);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
e.contentMoved && t.hooks.trigger(t.hooks.eventTypes.scrollEnd, r), t.animater.forceStopped && t.animater.setForceStopped(!1);
|
|
1153
|
+
});
|
|
1154
|
+
}, o.prototype.checkFlick = function(t, e, r) {
|
|
1155
|
+
var i = 1;
|
|
1156
|
+
if (this.hooks.events.flick.length > 1 && t < this.options.flickLimitTime && e < this.options.flickLimitDistance && r < this.options.flickLimitDistance && (r > i || e > i))
|
|
1157
|
+
return !0;
|
|
1158
|
+
}, o.prototype.momentum = function(t, e) {
|
|
1159
|
+
var r = {
|
|
1160
|
+
time: 0,
|
|
1161
|
+
easing: X.swiper,
|
|
1162
|
+
newX: t.x,
|
|
1163
|
+
newY: t.y
|
|
1164
|
+
}, i = this.scrollBehaviorX.end(e), n = this.scrollBehaviorY.end(e);
|
|
1165
|
+
if (r.newX = gt(i.destination) ? r.newX : i.destination, r.newY = gt(n.destination) ? r.newY : n.destination, r.time = Math.max(i.duration, n.duration), this.hooks.trigger(this.hooks.eventTypes.momentum, r, this), r.newX !== t.x || r.newY !== t.y)
|
|
1166
|
+
return (r.newX > this.scrollBehaviorX.minScrollPos || r.newX < this.scrollBehaviorX.maxScrollPos || r.newY > this.scrollBehaviorY.minScrollPos || r.newY < this.scrollBehaviorY.maxScrollPos) && (r.easing = X.swipeBounce), this.scrollTo(r.newX, r.newY, r.time, r.easing), !0;
|
|
1167
|
+
}, o.prototype.checkClick = function(t) {
|
|
1168
|
+
var e = {
|
|
1169
|
+
preventClick: this.animater.forceStopped
|
|
1170
|
+
};
|
|
1171
|
+
if (this.hooks.trigger(this.hooks.eventTypes.checkClick))
|
|
1172
|
+
return this.animater.setForceStopped(!1), !0;
|
|
1173
|
+
if (!e.preventClick) {
|
|
1174
|
+
var r = this.options.dblclick, i = !1;
|
|
1175
|
+
if (r && this.lastClickTime) {
|
|
1176
|
+
var n = r.delay, s = n === void 0 ? 300 : n;
|
|
1177
|
+
O() - this.lastClickTime < s && (i = !0, Se(t));
|
|
1178
|
+
}
|
|
1179
|
+
return this.options.tap && Te(t, this.options.tap), this.options.click && !R(t.target, this.options.preventDefaultException) && Ut(t), this.lastClickTime = i ? null : O(), !0;
|
|
1180
|
+
}
|
|
1181
|
+
return !1;
|
|
1182
|
+
}, o.prototype.resize = function() {
|
|
1183
|
+
var t = this;
|
|
1184
|
+
this.actions.enabled && (ue && (this.wrapper.scrollTop = 0), clearTimeout(this.resizeTimeout), this.resizeTimeout = window.setTimeout(function() {
|
|
1185
|
+
t.hooks.trigger(t.hooks.eventTypes.resize);
|
|
1186
|
+
}, this.options.resizePolling));
|
|
1187
|
+
}, o.prototype.transitionEnd = function(t) {
|
|
1188
|
+
if (!(t.target !== this.content || !this.animater.pending)) {
|
|
1189
|
+
var e = this.animater;
|
|
1190
|
+
e.transitionTime(), this.resetPosition(this.options.bounceTime, X.bounce) || (this.animater.setPending(!1), this.options.probeType !== 3 && this.hooks.trigger(this.hooks.eventTypes.scrollEnd, this.getCurrentPos()));
|
|
1191
|
+
}
|
|
1192
|
+
}, o.prototype.togglePointerEvents = function(t) {
|
|
1193
|
+
t === void 0 && (t = !0);
|
|
1194
|
+
for (var e = this.content.children.length ? this.content.children : [this.content], r = t ? "auto" : "none", i = 0; i < e.length; i++) {
|
|
1195
|
+
var n = e[i];
|
|
1196
|
+
n.isBScrollContainer || (n.style.pointerEvents = r);
|
|
1197
|
+
}
|
|
1198
|
+
}, o.prototype.refresh = function(t) {
|
|
1199
|
+
var e = this.setContent(t);
|
|
1200
|
+
this.hooks.trigger(this.hooks.eventTypes.beforeRefresh), this.scrollBehaviorX.refresh(t), this.scrollBehaviorY.refresh(t), e && (this.translater.setContent(t), this.animater.setContent(t), this.transitionEndRegister.destroy(), this.registerTransitionEnd(), this.options.bindToTarget && this.actionsHandler.setContent(t)), this.actions.refresh(), this.wrapperOffset = Yt(this.wrapper);
|
|
1201
|
+
}, o.prototype.setContent = function(t) {
|
|
1202
|
+
var e = t !== this.content;
|
|
1203
|
+
return e && (this.content = t), e;
|
|
1204
|
+
}, o.prototype.scrollBy = function(t, e, r, i) {
|
|
1205
|
+
r === void 0 && (r = 0);
|
|
1206
|
+
var n = this.getCurrentPos(), s = n.x, l = n.y;
|
|
1207
|
+
i = i || X.bounce, t += s, e += l, this.scrollTo(t, e, r, i);
|
|
1208
|
+
}, o.prototype.scrollTo = function(t, e, r, i, n) {
|
|
1209
|
+
r === void 0 && (r = 0), i === void 0 && (i = X.bounce), n === void 0 && (n = {
|
|
1210
|
+
start: {},
|
|
1211
|
+
end: {}
|
|
1212
|
+
});
|
|
1213
|
+
var s = this.options.useTransition ? i.style : i.fn, l = this.getCurrentPos(), c = N({ x: l.x, y: l.y }, n.start), a = N({
|
|
1214
|
+
x: t,
|
|
1215
|
+
y: e
|
|
1216
|
+
}, n.end);
|
|
1217
|
+
if (this.hooks.trigger(this.hooks.eventTypes.scrollTo, a), !Fe(c, a)) {
|
|
1218
|
+
var h = Math.abs(a.x - c.x), u = Math.abs(a.y - c.y);
|
|
1219
|
+
h < Ft && u < Ft && (r = 0, this.hooks.trigger(this.hooks.eventTypes.minDistanceScroll)), this.animater.move(c, a, r, s);
|
|
1220
|
+
}
|
|
1221
|
+
}, o.prototype.scrollToElement = function(t, e, r, i, n) {
|
|
1222
|
+
var s = Vt(t), l = Yt(s), c = function(h, u, f) {
|
|
1223
|
+
return typeof h == "number" ? h : h ? Math.round(u / 2 - f / 2) : 0;
|
|
1224
|
+
};
|
|
1225
|
+
r = c(r, s.offsetWidth, this.wrapper.offsetWidth), i = c(i, s.offsetHeight, this.wrapper.offsetHeight);
|
|
1226
|
+
var a = function(h, u, f, y) {
|
|
1227
|
+
return h -= u, h = y.adjustPosition(h - f), h;
|
|
1228
|
+
};
|
|
1229
|
+
l.left = a(l.left, this.wrapperOffset.left, r, this.scrollBehaviorX), l.top = a(l.top, this.wrapperOffset.top, i, this.scrollBehaviorY), !this.hooks.trigger(this.hooks.eventTypes.scrollToElement, s, l) && this.scrollTo(l.left, l.top, e, n);
|
|
1230
|
+
}, o.prototype.resetPosition = function(t, e) {
|
|
1231
|
+
t === void 0 && (t = 0), e === void 0 && (e = X.bounce);
|
|
1232
|
+
var r = this.scrollBehaviorX.checkInBoundary(), i = r.position, n = r.inBoundary, s = this.scrollBehaviorY.checkInBoundary(), l = s.position, c = s.inBoundary;
|
|
1233
|
+
return n && c ? !1 : (pe && this.reflow(), this.scrollTo(i, l, t, e), !0);
|
|
1234
|
+
}, o.prototype.reflow = function() {
|
|
1235
|
+
this._reflow = this.content.offsetHeight;
|
|
1236
|
+
}, o.prototype.updatePositions = function(t) {
|
|
1237
|
+
this.scrollBehaviorX.updatePosition(t.x), this.scrollBehaviorY.updatePosition(t.y);
|
|
1238
|
+
}, o.prototype.getCurrentPos = function() {
|
|
1239
|
+
return this.actions.getCurrentPos();
|
|
1240
|
+
}, o.prototype.enable = function() {
|
|
1241
|
+
this.actions.enabled = !0;
|
|
1242
|
+
}, o.prototype.disable = function() {
|
|
1243
|
+
I(this.animater.timer), this.actions.enabled = !1;
|
|
1244
|
+
}, o.prototype.destroy = function() {
|
|
1245
|
+
var t = this, e = [
|
|
1246
|
+
"resizeRegister",
|
|
1247
|
+
"transitionEndRegister",
|
|
1248
|
+
"actionsHandler",
|
|
1249
|
+
"actions",
|
|
1250
|
+
"hooks",
|
|
1251
|
+
"animater",
|
|
1252
|
+
"translater",
|
|
1253
|
+
"scrollBehaviorX",
|
|
1254
|
+
"scrollBehaviorY"
|
|
1255
|
+
];
|
|
1256
|
+
e.forEach(function(r) {
|
|
1257
|
+
return t[r].destroy();
|
|
1258
|
+
});
|
|
1259
|
+
}, o;
|
|
1260
|
+
}()
|
|
1261
|
+
), nt = (
|
|
1262
|
+
/** @class */
|
|
1263
|
+
function(o) {
|
|
1264
|
+
it(t, o);
|
|
1265
|
+
function t(e, r) {
|
|
1266
|
+
var i = o.call(this, [
|
|
1267
|
+
"refresh",
|
|
1268
|
+
"contentChanged",
|
|
1269
|
+
"enable",
|
|
1270
|
+
"disable",
|
|
1271
|
+
"beforeScrollStart",
|
|
1272
|
+
"scrollStart",
|
|
1273
|
+
"scroll",
|
|
1274
|
+
"scrollEnd",
|
|
1275
|
+
"scrollCancel",
|
|
1276
|
+
"touchEnd",
|
|
1277
|
+
"flick",
|
|
1278
|
+
"destroy"
|
|
1279
|
+
]) || this, n = Vt(e);
|
|
1280
|
+
return n ? (i.plugins = {}, i.options = new De().merge(r).process(), i.setContent(n).valid && (i.hooks = new Y([
|
|
1281
|
+
"refresh",
|
|
1282
|
+
"enable",
|
|
1283
|
+
"disable",
|
|
1284
|
+
"destroy",
|
|
1285
|
+
"beforeInitialScrollTo",
|
|
1286
|
+
"contentChanged"
|
|
1287
|
+
]), i.init(n)), i) : (tt("Can not resolve the wrapper DOM."), i);
|
|
1288
|
+
}
|
|
1289
|
+
return t.use = function(e) {
|
|
1290
|
+
var r = e.pluginName, i = t.plugins.some(function(n) {
|
|
1291
|
+
return e === n.ctor;
|
|
1292
|
+
});
|
|
1293
|
+
return i ? t : gt(r) ? (tt("Plugin Class must specify plugin's name in static property by 'pluginName' field."), t) : (t.pluginsMap[r] = !0, t.plugins.push({
|
|
1294
|
+
name: r,
|
|
1295
|
+
applyOrder: e.applyOrder,
|
|
1296
|
+
ctor: e
|
|
1297
|
+
}), t);
|
|
1298
|
+
}, t.prototype.setContent = function(e) {
|
|
1299
|
+
var r = !1, i = !0, n = e.children[this.options.specifiedIndexAsContent];
|
|
1300
|
+
return n ? (r = this.content !== n, r && (this.content = n)) : (tt("The wrapper need at least one child element to be content element to scroll."), i = !1), {
|
|
1301
|
+
valid: i,
|
|
1302
|
+
contentChanged: r
|
|
1303
|
+
};
|
|
1304
|
+
}, t.prototype.init = function(e) {
|
|
1305
|
+
var r = this;
|
|
1306
|
+
this.wrapper = e, e.isBScrollContainer = !0, this.scroller = new We(e, this.content, this.options), this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize, function() {
|
|
1307
|
+
r.refresh();
|
|
1308
|
+
}), this.eventBubbling(), this.handleAutoBlur(), this.enable(), this.proxy(ce), this.applyPlugins(), this.refreshWithoutReset(this.content);
|
|
1309
|
+
var i = this.options, n = i.startX, s = i.startY, l = {
|
|
1310
|
+
x: n,
|
|
1311
|
+
y: s
|
|
1312
|
+
};
|
|
1313
|
+
this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo, l) || this.scroller.scrollTo(l.x, l.y);
|
|
1314
|
+
}, t.prototype.applyPlugins = function() {
|
|
1315
|
+
var e = this, r = this.options;
|
|
1316
|
+
t.plugins.sort(function(i, n) {
|
|
1317
|
+
var s, l = (s = {}, s.pre = -1, s.post = 1, s), c = i.applyOrder ? l[i.applyOrder] : 0, a = n.applyOrder ? l[n.applyOrder] : 0;
|
|
1318
|
+
return c - a;
|
|
1319
|
+
}).forEach(function(i) {
|
|
1320
|
+
var n = i.ctor;
|
|
1321
|
+
r[i.name] && typeof n == "function" && (e.plugins[i.name] = new n(e));
|
|
1322
|
+
});
|
|
1323
|
+
}, t.prototype.handleAutoBlur = function() {
|
|
1324
|
+
this.options.autoBlur && this.on(this.eventTypes.beforeScrollStart, function() {
|
|
1325
|
+
var e = document.activeElement;
|
|
1326
|
+
e && (e.tagName === "INPUT" || e.tagName === "TEXTAREA") && e.blur();
|
|
1327
|
+
});
|
|
1328
|
+
}, t.prototype.eventBubbling = function() {
|
|
1329
|
+
kt(this.scroller.hooks, this, [
|
|
1330
|
+
this.eventTypes.beforeScrollStart,
|
|
1331
|
+
this.eventTypes.scrollStart,
|
|
1332
|
+
this.eventTypes.scroll,
|
|
1333
|
+
this.eventTypes.scrollEnd,
|
|
1334
|
+
this.eventTypes.scrollCancel,
|
|
1335
|
+
this.eventTypes.touchEnd,
|
|
1336
|
+
this.eventTypes.flick
|
|
1337
|
+
]);
|
|
1338
|
+
}, t.prototype.refreshWithoutReset = function(e) {
|
|
1339
|
+
this.scroller.refresh(e), this.hooks.trigger(this.hooks.eventTypes.refresh, e), this.trigger(this.eventTypes.refresh, e);
|
|
1340
|
+
}, t.prototype.proxy = function(e) {
|
|
1341
|
+
var r = this;
|
|
1342
|
+
e.forEach(function(i) {
|
|
1343
|
+
var n = i.key, s = i.sourceKey;
|
|
1344
|
+
Ee(r, s, n);
|
|
1345
|
+
});
|
|
1346
|
+
}, t.prototype.refresh = function() {
|
|
1347
|
+
var e = this.setContent(this.wrapper), r = e.contentChanged, i = e.valid;
|
|
1348
|
+
if (i) {
|
|
1349
|
+
var n = this.content;
|
|
1350
|
+
this.refreshWithoutReset(n), r && (this.hooks.trigger(this.hooks.eventTypes.contentChanged, n), this.trigger(this.eventTypes.contentChanged, n)), this.scroller.resetPosition();
|
|
1351
|
+
}
|
|
1352
|
+
}, t.prototype.enable = function() {
|
|
1353
|
+
this.scroller.enable(), this.hooks.trigger(this.hooks.eventTypes.enable), this.trigger(this.eventTypes.enable);
|
|
1354
|
+
}, t.prototype.disable = function() {
|
|
1355
|
+
this.scroller.disable(), this.hooks.trigger(this.hooks.eventTypes.disable), this.trigger(this.eventTypes.disable);
|
|
1356
|
+
}, t.prototype.destroy = function() {
|
|
1357
|
+
this.hooks.trigger(this.hooks.eventTypes.destroy), this.trigger(this.eventTypes.destroy), this.scroller.destroy();
|
|
1358
|
+
}, t.prototype.eventRegister = function(e) {
|
|
1359
|
+
this.registerType(e);
|
|
1360
|
+
}, t.plugins = [], t.pluginsMap = {}, t;
|
|
1361
|
+
}(Y)
|
|
1362
|
+
);
|
|
1363
|
+
function V(o, t) {
|
|
1364
|
+
var e = new nt(o, t);
|
|
1365
|
+
return e;
|
|
1366
|
+
}
|
|
1367
|
+
V.use = nt.use;
|
|
1368
|
+
V.plugins = nt.plugins;
|
|
1369
|
+
V.pluginsMap = nt.pluginsMap;
|
|
1370
|
+
var ze = V;
|
|
1371
|
+
/*!
|
|
1372
|
+
* better-scroll / wheel
|
|
1373
|
+
* (c) 2016-2023 ustbhuangyi
|
|
1374
|
+
* Released under the MIT License.
|
|
1375
|
+
*/
|
|
1376
|
+
var $ = typeof window < "u", ot = $ && navigator.userAgent.toLowerCase();
|
|
1377
|
+
ot && ot.indexOf("android") > 0;
|
|
1378
|
+
(function() {
|
|
1379
|
+
if (typeof ot == "string") {
|
|
1380
|
+
var o = /os (\d\d?_\d(_\d)?)/, t = o.exec(ot);
|
|
1381
|
+
if (!t)
|
|
1382
|
+
return !1;
|
|
1383
|
+
var e = t[1].split("_").map(function(r) {
|
|
1384
|
+
return parseInt(r, 10);
|
|
1385
|
+
});
|
|
1386
|
+
return e[0] === 13 && e[1] >= 4;
|
|
1387
|
+
}
|
|
1388
|
+
return !1;
|
|
1389
|
+
})();
|
|
1390
|
+
var Ke = !1;
|
|
1391
|
+
if ($) {
|
|
1392
|
+
var Ne = "test-passive";
|
|
1393
|
+
try {
|
|
1394
|
+
var Wt = {};
|
|
1395
|
+
Object.defineProperty(Wt, "passive", {
|
|
1396
|
+
get: function() {
|
|
1397
|
+
Ke = !0;
|
|
1398
|
+
}
|
|
1399
|
+
}), window.addEventListener(Ne, function() {
|
|
1400
|
+
}, Wt);
|
|
1401
|
+
} catch {
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
var Re = function(o, t) {
|
|
1405
|
+
for (var e in t)
|
|
1406
|
+
o[e] = t[e];
|
|
1407
|
+
return o;
|
|
1408
|
+
}, Jt = $ && document.createElement("div").style, F = function() {
|
|
1409
|
+
if (!$)
|
|
1410
|
+
return !1;
|
|
1411
|
+
for (var o = [
|
|
1412
|
+
{
|
|
1413
|
+
key: "standard",
|
|
1414
|
+
value: "transform"
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
key: "webkit",
|
|
1418
|
+
value: "webkitTransform"
|
|
1419
|
+
},
|
|
1420
|
+
{
|
|
1421
|
+
key: "Moz",
|
|
1422
|
+
value: "MozTransform"
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
key: "O",
|
|
1426
|
+
value: "OTransform"
|
|
1427
|
+
},
|
|
1428
|
+
{
|
|
1429
|
+
key: "ms",
|
|
1430
|
+
value: "msTransform"
|
|
1431
|
+
}
|
|
1432
|
+
], t = 0, e = o; t < e.length; t++) {
|
|
1433
|
+
var r = e[t];
|
|
1434
|
+
if (Jt[r.value] !== void 0)
|
|
1435
|
+
return r.key;
|
|
1436
|
+
}
|
|
1437
|
+
return !1;
|
|
1438
|
+
}();
|
|
1439
|
+
function x(o) {
|
|
1440
|
+
return F === !1 ? o : F === "standard" ? o === "transitionEnd" ? "transitionend" : o : F + o.charAt(0).toUpperCase() + o.substr(1);
|
|
1441
|
+
}
|
|
1442
|
+
F && F !== "standard" && "" + F.toLowerCase();
|
|
1443
|
+
var Ve = x("transform"), $e = x("transition");
|
|
1444
|
+
$ && x("perspective") in Jt;
|
|
1445
|
+
var dt = {
|
|
1446
|
+
transform: Ve,
|
|
1447
|
+
transition: $e,
|
|
1448
|
+
transitionTimingFunction: x("transitionTimingFunction"),
|
|
1449
|
+
transitionDuration: x("transitionDuration"),
|
|
1450
|
+
transitionDelay: x("transitionDelay"),
|
|
1451
|
+
transformOrigin: x("transformOrigin"),
|
|
1452
|
+
transitionEnd: x("transitionEnd"),
|
|
1453
|
+
transitionProperty: x("transitionProperty")
|
|
1454
|
+
};
|
|
1455
|
+
function Q(o, t) {
|
|
1456
|
+
var e = new RegExp("(^|\\s)" + t + "(\\s|$)");
|
|
1457
|
+
return e.test(o.className);
|
|
1458
|
+
}
|
|
1459
|
+
function je(o) {
|
|
1460
|
+
return Array.prototype.slice.call(o, 0);
|
|
1461
|
+
}
|
|
1462
|
+
var Ue = {
|
|
1463
|
+
// easeOutQuint
|
|
1464
|
+
swipe: {
|
|
1465
|
+
style: "cubic-bezier(0.23, 1, 0.32, 1)",
|
|
1466
|
+
fn: function(o) {
|
|
1467
|
+
return 1 + --o * o * o * o * o;
|
|
1468
|
+
}
|
|
1469
|
+
},
|
|
1470
|
+
// easeOutQuard
|
|
1471
|
+
swipeBounce: {
|
|
1472
|
+
style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
|
|
1473
|
+
fn: function(o) {
|
|
1474
|
+
return o * (2 - o);
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
// easeOutQuart
|
|
1478
|
+
bounce: {
|
|
1479
|
+
style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
|
|
1480
|
+
fn: function(o) {
|
|
1481
|
+
return 1 - --o * o * o * o;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
}, qe = "plugins.wheel", Ge = [
|
|
1485
|
+
{
|
|
1486
|
+
key: "wheelTo",
|
|
1487
|
+
name: "wheelTo"
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
key: "getSelectedIndex",
|
|
1491
|
+
name: "getSelectedIndex"
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
key: "restorePosition",
|
|
1495
|
+
name: "restorePosition"
|
|
1496
|
+
}
|
|
1497
|
+
], Ze = Ge.map(function(o) {
|
|
1498
|
+
return {
|
|
1499
|
+
key: o.key,
|
|
1500
|
+
sourceKey: qe + "." + o.name
|
|
1501
|
+
};
|
|
1502
|
+
}), zt = "wheelIndexChanged", Je = {
|
|
1503
|
+
rate: 4
|
|
1504
|
+
}, Qe = (
|
|
1505
|
+
/** @class */
|
|
1506
|
+
function() {
|
|
1507
|
+
function o(t) {
|
|
1508
|
+
this.scroll = t, this.init();
|
|
1509
|
+
}
|
|
1510
|
+
return o.prototype.init = function() {
|
|
1511
|
+
this.handleBScroll(), this.handleOptions(), this.handleHooks(), this.refreshBoundary(), this.setSelectedIndex(this.options.selectedIndex);
|
|
1512
|
+
}, o.prototype.handleBScroll = function() {
|
|
1513
|
+
this.scroll.proxy(Ze), this.scroll.registerType([zt]);
|
|
1514
|
+
}, o.prototype.handleOptions = function() {
|
|
1515
|
+
var t = this.scroll.options.wheel === !0 ? {} : this.scroll.options.wheel, e = {
|
|
1516
|
+
wheelWrapperClass: "wheel-scroll",
|
|
1517
|
+
wheelItemClass: "wheel-item",
|
|
1518
|
+
rotate: 25,
|
|
1519
|
+
adjustTime: 400,
|
|
1520
|
+
selectedIndex: 0,
|
|
1521
|
+
wheelDisabledItemClass: "wheel-disabled-item"
|
|
1522
|
+
};
|
|
1523
|
+
this.options = Re(e, t);
|
|
1524
|
+
}, o.prototype.handleHooks = function() {
|
|
1525
|
+
var t = this, e = this.scroll, r = this.scroll.scroller, i = r.actionsHandler, n = r.scrollBehaviorX, s = r.scrollBehaviorY, l = r.animater, c = r.content;
|
|
1526
|
+
e.on(e.eventTypes.scrollEnd, function(a) {
|
|
1527
|
+
var h = t.findNearestValidWheel(a.y).index;
|
|
1528
|
+
if (r.animater.forceStopped && !t.isAdjustingPosition)
|
|
1529
|
+
return t.target = t.items[h], !0;
|
|
1530
|
+
t.setSelectedIndex(h), t.isAdjustingPosition && (t.isAdjustingPosition = !1);
|
|
1531
|
+
}), this.scroll.hooks.on(this.scroll.hooks.eventTypes.refresh, function(a) {
|
|
1532
|
+
a !== c && (c = a, t.setSelectedIndex(t.options.selectedIndex, !0)), t.rotateX(t.scroll.y), t.wheelTo(t.selectedIndex, 0);
|
|
1533
|
+
}), this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo, function(a) {
|
|
1534
|
+
a.x = 0, a.y = -(t.selectedIndex * t.itemHeight);
|
|
1535
|
+
}), r.hooks.on(r.hooks.eventTypes.checkClick, function() {
|
|
1536
|
+
var a = je(t.items).indexOf(t.target);
|
|
1537
|
+
return a === -1 || t.wheelTo(a, t.options.adjustTime, Ue.swipe), !0;
|
|
1538
|
+
}), r.hooks.on(r.hooks.eventTypes.scrollTo, function(a) {
|
|
1539
|
+
a.y = t.findNearestValidWheel(a.y).y;
|
|
1540
|
+
}), r.hooks.on(r.hooks.eventTypes.minDistanceScroll, function() {
|
|
1541
|
+
var a = r.animater;
|
|
1542
|
+
a.forceStopped === !0 && (a.forceStopped = !1);
|
|
1543
|
+
}), r.hooks.on(r.hooks.eventTypes.scrollToElement, function(a, h) {
|
|
1544
|
+
if (Q(a, t.options.wheelItemClass))
|
|
1545
|
+
h.top = t.findNearestValidWheel(h.top).y;
|
|
1546
|
+
else
|
|
1547
|
+
return !0;
|
|
1548
|
+
}), i.hooks.on(i.hooks.eventTypes.beforeStart, function(a) {
|
|
1549
|
+
t.target = a.target;
|
|
1550
|
+
}), n.hooks.on(n.hooks.eventTypes.computeBoundary, function(a) {
|
|
1551
|
+
a.maxScrollPos = 0, a.minScrollPos = 0;
|
|
1552
|
+
}), s.hooks.on(s.hooks.eventTypes.computeBoundary, function(a) {
|
|
1553
|
+
t.items = t.scroll.scroller.content.children, t.checkWheelAllDisabled(), t.itemHeight = t.items.length > 0 ? s.contentSize / t.items.length : 0, a.maxScrollPos = -t.itemHeight * (t.items.length - 1), a.minScrollPos = 0;
|
|
1554
|
+
}), s.hooks.on(s.hooks.eventTypes.momentum, function(a) {
|
|
1555
|
+
a.rate = Je.rate, a.destination = t.findNearestValidWheel(a.destination).y;
|
|
1556
|
+
}), s.hooks.on(s.hooks.eventTypes.end, function(a) {
|
|
1557
|
+
var h = t.findNearestValidWheel(s.currentPos);
|
|
1558
|
+
a.destination = h.y, a.duration = t.options.adjustTime;
|
|
1559
|
+
}), l.hooks.on(l.hooks.eventTypes.time, function(a) {
|
|
1560
|
+
t.transitionDuration(a);
|
|
1561
|
+
}), l.hooks.on(l.hooks.eventTypes.timeFunction, function(a) {
|
|
1562
|
+
t.timeFunction(a);
|
|
1563
|
+
}), l.hooks.on(l.hooks.eventTypes.callStop, function() {
|
|
1564
|
+
var a = t.findNearestValidWheel(t.scroll.y).index;
|
|
1565
|
+
t.isAdjustingPosition = !0, t.wheelTo(a, 0);
|
|
1566
|
+
}), l.translater.hooks.on(l.translater.hooks.eventTypes.translate, function(a) {
|
|
1567
|
+
t.rotateX(a.y);
|
|
1568
|
+
});
|
|
1569
|
+
}, o.prototype.refreshBoundary = function() {
|
|
1570
|
+
var t = this.scroll.scroller, e = t.scrollBehaviorX, r = t.scrollBehaviorY, i = t.content;
|
|
1571
|
+
e.refresh(i), r.refresh(i);
|
|
1572
|
+
}, o.prototype.setSelectedIndex = function(t, e) {
|
|
1573
|
+
e === void 0 && (e = !1);
|
|
1574
|
+
var r = this.selectedIndex;
|
|
1575
|
+
this.selectedIndex = t, r !== t && !e && this.scroll.trigger(zt, t);
|
|
1576
|
+
}, o.prototype.getSelectedIndex = function() {
|
|
1577
|
+
return this.selectedIndex;
|
|
1578
|
+
}, o.prototype.wheelTo = function(t, e, r) {
|
|
1579
|
+
t === void 0 && (t = 0), e === void 0 && (e = 0);
|
|
1580
|
+
var i = -t * this.itemHeight;
|
|
1581
|
+
this.scroll.scrollTo(0, i, e, r);
|
|
1582
|
+
}, o.prototype.restorePosition = function() {
|
|
1583
|
+
var t = this.scroll.pending;
|
|
1584
|
+
if (t) {
|
|
1585
|
+
var e = this.getSelectedIndex();
|
|
1586
|
+
this.scroll.scroller.animater.clearTimer(), this.wheelTo(e, 0);
|
|
1587
|
+
}
|
|
1588
|
+
}, o.prototype.transitionDuration = function(t) {
|
|
1589
|
+
for (var e = 0; e < this.items.length; e++)
|
|
1590
|
+
this.items[e].style[dt.transitionDuration] = t + "ms";
|
|
1591
|
+
}, o.prototype.timeFunction = function(t) {
|
|
1592
|
+
for (var e = 0; e < this.items.length; e++)
|
|
1593
|
+
this.items[e].style[dt.transitionTimingFunction] = t;
|
|
1594
|
+
}, o.prototype.rotateX = function(t) {
|
|
1595
|
+
for (var e = this.options.rotate, r = e === void 0 ? 25 : e, i = 0; i < this.items.length; i++) {
|
|
1596
|
+
var n = r * (t / this.itemHeight + i), s = n.toFixed(3);
|
|
1597
|
+
this.items[i].style[dt.transform] = "rotateX(" + s + "deg)";
|
|
1598
|
+
}
|
|
1599
|
+
}, o.prototype.findNearestValidWheel = function(t) {
|
|
1600
|
+
t = t > 0 ? 0 : t < this.scroll.maxScrollY ? this.scroll.maxScrollY : t;
|
|
1601
|
+
for (var e = Math.abs(Math.round(-t / this.itemHeight)), r = e, i = this.items, n = this.options.wheelDisabledItemClass; e >= 0 && Q(i[e], n); )
|
|
1602
|
+
e--;
|
|
1603
|
+
if (e < 0)
|
|
1604
|
+
for (e = r; e <= i.length - 1 && Q(i[e], n); )
|
|
1605
|
+
e++;
|
|
1606
|
+
return e === i.length && (e = r), {
|
|
1607
|
+
index: this.wheelItemsAllDisabled ? -1 : e,
|
|
1608
|
+
y: -e * this.itemHeight
|
|
1609
|
+
};
|
|
1610
|
+
}, o.prototype.checkWheelAllDisabled = function() {
|
|
1611
|
+
var t = this.options.wheelDisabledItemClass, e = this.items;
|
|
1612
|
+
this.wheelItemsAllDisabled = !0;
|
|
1613
|
+
for (var r = 0; r < e.length; r++)
|
|
1614
|
+
if (!Q(e[r], t)) {
|
|
1615
|
+
this.wheelItemsAllDisabled = !1;
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
}, o.pluginName = "wheel", o;
|
|
1619
|
+
}()
|
|
1620
|
+
);
|
|
1621
|
+
const rt = Array.isArray, to = (o) => typeof o == "object" && o !== null;
|
|
1622
|
+
function St(o) {
|
|
1623
|
+
return rt(o) && o.length === 3;
|
|
1624
|
+
}
|
|
1625
|
+
function eo(o) {
|
|
1626
|
+
if (!o) return {};
|
|
1627
|
+
const t = 1900, e = 2100, r = /* @__PURE__ */ new Date(), i = r.getFullYear(), n = r.getMonth() + 1, s = r.getDate(), l = L(i), c = L(n), a = v(t, e), h = v(1, 12), u = C(() => {
|
|
1628
|
+
const m = [4, 6, 9, 11], S = [1, 3, 5, 7, 8, 10, 12], w = m.includes(c.value) ? 30 : S.includes(c.value) ? 31 : y(l.value) ? 29 : 28;
|
|
1629
|
+
return v(1, w);
|
|
1630
|
+
}), f = C(() => [a, h, u.value]);
|
|
1631
|
+
function y(m) {
|
|
1632
|
+
return m % 4 === 0 && (m % 100 !== 0 || m % 400 === 0);
|
|
1633
|
+
}
|
|
1634
|
+
function v(m, S) {
|
|
1635
|
+
const w = [];
|
|
1636
|
+
for (let E = m; E <= S; E++)
|
|
1637
|
+
w.push(E);
|
|
1638
|
+
return w;
|
|
1639
|
+
}
|
|
1640
|
+
function T(m) {
|
|
1641
|
+
return (St(m) ? m : [i, n, s]).map((w, E) => {
|
|
1642
|
+
const j = f.value[E].indexOf(w);
|
|
1643
|
+
return j > -1 ? j : 0;
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
function g(m) {
|
|
1647
|
+
const [S, w] = m;
|
|
1648
|
+
l.value = f.value[0][S], c.value = f.value[1][w];
|
|
1649
|
+
}
|
|
1650
|
+
return {
|
|
1651
|
+
selectYear: l,
|
|
1652
|
+
selectMonth: c,
|
|
1653
|
+
dateList: f,
|
|
1654
|
+
updateDateSelect: g,
|
|
1655
|
+
getDateAnchors: T
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
function oo(o) {
|
|
1659
|
+
if (!o) return {};
|
|
1660
|
+
const t = n(0, 23), e = n(0, 59), r = n(0, 59), i = L([]);
|
|
1661
|
+
s();
|
|
1662
|
+
function n(c, a) {
|
|
1663
|
+
const h = [];
|
|
1664
|
+
for (let u = c; u <= a; u++)
|
|
1665
|
+
h.push(`${u}`.padStart(2, "0"));
|
|
1666
|
+
return h;
|
|
1667
|
+
}
|
|
1668
|
+
function s() {
|
|
1669
|
+
const c = /* @__PURE__ */ new Date(), a = c.getHours(), h = c.getMinutes(), u = c.getSeconds();
|
|
1670
|
+
i.value = [a, h, u];
|
|
1671
|
+
}
|
|
1672
|
+
function l(c) {
|
|
1673
|
+
return (St(c) ? c : i.value).map((h) => +h);
|
|
1674
|
+
}
|
|
1675
|
+
return {
|
|
1676
|
+
timeList: [t, e, r],
|
|
1677
|
+
updateDefaultTime: s,
|
|
1678
|
+
getTimeAnchors: l
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
ze.use(Qe);
|
|
1682
|
+
function ro(o, t) {
|
|
1683
|
+
const e = L([]), r = L(), i = L([]), n = C(() => o.type === "date"), s = C(() => o.type === "time"), { selectYear: l, selectMonth: c, dateList: a, updateDateSelect: h, getDateAnchors: u } = eo(n.value), { timeList: f, updateDefaultTime: y, getTimeAnchors: v } = oo(s.value), T = C(() => n.value ? u(o.anchor) : s.value ? v(o.anchor) : rt(o.anchor) ? o.anchor : [o.anchor]);
|
|
1684
|
+
async function g(p = !1) {
|
|
1685
|
+
p ? m() : S(), await ne(), e.value.forEach((k, d) => w(d)), !p && j(), te();
|
|
1686
|
+
}
|
|
1687
|
+
function m() {
|
|
1688
|
+
const p = {
|
|
1689
|
+
date: a == null ? void 0 : a.value,
|
|
1690
|
+
time: f
|
|
1691
|
+
}, k = o.type, b = rt(o.data[0]) ? [...o.data] : [o.data];
|
|
1692
|
+
e.value = p[k] ?? b;
|
|
1693
|
+
}
|
|
1694
|
+
function S() {
|
|
1695
|
+
n.value && h(T.value), s.value && !St(o.anchor) && y();
|
|
1696
|
+
}
|
|
1697
|
+
function w(p) {
|
|
1698
|
+
var b;
|
|
1699
|
+
const k = (b = r.value) == null ? void 0 : b.children[p];
|
|
1700
|
+
if (!k) throw new Error("It's not find wheelWrapper");
|
|
1701
|
+
let d = i.value[p];
|
|
1702
|
+
if (d)
|
|
1703
|
+
d.refresh();
|
|
1704
|
+
else {
|
|
1705
|
+
const at = V(k, {
|
|
1706
|
+
wheel: {
|
|
1707
|
+
selectedIndex: 0,
|
|
1708
|
+
rotate: 25
|
|
1709
|
+
},
|
|
1710
|
+
swipeTime: o.swipeTime ?? 500
|
|
1711
|
+
});
|
|
1712
|
+
d = i.value[p] = at, d.on("scrollEnd", () => E(p));
|
|
1713
|
+
}
|
|
1714
|
+
return d;
|
|
1715
|
+
}
|
|
1716
|
+
function E(p) {
|
|
1717
|
+
if (!n.value || p === 2) return;
|
|
1718
|
+
const k = i.value[p].getSelectedIndex(), d = a.value[p][k];
|
|
1719
|
+
p === 0 && (l.value = d), p === 1 && (c.value = d), g(!0);
|
|
1720
|
+
}
|
|
1721
|
+
function j() {
|
|
1722
|
+
i.value.forEach((p, k) => {
|
|
1723
|
+
var b;
|
|
1724
|
+
const d = (b = T.value) == null ? void 0 : b[k];
|
|
1725
|
+
p.wheelTo(d ?? 0);
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
function te() {
|
|
1729
|
+
const p = e.value.length;
|
|
1730
|
+
if (i.value.length <= p) return;
|
|
1731
|
+
i.value.splice(p).forEach((d) => d.destroy());
|
|
1732
|
+
}
|
|
1733
|
+
function ee() {
|
|
1734
|
+
t("cancel"), st();
|
|
1735
|
+
}
|
|
1736
|
+
function oe() {
|
|
1737
|
+
i.value.some((b) => b.isInTransition) && re();
|
|
1738
|
+
const { item: k, anchor: d } = ie();
|
|
1739
|
+
t("confirm", k), t("update:anchor", d), st();
|
|
1740
|
+
}
|
|
1741
|
+
function st() {
|
|
1742
|
+
t("update:isShowPicker", !1);
|
|
1743
|
+
}
|
|
1744
|
+
function re() {
|
|
1745
|
+
i.value.forEach((p) => p.stop());
|
|
1746
|
+
}
|
|
1747
|
+
function ie() {
|
|
1748
|
+
const { item: p, anchor: k } = i.value.reduce(
|
|
1749
|
+
(d, b, at) => {
|
|
1750
|
+
const wt = b.getSelectedIndex(), lt = e.value[at][wt];
|
|
1751
|
+
return d.item.push(s.value ? +lt : lt), d.anchor.push(n.value ? lt : wt), d;
|
|
1752
|
+
},
|
|
1753
|
+
{ item: [], anchor: [] }
|
|
1754
|
+
);
|
|
1755
|
+
return p.length > 1 ? { item: p, anchor: k } : { item: p[0], anchor: k[0] };
|
|
1756
|
+
}
|
|
1757
|
+
return bt(
|
|
1758
|
+
() => o.data,
|
|
1759
|
+
() => g(!0),
|
|
1760
|
+
{ immediate: !0 }
|
|
1761
|
+
), bt(
|
|
1762
|
+
() => o.isShowPicker,
|
|
1763
|
+
(p) => p && g()
|
|
1764
|
+
), {
|
|
1765
|
+
pickerData: e,
|
|
1766
|
+
wheelWrapper: r,
|
|
1767
|
+
cancel: ee,
|
|
1768
|
+
confirm: oe,
|
|
1769
|
+
closePicker: st
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
const Qt = (o) => (ae("data-v-f4d0313e"), o = o(), le(), o), io = { class: "picker" }, no = { class: "picker_title" }, so = { class: "picker_panel" }, ao = /* @__PURE__ */ Qt(() => /* @__PURE__ */ P("div", { class: "picker_mask_top" }, null, -1)), lo = /* @__PURE__ */ Qt(() => /* @__PURE__ */ P("div", { class: "picker_mask_bottom" }, null, -1)), co = { class: "picker_wheel_scroll" }, ho = /* @__PURE__ */ se({
|
|
1773
|
+
__name: "Picker",
|
|
1774
|
+
props: {
|
|
1775
|
+
data: { default: () => [] },
|
|
1776
|
+
isShowPicker: { type: Boolean, default: !1 },
|
|
1777
|
+
options: { default: () => ({}) },
|
|
1778
|
+
anchor: {},
|
|
1779
|
+
showKey: {},
|
|
1780
|
+
swipeTime: { default: 500 },
|
|
1781
|
+
type: { default: "" }
|
|
1782
|
+
},
|
|
1783
|
+
emits: ["update:isShowPicker", "update:anchor", "cancel", "confirm"],
|
|
1784
|
+
setup(o, { emit: t }) {
|
|
1785
|
+
const e = o, r = t, i = C(() => ({
|
|
1786
|
+
cancelClass: "",
|
|
1787
|
+
confirmClass: "",
|
|
1788
|
+
titleClass: "",
|
|
1789
|
+
cancelColor: "#999",
|
|
1790
|
+
confirmColor: "#42b983",
|
|
1791
|
+
titleColor: "",
|
|
1792
|
+
cancelText: "Cancel",
|
|
1793
|
+
confirmText: "Confirm",
|
|
1794
|
+
titleText: "",
|
|
1795
|
+
...e.options
|
|
1796
|
+
})), n = C(() => i.value.cancelColor), s = C(() => i.value.confirmColor), l = C(() => i.value.titleColor), c = C(() => rt(e.showKey) ? e.showKey : [e.showKey]), { pickerData: a, wheelWrapper: h, cancel: u, confirm: f, closePicker: y } = ro(e, r);
|
|
1797
|
+
return (v, T) => (z(), K(ct, null, [
|
|
1798
|
+
Pt(Et, { name: "fade" }, {
|
|
1799
|
+
default: Ct(() => [
|
|
1800
|
+
Dt(P("div", {
|
|
1801
|
+
class: "mask",
|
|
1802
|
+
onClick: T[0] || (T[0] = //@ts-ignore
|
|
1803
|
+
(...g) => A(y) && A(y)(...g))
|
|
1804
|
+
}, null, 512), [
|
|
1805
|
+
[Bt, v.isShowPicker]
|
|
1806
|
+
])
|
|
1807
|
+
]),
|
|
1808
|
+
_: 1
|
|
1809
|
+
}),
|
|
1810
|
+
Pt(Et, { name: "slide" }, {
|
|
1811
|
+
default: Ct(() => [
|
|
1812
|
+
Dt(P("div", io, [
|
|
1813
|
+
P("div", no, [
|
|
1814
|
+
P("button", {
|
|
1815
|
+
class: ht(["picker_cancel", i.value.cancelClass]),
|
|
1816
|
+
style: ut({ color: n.value }),
|
|
1817
|
+
onClick: T[1] || (T[1] = //@ts-ignore
|
|
1818
|
+
(...g) => A(u) && A(u)(...g))
|
|
1819
|
+
}, U(i.value.cancelText), 7),
|
|
1820
|
+
P("button", {
|
|
1821
|
+
class: ht(["picker_confirm", i.value.confirmClass]),
|
|
1822
|
+
style: ut({ color: s.value }),
|
|
1823
|
+
onClick: T[2] || (T[2] = //@ts-ignore
|
|
1824
|
+
(...g) => A(f) && A(f)(...g))
|
|
1825
|
+
}, U(i.value.confirmText), 7),
|
|
1826
|
+
P("h4", {
|
|
1827
|
+
class: ht([i.value.titleClass]),
|
|
1828
|
+
style: ut({ color: l.value })
|
|
1829
|
+
}, U(i.value.titleText), 7)
|
|
1830
|
+
]),
|
|
1831
|
+
P("div", so, [
|
|
1832
|
+
ao,
|
|
1833
|
+
lo,
|
|
1834
|
+
P("div", {
|
|
1835
|
+
ref_key: "wheelWrapper",
|
|
1836
|
+
ref: h,
|
|
1837
|
+
class: "picker_wheel_wrapper"
|
|
1838
|
+
}, [
|
|
1839
|
+
(z(!0), K(ct, null, xt(A(a), (g, m) => (z(), K("div", {
|
|
1840
|
+
key: m,
|
|
1841
|
+
class: "picker_wheel"
|
|
1842
|
+
}, [
|
|
1843
|
+
P("ul", co, [
|
|
1844
|
+
(z(!0), K(ct, null, xt(g, (S, w) => {
|
|
1845
|
+
var E;
|
|
1846
|
+
return z(), K("li", {
|
|
1847
|
+
key: w,
|
|
1848
|
+
class: "picker_wheel_item"
|
|
1849
|
+
}, U((E = c.value) != null && E[m] && A(to)(S) ? S[c.value[m]] : S), 1);
|
|
1850
|
+
}), 128))
|
|
1851
|
+
])
|
|
1852
|
+
]))), 128))
|
|
1853
|
+
], 512)
|
|
1854
|
+
])
|
|
1855
|
+
], 512), [
|
|
1856
|
+
[Bt, v.isShowPicker]
|
|
1857
|
+
])
|
|
1858
|
+
]),
|
|
1859
|
+
_: 1
|
|
1860
|
+
})
|
|
1861
|
+
], 64));
|
|
1862
|
+
}
|
|
1863
|
+
}), uo = (o, t) => {
|
|
1864
|
+
const e = o.__vccOpts || o;
|
|
1865
|
+
for (const [r, i] of t)
|
|
1866
|
+
e[r] = i;
|
|
1867
|
+
return e;
|
|
1868
|
+
}, Kt = /* @__PURE__ */ uo(ho, [["__scopeId", "data-v-f4d0313e"]]);
|
|
1869
|
+
Kt.install = function(o) {
|
|
1870
|
+
o.component("Picker", Kt);
|
|
1871
|
+
};
|
|
1872
|
+
export {
|
|
1873
|
+
Kt as default
|
|
1874
|
+
};
|