@3dwayfinder/wayfinder-vue-components 1.0.91 → 1.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wayfinder-vue-components.esm.js +166 -3296
- package/dist/wayfinder-vue-components.min.js +2 -21
- package/dist/wayfinder-vue-components.ssr.js +160 -3290
- package/package.json +2 -1
- package/src/lib-components/GroupsMenu.vue +5 -9
- package/src/lib-components/ScrollableArea.vue +5 -90
- package/src/lib-components/pages/Browser.vue +19 -2
|
@@ -1874,8 +1874,8 @@ var script$d = {
|
|
|
1874
1874
|
name: 'GroupsMenu',
|
|
1875
1875
|
props: {
|
|
1876
1876
|
parent: {
|
|
1877
|
-
type:
|
|
1878
|
-
default:
|
|
1877
|
+
type: Number,
|
|
1878
|
+
default: -1
|
|
1879
1879
|
},
|
|
1880
1880
|
showPOICount: {
|
|
1881
1881
|
type: Boolean,
|
|
@@ -1933,18 +1933,13 @@ var script$d = {
|
|
|
1933
1933
|
let topic;
|
|
1934
1934
|
let groups = this.poiGroups;
|
|
1935
1935
|
|
|
1936
|
-
if (this.parent && this.parent.id) {
|
|
1937
|
-
|
|
1938
|
-
if (this.poiGroups[this.parent.id]) {
|
|
1939
|
-
this.poiGroups[this.parent.id];
|
|
1940
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
1936
|
for (let i in groups) {
|
|
1944
1937
|
topic = groups[i];
|
|
1945
1938
|
|
|
1946
1939
|
if (topic && topic.getShowInMenu() && topic.getName(this.language)) {
|
|
1947
|
-
|
|
1940
|
+
if (!(this.parent > -1 && parseInt(topic.parent_id) !== this.parent)) {
|
|
1941
|
+
arr.push(topic);
|
|
1942
|
+
}
|
|
1948
1943
|
}
|
|
1949
1944
|
}
|
|
1950
1945
|
|
|
@@ -2118,8 +2113,8 @@ var __vue_staticRenderFns__$d = [];
|
|
|
2118
2113
|
|
|
2119
2114
|
const __vue_inject_styles__$d = function (inject) {
|
|
2120
2115
|
if (!inject) return;
|
|
2121
|
-
inject("data-v-
|
|
2122
|
-
source: ".az-menu[data-v-
|
|
2116
|
+
inject("data-v-616120b3_0", {
|
|
2117
|
+
source: ".az-menu[data-v-616120b3]{overflow:hidden;user-select:none}.az-menu .list-item[data-v-616120b3]{list-style:none}.az-menu ul[data-v-616120b3]{margin:0;padding:0}",
|
|
2123
2118
|
map: undefined,
|
|
2124
2119
|
media: undefined
|
|
2125
2120
|
});
|
|
@@ -2127,7 +2122,7 @@ const __vue_inject_styles__$d = function (inject) {
|
|
|
2127
2122
|
/* scoped */
|
|
2128
2123
|
|
|
2129
2124
|
|
|
2130
|
-
const __vue_scope_id__$d = "data-v-
|
|
2125
|
+
const __vue_scope_id__$d = "data-v-616120b3";
|
|
2131
2126
|
/* module identifier */
|
|
2132
2127
|
|
|
2133
2128
|
const __vue_module_identifier__$d = undefined;
|
|
@@ -3322,3299 +3317,152 @@ const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
|
|
|
3322
3317
|
staticRenderFns: __vue_staticRenderFns__$3
|
|
3323
3318
|
}, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, createInjector, undefined, undefined);
|
|
3324
3319
|
|
|
3325
|
-
|
|
3326
|
-
* better-scroll / core
|
|
3327
|
-
|
|
3328
|
-
* Released under the MIT License.
|
|
3329
|
-
*/
|
|
3330
|
-
/*! *****************************************************************************
|
|
3331
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3332
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
3333
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
3334
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
3335
|
-
|
|
3336
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
3337
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
3338
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
3339
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
3340
|
-
|
|
3341
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
3342
|
-
and limitations under the License.
|
|
3343
|
-
***************************************************************************** */
|
|
3344
|
-
/* global Reflect, Promise */
|
|
3345
|
-
|
|
3346
|
-
var extendStatics = function(d, b) {
|
|
3347
|
-
extendStatics = Object.setPrototypeOf ||
|
|
3348
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
3349
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
3350
|
-
return extendStatics(d, b);
|
|
3351
|
-
};
|
|
3320
|
+
var scrollarea_common = createCommonjsModule(function (module) {
|
|
3321
|
+
module.exports=function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s});},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0});},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e){t.exports={create:function(){return [0,0]},clone:function(t){var e=new Array(2);return e[0]=t[0],e[1]=t[1],e},fromValues:function(t,e){var i=new Array(2);return i[0]=t,i[1]=e,i},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t},set:function(t,e,i){return t[0]=e,t[1]=i,t},add:function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},sub:function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},mul:function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t},div:function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t},min:function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},max:function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t},scale:function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},dist:function(t,e){var i=e[0]-t[0],s=e[1]-t[1];return Math.sqrt(i*i+s*s)},sqrDist:function(t,e){var i=e[0]-t[0],s=e[1]-t[1];return i*i+s*s},len:function(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)},length:function(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)},sqrLen:function(t){var e=t[0],i=t[1];return e*e+i*i},negate:function(t,e){return t[0]=-e[0],t[1]=-e[1],t},normalize:function(t,e){var i=e[0],s=e[1],n=i*i+s*s;return n>0&&(n=1/Math.sqrt(n),t[0]=e[0]*n,t[1]=e[1]*n),t},dot:function(t,e){return t[0]*e[0]+t[1]*e[1]},cross:function(t,e,i){var s=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=s,t},lerp:function(t,e,i,s){var n=e[0],o=e[1];return t[0]=n+s*(i[0]-n),t[1]=o+s*(i[1]-o),t},transformMat2:function(t,e,i){var s=e[0],n=e[1];return t[0]=s*i[0]+n*i[1],t[1]=s*i[2]+n*i[3],t},str:function(t){return "this("+t[0]+", "+t[1]+")"}};},function(t,e,i){i.r(e),i.d(e,"ScrollArea",(function(){return a}));var s=i(0),n=i.n(s);class o{constructor(t,e){this.position=n.a.create(),this.contentSize=t,this.viewSize=e,this._maxPosition=n.a.create(),this._minPosition=n.a.create(),this._vec2cache=n.a.create();}getViewPosition(){return this.position}getContentPosition(){return this.position}clampPosition(){n.a.max(this._maxPosition,this.getViewSize(),this.getContentSize()),n.a.min(this._minPosition,this.getViewSize(),this.getContentSize()),n.a.sub(this._maxPosition,this._maxPosition,this._minPosition),this.position=this.clamp(this.position,n.a.create(),this._maxPosition);}setViewPosition(t){!isNaN(parseFloat(t[0]))&&isFinite(t[0])&&!isNaN(parseFloat(t[1]))&&isFinite(t[1])&&(this.position=t,this.clampPosition());}move(t){t&&this.setViewPosition(n.a.sub(t,this.getViewPosition(),t));}setViewSize(t,e){this.viewSize=n.a.fromValues(t,e),this.clampPosition();}setContentSize(t,e){this.contentSize=n.a.fromValues(t,e),this.clampPosition();}isContentLonger(){return this.viewSize[1]<=this.contentSize[1]}isContentWider(){return this.viewSize[0]<=this.contentSize[0]}getContentSize(){return this.contentSize}getViewSize(){return this.viewSize}clamp(t,e,i){var s=n.a.clone(t);return n.a.max(s,s,e),n.a.min(s,s,i),s}getPercentagePosition(){return n.a.div(n.a.create(),this.position,this.viewSize)}getRelativePosition(){return n.a.sub(this._vec2cache,this.getViewSize(),this.getContentSize()),0!==n.a.len(this._vec2cache)&&n.a.div(this._vec2cache,this.getViewPosition(),n.a.sub(this._vec2cache,this.getViewSize(),this.getContentSize())),this._vec2cache}}class r{constructor(t,e,i){this.vertical=void 0===i||!i,this.position=0,this.containerSize=1,this.contentSize=1,this.mouseDelta=n.a.create(),this.onScroll=!1,this.parentElement=t,this.element=document.createElement("div"),this.element.classList.add("sa-scrollbar"),this.element.classList.add("sa-scrollbar-position-"+e),this.element.style.position="absolute",this.element.style.right="0",this.element.style.top="0",this.element.style.bottom="0",this.bar=document.createElement("div"),this.bar.style.minWidth="1px",this.bar.classList.add("sa-bar"),this.element.appendChild(this.bar),t.appendChild(this.element),this.attachEvents(this.element),this.view=new o(n.a.fromValues(this.bar.clientWidth,this.bar.clientHeight),n.a.fromValues(this.element.clientWidth,this.element.clientHeight));}attachEvents(t){if(t.addEventListener("mousedown",t=>{this.mousedown=!0,t.stopPropagation(),t.preventDefault();}),window.addEventListener("mousemove",t=>{if(this.mousedown){var e=n.a.fromValues(t.movementX,t.movementY);this.deltaMove=e,this.lastTime=Date.now(),this.getOption("reverse"),this.scroll(e);}}),window.addEventListener("mouseup",t=>{this.mousedown=!1;}),t.addEventListener("touchstart",t=>{t.touches&&t.touches.length>0&&(this.lastTouch=n.a.fromValues(t.touches[0].screenX,t.touches[0].screenY));},!1),window.addEventListener("touchend",t=>{this.lastTouch=null;},!1),window.addEventListener("touchcancel",t=>{this.lastTouch=null;},!1),window.addEventListener("touchmove",t=>{if(console.log("touchmove",t),t.touches&&t.touches.length>0){if(this.lastTouch){var e=n.a.fromValues(t.touches[0].screenX,t.touches[0].screenY);this.getOption("reverse")?this.scroll(n.a.sub(e,this.lastTouch,e)):this.scroll(n.a.sub(e,e,this.lastTouch));}this.lastTouch=n.a.fromValues(t.touches[0].screenX,t.touches[0].screenY);}},!1),"undefined"!=typeof ResizeObserver&&t){var e=this;this.resizeObserver=new ResizeObserver((function(){e.resize();})),this.resizeObserver.observe(t);}}scroll(t){var e=this;window.requestAnimationFrame((function(){e.view.move(t),t=n.a.clone(e.view.getContentPosition()),e.setPosition(t),e.updateCallback&&"function"==typeof e.updateCallback&&e.updateCallback(me);}));}setPosition(t){var e=1;this.getOption("swapContainers")&&(e=-1),this.bar.style.transform="translate("+t[0]*e+"px,"+t[1]*e+"px)",this.scrolling=!1,this.checkContentPosition();}checkContentPosition(){var t=this.view.getRelativePosition(),e=[];0===t[0]&&e.push("on-left"),0===t[1]&&e.push("on-top"),1===t[0]&&e.push("on-right"),1===t[1]&&e.push("on-bottom"),e!==this.positionClassNames&&(this.container.classList.remove(...this.positionClassNames),e&&e.length>0&&this.container.classList.add(...e),this.positionClassNames=e);}clear(){this.position=0,this.setPosition(0);}getBarLength(){return this.vertical?parseInt(this.bar.height()):parseInt(this.bar.width())}getViewLength(){return this.vertical?this.view.getViewSize()[1]:this.view.getViewSize()[0]}getContentLength(){return this.vertical?this.view.getContentSize()[1]:this.view.getContentSize()[0]}setContentPosition(t){var e=n.a.create(),i=this.containerSize/this.contentSize;n.a.scale(e,t,i),this.view.setViewPosition(e),this.setPosition(this.view.getContentPosition());}getPercentage(){return n.a.len(this.view.getViewPosition())/this.getViewLength()}resize(){this.view.setViewSize(parseInt(this.element.clientWidth),parseInt(this.bar.clientHeight)),this.view.setContentSize(parseInt(this.element.clientWidth),parseInt(this.bar.clientHeight)),this.checkIfScrollIsNeeded();}checkIfScrollIsNeeded(){this.view.isContentLonger()&&this.element.classList.add("content-longer"),this.view.isContentWider()&&this.element.classList.add("content-wider");}}class a{constructor(t,e,i){this.container=null,this.content=null,this.options={smooth:!0,reverse:!0,swapContainers:!0,updateInterval:10,wheelSpeed:50},void 0!==i&&i&&(this.options=this.chooseOptions(this.options,i)),console.log("vec2",n.a,n.a.create),this.setContainer(t),this.events={change:[],layout:[],ready:[]},this.lastTouch=null,this.deltaMove=n.a.create(),this.lastTime=0,this.smoothDistance=null,this.timeout=null,this.smoothCoeficent=n.a.fromValues(11,11),this.positionClassNames=[],this.mousedown=!1,this.touchstart=!1,this._vec2cache=n.a.create();this.container;if(this.getOption("swapContainers")?this.view=new o(n.a.fromValues(this.container.clientWidth,this.container.clientHeight),n.a.fromValues(this.content.clientWidth,this.content.clientHeight)):(this.content,this.view=new o(n.a.fromValues(this.content.clientWidth,this.content.clientHeight),n.a.fromValues(this.container.clientWidth,this.container.clientHeight))),this.container.style.position="relative",this.container.style.overflow="hidden",this.container.style.overflow="hidden",this.container.style.userSelect="none",this.attachEvents(this.container),this.scrollbar=new r(this.container,"right"),"undefined"!=typeof ResizeObserver&&this.content){var s=this;this.resizeObserver=new ResizeObserver((function(){console.log("resizeObserver2"),s.resize();})),this.resizeObserver.observe(this.content);}}attachEvents(t){t.addEventListener("mousewheel",t=>{var e=0;t.originalEvent&&(t=t.originalEvent),e="wheelDelta"in t?t.wheelDelta<0?1:t.wheelDelta>0?-1:1:t.deltaY>0?1:t.deltaY<0?-1:1,this.scroll(n.a.fromValues(0,scope.getOption("wheelSpeed")*e));}),t.addEventListener("mousedown",t=>{this.mousedown=!0,t.stopPropagation(),t.preventDefault();}),window.addEventListener("mousemove",t=>{if(this.mousedown){var e=n.a.fromValues(t.movementX,t.movementY);this.deltaMove=e,this.lastTime=Date.now(),this.getOption("reverse"),this.scroll(e);}}),window.addEventListener("mouseup",t=>{this.mousedown=!1;}),t.addEventListener("touchstart",t=>{t.touches&&t.touches.length>0&&(this.lastTouch=n.a.fromValues(t.touches[0].screenX,t.touches[0].screenY));},!1),window.addEventListener("touchend",t=>{this.lastTouch=null;},!1),window.addEventListener("touchcancel",t=>{this.lastTouch=null;},!1),window.addEventListener("touchmove",t=>{if(console.log("touchmove",t),t.touches&&t.touches.length>0){if(this.lastTouch){var e=n.a.fromValues(t.touches[0].screenX,t.touches[0].screenY);this.getOption("reverse")?this.scroll(n.a.sub(e,this.lastTouch,e)):this.scroll(n.a.sub(e,e,this.lastTouch));}this.lastTouch=n.a.fromValues(t.touches[0].screenX,t.touches[0].screenY);}},!1);}onEndDrag(t,e){var i=n.a.div(0,Math.abs(event.velocity));if(this.getOption("smooth")&&sqrLen(i)>.3){var s=fromValues(event.deltaX,event.deltaY),o=n.a.create();n.a.multiply(o,s,i),this.getOption("reverse");var r=this;this.stop();var a=create(),h=function(){div(a,o,r.smoothCoeficent),sqrLen(a)>3?(sub(o,o,a),requestAnimFrame(h,r.getOption("updateInterval")),negate(a,a),r.scroll(a)):r.scrolling=!1;};this.timeout=requestAnimFrame(h,r.updateInterval);}else this.scrolling=!1;}resize(){this.getOption("swapContainers")?(this.view.setViewSize(parseInt(this.content.clientWidth),parseInt(this.content.clientHeight)),this.view.setContentSize(parseInt(this.container.clientWidth),parseInt(this.container.clientHeight))):(this.view.setViewSize(parseInt(this.container.clientWidth),parseInt(this.container.clientHeight)),this.view.setContentSize(parseInt(this.content.clientWidth),parseInt(this.content.clientHeight))),this.checkIfScrollIsNeeded();}reset(){this.setContentOffset([0,0]);}checkIfScrollIsNeeded(){this.view.isContentLonger()&&this.container.classList.add("content-longer"),this.view.isContentWider()&&this.container.classList.add("content-wider");}chooseOptions(t,e){for(var i in e)t[i]&&(t[i]=e[i]);return t}setContainer(t){switch(typeof t){case"undefined":this.container=document.createElement("div"),this.container.classList.add("keyboard"),document.body.appendChild(this.container);break;case"string":this.container=document.getElementById(t);break;default:this.container=t;}this.container&&(this.content=this.container.firstElementChild);}getOption(t){return this.options[t]}on(t,e){"object"!=typeof this.events[t]&&(this.events[t]=[]),this.events[t].push(e);}trigger(){let t=Array.prototype.slice.call(arguments);if(t.length>0){let e=t[0];if(t.shift(),this.events[e]){let i;for(let s=0,n=this.events[e].length;s<n;s++)i=this.events[e][s],"function"==typeof i&&i.apply(this,t);}}}scroll(t){var e=this;window.requestAnimationFrame((function(){e.view.move(t),t=n.a.clone(e.view.getContentPosition()),e.setContentOffset(t),e.updateCallback&&"function"==typeof e.updateCallback&&e.updateCallback(me);}));}setContentOffset(t){var e=1;this.getOption("swapContainers")&&(e=-1),this.content.style.transform="translate("+t[0]*e+"px,"+t[1]*e+"px)",this.scrolling=!1,this.checkContentPosition();}checkContentPosition(){var t=this.view.getRelativePosition(),e=[];0===t[0]&&e.push("on-left"),0===t[1]&&e.push("on-top"),1===t[0]&&e.push("on-right"),1===t[1]&&e.push("on-bottom"),e!==this.positionClassNames&&(this.container.classList.remove(...this.positionClassNames),e&&e.length>0&&this.container.classList.add(...e),this.positionClassNames=e);}}}]).ScrollArea;
|
|
3322
|
+
});
|
|
3352
3323
|
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3324
|
+
//
|
|
3325
|
+
var script$2 = {
|
|
3326
|
+
name: 'ScrollableArea',
|
|
3327
|
+
data: () => ({
|
|
3328
|
+
scroll: null
|
|
3329
|
+
}),
|
|
3358
3330
|
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
};
|
|
3367
|
-
return __assign.apply(this, arguments);
|
|
3368
|
-
};
|
|
3331
|
+
updated() {
|
|
3332
|
+
this.$nextTick(() => {
|
|
3333
|
+
if (this.scroll) {
|
|
3334
|
+
this.scroll.resize();
|
|
3335
|
+
}
|
|
3336
|
+
});
|
|
3337
|
+
},
|
|
3369
3338
|
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3339
|
+
mounted() {
|
|
3340
|
+
this.$nextTick(() => {
|
|
3341
|
+
if (!this.scroll) {
|
|
3342
|
+
this.scroll = new scrollarea_common(this.$refs.area);
|
|
3343
|
+
}
|
|
3344
|
+
});
|
|
3345
|
+
},
|
|
3373
3346
|
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
var isAndroid = ua$2 && ua$2.indexOf('android') > 0;
|
|
3347
|
+
methods: {
|
|
3348
|
+
activate() {
|
|
3349
|
+
this.makeScroll();
|
|
3350
|
+
},
|
|
3379
3351
|
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
}
|
|
3385
|
-
function extend$1(target) {
|
|
3386
|
-
var rest = [];
|
|
3387
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
3388
|
-
rest[_i - 1] = arguments[_i];
|
|
3389
|
-
}
|
|
3390
|
-
for (var i = 0; i < rest.length; i++) {
|
|
3391
|
-
var source = rest[i];
|
|
3392
|
-
for (var key in source) {
|
|
3393
|
-
target[key] = source[key];
|
|
3352
|
+
reset() {
|
|
3353
|
+
this.$nextTick(() => {
|
|
3354
|
+
if (this.scroll) {
|
|
3355
|
+
this.scroll.refresh();
|
|
3394
3356
|
}
|
|
3357
|
+
});
|
|
3395
3358
|
}
|
|
3396
|
-
return target;
|
|
3397
|
-
}
|
|
3398
|
-
function isUndef(v) {
|
|
3399
|
-
return v === undefined || v === null;
|
|
3400
|
-
}
|
|
3401
3359
|
|
|
3402
|
-
|
|
3403
|
-
document.createElement('div').style);
|
|
3404
|
-
var vendor$2 = (function () {
|
|
3405
|
-
if (!inBrowser$2) {
|
|
3406
|
-
return false;
|
|
3407
|
-
}
|
|
3408
|
-
var transformNames = {
|
|
3409
|
-
webkit: 'webkitTransform',
|
|
3410
|
-
Moz: 'MozTransform',
|
|
3411
|
-
O: 'OTransform',
|
|
3412
|
-
ms: 'msTransform',
|
|
3413
|
-
standard: 'transform'
|
|
3414
|
-
};
|
|
3415
|
-
for (var key in transformNames) {
|
|
3416
|
-
if (elementStyle$2[transformNames[key]] !== undefined) {
|
|
3417
|
-
return key;
|
|
3418
|
-
}
|
|
3419
|
-
}
|
|
3420
|
-
return false;
|
|
3421
|
-
})();
|
|
3422
|
-
function prefixStyle$2(style) {
|
|
3423
|
-
if (vendor$2 === false) {
|
|
3424
|
-
return style;
|
|
3425
|
-
}
|
|
3426
|
-
if (vendor$2 === 'standard') {
|
|
3427
|
-
if (style === 'transitionEnd') {
|
|
3428
|
-
return 'transitionend';
|
|
3429
|
-
}
|
|
3430
|
-
return style;
|
|
3431
|
-
}
|
|
3432
|
-
return vendor$2 + style.charAt(0).toUpperCase() + style.substr(1);
|
|
3433
|
-
}
|
|
3434
|
-
function getElement(el) {
|
|
3435
|
-
return (typeof el === 'string'
|
|
3436
|
-
? document.querySelector(el)
|
|
3437
|
-
: el);
|
|
3438
|
-
}
|
|
3439
|
-
function addEvent$2(el, type, fn, capture) {
|
|
3440
|
-
el.addEventListener(type, fn, {
|
|
3441
|
-
passive: false,
|
|
3442
|
-
capture: !!capture
|
|
3443
|
-
});
|
|
3444
|
-
}
|
|
3445
|
-
function removeEvent$2(el, type, fn, capture) {
|
|
3446
|
-
el.removeEventListener(type, fn, {
|
|
3447
|
-
capture: !!capture
|
|
3448
|
-
});
|
|
3449
|
-
}
|
|
3450
|
-
function offset(el) {
|
|
3451
|
-
var left = 0;
|
|
3452
|
-
var top = 0;
|
|
3453
|
-
while (el) {
|
|
3454
|
-
left -= el.offsetLeft;
|
|
3455
|
-
top -= el.offsetTop;
|
|
3456
|
-
el = el.offsetParent;
|
|
3457
|
-
}
|
|
3458
|
-
return {
|
|
3459
|
-
left: left,
|
|
3460
|
-
top: top
|
|
3461
|
-
};
|
|
3462
|
-
}
|
|
3463
|
-
vendor$2 && vendor$2 !== 'standard' ? '-' + vendor$2.toLowerCase() + '-' : '';
|
|
3464
|
-
var transform$2 = prefixStyle$2('transform');
|
|
3465
|
-
var transition$2 = prefixStyle$2('transition');
|
|
3466
|
-
var hasPerspective = inBrowser$2 && prefixStyle$2('perspective') in elementStyle$2;
|
|
3467
|
-
// fix issue #361
|
|
3468
|
-
var hasTransition = inBrowser$2 && transition$2 in elementStyle$2;
|
|
3469
|
-
var style$1 = {
|
|
3470
|
-
transform: transform$2,
|
|
3471
|
-
transition: transition$2,
|
|
3472
|
-
transitionTimingFunction: prefixStyle$2('transitionTimingFunction'),
|
|
3473
|
-
transitionDuration: prefixStyle$2('transitionDuration'),
|
|
3474
|
-
transitionDelay: prefixStyle$2('transitionDelay'),
|
|
3475
|
-
transformOrigin: prefixStyle$2('transformOrigin'),
|
|
3476
|
-
transitionEnd: prefixStyle$2('transitionEnd')
|
|
3477
|
-
};
|
|
3478
|
-
var eventTypeMap = {
|
|
3479
|
-
touchstart: 1,
|
|
3480
|
-
touchmove: 1,
|
|
3481
|
-
touchend: 1,
|
|
3482
|
-
mousedown: 2,
|
|
3483
|
-
mousemove: 2,
|
|
3484
|
-
mouseup: 2
|
|
3360
|
+
}
|
|
3485
3361
|
};
|
|
3486
|
-
function getRect(el) {
|
|
3487
|
-
if (el instanceof window.SVGElement) {
|
|
3488
|
-
var rect = el.getBoundingClientRect();
|
|
3489
|
-
return {
|
|
3490
|
-
top: rect.top,
|
|
3491
|
-
left: rect.left,
|
|
3492
|
-
width: rect.width,
|
|
3493
|
-
height: rect.height
|
|
3494
|
-
};
|
|
3495
|
-
}
|
|
3496
|
-
else {
|
|
3497
|
-
return {
|
|
3498
|
-
top: el.offsetTop,
|
|
3499
|
-
left: el.offsetLeft,
|
|
3500
|
-
width: el.offsetWidth,
|
|
3501
|
-
height: el.offsetHeight
|
|
3502
|
-
};
|
|
3503
|
-
}
|
|
3504
|
-
}
|
|
3505
|
-
function preventDefaultExceptionFn$1(el, exceptions) {
|
|
3506
|
-
for (var i in exceptions) {
|
|
3507
|
-
if (exceptions[i].test(el[i])) {
|
|
3508
|
-
return true;
|
|
3509
|
-
}
|
|
3510
|
-
}
|
|
3511
|
-
return false;
|
|
3512
|
-
}
|
|
3513
|
-
var tagExceptionFn = preventDefaultExceptionFn$1;
|
|
3514
|
-
function tap(e, eventName) {
|
|
3515
|
-
var ev = document.createEvent('Event');
|
|
3516
|
-
ev.initEvent(eventName, true, true);
|
|
3517
|
-
ev.pageX = e.pageX;
|
|
3518
|
-
ev.pageY = e.pageY;
|
|
3519
|
-
e.target.dispatchEvent(ev);
|
|
3520
|
-
}
|
|
3521
|
-
function click(e, event) {
|
|
3522
|
-
if (event === void 0) { event = 'click'; }
|
|
3523
|
-
var eventSource;
|
|
3524
|
-
if (e.type === 'mouseup') {
|
|
3525
|
-
eventSource = e;
|
|
3526
|
-
}
|
|
3527
|
-
else if (e.type === 'touchend' || e.type === 'touchcancel') {
|
|
3528
|
-
eventSource = e.changedTouches[0];
|
|
3529
|
-
}
|
|
3530
|
-
var posSrc = {};
|
|
3531
|
-
if (eventSource) {
|
|
3532
|
-
posSrc.screenX = eventSource.screenX || 0;
|
|
3533
|
-
posSrc.screenY = eventSource.screenY || 0;
|
|
3534
|
-
posSrc.clientX = eventSource.clientX || 0;
|
|
3535
|
-
posSrc.clientY = eventSource.clientY || 0;
|
|
3536
|
-
}
|
|
3537
|
-
var ev;
|
|
3538
|
-
var bubbles = true;
|
|
3539
|
-
var cancelable = true;
|
|
3540
|
-
if (typeof MouseEvent !== 'undefined') {
|
|
3541
|
-
try {
|
|
3542
|
-
ev = new MouseEvent(event, extend$1({
|
|
3543
|
-
bubbles: bubbles,
|
|
3544
|
-
cancelable: cancelable
|
|
3545
|
-
}, posSrc));
|
|
3546
|
-
}
|
|
3547
|
-
catch (e) {
|
|
3548
|
-
createEvent();
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3551
|
-
else {
|
|
3552
|
-
createEvent();
|
|
3553
|
-
}
|
|
3554
|
-
function createEvent() {
|
|
3555
|
-
ev = document.createEvent('Event');
|
|
3556
|
-
ev.initEvent(event, bubbles, cancelable);
|
|
3557
|
-
extend$1(ev, posSrc);
|
|
3558
|
-
}
|
|
3559
|
-
// forwardedTouchEvent set to true in case of the conflict with fastclick
|
|
3560
|
-
ev.forwardedTouchEvent = true;
|
|
3561
|
-
ev._constructed = true;
|
|
3562
|
-
e.target.dispatchEvent(ev);
|
|
3563
|
-
}
|
|
3564
|
-
function dblclick(e) {
|
|
3565
|
-
click(e, 'dblclick');
|
|
3566
|
-
}
|
|
3567
3362
|
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
style: 'cubic-bezier(0.23, 1, 0.32, 1)',
|
|
3572
|
-
fn: function (t) {
|
|
3573
|
-
return 1 + --t * t * t * t * t;
|
|
3574
|
-
}
|
|
3575
|
-
},
|
|
3576
|
-
// easeOutQuard
|
|
3577
|
-
swipeBounce: {
|
|
3578
|
-
style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
|
|
3579
|
-
fn: function (t) {
|
|
3580
|
-
return t * (2 - t);
|
|
3581
|
-
}
|
|
3582
|
-
},
|
|
3583
|
-
// easeOutQuart
|
|
3584
|
-
bounce: {
|
|
3585
|
-
style: 'cubic-bezier(0.165, 0.84, 0.44, 1)',
|
|
3586
|
-
fn: function (t) {
|
|
3587
|
-
return 1 - --t * t * t * t;
|
|
3588
|
-
}
|
|
3589
|
-
}
|
|
3590
|
-
};
|
|
3363
|
+
/* script */
|
|
3364
|
+
const __vue_script__$2 = script$2;
|
|
3365
|
+
/* template */
|
|
3591
3366
|
|
|
3592
|
-
var
|
|
3593
|
-
var
|
|
3594
|
-
|
|
3595
|
-
var
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
windowCompat.oRequestAnimationFrame ||
|
|
3604
|
-
// if all else fails, use setTimeout
|
|
3605
|
-
function (callback) {
|
|
3606
|
-
return window.setTimeout(callback, (callback.interval || DEFAULT_INTERVAL) / 2); // make interval as precise as possible.
|
|
3607
|
-
});
|
|
3608
|
-
})();
|
|
3609
|
-
var cancelAnimationFrame = (function () {
|
|
3610
|
-
if (!inBrowser$2) {
|
|
3611
|
-
/* istanbul ignore if */
|
|
3612
|
-
return noop;
|
|
3613
|
-
}
|
|
3614
|
-
return (windowCompat.cancelAnimationFrame ||
|
|
3615
|
-
windowCompat.webkitCancelAnimationFrame ||
|
|
3616
|
-
windowCompat.mozCancelAnimationFrame ||
|
|
3617
|
-
windowCompat.oCancelAnimationFrame ||
|
|
3618
|
-
function (id) {
|
|
3619
|
-
window.clearTimeout(id);
|
|
3620
|
-
});
|
|
3621
|
-
})();
|
|
3622
|
-
|
|
3623
|
-
var noop$1 = function (val) { };
|
|
3624
|
-
var sharedPropertyDefinition = {
|
|
3625
|
-
enumerable: true,
|
|
3626
|
-
configurable: true,
|
|
3627
|
-
get: noop$1,
|
|
3628
|
-
set: noop$1
|
|
3629
|
-
};
|
|
3630
|
-
var getProperty = function (obj, key) {
|
|
3631
|
-
var keys = key.split('.');
|
|
3632
|
-
for (var i = 0; i < keys.length - 1; i++) {
|
|
3633
|
-
obj = obj[keys[i]];
|
|
3634
|
-
if (typeof obj !== 'object' || !obj)
|
|
3635
|
-
return;
|
|
3636
|
-
}
|
|
3637
|
-
var lastKey = keys.pop();
|
|
3638
|
-
if (typeof obj[lastKey] === 'function') {
|
|
3639
|
-
return function () {
|
|
3640
|
-
return obj[lastKey].apply(obj, arguments);
|
|
3641
|
-
};
|
|
3642
|
-
}
|
|
3643
|
-
else {
|
|
3644
|
-
return obj[lastKey];
|
|
3645
|
-
}
|
|
3646
|
-
};
|
|
3647
|
-
var setProperty = function (obj, key, value) {
|
|
3648
|
-
var keys = key.split('.');
|
|
3649
|
-
var temp;
|
|
3650
|
-
for (var i = 0; i < keys.length - 1; i++) {
|
|
3651
|
-
temp = keys[i];
|
|
3652
|
-
if (!obj[temp])
|
|
3653
|
-
obj[temp] = {};
|
|
3654
|
-
obj = obj[temp];
|
|
3655
|
-
}
|
|
3656
|
-
obj[keys.pop()] = value;
|
|
3367
|
+
var __vue_render__$2 = function () {
|
|
3368
|
+
var _vm = this;
|
|
3369
|
+
|
|
3370
|
+
var _h = _vm.$createElement;
|
|
3371
|
+
|
|
3372
|
+
var _c = _vm._self._c || _h;
|
|
3373
|
+
|
|
3374
|
+
return _c('div', {
|
|
3375
|
+
ref: "area",
|
|
3376
|
+
staticClass: "wf-component wf-scrollable"
|
|
3377
|
+
}, [_vm._t("default")], 2);
|
|
3657
3378
|
};
|
|
3658
|
-
function propertiesProxy(target, sourceKey, key) {
|
|
3659
|
-
sharedPropertyDefinition.get = function proxyGetter() {
|
|
3660
|
-
return getProperty(this, sourceKey);
|
|
3661
|
-
};
|
|
3662
|
-
sharedPropertyDefinition.set = function proxySetter(val) {
|
|
3663
|
-
setProperty(this, sourceKey, val);
|
|
3664
|
-
};
|
|
3665
|
-
Object.defineProperty(target, key, sharedPropertyDefinition);
|
|
3666
|
-
}
|
|
3667
3379
|
|
|
3668
|
-
var
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3380
|
+
var __vue_staticRenderFns__$2 = [];
|
|
3381
|
+
/* style */
|
|
3382
|
+
|
|
3383
|
+
const __vue_inject_styles__$2 = undefined;
|
|
3384
|
+
/* scoped */
|
|
3385
|
+
|
|
3386
|
+
const __vue_scope_id__$2 = "data-v-21e68d18";
|
|
3387
|
+
/* module identifier */
|
|
3388
|
+
|
|
3389
|
+
const __vue_module_identifier__$2 = undefined;
|
|
3390
|
+
/* functional template */
|
|
3391
|
+
|
|
3392
|
+
const __vue_is_functional_template__$2 = false;
|
|
3393
|
+
/* style inject */
|
|
3394
|
+
|
|
3395
|
+
/* style inject SSR */
|
|
3396
|
+
|
|
3397
|
+
/* style inject shadow dom */
|
|
3398
|
+
|
|
3399
|
+
const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
|
|
3400
|
+
render: __vue_render__$2,
|
|
3401
|
+
staticRenderFns: __vue_staticRenderFns__$2
|
|
3402
|
+
}, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
|
|
3403
|
+
|
|
3404
|
+
//
|
|
3405
|
+
var script$1 = {
|
|
3406
|
+
name: 'Banner',
|
|
3407
|
+
props: {
|
|
3408
|
+
template: String,
|
|
3409
|
+
container: String,
|
|
3410
|
+
playOnBoot: {
|
|
3411
|
+
type: Boolean,
|
|
3412
|
+
default: false
|
|
3673
3413
|
}
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
}
|
|
3692
|
-
_this.off(type, magic);
|
|
3693
|
-
fn.apply(context, args);
|
|
3694
|
-
};
|
|
3695
|
-
magic.fn = fn;
|
|
3696
|
-
this.on(type, magic);
|
|
3697
|
-
return this;
|
|
3698
|
-
};
|
|
3699
|
-
EventEmitter.prototype.off = function (type, fn) {
|
|
3700
|
-
if (!type && !fn) {
|
|
3701
|
-
this.events = {};
|
|
3702
|
-
return this;
|
|
3703
|
-
}
|
|
3704
|
-
if (type) {
|
|
3705
|
-
this._checkInTypes(type);
|
|
3706
|
-
if (!fn) {
|
|
3707
|
-
this.events[type] = [];
|
|
3708
|
-
return this;
|
|
3709
|
-
}
|
|
3710
|
-
var events = this.events[type];
|
|
3711
|
-
if (!events) {
|
|
3712
|
-
return this;
|
|
3713
|
-
}
|
|
3714
|
-
var count = events.length;
|
|
3715
|
-
while (count--) {
|
|
3716
|
-
if (events[count][0] === fn ||
|
|
3717
|
-
(events[count][0] && events[count][0].fn === fn)) {
|
|
3718
|
-
events.splice(count, 1);
|
|
3719
|
-
}
|
|
3720
|
-
}
|
|
3721
|
-
return this;
|
|
3722
|
-
}
|
|
3414
|
+
},
|
|
3415
|
+
computed: { //yahLogo
|
|
3416
|
+
...mapState(['banners'])
|
|
3417
|
+
},
|
|
3418
|
+
|
|
3419
|
+
data() {
|
|
3420
|
+
return {
|
|
3421
|
+
frames: [],
|
|
3422
|
+
current: -1,
|
|
3423
|
+
timer: null,
|
|
3424
|
+
fadeDuration: 500,
|
|
3425
|
+
backgroundColor: "#fff",
|
|
3426
|
+
visible: false,
|
|
3427
|
+
qr: null,
|
|
3428
|
+
displayQR: false,
|
|
3429
|
+
frameKeywords: [],
|
|
3430
|
+
last: 0
|
|
3723
3431
|
};
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3432
|
+
},
|
|
3433
|
+
|
|
3434
|
+
watch: {
|
|
3435
|
+
banners() {
|
|
3436
|
+
let now = Date.now();
|
|
3437
|
+
|
|
3438
|
+
if (this.template && this.container && this.banners['template-' + this.template] && this.banners['template-' + this.template][this.container]) {
|
|
3439
|
+
this.frames = this.banners['template-' + this.template][this.container].filter(frame => {
|
|
3440
|
+
let enabled = frame.enabled;
|
|
3441
|
+
|
|
3442
|
+
if (enabled && frame.from_date) {
|
|
3443
|
+
enabled = enabled && new Date(frame.from_date).getTime() <= now;
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
if (enabled && frame.to_date) {
|
|
3447
|
+
enabled = enabled && new Date(frame.to_date).getTime() >= now;
|
|
3448
|
+
}
|
|
3449
|
+
|
|
3450
|
+
if (enabled) {
|
|
3451
|
+
for (let c in frame.containers) {
|
|
3452
|
+
frame.containers[c].url = this.getUrl(frame.containers[c]);
|
|
3745
3453
|
}
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
var _this = this;
|
|
3750
|
-
names.forEach(function (type) {
|
|
3751
|
-
_this.eventTypes[type] = type;
|
|
3454
|
+
}
|
|
3455
|
+
|
|
3456
|
+
return enabled;
|
|
3752
3457
|
});
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
this.
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
var types = this.eventTypes;
|
|
3760
|
-
var inTypes = types[type] === type;
|
|
3761
|
-
if (!inTypes) {
|
|
3762
|
-
warn$2("EventEmitter has used unknown event type: \"" + type + "\", should be oneof [" + Object.keys(types) + "]");
|
|
3763
|
-
}
|
|
3764
|
-
};
|
|
3765
|
-
return EventEmitter;
|
|
3766
|
-
}());
|
|
3767
|
-
|
|
3768
|
-
var Direction;
|
|
3769
|
-
(function (Direction) {
|
|
3770
|
-
Direction[Direction["Positive"] = 1] = "Positive";
|
|
3771
|
-
Direction[Direction["Negative"] = -1] = "Negative";
|
|
3772
|
-
Direction[Direction["Default"] = 0] = "Default";
|
|
3773
|
-
})(Direction || (Direction = {}));
|
|
3774
|
-
|
|
3775
|
-
var DirectionLock;
|
|
3776
|
-
(function (DirectionLock) {
|
|
3777
|
-
DirectionLock["Default"] = "";
|
|
3778
|
-
DirectionLock["Horizontal"] = "horizontal";
|
|
3779
|
-
DirectionLock["Vertical"] = "vertical";
|
|
3780
|
-
DirectionLock["None"] = "none";
|
|
3781
|
-
})(DirectionLock || (DirectionLock = {}));
|
|
3782
|
-
|
|
3783
|
-
var EventPassthrough;
|
|
3784
|
-
(function (EventPassthrough) {
|
|
3785
|
-
EventPassthrough["None"] = "";
|
|
3786
|
-
EventPassthrough["Horizontal"] = "horizontal";
|
|
3787
|
-
EventPassthrough["Vertical"] = "vertical";
|
|
3788
|
-
})(EventPassthrough || (EventPassthrough = {}));
|
|
3789
|
-
|
|
3790
|
-
var EventType;
|
|
3791
|
-
(function (EventType) {
|
|
3792
|
-
EventType[EventType["Touch"] = 1] = "Touch";
|
|
3793
|
-
EventType[EventType["Mouse"] = 2] = "Mouse";
|
|
3794
|
-
})(EventType || (EventType = {}));
|
|
3795
|
-
|
|
3796
|
-
var MouseButton;
|
|
3797
|
-
(function (MouseButton) {
|
|
3798
|
-
MouseButton[MouseButton["Left"] = 0] = "Left";
|
|
3799
|
-
MouseButton[MouseButton["Middle"] = 1] = "Middle";
|
|
3800
|
-
MouseButton[MouseButton["Right"] = 2] = "Right";
|
|
3801
|
-
})(MouseButton || (MouseButton = {}));
|
|
3802
|
-
|
|
3803
|
-
var Probe;
|
|
3804
|
-
(function (Probe) {
|
|
3805
|
-
Probe[Probe["Default"] = 0] = "Default";
|
|
3806
|
-
Probe[Probe["Throttle"] = 1] = "Throttle";
|
|
3807
|
-
Probe[Probe["Normal"] = 2] = "Normal";
|
|
3808
|
-
Probe[Probe["Realtime"] = 3] = "Realtime";
|
|
3809
|
-
})(Probe || (Probe = {}));
|
|
3810
|
-
|
|
3811
|
-
var Options = /** @class */ (function () {
|
|
3812
|
-
function Options() {
|
|
3813
|
-
this.startX = 0;
|
|
3814
|
-
this.startY = 0;
|
|
3815
|
-
this.scrollX = false;
|
|
3816
|
-
this.scrollY = true;
|
|
3817
|
-
this.freeScroll = false;
|
|
3818
|
-
this.directionLockThreshold = 5;
|
|
3819
|
-
this.eventPassthrough = EventPassthrough.None;
|
|
3820
|
-
this.click = false;
|
|
3821
|
-
this.dblclick = false;
|
|
3822
|
-
this.tap = '';
|
|
3823
|
-
this.bounce = {
|
|
3824
|
-
top: true,
|
|
3825
|
-
bottom: true,
|
|
3826
|
-
left: true,
|
|
3827
|
-
right: true
|
|
3828
|
-
};
|
|
3829
|
-
this.bounceTime = 800;
|
|
3830
|
-
this.momentum = true;
|
|
3831
|
-
this.momentumLimitTime = 300;
|
|
3832
|
-
this.momentumLimitDistance = 15;
|
|
3833
|
-
this.swipeTime = 2500;
|
|
3834
|
-
this.swipeBounceTime = 500;
|
|
3835
|
-
this.deceleration = 0.0015;
|
|
3836
|
-
this.flickLimitTime = 200;
|
|
3837
|
-
this.flickLimitDistance = 100;
|
|
3838
|
-
this.resizePolling = 60;
|
|
3839
|
-
this.probeType = Probe.Default;
|
|
3840
|
-
this.stopPropagation = false;
|
|
3841
|
-
this.preventDefault = true;
|
|
3842
|
-
this.preventDefaultException = {
|
|
3843
|
-
tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/
|
|
3844
|
-
};
|
|
3845
|
-
this.tagException = {
|
|
3846
|
-
tagName: /^TEXTAREA$/
|
|
3847
|
-
};
|
|
3848
|
-
this.HWCompositing = true;
|
|
3849
|
-
this.useTransition = true;
|
|
3850
|
-
this.bindToWrapper = false;
|
|
3851
|
-
this.autoBlur = true;
|
|
3852
|
-
}
|
|
3853
|
-
Options.prototype.merge = function (options) {
|
|
3854
|
-
if (!options)
|
|
3855
|
-
return this;
|
|
3856
|
-
for (var key in options) {
|
|
3857
|
-
this[key] = options[key];
|
|
3458
|
+
this.$emit('hasbanners', this.frames.length > 0);
|
|
3459
|
+
|
|
3460
|
+
if (this.playOnBoot) {
|
|
3461
|
+
this.$nextTick(function () {
|
|
3462
|
+
this.play();
|
|
3463
|
+
});
|
|
3858
3464
|
}
|
|
3859
|
-
|
|
3860
|
-
};
|
|
3861
|
-
Options.prototype.process = function () {
|
|
3862
|
-
this.translateZ =
|
|
3863
|
-
this.HWCompositing && hasPerspective ? ' translateZ(0)' : '';
|
|
3864
|
-
this.useTransition = this.useTransition && hasTransition;
|
|
3865
|
-
this.preventDefault = !this.eventPassthrough && this.preventDefault;
|
|
3866
|
-
// If you want eventPassthrough I have to lock one of the axes
|
|
3867
|
-
this.scrollX =
|
|
3868
|
-
this.eventPassthrough === EventPassthrough.Horizontal
|
|
3869
|
-
? false
|
|
3870
|
-
: this.scrollX;
|
|
3871
|
-
this.scrollY =
|
|
3872
|
-
this.eventPassthrough === EventPassthrough.Vertical ? false : this.scrollY;
|
|
3873
|
-
// With eventPassthrough we also need lockDirection mechanism
|
|
3874
|
-
this.freeScroll = this.freeScroll && !this.eventPassthrough;
|
|
3875
|
-
// force true when freeScroll is true
|
|
3876
|
-
this.scrollX = this.freeScroll ? true : this.scrollX;
|
|
3877
|
-
this.scrollY = this.freeScroll ? true : this.scrollY;
|
|
3878
|
-
this.directionLockThreshold = this.eventPassthrough
|
|
3879
|
-
? 0
|
|
3880
|
-
: this.directionLockThreshold;
|
|
3881
|
-
return this;
|
|
3882
|
-
};
|
|
3883
|
-
return Options;
|
|
3884
|
-
}());
|
|
3885
|
-
|
|
3886
|
-
var EventRegister$2 = /** @class */ (function () {
|
|
3887
|
-
function EventRegister(wrapper, events) {
|
|
3888
|
-
this.wrapper = wrapper;
|
|
3889
|
-
this.events = events;
|
|
3890
|
-
this.addDOMEvents();
|
|
3891
|
-
}
|
|
3892
|
-
EventRegister.prototype.destroy = function () {
|
|
3893
|
-
this.removeDOMEvents();
|
|
3894
|
-
this.events = [];
|
|
3895
|
-
};
|
|
3896
|
-
EventRegister.prototype.addDOMEvents = function () {
|
|
3897
|
-
this.handleDOMEvents(addEvent$2);
|
|
3898
|
-
};
|
|
3899
|
-
EventRegister.prototype.removeDOMEvents = function () {
|
|
3900
|
-
this.handleDOMEvents(removeEvent$2);
|
|
3901
|
-
};
|
|
3902
|
-
EventRegister.prototype.handleDOMEvents = function (eventOperation) {
|
|
3903
|
-
var _this = this;
|
|
3904
|
-
var wrapper = this.wrapper;
|
|
3905
|
-
this.events.forEach(function (event) {
|
|
3906
|
-
eventOperation(wrapper, event.name, _this, !!event.capture);
|
|
3907
|
-
});
|
|
3908
|
-
};
|
|
3909
|
-
EventRegister.prototype.handleEvent = function (e) {
|
|
3910
|
-
var eventType = e.type;
|
|
3911
|
-
this.events.some(function (event) {
|
|
3912
|
-
if (event.name === eventType) {
|
|
3913
|
-
event.handler(e);
|
|
3914
|
-
return true;
|
|
3915
|
-
}
|
|
3916
|
-
return false;
|
|
3917
|
-
});
|
|
3918
|
-
};
|
|
3919
|
-
return EventRegister;
|
|
3920
|
-
}());
|
|
3921
|
-
|
|
3922
|
-
var ActionsHandler = /** @class */ (function () {
|
|
3923
|
-
function ActionsHandler(wrapper, options) {
|
|
3924
|
-
this.wrapper = wrapper;
|
|
3925
|
-
this.options = options;
|
|
3926
|
-
this.hooks = new EventEmitter$1([
|
|
3927
|
-
'beforeStart',
|
|
3928
|
-
'start',
|
|
3929
|
-
'move',
|
|
3930
|
-
'end',
|
|
3931
|
-
'click'
|
|
3932
|
-
]);
|
|
3933
|
-
this.handleDOMEvents();
|
|
3934
|
-
}
|
|
3935
|
-
ActionsHandler.prototype.handleDOMEvents = function () {
|
|
3936
|
-
var _a = this.options, bindToWrapper = _a.bindToWrapper;
|
|
3937
|
-
var wrapper = this.wrapper;
|
|
3938
|
-
var target = bindToWrapper ? wrapper : window;
|
|
3939
|
-
this.startClickRegister = new EventRegister$2(wrapper, [
|
|
3940
|
-
{
|
|
3941
|
-
name: 'mousedown',
|
|
3942
|
-
handler: this.start.bind(this)
|
|
3943
|
-
},
|
|
3944
|
-
{
|
|
3945
|
-
name: 'touchstart',
|
|
3946
|
-
handler: this.start.bind(this)
|
|
3947
|
-
},
|
|
3948
|
-
{
|
|
3949
|
-
name: 'click',
|
|
3950
|
-
handler: this.click.bind(this),
|
|
3951
|
-
capture: true
|
|
3952
|
-
}
|
|
3953
|
-
]);
|
|
3954
|
-
this.moveEndRegister = new EventRegister$2(target, [
|
|
3955
|
-
{
|
|
3956
|
-
name: 'mousemove',
|
|
3957
|
-
handler: this.move.bind(this)
|
|
3958
|
-
},
|
|
3959
|
-
{
|
|
3960
|
-
name: 'touchmove',
|
|
3961
|
-
handler: this.move.bind(this)
|
|
3962
|
-
},
|
|
3963
|
-
{
|
|
3964
|
-
name: 'mouseup',
|
|
3965
|
-
handler: this.end.bind(this)
|
|
3966
|
-
},
|
|
3967
|
-
{
|
|
3968
|
-
name: 'touchend',
|
|
3969
|
-
handler: this.end.bind(this)
|
|
3970
|
-
},
|
|
3971
|
-
{
|
|
3972
|
-
name: 'mouseup',
|
|
3973
|
-
handler: this.end.bind(this)
|
|
3974
|
-
},
|
|
3975
|
-
{
|
|
3976
|
-
name: 'touchcancel',
|
|
3977
|
-
handler: this.end.bind(this)
|
|
3978
|
-
}
|
|
3979
|
-
]);
|
|
3980
|
-
};
|
|
3981
|
-
ActionsHandler.prototype.beforeHandler = function (e, type) {
|
|
3982
|
-
var _a = this.options, preventDefault = _a.preventDefault, stopPropagation = _a.stopPropagation, preventDefaultException = _a.preventDefaultException;
|
|
3983
|
-
var preventDefaultConditions = {
|
|
3984
|
-
start: function () {
|
|
3985
|
-
return (preventDefault &&
|
|
3986
|
-
!preventDefaultExceptionFn$1(e.target, preventDefaultException));
|
|
3987
|
-
},
|
|
3988
|
-
end: function () {
|
|
3989
|
-
return (preventDefault &&
|
|
3990
|
-
!preventDefaultExceptionFn$1(e.target, preventDefaultException));
|
|
3991
|
-
},
|
|
3992
|
-
move: function () {
|
|
3993
|
-
return preventDefault;
|
|
3994
|
-
}
|
|
3995
|
-
};
|
|
3996
|
-
if (preventDefaultConditions[type]()) {
|
|
3997
|
-
e.preventDefault();
|
|
3998
|
-
}
|
|
3999
|
-
if (stopPropagation) {
|
|
4000
|
-
e.stopPropagation();
|
|
4001
|
-
}
|
|
4002
|
-
};
|
|
4003
|
-
ActionsHandler.prototype.setInitiated = function (type) {
|
|
4004
|
-
if (type === void 0) { type = 0; }
|
|
4005
|
-
this.initiated = type;
|
|
4006
|
-
};
|
|
4007
|
-
ActionsHandler.prototype.start = function (e) {
|
|
4008
|
-
var _eventType = eventTypeMap[e.type];
|
|
4009
|
-
if (this.initiated && this.initiated !== _eventType) {
|
|
4010
|
-
return;
|
|
4011
|
-
}
|
|
4012
|
-
this.setInitiated(_eventType);
|
|
4013
|
-
// if textarea or other html tags in options.tagException is manipulated
|
|
4014
|
-
// do not make bs scroll
|
|
4015
|
-
if (tagExceptionFn(e.target, this.options.tagException)) {
|
|
4016
|
-
this.setInitiated();
|
|
4017
|
-
return;
|
|
4018
|
-
}
|
|
4019
|
-
// no mouse left button
|
|
4020
|
-
if (_eventType === EventType.Mouse && e.button !== MouseButton.Left)
|
|
4021
|
-
return;
|
|
4022
|
-
if (this.hooks.trigger(this.hooks.eventTypes.beforeStart, e)) {
|
|
4023
|
-
return;
|
|
4024
|
-
}
|
|
4025
|
-
this.beforeHandler(e, 'start');
|
|
4026
|
-
var point = (e.touches ? e.touches[0] : e);
|
|
4027
|
-
this.pointX = point.pageX;
|
|
4028
|
-
this.pointY = point.pageY;
|
|
4029
|
-
this.hooks.trigger(this.hooks.eventTypes.start, e);
|
|
4030
|
-
};
|
|
4031
|
-
ActionsHandler.prototype.move = function (e) {
|
|
4032
|
-
if (eventTypeMap[e.type] !== this.initiated) {
|
|
4033
|
-
return;
|
|
4034
|
-
}
|
|
4035
|
-
this.beforeHandler(e, 'move');
|
|
4036
|
-
var point = (e.touches ? e.touches[0] : e);
|
|
4037
|
-
var deltaX = point.pageX - this.pointX;
|
|
4038
|
-
var deltaY = point.pageY - this.pointY;
|
|
4039
|
-
this.pointX = point.pageX;
|
|
4040
|
-
this.pointY = point.pageY;
|
|
4041
|
-
if (this.hooks.trigger(this.hooks.eventTypes.move, {
|
|
4042
|
-
deltaX: deltaX,
|
|
4043
|
-
deltaY: deltaY,
|
|
4044
|
-
e: e
|
|
4045
|
-
})) {
|
|
4046
|
-
return;
|
|
4047
|
-
}
|
|
4048
|
-
// auto end when out of wrapper
|
|
4049
|
-
var scrollLeft = document.documentElement.scrollLeft ||
|
|
4050
|
-
window.pageXOffset ||
|
|
4051
|
-
document.body.scrollLeft;
|
|
4052
|
-
var scrollTop = document.documentElement.scrollTop ||
|
|
4053
|
-
window.pageYOffset ||
|
|
4054
|
-
document.body.scrollTop;
|
|
4055
|
-
var pX = this.pointX - scrollLeft;
|
|
4056
|
-
var pY = this.pointY - scrollTop;
|
|
4057
|
-
if (pX >
|
|
4058
|
-
document.documentElement.clientWidth -
|
|
4059
|
-
this.options.momentumLimitDistance ||
|
|
4060
|
-
pX < this.options.momentumLimitDistance ||
|
|
4061
|
-
pY < this.options.momentumLimitDistance ||
|
|
4062
|
-
pY >
|
|
4063
|
-
document.documentElement.clientHeight -
|
|
4064
|
-
this.options.momentumLimitDistance) {
|
|
4065
|
-
this.end(e);
|
|
4066
|
-
}
|
|
4067
|
-
};
|
|
4068
|
-
ActionsHandler.prototype.end = function (e) {
|
|
4069
|
-
if (eventTypeMap[e.type] !== this.initiated) {
|
|
4070
|
-
return;
|
|
4071
|
-
}
|
|
4072
|
-
this.setInitiated();
|
|
4073
|
-
this.beforeHandler(e, 'end');
|
|
4074
|
-
this.hooks.trigger(this.hooks.eventTypes.end, e);
|
|
4075
|
-
};
|
|
4076
|
-
ActionsHandler.prototype.click = function (e) {
|
|
4077
|
-
this.hooks.trigger(this.hooks.eventTypes.click, e);
|
|
4078
|
-
};
|
|
4079
|
-
ActionsHandler.prototype.destroy = function () {
|
|
4080
|
-
this.startClickRegister.destroy();
|
|
4081
|
-
this.moveEndRegister.destroy();
|
|
4082
|
-
this.hooks.destroy();
|
|
4083
|
-
};
|
|
4084
|
-
return ActionsHandler;
|
|
4085
|
-
}());
|
|
4086
|
-
|
|
4087
|
-
var translaterMetaData = {
|
|
4088
|
-
x: ['translateX', 'px'],
|
|
4089
|
-
y: ['translateY', 'px']
|
|
4090
|
-
};
|
|
4091
|
-
var Translater = /** @class */ (function () {
|
|
4092
|
-
function Translater(content) {
|
|
4093
|
-
this.content = content;
|
|
4094
|
-
this.style = content.style;
|
|
4095
|
-
this.hooks = new EventEmitter$1(['beforeTranslate', 'translate']);
|
|
4096
|
-
}
|
|
4097
|
-
Translater.prototype.getComputedPosition = function () {
|
|
4098
|
-
var cssStyle = window.getComputedStyle(this.content, null);
|
|
4099
|
-
var matrix = cssStyle[style$1.transform].split(')')[0].split(', ');
|
|
4100
|
-
var x = +(matrix[12] || matrix[4]);
|
|
4101
|
-
var y = +(matrix[13] || matrix[5]);
|
|
4102
|
-
return {
|
|
4103
|
-
x: x,
|
|
4104
|
-
y: y
|
|
4105
|
-
};
|
|
4106
|
-
};
|
|
4107
|
-
Translater.prototype.translate = function (point) {
|
|
4108
|
-
var transformStyle = [];
|
|
4109
|
-
Object.keys(point).forEach(function (key) {
|
|
4110
|
-
if (!translaterMetaData[key]) {
|
|
4111
|
-
return;
|
|
4112
|
-
}
|
|
4113
|
-
var transformFnName = translaterMetaData[key][0];
|
|
4114
|
-
if (transformFnName) {
|
|
4115
|
-
var transformFnArgUnit = translaterMetaData[key][1];
|
|
4116
|
-
var transformFnArg = point[key];
|
|
4117
|
-
transformStyle.push(transformFnName + "(" + transformFnArg + transformFnArgUnit + ")");
|
|
4118
|
-
}
|
|
4119
|
-
});
|
|
4120
|
-
this.hooks.trigger(this.hooks.eventTypes.beforeTranslate, transformStyle, point);
|
|
4121
|
-
this.style[style$1.transform] = "" + transformStyle.join(' ');
|
|
4122
|
-
this.hooks.trigger(this.hooks.eventTypes.translate, point);
|
|
4123
|
-
};
|
|
4124
|
-
Translater.prototype.destroy = function () {
|
|
4125
|
-
this.hooks.destroy();
|
|
4126
|
-
};
|
|
4127
|
-
return Translater;
|
|
4128
|
-
}());
|
|
4129
|
-
|
|
4130
|
-
var Base = /** @class */ (function () {
|
|
4131
|
-
function Base(content, translater, options) {
|
|
4132
|
-
this.content = content;
|
|
4133
|
-
this.translater = translater;
|
|
4134
|
-
this.options = options;
|
|
4135
|
-
this.hooks = new EventEmitter$1([
|
|
4136
|
-
'move',
|
|
4137
|
-
'end',
|
|
4138
|
-
'beforeForceStop',
|
|
4139
|
-
'forceStop',
|
|
4140
|
-
'time',
|
|
4141
|
-
'timeFunction'
|
|
4142
|
-
]);
|
|
4143
|
-
this.style = content.style;
|
|
4144
|
-
}
|
|
4145
|
-
Base.prototype.translate = function (endPoint) {
|
|
4146
|
-
this.translater.translate(endPoint);
|
|
4147
|
-
};
|
|
4148
|
-
Base.prototype.setPending = function (pending) {
|
|
4149
|
-
this.pending = pending;
|
|
4150
|
-
};
|
|
4151
|
-
Base.prototype.setForceStopped = function (forceStopped) {
|
|
4152
|
-
this.forceStopped = forceStopped;
|
|
4153
|
-
};
|
|
4154
|
-
Base.prototype.destroy = function () {
|
|
4155
|
-
this.hooks.destroy();
|
|
4156
|
-
cancelAnimationFrame(this.timer);
|
|
4157
|
-
};
|
|
4158
|
-
return Base;
|
|
4159
|
-
}());
|
|
4160
|
-
|
|
4161
|
-
var Transition = /** @class */ (function (_super) {
|
|
4162
|
-
__extends(Transition, _super);
|
|
4163
|
-
function Transition() {
|
|
4164
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4165
|
-
}
|
|
4166
|
-
Transition.prototype.startProbe = function () {
|
|
4167
|
-
var _this = this;
|
|
4168
|
-
var probe = function () {
|
|
4169
|
-
var pos = _this.translater.getComputedPosition();
|
|
4170
|
-
_this.hooks.trigger(_this.hooks.eventTypes.move, pos);
|
|
4171
|
-
// excute when transition ends
|
|
4172
|
-
if (!_this.pending) {
|
|
4173
|
-
_this.hooks.trigger(_this.hooks.eventTypes.end, pos);
|
|
4174
|
-
return;
|
|
4175
|
-
}
|
|
4176
|
-
_this.timer = requestAnimationFrame(probe);
|
|
4177
|
-
};
|
|
4178
|
-
cancelAnimationFrame(this.timer);
|
|
4179
|
-
this.timer = requestAnimationFrame(probe);
|
|
4180
|
-
};
|
|
4181
|
-
Transition.prototype.transitionTime = function (time) {
|
|
4182
|
-
if (time === void 0) { time = 0; }
|
|
4183
|
-
this.style[style$1.transitionDuration] = time + 'ms';
|
|
4184
|
-
this.hooks.trigger(this.hooks.eventTypes.time, time);
|
|
4185
|
-
};
|
|
4186
|
-
Transition.prototype.transitionTimingFunction = function (easing) {
|
|
4187
|
-
this.style[style$1.transitionTimingFunction] = easing;
|
|
4188
|
-
this.hooks.trigger(this.hooks.eventTypes.timeFunction, easing);
|
|
4189
|
-
};
|
|
4190
|
-
Transition.prototype.move = function (startPoint, endPoint, time, easingFn, isSlient) {
|
|
4191
|
-
this.setPending(time > 0 && (startPoint.x !== endPoint.x || startPoint.y !== endPoint.y));
|
|
4192
|
-
this.transitionTimingFunction(easingFn);
|
|
4193
|
-
this.transitionTime(time);
|
|
4194
|
-
this.translate(endPoint);
|
|
4195
|
-
if (time && this.options.probeType === Probe.Realtime) {
|
|
4196
|
-
this.startProbe();
|
|
4197
|
-
}
|
|
4198
|
-
// if we change content's transformY in a tick
|
|
4199
|
-
// such as: 0 -> 50px -> 0
|
|
4200
|
-
// transitionend will not be triggered
|
|
4201
|
-
// so we forceupdate by reflow
|
|
4202
|
-
if (!time) {
|
|
4203
|
-
this._reflow = this.content.offsetHeight;
|
|
4204
|
-
}
|
|
4205
|
-
// no need to dispatch move and end when slient
|
|
4206
|
-
if (!time && !isSlient) {
|
|
4207
|
-
this.hooks.trigger(this.hooks.eventTypes.move, endPoint);
|
|
4208
|
-
this.hooks.trigger(this.hooks.eventTypes.end, endPoint);
|
|
4209
|
-
}
|
|
4210
|
-
};
|
|
4211
|
-
Transition.prototype.stop = function () {
|
|
4212
|
-
// still in transition
|
|
4213
|
-
if (this.pending) {
|
|
4214
|
-
this.setPending(false);
|
|
4215
|
-
cancelAnimationFrame(this.timer);
|
|
4216
|
-
var _a = this.translater.getComputedPosition(), x = _a.x, y = _a.y;
|
|
4217
|
-
this.transitionTime();
|
|
4218
|
-
this.translate({ x: x, y: y });
|
|
4219
|
-
this.setForceStopped(true);
|
|
4220
|
-
if (this.hooks.trigger(this.hooks.eventTypes.beforeForceStop, { x: x, y: y })) {
|
|
4221
|
-
return;
|
|
4222
|
-
}
|
|
4223
|
-
this.hooks.trigger(this.hooks.eventTypes.forceStop, { x: x, y: y });
|
|
4224
|
-
}
|
|
4225
|
-
};
|
|
4226
|
-
return Transition;
|
|
4227
|
-
}(Base));
|
|
4228
|
-
|
|
4229
|
-
var Animation = /** @class */ (function (_super) {
|
|
4230
|
-
__extends(Animation, _super);
|
|
4231
|
-
function Animation() {
|
|
4232
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
4233
|
-
}
|
|
4234
|
-
Animation.prototype.move = function (startPoint, endPoint, time, easingFn, isSlient) {
|
|
4235
|
-
// time is 0
|
|
4236
|
-
if (!time) {
|
|
4237
|
-
this.translate(endPoint);
|
|
4238
|
-
// if we change content's transformY in a tick
|
|
4239
|
-
// such as: 0 -> 50px -> 0
|
|
4240
|
-
// transitionend will not be triggered
|
|
4241
|
-
// so we forceupdate by reflow
|
|
4242
|
-
this._reflow = this.content.offsetHeight;
|
|
4243
|
-
// no need to dispatch move and end when slient
|
|
4244
|
-
if (isSlient)
|
|
4245
|
-
return;
|
|
4246
|
-
this.hooks.trigger(this.hooks.eventTypes.move, endPoint);
|
|
4247
|
-
this.hooks.trigger(this.hooks.eventTypes.end, endPoint);
|
|
4248
|
-
return;
|
|
4249
|
-
}
|
|
4250
|
-
this.animate(startPoint, endPoint, time, easingFn);
|
|
4251
|
-
};
|
|
4252
|
-
Animation.prototype.animate = function (startPoint, endPoint, duration, easingFn) {
|
|
4253
|
-
var _this = this;
|
|
4254
|
-
var startTime = getNow();
|
|
4255
|
-
var destTime = startTime + duration;
|
|
4256
|
-
var step = function () {
|
|
4257
|
-
var now = getNow();
|
|
4258
|
-
// js animation end
|
|
4259
|
-
if (now >= destTime) {
|
|
4260
|
-
_this.translate(endPoint);
|
|
4261
|
-
_this.hooks.trigger(_this.hooks.eventTypes.move, endPoint);
|
|
4262
|
-
_this.hooks.trigger(_this.hooks.eventTypes.end, endPoint);
|
|
4263
|
-
return;
|
|
4264
|
-
}
|
|
4265
|
-
now = (now - startTime) / duration;
|
|
4266
|
-
var easing = easingFn(now);
|
|
4267
|
-
var newPoint = {};
|
|
4268
|
-
Object.keys(endPoint).forEach(function (key) {
|
|
4269
|
-
var startValue = startPoint[key];
|
|
4270
|
-
var endValue = endPoint[key];
|
|
4271
|
-
newPoint[key] = (endValue - startValue) * easing + startValue;
|
|
4272
|
-
});
|
|
4273
|
-
_this.translate(newPoint);
|
|
4274
|
-
if (_this.pending) {
|
|
4275
|
-
_this.timer = requestAnimationFrame(step);
|
|
4276
|
-
}
|
|
4277
|
-
if (_this.options.probeType === Probe.Realtime) {
|
|
4278
|
-
_this.hooks.trigger(_this.hooks.eventTypes.move, newPoint);
|
|
4279
|
-
}
|
|
4280
|
-
};
|
|
4281
|
-
this.setPending(true);
|
|
4282
|
-
cancelAnimationFrame(this.timer);
|
|
4283
|
-
step();
|
|
4284
|
-
};
|
|
4285
|
-
Animation.prototype.stop = function () {
|
|
4286
|
-
// still in requestFrameAnimation
|
|
4287
|
-
if (this.pending) {
|
|
4288
|
-
this.setPending(false);
|
|
4289
|
-
cancelAnimationFrame(this.timer);
|
|
4290
|
-
var pos = this.translater.getComputedPosition();
|
|
4291
|
-
this.setForceStopped(true);
|
|
4292
|
-
if (this.hooks.trigger(this.hooks.eventTypes.beforeForceStop, pos)) {
|
|
4293
|
-
return;
|
|
4294
|
-
}
|
|
4295
|
-
this.hooks.trigger(this.hooks.eventTypes.forceStop, pos);
|
|
4296
|
-
}
|
|
4297
|
-
};
|
|
4298
|
-
return Animation;
|
|
4299
|
-
}(Base));
|
|
4300
|
-
|
|
4301
|
-
function createAnimater(element, translater, options) {
|
|
4302
|
-
var useTransition = options.useTransition;
|
|
4303
|
-
var animaterOptions = {};
|
|
4304
|
-
Object.defineProperty(animaterOptions, 'probeType', {
|
|
4305
|
-
enumerable: true,
|
|
4306
|
-
configurable: false,
|
|
4307
|
-
get: function () {
|
|
4308
|
-
return options.probeType;
|
|
4309
|
-
}
|
|
4310
|
-
});
|
|
4311
|
-
if (useTransition) {
|
|
4312
|
-
return new Transition(element, translater, animaterOptions);
|
|
4313
|
-
}
|
|
4314
|
-
else {
|
|
4315
|
-
return new Animation(element, translater, animaterOptions);
|
|
4316
|
-
}
|
|
4317
|
-
}
|
|
4318
|
-
|
|
4319
|
-
var Behavior = /** @class */ (function () {
|
|
4320
|
-
function Behavior(wrapper, options) {
|
|
4321
|
-
this.wrapper = wrapper;
|
|
4322
|
-
this.options = options;
|
|
4323
|
-
this.hooks = new EventEmitter$1(['momentum', 'end']);
|
|
4324
|
-
this.content = this.wrapper.children[0];
|
|
4325
|
-
this.currentPos = 0;
|
|
4326
|
-
this.startPos = 0;
|
|
4327
|
-
}
|
|
4328
|
-
Behavior.prototype.start = function () {
|
|
4329
|
-
this.direction = Direction.Default;
|
|
4330
|
-
this.movingDirection = Direction.Default;
|
|
4331
|
-
this.dist = 0;
|
|
4332
|
-
};
|
|
4333
|
-
Behavior.prototype.move = function (delta) {
|
|
4334
|
-
delta = this.hasScroll ? delta : 0;
|
|
4335
|
-
this.movingDirection =
|
|
4336
|
-
delta > 0
|
|
4337
|
-
? Direction.Negative
|
|
4338
|
-
: delta < 0
|
|
4339
|
-
? Direction.Positive
|
|
4340
|
-
: Direction.Default;
|
|
4341
|
-
var newPos = this.currentPos + delta;
|
|
4342
|
-
// Slow down or stop if outside of the boundaries
|
|
4343
|
-
if (newPos > this.minScrollPos || newPos < this.maxScrollPos) {
|
|
4344
|
-
if ((newPos > this.minScrollPos && this.options.bounces[0]) ||
|
|
4345
|
-
(newPos < this.maxScrollPos && this.options.bounces[1])) {
|
|
4346
|
-
newPos = this.currentPos + delta / 3;
|
|
4347
|
-
}
|
|
4348
|
-
else {
|
|
4349
|
-
newPos =
|
|
4350
|
-
newPos > this.minScrollPos ? this.minScrollPos : this.maxScrollPos;
|
|
4351
|
-
}
|
|
4352
|
-
}
|
|
4353
|
-
return newPos;
|
|
4354
|
-
};
|
|
4355
|
-
Behavior.prototype.end = function (duration) {
|
|
4356
|
-
var momentumInfo = {
|
|
4357
|
-
duration: 0
|
|
4358
|
-
};
|
|
4359
|
-
var absDist = Math.abs(this.currentPos - this.startPos);
|
|
4360
|
-
// start momentum animation if needed
|
|
4361
|
-
if (this.options.momentum &&
|
|
4362
|
-
duration < this.options.momentumLimitTime &&
|
|
4363
|
-
absDist > this.options.momentumLimitDistance) {
|
|
4364
|
-
var wrapperSize = (this.direction === Direction.Negative && this.options.bounces[0]) ||
|
|
4365
|
-
(this.direction === Direction.Positive && this.options.bounces[1])
|
|
4366
|
-
? this.wrapperSize
|
|
4367
|
-
: 0;
|
|
4368
|
-
momentumInfo = this.hasScroll
|
|
4369
|
-
? this.momentum(this.currentPos, this.startPos, duration, this.maxScrollPos, this.minScrollPos, wrapperSize, this.options)
|
|
4370
|
-
: { destination: this.currentPos, duration: 0 };
|
|
4371
|
-
}
|
|
4372
|
-
else {
|
|
4373
|
-
this.hooks.trigger(this.hooks.eventTypes.end, momentumInfo);
|
|
4374
|
-
}
|
|
4375
|
-
return momentumInfo;
|
|
4376
|
-
};
|
|
4377
|
-
Behavior.prototype.momentum = function (current, start, time, lowerMargin, upperMargin, wrapperSize, options) {
|
|
4378
|
-
if (options === void 0) { options = this.options; }
|
|
4379
|
-
var distance = current - start;
|
|
4380
|
-
var speed = Math.abs(distance) / time;
|
|
4381
|
-
var deceleration = options.deceleration, swipeBounceTime = options.swipeBounceTime, swipeTime = options.swipeTime;
|
|
4382
|
-
var momentumData = {
|
|
4383
|
-
destination: current + (speed / deceleration) * (distance < 0 ? -1 : 1),
|
|
4384
|
-
duration: swipeTime,
|
|
4385
|
-
rate: 15
|
|
4386
|
-
};
|
|
4387
|
-
this.hooks.trigger(this.hooks.eventTypes.momentum, momentumData, distance);
|
|
4388
|
-
if (momentumData.destination < lowerMargin) {
|
|
4389
|
-
momentumData.destination = wrapperSize
|
|
4390
|
-
? Math.max(lowerMargin - wrapperSize / 4, lowerMargin - (wrapperSize / momentumData.rate) * speed)
|
|
4391
|
-
: lowerMargin;
|
|
4392
|
-
momentumData.duration = swipeBounceTime;
|
|
4393
|
-
}
|
|
4394
|
-
else if (momentumData.destination > upperMargin) {
|
|
4395
|
-
momentumData.destination = wrapperSize
|
|
4396
|
-
? Math.min(upperMargin + wrapperSize / 4, upperMargin + (wrapperSize / momentumData.rate) * speed)
|
|
4397
|
-
: upperMargin;
|
|
4398
|
-
momentumData.duration = swipeBounceTime;
|
|
4399
|
-
}
|
|
4400
|
-
momentumData.destination = Math.round(momentumData.destination);
|
|
4401
|
-
return momentumData;
|
|
4402
|
-
};
|
|
4403
|
-
Behavior.prototype.updateDirection = function () {
|
|
4404
|
-
var absDist = Math.round(this.currentPos) - this.absStartPos;
|
|
4405
|
-
this.direction =
|
|
4406
|
-
absDist > 0
|
|
4407
|
-
? Direction.Negative
|
|
4408
|
-
: absDist < 0
|
|
4409
|
-
? Direction.Positive
|
|
4410
|
-
: Direction.Default;
|
|
4411
|
-
};
|
|
4412
|
-
Behavior.prototype.refresh = function () {
|
|
4413
|
-
var _a = this.options.rect, size = _a.size, position = _a.position;
|
|
4414
|
-
var isWrapperStatic = window.getComputedStyle(this.wrapper, null).position === 'static';
|
|
4415
|
-
var wrapperRect = getRect(this.wrapper);
|
|
4416
|
-
this.wrapperSize = wrapperRect[size];
|
|
4417
|
-
var contentRect = getRect(this.content);
|
|
4418
|
-
this.contentSize = contentRect[size];
|
|
4419
|
-
this.relativeOffset = contentRect[position];
|
|
4420
|
-
if (isWrapperStatic) {
|
|
4421
|
-
this.relativeOffset -= wrapperRect[position];
|
|
4422
|
-
}
|
|
4423
|
-
this.minScrollPos = 0;
|
|
4424
|
-
this.maxScrollPos = this.wrapperSize - this.contentSize;
|
|
4425
|
-
if (this.maxScrollPos < 0) {
|
|
4426
|
-
this.maxScrollPos -= this.relativeOffset;
|
|
4427
|
-
this.minScrollPos = -this.relativeOffset;
|
|
4428
|
-
}
|
|
4429
|
-
this.hasScroll =
|
|
4430
|
-
this.options.scrollable && this.maxScrollPos < this.minScrollPos;
|
|
4431
|
-
if (!this.hasScroll) {
|
|
4432
|
-
this.maxScrollPos = this.minScrollPos;
|
|
4433
|
-
this.contentSize = this.wrapperSize;
|
|
4434
|
-
}
|
|
4435
|
-
this.direction = 0;
|
|
4436
|
-
};
|
|
4437
|
-
Behavior.prototype.updatePosition = function (pos) {
|
|
4438
|
-
this.currentPos = pos;
|
|
4439
|
-
};
|
|
4440
|
-
Behavior.prototype.getCurrentPos = function () {
|
|
4441
|
-
return Math.round(this.currentPos);
|
|
4442
|
-
};
|
|
4443
|
-
Behavior.prototype.checkInBoundary = function () {
|
|
4444
|
-
var position = this.adjustPosition(this.currentPos);
|
|
4445
|
-
var inBoundary = position === this.getCurrentPos();
|
|
4446
|
-
return {
|
|
4447
|
-
position: position,
|
|
4448
|
-
inBoundary: inBoundary
|
|
4449
|
-
};
|
|
4450
|
-
};
|
|
4451
|
-
// adjust position when out of boundary
|
|
4452
|
-
Behavior.prototype.adjustPosition = function (pos) {
|
|
4453
|
-
var roundPos = Math.round(pos);
|
|
4454
|
-
if (!this.hasScroll || roundPos > this.minScrollPos) {
|
|
4455
|
-
roundPos = this.minScrollPos;
|
|
4456
|
-
}
|
|
4457
|
-
else if (roundPos < this.maxScrollPos) {
|
|
4458
|
-
roundPos = this.maxScrollPos;
|
|
4459
|
-
}
|
|
4460
|
-
return roundPos;
|
|
4461
|
-
};
|
|
4462
|
-
Behavior.prototype.updateStartPos = function () {
|
|
4463
|
-
this.startPos = this.currentPos;
|
|
4464
|
-
};
|
|
4465
|
-
Behavior.prototype.updateAbsStartPos = function () {
|
|
4466
|
-
this.absStartPos = this.currentPos;
|
|
4467
|
-
};
|
|
4468
|
-
Behavior.prototype.resetStartPos = function () {
|
|
4469
|
-
this.updateStartPos();
|
|
4470
|
-
this.updateAbsStartPos();
|
|
4471
|
-
};
|
|
4472
|
-
Behavior.prototype.getAbsDist = function (delta) {
|
|
4473
|
-
this.dist += delta;
|
|
4474
|
-
return Math.abs(this.dist);
|
|
4475
|
-
};
|
|
4476
|
-
Behavior.prototype.destroy = function () {
|
|
4477
|
-
this.hooks.destroy();
|
|
4478
|
-
};
|
|
4479
|
-
return Behavior;
|
|
4480
|
-
}());
|
|
4481
|
-
|
|
4482
|
-
var _a, _b, _c, _d;
|
|
4483
|
-
var Passthrough;
|
|
4484
|
-
(function (Passthrough) {
|
|
4485
|
-
Passthrough["Yes"] = "yes";
|
|
4486
|
-
Passthrough["No"] = "no";
|
|
4487
|
-
})(Passthrough || (Passthrough = {}));
|
|
4488
|
-
var PassthroughHandlers = (_a = {},
|
|
4489
|
-
_a[Passthrough.Yes] = function (e) {
|
|
4490
|
-
return true;
|
|
4491
|
-
},
|
|
4492
|
-
_a[Passthrough.No] = function (e) {
|
|
4493
|
-
e.preventDefault();
|
|
4494
|
-
return false;
|
|
4495
|
-
},
|
|
4496
|
-
_a);
|
|
4497
|
-
var DirectionMap = (_b = {},
|
|
4498
|
-
_b[DirectionLock.Horizontal] = (_c = {},
|
|
4499
|
-
_c[Passthrough.Yes] = EventPassthrough.Horizontal,
|
|
4500
|
-
_c[Passthrough.No] = EventPassthrough.Vertical,
|
|
4501
|
-
_c),
|
|
4502
|
-
_b[DirectionLock.Vertical] = (_d = {},
|
|
4503
|
-
_d[Passthrough.Yes] = EventPassthrough.Vertical,
|
|
4504
|
-
_d[Passthrough.No] = EventPassthrough.Horizontal,
|
|
4505
|
-
_d),
|
|
4506
|
-
_b);
|
|
4507
|
-
var DirectionLockAction = /** @class */ (function () {
|
|
4508
|
-
function DirectionLockAction(directionLockThreshold, freeScroll, eventPassthrough) {
|
|
4509
|
-
this.directionLockThreshold = directionLockThreshold;
|
|
4510
|
-
this.freeScroll = freeScroll;
|
|
4511
|
-
this.eventPassthrough = eventPassthrough;
|
|
4512
|
-
this.reset();
|
|
4513
|
-
}
|
|
4514
|
-
DirectionLockAction.prototype.reset = function () {
|
|
4515
|
-
this.directionLocked = DirectionLock.Default;
|
|
4516
|
-
};
|
|
4517
|
-
DirectionLockAction.prototype.checkMovingDirection = function (absDistX, absDistY, e) {
|
|
4518
|
-
this.computeDirectionLock(absDistX, absDistY);
|
|
4519
|
-
return this.handleEventPassthrough(e);
|
|
4520
|
-
};
|
|
4521
|
-
DirectionLockAction.prototype.adjustDelta = function (deltaX, deltaY) {
|
|
4522
|
-
if (this.directionLocked === DirectionLock.Horizontal) {
|
|
4523
|
-
deltaY = 0;
|
|
4524
|
-
}
|
|
4525
|
-
else if (this.directionLocked === DirectionLock.Vertical) {
|
|
4526
|
-
deltaX = 0;
|
|
4527
|
-
}
|
|
4528
|
-
return {
|
|
4529
|
-
deltaX: deltaX,
|
|
4530
|
-
deltaY: deltaY
|
|
4531
|
-
};
|
|
4532
|
-
};
|
|
4533
|
-
DirectionLockAction.prototype.computeDirectionLock = function (absDistX, absDistY) {
|
|
4534
|
-
// If you are scrolling in one direction, lock it
|
|
4535
|
-
if (this.directionLocked === DirectionLock.Default && !this.freeScroll) {
|
|
4536
|
-
if (absDistX > absDistY + this.directionLockThreshold) {
|
|
4537
|
-
this.directionLocked = DirectionLock.Horizontal; // lock horizontally
|
|
4538
|
-
}
|
|
4539
|
-
else if (absDistY >= absDistX + this.directionLockThreshold) {
|
|
4540
|
-
this.directionLocked = DirectionLock.Vertical; // lock vertically
|
|
4541
|
-
}
|
|
4542
|
-
else {
|
|
4543
|
-
this.directionLocked = DirectionLock.None; // no lock
|
|
4544
|
-
}
|
|
4545
|
-
}
|
|
4546
|
-
};
|
|
4547
|
-
DirectionLockAction.prototype.handleEventPassthrough = function (e) {
|
|
4548
|
-
var handleMap = DirectionMap[this.directionLocked];
|
|
4549
|
-
if (handleMap) {
|
|
4550
|
-
if (this.eventPassthrough === handleMap[Passthrough.Yes]) {
|
|
4551
|
-
return PassthroughHandlers[Passthrough.Yes](e);
|
|
4552
|
-
}
|
|
4553
|
-
else if (this.eventPassthrough === handleMap[Passthrough.No]) {
|
|
4554
|
-
return PassthroughHandlers[Passthrough.No](e);
|
|
4555
|
-
}
|
|
4556
|
-
}
|
|
4557
|
-
return false;
|
|
4558
|
-
};
|
|
4559
|
-
return DirectionLockAction;
|
|
4560
|
-
}());
|
|
4561
|
-
|
|
4562
|
-
var ScrollerActions = /** @class */ (function () {
|
|
4563
|
-
function ScrollerActions(scrollBehaviorX, scrollBehaviorY, actionsHandler, animater, options) {
|
|
4564
|
-
this.hooks = new EventEmitter$1([
|
|
4565
|
-
'start',
|
|
4566
|
-
'beforeMove',
|
|
4567
|
-
'scrollStart',
|
|
4568
|
-
'scroll',
|
|
4569
|
-
'beforeEnd',
|
|
4570
|
-
'end',
|
|
4571
|
-
'scrollEnd'
|
|
4572
|
-
]);
|
|
4573
|
-
this.scrollBehaviorX = scrollBehaviorX;
|
|
4574
|
-
this.scrollBehaviorY = scrollBehaviorY;
|
|
4575
|
-
this.actionsHandler = actionsHandler;
|
|
4576
|
-
this.animater = animater;
|
|
4577
|
-
this.options = options;
|
|
4578
|
-
this.directionLockAction = new DirectionLockAction(options.directionLockThreshold, options.freeScroll, options.eventPassthrough);
|
|
4579
|
-
this.enabled = true;
|
|
4580
|
-
this.bindActionsHandler();
|
|
4581
|
-
}
|
|
4582
|
-
ScrollerActions.prototype.bindActionsHandler = function () {
|
|
4583
|
-
var _this = this;
|
|
4584
|
-
// [mouse|touch]start event
|
|
4585
|
-
this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start, function (e) {
|
|
4586
|
-
if (!_this.enabled)
|
|
4587
|
-
return true;
|
|
4588
|
-
return _this.handleStart(e);
|
|
4589
|
-
});
|
|
4590
|
-
// [mouse|touch]move event
|
|
4591
|
-
this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move, function (_a) {
|
|
4592
|
-
var deltaX = _a.deltaX, deltaY = _a.deltaY, e = _a.e;
|
|
4593
|
-
if (!_this.enabled)
|
|
4594
|
-
return true;
|
|
4595
|
-
return _this.handleMove(deltaX, deltaY, e);
|
|
4596
|
-
});
|
|
4597
|
-
// [mouse|touch]end event
|
|
4598
|
-
this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end, function (e) {
|
|
4599
|
-
if (!_this.enabled)
|
|
4600
|
-
return true;
|
|
4601
|
-
return _this.handleEnd(e);
|
|
4602
|
-
});
|
|
4603
|
-
// click
|
|
4604
|
-
this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click, function (e) {
|
|
4605
|
-
// handle native click event
|
|
4606
|
-
if (_this.enabled && !e._constructed) {
|
|
4607
|
-
_this.handleClick(e);
|
|
4608
|
-
}
|
|
4609
|
-
});
|
|
4610
|
-
};
|
|
4611
|
-
ScrollerActions.prototype.handleStart = function (e) {
|
|
4612
|
-
var timestamp = getNow();
|
|
4613
|
-
this.moved = false;
|
|
4614
|
-
this.startTime = timestamp;
|
|
4615
|
-
this.directionLockAction.reset();
|
|
4616
|
-
this.scrollBehaviorX.start();
|
|
4617
|
-
this.scrollBehaviorY.start();
|
|
4618
|
-
// force stopping last transition or animation
|
|
4619
|
-
this.animater.stop();
|
|
4620
|
-
this.scrollBehaviorX.resetStartPos();
|
|
4621
|
-
this.scrollBehaviorY.resetStartPos();
|
|
4622
|
-
this.hooks.trigger(this.hooks.eventTypes.start, e);
|
|
4623
|
-
};
|
|
4624
|
-
ScrollerActions.prototype.handleMove = function (deltaX, deltaY, e) {
|
|
4625
|
-
if (this.hooks.trigger(this.hooks.eventTypes.beforeMove, e)) {
|
|
4626
|
-
return;
|
|
4627
|
-
}
|
|
4628
|
-
var absDistX = this.scrollBehaviorX.getAbsDist(deltaX);
|
|
4629
|
-
var absDistY = this.scrollBehaviorY.getAbsDist(deltaY);
|
|
4630
|
-
var timestamp = getNow();
|
|
4631
|
-
// We need to move at least momentumLimitDistance pixels
|
|
4632
|
-
// for the scrolling to initiate
|
|
4633
|
-
if (this.checkMomentum(absDistX, absDistY, timestamp)) {
|
|
4634
|
-
return true;
|
|
4635
|
-
}
|
|
4636
|
-
if (this.directionLockAction.checkMovingDirection(absDistX, absDistY, e)) {
|
|
4637
|
-
this.actionsHandler.setInitiated();
|
|
4638
|
-
return true;
|
|
4639
|
-
}
|
|
4640
|
-
var delta = this.directionLockAction.adjustDelta(deltaX, deltaY);
|
|
4641
|
-
var newX = this.scrollBehaviorX.move(delta.deltaX);
|
|
4642
|
-
var newY = this.scrollBehaviorY.move(delta.deltaY);
|
|
4643
|
-
if (!this.moved) {
|
|
4644
|
-
this.moved = true;
|
|
4645
|
-
this.hooks.trigger(this.hooks.eventTypes.scrollStart);
|
|
4646
|
-
}
|
|
4647
|
-
this.animater.translate({
|
|
4648
|
-
x: newX,
|
|
4649
|
-
y: newY
|
|
4650
|
-
});
|
|
4651
|
-
this.dispatchScroll(timestamp);
|
|
4652
|
-
};
|
|
4653
|
-
ScrollerActions.prototype.dispatchScroll = function (timestamp) {
|
|
4654
|
-
// dispatch scroll in interval time
|
|
4655
|
-
if (timestamp - this.startTime > this.options.momentumLimitTime) {
|
|
4656
|
-
// refresh time and starting position to initiate a momentum
|
|
4657
|
-
this.startTime = timestamp;
|
|
4658
|
-
this.scrollBehaviorX.updateStartPos();
|
|
4659
|
-
this.scrollBehaviorY.updateStartPos();
|
|
4660
|
-
if (this.options.probeType === Probe.Throttle) {
|
|
4661
|
-
this.hooks.trigger(this.hooks.eventTypes.scroll, this.getCurrentPos());
|
|
4662
|
-
}
|
|
4663
|
-
}
|
|
4664
|
-
// dispatch scroll all the time
|
|
4665
|
-
if (this.options.probeType > Probe.Throttle) {
|
|
4666
|
-
this.hooks.trigger(this.hooks.eventTypes.scroll, this.getCurrentPos());
|
|
4667
|
-
}
|
|
4668
|
-
};
|
|
4669
|
-
ScrollerActions.prototype.checkMomentum = function (absDistX, absDistY, timestamp) {
|
|
4670
|
-
return (timestamp - this.endTime > this.options.momentumLimitTime &&
|
|
4671
|
-
absDistY < this.options.momentumLimitDistance &&
|
|
4672
|
-
absDistX < this.options.momentumLimitDistance);
|
|
4673
|
-
};
|
|
4674
|
-
ScrollerActions.prototype.handleEnd = function (e) {
|
|
4675
|
-
if (this.hooks.trigger(this.hooks.eventTypes.beforeEnd, e)) {
|
|
4676
|
-
return;
|
|
4677
|
-
}
|
|
4678
|
-
var currentPos = this.getCurrentPos();
|
|
4679
|
-
this.scrollBehaviorX.updateDirection();
|
|
4680
|
-
this.scrollBehaviorY.updateDirection();
|
|
4681
|
-
if (this.hooks.trigger(this.hooks.eventTypes.end, e, currentPos)) {
|
|
4682
|
-
return true;
|
|
4683
|
-
}
|
|
4684
|
-
this.animater.translate(currentPos);
|
|
4685
|
-
this.endTime = getNow();
|
|
4686
|
-
var duration = this.endTime - this.startTime;
|
|
4687
|
-
this.hooks.trigger(this.hooks.eventTypes.scrollEnd, currentPos, duration);
|
|
4688
|
-
};
|
|
4689
|
-
ScrollerActions.prototype.handleClick = function (e) {
|
|
4690
|
-
if (!preventDefaultExceptionFn$1(e.target, this.options.preventDefaultException)) {
|
|
4691
|
-
e.preventDefault();
|
|
4692
|
-
e.stopPropagation();
|
|
4693
|
-
}
|
|
4694
|
-
};
|
|
4695
|
-
ScrollerActions.prototype.getCurrentPos = function () {
|
|
4696
|
-
return {
|
|
4697
|
-
x: this.scrollBehaviorX.getCurrentPos(),
|
|
4698
|
-
y: this.scrollBehaviorY.getCurrentPos()
|
|
4699
|
-
};
|
|
4700
|
-
};
|
|
4701
|
-
ScrollerActions.prototype.refresh = function () {
|
|
4702
|
-
this.endTime = 0;
|
|
4703
|
-
};
|
|
4704
|
-
ScrollerActions.prototype.destroy = function () {
|
|
4705
|
-
this.hooks.destroy();
|
|
4706
|
-
};
|
|
4707
|
-
return ScrollerActions;
|
|
4708
|
-
}());
|
|
4709
|
-
|
|
4710
|
-
function createActionsHandlerOptions(bsOptions) {
|
|
4711
|
-
var options = [
|
|
4712
|
-
'click',
|
|
4713
|
-
'bindToWrapper',
|
|
4714
|
-
'preventDefault',
|
|
4715
|
-
'stopPropagation',
|
|
4716
|
-
'tagException',
|
|
4717
|
-
'preventDefaultException'
|
|
4718
|
-
].reduce(function (prev, cur) {
|
|
4719
|
-
prev[cur] = bsOptions[cur];
|
|
4720
|
-
return prev;
|
|
4721
|
-
}, {});
|
|
4722
|
-
return options;
|
|
4723
|
-
}
|
|
4724
|
-
function createBehaviorOptions(bsOptions, extraProp, bounces, rect) {
|
|
4725
|
-
var options = [
|
|
4726
|
-
'momentum',
|
|
4727
|
-
'momentumLimitTime',
|
|
4728
|
-
'momentumLimitDistance',
|
|
4729
|
-
'deceleration',
|
|
4730
|
-
'swipeBounceTime',
|
|
4731
|
-
'swipeTime'
|
|
4732
|
-
].reduce(function (prev, cur) {
|
|
4733
|
-
prev[cur] = bsOptions[cur];
|
|
4734
|
-
return prev;
|
|
4735
|
-
}, {});
|
|
4736
|
-
// add extra property
|
|
4737
|
-
options.scrollable = bsOptions[extraProp];
|
|
4738
|
-
options.bounces = bounces;
|
|
4739
|
-
options.rect = rect;
|
|
4740
|
-
return options;
|
|
4741
|
-
}
|
|
4742
|
-
|
|
4743
|
-
function bubbling(source, target, events) {
|
|
4744
|
-
events.forEach(function (event) {
|
|
4745
|
-
var sourceEvent;
|
|
4746
|
-
var targetEvent;
|
|
4747
|
-
if (typeof event === 'string') {
|
|
4748
|
-
sourceEvent = targetEvent = event;
|
|
4749
|
-
}
|
|
4750
|
-
else {
|
|
4751
|
-
sourceEvent = event.source;
|
|
4752
|
-
targetEvent = event.target;
|
|
4753
|
-
}
|
|
4754
|
-
source.on(sourceEvent, function () {
|
|
4755
|
-
var args = [];
|
|
4756
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4757
|
-
args[_i] = arguments[_i];
|
|
4758
|
-
}
|
|
4759
|
-
return target.trigger.apply(target, [targetEvent].concat(args));
|
|
4760
|
-
});
|
|
4761
|
-
});
|
|
4762
|
-
}
|
|
4763
|
-
|
|
4764
|
-
var Scroller = /** @class */ (function () {
|
|
4765
|
-
function Scroller(wrapper, options) {
|
|
4766
|
-
this.hooks = new EventEmitter$1([
|
|
4767
|
-
'beforeStart',
|
|
4768
|
-
'beforeMove',
|
|
4769
|
-
'beforeScrollStart',
|
|
4770
|
-
'scrollStart',
|
|
4771
|
-
'scroll',
|
|
4772
|
-
'beforeEnd',
|
|
4773
|
-
'scrollEnd',
|
|
4774
|
-
'refresh',
|
|
4775
|
-
'touchEnd',
|
|
4776
|
-
'end',
|
|
4777
|
-
'flick',
|
|
4778
|
-
'scrollCancel',
|
|
4779
|
-
'momentum',
|
|
4780
|
-
'scrollTo',
|
|
4781
|
-
'ignoreDisMoveForSamePos',
|
|
4782
|
-
'scrollToElement'
|
|
4783
|
-
]);
|
|
4784
|
-
this.wrapper = wrapper;
|
|
4785
|
-
this.content = wrapper.children[0];
|
|
4786
|
-
this.options = options;
|
|
4787
|
-
var _a = this
|
|
4788
|
-
.options.bounce, _b = _a.left, left = _b === void 0 ? true : _b, _c = _a.right, right = _c === void 0 ? true : _c, _d = _a.top, top = _d === void 0 ? true : _d, _e = _a.bottom, bottom = _e === void 0 ? true : _e;
|
|
4789
|
-
// direction X
|
|
4790
|
-
this.scrollBehaviorX = new Behavior(wrapper, createBehaviorOptions(options, 'scrollX', [left, right], {
|
|
4791
|
-
size: 'width',
|
|
4792
|
-
position: 'left'
|
|
4793
|
-
}));
|
|
4794
|
-
// direction Y
|
|
4795
|
-
this.scrollBehaviorY = new Behavior(wrapper, createBehaviorOptions(options, 'scrollY', [top, bottom], {
|
|
4796
|
-
size: 'height',
|
|
4797
|
-
position: 'top'
|
|
4798
|
-
}));
|
|
4799
|
-
this.translater = new Translater(this.content);
|
|
4800
|
-
this.animater = createAnimater(this.content, this.translater, this.options);
|
|
4801
|
-
this.actionsHandler = new ActionsHandler(wrapper, createActionsHandlerOptions(this.options));
|
|
4802
|
-
this.actions = new ScrollerActions(this.scrollBehaviorX, this.scrollBehaviorY, this.actionsHandler, this.animater, this.options);
|
|
4803
|
-
var resizeHandler = this.resize.bind(this);
|
|
4804
|
-
this.resizeRegister = new EventRegister$2(window, [
|
|
4805
|
-
{
|
|
4806
|
-
name: 'orientationchange',
|
|
4807
|
-
handler: resizeHandler
|
|
4808
|
-
},
|
|
4809
|
-
{
|
|
4810
|
-
name: 'resize',
|
|
4811
|
-
handler: resizeHandler
|
|
4812
|
-
}
|
|
4813
|
-
]);
|
|
4814
|
-
this.transitionEndRegister = new EventRegister$2(this.content, [
|
|
4815
|
-
{
|
|
4816
|
-
name: style$1.transitionEnd,
|
|
4817
|
-
handler: this.transitionEnd.bind(this)
|
|
4818
|
-
}
|
|
4819
|
-
]);
|
|
4820
|
-
this.init();
|
|
4821
|
-
}
|
|
4822
|
-
Scroller.prototype.init = function () {
|
|
4823
|
-
var _this = this;
|
|
4824
|
-
this.bindTranslater();
|
|
4825
|
-
this.bindAnimater();
|
|
4826
|
-
this.bindActions();
|
|
4827
|
-
// enable pointer events when scrolling ends
|
|
4828
|
-
this.hooks.on(this.hooks.eventTypes.scrollEnd, function () {
|
|
4829
|
-
_this.togglePointerEvents(true);
|
|
4830
|
-
});
|
|
4831
|
-
};
|
|
4832
|
-
Scroller.prototype.bindTranslater = function () {
|
|
4833
|
-
var _this = this;
|
|
4834
|
-
var hooks = this.translater.hooks;
|
|
4835
|
-
hooks.on(hooks.eventTypes.beforeTranslate, function (transformStyle) {
|
|
4836
|
-
if (_this.options.translateZ) {
|
|
4837
|
-
transformStyle.push(_this.options.translateZ);
|
|
4838
|
-
}
|
|
4839
|
-
});
|
|
4840
|
-
// disable pointer events when scrolling
|
|
4841
|
-
hooks.on(hooks.eventTypes.translate, function (pos) {
|
|
4842
|
-
_this.updatePositions(pos);
|
|
4843
|
-
_this.togglePointerEvents(false);
|
|
4844
|
-
});
|
|
4845
|
-
};
|
|
4846
|
-
Scroller.prototype.bindAnimater = function () {
|
|
4847
|
-
var _this = this;
|
|
4848
|
-
// reset position
|
|
4849
|
-
this.animater.hooks.on(this.animater.hooks.eventTypes.end, function (pos) {
|
|
4850
|
-
if (!_this.resetPosition(_this.options.bounceTime)) {
|
|
4851
|
-
_this.animater.setPending(false);
|
|
4852
|
-
_this.hooks.trigger(_this.hooks.eventTypes.scrollEnd, pos);
|
|
4853
|
-
}
|
|
4854
|
-
});
|
|
4855
|
-
bubbling(this.animater.hooks, this.hooks, [
|
|
4856
|
-
{
|
|
4857
|
-
source: this.animater.hooks.eventTypes.move,
|
|
4858
|
-
target: this.hooks.eventTypes.scroll
|
|
4859
|
-
},
|
|
4860
|
-
{
|
|
4861
|
-
source: this.animater.hooks.eventTypes.forceStop,
|
|
4862
|
-
target: this.hooks.eventTypes.scrollEnd
|
|
4863
|
-
}
|
|
4864
|
-
]);
|
|
4865
|
-
};
|
|
4866
|
-
Scroller.prototype.bindActions = function () {
|
|
4867
|
-
var _this = this;
|
|
4868
|
-
var actions = this.actions;
|
|
4869
|
-
bubbling(actions.hooks, this.hooks, [
|
|
4870
|
-
{
|
|
4871
|
-
source: actions.hooks.eventTypes.start,
|
|
4872
|
-
target: this.hooks.eventTypes.beforeStart
|
|
4873
|
-
},
|
|
4874
|
-
{
|
|
4875
|
-
source: actions.hooks.eventTypes.start,
|
|
4876
|
-
target: this.hooks.eventTypes.beforeScrollStart // just for event api
|
|
4877
|
-
},
|
|
4878
|
-
{
|
|
4879
|
-
source: actions.hooks.eventTypes.beforeMove,
|
|
4880
|
-
target: this.hooks.eventTypes.beforeMove
|
|
4881
|
-
},
|
|
4882
|
-
{
|
|
4883
|
-
source: actions.hooks.eventTypes.scrollStart,
|
|
4884
|
-
target: this.hooks.eventTypes.scrollStart
|
|
4885
|
-
},
|
|
4886
|
-
{
|
|
4887
|
-
source: actions.hooks.eventTypes.scroll,
|
|
4888
|
-
target: this.hooks.eventTypes.scroll
|
|
4889
|
-
},
|
|
4890
|
-
{
|
|
4891
|
-
source: actions.hooks.eventTypes.beforeEnd,
|
|
4892
|
-
target: this.hooks.eventTypes.beforeEnd
|
|
4893
|
-
}
|
|
4894
|
-
]);
|
|
4895
|
-
actions.hooks.on(actions.hooks.eventTypes.end, function (e, pos) {
|
|
4896
|
-
_this.hooks.trigger(_this.hooks.eventTypes.touchEnd, pos);
|
|
4897
|
-
if (_this.hooks.trigger(_this.hooks.eventTypes.end, pos)) {
|
|
4898
|
-
return true;
|
|
4899
|
-
}
|
|
4900
|
-
// check if it is a click operation
|
|
4901
|
-
if (!actions.moved && _this.checkClick(e)) {
|
|
4902
|
-
_this.animater.setForceStopped(false);
|
|
4903
|
-
_this.hooks.trigger(_this.hooks.eventTypes.scrollCancel);
|
|
4904
|
-
return true;
|
|
4905
|
-
}
|
|
4906
|
-
_this.animater.setForceStopped(false);
|
|
4907
|
-
// reset if we are outside of the boundaries
|
|
4908
|
-
if (_this.resetPosition(_this.options.bounceTime, ease.bounce)) {
|
|
4909
|
-
return true;
|
|
4910
|
-
}
|
|
4911
|
-
});
|
|
4912
|
-
actions.hooks.on(actions.hooks.eventTypes.scrollEnd, function (pos, duration) {
|
|
4913
|
-
var deltaX = Math.abs(pos.x - _this.scrollBehaviorX.startPos);
|
|
4914
|
-
var deltaY = Math.abs(pos.y - _this.scrollBehaviorY.startPos);
|
|
4915
|
-
if (_this.checkFlick(duration, deltaX, deltaY)) {
|
|
4916
|
-
_this.hooks.trigger(_this.hooks.eventTypes.flick);
|
|
4917
|
-
return;
|
|
4918
|
-
}
|
|
4919
|
-
if (_this.momentum(pos, duration)) {
|
|
4920
|
-
return;
|
|
4921
|
-
}
|
|
4922
|
-
_this.hooks.trigger(_this.hooks.eventTypes.scrollEnd, pos);
|
|
4923
|
-
});
|
|
4924
|
-
};
|
|
4925
|
-
Scroller.prototype.checkFlick = function (duration, deltaX, deltaY) {
|
|
4926
|
-
// flick
|
|
4927
|
-
if (this.hooks.events.flick.length > 1 &&
|
|
4928
|
-
duration < this.options.flickLimitTime &&
|
|
4929
|
-
deltaX < this.options.flickLimitDistance &&
|
|
4930
|
-
deltaY < this.options.flickLimitDistance) {
|
|
4931
|
-
return true;
|
|
4932
|
-
}
|
|
4933
|
-
};
|
|
4934
|
-
Scroller.prototype.momentum = function (pos, duration) {
|
|
4935
|
-
var meta = {
|
|
4936
|
-
time: 0,
|
|
4937
|
-
easing: ease.swiper,
|
|
4938
|
-
newX: pos.x,
|
|
4939
|
-
newY: pos.y
|
|
4940
|
-
};
|
|
4941
|
-
// start momentum animation if needed
|
|
4942
|
-
var momentumX = this.scrollBehaviorX.end(duration);
|
|
4943
|
-
var momentumY = this.scrollBehaviorY.end(duration);
|
|
4944
|
-
meta.newX = isUndef(momentumX.destination)
|
|
4945
|
-
? meta.newX
|
|
4946
|
-
: momentumX.destination;
|
|
4947
|
-
meta.newY = isUndef(momentumY.destination)
|
|
4948
|
-
? meta.newY
|
|
4949
|
-
: momentumY.destination;
|
|
4950
|
-
meta.time = Math.max(momentumX.duration, momentumY.duration);
|
|
4951
|
-
this.hooks.trigger(this.hooks.eventTypes.momentum, meta, this);
|
|
4952
|
-
// when x or y changed, do momentum animation now!
|
|
4953
|
-
if (meta.newX !== pos.x || meta.newY !== pos.y) {
|
|
4954
|
-
// change easing function when scroller goes out of the boundaries
|
|
4955
|
-
if (meta.newX > this.scrollBehaviorX.minScrollPos ||
|
|
4956
|
-
meta.newX < this.scrollBehaviorX.maxScrollPos ||
|
|
4957
|
-
meta.newY > this.scrollBehaviorY.minScrollPos ||
|
|
4958
|
-
meta.newY < this.scrollBehaviorY.maxScrollPos) {
|
|
4959
|
-
meta.easing = ease.swipeBounce;
|
|
4960
|
-
}
|
|
4961
|
-
this.scrollTo(meta.newX, meta.newY, meta.time, meta.easing);
|
|
4962
|
-
return true;
|
|
4963
|
-
}
|
|
4964
|
-
};
|
|
4965
|
-
Scroller.prototype.checkClick = function (e) {
|
|
4966
|
-
// when in the process of pulling down, it should not prevent click
|
|
4967
|
-
var cancelable = {
|
|
4968
|
-
preventClick: this.animater.forceStopped
|
|
4969
|
-
};
|
|
4970
|
-
// we scrolled less than momentumLimitDistance pixels
|
|
4971
|
-
if (this.hooks.trigger(this.hooks.eventTypes.checkClick))
|
|
4972
|
-
return true;
|
|
4973
|
-
if (!cancelable.preventClick) {
|
|
4974
|
-
var _dblclick = this.options.dblclick;
|
|
4975
|
-
var dblclickTrigged = false;
|
|
4976
|
-
if (_dblclick && this.lastClickTime) {
|
|
4977
|
-
var _a = _dblclick.delay, delay = _a === void 0 ? 300 : _a;
|
|
4978
|
-
if (getNow() - this.lastClickTime < delay) {
|
|
4979
|
-
dblclickTrigged = true;
|
|
4980
|
-
dblclick(e);
|
|
4981
|
-
}
|
|
4982
|
-
}
|
|
4983
|
-
if (this.options.tap) {
|
|
4984
|
-
tap(e, this.options.tap);
|
|
4985
|
-
}
|
|
4986
|
-
if (this.options.click &&
|
|
4987
|
-
!preventDefaultExceptionFn$1(e.target, this.options.preventDefaultException)) {
|
|
4988
|
-
click(e);
|
|
4989
|
-
}
|
|
4990
|
-
this.lastClickTime = dblclickTrigged ? null : getNow();
|
|
4991
|
-
return true;
|
|
4992
|
-
}
|
|
4993
|
-
return false;
|
|
4994
|
-
};
|
|
4995
|
-
Scroller.prototype.resize = function () {
|
|
4996
|
-
var _this = this;
|
|
4997
|
-
if (!this.actions.enabled) {
|
|
4998
|
-
return;
|
|
4999
|
-
}
|
|
5000
|
-
// fix a scroll problem under Android condition
|
|
5001
|
-
if (isAndroid) {
|
|
5002
|
-
this.wrapper.scrollTop = 0;
|
|
5003
|
-
}
|
|
5004
|
-
clearTimeout(this.resizeTimeout);
|
|
5005
|
-
this.resizeTimeout = window.setTimeout(function () {
|
|
5006
|
-
_this.refresh();
|
|
5007
|
-
}, this.options.resizePolling);
|
|
5008
|
-
};
|
|
5009
|
-
Scroller.prototype.transitionEnd = function (e) {
|
|
5010
|
-
if (e.target !== this.content || !this.animater.pending) {
|
|
5011
|
-
return;
|
|
5012
|
-
}
|
|
5013
|
-
var animater = this.animater;
|
|
5014
|
-
animater.transitionTime();
|
|
5015
|
-
if (!this.resetPosition(this.options.bounceTime, ease.bounce)) {
|
|
5016
|
-
this.animater.setPending(false);
|
|
5017
|
-
if (this.options.probeType !== Probe.Realtime) {
|
|
5018
|
-
this.hooks.trigger(this.hooks.eventTypes.scrollEnd, this.getCurrentPos());
|
|
5019
|
-
}
|
|
5020
|
-
}
|
|
5021
|
-
};
|
|
5022
|
-
Scroller.prototype.togglePointerEvents = function (enabled) {
|
|
5023
|
-
if (enabled === void 0) { enabled = true; }
|
|
5024
|
-
var el = this.content.children.length
|
|
5025
|
-
? this.content.children
|
|
5026
|
-
: [this.content];
|
|
5027
|
-
var pointerEvents = enabled ? 'auto' : 'none';
|
|
5028
|
-
for (var i = 0; i < el.length; i++) {
|
|
5029
|
-
el[i].style.pointerEvents = pointerEvents;
|
|
5030
|
-
}
|
|
5031
|
-
};
|
|
5032
|
-
Scroller.prototype.refresh = function () {
|
|
5033
|
-
this.scrollBehaviorX.refresh();
|
|
5034
|
-
this.scrollBehaviorY.refresh();
|
|
5035
|
-
this.actions.refresh();
|
|
5036
|
-
this.wrapperOffset = offset(this.wrapper);
|
|
5037
|
-
};
|
|
5038
|
-
Scroller.prototype.scrollBy = function (deltaX, deltaY, time, easing) {
|
|
5039
|
-
if (time === void 0) { time = 0; }
|
|
5040
|
-
var _a = this.getCurrentPos(), x = _a.x, y = _a.y;
|
|
5041
|
-
easing = !easing ? ease.bounce : easing;
|
|
5042
|
-
deltaX += x;
|
|
5043
|
-
deltaY += y;
|
|
5044
|
-
this.scrollTo(deltaX, deltaY, time, easing);
|
|
5045
|
-
};
|
|
5046
|
-
Scroller.prototype.scrollTo = function (x, y, time, easing, extraTransform, isSilent) {
|
|
5047
|
-
if (time === void 0) { time = 0; }
|
|
5048
|
-
if (extraTransform === void 0) { extraTransform = {
|
|
5049
|
-
start: {},
|
|
5050
|
-
end: {}
|
|
5051
|
-
}; }
|
|
5052
|
-
easing = !easing ? ease.bounce : easing;
|
|
5053
|
-
var easingFn = this.options.useTransition ? easing.style : easing.fn;
|
|
5054
|
-
var currentPos = this.getCurrentPos();
|
|
5055
|
-
var startPoint = __assign({ x: currentPos.x, y: currentPos.y }, extraTransform.start);
|
|
5056
|
-
var endPoint = __assign({ x: x,
|
|
5057
|
-
y: y }, extraTransform.end);
|
|
5058
|
-
this.hooks.trigger(this.hooks.eventTypes.scrollTo, endPoint);
|
|
5059
|
-
if (!this.hooks.trigger(this.hooks.eventTypes.ignoreDisMoveForSamePos)) {
|
|
5060
|
-
// it is an useless move
|
|
5061
|
-
if (startPoint.x === endPoint.x && startPoint.y === endPoint.y) {
|
|
5062
|
-
return;
|
|
5063
|
-
}
|
|
5064
|
-
}
|
|
5065
|
-
this.animater.move(startPoint, endPoint, time, easingFn, isSilent);
|
|
5066
|
-
};
|
|
5067
|
-
Scroller.prototype.scrollToElement = function (el, time, offsetX, offsetY, easing) {
|
|
5068
|
-
var targetEle = getElement(el);
|
|
5069
|
-
var pos = offset(targetEle);
|
|
5070
|
-
var getOffset = function (offset, size, wrapperSize) {
|
|
5071
|
-
if (typeof offset === 'number') {
|
|
5072
|
-
return offset;
|
|
5073
|
-
}
|
|
5074
|
-
// if offsetX/Y are true we center the element to the screen
|
|
5075
|
-
return offset ? Math.round(size / 2 - wrapperSize / 2) : 0;
|
|
5076
|
-
};
|
|
5077
|
-
offsetX = getOffset(offsetX, targetEle.offsetWidth, this.wrapper.offsetWidth);
|
|
5078
|
-
offsetY = getOffset(offsetY, targetEle.offsetHeight, this.wrapper.offsetHeight);
|
|
5079
|
-
var getPos = function (pos, wrapperPos, offset, scrollBehavior) {
|
|
5080
|
-
pos -= wrapperPos;
|
|
5081
|
-
pos = scrollBehavior.adjustPosition(pos - offset);
|
|
5082
|
-
return pos;
|
|
5083
|
-
};
|
|
5084
|
-
pos.left = getPos(pos.left, this.wrapperOffset.left, offsetX, this.scrollBehaviorX);
|
|
5085
|
-
pos.top = getPos(pos.top, this.wrapperOffset.top, offsetY, this.scrollBehaviorY);
|
|
5086
|
-
if (this.hooks.trigger(this.hooks.eventTypes.scrollToElement, targetEle, pos)) {
|
|
5087
|
-
return;
|
|
5088
|
-
}
|
|
5089
|
-
this.scrollTo(pos.left, pos.top, time, easing);
|
|
5090
|
-
};
|
|
5091
|
-
Scroller.prototype.resetPosition = function (time, easing) {
|
|
5092
|
-
if (time === void 0) { time = 0; }
|
|
5093
|
-
easing = !easing ? ease.bounce : easing;
|
|
5094
|
-
var _a = this.scrollBehaviorX.checkInBoundary(), x = _a.position, xInBoundary = _a.inBoundary;
|
|
5095
|
-
var _b = this.scrollBehaviorY.checkInBoundary(), y = _b.position, yInBoundary = _b.inBoundary;
|
|
5096
|
-
if (xInBoundary && yInBoundary) {
|
|
5097
|
-
return false;
|
|
5098
|
-
}
|
|
5099
|
-
// out of boundary
|
|
5100
|
-
this.scrollTo(x, y, time, easing);
|
|
5101
|
-
return true;
|
|
5102
|
-
};
|
|
5103
|
-
Scroller.prototype.updatePositions = function (pos) {
|
|
5104
|
-
this.scrollBehaviorX.updatePosition(pos.x);
|
|
5105
|
-
this.scrollBehaviorY.updatePosition(pos.y);
|
|
5106
|
-
};
|
|
5107
|
-
Scroller.prototype.getCurrentPos = function () {
|
|
5108
|
-
return this.actions.getCurrentPos();
|
|
5109
|
-
};
|
|
5110
|
-
Scroller.prototype.enable = function () {
|
|
5111
|
-
this.actions.enabled = true;
|
|
5112
|
-
};
|
|
5113
|
-
Scroller.prototype.disable = function () {
|
|
5114
|
-
cancelAnimationFrame(this.animater.timer);
|
|
5115
|
-
this.actions.enabled = false;
|
|
5116
|
-
};
|
|
5117
|
-
Scroller.prototype.destroy = function () {
|
|
5118
|
-
var _this = this;
|
|
5119
|
-
var keys = [
|
|
5120
|
-
'resizeRegister',
|
|
5121
|
-
'transitionEndRegister',
|
|
5122
|
-
'actionsHandler',
|
|
5123
|
-
'actions',
|
|
5124
|
-
'hooks',
|
|
5125
|
-
'animater',
|
|
5126
|
-
'translater',
|
|
5127
|
-
'scrollBehaviorX',
|
|
5128
|
-
'scrollBehaviorY'
|
|
5129
|
-
];
|
|
5130
|
-
keys.forEach(function (key) { return _this[key].destroy(); });
|
|
5131
|
-
};
|
|
5132
|
-
return Scroller;
|
|
5133
|
-
}());
|
|
5134
|
-
|
|
5135
|
-
var propertiesConfig = [
|
|
5136
|
-
{
|
|
5137
|
-
sourceKey: 'scroller.scrollBehaviorX.currentPos',
|
|
5138
|
-
key: 'x'
|
|
5139
|
-
},
|
|
5140
|
-
{
|
|
5141
|
-
sourceKey: 'scroller.scrollBehaviorY.currentPos',
|
|
5142
|
-
key: 'y'
|
|
5143
|
-
},
|
|
5144
|
-
{
|
|
5145
|
-
sourceKey: 'scroller.scrollBehaviorX.hasScroll',
|
|
5146
|
-
key: 'hasHorizontalScroll'
|
|
5147
|
-
},
|
|
5148
|
-
{
|
|
5149
|
-
sourceKey: 'scroller.scrollBehaviorY.hasScroll',
|
|
5150
|
-
key: 'hasVerticalScroll'
|
|
5151
|
-
},
|
|
5152
|
-
{
|
|
5153
|
-
sourceKey: 'scroller.scrollBehaviorX.contentSize',
|
|
5154
|
-
key: 'scrollerWidth'
|
|
5155
|
-
},
|
|
5156
|
-
{
|
|
5157
|
-
sourceKey: 'scroller.scrollBehaviorY.contentSize',
|
|
5158
|
-
key: 'scrollerHeight'
|
|
5159
|
-
},
|
|
5160
|
-
{
|
|
5161
|
-
sourceKey: 'scroller.scrollBehaviorX.maxScrollPos',
|
|
5162
|
-
key: 'maxScrollX'
|
|
5163
|
-
},
|
|
5164
|
-
{
|
|
5165
|
-
sourceKey: 'scroller.scrollBehaviorY.maxScrollPos',
|
|
5166
|
-
key: 'maxScrollY'
|
|
5167
|
-
},
|
|
5168
|
-
{
|
|
5169
|
-
sourceKey: 'scroller.scrollBehaviorX.minScrollPos',
|
|
5170
|
-
key: 'minScrollX'
|
|
5171
|
-
},
|
|
5172
|
-
{
|
|
5173
|
-
sourceKey: 'scroller.scrollBehaviorY.minScrollPos',
|
|
5174
|
-
key: 'minScrollY'
|
|
5175
|
-
},
|
|
5176
|
-
{
|
|
5177
|
-
sourceKey: 'scroller.scrollBehaviorX.movingDirection',
|
|
5178
|
-
key: 'movingDirectionX'
|
|
5179
|
-
},
|
|
5180
|
-
{
|
|
5181
|
-
sourceKey: 'scroller.scrollBehaviorY.movingDirection',
|
|
5182
|
-
key: 'movingDirectionY'
|
|
5183
|
-
},
|
|
5184
|
-
{
|
|
5185
|
-
sourceKey: 'scroller.scrollBehaviorX.direction',
|
|
5186
|
-
key: 'directionX'
|
|
5187
|
-
},
|
|
5188
|
-
{
|
|
5189
|
-
sourceKey: 'scroller.scrollBehaviorY.direction',
|
|
5190
|
-
key: 'directionY'
|
|
5191
|
-
},
|
|
5192
|
-
{
|
|
5193
|
-
sourceKey: 'scroller.actions.enabled',
|
|
5194
|
-
key: 'enabled'
|
|
5195
|
-
},
|
|
5196
|
-
{
|
|
5197
|
-
sourceKey: 'scroller.animater.pending',
|
|
5198
|
-
key: 'pending'
|
|
5199
|
-
},
|
|
5200
|
-
{
|
|
5201
|
-
sourceKey: 'scroller.scrollTo',
|
|
5202
|
-
key: 'scrollTo'
|
|
5203
|
-
},
|
|
5204
|
-
{
|
|
5205
|
-
sourceKey: 'scroller.scrollBy',
|
|
5206
|
-
key: 'scrollBy'
|
|
5207
|
-
},
|
|
5208
|
-
{
|
|
5209
|
-
sourceKey: 'scroller.scrollToElement',
|
|
5210
|
-
key: 'scrollToElement'
|
|
5211
|
-
},
|
|
5212
|
-
{
|
|
5213
|
-
sourceKey: 'scroller.resetPosition',
|
|
5214
|
-
key: 'resetPosition'
|
|
5215
|
-
}
|
|
5216
|
-
];
|
|
5217
|
-
|
|
5218
|
-
var EnforceOrder;
|
|
5219
|
-
(function (EnforceOrder) {
|
|
5220
|
-
EnforceOrder["Pre"] = "pre";
|
|
5221
|
-
EnforceOrder["Post"] = "post";
|
|
5222
|
-
})(EnforceOrder || (EnforceOrder = {}));
|
|
5223
|
-
|
|
5224
|
-
var BScroll = /** @class */ (function (_super) {
|
|
5225
|
-
__extends(BScroll, _super);
|
|
5226
|
-
function BScroll(el, options) {
|
|
5227
|
-
var _this = _super.call(this, [
|
|
5228
|
-
'refresh',
|
|
5229
|
-
'enable',
|
|
5230
|
-
'disable',
|
|
5231
|
-
'beforeScrollStart',
|
|
5232
|
-
'scrollStart',
|
|
5233
|
-
'scroll',
|
|
5234
|
-
'scrollEnd',
|
|
5235
|
-
'scrollCancel',
|
|
5236
|
-
'touchEnd',
|
|
5237
|
-
'flick',
|
|
5238
|
-
'destroy'
|
|
5239
|
-
]) || this;
|
|
5240
|
-
var wrapper = getElement(el);
|
|
5241
|
-
if (!wrapper) {
|
|
5242
|
-
warn$2('Can not resolve the wrapper DOM.');
|
|
5243
|
-
return _this;
|
|
5244
|
-
}
|
|
5245
|
-
var content = wrapper.children[0];
|
|
5246
|
-
if (!content) {
|
|
5247
|
-
warn$2('The wrapper need at least one child element to be scroller.');
|
|
5248
|
-
return _this;
|
|
5249
|
-
}
|
|
5250
|
-
_this.plugins = {};
|
|
5251
|
-
_this.options = new Options().merge(options).process();
|
|
5252
|
-
_this.hooks = new EventEmitter$1([
|
|
5253
|
-
'init',
|
|
5254
|
-
'refresh',
|
|
5255
|
-
'enable',
|
|
5256
|
-
'disable',
|
|
5257
|
-
'destroy'
|
|
5258
|
-
]);
|
|
5259
|
-
_this.init(wrapper);
|
|
5260
|
-
return _this;
|
|
5261
|
-
}
|
|
5262
|
-
BScroll.use = function (ctor) {
|
|
5263
|
-
var name = ctor.pluginName;
|
|
5264
|
-
var installed = this.plugins.some(function (plugin) { return ctor === plugin.ctor; });
|
|
5265
|
-
if (installed)
|
|
5266
|
-
return this;
|
|
5267
|
-
if (isUndef(name)) {
|
|
5268
|
-
warn$2("Plugin Class must specify plugin's name in static property by 'pluginName' field.");
|
|
5269
|
-
return this;
|
|
5270
|
-
}
|
|
5271
|
-
if (this.pluginsMap[name]) {
|
|
5272
|
-
warn$2("This plugin has been registered, maybe you need change plugin's name");
|
|
5273
|
-
return this;
|
|
5274
|
-
}
|
|
5275
|
-
this.pluginsMap[name] = true;
|
|
5276
|
-
this.plugins.push({
|
|
5277
|
-
name: name,
|
|
5278
|
-
enforce: ctor.enforce,
|
|
5279
|
-
ctor: ctor
|
|
5280
|
-
});
|
|
5281
|
-
return this;
|
|
5282
|
-
};
|
|
5283
|
-
BScroll.prototype.init = function (wrapper) {
|
|
5284
|
-
this.wrapper = wrapper;
|
|
5285
|
-
this.scroller = new Scroller(wrapper, this.options);
|
|
5286
|
-
this.eventBubbling();
|
|
5287
|
-
this.handleAutoBlur();
|
|
5288
|
-
this.innerRefresh();
|
|
5289
|
-
this.scroller.scrollTo(this.options.startX, this.options.startY);
|
|
5290
|
-
this.enable();
|
|
5291
|
-
this.proxy(propertiesConfig);
|
|
5292
|
-
this.applyPlugins();
|
|
5293
|
-
};
|
|
5294
|
-
BScroll.prototype.applyPlugins = function () {
|
|
5295
|
-
var _this = this;
|
|
5296
|
-
var options = this.options;
|
|
5297
|
-
this.constructor.plugins
|
|
5298
|
-
.sort(function (a, b) {
|
|
5299
|
-
var _a;
|
|
5300
|
-
var enforeOrderMap = (_a = {},
|
|
5301
|
-
_a[EnforceOrder.Pre] = -1,
|
|
5302
|
-
_a[EnforceOrder.Post] = 1,
|
|
5303
|
-
_a);
|
|
5304
|
-
var aOrder = a.enforce ? enforeOrderMap[a.enforce] : 0;
|
|
5305
|
-
var bOrder = b.enforce ? enforeOrderMap[b.enforce] : 0;
|
|
5306
|
-
return aOrder - bOrder;
|
|
5307
|
-
})
|
|
5308
|
-
.forEach(function (item) {
|
|
5309
|
-
var ctor = item.ctor;
|
|
5310
|
-
if (options[item.name] && typeof ctor === 'function') {
|
|
5311
|
-
_this.plugins[item.name] = new ctor(_this);
|
|
5312
|
-
}
|
|
5313
|
-
});
|
|
5314
|
-
};
|
|
5315
|
-
BScroll.prototype.handleAutoBlur = function () {
|
|
5316
|
-
if (this.options.autoBlur) {
|
|
5317
|
-
this.on(this.eventTypes.beforeScrollStart, function () {
|
|
5318
|
-
var activeElement = document.activeElement;
|
|
5319
|
-
if (activeElement &&
|
|
5320
|
-
(activeElement.tagName === 'INPUT' ||
|
|
5321
|
-
activeElement.tagName === 'TEXTAREA')) {
|
|
5322
|
-
activeElement.blur();
|
|
5323
|
-
}
|
|
5324
|
-
});
|
|
5325
|
-
}
|
|
5326
|
-
};
|
|
5327
|
-
BScroll.prototype.eventBubbling = function () {
|
|
5328
|
-
bubbling(this.scroller.hooks, this, [
|
|
5329
|
-
'beforeScrollStart',
|
|
5330
|
-
'scrollStart',
|
|
5331
|
-
'scroll',
|
|
5332
|
-
'scrollEnd',
|
|
5333
|
-
'scrollCancel',
|
|
5334
|
-
'touchEnd',
|
|
5335
|
-
'flick'
|
|
5336
|
-
]);
|
|
5337
|
-
};
|
|
5338
|
-
BScroll.prototype.innerRefresh = function () {
|
|
5339
|
-
this.scroller.refresh();
|
|
5340
|
-
this.hooks.trigger(this.hooks.eventTypes.refresh);
|
|
5341
|
-
this.trigger(this.eventTypes.refresh);
|
|
5342
|
-
};
|
|
5343
|
-
BScroll.prototype.proxy = function (propertiesConfig) {
|
|
5344
|
-
var _this = this;
|
|
5345
|
-
propertiesConfig.forEach(function (_a) {
|
|
5346
|
-
var key = _a.key, sourceKey = _a.sourceKey;
|
|
5347
|
-
propertiesProxy(_this, sourceKey, key);
|
|
5348
|
-
});
|
|
5349
|
-
};
|
|
5350
|
-
BScroll.prototype.refresh = function () {
|
|
5351
|
-
this.innerRefresh();
|
|
5352
|
-
this.scroller.resetPosition();
|
|
5353
|
-
};
|
|
5354
|
-
BScroll.prototype.enable = function () {
|
|
5355
|
-
this.scroller.enable();
|
|
5356
|
-
this.hooks.trigger(this.hooks.eventTypes.enable);
|
|
5357
|
-
this.trigger(this.eventTypes.enable);
|
|
5358
|
-
};
|
|
5359
|
-
BScroll.prototype.disable = function () {
|
|
5360
|
-
this.scroller.disable();
|
|
5361
|
-
this.hooks.trigger(this.hooks.eventTypes.disable);
|
|
5362
|
-
this.trigger(this.eventTypes.disable);
|
|
5363
|
-
};
|
|
5364
|
-
BScroll.prototype.destroy = function () {
|
|
5365
|
-
this.scroller.destroy();
|
|
5366
|
-
this.hooks.trigger(this.hooks.eventTypes.destroy);
|
|
5367
|
-
this.trigger(this.eventTypes.destroy);
|
|
5368
|
-
};
|
|
5369
|
-
BScroll.prototype.eventRegister = function (names) {
|
|
5370
|
-
this.registerType(names);
|
|
5371
|
-
};
|
|
5372
|
-
BScroll.version = '2.0.0';
|
|
5373
|
-
BScroll.plugins = [];
|
|
5374
|
-
BScroll.pluginsMap = {};
|
|
5375
|
-
return BScroll;
|
|
5376
|
-
}(EventEmitter$1));
|
|
5377
|
-
|
|
5378
|
-
/*!
|
|
5379
|
-
* better-scroll / scroll-bar
|
|
5380
|
-
* (c) 2016-2020 ustbhuangyi
|
|
5381
|
-
* Released under the MIT License.
|
|
5382
|
-
*/
|
|
5383
|
-
function warn$1(msg) {
|
|
5384
|
-
console.error("[BScroll warn]: " + msg);
|
|
5385
|
-
}
|
|
5386
|
-
|
|
5387
|
-
// ssr support
|
|
5388
|
-
var inBrowser$1 = typeof window !== 'undefined';
|
|
5389
|
-
var ua$1 = inBrowser$1 && navigator.userAgent.toLowerCase();
|
|
5390
|
-
!!(ua$1 && /wechatdevtools/.test(ua$1));
|
|
5391
|
-
ua$1 && ua$1.indexOf('android') > 0;
|
|
5392
|
-
((function () {
|
|
5393
|
-
if (typeof ua$1 === 'string') {
|
|
5394
|
-
var regex = /os (\d\d?_\d(_\d)?)/;
|
|
5395
|
-
var matches = regex.exec(ua$1);
|
|
5396
|
-
if (!matches)
|
|
5397
|
-
return false;
|
|
5398
|
-
var parts = matches[1].split('_').map(function (item) {
|
|
5399
|
-
return parseInt(item, 10);
|
|
5400
|
-
});
|
|
5401
|
-
// ios version >= 13.4 issue 982
|
|
5402
|
-
return !!(parts[0] >= 13 && parts[1] >= 4);
|
|
5403
|
-
}
|
|
5404
|
-
return false;
|
|
5405
|
-
}))();
|
|
5406
|
-
|
|
5407
|
-
var elementStyle$1 = (inBrowser$1 &&
|
|
5408
|
-
document.createElement('div').style);
|
|
5409
|
-
var vendor$1 = (function () {
|
|
5410
|
-
if (!inBrowser$1) {
|
|
5411
|
-
return false;
|
|
5412
|
-
}
|
|
5413
|
-
var transformNames = [
|
|
5414
|
-
{
|
|
5415
|
-
key: 'standard',
|
|
5416
|
-
value: 'transform',
|
|
5417
|
-
},
|
|
5418
|
-
{
|
|
5419
|
-
key: 'webkit',
|
|
5420
|
-
value: 'webkitTransform',
|
|
5421
|
-
},
|
|
5422
|
-
{
|
|
5423
|
-
key: 'Moz',
|
|
5424
|
-
value: 'MozTransform',
|
|
5425
|
-
},
|
|
5426
|
-
{
|
|
5427
|
-
key: 'O',
|
|
5428
|
-
value: 'OTransform',
|
|
5429
|
-
},
|
|
5430
|
-
{
|
|
5431
|
-
key: 'ms',
|
|
5432
|
-
value: 'msTransform',
|
|
5433
|
-
},
|
|
5434
|
-
];
|
|
5435
|
-
for (var _i = 0, transformNames_1 = transformNames; _i < transformNames_1.length; _i++) {
|
|
5436
|
-
var obj = transformNames_1[_i];
|
|
5437
|
-
if (elementStyle$1[obj.value] !== undefined) {
|
|
5438
|
-
return obj.key;
|
|
5439
|
-
}
|
|
5440
|
-
}
|
|
5441
|
-
return false;
|
|
5442
|
-
})();
|
|
5443
|
-
function prefixStyle$1(style) {
|
|
5444
|
-
if (vendor$1 === false) {
|
|
5445
|
-
return style;
|
|
5446
|
-
}
|
|
5447
|
-
if (vendor$1 === 'standard') {
|
|
5448
|
-
if (style === 'transitionEnd') {
|
|
5449
|
-
return 'transitionend';
|
|
5450
|
-
}
|
|
5451
|
-
return style;
|
|
5452
|
-
}
|
|
5453
|
-
return vendor$1 + style.charAt(0).toUpperCase() + style.substr(1);
|
|
5454
|
-
}
|
|
5455
|
-
function addEvent$1(el, type, fn, capture) {
|
|
5456
|
-
el.addEventListener(type, fn, {
|
|
5457
|
-
passive: false,
|
|
5458
|
-
capture: !!capture,
|
|
5459
|
-
});
|
|
5460
|
-
}
|
|
5461
|
-
function removeEvent$1(el, type, fn, capture) {
|
|
5462
|
-
el.removeEventListener(type, fn, {
|
|
5463
|
-
capture: !!capture,
|
|
5464
|
-
});
|
|
5465
|
-
}
|
|
5466
|
-
vendor$1 && vendor$1 !== 'standard' ? '-' + vendor$1.toLowerCase() + '-' : '';
|
|
5467
|
-
var transform$1 = prefixStyle$1('transform');
|
|
5468
|
-
var transition$1 = prefixStyle$1('transition');
|
|
5469
|
-
inBrowser$1 && prefixStyle$1('perspective') in elementStyle$1;
|
|
5470
|
-
var style = {
|
|
5471
|
-
transform: transform$1,
|
|
5472
|
-
transition: transition$1,
|
|
5473
|
-
transitionTimingFunction: prefixStyle$1('transitionTimingFunction'),
|
|
5474
|
-
transitionDuration: prefixStyle$1('transitionDuration'),
|
|
5475
|
-
transitionDelay: prefixStyle$1('transitionDelay'),
|
|
5476
|
-
transformOrigin: prefixStyle$1('transformOrigin'),
|
|
5477
|
-
transitionEnd: prefixStyle$1('transitionEnd'),
|
|
5478
|
-
transitionProperty: prefixStyle$1('transitionProperty'),
|
|
5479
|
-
};
|
|
5480
|
-
|
|
5481
|
-
/*! *****************************************************************************
|
|
5482
|
-
Copyright (c) Microsoft Corporation.
|
|
5483
|
-
|
|
5484
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
5485
|
-
purpose with or without fee is hereby granted.
|
|
5486
|
-
|
|
5487
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
5488
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
5489
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
5490
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
5491
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
5492
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
5493
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
5494
|
-
***************************************************************************** */
|
|
5495
|
-
|
|
5496
|
-
function __spreadArrays() {
|
|
5497
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
5498
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
5499
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
5500
|
-
r[k] = a[j];
|
|
5501
|
-
return r;
|
|
5502
|
-
}
|
|
5503
|
-
|
|
5504
|
-
var EventEmitter = /** @class */ (function () {
|
|
5505
|
-
function EventEmitter(names) {
|
|
5506
|
-
this.events = {};
|
|
5507
|
-
this.eventTypes = {};
|
|
5508
|
-
this.registerType(names);
|
|
5509
|
-
}
|
|
5510
|
-
EventEmitter.prototype.on = function (type, fn, context) {
|
|
5511
|
-
if (context === void 0) { context = this; }
|
|
5512
|
-
this.hasType(type);
|
|
5513
|
-
if (!this.events[type]) {
|
|
5514
|
-
this.events[type] = [];
|
|
5515
|
-
}
|
|
5516
|
-
this.events[type].push([fn, context]);
|
|
5517
|
-
return this;
|
|
5518
|
-
};
|
|
5519
|
-
EventEmitter.prototype.once = function (type, fn, context) {
|
|
5520
|
-
var _this = this;
|
|
5521
|
-
if (context === void 0) { context = this; }
|
|
5522
|
-
this.hasType(type);
|
|
5523
|
-
var magic = function () {
|
|
5524
|
-
var args = [];
|
|
5525
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5526
|
-
args[_i] = arguments[_i];
|
|
5527
|
-
}
|
|
5528
|
-
_this.off(type, magic);
|
|
5529
|
-
fn.apply(context, args);
|
|
5530
|
-
};
|
|
5531
|
-
magic.fn = fn;
|
|
5532
|
-
this.on(type, magic);
|
|
5533
|
-
return this;
|
|
5534
|
-
};
|
|
5535
|
-
EventEmitter.prototype.off = function (type, fn) {
|
|
5536
|
-
if (!type && !fn) {
|
|
5537
|
-
this.events = {};
|
|
5538
|
-
return this;
|
|
5539
|
-
}
|
|
5540
|
-
if (type) {
|
|
5541
|
-
this.hasType(type);
|
|
5542
|
-
if (!fn) {
|
|
5543
|
-
this.events[type] = [];
|
|
5544
|
-
return this;
|
|
5545
|
-
}
|
|
5546
|
-
var events = this.events[type];
|
|
5547
|
-
if (!events) {
|
|
5548
|
-
return this;
|
|
5549
|
-
}
|
|
5550
|
-
var count = events.length;
|
|
5551
|
-
while (count--) {
|
|
5552
|
-
if (events[count][0] === fn ||
|
|
5553
|
-
(events[count][0] && events[count][0].fn === fn)) {
|
|
5554
|
-
events.splice(count, 1);
|
|
5555
|
-
}
|
|
5556
|
-
}
|
|
5557
|
-
return this;
|
|
5558
|
-
}
|
|
5559
|
-
};
|
|
5560
|
-
EventEmitter.prototype.trigger = function (type) {
|
|
5561
|
-
var args = [];
|
|
5562
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
5563
|
-
args[_i - 1] = arguments[_i];
|
|
5564
|
-
}
|
|
5565
|
-
this.hasType(type);
|
|
5566
|
-
var events = this.events[type];
|
|
5567
|
-
if (!events) {
|
|
5568
|
-
return;
|
|
5569
|
-
}
|
|
5570
|
-
var len = events.length;
|
|
5571
|
-
var eventsCopy = __spreadArrays(events);
|
|
5572
|
-
var ret;
|
|
5573
|
-
for (var i = 0; i < len; i++) {
|
|
5574
|
-
var event_1 = eventsCopy[i];
|
|
5575
|
-
var fn = event_1[0], context = event_1[1];
|
|
5576
|
-
if (fn) {
|
|
5577
|
-
ret = fn.apply(context, args);
|
|
5578
|
-
if (ret === true) {
|
|
5579
|
-
return ret;
|
|
5580
|
-
}
|
|
5581
|
-
}
|
|
5582
|
-
}
|
|
5583
|
-
};
|
|
5584
|
-
EventEmitter.prototype.registerType = function (names) {
|
|
5585
|
-
var _this = this;
|
|
5586
|
-
names.forEach(function (type) {
|
|
5587
|
-
_this.eventTypes[type] = type;
|
|
5588
|
-
});
|
|
5589
|
-
};
|
|
5590
|
-
EventEmitter.prototype.destroy = function () {
|
|
5591
|
-
this.events = {};
|
|
5592
|
-
this.eventTypes = {};
|
|
5593
|
-
};
|
|
5594
|
-
EventEmitter.prototype.hasType = function (type) {
|
|
5595
|
-
var types = this.eventTypes;
|
|
5596
|
-
var isType = types[type] === type;
|
|
5597
|
-
if (!isType) {
|
|
5598
|
-
warn$1("EventEmitter has used unknown event type: \"" + type + "\", should be oneof [" +
|
|
5599
|
-
("" + Object.keys(types).map(function (_) { return JSON.stringify(_); })) +
|
|
5600
|
-
"]");
|
|
5601
|
-
}
|
|
5602
|
-
};
|
|
5603
|
-
return EventEmitter;
|
|
5604
|
-
}());
|
|
5605
|
-
var EventRegister$1 = /** @class */ (function () {
|
|
5606
|
-
function EventRegister(wrapper, events) {
|
|
5607
|
-
this.wrapper = wrapper;
|
|
5608
|
-
this.events = events;
|
|
5609
|
-
this.addDOMEvents();
|
|
5610
|
-
}
|
|
5611
|
-
EventRegister.prototype.destroy = function () {
|
|
5612
|
-
this.removeDOMEvents();
|
|
5613
|
-
this.events = [];
|
|
5614
|
-
};
|
|
5615
|
-
EventRegister.prototype.addDOMEvents = function () {
|
|
5616
|
-
this.handleDOMEvents(addEvent$1);
|
|
5617
|
-
};
|
|
5618
|
-
EventRegister.prototype.removeDOMEvents = function () {
|
|
5619
|
-
this.handleDOMEvents(removeEvent$1);
|
|
5620
|
-
};
|
|
5621
|
-
EventRegister.prototype.handleDOMEvents = function (eventOperation) {
|
|
5622
|
-
var _this = this;
|
|
5623
|
-
var wrapper = this.wrapper;
|
|
5624
|
-
this.events.forEach(function (event) {
|
|
5625
|
-
eventOperation(wrapper, event.name, _this, !!event.capture);
|
|
5626
|
-
});
|
|
5627
|
-
};
|
|
5628
|
-
EventRegister.prototype.handleEvent = function (e) {
|
|
5629
|
-
var eventType = e.type;
|
|
5630
|
-
this.events.some(function (event) {
|
|
5631
|
-
if (event.name === eventType) {
|
|
5632
|
-
event.handler(e);
|
|
5633
|
-
return true;
|
|
5634
|
-
}
|
|
5635
|
-
return false;
|
|
5636
|
-
});
|
|
5637
|
-
};
|
|
5638
|
-
return EventRegister;
|
|
5639
|
-
}());
|
|
5640
|
-
|
|
5641
|
-
var EventHandler = /** @class */ (function () {
|
|
5642
|
-
function EventHandler(indicator, options) {
|
|
5643
|
-
this.indicator = indicator;
|
|
5644
|
-
this.options = options;
|
|
5645
|
-
this.bscroll = indicator.bscroll;
|
|
5646
|
-
this.startEventRegister = new EventRegister$1(this.indicator.el, [
|
|
5647
|
-
{
|
|
5648
|
-
name: options.disableMouse ? 'touchstart' : 'mousedown',
|
|
5649
|
-
handler: this._start.bind(this)
|
|
5650
|
-
}
|
|
5651
|
-
]);
|
|
5652
|
-
this.endEventRegister = new EventRegister$1(window, [
|
|
5653
|
-
{
|
|
5654
|
-
name: options.disableMouse ? 'touchend' : 'mouseup',
|
|
5655
|
-
handler: this._end.bind(this)
|
|
5656
|
-
}
|
|
5657
|
-
]);
|
|
5658
|
-
this.hooks = new EventEmitter(['touchStart', 'touchMove', 'touchEnd']);
|
|
5659
|
-
}
|
|
5660
|
-
EventHandler.prototype._start = function (e) {
|
|
5661
|
-
if (!this.bscroll.scroller.actions.enabled) {
|
|
5662
|
-
return;
|
|
5663
|
-
}
|
|
5664
|
-
var point = (e.touches ? e.touches[0] : e);
|
|
5665
|
-
e.preventDefault();
|
|
5666
|
-
e.stopPropagation();
|
|
5667
|
-
this.initiated = true;
|
|
5668
|
-
this.moved = false;
|
|
5669
|
-
this.lastPoint = point[this.indicator.keysMap.pointPos];
|
|
5670
|
-
var disableMouse = this.bscroll.options.disableMouse;
|
|
5671
|
-
this.moveEventRegister = new EventRegister$1(window, [
|
|
5672
|
-
{
|
|
5673
|
-
name: disableMouse ? 'touchmove' : 'mousemove',
|
|
5674
|
-
handler: this._move.bind(this)
|
|
5675
|
-
}
|
|
5676
|
-
]);
|
|
5677
|
-
this.hooks.trigger('touchStart');
|
|
5678
|
-
};
|
|
5679
|
-
EventHandler.prototype._move = function (e) {
|
|
5680
|
-
var point = (e.touches ? e.touches[0] : e);
|
|
5681
|
-
var pointPos = point[this.indicator.keysMap.pointPos];
|
|
5682
|
-
e.preventDefault();
|
|
5683
|
-
e.stopPropagation();
|
|
5684
|
-
var delta = pointPos - this.lastPoint;
|
|
5685
|
-
this.lastPoint = pointPos;
|
|
5686
|
-
if (!this.moved) {
|
|
5687
|
-
this.hooks.trigger('touchMove', this.moved, delta);
|
|
5688
|
-
this.moved = true;
|
|
5689
|
-
return;
|
|
5690
|
-
}
|
|
5691
|
-
this.hooks.trigger('touchMove', this.moved, delta);
|
|
5692
|
-
};
|
|
5693
|
-
EventHandler.prototype._end = function (e) {
|
|
5694
|
-
if (!this.initiated) {
|
|
5695
|
-
return;
|
|
5696
|
-
}
|
|
5697
|
-
this.initiated = false;
|
|
5698
|
-
e.preventDefault();
|
|
5699
|
-
e.stopPropagation();
|
|
5700
|
-
this.moveEventRegister.destroy();
|
|
5701
|
-
this.hooks.trigger('touchEnd', this.moved);
|
|
5702
|
-
};
|
|
5703
|
-
EventHandler.prototype.destroy = function () {
|
|
5704
|
-
this.startEventRegister.destroy();
|
|
5705
|
-
this.moveEventRegister && this.moveEventRegister.destroy();
|
|
5706
|
-
this.endEventRegister.destroy();
|
|
5707
|
-
};
|
|
5708
|
-
return EventHandler;
|
|
5709
|
-
}());
|
|
5710
|
-
|
|
5711
|
-
var INDICATOR_MIN_LEN = 8;
|
|
5712
|
-
var Indicator = /** @class */ (function () {
|
|
5713
|
-
function Indicator(bscroll, options) {
|
|
5714
|
-
this.bscroll = bscroll;
|
|
5715
|
-
this.options = options;
|
|
5716
|
-
this.keyVals = {
|
|
5717
|
-
sizeRatio: 1,
|
|
5718
|
-
maxPos: 0,
|
|
5719
|
-
initialSize: 0
|
|
5720
|
-
};
|
|
5721
|
-
this.curPos = 0;
|
|
5722
|
-
this.hooksHandlers = [];
|
|
5723
|
-
this.wrapper = options.wrapper;
|
|
5724
|
-
this.wrapperStyle = this.wrapper.style;
|
|
5725
|
-
this.el = this.wrapper.children[0];
|
|
5726
|
-
this.elStyle = this.el.style;
|
|
5727
|
-
this.bscroll = bscroll;
|
|
5728
|
-
this.direction = options.direction;
|
|
5729
|
-
this.keysMap = this._getKeysMap();
|
|
5730
|
-
if (options.fade) {
|
|
5731
|
-
this.visible = 0;
|
|
5732
|
-
this.wrapperStyle.opacity = '0';
|
|
5733
|
-
}
|
|
5734
|
-
else {
|
|
5735
|
-
this.visible = 1;
|
|
5736
|
-
}
|
|
5737
|
-
this._listenHooks(options.fade, options.interactive);
|
|
5738
|
-
this.refresh();
|
|
5739
|
-
}
|
|
5740
|
-
Indicator.prototype._listenHooks = function (fade, interactive) {
|
|
5741
|
-
var _this = this;
|
|
5742
|
-
var bscroll = this.bscroll;
|
|
5743
|
-
var bscrollHooks = bscroll;
|
|
5744
|
-
var translaterHooks = bscroll.scroller.translater.hooks;
|
|
5745
|
-
var animaterHooks = bscroll.scroller.animater.hooks;
|
|
5746
|
-
this._listen(bscrollHooks, 'refresh', this.refresh);
|
|
5747
|
-
this._listen(translaterHooks, 'translate', this.updatePosAndSize);
|
|
5748
|
-
this._listen(animaterHooks, 'time', function (time) {
|
|
5749
|
-
_this.setTransitionTime(time);
|
|
5750
|
-
});
|
|
5751
|
-
this._listen(animaterHooks, 'timeFunction', function (ease) {
|
|
5752
|
-
_this.setTransitionTimingFunction(ease);
|
|
5753
|
-
});
|
|
5754
|
-
if (fade) {
|
|
5755
|
-
this._listen(bscrollHooks, 'scrollEnd', function () {
|
|
5756
|
-
_this.fade();
|
|
5757
|
-
});
|
|
5758
|
-
this._listen(bscrollHooks, 'scrollStart', function () {
|
|
5759
|
-
_this.fade(true);
|
|
5760
|
-
});
|
|
5761
|
-
// for mousewheel event
|
|
5762
|
-
if (bscroll.eventTypes.mousewheelStart &&
|
|
5763
|
-
bscroll.eventTypes.mousewheelEnd) {
|
|
5764
|
-
this._listen(bscrollHooks, 'mousewheelStart', function () {
|
|
5765
|
-
_this.fade(true);
|
|
5766
|
-
});
|
|
5767
|
-
this._listen(bscrollHooks, 'mousewheelEnd', function () {
|
|
5768
|
-
_this.fade();
|
|
5769
|
-
});
|
|
5770
|
-
}
|
|
5771
|
-
}
|
|
5772
|
-
if (interactive) {
|
|
5773
|
-
var disableMouse = this.bscroll.options.disableMouse;
|
|
5774
|
-
this.eventHandler = new EventHandler(this, { disableMouse: disableMouse });
|
|
5775
|
-
var eventHandlerHooks = this.eventHandler.hooks;
|
|
5776
|
-
this._listen(eventHandlerHooks, 'touchStart', this.startHandler);
|
|
5777
|
-
this._listen(eventHandlerHooks, 'touchMove', this.moveHandler);
|
|
5778
|
-
this._listen(eventHandlerHooks, 'touchEnd', this.endHandler);
|
|
5779
|
-
}
|
|
5780
|
-
};
|
|
5781
|
-
Indicator.prototype._getKeysMap = function () {
|
|
5782
|
-
if (this.direction === "vertical" /* Vertical */) {
|
|
5783
|
-
return {
|
|
5784
|
-
hasScroll: 'hasVerticalScroll',
|
|
5785
|
-
size: 'height',
|
|
5786
|
-
wrapperSize: 'clientHeight',
|
|
5787
|
-
scrollerSize: 'scrollerHeight',
|
|
5788
|
-
maxScroll: 'maxScrollY',
|
|
5789
|
-
pos: 'y',
|
|
5790
|
-
pointPos: 'pageY',
|
|
5791
|
-
translate: 'translateY'
|
|
5792
|
-
};
|
|
5793
|
-
}
|
|
5794
|
-
return {
|
|
5795
|
-
hasScroll: 'hasHorizontalScroll',
|
|
5796
|
-
size: 'width',
|
|
5797
|
-
wrapperSize: 'clientWidth',
|
|
5798
|
-
scrollerSize: 'scrollerWidth',
|
|
5799
|
-
maxScroll: 'maxScrollX',
|
|
5800
|
-
pos: 'x',
|
|
5801
|
-
pointPos: 'pageX',
|
|
5802
|
-
translate: 'translateX'
|
|
5803
|
-
};
|
|
5804
|
-
};
|
|
5805
|
-
Indicator.prototype.fade = function (visible) {
|
|
5806
|
-
var time = visible ? 250 : 500;
|
|
5807
|
-
this.wrapperStyle[style.transitionDuration] = time + 'ms';
|
|
5808
|
-
this.wrapperStyle.opacity = visible ? '1' : '0';
|
|
5809
|
-
this.visible = visible ? 1 : 0;
|
|
5810
|
-
};
|
|
5811
|
-
Indicator.prototype.refresh = function () {
|
|
5812
|
-
var hasScroll = this.keysMap.hasScroll;
|
|
5813
|
-
if (this._setShowBy(this.bscroll[hasScroll])) {
|
|
5814
|
-
var _a = this.keysMap, wrapperSize = _a.wrapperSize, scrollerSize = _a.scrollerSize, maxScroll = _a.maxScroll;
|
|
5815
|
-
this.keyVals = this._refreshKeyValues(this.wrapper[wrapperSize], this.bscroll[scrollerSize], this.bscroll[maxScroll]);
|
|
5816
|
-
this.updatePosAndSize({
|
|
5817
|
-
x: this.bscroll.x,
|
|
5818
|
-
y: this.bscroll.y
|
|
5819
|
-
});
|
|
5820
|
-
}
|
|
5821
|
-
};
|
|
5822
|
-
Indicator.prototype._setShowBy = function (hasScroll) {
|
|
5823
|
-
if (hasScroll) {
|
|
5824
|
-
this.wrapper.style.display = '';
|
|
5825
|
-
return true;
|
|
5826
|
-
}
|
|
5827
|
-
this.wrapper.style.display = 'none';
|
|
5828
|
-
return false;
|
|
5829
|
-
};
|
|
5830
|
-
Indicator.prototype._refreshKeyValues = function (wrapperSize, scrollerSize, maxScroll) {
|
|
5831
|
-
var initialSize = Math.max(Math.round((wrapperSize * wrapperSize) / (scrollerSize || wrapperSize || 1)), INDICATOR_MIN_LEN);
|
|
5832
|
-
var maxPos = wrapperSize - initialSize;
|
|
5833
|
-
// sizeRatio is negative
|
|
5834
|
-
var sizeRatio = maxPos / maxScroll;
|
|
5835
|
-
return {
|
|
5836
|
-
initialSize: initialSize,
|
|
5837
|
-
maxPos: maxPos,
|
|
5838
|
-
sizeRatio: sizeRatio
|
|
5839
|
-
};
|
|
5840
|
-
};
|
|
5841
|
-
Indicator.prototype.updatePosAndSize = function (endPoint) {
|
|
5842
|
-
var _a = this._refreshPosAndSizeValue(endPoint, this.keyVals), pos = _a.pos, size = _a.size;
|
|
5843
|
-
this.curPos = pos;
|
|
5844
|
-
this._refreshPosAndSizeStyle(size, pos);
|
|
5845
|
-
};
|
|
5846
|
-
Indicator.prototype._refreshPosAndSizeValue = function (endPoint, keyVals) {
|
|
5847
|
-
var posKey = this.keysMap.pos;
|
|
5848
|
-
var sizeRatio = keyVals.sizeRatio, initialSize = keyVals.initialSize, maxPos = keyVals.maxPos;
|
|
5849
|
-
var pos = Math.round(sizeRatio * endPoint[posKey]);
|
|
5850
|
-
var size;
|
|
5851
|
-
if (pos < 0) {
|
|
5852
|
-
size = Math.max(initialSize + pos * 3, INDICATOR_MIN_LEN);
|
|
5853
|
-
pos = 0;
|
|
5854
|
-
}
|
|
5855
|
-
else if (pos > maxPos) {
|
|
5856
|
-
size = Math.max(initialSize - (pos - maxPos) * 3, INDICATOR_MIN_LEN);
|
|
5857
|
-
pos = maxPos + initialSize - size;
|
|
5858
|
-
}
|
|
5859
|
-
else {
|
|
5860
|
-
size = initialSize;
|
|
5861
|
-
}
|
|
5862
|
-
return {
|
|
5863
|
-
pos: pos,
|
|
5864
|
-
size: size
|
|
5865
|
-
};
|
|
5866
|
-
};
|
|
5867
|
-
Indicator.prototype._refreshPosAndSizeStyle = function (size, pos) {
|
|
5868
|
-
var _a = this.keysMap, translate = _a.translate, sizeKey = _a.size;
|
|
5869
|
-
this.elStyle[sizeKey] = size + "px";
|
|
5870
|
-
this.elStyle[style.transform] = translate + "(" + pos + "px)" + this.bscroll.options.translateZ;
|
|
5871
|
-
};
|
|
5872
|
-
Indicator.prototype.setTransitionTime = function (time) {
|
|
5873
|
-
if (time === void 0) { time = 0; }
|
|
5874
|
-
this.elStyle[style.transitionDuration] = time + 'ms';
|
|
5875
|
-
};
|
|
5876
|
-
Indicator.prototype.setTransitionTimingFunction = function (easing) {
|
|
5877
|
-
this.elStyle[style.transitionTimingFunction] = easing;
|
|
5878
|
-
};
|
|
5879
|
-
Indicator.prototype.startHandler = function () {
|
|
5880
|
-
this.setTransitionTime();
|
|
5881
|
-
this.bscroll.trigger('beforeScrollStart');
|
|
5882
|
-
};
|
|
5883
|
-
Indicator.prototype.moveHandler = function (moved, delta) {
|
|
5884
|
-
if (!moved) {
|
|
5885
|
-
this.bscroll.trigger('scrollStart');
|
|
5886
|
-
}
|
|
5887
|
-
var newScrollPos = this._calScrollDesPos(this.curPos, delta, this.keyVals);
|
|
5888
|
-
// TODO freeScroll ?
|
|
5889
|
-
if (this.direction === "vertical" /* Vertical */) {
|
|
5890
|
-
this.bscroll.scrollTo(this.bscroll.x, newScrollPos);
|
|
5891
|
-
}
|
|
5892
|
-
else {
|
|
5893
|
-
this.bscroll.scrollTo(newScrollPos, this.bscroll.y);
|
|
5894
|
-
}
|
|
5895
|
-
this.bscroll.trigger('scroll', {
|
|
5896
|
-
x: this.bscroll.x,
|
|
5897
|
-
y: this.bscroll.y
|
|
5898
|
-
});
|
|
5899
|
-
};
|
|
5900
|
-
Indicator.prototype._calScrollDesPos = function (curPos, delta, keyVals) {
|
|
5901
|
-
var maxPos = keyVals.maxPos, sizeRatio = keyVals.sizeRatio;
|
|
5902
|
-
var newPos = curPos + delta;
|
|
5903
|
-
if (newPos < 0) {
|
|
5904
|
-
newPos = 0;
|
|
5905
|
-
}
|
|
5906
|
-
else if (newPos > maxPos) {
|
|
5907
|
-
newPos = maxPos;
|
|
5908
|
-
}
|
|
5909
|
-
return Math.round(newPos / sizeRatio);
|
|
5910
|
-
};
|
|
5911
|
-
Indicator.prototype.endHandler = function (moved) {
|
|
5912
|
-
if (moved) {
|
|
5913
|
-
this.bscroll.trigger('scrollEnd', {
|
|
5914
|
-
x: this.bscroll.x,
|
|
5915
|
-
y: this.bscroll.y
|
|
5916
|
-
});
|
|
5917
|
-
}
|
|
5918
|
-
};
|
|
5919
|
-
Indicator.prototype.destroy = function () {
|
|
5920
|
-
if (this.options.interactive) {
|
|
5921
|
-
this.eventHandler.destroy();
|
|
5922
|
-
}
|
|
5923
|
-
this.wrapper.parentNode.removeChild(this.wrapper);
|
|
5924
|
-
this.hooksHandlers.forEach(function (item) {
|
|
5925
|
-
var hooks = item[0];
|
|
5926
|
-
var hooksName = item[1];
|
|
5927
|
-
var handlerFn = item[2];
|
|
5928
|
-
hooks.off(hooksName, handlerFn);
|
|
5929
|
-
});
|
|
5930
|
-
this.hooksHandlers.length = 0;
|
|
5931
|
-
};
|
|
5932
|
-
Indicator.prototype._listen = function (hooks, name, handler) {
|
|
5933
|
-
hooks.on(name, handler, this);
|
|
5934
|
-
this.hooksHandlers.push([hooks, name, handler]);
|
|
5935
|
-
};
|
|
5936
|
-
return Indicator;
|
|
5937
|
-
}());
|
|
5938
|
-
|
|
5939
|
-
var ScrollBar = /** @class */ (function () {
|
|
5940
|
-
function ScrollBar(scroll) {
|
|
5941
|
-
this.indicators = [];
|
|
5942
|
-
this.indicators = this.createIndicators(scroll);
|
|
5943
|
-
scroll.on(scroll.eventTypes.destroy, this.destroy, this);
|
|
5944
|
-
}
|
|
5945
|
-
ScrollBar.prototype.createIndicators = function (bscroll) {
|
|
5946
|
-
var _this = this;
|
|
5947
|
-
var _a = bscroll.options
|
|
5948
|
-
.scrollbar, _b = _a.fade, fade = _b === void 0 ? true : _b, _c = _a.interactive, interactive = _c === void 0 ? false : _c;
|
|
5949
|
-
var indicatorOption;
|
|
5950
|
-
var scrolls = {
|
|
5951
|
-
scrollX: "horizontal" /* Horizontal */,
|
|
5952
|
-
scrollY: "vertical" /* Vertical */
|
|
5953
|
-
};
|
|
5954
|
-
var indicators = [];
|
|
5955
|
-
Object.keys(scrolls).forEach(function (key) {
|
|
5956
|
-
var direction = scrolls[key];
|
|
5957
|
-
if (bscroll.options[key]) {
|
|
5958
|
-
indicatorOption = {
|
|
5959
|
-
wrapper: _this.createIndicatorElement(direction),
|
|
5960
|
-
direction: direction,
|
|
5961
|
-
fade: fade,
|
|
5962
|
-
interactive: interactive
|
|
5963
|
-
};
|
|
5964
|
-
bscroll.wrapper.appendChild(indicatorOption.wrapper);
|
|
5965
|
-
indicators.push(new Indicator(bscroll, indicatorOption));
|
|
5966
|
-
}
|
|
5967
|
-
});
|
|
5968
|
-
return indicators;
|
|
5969
|
-
};
|
|
5970
|
-
ScrollBar.prototype.createIndicatorElement = function (direction) {
|
|
5971
|
-
var scrollbarEl = document.createElement('div');
|
|
5972
|
-
var indicatorEl = document.createElement('div');
|
|
5973
|
-
scrollbarEl.style.cssText =
|
|
5974
|
-
'position:absolute;z-index:9999;pointerEvents:none';
|
|
5975
|
-
indicatorEl.style.cssText =
|
|
5976
|
-
'box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;';
|
|
5977
|
-
indicatorEl.className = 'bscroll-indicator';
|
|
5978
|
-
if (direction === 'horizontal') {
|
|
5979
|
-
scrollbarEl.style.cssText += ';height:7px;left:2px;right:2px;bottom:0';
|
|
5980
|
-
indicatorEl.style.height = '100%';
|
|
5981
|
-
scrollbarEl.className = 'bscroll-horizontal-scrollbar';
|
|
5982
|
-
}
|
|
5983
|
-
else {
|
|
5984
|
-
scrollbarEl.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px';
|
|
5985
|
-
indicatorEl.style.width = '100%';
|
|
5986
|
-
scrollbarEl.className = 'bscroll-vertical-scrollbar';
|
|
5987
|
-
}
|
|
5988
|
-
scrollbarEl.style.cssText += ';overflow:hidden';
|
|
5989
|
-
scrollbarEl.appendChild(indicatorEl);
|
|
5990
|
-
return scrollbarEl;
|
|
5991
|
-
};
|
|
5992
|
-
ScrollBar.prototype.destroy = function () {
|
|
5993
|
-
for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {
|
|
5994
|
-
var indicator = _a[_i];
|
|
5995
|
-
indicator.destroy();
|
|
5996
|
-
}
|
|
5997
|
-
};
|
|
5998
|
-
ScrollBar.pluginName = 'scrollbar';
|
|
5999
|
-
return ScrollBar;
|
|
6000
|
-
}());
|
|
6001
|
-
|
|
6002
|
-
/*!
|
|
6003
|
-
* better-scroll / mouse-wheel
|
|
6004
|
-
* (c) 2016-2020 ustbhuangyi
|
|
6005
|
-
* Released under the MIT License.
|
|
6006
|
-
*/
|
|
6007
|
-
function warn(msg) {
|
|
6008
|
-
console.error("[BScroll warn]: " + msg);
|
|
6009
|
-
}
|
|
6010
|
-
|
|
6011
|
-
// ssr support
|
|
6012
|
-
var inBrowser = typeof window !== 'undefined';
|
|
6013
|
-
var ua = inBrowser && navigator.userAgent.toLowerCase();
|
|
6014
|
-
!!(ua && /wechatdevtools/.test(ua));
|
|
6015
|
-
ua && ua.indexOf('android') > 0;
|
|
6016
|
-
((function () {
|
|
6017
|
-
if (typeof ua === 'string') {
|
|
6018
|
-
var regex = /os (\d\d?_\d(_\d)?)/;
|
|
6019
|
-
var matches = regex.exec(ua);
|
|
6020
|
-
if (!matches)
|
|
6021
|
-
return false;
|
|
6022
|
-
var parts = matches[1].split('_').map(function (item) {
|
|
6023
|
-
return parseInt(item, 10);
|
|
6024
|
-
});
|
|
6025
|
-
// ios version >= 13.4 issue 982
|
|
6026
|
-
return !!(parts[0] >= 13 && parts[1] >= 4);
|
|
6027
|
-
}
|
|
6028
|
-
return false;
|
|
6029
|
-
}))();
|
|
6030
|
-
|
|
6031
|
-
var extend = function (target, source) {
|
|
6032
|
-
for (var key in source) {
|
|
6033
|
-
target[key] = source[key];
|
|
6034
|
-
}
|
|
6035
|
-
return target;
|
|
6036
|
-
};
|
|
6037
|
-
|
|
6038
|
-
var elementStyle = (inBrowser &&
|
|
6039
|
-
document.createElement('div').style);
|
|
6040
|
-
var vendor = (function () {
|
|
6041
|
-
if (!inBrowser) {
|
|
6042
|
-
return false;
|
|
6043
|
-
}
|
|
6044
|
-
var transformNames = [
|
|
6045
|
-
{
|
|
6046
|
-
key: 'standard',
|
|
6047
|
-
value: 'transform',
|
|
6048
|
-
},
|
|
6049
|
-
{
|
|
6050
|
-
key: 'webkit',
|
|
6051
|
-
value: 'webkitTransform',
|
|
6052
|
-
},
|
|
6053
|
-
{
|
|
6054
|
-
key: 'Moz',
|
|
6055
|
-
value: 'MozTransform',
|
|
6056
|
-
},
|
|
6057
|
-
{
|
|
6058
|
-
key: 'O',
|
|
6059
|
-
value: 'OTransform',
|
|
6060
|
-
},
|
|
6061
|
-
{
|
|
6062
|
-
key: 'ms',
|
|
6063
|
-
value: 'msTransform',
|
|
6064
|
-
},
|
|
6065
|
-
];
|
|
6066
|
-
for (var _i = 0, transformNames_1 = transformNames; _i < transformNames_1.length; _i++) {
|
|
6067
|
-
var obj = transformNames_1[_i];
|
|
6068
|
-
if (elementStyle[obj.value] !== undefined) {
|
|
6069
|
-
return obj.key;
|
|
6070
|
-
}
|
|
6071
|
-
}
|
|
6072
|
-
return false;
|
|
6073
|
-
})();
|
|
6074
|
-
function prefixStyle(style) {
|
|
6075
|
-
if (vendor === false) {
|
|
6076
|
-
return style;
|
|
6077
|
-
}
|
|
6078
|
-
if (vendor === 'standard') {
|
|
6079
|
-
if (style === 'transitionEnd') {
|
|
6080
|
-
return 'transitionend';
|
|
6081
|
-
}
|
|
6082
|
-
return style;
|
|
6083
|
-
}
|
|
6084
|
-
return vendor + style.charAt(0).toUpperCase() + style.substr(1);
|
|
6085
|
-
}
|
|
6086
|
-
function addEvent(el, type, fn, capture) {
|
|
6087
|
-
el.addEventListener(type, fn, {
|
|
6088
|
-
passive: false,
|
|
6089
|
-
capture: !!capture,
|
|
6090
|
-
});
|
|
6091
|
-
}
|
|
6092
|
-
function removeEvent(el, type, fn, capture) {
|
|
6093
|
-
el.removeEventListener(type, fn, {
|
|
6094
|
-
capture: !!capture,
|
|
6095
|
-
});
|
|
6096
|
-
}
|
|
6097
|
-
vendor && vendor !== 'standard' ? '-' + vendor.toLowerCase() + '-' : '';
|
|
6098
|
-
var transform = prefixStyle('transform');
|
|
6099
|
-
var transition = prefixStyle('transition');
|
|
6100
|
-
inBrowser && prefixStyle('perspective') in elementStyle;
|
|
6101
|
-
({
|
|
6102
|
-
transform: transform,
|
|
6103
|
-
transition: transition,
|
|
6104
|
-
transitionTimingFunction: prefixStyle('transitionTimingFunction'),
|
|
6105
|
-
transitionDuration: prefixStyle('transitionDuration'),
|
|
6106
|
-
transitionDelay: prefixStyle('transitionDelay'),
|
|
6107
|
-
transformOrigin: prefixStyle('transformOrigin'),
|
|
6108
|
-
transitionEnd: prefixStyle('transitionEnd'),
|
|
6109
|
-
transitionProperty: prefixStyle('transitionProperty'),
|
|
6110
|
-
});
|
|
6111
|
-
function preventDefaultExceptionFn(el, exceptions) {
|
|
6112
|
-
for (var i in exceptions) {
|
|
6113
|
-
if (exceptions[i].test(el[i])) {
|
|
6114
|
-
return true;
|
|
6115
|
-
}
|
|
6116
|
-
}
|
|
6117
|
-
return false;
|
|
6118
|
-
}
|
|
6119
|
-
|
|
6120
|
-
var EventRegister = /** @class */ (function () {
|
|
6121
|
-
function EventRegister(wrapper, events) {
|
|
6122
|
-
this.wrapper = wrapper;
|
|
6123
|
-
this.events = events;
|
|
6124
|
-
this.addDOMEvents();
|
|
6125
|
-
}
|
|
6126
|
-
EventRegister.prototype.destroy = function () {
|
|
6127
|
-
this.removeDOMEvents();
|
|
6128
|
-
this.events = [];
|
|
6129
|
-
};
|
|
6130
|
-
EventRegister.prototype.addDOMEvents = function () {
|
|
6131
|
-
this.handleDOMEvents(addEvent);
|
|
6132
|
-
};
|
|
6133
|
-
EventRegister.prototype.removeDOMEvents = function () {
|
|
6134
|
-
this.handleDOMEvents(removeEvent);
|
|
6135
|
-
};
|
|
6136
|
-
EventRegister.prototype.handleDOMEvents = function (eventOperation) {
|
|
6137
|
-
var _this = this;
|
|
6138
|
-
var wrapper = this.wrapper;
|
|
6139
|
-
this.events.forEach(function (event) {
|
|
6140
|
-
eventOperation(wrapper, event.name, _this, !!event.capture);
|
|
6141
|
-
});
|
|
6142
|
-
};
|
|
6143
|
-
EventRegister.prototype.handleEvent = function (e) {
|
|
6144
|
-
var eventType = e.type;
|
|
6145
|
-
this.events.some(function (event) {
|
|
6146
|
-
if (event.name === eventType) {
|
|
6147
|
-
event.handler(e);
|
|
6148
|
-
return true;
|
|
6149
|
-
}
|
|
6150
|
-
return false;
|
|
6151
|
-
});
|
|
6152
|
-
};
|
|
6153
|
-
return EventRegister;
|
|
6154
|
-
}());
|
|
6155
|
-
|
|
6156
|
-
var MouseWheel = /** @class */ (function () {
|
|
6157
|
-
function MouseWheel(scroll) {
|
|
6158
|
-
this.scroll = scroll;
|
|
6159
|
-
this.wheelEndTimer = 0;
|
|
6160
|
-
this.wheelMoveTimer = 0;
|
|
6161
|
-
this.wheelStart = false;
|
|
6162
|
-
this.init();
|
|
6163
|
-
}
|
|
6164
|
-
MouseWheel.prototype.init = function () {
|
|
6165
|
-
this.handleBScroll();
|
|
6166
|
-
this.handleOptions();
|
|
6167
|
-
this.handleHooks();
|
|
6168
|
-
this.registerEvent();
|
|
6169
|
-
};
|
|
6170
|
-
MouseWheel.prototype.handleBScroll = function () {
|
|
6171
|
-
this.scroll.registerType([
|
|
6172
|
-
'alterOptions',
|
|
6173
|
-
'mousewheelStart',
|
|
6174
|
-
'mousewheelMove',
|
|
6175
|
-
'mousewheelEnd',
|
|
6176
|
-
]);
|
|
6177
|
-
};
|
|
6178
|
-
MouseWheel.prototype.handleOptions = function () {
|
|
6179
|
-
var userOptions = (this.scroll.options.mouseWheel === true
|
|
6180
|
-
? {}
|
|
6181
|
-
: this.scroll.options.mouseWheel);
|
|
6182
|
-
var defaultOptions = {
|
|
6183
|
-
speed: 20,
|
|
6184
|
-
invert: false,
|
|
6185
|
-
easeTime: 300,
|
|
6186
|
-
discreteTime: 400,
|
|
6187
|
-
throttleTime: 0,
|
|
6188
|
-
dampingFactor: 0.1,
|
|
6189
|
-
};
|
|
6190
|
-
this.mouseWheelOpt = extend(defaultOptions, userOptions);
|
|
6191
|
-
};
|
|
6192
|
-
MouseWheel.prototype.handleHooks = function () {
|
|
6193
|
-
this.hooksFn = [];
|
|
6194
|
-
this.registerHooks(this.scroll.hooks, 'destroy', this.destroy);
|
|
6195
|
-
};
|
|
6196
|
-
MouseWheel.prototype.registerEvent = function () {
|
|
6197
|
-
this.eventRegister = new EventRegister(this.scroll.scroller.wrapper, [
|
|
6198
|
-
{
|
|
6199
|
-
name: 'wheel',
|
|
6200
|
-
handler: this.wheelHandler.bind(this),
|
|
6201
|
-
},
|
|
6202
|
-
{
|
|
6203
|
-
name: 'mousewheel',
|
|
6204
|
-
handler: this.wheelHandler.bind(this),
|
|
6205
|
-
},
|
|
6206
|
-
{
|
|
6207
|
-
name: 'DOMMouseScroll',
|
|
6208
|
-
handler: this.wheelHandler.bind(this),
|
|
6209
|
-
},
|
|
6210
|
-
]);
|
|
6211
|
-
};
|
|
6212
|
-
MouseWheel.prototype.registerHooks = function (hooks, name, handler) {
|
|
6213
|
-
hooks.on(name, handler, this);
|
|
6214
|
-
this.hooksFn.push([hooks, name, handler]);
|
|
6215
|
-
};
|
|
6216
|
-
MouseWheel.prototype.wheelHandler = function (e) {
|
|
6217
|
-
if (!this.scroll.enabled) {
|
|
6218
|
-
return;
|
|
6219
|
-
}
|
|
6220
|
-
this.beforeHandler(e);
|
|
6221
|
-
// start
|
|
6222
|
-
if (!this.wheelStart) {
|
|
6223
|
-
this.wheelStartHandler(e);
|
|
6224
|
-
this.wheelStart = true;
|
|
6225
|
-
}
|
|
6226
|
-
// move
|
|
6227
|
-
var delta = this.getWheelDelta(e);
|
|
6228
|
-
this.wheelMoveHandler(delta);
|
|
6229
|
-
// end
|
|
6230
|
-
this.wheelEndDetector(delta);
|
|
6231
|
-
};
|
|
6232
|
-
MouseWheel.prototype.wheelStartHandler = function (e) {
|
|
6233
|
-
this.cleanCache();
|
|
6234
|
-
var _a = this.scroll.scroller, scrollBehaviorX = _a.scrollBehaviorX, scrollBehaviorY = _a.scrollBehaviorY;
|
|
6235
|
-
scrollBehaviorX.setMovingDirection(0 /* Default */);
|
|
6236
|
-
scrollBehaviorY.setMovingDirection(0 /* Default */);
|
|
6237
|
-
scrollBehaviorX.setDirection(0 /* Default */);
|
|
6238
|
-
scrollBehaviorY.setDirection(0 /* Default */);
|
|
6239
|
-
this.scroll.trigger(this.scroll.eventTypes.alterOptions, this.mouseWheelOpt);
|
|
6240
|
-
this.scroll.trigger(this.scroll.eventTypes.mousewheelStart);
|
|
6241
|
-
};
|
|
6242
|
-
MouseWheel.prototype.cleanCache = function () {
|
|
6243
|
-
this.deltaCache = [];
|
|
6244
|
-
};
|
|
6245
|
-
MouseWheel.prototype.wheelMoveHandler = function (delta) {
|
|
6246
|
-
var _this = this;
|
|
6247
|
-
var _a = this.mouseWheelOpt, throttleTime = _a.throttleTime, dampingFactor = _a.dampingFactor;
|
|
6248
|
-
if (throttleTime && this.wheelMoveTimer) {
|
|
6249
|
-
this.deltaCache.push(delta);
|
|
6250
|
-
}
|
|
6251
|
-
else {
|
|
6252
|
-
var cachedDelta = this.deltaCache.reduce(function (prev, current) {
|
|
6253
|
-
return {
|
|
6254
|
-
x: prev.x + current.x,
|
|
6255
|
-
y: prev.y + current.y,
|
|
6256
|
-
};
|
|
6257
|
-
}, { x: 0, y: 0 });
|
|
6258
|
-
this.cleanCache();
|
|
6259
|
-
var _b = this.scroll.scroller, scrollBehaviorX = _b.scrollBehaviorX, scrollBehaviorY = _b.scrollBehaviorY;
|
|
6260
|
-
scrollBehaviorX.setMovingDirection(-delta.directionX);
|
|
6261
|
-
scrollBehaviorY.setMovingDirection(-delta.directionY);
|
|
6262
|
-
scrollBehaviorX.setDirection(delta.x);
|
|
6263
|
-
scrollBehaviorY.setDirection(delta.y);
|
|
6264
|
-
// when out of boundary, perform a damping scroll
|
|
6265
|
-
var newX = scrollBehaviorX.performDampingAlgorithm(Math.round(delta.x) + cachedDelta.x, dampingFactor);
|
|
6266
|
-
var newY = scrollBehaviorY.performDampingAlgorithm(Math.round(delta.y) + cachedDelta.x, dampingFactor);
|
|
6267
|
-
if (!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove, {
|
|
6268
|
-
x: newX,
|
|
6269
|
-
y: newY,
|
|
6270
|
-
})) {
|
|
6271
|
-
var easeTime = this.getEaseTime();
|
|
6272
|
-
if (newX !== this.scroll.x || newY !== this.scroll.y) {
|
|
6273
|
-
this.scroll.scrollTo(newX, newY, easeTime);
|
|
6274
|
-
}
|
|
6275
|
-
}
|
|
6276
|
-
if (throttleTime) {
|
|
6277
|
-
this.wheelMoveTimer = window.setTimeout(function () {
|
|
6278
|
-
_this.wheelMoveTimer = 0;
|
|
6279
|
-
}, throttleTime);
|
|
6280
|
-
}
|
|
6281
|
-
}
|
|
6282
|
-
};
|
|
6283
|
-
MouseWheel.prototype.wheelEndDetector = function (delta) {
|
|
6284
|
-
var _this = this;
|
|
6285
|
-
window.clearTimeout(this.wheelEndTimer);
|
|
6286
|
-
this.wheelEndTimer = window.setTimeout(function () {
|
|
6287
|
-
_this.wheelStart = false;
|
|
6288
|
-
window.clearTimeout(_this.wheelMoveTimer);
|
|
6289
|
-
_this.wheelMoveTimer = 0;
|
|
6290
|
-
_this.scroll.trigger(_this.scroll.eventTypes.mousewheelEnd, delta);
|
|
6291
|
-
}, this.mouseWheelOpt.discreteTime);
|
|
6292
|
-
};
|
|
6293
|
-
MouseWheel.prototype.getWheelDelta = function (e) {
|
|
6294
|
-
var _a = this.mouseWheelOpt, speed = _a.speed, invert = _a.invert;
|
|
6295
|
-
var wheelDeltaX = 0;
|
|
6296
|
-
var wheelDeltaY = 0;
|
|
6297
|
-
var direction = invert ? -1 /* Negative */ : 1 /* Positive */;
|
|
6298
|
-
switch (true) {
|
|
6299
|
-
case 'deltaX' in e:
|
|
6300
|
-
if (e.deltaMode === 1) {
|
|
6301
|
-
wheelDeltaX = -e.deltaX * speed;
|
|
6302
|
-
wheelDeltaY = -e.deltaY * speed;
|
|
6303
|
-
}
|
|
6304
|
-
else {
|
|
6305
|
-
wheelDeltaX = -e.deltaX;
|
|
6306
|
-
wheelDeltaY = -e.deltaY;
|
|
6307
|
-
}
|
|
6308
|
-
break;
|
|
6309
|
-
case 'wheelDeltaX' in e:
|
|
6310
|
-
wheelDeltaX = (e.wheelDeltaX / 120) * speed;
|
|
6311
|
-
wheelDeltaY = (e.wheelDeltaY / 120) * speed;
|
|
6312
|
-
break;
|
|
6313
|
-
case 'wheelDelta' in e:
|
|
6314
|
-
wheelDeltaX = wheelDeltaY = (e.wheelDelta / 120) * speed;
|
|
6315
|
-
break;
|
|
6316
|
-
case 'detail' in e:
|
|
6317
|
-
wheelDeltaX = wheelDeltaY = (-e.detail / 3) * speed;
|
|
6318
|
-
break;
|
|
6319
|
-
}
|
|
6320
|
-
wheelDeltaX *= direction;
|
|
6321
|
-
wheelDeltaY *= direction;
|
|
6322
|
-
if (!this.scroll.hasVerticalScroll) {
|
|
6323
|
-
wheelDeltaX = wheelDeltaY;
|
|
6324
|
-
wheelDeltaY = 0;
|
|
6325
|
-
}
|
|
6326
|
-
if (!this.scroll.hasHorizontalScroll) {
|
|
6327
|
-
wheelDeltaX = 0;
|
|
6328
|
-
}
|
|
6329
|
-
var directionX = wheelDeltaX > 0
|
|
6330
|
-
? -1 /* Negative */
|
|
6331
|
-
: wheelDeltaX < 0
|
|
6332
|
-
? 1 /* Positive */
|
|
6333
|
-
: 0 /* Default */;
|
|
6334
|
-
var directionY = wheelDeltaY > 0
|
|
6335
|
-
? -1 /* Negative */
|
|
6336
|
-
: wheelDeltaY < 0
|
|
6337
|
-
? 1 /* Positive */
|
|
6338
|
-
: 0 /* Default */;
|
|
6339
|
-
return {
|
|
6340
|
-
x: wheelDeltaX,
|
|
6341
|
-
y: wheelDeltaY,
|
|
6342
|
-
directionX: directionX,
|
|
6343
|
-
directionY: directionY,
|
|
6344
|
-
};
|
|
6345
|
-
};
|
|
6346
|
-
MouseWheel.prototype.beforeHandler = function (e) {
|
|
6347
|
-
var _a = this.scroll.options, preventDefault = _a.preventDefault, stopPropagation = _a.stopPropagation, preventDefaultException = _a.preventDefaultException;
|
|
6348
|
-
if (preventDefault &&
|
|
6349
|
-
!preventDefaultExceptionFn(e.target, preventDefaultException)) {
|
|
6350
|
-
e.preventDefault();
|
|
6351
|
-
}
|
|
6352
|
-
if (stopPropagation) {
|
|
6353
|
-
e.stopPropagation();
|
|
6354
|
-
}
|
|
6355
|
-
};
|
|
6356
|
-
MouseWheel.prototype.getEaseTime = function () {
|
|
6357
|
-
var SAFE_EASETIME = 100;
|
|
6358
|
-
var easeTime = this.mouseWheelOpt.easeTime;
|
|
6359
|
-
// scrollEnd event will be triggered in every calling of scrollTo when easeTime is too small
|
|
6360
|
-
// easeTime needs to be greater than 100
|
|
6361
|
-
if (easeTime < SAFE_EASETIME) {
|
|
6362
|
-
warn("easeTime should be greater than 100." +
|
|
6363
|
-
"If mouseWheel easeTime is too small," +
|
|
6364
|
-
"scrollEnd will be triggered many times.");
|
|
6365
|
-
}
|
|
6366
|
-
return Math.max(easeTime, SAFE_EASETIME);
|
|
6367
|
-
};
|
|
6368
|
-
MouseWheel.prototype.destroy = function () {
|
|
6369
|
-
this.eventRegister.destroy();
|
|
6370
|
-
window.clearTimeout(this.wheelEndTimer);
|
|
6371
|
-
window.clearTimeout(this.wheelMoveTimer);
|
|
6372
|
-
this.hooksFn.forEach(function (item) {
|
|
6373
|
-
var hooks = item[0];
|
|
6374
|
-
var hooksName = item[1];
|
|
6375
|
-
var handlerFn = item[2];
|
|
6376
|
-
hooks.off(hooksName, handlerFn);
|
|
6377
|
-
});
|
|
6378
|
-
};
|
|
6379
|
-
MouseWheel.pluginName = 'mouseWheel';
|
|
6380
|
-
MouseWheel.applyOrder = "pre" /* Pre */;
|
|
6381
|
-
return MouseWheel;
|
|
6382
|
-
}());
|
|
6383
|
-
|
|
6384
|
-
//
|
|
6385
|
-
BScroll.use(ScrollBar);
|
|
6386
|
-
BScroll.use(MouseWheel);
|
|
6387
|
-
var script$2 = {
|
|
6388
|
-
name: 'ScrollableArea',
|
|
6389
|
-
data: () => ({
|
|
6390
|
-
scroll: null,
|
|
6391
|
-
changed: 0,
|
|
6392
|
-
hasSlotContent: false,
|
|
6393
|
-
observer: null,
|
|
6394
|
-
scrollOptions: {
|
|
6395
|
-
scrollbar: {
|
|
6396
|
-
fade: false,
|
|
6397
|
-
interactive: true
|
|
6398
|
-
},
|
|
6399
|
-
click: true,
|
|
6400
|
-
mouseWheel: {
|
|
6401
|
-
speed: 20,
|
|
6402
|
-
invert: false
|
|
6403
|
-
}
|
|
6404
|
-
}
|
|
6405
|
-
}),
|
|
6406
|
-
|
|
6407
|
-
beforeUpdate() {
|
|
6408
|
-
this.hasSlotContent = this.checkForSlotContent();
|
|
6409
|
-
},
|
|
6410
|
-
|
|
6411
|
-
beforeDestroy: function () {
|
|
6412
|
-
// Clean up
|
|
6413
|
-
this.observer.disconnect();
|
|
6414
|
-
},
|
|
6415
|
-
|
|
6416
|
-
created() {
|
|
6417
|
-
this.hasSlotContent = this.checkForSlotContent();
|
|
6418
|
-
},
|
|
6419
|
-
|
|
6420
|
-
updated() {
|
|
6421
|
-
this.$nextTick(() => {
|
|
6422
|
-
if (this.scroll) {
|
|
6423
|
-
this.scroll.refresh();
|
|
6424
|
-
}
|
|
6425
|
-
});
|
|
6426
|
-
},
|
|
6427
|
-
|
|
6428
|
-
mounted() {
|
|
6429
|
-
this.$nextTick(() => {
|
|
6430
|
-
if (!this.scroll) {
|
|
6431
|
-
this.scroll = new BScroll(this.$refs.area, this.scrollOptions);
|
|
6432
|
-
}
|
|
6433
|
-
});
|
|
6434
|
-
let classes = ["scrollable", "bscroll-vertical-scrollbar"];
|
|
6435
|
-
this.observer = new MutationObserver(function (mutations) {
|
|
6436
|
-
let className;
|
|
6437
|
-
let reload = false;
|
|
6438
|
-
let mut;
|
|
6439
|
-
|
|
6440
|
-
for (let m in mutations) {
|
|
6441
|
-
mut = mutations[m];
|
|
6442
|
-
className = mut.target.className;
|
|
6443
|
-
|
|
6444
|
-
if (!(mut.type == "attributes" || classes.indexOf(className) > -1)) {
|
|
6445
|
-
reload = true;
|
|
6446
|
-
}
|
|
6447
|
-
}
|
|
6448
|
-
|
|
6449
|
-
if (reload) {
|
|
6450
|
-
this.changed++;
|
|
6451
|
-
} //
|
|
6452
|
-
|
|
6453
|
-
}.bind(this)); // Setup the observer
|
|
6454
|
-
|
|
6455
|
-
this.observer.observe(this.$refs.area, {
|
|
6456
|
-
attributes: true,
|
|
6457
|
-
childList: true,
|
|
6458
|
-
characterData: true,
|
|
6459
|
-
subtree: true
|
|
6460
|
-
});
|
|
6461
|
-
},
|
|
6462
|
-
|
|
6463
|
-
watch: {
|
|
6464
|
-
changed: function (newVal) {
|
|
6465
|
-
// watch it
|
|
6466
|
-
if (newVal) {
|
|
6467
|
-
this.makeScroll();
|
|
6468
|
-
}
|
|
6469
|
-
},
|
|
6470
|
-
hasSlotContent: function (val) {}
|
|
6471
|
-
},
|
|
6472
|
-
methods: {
|
|
6473
|
-
activate() {
|
|
6474
|
-
this.makeScroll();
|
|
6475
|
-
},
|
|
6476
|
-
|
|
6477
|
-
checkForSlotContent() {
|
|
6478
|
-
let checkForContent = (hasContent, node) => {
|
|
6479
|
-
return hasContent || node.tag || node.text && node.text.trim();
|
|
6480
|
-
};
|
|
6481
|
-
|
|
6482
|
-
return this.$slots.default && this.$slots.default.reduce(checkForContent, false);
|
|
6483
|
-
},
|
|
6484
|
-
|
|
6485
|
-
makeScroll() {
|
|
6486
|
-
this.$nextTick(() => {
|
|
6487
|
-
this.$nextTick(() => {
|
|
6488
|
-
if (this.scroll) {
|
|
6489
|
-
this.scroll.destroy();
|
|
6490
|
-
this.scroll = null;
|
|
6491
|
-
}
|
|
6492
|
-
|
|
6493
|
-
this.scroll = new BScroll(this.$refs.area, this.scrollOptions);
|
|
6494
|
-
});
|
|
6495
|
-
});
|
|
6496
|
-
},
|
|
6497
|
-
|
|
6498
|
-
reset() {
|
|
6499
|
-
this.$nextTick(() => {
|
|
6500
|
-
if (this.scroll) {
|
|
6501
|
-
this.scroll.refresh();
|
|
6502
|
-
}
|
|
6503
|
-
});
|
|
6504
|
-
}
|
|
6505
|
-
|
|
6506
|
-
}
|
|
6507
|
-
};
|
|
6508
|
-
|
|
6509
|
-
/* script */
|
|
6510
|
-
const __vue_script__$2 = script$2;
|
|
6511
|
-
/* template */
|
|
6512
|
-
|
|
6513
|
-
var __vue_render__$2 = function () {
|
|
6514
|
-
var _vm = this;
|
|
6515
|
-
|
|
6516
|
-
var _h = _vm.$createElement;
|
|
6517
|
-
|
|
6518
|
-
var _c = _vm._self._c || _h;
|
|
6519
|
-
|
|
6520
|
-
return _c('div', {
|
|
6521
|
-
ref: "area",
|
|
6522
|
-
staticClass: "wf-component scrollable"
|
|
6523
|
-
}, [_vm._t("default")], 2);
|
|
6524
|
-
};
|
|
6525
|
-
|
|
6526
|
-
var __vue_staticRenderFns__$2 = [];
|
|
6527
|
-
/* style */
|
|
6528
|
-
|
|
6529
|
-
const __vue_inject_styles__$2 = function (inject) {
|
|
6530
|
-
if (!inject) return;
|
|
6531
|
-
inject("data-v-a5c2b274_0", {
|
|
6532
|
-
source: ".scrollable[data-v-a5c2b274]{overflow:hidden;width:100%;height:100%}",
|
|
6533
|
-
map: undefined,
|
|
6534
|
-
media: undefined
|
|
6535
|
-
});
|
|
6536
|
-
};
|
|
6537
|
-
/* scoped */
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
const __vue_scope_id__$2 = "data-v-a5c2b274";
|
|
6541
|
-
/* module identifier */
|
|
6542
|
-
|
|
6543
|
-
const __vue_module_identifier__$2 = undefined;
|
|
6544
|
-
/* functional template */
|
|
6545
|
-
|
|
6546
|
-
const __vue_is_functional_template__$2 = false;
|
|
6547
|
-
/* style inject SSR */
|
|
6548
|
-
|
|
6549
|
-
/* style inject shadow dom */
|
|
6550
|
-
|
|
6551
|
-
const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
|
|
6552
|
-
render: __vue_render__$2,
|
|
6553
|
-
staticRenderFns: __vue_staticRenderFns__$2
|
|
6554
|
-
}, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, createInjector, undefined, undefined);
|
|
6555
|
-
|
|
6556
|
-
//
|
|
6557
|
-
var script$1 = {
|
|
6558
|
-
name: 'Banner',
|
|
6559
|
-
props: {
|
|
6560
|
-
template: String,
|
|
6561
|
-
container: String,
|
|
6562
|
-
playOnBoot: {
|
|
6563
|
-
type: Boolean,
|
|
6564
|
-
default: false
|
|
6565
|
-
}
|
|
6566
|
-
},
|
|
6567
|
-
computed: { //yahLogo
|
|
6568
|
-
...mapState(['banners'])
|
|
6569
|
-
},
|
|
6570
|
-
|
|
6571
|
-
data() {
|
|
6572
|
-
return {
|
|
6573
|
-
frames: [],
|
|
6574
|
-
current: -1,
|
|
6575
|
-
timer: null,
|
|
6576
|
-
fadeDuration: 500,
|
|
6577
|
-
backgroundColor: "#fff",
|
|
6578
|
-
visible: false,
|
|
6579
|
-
qr: null,
|
|
6580
|
-
displayQR: false,
|
|
6581
|
-
frameKeywords: [],
|
|
6582
|
-
last: 0
|
|
6583
|
-
};
|
|
6584
|
-
},
|
|
6585
|
-
|
|
6586
|
-
watch: {
|
|
6587
|
-
banners() {
|
|
6588
|
-
let now = Date.now();
|
|
6589
|
-
|
|
6590
|
-
if (this.template && this.container && this.banners['template-' + this.template] && this.banners['template-' + this.template][this.container]) {
|
|
6591
|
-
this.frames = this.banners['template-' + this.template][this.container].filter(frame => {
|
|
6592
|
-
let enabled = frame.enabled;
|
|
6593
|
-
|
|
6594
|
-
if (enabled && frame.from_date) {
|
|
6595
|
-
enabled = enabled && new Date(frame.from_date).getTime() <= now;
|
|
6596
|
-
}
|
|
6597
|
-
|
|
6598
|
-
if (enabled && frame.to_date) {
|
|
6599
|
-
enabled = enabled && new Date(frame.to_date).getTime() >= now;
|
|
6600
|
-
}
|
|
6601
|
-
|
|
6602
|
-
if (enabled) {
|
|
6603
|
-
for (let c in frame.containers) {
|
|
6604
|
-
frame.containers[c].url = this.getUrl(frame.containers[c]);
|
|
6605
|
-
}
|
|
6606
|
-
}
|
|
6607
|
-
|
|
6608
|
-
return enabled;
|
|
6609
|
-
});
|
|
6610
|
-
this.$emit('hasbanners', this.frames.length > 0);
|
|
6611
|
-
|
|
6612
|
-
if (this.playOnBoot) {
|
|
6613
|
-
this.$nextTick(function () {
|
|
6614
|
-
this.play();
|
|
6615
|
-
});
|
|
6616
|
-
}
|
|
6617
|
-
}
|
|
3465
|
+
}
|
|
6618
3466
|
}
|
|
6619
3467
|
|
|
6620
3468
|
},
|
|
@@ -6819,11 +3667,6 @@ const __vue_component__$1 = /*#__PURE__*/normalizeComponent({
|
|
|
6819
3667
|
staticRenderFns: __vue_staticRenderFns__$1
|
|
6820
3668
|
}, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, createInjector, undefined, undefined);
|
|
6821
3669
|
|
|
6822
|
-
//
|
|
6823
|
-
//
|
|
6824
|
-
//
|
|
6825
|
-
//
|
|
6826
|
-
//
|
|
6827
3670
|
//
|
|
6828
3671
|
var script = {
|
|
6829
3672
|
name: 'MapFloors',
|
|
@@ -6832,6 +3675,24 @@ var script = {
|
|
|
6832
3675
|
type: String,
|
|
6833
3676
|
default: ""
|
|
6834
3677
|
}
|
|
3678
|
+
},
|
|
3679
|
+
computed: { ...mapState(['reset'])
|
|
3680
|
+
},
|
|
3681
|
+
|
|
3682
|
+
data() {
|
|
3683
|
+
return {
|
|
3684
|
+
currentSRC: ""
|
|
3685
|
+
};
|
|
3686
|
+
},
|
|
3687
|
+
|
|
3688
|
+
mounted() {
|
|
3689
|
+
this.currentSRC = this.src;
|
|
3690
|
+
},
|
|
3691
|
+
|
|
3692
|
+
watch: {
|
|
3693
|
+
reset: function (newVal) {
|
|
3694
|
+
this.currentSRC = this.src + "?t=" + Date.now();
|
|
3695
|
+
}
|
|
6835
3696
|
}
|
|
6836
3697
|
};
|
|
6837
3698
|
|
|
@@ -6850,7 +3711,7 @@ var __vue_render__ = function () {
|
|
|
6850
3711
|
staticClass: "wf-component wf-browser"
|
|
6851
3712
|
}, [_c('iframe', {
|
|
6852
3713
|
attrs: {
|
|
6853
|
-
"src": _vm.
|
|
3714
|
+
"src": _vm.currentSRC
|
|
6854
3715
|
}
|
|
6855
3716
|
})]);
|
|
6856
3717
|
};
|
|
@@ -6860,7 +3721,7 @@ var __vue_staticRenderFns__ = [];
|
|
|
6860
3721
|
|
|
6861
3722
|
const __vue_inject_styles__ = function (inject) {
|
|
6862
3723
|
if (!inject) return;
|
|
6863
|
-
inject("data-v-
|
|
3724
|
+
inject("data-v-55f34065_0", {
|
|
6864
3725
|
source: ".wf-browser,.wf-browser iframe{width:100%;height:100%;border:none}",
|
|
6865
3726
|
map: undefined,
|
|
6866
3727
|
media: undefined
|
|
@@ -6909,7 +3770,8 @@ var store = new index.Store({
|
|
|
6909
3770
|
banners: {},
|
|
6910
3771
|
landscape: false,
|
|
6911
3772
|
mobile: false,
|
|
6912
|
-
maxInActivity: 30
|
|
3773
|
+
maxInActivity: 30,
|
|
3774
|
+
reset: 0
|
|
6913
3775
|
},
|
|
6914
3776
|
getters: {
|
|
6915
3777
|
xLanguage: (state, context) => {
|
|
@@ -7011,6 +3873,9 @@ var store = new index.Store({
|
|
|
7011
3873
|
},
|
|
7012
3874
|
SET_FILTERED_POIS: (state, pois) => {
|
|
7013
3875
|
state.filteredPOIs = pois;
|
|
3876
|
+
},
|
|
3877
|
+
RESET: (state, pois) => {
|
|
3878
|
+
state.reset = Date.now();
|
|
7014
3879
|
}
|
|
7015
3880
|
},
|
|
7016
3881
|
actions: {
|
|
@@ -7043,7 +3908,12 @@ var store = new index.Store({
|
|
|
7043
3908
|
},
|
|
7044
3909
|
SET_FILTERED_POIS: (context, pois) => {
|
|
7045
3910
|
context.commit('SET_FILTERED_POIS', Object.freeze(pois));
|
|
3911
|
+
},
|
|
3912
|
+
|
|
3913
|
+
RESET(context) {
|
|
3914
|
+
context.commit('RESET');
|
|
7046
3915
|
}
|
|
3916
|
+
|
|
7047
3917
|
}
|
|
7048
3918
|
});
|
|
7049
3919
|
|