12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673 |
- !
- function(e, t) {
- "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.Picker = t() : e.Picker = t()
- }(this, function() {
- return function(e) {
- function t(n) {
- if (i[n]) return i[n].exports;
- var r = i[n] = {
- exports: {},
- id: n,
- loaded: !1
- };
- return e[n].call(r.exports, r, r.exports, t), r.loaded = !0, r.exports
- }
- var i = {};
- return t.m = e, t.c = i, t.p = "", t(0)
- }([function(e, t, i) {
- "use strict";
- function n(e) {
- return e && e.__esModule ? e : {
- default:
- e
- }
- }
- t.__esModule = !0;
- var r = i(1),
- o = n(r);
- o.
- default.version = "1.1.2", t.
- default = o.
- default, e.exports = t.
- default
- }, function(e, t, i) {
- "use strict";
- function n(e) {
- return e && e.__esModule ? e : {
- default:
- e
- }
- }
- function r(e, t) {
- if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
- }
- function o(e, t) {
- if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !t || "object" != typeof t && "function" != typeof t ? e : t
- }
- function s(e, t) {
- if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
- e.prototype = Object.create(t && t.prototype, {
- constructor: {
- value: e,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
- }
- t.__esModule = !0;
- var a = function() {
- function e(e, t) {
- for (var i = 0; i < t.length; i++) {
- var n = t[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
- }
- }
- return function(t, i, n) {
- return i && e(t.prototype, i), n && e(t, n), t
- }
- }(),
- l = i(2),
- h = n(l),
- c = i(3),
- p = n(c),
- u = i(4),
- f = i(5),
- d = i(6),
- m = n(d),
- v = i(14),
- g = n(v);
- i(15);
- var y = function(e) {
- function t(e) {
- r(this, t);
- var i = o(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
- return i.options = {
- data: [],
- title: "",
- selectedIndex: null,
- showCls: "show"
- }, (0, u.extend)(i.options, e), i.data = i.options.data, i.pickerEl = (0, f.createDom)((0, m.
- default)({
- data: i.data,
- title: i.options.title
- })), document.body.appendChild(i.pickerEl), i.maskEl = i.pickerEl.getElementsByClassName("mask-hook")[0], i.wheelEl = i.pickerEl.getElementsByClassName("wheel-hook"), i.panelEl = i.pickerEl.getElementsByClassName("panel-hook")[0], i.confirmEl = i.pickerEl.getElementsByClassName("confirm-hook")[0], i.cancelEl = i.pickerEl.getElementsByClassName("cancel-hook")[0], i.scrollEl = i.pickerEl.getElementsByClassName("wheel-scroll-hook"), i._init(), i
- }
- return s(t, e), a(t, [{
- key: "_init",
- value: function() {
- if (this.selectedIndex = [], this.selectedVal = [], this.options.selectedIndex) this.selectedIndex = this.options.selectedIndex;
- else for (var e = 0; e < this.data.length; e++) this.selectedIndex[e] = 0;
- this._bindEvent();
- }
- }, {
- key: "_bindEvent",
- value: function() {
- var e = this;
- (0, f.addEvent)(this.pickerEl, "touchmove", function(e) {
- e.preventDefault()
- }), (0, f.addEvent)(this.confirmEl, "click", function() {
- console.log(e.selectedIndex+"...");
- e.hide();
- for (var t = !1, i = 0; i < e.data.length; i++) {
- var n = e.wheels[i].getSelectedIndex();
- e.selectedIndex[i] = n;
- var r = null;
- e.data[i].length && (r = e.data[i][n].value), e.selectedVal[i] !== r && (t = !0), e.selectedVal[i] = r
- }
- $("#select_demo").val(e.selectedVal[0]+"-"+e.selectedVal[1]+"-"+e.selectedVal[2]);
- e.trigger("picker.select", e.selectedVal, e.selectedIndex), t && e.trigger("picker.valuechange", e.selectedVal, e.selectedIndex)
- }), (0, f.addEvent)(this.cancelEl, "click", function() {
- e.hide(), e.trigger("picker.cancel")
- })
- }
- }, {
- key: "_createWheel",
- value: function(e, t) {
- var i = this;
- return this.wheels[t] = new h.
- default (e[t], {
- wheel: !0,
- selectedIndex: this.selectedIndex[t]
- }), function(e) {
- i.wheels[e].on("scrollEnd", function() {
- var n = i.wheels[e].getSelectedIndex();
- i.selectedIndex[t] !== n && (i.selectedIndex[t] = n, i.trigger("picker.change", e, n))
- })
- }(t), this.wheels[t]
- }
- }, {
- key: "show",
- value: function(e) {
- var t = this;
- this.pickerEl.style.display = "block";
- var i = this.options.showCls;
- window.setTimeout(function() {
- if ((0, f.addClass)(t.maskEl, i), (0, f.addClass)(t.panelEl, i), t.wheels) for (var n = 0; n < t.data.length; n++) t.wheels[n].enable(), t.wheels[n].wheelTo(t.selectedIndex[n]);
- else {
- t.wheels = [];
- for (var r = 0; r < t.data.length; r++) t._createWheel(t.wheelEl, r)
- }
- e && e()
- }, 0)
- }
- }, {
- key: "hide",
- value: function() {
- var e = this,
- t = this.options.showCls;
- (0, f.removeClass)(this.maskEl, t), (0, f.removeClass)(this.panelEl, t), window.setTimeout(function() {
- e.pickerEl.style.display = "none";
- for (var t = 0; t < e.data.length; t++) e.wheels[t].disable()
- }, 500)
- }
- }, {
- key: "refillColumn",
- value: function(e, t) {
- var i = this.scrollEl[e],
- n = this.wheels[e];
- if (i && n) {
- var r = this.data[e];
- this.data[e] = t, i.innerHTML = (0, g.
- default)(t);
- var o = n.getSelectedIndex(),
- s = 0;
- if (r.length) for (var a = r[o].value, l = 0; l < t.length; l++) if (t[l].value === a) {
- s = l;
- break
- }
- return this.selectedIndex[e] = s, n.refresh(), n.wheelTo(s), s
- }
- }
- }, {
- key: "refill",
- value: function(e) {
- var t = this,
- i = [];
- return e.length ? (e.forEach(function(e, n) {
- i[n] = t.refillColumn(n, e)
- }), i) : i
- }
- }, {
- key: "scrollColumn",
- value: function(e, t) {
- var i = this.wheels[e];
- i.wheelTo(t)
- }
- }]), t
- }(p.
- default);
- t.
- default = y, e.exports = t.
- default
- }, function(e, t, i) {
- !
- function(t, i) {
- e.exports = i()
- }(this, function() {
- return function(e) {
- function t(n) {
- if (i[n]) return i[n].exports;
- var r = i[n] = {
- exports: {},
- id: n,
- loaded: !1
- };
- return e[n].call(r.exports, r, r.exports, t), r.loaded = !0, r.exports
- }
- var i = {};
- return t.m = e, t.c = i, t.p = "/assets/", t(0)
- }([function(e, t, i) {
- "use strict";
- var n = i(1);
- n.BScroll.Version = "0.1.14", e.exports = n.BScroll
- }, function(e, t, i) {
- "use strict";
- function n(e, t) {
- if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
- }
- function r(e, t) {
- if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- return !t || "object" != typeof t && "function" != typeof t ? e : t
- }
- function o(e, t) {
- if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
- e.prototype = Object.create(t && t.prototype, {
- constructor: {
- value: e,
- enumerable: !1,
- writable: !0,
- configurable: !0
- }
- }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
- }
- Object.defineProperty(t, "__esModule", {
- value: !0
- }), t.BScroll = void 0;
- var s = function() {
- function e(e, t) {
- for (var i = 0; i < t.length; i++) {
- var n = t[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
- }
- }
- return function(t, i, n) {
- return i && e(t.prototype, i), n && e(t, n), t
- }
- }(),
- a = i(2),
- l = 1;
- t.BScroll = function(e) {
- function t(e, i) {
- n(this, t);
- var o = r(this, Object.getPrototypeOf(t).call(this));
- return o.wrapper = "string" == typeof e ? document.querySelector(e) : e, o.scroller = o.wrapper.children[0], o.scrollerStyle = o.scroller.style, o.options = {
- startX: 0,
- startY: 0,
- scrollY: !0,
- directionLockThreshold: 5,
- momentum: !0,
- bounce: !0,
- selectedIndex: 0,
- rotate: 25,
- wheel: !1,
- snap: !1,
- snapLoop: !1,
- snapThreshold: .1,
- swipeTime: 2500,
- bounceTime: 700,
- adjustTime: 400,
- swipeBounceTime: 1200,
- deceleration: .001,
- momentumLimitTime: 300,
- momentumLimitDistance: 15,
- resizePolling: 60,
- preventDefault: !0,
- preventDefaultException: {
- tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/
- },
- HWCompositing: !0,
- useTransition: !0,
- useTransform: !0
- }, (0, a.extend)(o.options, i), o.translateZ = o.options.HWCompositing && a.hasPerspective ? " translateZ(0)" : "", o.options.useTransition = o.options.useTransition && a.hasTransition, o.options.useTransform = o.options.useTransform && a.hasTransform, o.options.eventPassthrough = o.options.eventPassthrough === !0 ? "vertical" : o.options.eventPassthrough, o.options.preventDefault = !o.options.eventPassthrough && o.options.preventDefault, o.options.scrollX = "horizontal" !== o.options.eventPassthrough && o.options.scrollX, o.options.scrollY = "vertical" !== o.options.eventPassthrough && o.options.scrollY, o.options.freeScroll = o.options.freeScroll && !o.options.eventPassthrough, o.options.directionLockThreshold = o.options.eventPassthrough ? 0 : o.options.directionLockThreshold, o.options.tap === !0 && (o.options.tap = "tap"), o._init(), o.options.snap && o._initSnap(), o.refresh(), o.options.snap || o.scrollTo(o.options.startX, o.options.startY), o.enable(), o
- }
- return o(t, e), s(t, [{
- key: "_init",
- value: function() {
- this.x = 0, this.y = 0, this.directionX = 0, this.directionY = 0, this._addEvents()
- }
- }, {
- key: "_initSnap",
- value: function() {
- var e = this;
- if (this.currentPage = {}, this.options.snapLoop) {
- var t = this.scroller.children;
- t.length > 0 && ((0, a.prepend)(t[t.length - 1].cloneNode(!0), this.scroller), this.scroller.appendChild(t[1].cloneNode(!0)))
- }
- "string" == typeof this.options.snap && (this.options.snap = this.scroller.querySelectorAll(this.options.snap)), this.on("refresh", function() {
- if (e.pages = [], e.wrapperWidth && e.wrapperHeight && e.scrollerWidth && e.scrollerHeight) {
- var t = e.options.snapStepX || e.wrapperWidth,
- i = e.options.snapStepY || e.wrapperHeight,
- n = 0,
- r = void 0,
- o = void 0,
- s = void 0,
- l = 0,
- h = void 0,
- c = 0,
- p = void 0,
- u = void 0,
- f = void 0;
- if (e.options.snap === !0) for (o = Math.round(t / 2), s = Math.round(i / 2); n > -e.scrollerWidth;) {
- for (e.pages[l] = [], h = 0, r = 0; r > -e.scrollerHeight;) e.pages[l][h] = {
- x: Math.max(n, e.maxScrollX),
- y: Math.max(r, e.maxScrollY),
- width: t,
- height: i,
- cx: n - o,
- cy: r - s
- }, r -= i, h++;
- n -= t, l++
- } else for (u = e.options.snap, h = u.length, p = -1; l < h; l++) f = (0, a.getRect)(u[l]), (0 === l || f.left <= (0, a.getRect)(u[l - 1]).left) && (c = 0, p++), e.pages[c] || (e.pages[c] = []), n = Math.max(-f.left, e.maxScrollX), r = Math.max(-f.top, e.maxScrollY), o = n - Math.round(f.width / 2), s = r - Math.round(f.height / 2), e.pages[c][p] = {
- x: n,
- y: r,
- width: f.width,
- height: f.height,
- cx: o,
- cy: s
- }, n > e.maxScrollX && c++;
- var d = e.options.snapLoop ? 1 : 0;
- e.goToPage(e.currentPage.pageX || d, e.currentPage.pageY || 0, 0), e.options.snapThreshold % 1 === 0 ? (e.snapThresholdX = e.options.snapThreshold, e.snapThresholdY = e.options.snapThreshold) : (e.snapThresholdX = Math.round(e.pages[e.currentPage.pageX][e.currentPage.pageY].width * e.options.snapThreshold), e.snapThresholdY = Math.round(e.pages[e.currentPage.pageX][e.currentPage.pageY].height * e.options.snapThreshold))
- }
- }), this.on("scrollEnd", function() {
- e.options.snapLoop && (0 === e.currentPage.pageX && e.goToPage(e.pages.length - 2, e.currentPage.pageY, 0), e.currentPage.pageX === e.pages.length - 1 && e.goToPage(1, e.currentPage.pageY, 0))
- }), this.on("flick", function() {
- var t = e.options.snapSpeed || Math.max(Math.max(Math.min(Math.abs(e.x - e.startX), 1e3), Math.min(Math.abs(e.y - e.startY), 1e3)), 300);
- e.goToPage(e.currentPage.pageX + e.directionX, e.currentPage.pageY + e.directionY, t)
- })
- }
- }, {
- key: "_nearestSnap",
- value: function(e, t) {
- if (!this.pages.length) return {
- x: 0,
- y: 0,
- pageX: 0,
- pageY: 0
- };
- var i = 0;
- if (Math.abs(e - this.absStartX) < this.snapThresholdX && Math.abs(t - this.absStartY) < this.snapThresholdY) return this.currentPage;
- e > 0 ? e = 0 : e < this.maxScrollX && (e = this.maxScrollX), t > 0 ? t = 0 : t < this.maxScrollY && (t = this.maxScrollY);
- for (var n = this.pages.length; i < n; i++) if (e >= this.pages[i][0].cx) {
- e = this.pages[i][0].x;
- break
- }
- n = this.pages[i].length;
- for (var r = 0; r < n; r++) if (t >= this.pages[0][r].cy) {
- t = this.pages[0][r].y;
- break
- }
- return i === this.currentPage.pageX && (i += this.directionX, i < 0 ? i = 0 : i >= this.pages.length && (i = this.pages.length - 1), e = this.pages[i][0].x), r === this.currentPage.pageY && (r += this.directionY, r < 0 ? r = 0 : r >= this.pages[0].length && (r = this.pages[0].length - 1), t = this.pages[0][r].y), {
- x: e,
- y: t,
- pageX: i,
- pageY: r
- }
- }
- }, {
- key: "_addEvents",
- value: function() {
- var e = a.addEvent;
- this._handleEvents(e)
- }
- }, {
- key: "_removeEvents",
- value: function() {
- var e = a.removeEvent;
- this._handleEvents(e)
- }
- }, {
- key: "_handleEvents",
- value: function(e) {
- var t = this.options.bindToWrapper ? this.wrapper : window;
- e(window, "orientationchange", this), e(window, "resize", this), this.options.click && e(this.wrapper, "click", this), this.options.disableMouse || (e(this.wrapper, "mousedown", this), e(t, "mousemove", this), e(t, "mousecancel", this), e(t, "mouseup", this)), a.hasTouch && !this.options.disableTouch && (e(this.wrapper, "touchstart", this), e(t, "touchmove", this), e(t, "touchcancel", this), e(t, "touchend", this)), e(this.scroller, a.style.transitionEnd, this)
- }
- }, {
- key: "_start",
- value: function(e) {
- var t = a.eventType[e.type];
- if ((t === l || 0 === e.button) && this.enabled && (!this.initiated || this.initiated === t)) {
- if (this.initiated = t, !this.options.preventDefault || a.isBadAndroid || (0, a.preventDefaultException)(e.target, this.options.preventDefaultException) || e.preventDefault(), this.moved = !1, this.distX = 0, this.distY = 0, this.directionX = 0, this.directionY = 0, this.directionLocked = 0, this._transitionTime(), this.startTime = +new Date, this.options.wheel && (this.target = e.target), this.options.useTransition && this.isInTransition) {
- this.isInTransition = !1;
- var i = this.getComputedPosition();
- this._translate(i.x, i.y), this.options.wheel ? this.target = this.items[Math.round(-i.y / this.itemHeight)] : this.trigger("scrollEnd")
- }
- var n = e.touches ? e.touches[0] : e;
- this.startX = this.x, this.startY = this.y, this.absStartX = this.x, this.absStartY = this.y, this.pointX = n.pageX, this.pointY = n.pageY, this.trigger("beforeScrollStart")
- }
- }
- }, {
- key: "_move",
- value: function(e) {
- if (this.enabled && a.eventType[e.type] === this.initiated) {
- this.options.preventDefault && e.preventDefault();
- var t = e.touches ? e.touches[0] : e,
- i = t.pageX - this.pointX,
- n = t.pageY - this.pointY;
- this.pointX = t.pageX, this.pointY = t.pageY, this.distX += i, this.distY += n;
- var r = Math.abs(this.distX),
- o = Math.abs(this.distY),
- s = +new Date;
- if (!(s - this.endTime > this.options.momentumLimitTime && o < this.options.momentumLimitDistance && r < this.options.momentumLimitDistance)) {
- if (this.directionLocked || this.options.freeScroll || (r > o + this.options.directionLockThreshold ? this.directionLocked = "h" : o >= r + this.options.directionLockThreshold ? this.directionLocked = "v" : this.directionLocked = "n"), "h" === this.directionLocked) {
- if ("vertical" === this.options.eventPassthrough) e.preventDefault();
- else if ("horizontal" === this.options.eventPassthrough) return void(this.initiated = !1);
- n = 0
- } else if ("v" === this.directionLocked) {
- if ("horizontal" === this.options.eventPassthrough) e.preventDefault();
- else if ("vertical" === this.options.eventPassthrough) return void(this.initiated = !1);
- i = 0
- }
- i = this.hasHorizontalScroll ? i : 0, n = this.hasVerticalScroll ? n : 0;
- var l = this.x + i,
- h = this.y + n;
- (l > 0 || l < this.maxScrollX) && (l = this.options.bounce ? this.x + i / 3 : l > 0 ? 0 : this.maxScrollX), (h > 0 || h < this.maxScrollY) && (h = this.options.bounce ? this.y + n / 3 : h > 0 ? 0 : this.maxScrollY), this.directionX = i > 0 ? -1 : i < 0 ? 1 : 0, this.directionY = n > 0 ? -1 : n < 0 ? 1 : 0, this.moved || (this.moved = !0, this.trigger("scrollStart")), this._translate(l, h), s - this.startTime > this.options.momentumLimitTime && (this.startTime = s, this.startX = this.x, this.startY = this.y, 1 === this.options.probeType && this.trigger("scroll", {
- x: this.x,
- y: this.y
- })), this.options.probeType > 1 && this.trigger("scroll", {
- x: this.x,
- y: this.y
- });
- var c = document.documentElement.scrollLeft || window.pageXOffset || document.body.scrollLeft,
- p = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop,
- u = this.pointX - c,
- f = this.pointY - p;
- (u > document.documentElement.clientWidth - this.options.momentumLimitDistance || u < this.options.momentumLimitDistance || f < this.options.momentumLimitDistance || f > document.documentElement.clientHeight - this.options.momentumLimitDistance) && this._end(e)
- }
- }
- }
- }, {
- key: "_end",
- value: function(e) {
- if (this.enabled && a.eventType[e.type] === this.initiated && (this.initiated = !1, this.options.preventDefault && !(0, a.preventDefaultException)(e.target, this.options.preventDefaultException) && e.preventDefault(), this.trigger("touchend", {
- x: this.x,
- y: this.y
- }), !this.resetPosition(this.options.bounceTime, a.ease.bounce))) {
- this.isInTransition = !1;
- var t = Math.round(this.x),
- i = Math.round(this.y);
- if (!this.moved) {
- if (this.options.wheel) {
- if (this.target && "wheel-scroll" === this.target.className) {
- var n = Math.abs(Math.round(i / this.itemHeight)),
- r = Math.round((this.pointY + (0, a.offset)(this.target).top - this.itemHeight / 2) / this.itemHeight);
- this.target = this.items[n + r]
- }
- this.scrollToElement(this.target, this.options.adjustTime, !0, !0, a.ease.swipe)
- } else this.options.tap && (0, a.tap)(e, this.options.tap), this.options.click && (0, a.click)(e);
- return void this.trigger("scrollCancel")
- }
- this.scrollTo(t, i), this.endTime = +new Date;
- var o = this.endTime - this.startTime,
- s = Math.abs(t - this.startX),
- l = Math.abs(i - this.startY);
- if (this._events.flick && o < this.options.momentumLimitTime && s < this.options.momentumLimitDistance && l < this.options.momentumLimitDistance) return void this.trigger("flick");
- var h = 0;
- if (this.options.momentum && o < this.options.momentumLimitTime && (l > this.options.momentumLimitDistance || s > this.options.momentumLimitDistance)) {
- var c = this.hasHorizontalScroll ? (0, a.momentum)(this.x, this.startX, o, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options) : {
- destination: t,
- duration: 0
- },
- p = this.hasVerticalScroll ? (0, a.momentum)(this.y, this.startY, o, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options) : {
- destination: i,
- duration: 0
- };
- t = c.destination, i = p.destination, h = Math.max(c.duration, p.duration), this.isInTransition = 1
- } else this.options.wheel && (i = Math.round(i / this.itemHeight) * this.itemHeight, h = this.options.adjustTime);
- var u = a.ease.swipe;
- if (this.options.snap) {
- var f = this._nearestSnap(t, i);
- this.currentPage = f, h = this.options.snapSpeed || Math.max(Math.max(Math.min(Math.abs(t - f.x), 1e3), Math.min(Math.abs(i - f.y), 1e3)), 300), t = f.x, i = f.y, this.directionX = 0, this.directionY = 0, u = a.ease.bounce
- }
- if (t !== this.x || i !== this.y) return (t > 0 || t < this.maxScrollX || i > 0 || i < this.maxScrollY) && (u = a.ease.swipeBounce), void this.scrollTo(t, i, h, u);
- this.options.wheel && (this.selectedIndex = 0 | Math.abs(this.y / this.itemHeight)), this.trigger("scrollEnd")
- }
- }
- }, {
- key: "_resize",
- value: function() {
- var e = this;
- this.enabled && (clearTimeout(this.resizeTimeout), this.resizeTimeout = setTimeout(function() {
- e.refresh()
- }, this.options.resizePolling))
- }
- }, {
- key: "_startProbe",
- value: function() {
- function e() {
- var i = t.getComputedPosition();
- t.trigger("scroll", i), t.isInTransition && (t.probeTimer = (0, a.requestAnimationFrame)(e))
- }(0, a.cancelAnimationFrame)(this.probeTimer), this.probeTimer = (0, a.requestAnimationFrame)(e);
- var t = this
- }
- }, {
- key: "_transitionTime",
- value: function() {
- var e = this,
- t = arguments.length <= 0 || void 0 === arguments[0] ? 0 : arguments[0];
- if (this.scrollerStyle[a.style.transitionDuration] = t + "ms", this.options.wheel && !a.isBadAndroid) for (var i = 0; i < this.items.length; i++) this.items[i].style[a.style.transitionDuration] = t + "ms";
- !t && a.isBadAndroid && (this.scrollerStyle[a.style.transitionDuration] = "0.001s", (0, a.requestAnimationFrame)(function() {
- "0.0001ms" === e.scrollerStyle[a.style.transitionDuration] && (e.scrollerStyle[a.style.transitionDuration] = "0s")
- }))
- }
- }, {
- key: "_transitionTimingFunction",
- value: function(e) {
- if (this.scrollerStyle[a.style.transitionTimingFunction] = e, this.options.wheel && !a.isBadAndroid) for (var t = 0; t < this.items.length; t++) this.items[t].style[a.style.transitionTimingFunction] = e
- }
- }, {
- key: "_transitionEnd",
- value: function(e) {
- e.target === this.scroller && this.isInTransition && (this._transitionTime(), this.resetPosition(this.options.bounceTime, a.ease.bounce) || (this.isInTransition = !1, this.trigger("scrollEnd")))
- }
- }, {
- key: "_translate",
- value: function(e, t) {
- if (this.options.useTransform ? this.scrollerStyle[a.style.transform] = "translate(" + e + "px," + t + "px)" + this.translateZ : (e = Math.round(e), t = Math.round(t), this.scrollerStyle.left = e + "px", this.scrollerStyle.top = t + "px"), this.options.wheel && !a.isBadAndroid) for (var i = 0; i < this.items.length; i++) {
- var n = this.options.rotate * (t / this.itemHeight + i);
- this.items[i].style[a.style.transform] = "rotateX(" + n + "deg)"
- }
- this.x = e, this.y = t
- }
- }, {
- key: "enable",
- value: function() {
- this.enabled = !0
- }
- }, {
- key: "disable",
- value: function() {
- this.enabled = !1
- }
- }, {
- key: "refresh",
- value: function() {
- this.wrapper.offsetHeight;
- this.wrapperWidth = parseInt(this.wrapper.style.width) || this.wrapper.clientWidth, this.wrapperHeight = parseInt(this.wrapper.style.height) || this.wrapper.clientHeight, this.scrollerWidth = parseInt(this.scroller.style.width) || this.scroller.clientWidth, this.scrollerHeight = parseInt(this.scroller.style.height) || this.scroller.clientHeight, this.options.wheel ? (this.items = this.scroller.children, this.options.itemHeight = this.itemHeight = this.items.length ? this.items[0].clientHeight : 0, void 0 === this.selectedIndex && (this.selectedIndex = this.options.selectedIndex), this.options.startY = -this.selectedIndex * this.itemHeight, this.maxScrollX = 0, this.maxScrollY = -this.itemHeight * (this.items.length - 1)) : (this.maxScrollX = this.wrapperWidth - this.scrollerWidth, this.maxScrollY = this.wrapperHeight - this.scrollerHeight), this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0, this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0, this.hasHorizontalScroll || (this.maxScrollX = 0, this.scrollerWidth = this.wrapperWidth), this.hasVerticalScroll || (this.maxScrollY = 0, this.scrollerHeight = this.wrapperHeight), this.endTime = 0, this.directionX = 0, this.directionY = 0, this.wrapperOffset = (0, a.offset)(this.wrapper), this.trigger("refresh"), this.resetPosition()
- }
- }, {
- key: "resetPosition",
- value: function() {
- var e = arguments.length <= 0 || void 0 === arguments[0] ? 0 : arguments[0],
- t = arguments.length <= 1 || void 0 === arguments[1] ? a.ease.bounce : arguments[1],
- i = this.x;
- !this.hasHorizontalScroll || i > 0 ? i = 0 : i < this.maxScrollX && (i = this.maxScrollX);
- var n = this.y;
- return !this.hasVerticalScroll || n > 0 ? n = 0 : n < this.maxScrollY && (n = this.maxScrollY), (i !== this.x || n !== this.y) && (this.scrollTo(i, n, e, t), !0)
- }
- }, {
- key: "wheelTo",
- value: function(e) {
- this.options.wheel && (this.y = -e * this.itemHeight, this.scrollTo(0, this.y))
- }
- }, {
- key: "scrollBy",
- value: function(e, t) {
- var i = arguments.length <= 2 || void 0 === arguments[2] ? 0 : arguments[2],
- n = arguments.length <= 3 || void 0 === arguments[3] ? a.ease.bounce : arguments[3];
- e = this.x + e, t = this.y + t, this.scrollTo(e, t, i, n)
- }
- }, {
- key: "scrollTo",
- value: function(e, t, i) {
- var n = arguments.length <= 3 || void 0 === arguments[3] ? a.ease.bounce : arguments[3];
- this.isInTransition = this.options.useTransition && i > 0 && (e !== this.x || t !== this.y), i && !this.options.useTransition || (this._transitionTimingFunction(n.style), this._transitionTime(i), this._translate(e, t), i && 3 === this.options.probeType && this._startProbe(), this.options.wheel && (t > 0 ? this.selectedIndex = 0 : t < this.maxScrollY ? this.selectedIndex = this.items.length - 1 : this.selectedIndex = 0 | Math.abs(t / this.itemHeight)))
- }
- }, {
- key: "getSelectedIndex",
- value: function() {
- return this.options.wheel && this.selectedIndex
- }
- }, {
- key: "getCurrentPage",
- value: function() {
- return this.options.snap && this.currentPage
- }
- }, {
- key: "scrollToElement",
- value: function(e, t, i, n, r) {
- if (e && (e = e.nodeType ? e : this.scroller.querySelector(e), !this.options.wheel || "wheel-item" === e.className)) {
- var o = (0, a.offset)(e);
- o.left -= this.wrapperOffset.left, o.top -= this.wrapperOffset.top, i === !0 && (i = Math.round(e.offsetWidth / 2 - this.wrapper.offsetWidth / 2)), n === !0 && (n = Math.round(e.offsetHeight / 2 - this.wrapper.offsetHeight / 2)), o.left -= i || 0, o.top -= n || 0, o.left = o.left > 0 ? 0 : o.left < this.maxScrollX ? this.maxScrollX : o.left, o.top = o.top > 0 ? 0 : o.top < this.maxScrollY ? this.maxScrollY : o.top, this.options.wheel && (o.top = Math.round(o.top / this.itemHeight) * this.itemHeight), t = void 0 === t || null === t || "auto" === t ? Math.max(Math.abs(this.x - o.left), Math.abs(this.y - o.top)) : t, this.scrollTo(o.left, o.top, t, r)
- }
- }
- }, {
- key: "getComputedPosition",
- value: function() {
- var e = window.getComputedStyle(this.scroller, null),
- t = void 0,
- i = void 0;
- return this.options.useTransform ? (e = e[a.style.transform].split(")")[0].split(", "), t = +(e[12] || e[4]), i = +(e[13] || e[5])) : (t = +e.left.replace(/[^-\d.]/g, ""), i = +e.top.replace(/[^-\d.]/g, "")), {
- x: t,
- y: i
- }
- }
- }, {
- key: "goToPage",
- value: function(e, t, i) {
- var n = arguments.length <= 3 || void 0 === arguments[3] ? a.ease.bounce : arguments[3];
- e >= this.pages.length ? e = this.pages.length - 1 : e < 0 && (e = 0), t >= this.pages[e].length ? t = this.pages[e].length - 1 : t < 0 && (t = 0);
- var r = this.pages[e][t].x,
- o = this.pages[e][t].y;
- i = void 0 === i ? this.options.snapSpeed || Math.max(Math.max(Math.min(Math.abs(r - this.x), 1e3), Math.min(Math.abs(o - this.y), 1e3)), 300) : i, this.currentPage = {
- x: r,
- y: o,
- pageX: e,
- pageY: t
- }, this.scrollTo(r, o, i, n)
- }
- }, {
- key: "next",
- value: function(e, t) {
- var i = this.currentPage.pageX,
- n = this.currentPage.pageY;
- i++, i >= this.pages.length && this.hasVerticalScroll && (i = 0, n++), this.goToPage(i, n, e, t)
- }
- }, {
- key: "prev",
- value: function(e, t) {
- var i = this.currentPage.pageX,
- n = this.currentPage.pageY;
- i--, i < 0 && this.hasVerticalScroll && (i = 0, n--), this.goToPage(i, n, e, t)
- }
- }, {
- key: "destroy",
- value: function() {
- this._removeEvents(), this.trigger("destroy")
- }
- }, {
- key: "handleEvent",
- value: function(e) {
- switch (e.type) {
- case "touchstart":
- case "mousedown":
- this._start(e);
- break;
- case "touchmove":
- case "mousemove":
- this._move(e);
- break;
- case "touchend":
- case "mouseup":
- case "touchcancel":
- case "mousecancel":
- this._end(e);
- break;
- case "orientationchange":
- case "resize":
- this._resize();
- break;
- case "transitionend":
- case "webkitTransitionEnd":
- case "oTransitionEnd":
- case "MSTransitionEnd":
- this._transitionEnd(e);
- break;
- case "click":
- !this.enabled || e._constructed || /(SELECT|INPUT|TEXTAREA)/i.test(e.target.tagName) || (e.preventDefault(), e.stopPropagation())
- }
- }
- }]), t
- }(a.EventEmitter)
- }, function(e, t, i) {
- "use strict";
- Object.defineProperty(t, "__esModule", {
- value: !0
- });
- var n = i(3);
- Object.keys(n).forEach(function(e) {
- "default" !== e && "__esModule" !== e && Object.defineProperty(t, e, {
- enumerable: !0,
- get: function() {
- return n[e]
- }
- })
- });
- var r = i(4);
- Object.keys(r).forEach(function(e) {
- "default" !== e && "__esModule" !== e && Object.defineProperty(t, e, {
- enumerable: !0,
- get: function() {
- return r[e]
- }
- })
- });
- var o = i(5);
- Object.keys(o).forEach(function(e) {
- "default" !== e && "__esModule" !== e && Object.defineProperty(t, e, {
- enumerable: !0,
- get: function() {
- return o[e]
- }
- })
- });
- var s = i(6);
- Object.keys(s).forEach(function(e) {
- "default" !== e && "__esModule" !== e && Object.defineProperty(t, e, {
- enumerable: !0,
- get: function() {
- return s[e]
- }
- })
- });
- var a = i(7);
- Object.keys(a).forEach(function(e) {
- "default" !== e && "__esModule" !== e && Object.defineProperty(t, e, {
- enumerable: !0,
- get: function() {
- return a[e]
- }
- })
- });
- var l = i(8);
- Object.keys(l).forEach(function(e) {
- "default" !== e && "__esModule" !== e && Object.defineProperty(t, e, {
- enumerable: !0,
- get: function() {
- return l[e]
- }
- })
- })
- }, function(e, t) {
- "use strict";
- function i(e) {
- return f !== !1 && ("standard" === f ? e : f + e.charAt(0).toUpperCase() + e.substr(1))
- }
- function n(e, t, i, n) {
- e.addEventListener(t, i, {
- passive: !1,
- capture: !! n
- })
- }
- function r(e, t, i, n) {
- e.removeEventListener(t, i, !! n)
- }
- function o(e) {
- for (var t = 0, i = 0; e;) t -= e.offsetLeft, i -= e.offsetTop, e = e.offsetParent;
- return {
- left: t,
- top: i
- }
- }
- function s(e) {
- if (e instanceof window.SVGElement) {
- var t = e.getBoundingClientRect();
- return {
- top: t.top,
- left: t.left,
- width: t.width,
- height: t.height
- }
- }
- return {
- top: e.offsetTop,
- left: e.offsetLeft,
- width: e.offsetWidth,
- height: e.offsetHeight
- }
- }
- function a(e, t) {
- for (var i in t) if (t[i].test(e[i])) return !0;
- return !1
- }
- function l(e, t) {
- var i = document.createEvent("Event");
- i.initEvent(t, !0, !0), i.pageX = e.pageX, i.pageY = e.pageY, e.target.dispatchEvent(i)
- }
- function h(e) {
- var t = e.target;
- if (!/(SELECT|INPUT|TEXTAREA)/i.test(t.tagName)) {
- var i = document.createEvent(window.MouseEvent ? "MouseEvents" : "Event");
- i.initEvent("click", !0, !0), i._constructed = !0, t.dispatchEvent(i)
- }
- }
- function c(e, t) {
- t.firstChild ? p(e, t.firstChild) : t.appendChild(e)
- }
- function p(e, t) {
- t.parentNode.insertBefore(e, t)
- }
- Object.defineProperty(t, "__esModule", {
- value: !0
- }), t.addEvent = n, t.removeEvent = r, t.offset = o, t.getRect = s, t.preventDefaultException = a, t.tap = l, t.click = h, t.prepend = c, t.before = p;
- var u = document.createElement("div").style,
- f = function() {
- var e = {
- webkit: "webkitTransform",
- Moz: "MozTransform",
- O: "OTransform",
- ms: "msTransform",
- standard: "transform"
- };
- for (var t in e) if (void 0 !== u[e[t]]) return t;
- return !1
- }(),
- d = i("transform"),
- m = (t.hasPerspective = i("perspective") in u, t.hasTouch = "ontouchstart" in window, t.hasTransform = d !== !1, t.hasTransition = i("transition") in u, t.style = {
- transform: d,
- transitionTimingFunction: i("transitionTimingFunction"),
- transitionDuration: i("transitionDuration"),
- transitionDelay: i("transitionDelay"),
- transformOrigin: i("transformOrigin"),
- transitionEnd: i("transitionEnd")
- }, 1),
- v = 2;
- t.eventType = {
- touchstart: m,
- touchmove: m,
- touchend: m,
- mousedown: v,
- mousemove: v,
- mouseup: v
- }
- }, function(e, t) {
- "use strict";
- Object.defineProperty(t, "__esModule", {
- value: !0
- });
- t.isBadAndroid = /Android /.test(window.navigator.appVersion) && !/Chrome\/\d/.test(window.navigator.appVersion)
- }, function(e, t) {
- "use strict";
- Object.defineProperty(t, "__esModule", {
- value: !0
- });
- t.ease = {
- swipe: {
- style: "cubic-bezier(0.23, 1, 0.32, 1)",
- fn: function(e) {
- return 1 + --e * e * e * e * e
- }
- },
- swipeBounce: {
- style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
- fn: function(e) {
- return e * (2 - e)
- }
- },
- bounce: {
- style: "cubic-bezier(0.165, 0.84, 0.44, 1)",
- fn: function(e) {
- return 1 - --e * e * e * e
- }
- }
- }
- }, function(e, t) {
- "use strict";
- function i(e) {
- if (Array.isArray(e)) {
- for (var t = 0, i = Array(e.length); t < e.length; t++) i[t] = e[t];
- return i
- }
- return Array.from(e)
- }
- function n(e, t) {
- if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
- }
- Object.defineProperty(t, "__esModule", {
- value: !0
- });
- var r = function() {
- function e(e, t) {
- var i = [],
- n = !0,
- r = !1,
- o = void 0;
- try {
- for (var s, a = e[Symbol.iterator](); !(n = (s = a.next()).done) && (i.push(s.value), !t || i.length !== t); n = !0);
- } catch (e) {
- r = !0, o = e
- } finally {
- try {
- !n && a.
- return &&a.
- return ()
- } finally {
- if (r) throw o
- }
- }
- return i
- }
- return function(t, i) {
- if (Array.isArray(t)) return t;
- if (Symbol.iterator in Object(t)) return e(t, i);
- throw new TypeError("Invalid attempt to destructure non-iterable instance")
- }
- }(),
- o = function() {
- function e(e, t) {
- for (var i = 0; i < t.length; i++) {
- var n = t[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
- }
- }
- return function(t, i, n) {
- return i && e(t.prototype, i), n && e(t, n), t
- }
- }();
- t.EventEmitter = function() {
- function e() {
- n(this, e), this._events = {}
- }
- return o(e, [{
- key: "on",
- value: function(e, t) {
- var i = arguments.length <= 2 || void 0 === arguments[2] ? this : arguments[2];
- this._events[e] || (this._events[e] = []), this._events[e].push([t, i])
- }
- }, {
- key: "once",
- value: function(e, t) {
- function i() {
- this.off(e, i), r || (r = !0, t.apply(n, arguments))
- }
- var n = arguments.length <= 2 || void 0 === arguments[2] ? this : arguments[2],
- r = !1;
- this.on(e, i)
- }
- }, {
- key: "off",
- value: function(e, t) {
- var i = this._events[e];
- if (i) for (var n = i.length; n--;) i[n][0] === t && (i[n][0] = void 0)
- }
- }, {
- key: "trigger",
- value: function(e) {
- var t = this._events[e];
- if (t) for (var n = t.length, o = [].concat(i(t)), s = 0; s < n; s++) {
- var a = o[s],
- l = r(a, 2),
- h = l[0],
- c = l[1];
- h && h.apply(c, [].slice.call(arguments, 1))
- }
- }
- }]), e
- }()
- }, function(e, t) {
- "use strict";
- function i(e, t, i, n, r, o) {
- var s = e - t,
- a = Math.abs(s) / i,
- l = o.deceleration,
- h = o.itemHeight,
- c = o.swipeBounceTime,
- p = o.bounceTime,
- u = o.swipeTime,
- f = o.wheel ? 4 : 15,
- d = e + a / l * (s < 0 ? -1 : 1);
- return o.wheel && h && (d = Math.round(d / h) * h), d < n ? (d = r ? n - r / f * a : n, u = c - p) : d > 0 && (d = r ? r / f * a : 0, u = c - p), {
- destination: Math.round(d),
- duration: u
- }
- }
- Object.defineProperty(t, "__esModule", {
- value: !0
- }), t.momentum = i
- }, function(e, t) {
- "use strict";
- function i(e, t) {
- for (var i in t) e[i] = t[i]
- }
- Object.defineProperty(t, "__esModule", {
- value: !0
- }), t.extend = i;
- var n = 100 / 60;
- t.requestAnimationFrame = function() {
- return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame ||
- function(e) {
- return window.setTimeout(e, (e.interval || n) / 2)
- }
- }(), t.cancelAnimationFrame = function() {
- return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || window.oCancelAnimationFrame ||
- function(e) {
- window.clearTimeout(e)
- }
- }()
- }])
- })
- }, function(e, t) {
- "use strict";
- function i(e) {
- if (Array.isArray(e)) {
- for (var t = 0, i = Array(e.length); t < e.length; t++) i[t] = e[t];
- return i
- }
- return Array.from(e)
- }
- function n(e, t) {
- if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
- }
- t.__esModule = !0;
- var r = function() {
- function e(e, t) {
- var i = [],
- n = !0,
- r = !1,
- o = void 0;
- try {
- for (var s, a = e[Symbol.iterator](); !(n = (s = a.next()).done) && (i.push(s.value), !t || i.length !== t); n = !0);
- } catch (e) {
- r = !0, o = e
- } finally {
- try {
- !n && a.
- return &&a.
- return ()
- } finally {
- if (r) throw o
- }
- }
- return i
- }
- return function(t, i) {
- if (Array.isArray(t)) return t;
- if (Symbol.iterator in Object(t)) return e(t, i);
- throw new TypeError("Invalid attempt to destructure non-iterable instance")
- }
- }(),
- o = function() {
- function e(e, t) {
- for (var i = 0; i < t.length; i++) {
- var n = t[i];
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
- }
- }
- return function(t, i, n) {
- return i && e(t.prototype, i), n && e(t, n), t
- }
- }(),
- s = function() {
- function e() {
- n(this, e), this._events = {}
- }
- return o(e, [{
- key: "on",
- value: function(e, t) {
- var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this;
- this._events[e] || (this._events[e] = []), this._events[e].push([t, i])
- }
- }, {
- key: "once",
- value: function(e, t) {
- function i() {
- this.off(e, i), r || (r = !0, t.apply(n, arguments))
- }
- var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this,
- r = !1;
- this.on(e, i)
- }
- }, {
- key: "off",
- value: function(e, t) {
- var i = this._events[e];
- if (i) for (var n = i.length; n--;) i[n][0] === t && (i[n][0] = void 0)
- }
- }, {
- key: "trigger",
- value: function(e) {
- var t = this._events[e];
- if (t) for (var n = t.length, o = [].concat(i(t)), s = 0; s < n; s++) {
- var a = o[s],
- l = r(a, 2),
- h = l[0],
- c = l[1];
- h && h.apply(c, [].slice.call(arguments, 1))
- }
- }
- }]), e
- }();
- t.
- default = s, e.exports = t.
- default
- }, function(e, t) {
- "use strict";
- function i(e, t) {
- for (var i in t) e[i] = t[i]
- }
- t.__esModule = !0, t.extend = i
- }, function(e, t) {
- "use strict";
- function i(e) {
- var t = document.createElement("div");
- return t.innerHTML = e, t.childNodes[0]
- }
- function n(e, t, i, n) {
- e.addEventListener(t, i, !! n)
- }
- function r(e, t, i, n) {
- e.removeEventListener(t, i, !! n)
- }
- function o(e, t) {
- var i = new RegExp("(^|\\s)" + t + "(\\s|$)");
- return i.test(e.className)
- }
- function s(e, t) {
- if (!o(e, t)) {
- var i = e.className.split(" ");
- i.push(t), e.className = i.join(" ")
- }
- }
- function a(e, t) {
- if (o(e, t)) {
- var i = new RegExp("(^|\\s)" + t + "(\\s|$)", "g");
- e.className = e.className.replace(i, " ")
- }
- }
- t.__esModule = !0, t.createDom = i, t.addEvent = n, t.removeEvent = r, t.hasClass = o, t.addClass = s, t.removeClass = a
- }, function(e, t, i) {
- var n = i(7);
- e.exports = (n.
- default ||n).template(function(e, t, i, n, r) {
- function o(e, t) {
- var n, r = "";
- return r += '\n <div class="wheel wheel-hook">\n <ul class="wheel-scroll wheel-scroll-hook">\n ', n = i.each.call(e, e, {
- hash: {},
- inverse: u.noop,
- fn: u.program(2, s, t),
- data: t
- }), (n || 0 === n) && (r += n), r += "\n </ul>\n </div>\n "
- }
- function s(e, t) {
- var n, r, o = "";
- return o += '\n <li class="wheel-item" data-val="', (r = i.value) ? n = r.call(e, {
- hash: {},
- data: t
- }) : (r = e && e.value, n = typeof r === c ? r.call(e, {
- hash: {},
- data: t
- }) : r), o += p(n) + '">', (r = i.text) ? n = r.call(e, {
- hash: {},
- data: t
- }) : (r = e && e.text, n = typeof r === c ? r.call(e, {
- hash: {},
- data: t
- }) : r), o += p(n) + "</li>\n "
- }
- this.compilerInfo = [4, ">= 1.0.0"], i = this.merge(i, e.helpers), r = r || {};
- var a, l, h = "",
- c = "function",
- p = this.escapeExpression,
- u = this;
- return h += '<div class="picker">\n <div class="picker-mask mask-hook"></div>\n <div class="picker-panel panel-hook">\n <div class="picker-choose choose-hook">\n <span class="cancel cancel-hook">取消</span>\n <span class="confirm confirm-hook">确定</span>\n <h1 class="picker-title">', (l = i.title) ? a = l.call(t, {
- hash: {},
- data: r
- }) : (l = t && t.title, a = typeof l === c ? l.call(t, {
- hash: {},
- data: r
- }) : l), h += p(a) + '</h1>\n </div>\n <div class="picker-content">\n <div class="mask-top border-1px"></div>\n <div class="mask-bottom border-1px"></div>\n <div class="wheel-wrapper wheel-wrapper-hook">\n ', a = i.each.call(t, t && t.data, {
- hash: {},
- inverse: u.noop,
- fn: u.program(1, o, r),
- data: r
- }), (a || 0 === a) && (h += a), h += '\n </div>\n </div>\n <div class="picker-footer footer-hook"></div>\n </div>\n</div>'
- })
- }, function(e, t, i) {
- e.exports = i(8)
- }, function(e, t, i) {
- "use strict";
- var n = i(9),
- r = i(11).
- default,
- o = i(12).
- default,
- s = i(10),
- a = i(13),
- l = function() {
- var e = new n.HandlebarsEnvironment;
- return s.extend(e, n), e.SafeString = r, e.Exception = o, e.Utils = s, e.VM = a, e.template = function(t) {
- return a.template(t, e)
- }, e
- },
- h = l();
- h.create = l, t.
- default = h
- }, function(e, t, i) {
- "use strict";
- function n(e, t) {
- this.helpers = e || {}, this.partials = t || {}, r(this)
- }
- function r(e) {
- e.registerHelper("helperMissing", function(e) {
- if (2 !== arguments.length) throw new a("Missing helper: '" + e + "'")
- }), e.registerHelper("blockHelperMissing", function(t, i) {
- var n = i.inverse ||
- function() {}, r = i.fn;
- return u(t) && (t = t.call(this)), t === !0 ? r(this) : t === !1 || null == t ? n(this) : p(t) ? t.length > 0 ? e.helpers.each(t, i) : n(this) : r(t)
- }), e.registerHelper("each", function(e, t) {
- var i, n = t.fn,
- r = t.inverse,
- o = 0,
- s = "";
- if (u(e) && (e = e.call(this)), t.data && (i = v(t.data)), e && "object" == typeof e) if (p(e)) for (var a = e.length; o < a; o++) i && (i.index = o, i.first = 0 === o, i.last = o === e.length - 1), s += n(e[o], {
- data: i
- });
- else for (var l in e) e.hasOwnProperty(l) && (i && (i.key = l, i.index = o, i.first = 0 === o), s += n(e[l], {
- data: i
- }), o++);
- return 0 === o && (s = r(this)), s
- }), e.registerHelper("if", function(e, t) {
- return u(e) && (e = e.call(this)), !t.hash.includeZero && !e || s.isEmpty(e) ? t.inverse(this) : t.fn(this)
- }), e.registerHelper("unless", function(t, i) {
- return e.helpers.
- if.call(this, t, {
- fn: i.inverse,
- inverse: i.fn,
- hash: i.hash
- })
- }), e.registerHelper("with", function(e, t) {
- if (u(e) && (e = e.call(this)), !s.isEmpty(e)) return t.fn(e)
- }), e.registerHelper("log", function(t, i) {
- var n = i.data && null != i.data.level ? parseInt(i.data.level, 10) : 1;
- e.log(n, t)
- })
- }
- function o(e, t) {
- m.log(e, t)
- }
- var s = i(10),
- a = i(12).
- default,
- l = "1.3.0";
- t.VERSION = l;
- var h = 4;
- t.COMPILER_REVISION = h;
- var c = {
- 1: "<= 1.0.rc.2",
- 2: "== 1.0.0-rc.3",
- 3: "== 1.0.0-rc.4",
- 4: ">= 1.0.0"
- };
- t.REVISION_CHANGES = c;
- var p = s.isArray,
- u = s.isFunction,
- f = s.toString,
- d = "[object Object]";
- t.HandlebarsEnvironment = n, n.prototype = {
- constructor: n,
- logger: m,
- log: o,
- registerHelper: function(e, t, i) {
- if (f.call(e) === d) {
- if (i || t) throw new a("Arg not supported with multiple helpers");
- s.extend(this.helpers, e)
- } else i && (t.not = i), this.helpers[e] = t
- },
- registerPartial: function(e, t) {
- f.call(e) === d ? s.extend(this.partials, e) : this.partials[e] = t
- }
- };
- var m = {
- methodMap: {
- 0: "debug",
- 1: "info",
- 2: "warn",
- 3: "error"
- },
- DEBUG: 0,
- INFO: 1,
- WARN: 2,
- ERROR: 3,
- level: 3,
- log: function(e, t) {
- if (m.level <= e) {
- var i = m.methodMap[e];
- "undefined" != typeof console && console[i] && console[i].call(console, t)
- }
- }
- };
- t.logger = m, t.log = o;
- var v = function(e) {
- var t = {};
- return s.extend(t, e), t
- };
- t.createFrame = v
- }, function(e, t, i) {
- "use strict";
- function n(e) {
- return l[e] || "&"
- }
- function r(e, t) {
- for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i])
- }
- function o(e) {
- return e instanceof a ? e.toString() : e || 0 === e ? (e = "" + e, c.test(e) ? e.replace(h, n) : e) : ""
- }
- function s(e) {
- return !e && 0 !== e || !(!f(e) || 0 !== e.length)
- }
- var a = i(11).
- default,
- l = {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': """,
- "'": "'",
- "`": "`"
- },
- h = /[&<>"'`]/g,
- c = /[&<>"'`]/;
- t.extend = r;
- var p = Object.prototype.toString;
- t.toString = p;
- var u = function(e) {
- return "function" == typeof e
- };
- u(/x/) && (u = function(e) {
- return "function" == typeof e && "[object Function]" === p.call(e)
- });
- var u;
- t.isFunction = u;
- var f = Array.isArray ||
- function(e) {
- return !(!e || "object" != typeof e) && "[object Array]" === p.call(e)
- };
- t.isArray = f, t.escapeExpression = o, t.isEmpty = s
- }, function(e, t) {
- "use strict";
- function i(e) {
- this.string = e
- }
- i.prototype.toString = function() {
- return "" + this.string
- }, t.
- default = i
- }, function(e, t) {
- "use strict";
- function i(e, t) {
- var i;
- t && t.firstLine && (i = t.firstLine, e += " - " + i + ":" + t.firstColumn);
- for (var r = Error.prototype.constructor.call(this, e), o = 0; o < n.length; o++) this[n[o]] = r[n[o]];
- i && (this.lineNumber = i, this.column = t.firstColumn)
- }
- var n = ["description", "fileName", "lineNumber", "message", "name", "number", "stack"];
- i.prototype = new Error, t.
- default = i
- }, function(e, t, i) {
- "use strict";
- function n(e) {
- var t = e && e[0] || 1,
- i = p;
- if (t !== i) {
- if (t < i) {
- var n = u[i],
- r = u[t];
- throw new c("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version (" + n + ") or downgrade your runtime to an older version (" + r + ").")
- }
- throw new c("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version (" + e[1] + ").")
- }
- }
- function r(e, t) {
- if (!t) throw new c("No environment passed to template");
- var i = function(e, i, n, r, o, s) {
- var a = t.VM.invokePartial.apply(this, arguments);
- if (null != a) return a;
- if (t.compile) {
- var l = {
- helpers: r,
- partials: o,
- data: s
- };
- return o[i] = t.compile(e, {
- data: void 0 !== s
- }, t), o[i](n, l)
- }
- throw new c("The partial " + i + " could not be compiled when running in runtime-only mode")
- },
- n = {
- escapeExpression: h.escapeExpression,
- invokePartial: i,
- programs: [],
- program: function(e, t, i) {
- var n = this.programs[e];
- return i ? n = s(e, t, i) : n || (n = this.programs[e] = s(e, t)), n
- },
- merge: function(e, t) {
- var i = e || t;
- return e && t && e !== t && (i = {}, h.extend(i, t), h.extend(i, e)), i
- },
- programWithDepth: t.VM.programWithDepth,
- noop: t.VM.noop,
- compilerInfo: null
- };
- return function(i, r) {
- r = r || {};
- var o, s, a = r.partial ? r : t;
- r.partial || (o = r.helpers, s = r.partials);
- var l = e.call(n, a, i, o, s, r.data);
- return r.partial || t.VM.checkRevision(n.compilerInfo), l
- }
- }
- function o(e, t, i) {
- var n = Array.prototype.slice.call(arguments, 3),
- r = function(e, r) {
- return r = r || {}, t.apply(this, [e, r.data || i].concat(n))
- };
- return r.program = e, r.depth = n.length, r
- }
- function s(e, t, i) {
- var n = function(e, n) {
- return n = n || {}, t(e, n.data || i)
- };
- return n.program = e, n.depth = 0, n
- }
- function a(e, t, i, n, r, o) {
- var s = {
- partial: !0,
- helpers: n,
- partials: r,
- data: o
- };
- if (void 0 === e) throw new c("The partial " + t + " could not be found");
- if (e instanceof Function) return e(i, s)
- }
- function l() {
- return ""
- }
- var h = i(10),
- c = i(12).
- default,
- p = i(9).COMPILER_REVISION,
- u = i(9).REVISION_CHANGES;
- t.checkRevision = n, t.template = r, t.programWithDepth = o, t.program = s, t.invokePartial = a, t.noop = l
- }, function(e, t, i) {
- var n = i(7);
- e.exports = (n.
- default ||n).template(function(e, t, i, n, r) {
- function o(e, t) {
- var n, r, o = "";
- return o += '\n <li class="wheel-item" data-val="', (r = i.value) ? n = r.call(e, {
- hash: {},
- data: t
- }) : (r = e && e.value, n = typeof r === a ? r.call(e, {
- hash: {},
- data: t
- }) : r), o += l(n) + '">', (r = i.text) ? n = r.call(e, {
- hash: {},
- data: t
- }) : (r = e && e.text, n = typeof r === a ? r.call(e, {
- hash: {},
- data: t
- }) : r), o += l(n) + "</li>\n"
- }
- this.compilerInfo = [4, ">= 1.0.0"], i = this.merge(i, e.helpers), r = r || {};
- var s, a = "function",
- l = this.escapeExpression,
- h = this;
- return s = i.each.call(t, t, {
- hash: {},
- inverse: h.noop,
- fn: h.program(1, o, r),
- data: r
- }), s || 0 === s ? s : ""
- })
- }, function(e, t, i) {
- var n = i(16);
- "string" == typeof n && (n = [
- [e.id, n, ""]
- ]);
- i(18)(n, {});
- n.locals && (e.exports = n.locals)
- }, function(e, t, i) {
- t = e.exports = i(17)(), t.push([e.id, '.picker{display:none;position:fixed;top:0;z-index:100;width:100%;height:100%;overflow:hidden;text-align:center;font-family:PingFang SC,STHeitiSC-Light,Helvetica-Light,arial,sans-serif;font-size:14px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}.picker .picker-mask{position:absolute;z-index:500;width:100%;height:100%;transition:all .5s;-webkit-transition:all .5s;background:transparent;opacity:0}.picker .picker-mask.show{background:rgba(0,0,0,.6);opacity:1}.picker .picker-panel{position:absolute;z-index:600;bottom:0;width:100%;height:243px;background:#fff;transform:translateY(243px);-webkit-transform:translateY(243px);transition:all .5s;-webkit-transition:all .5s}.picker .picker-panel.show{transform:translateY(0);-webkit-transform:translateY(0)}.picker .picker-panel .picker-choose{position:relative;height:50px;color:#878787;font-size:14px}.picker .picker-panel .picker-choose .picker-title{line-height:50px;font-size:19px;text-align:center;color:#333}.picker .picker-panel .picker-choose .cancel,.picker .picker-panel .picker-choose .confirm{position:absolute;padding:10px;top:6px}.picker .picker-panel .picker-choose .confirm{right:0;color:#17f377}.picker .picker-panel .picker-choose .cancel{left:0}.picker .picker-panel .picker-content{position:relative}.picker .picker-panel .picker-content .mask-bottom,.picker .picker-panel .picker-content .mask-top{position:absolute;z-index:10;width:100%;height:68px;pointer-events:none;transform:translateZ(0);-webkit-transform:translateZ(0)}.picker .picker-panel .picker-content .mask-top{top:0;background:-webkit-gradient(linear,left bottom,left top,from(hsla(0,0%,100%,.4)),to(hsla(0,0%,100%,.8)));background:-o-linear-gradient(bottom,hsla(0,0%,100%,.4),hsla(0,0%,100%,.8))}.picker .picker-panel .picker-content .mask-top:after,.picker .picker-panel .picker-content .mask-top:before{display:block;position:absolute;border-top:1px solid #ccc;left:0;width:100%;content:" "}.picker .picker-panel .picker-content .mask-top:before{display:none;top:0}.picker .picker-panel .picker-content .mask-top:after{display:block;bottom:0}.picker .picker-panel .picker-content .mask-bottom{bottom:0;background:-webkit-gradient(linear,left top,left bottom,from(hsla(0,0%,100%,.4)),to(hsla(0,0%,100%,.8)));background:-o-linear-gradient(top,hsla(0,0%,100%,.4),hsla(0,0%,100%,.8))}.picker .picker-panel .picker-content .mask-bottom:after,.picker .picker-panel .picker-content .mask-bottom:before{display:block;position:absolute;border-top:1px solid #ccc;left:0;width:100%;content:" "}.picker .picker-panel .picker-content .mask-bottom:before{display:block;top:0}.picker .picker-panel .picker-content .mask-bottom:after{display:none;bottom:0}.picker .picker-panel .wheel-wrapper{display:-ms-flexbox;display:-webkit-box;display:flex;padding:0 10px}.picker .picker-panel .wheel-wrapper .wheel{-ms-flex:1 1 1e-9px;-webkit-box-flex:1;flex:1;flex-basis:1e-9px;width:1%;height:173px;overflow:hidden;font-size:21px}.picker .picker-panel .wheel-wrapper .wheel .wheel-scroll{margin-top:68px;line-height:36px}.picker .picker-panel .wheel-wrapper .wheel .wheel-scroll .wheel-item{height:36px;overflow:hidden;white-space:nowrap;color:#333}.picker .picker-footer{height:20px}@media (-webkit-min-device-pixel-ratio:1.5),(min-device-pixel-ratio:1.5){.border-1px:after,.border-1px:before{-webkit-transform:scaleY(.7);-webkit-transform-origin:0 0;transform:scaleY(.7)}.border-1px:after{-webkit-transform-origin:left bottom}}@media (-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2){.border-1px:after,.border-1px:before{-webkit-transform:scaleY(.5);transform:scaleY(.5)}}', ""])
- }, function(e, t) {
- e.exports = function() {
- var e = [];
- return e.toString = function() {
- for (var e = [], t = 0; t < this.length; t++) {
- var i = this[t];
- i[2] ? e.push("@media " + i[2] + "{" + i[1] + "}") : e.push(i[1])
- }
- return e.join("")
- }, e.i = function(t, i) {
- "string" == typeof t && (t = [
- [null, t, ""]
- ]);
- for (var n = {}, r = 0; r < this.length; r++) {
- var o = this[r][0];
- "number" == typeof o && (n[o] = !0)
- }
- for (r = 0; r < t.length; r++) {
- var s = t[r];
- "number" == typeof s[0] && n[s[0]] || (i && !s[2] ? s[2] = i : i && (s[2] = "(" + s[2] + ") and (" + i + ")"), e.push(s))
- }
- }, e
- }
- }, function(e, t, i) {
- function n(e, t) {
- for (var i = 0; i < e.length; i++) {
- var n = e[i],
- r = f[n.id];
- if (r) {
- r.refs++;
- for (var o = 0; o < r.parts.length; o++) r.parts[o](n.parts[o]);
- for (; o < n.parts.length; o++) r.parts.push(h(n.parts[o], t))
- } else {
- for (var s = [], o = 0; o < n.parts.length; o++) s.push(h(n.parts[o], t));
- f[n.id] = {
- id: n.id,
- refs: 1,
- parts: s
- }
- }
- }
- }
- function r(e) {
- for (var t = [], i = {}, n = 0; n < e.length; n++) {
- var r = e[n],
- o = r[0],
- s = r[1],
- a = r[2],
- l = r[3],
- h = {
- css: s,
- media: a,
- sourceMap: l
- };
- i[o] ? i[o].parts.push(h) : t.push(i[o] = {
- id: o,
- parts: [h]
- })
- }
- return t
- }
- function o(e, t) {
- var i = v(),
- n = b[b.length - 1];
- if ("top" === e.insertAt) n ? n.nextSibling ? i.insertBefore(t, n.nextSibling) : i.appendChild(t) : i.insertBefore(t, i.firstChild), b.push(t);
- else {
- if ("bottom" !== e.insertAt) throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
- i.appendChild(t)
- }
- }
- function s(e) {
- e.parentNode.removeChild(e);
- var t = b.indexOf(e);
- t >= 0 && b.splice(t, 1)
- }
- function a(e) {
- var t = document.createElement("style");
- return t.type = "text/css", o(e, t), t
- }
- function l(e) {
- var t = document.createElement("link");
- return t.rel = "stylesheet", o(e, t), t
- }
- function h(e, t) {
- var i, n, r;
- if (t.singleton) {
- var o = y++;
- i = g || (g = a(t)), n = c.bind(null, i, o, !1), r = c.bind(null, i, o, !0)
- } else e.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (i = l(t), n = u.bind(null, i), r = function() {
- s(i), i.href && URL.revokeObjectURL(i.href)
- }) : (i = a(t), n = p.bind(null, i), r = function() {
- s(i)
- });
- return n(e), function(t) {
- if (t) {
- if (t.css === e.css && t.media === e.media && t.sourceMap === e.sourceMap) return;
- n(e = t)
- } else r()
- }
- }
- function c(e, t, i, n) {
- var r = i ? "" : n.css;
- if (e.styleSheet) e.styleSheet.cssText = k(t, r);
- else {
- var o = document.createTextNode(r),
- s = e.childNodes;
- s[t] && e.removeChild(s[t]), s.length ? e.insertBefore(o, s[t]) : e.appendChild(o)
- }
- }
- function p(e, t) {
- var i = t.css,
- n = t.media;
- if (n && e.setAttribute("media", n), e.styleSheet) e.styleSheet.cssText = i;
- else {
- for (; e.firstChild;) e.removeChild(e.firstChild);
- e.appendChild(document.createTextNode(i))
- }
- }
- function u(e, t) {
- var i = t.css,
- n = t.sourceMap;
- n && (i += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(n)))) + " */");
- var r = new Blob([i], {
- type: "text/css"
- }),
- o = e.href;
- e.href = URL.createObjectURL(r), o && URL.revokeObjectURL(o)
- }
- var f = {},
- d = function(e) {
- var t;
- return function() {
- return "undefined" == typeof t && (t = e.apply(this, arguments)), t
- }
- },
- m = d(function() {
- return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())
- }),
- v = d(function() {
- return document.head || document.getElementsByTagName("head")[0]
- }),
- g = null,
- y = 0,
- b = [];
- e.exports = function(e, t) {
- t = t || {}, "undefined" == typeof t.singleton && (t.singleton = m()), "undefined" == typeof t.insertAt && (t.insertAt = "bottom");
- var i = r(e);
- return n(i, t), function(e) {
- for (var o = [], s = 0; s < i.length; s++) {
- var a = i[s],
- l = f[a.id];
- l.refs--, o.push(l)
- }
- if (e) {
- var h = r(e);
- n(h, t)
- }
- for (var s = 0; s < o.length; s++) {
- var l = o[s];
- if (0 === l.refs) {
- for (var c = 0; c < l.parts.length; c++) l.parts[c]();
- delete f[l.id]
- }
- }
- }
- };
- var k = function() {
- var e = [];
- return function(t, i) {
- return e[t] = i, e.filter(Boolean).join("\n")
- }
- }()
- }])
- });
|