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