@component-hook/picker 0.2.2 → 0.2.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/index.css +1 -1
- package/dist/react/picker.es.js +159 -160
- package/dist/react/picker.umd.js +2 -2
- package/dist/vue/index.css +1 -1
- package/dist/vue/picker.es.d.ts +5 -3
- package/dist/vue/picker.es.js +11 -12
- package/dist/vue/picker.umd.js +3 -3
- package/package.json +3 -3
package/dist/react/picker.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(N,ge){typeof exports=="object"&&typeof module<"u"?module.exports=ge(require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["react","react-dom"],ge):(N=typeof globalThis<"u"?globalThis:N||self,N.picker=ge(N.React,N.ReactDOM))})(this,function(N,ge){"use strict";var jt=document.createElement("style");jt.textContent=`.mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#0003}.picker{position:fixed;left:0;right:0;bottom:0;height:270px;z-index:10000;background:#fff;-webkit-user-select:none;user-select:none}.picker_title{position:relative;height:44px;color:#333}.picker_title:after{content:"";display:block;border-bottom:1px solid #ebebeb;left:0;right:0;transform:scaleY(.5)}.picker_title button{position:absolute;height:44px;line-height:44px;padding:0 12px;font-size:14px;border:none;background-color:transparent}.picker_title h4{margin:0;font-size:16px;font-weight:400;height:44px;line-height:44px;text-align:center}.picker_cancel{left:0;cursor:pointer;transition:all .3s}.picker_cancel:hover{filter:brightness(110%)}.picker_confirm{right:0;cursor:pointer;transition:all .3s}.picker_confirm:hover{filter:brightness(110%)}.picker_panel{position:relative;height:226px;padding:24px 12px;box-sizing:border-box}.picker_mask_top,.picker_mask_bottom{position:absolute;left:0;right:0;height:72px;background:#fff;transform:translateZ(0);z-index:1;pointer-events:none}.picker_mask_top{top:24px;background:linear-gradient(to bottom,#ffffffe6,#ffffff80)}.picker_mask_top:after{content:"";display:block;position:absolute;left:0;right:0;bottom:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.picker_mask_bottom{bottom:24px;background:linear-gradient(to top,#ffffffe6,#ffffff80)}.picker_mask_bottom:before{content:"";display:block;position:absolute;left:0;right:0;top:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.picker_wheel{flex:1;overflow:hidden}.picker_wheel_wrapper{display:flex;align-items:stretch;height:100%}.picker_wheel_scroll{margin-top:72px;padding:0}.picker_wheel_item{height:34px;line-height:34px;font-size:17px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#333}.fade-enter{opacity:0}.fade-enter-active{opacity:1;transition:all .3s ease}.fade-exit-active{opacity:0;transition:all .3s ease}.slide-enter{opacity:.5;transform:translate3d(0,270px,0)}.slide-enter-active{transition:all .3s ease;opacity:1;transform:translateZ(0)}.slide-exit-active{transition:all .3s ease;opacity:.5;transform:translate3d(0,270px,0)}
|
|
1
|
+
(function(N,ge){typeof exports=="object"&&typeof module<"u"?module.exports=ge(require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["react","react-dom"],ge):(N=typeof globalThis<"u"?globalThis:N||self,N.picker=ge(N.React,N.ReactDOM))})(this,function(N,ge){"use strict";var jt=document.createElement("style");jt.textContent=`.component-hook-picker-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#0003}.component-hook-picker{position:fixed;left:0;right:0;bottom:0;height:270px;z-index:10000;background:#fff;-webkit-user-select:none;user-select:none}.component-hook-picker_title{position:relative;height:44px;color:#333}.component-hook-picker_title:after{content:"";display:block;border-bottom:1px solid #ebebeb;left:0;right:0;transform:scaleY(.5)}.component-hook-picker_title button{position:absolute;height:44px;line-height:44px;padding:0 12px;font-size:14px;border:none;background-color:transparent}.component-hook-picker_title button:hover{background-color:transparent}.component-hook-picker_title h4{margin:0;font-size:16px;font-weight:400;height:44px;line-height:44px;text-align:center}.component-hook-picker_cancel{left:0;cursor:pointer;transition:all .3s}.component-hook-picker_cancel:hover{filter:brightness(110%)}.component-hook-picker_confirm{right:0;cursor:pointer;transition:all .3s}.component-hook-picker_confirm:hover{filter:brightness(110%)}.component-hook-picker_panel{position:relative;height:226px;padding:24px 12px;box-sizing:border-box}.component-hook-picker_mask_top,.component-hook-picker_mask_bottom{position:absolute;left:0;right:0;height:72px;background:#fff;transform:translateZ(0);z-index:1;pointer-events:none}.component-hook-picker_mask_top{top:24px;background:linear-gradient(to bottom,#ffffffe6,#ffffff80)}.component-hook-picker_mask_top:after{content:"";display:block;position:absolute;left:0;right:0;bottom:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.component-hook-picker_mask_bottom{bottom:24px;background:linear-gradient(to top,#ffffffe6,#ffffff80)}.component-hook-picker_mask_bottom:before{content:"";display:block;position:absolute;left:0;right:0;top:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.component-hook-picker_wheel{flex:1;overflow:hidden}.component-hook-picker_wheel_wrapper{display:flex;align-items:stretch;height:100%}.component-hook-picker_wheel_scroll{margin-top:72px;padding:0}.component-hook-picker_wheel_item{height:34px;line-height:34px;font-size:17px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#333}.component-hook-picker-fade-enter{opacity:0}.component-hook-picker-fade-enter-active{opacity:1;transition:all .3s ease}.component-hook-picker-fade-exit-active{opacity:0;transition:all .3s ease}.component-hook-picker-slide-enter{opacity:.5;transform:translate3d(0,270px,0)}.component-hook-picker-slide-enter-active{transition:all .3s ease;opacity:1;transform:translateZ(0)}.component-hook-picker-slide-exit-active{transition:all .3s ease;opacity:.5;transform:translate3d(0,270px,0)}
|
|
2
2
|
/*$vite$:1*/`,document.head.appendChild(jt);function Lr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ct={exports:{}},Ne={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|
|
@@ -68,4 +68,4 @@ Valid keys: `+JSON.stringify(Object.keys(d),null," "));var m=Z(w,A,E,x,S+"."+A,
|
|
|
68
68
|
* better-scroll / wheel
|
|
69
69
|
* (c) 2016-2023 ustbhuangyi
|
|
70
70
|
* Released under the MIT License.
|
|
71
|
-
*/var ze=typeof window<"u",ot=ze&&navigator.userAgent.toLowerCase();ot&&ot.indexOf("android")>0,function(){if(typeof ot=="string"){var r=/os (\d\d?_\d(_\d)?)/,e=r.exec(ot);if(!e)return!1;var t=e[1].split("_").map(function(n){return parseInt(n,10)});return t[0]===13&&t[1]>=4}return!1}();var jn=!1;if(ze){var Nn="test-passive";try{var kr={};Object.defineProperty(kr,"passive",{get:function(){jn=!0}}),window.addEventListener(Nn,function(){},kr)}catch{}}var Ln=function(r,e){for(var t in e)r[t]=e[t];return r},Sr=ze&&document.createElement("div").style,Me=function(){if(!ze)return!1;for(var r=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],e=0,t=r;e<t.length;e++){var n=t[e];if(Sr[n.value]!==void 0)return n.key}return!1}();function me(r){return Me===!1?r:Me==="standard"?r==="transitionEnd"?"transitionend":r:Me+r.charAt(0).toUpperCase()+r.substr(1)}Me&&Me!=="standard"&&""+Me.toLowerCase();var $n=me("transform"),Fn=me("transition");ze&&me("perspective")in Sr;var _t={transform:$n,transition:Fn,transitionTimingFunction:me("transitionTimingFunction"),transitionDuration:me("transitionDuration"),transitionDelay:me("transitionDelay"),transformOrigin:me("transformOrigin"),transitionEnd:me("transitionEnd"),transitionProperty:me("transitionProperty")};function it(r,e){var t=new RegExp("(^|\\s)"+e+"(\\s|$)");return t.test(r.className)}function Xn(r){return Array.prototype.slice.call(r,0)}var Wn={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(r){return 1+--r*r*r*r*r}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(r){return r*(2-r)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(r){return 1- --r*r*r*r}}},zn="plugins.wheel",Hn=[{key:"wheelTo",name:"wheelTo"},{key:"getSelectedIndex",name:"getSelectedIndex"},{key:"restorePosition",name:"restorePosition"}],Un=Hn.map(function(r){return{key:r.key,sourceKey:zn+"."+r.name}}),xr="wheelIndexChanged",qn={rate:4},Vn=function(){function r(e){this.scroll=e,this.init()}return r.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.refreshBoundary(),this.setSelectedIndex(this.options.selectedIndex)},r.prototype.handleBScroll=function(){this.scroll.proxy(Un),this.scroll.registerType([xr])},r.prototype.handleOptions=function(){var e=this.scroll.options.wheel===!0?{}:this.scroll.options.wheel,t={wheelWrapperClass:"wheel-scroll",wheelItemClass:"wheel-item",rotate:25,adjustTime:400,selectedIndex:0,wheelDisabledItemClass:"wheel-disabled-item"};this.options=Ln(t,e)},r.prototype.handleHooks=function(){var e=this,t=this.scroll,n=this.scroll.scroller,o=n.actionsHandler,i=n.scrollBehaviorX,a=n.scrollBehaviorY,c=n.animater,u=n.content;t.on(t.eventTypes.scrollEnd,function(l){var f=e.findNearestValidWheel(l.y).index;if(n.animater.forceStopped&&!e.isAdjustingPosition)return e.target=e.items[f],!0;e.setSelectedIndex(f),e.isAdjustingPosition&&(e.isAdjustingPosition=!1)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.refresh,function(l){l!==u&&(u=l,e.setSelectedIndex(e.options.selectedIndex,!0)),e.rotateX(e.scroll.y),e.wheelTo(e.selectedIndex,0)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(l){l.x=0,l.y=-(e.selectedIndex*e.itemHeight)}),n.hooks.on(n.hooks.eventTypes.checkClick,function(){var l=Xn(e.items).indexOf(e.target);return l===-1||e.wheelTo(l,e.options.adjustTime,Wn.swipe),!0}),n.hooks.on(n.hooks.eventTypes.scrollTo,function(l){l.y=e.findNearestValidWheel(l.y).y}),n.hooks.on(n.hooks.eventTypes.minDistanceScroll,function(){var l=n.animater;l.forceStopped===!0&&(l.forceStopped=!1)}),n.hooks.on(n.hooks.eventTypes.scrollToElement,function(l,f){if(it(l,e.options.wheelItemClass))f.top=e.findNearestValidWheel(f.top).y;else return!0}),o.hooks.on(o.hooks.eventTypes.beforeStart,function(l){e.target=l.target}),i.hooks.on(i.hooks.eventTypes.computeBoundary,function(l){l.maxScrollPos=0,l.minScrollPos=0}),a.hooks.on(a.hooks.eventTypes.computeBoundary,function(l){e.items=e.scroll.scroller.content.children,e.checkWheelAllDisabled(),e.itemHeight=e.items.length>0?a.contentSize/e.items.length:0,l.maxScrollPos=-e.itemHeight*(e.items.length-1),l.minScrollPos=0}),a.hooks.on(a.hooks.eventTypes.momentum,function(l){l.rate=qn.rate,l.destination=e.findNearestValidWheel(l.destination).y}),a.hooks.on(a.hooks.eventTypes.end,function(l){var f=e.findNearestValidWheel(a.currentPos);l.destination=f.y,l.duration=e.options.adjustTime}),c.hooks.on(c.hooks.eventTypes.time,function(l){e.transitionDuration(l)}),c.hooks.on(c.hooks.eventTypes.timeFunction,function(l){e.timeFunction(l)}),c.hooks.on(c.hooks.eventTypes.callStop,function(){var l=e.findNearestValidWheel(e.scroll.y).index;e.isAdjustingPosition=!0,e.wheelTo(l,0)}),c.translater.hooks.on(c.translater.hooks.eventTypes.translate,function(l){e.rotateX(l.y)})},r.prototype.refreshBoundary=function(){var e=this.scroll.scroller,t=e.scrollBehaviorX,n=e.scrollBehaviorY,o=e.content;t.refresh(o),n.refresh(o)},r.prototype.setSelectedIndex=function(e,t){t===void 0&&(t=!1);var n=this.selectedIndex;this.selectedIndex=e,n!==e&&!t&&this.scroll.trigger(xr,e)},r.prototype.getSelectedIndex=function(){return this.selectedIndex},r.prototype.wheelTo=function(e,t,n){e===void 0&&(e=0),t===void 0&&(t=0);var o=-e*this.itemHeight;this.scroll.scrollTo(0,o,t,n)},r.prototype.restorePosition=function(){var e=this.scroll.pending;if(e){var t=this.getSelectedIndex();this.scroll.scroller.animater.clearTimer(),this.wheelTo(t,0)}},r.prototype.transitionDuration=function(e){for(var t=0;t<this.items.length;t++)this.items[t].style[_t.transitionDuration]=e+"ms"},r.prototype.timeFunction=function(e){for(var t=0;t<this.items.length;t++)this.items[t].style[_t.transitionTimingFunction]=e},r.prototype.rotateX=function(e){for(var t=this.options.rotate,n=t===void 0?25:t,o=0;o<this.items.length;o++){var i=n*(e/this.itemHeight+o),a=i.toFixed(3);this.items[o].style[_t.transform]="rotateX("+a+"deg)"}},r.prototype.findNearestValidWheel=function(e){e=e>0?0:e<this.scroll.maxScrollY?this.scroll.maxScrollY:e;for(var t=Math.abs(Math.round(-e/this.itemHeight)),n=t,o=this.items,i=this.options.wheelDisabledItemClass;t>=0&&it(o[t],i);)t--;if(t<0)for(t=n;t<=o.length-1&&it(o[t],i);)t++;return t===o.length&&(t=n),{index:this.wheelItemsAllDisabled?-1:t,y:-t*this.itemHeight}},r.prototype.checkWheelAllDisabled=function(){var e=this.options.wheelDisabledItemClass,t=this.items;this.wheelItemsAllDisabled=!0;for(var n=0;n<t.length;n++)if(!it(t[n],e)){this.wheelItemsAllDisabled=!1;break}},r.pluginName="wheel",r}();Bn.use(Vn);const st=Array.isArray,Kn=r=>typeof r=="string",Pr=r=>typeof r=="number",Gn=r=>typeof r=="object"&&r!==null;function Ot(r){return st(r)&&r.length===3}function Jn(r){return r%4===0&&(r%100!==0||r%400===0)}function Ie(r,e){const t=[];for(let n=r;n<=e;n++)t.push(n);return t}function Rt(r,e){const t=[];for(let n=r;n<=e;n++)t.push(`${n}`.padStart(2,"0"));return t}function Zn(){const r=Rt(0,23),e=Rt(0,59),t=Rt(0,59);return{timeList:[r,e,t],getTimeAnchors:Qn}}function Qn(r){return(Ot(r)?r:eo()).map(t=>Number(t))}function eo(){const r=new Date,e=r.getHours(),t=r.getMinutes(),n=r.getSeconds();return[e,t,n]}function to(){const t=new Date,n=t.getFullYear(),o=t.getMonth()+1,i=t.getDate(),[a,c]=N.useState(n),[u,l]=N.useState(o),f=Ie(1900,2100),p=Ie(1,12),b=N.useMemo(()=>{const B=[4,6,9,11],X=[1,3,5,7,8,10,12];return B.includes(u)?Ie(1,30):X.includes(u)?Ie(1,31):Jn(a)?Ie(1,29):Ie(1,28)},[u,a]),_=N.useMemo(()=>[f,p,b],[b]);function R(B){return(Ot(B)?B:[n,o,i]).map((D,H)=>{if(!Pr(D))return 0;const W=_[H].indexOf(D);return W!==-1?W:0})}function I(B){const[X,D]=B;c(_[0][X]),l(_[1][D])}return{dateList:_,setSelectYear:c,setSelectMonth:l,updateDateSelect:I,getDateAnchors:R}}function ro({data:r,isShowPicker:e,anchor:t,swipeTime:n,type:o,onChangeAnchor:i,onClose:a,onCancel:c,onConfirm:u}){const[l,f]=N.useState([]),[p,b]=N.useState([]),[_,R]=N.useState(!1),I=N.useRef(null),{dateList:B,setSelectYear:X,setSelectMonth:D,updateDateSelect:H,getDateAnchors:W}=to(),{timeList:v,getTimeAnchors:re}=Zn(),Q=o==="date",K=o==="time",ne=N.useMemo(()=>Q?W(t):K?re(t):st(t)?t:[t],[Q,K,t,_]);N.useEffect(()=>{pe()},[r,o,B]),N.useEffect(()=>{e&&(ie(),se(),ae())},[e]),N.useEffect(()=>{ie()},[l]),N.useEffect(()=>{ae()},[ne]);function ie(){l.forEach((T,k)=>G(k)),ee()}function pe(){const T={date:B,time:v},E=st(r[0])?[...r]:[r],x=o?T[o]:E;f(x)}function se(){!Q&&!K||(Q&&H(ne),!Ot(t)&&R(!_))}function G(T){var x;const k=(x=I.current)==null?void 0:x.children[T];if(!k)return;const E=p[T];if(E)E.refresh();else{const S=We(k,{wheel:{selectedIndex:0,rotate:25},swipeTime:n});b(w=>{const O=[...w];return O[T]=S,O}),S.on("scrollEnd",()=>J(T,S))}}function J(T,k){if(Q){if(T===2)return;const E=k.getSelectedIndex(),x=B[T][E];T===0&&X(x),T===1&&D(x)}}function ae(){setTimeout(()=>{p.forEach((T,k)=>{const E=ne[k];T.wheelTo(E??0)})})}function ee(){const T=l.length;if(p.length<=T)return;const k=p.splice(T);b(E=>E.slice(0,T)),k.forEach(E=>E.destroy())}function ce(){c==null||c(),de()}function ye(){p.some(x=>x.isInTransition)&&d();const{item:k,anchor:E}=g();u==null||u(k),i(E),de()}function de(){a()}function d(){p.forEach(T=>T.stop())}function g(){const{item:T,anchor:k}=p.reduce((E,x,S)=>{const w=x.getSelectedIndex(),O=l[S][w];return E.item.push(K?+O:O),E.anchor.push(Q?O:w),E},{item:[],anchor:[]});return T.length>1?{item:T,anchor:k}:{item:T[0],anchor:k[0]}}return{pickerData:l,wheelWrapper:I,cancel:ce,confirm:ye,closePicker:de}}const no={cancelClass:"",confirmClass:"",titleClass:"",cancelColor:"#999",confirmColor:"#42b983",titleColor:"",cancelText:"Cancel",confirmText:"Confirm",titleText:""},oo=[],io={};function so({data:r=oo,isShowPicker:e,options:t=io,anchor:n,showKey:o="",swipeTime:i=500,type:a="",onChangeAnchor:c,onClose:u,onCancel:l,onConfirm:f}){const p=N.useRef(null),b=N.useRef(null),{pickerData:_,wheelWrapper:R,cancel:I,confirm:B,closePicker:X}=ro({data:r,isShowPicker:e,options:t,anchor:n,showKey:o,swipeTime:i,type:a,onClose:u,onChangeAnchor:c,onCancel:l,onConfirm:f}),D=N.useMemo(()=>({...no,...t}),[t]),H=D.cancelColor,W=D.confirmColor,v=D.titleColor,re=N.useMemo(()=>st(o)?o:[o],[o]);function Q(K){p.current&&p.current.style.setProperty("display",K)}return V.jsxs("div",{children:[V.jsx(Ke,{in:e,classNames:"fade",timeout:300,nodeRef:b,unmountOnExit:!0,children:V.jsx("div",{ref:b,role:"presentation",className:"mask",onClick:X,onKeyDown:K=>{K.key==="Escape"&&X()}})}),V.jsx(Ke,{in:e,classNames:"slide",timeout:300,nodeRef:p,onEnter:()=>Q(""),onExited:()=>Q("none"),children:V.jsxs("div",{ref:p,className:"picker",style:{display:"none"},children:[V.jsxs("div",{className:"picker_title",children:[V.jsx("button",{className:`picker_cancel ${D.cancelClass}`,style:{color:H},onClick:I,children:D.cancelText}),V.jsx("button",{className:`picker_confirm ${D.confirmClass}`,style:{color:W},onClick:B,children:D.confirmText}),V.jsx("h4",{className:D.titleClass,style:{color:v},children:D.titleText})]}),V.jsxs("div",{className:"picker_panel",children:[V.jsx("div",{className:"picker_mask_top"}),V.jsx("div",{className:"picker_mask_bottom"}),V.jsx("div",{ref:R,className:"picker_wheel_wrapper",children:_.map((K,ne)=>V.jsx("div",{className:"picker_wheel",children:V.jsx("ul",{className:"picker_wheel_scroll",children:K.map((ie,pe)=>{const se=re[ne]&&Gn(ie)?ie[re[ne]]:ie;return!Kn(se)&&!Pr(se)?null:V.jsx("li",{className:"picker_wheel_item",children:se},pe)})})},ne))})]})]})})]})}return so});
|
|
71
|
+
*/var ze=typeof window<"u",ot=ze&&navigator.userAgent.toLowerCase();ot&&ot.indexOf("android")>0,function(){if(typeof ot=="string"){var r=/os (\d\d?_\d(_\d)?)/,e=r.exec(ot);if(!e)return!1;var t=e[1].split("_").map(function(n){return parseInt(n,10)});return t[0]===13&&t[1]>=4}return!1}();var jn=!1;if(ze){var Nn="test-passive";try{var kr={};Object.defineProperty(kr,"passive",{get:function(){jn=!0}}),window.addEventListener(Nn,function(){},kr)}catch{}}var Ln=function(r,e){for(var t in e)r[t]=e[t];return r},Sr=ze&&document.createElement("div").style,Me=function(){if(!ze)return!1;for(var r=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],e=0,t=r;e<t.length;e++){var n=t[e];if(Sr[n.value]!==void 0)return n.key}return!1}();function me(r){return Me===!1?r:Me==="standard"?r==="transitionEnd"?"transitionend":r:Me+r.charAt(0).toUpperCase()+r.substr(1)}Me&&Me!=="standard"&&""+Me.toLowerCase();var $n=me("transform"),Fn=me("transition");ze&&me("perspective")in Sr;var _t={transform:$n,transition:Fn,transitionTimingFunction:me("transitionTimingFunction"),transitionDuration:me("transitionDuration"),transitionDelay:me("transitionDelay"),transformOrigin:me("transformOrigin"),transitionEnd:me("transitionEnd"),transitionProperty:me("transitionProperty")};function it(r,e){var t=new RegExp("(^|\\s)"+e+"(\\s|$)");return t.test(r.className)}function Xn(r){return Array.prototype.slice.call(r,0)}var Wn={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(r){return 1+--r*r*r*r*r}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(r){return r*(2-r)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(r){return 1- --r*r*r*r}}},zn="plugins.wheel",Hn=[{key:"wheelTo",name:"wheelTo"},{key:"getSelectedIndex",name:"getSelectedIndex"},{key:"restorePosition",name:"restorePosition"}],Un=Hn.map(function(r){return{key:r.key,sourceKey:zn+"."+r.name}}),xr="wheelIndexChanged",qn={rate:4},Vn=function(){function r(e){this.scroll=e,this.init()}return r.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.refreshBoundary(),this.setSelectedIndex(this.options.selectedIndex)},r.prototype.handleBScroll=function(){this.scroll.proxy(Un),this.scroll.registerType([xr])},r.prototype.handleOptions=function(){var e=this.scroll.options.wheel===!0?{}:this.scroll.options.wheel,t={wheelWrapperClass:"wheel-scroll",wheelItemClass:"wheel-item",rotate:25,adjustTime:400,selectedIndex:0,wheelDisabledItemClass:"wheel-disabled-item"};this.options=Ln(t,e)},r.prototype.handleHooks=function(){var e=this,t=this.scroll,n=this.scroll.scroller,o=n.actionsHandler,i=n.scrollBehaviorX,a=n.scrollBehaviorY,c=n.animater,u=n.content;t.on(t.eventTypes.scrollEnd,function(l){var f=e.findNearestValidWheel(l.y).index;if(n.animater.forceStopped&&!e.isAdjustingPosition)return e.target=e.items[f],!0;e.setSelectedIndex(f),e.isAdjustingPosition&&(e.isAdjustingPosition=!1)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.refresh,function(l){l!==u&&(u=l,e.setSelectedIndex(e.options.selectedIndex,!0)),e.rotateX(e.scroll.y),e.wheelTo(e.selectedIndex,0)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(l){l.x=0,l.y=-(e.selectedIndex*e.itemHeight)}),n.hooks.on(n.hooks.eventTypes.checkClick,function(){var l=Xn(e.items).indexOf(e.target);return l===-1||e.wheelTo(l,e.options.adjustTime,Wn.swipe),!0}),n.hooks.on(n.hooks.eventTypes.scrollTo,function(l){l.y=e.findNearestValidWheel(l.y).y}),n.hooks.on(n.hooks.eventTypes.minDistanceScroll,function(){var l=n.animater;l.forceStopped===!0&&(l.forceStopped=!1)}),n.hooks.on(n.hooks.eventTypes.scrollToElement,function(l,f){if(it(l,e.options.wheelItemClass))f.top=e.findNearestValidWheel(f.top).y;else return!0}),o.hooks.on(o.hooks.eventTypes.beforeStart,function(l){e.target=l.target}),i.hooks.on(i.hooks.eventTypes.computeBoundary,function(l){l.maxScrollPos=0,l.minScrollPos=0}),a.hooks.on(a.hooks.eventTypes.computeBoundary,function(l){e.items=e.scroll.scroller.content.children,e.checkWheelAllDisabled(),e.itemHeight=e.items.length>0?a.contentSize/e.items.length:0,l.maxScrollPos=-e.itemHeight*(e.items.length-1),l.minScrollPos=0}),a.hooks.on(a.hooks.eventTypes.momentum,function(l){l.rate=qn.rate,l.destination=e.findNearestValidWheel(l.destination).y}),a.hooks.on(a.hooks.eventTypes.end,function(l){var f=e.findNearestValidWheel(a.currentPos);l.destination=f.y,l.duration=e.options.adjustTime}),c.hooks.on(c.hooks.eventTypes.time,function(l){e.transitionDuration(l)}),c.hooks.on(c.hooks.eventTypes.timeFunction,function(l){e.timeFunction(l)}),c.hooks.on(c.hooks.eventTypes.callStop,function(){var l=e.findNearestValidWheel(e.scroll.y).index;e.isAdjustingPosition=!0,e.wheelTo(l,0)}),c.translater.hooks.on(c.translater.hooks.eventTypes.translate,function(l){e.rotateX(l.y)})},r.prototype.refreshBoundary=function(){var e=this.scroll.scroller,t=e.scrollBehaviorX,n=e.scrollBehaviorY,o=e.content;t.refresh(o),n.refresh(o)},r.prototype.setSelectedIndex=function(e,t){t===void 0&&(t=!1);var n=this.selectedIndex;this.selectedIndex=e,n!==e&&!t&&this.scroll.trigger(xr,e)},r.prototype.getSelectedIndex=function(){return this.selectedIndex},r.prototype.wheelTo=function(e,t,n){e===void 0&&(e=0),t===void 0&&(t=0);var o=-e*this.itemHeight;this.scroll.scrollTo(0,o,t,n)},r.prototype.restorePosition=function(){var e=this.scroll.pending;if(e){var t=this.getSelectedIndex();this.scroll.scroller.animater.clearTimer(),this.wheelTo(t,0)}},r.prototype.transitionDuration=function(e){for(var t=0;t<this.items.length;t++)this.items[t].style[_t.transitionDuration]=e+"ms"},r.prototype.timeFunction=function(e){for(var t=0;t<this.items.length;t++)this.items[t].style[_t.transitionTimingFunction]=e},r.prototype.rotateX=function(e){for(var t=this.options.rotate,n=t===void 0?25:t,o=0;o<this.items.length;o++){var i=n*(e/this.itemHeight+o),a=i.toFixed(3);this.items[o].style[_t.transform]="rotateX("+a+"deg)"}},r.prototype.findNearestValidWheel=function(e){e=e>0?0:e<this.scroll.maxScrollY?this.scroll.maxScrollY:e;for(var t=Math.abs(Math.round(-e/this.itemHeight)),n=t,o=this.items,i=this.options.wheelDisabledItemClass;t>=0&&it(o[t],i);)t--;if(t<0)for(t=n;t<=o.length-1&&it(o[t],i);)t++;return t===o.length&&(t=n),{index:this.wheelItemsAllDisabled?-1:t,y:-t*this.itemHeight}},r.prototype.checkWheelAllDisabled=function(){var e=this.options.wheelDisabledItemClass,t=this.items;this.wheelItemsAllDisabled=!0;for(var n=0;n<t.length;n++)if(!it(t[n],e)){this.wheelItemsAllDisabled=!1;break}},r.pluginName="wheel",r}();Bn.use(Vn);const st=Array.isArray,Kn=r=>typeof r=="string",Pr=r=>typeof r=="number",Gn=r=>typeof r=="object"&&r!==null;function Ot(r){return st(r)&&r.length===3}function Jn(r){return r%4===0&&(r%100!==0||r%400===0)}function Ie(r,e){const t=[];for(let n=r;n<=e;n++)t.push(n);return t}function Rt(r,e){const t=[];for(let n=r;n<=e;n++)t.push(`${n}`.padStart(2,"0"));return t}function Zn(){const r=Rt(0,23),e=Rt(0,59),t=Rt(0,59);return{timeList:[r,e,t],getTimeAnchors:Qn}}function Qn(r){return(Ot(r)?r:eo()).map(t=>Number(t))}function eo(){const r=new Date,e=r.getHours(),t=r.getMinutes(),n=r.getSeconds();return[e,t,n]}function to(){const t=new Date,n=t.getFullYear(),o=t.getMonth()+1,i=t.getDate(),[a,c]=N.useState(n),[u,l]=N.useState(o),f=Ie(1900,2100),p=Ie(1,12),b=N.useMemo(()=>{const B=[4,6,9,11],X=[1,3,5,7,8,10,12];return B.includes(u)?Ie(1,30):X.includes(u)?Ie(1,31):Jn(a)?Ie(1,29):Ie(1,28)},[u,a]),_=N.useMemo(()=>[f,p,b],[b]);function R(B){return(Ot(B)?B:[n,o,i]).map((D,H)=>{if(!Pr(D))return 0;const W=_[H].indexOf(D);return W!==-1?W:0})}function I(B){const[X,D]=B;c(_[0][X]),l(_[1][D])}return{dateList:_,setSelectYear:c,setSelectMonth:l,updateDateSelect:I,getDateAnchors:R}}function ro({data:r,isShowPicker:e,anchor:t,swipeTime:n,type:o,onChangeAnchor:i,onClose:a,onCancel:c,onConfirm:u}){const[l,f]=N.useState([]),[p,b]=N.useState([]),[_,R]=N.useState(!1),I=N.useRef(null),{dateList:B,setSelectYear:X,setSelectMonth:D,updateDateSelect:H,getDateAnchors:W}=to(),{timeList:v,getTimeAnchors:re}=Zn(),Q=o==="date",K=o==="time",ne=N.useMemo(()=>Q?W(t):K?re(t):st(t)?t:[t],[Q,K,t,_]);N.useEffect(()=>{pe()},[r,o,B]),N.useEffect(()=>{e&&(ie(),se(),ae())},[e]),N.useEffect(()=>{ie()},[l]),N.useEffect(()=>{ae()},[ne]);function ie(){l.forEach((T,k)=>G(k)),ee()}function pe(){const T={date:B,time:v},E=st(r[0])?[...r]:[r],x=o?T[o]:E;f(x)}function se(){!Q&&!K||(Q&&H(ne),!Ot(t)&&R(!_))}function G(T){var x;const k=(x=I.current)==null?void 0:x.children[T];if(!k)return;const E=p[T];if(E)E.refresh();else{const S=We(k,{wheel:{selectedIndex:0,rotate:25},swipeTime:n});b(w=>{const O=[...w];return O[T]=S,O}),S.on("scrollEnd",()=>J(T,S))}}function J(T,k){if(Q){if(T===2)return;const E=k.getSelectedIndex(),x=B[T][E];T===0&&X(x),T===1&&D(x)}}function ae(){setTimeout(()=>{p.forEach((T,k)=>{const E=ne[k];T.wheelTo(E??0)})})}function ee(){const T=l.length;if(p.length<=T)return;const k=p.splice(T);b(E=>E.slice(0,T)),k.forEach(E=>E.destroy())}function ce(){c==null||c(),de()}function ye(){p.some(x=>x.isInTransition)&&d();const{item:k,anchor:E}=g();u==null||u(k),i(E),de()}function de(){a()}function d(){p.forEach(T=>T.stop())}function g(){const{item:T,anchor:k}=p.reduce((E,x,S)=>{const w=x.getSelectedIndex(),O=l[S][w];return E.item.push(K?+O:O),E.anchor.push(Q?O:w),E},{item:[],anchor:[]});return T.length>1?{item:T,anchor:k}:{item:T[0],anchor:k[0]}}return{pickerData:l,wheelWrapper:I,cancel:ce,confirm:ye,closePicker:de}}const no={cancelClass:"",confirmClass:"",titleClass:"",cancelColor:"#999",confirmColor:"#42b983",titleColor:"",cancelText:"Cancel",confirmText:"Confirm",titleText:""},oo=[],io={};function so({data:r=oo,isShowPicker:e,options:t=io,anchor:n,showKey:o="",swipeTime:i=500,type:a="",onChangeAnchor:c,onClose:u,onCancel:l,onConfirm:f}){const p=N.useRef(null),b=N.useRef(null),{pickerData:_,wheelWrapper:R,cancel:I,confirm:B,closePicker:X}=ro({data:r,isShowPicker:e,options:t,anchor:n,showKey:o,swipeTime:i,type:a,onClose:u,onChangeAnchor:c,onCancel:l,onConfirm:f}),D=N.useMemo(()=>({...no,...t}),[t]),H=D.cancelColor,W=D.confirmColor,v=D.titleColor,re=N.useMemo(()=>st(o)?o:[o],[o]);function Q(K){p.current&&p.current.style.setProperty("display",K)}return V.jsxs("div",{children:[V.jsx(Ke,{in:e,classNames:"component-hook-picker-fade",timeout:300,nodeRef:b,unmountOnExit:!0,children:V.jsx("div",{ref:b,role:"presentation",className:"component-hook-picker-mask",onClick:X,onKeyDown:K=>{K.key==="Escape"&&X()}})}),V.jsx(Ke,{in:e,classNames:"component-hook-picker-slide",timeout:300,nodeRef:p,onEnter:()=>Q(""),onExited:()=>Q("none"),children:V.jsxs("div",{ref:p,className:"component-hook-picker",style:{display:"none"},children:[V.jsxs("div",{className:"component-hook-picker_title",children:[V.jsx("button",{className:`component-hook-picker_cancel ${D.cancelClass}`,style:{color:H},onClick:I,children:D.cancelText}),V.jsx("button",{className:`component-hook-picker_confirm ${D.confirmClass}`,style:{color:W},onClick:B,children:D.confirmText}),V.jsx("h4",{className:D.titleClass,style:{color:v},children:D.titleText})]}),V.jsxs("div",{className:"component-hook-picker_panel",children:[V.jsx("div",{className:"component-hook-picker_mask_top"}),V.jsx("div",{className:"component-hook-picker_mask_bottom"}),V.jsx("div",{ref:R,className:"component-hook-picker_wheel_wrapper",children:_.map((K,ne)=>V.jsx("div",{className:"component-hook-picker_wheel",children:V.jsx("ul",{className:"component-hook-picker_wheel_scroll",children:K.map((ie,pe)=>{const se=re[ne]&&Gn(ie)?ie[re[ne]]:ie;return!Kn(se)&&!Pr(se)?null:V.jsx("li",{className:"component-hook-picker_wheel_item",children:se},pe)})})},ne))})]})]})})]})}return so});
|
package/dist/vue/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#0003}.picker{position:fixed;left:0;right:0;bottom:0;height:270px;z-index:10000;background:#fff;-webkit-user-select:none;user-select:none}.picker_title{position:relative;height:44px;color:#333}.picker_title:after{content:"";display:block;border-bottom:1px solid #ebebeb;left:0;right:0;transform:scaleY(.5)}.picker_title button{position:absolute;height:44px;line-height:44px;padding:0 12px;font-size:14px;border:none;background-color:transparent}.picker_title h4{margin:0;font-size:16px;font-weight:400;height:44px;line-height:44px;text-align:center}.picker_cancel{left:0;cursor:pointer;transition:all .3s}.picker_cancel:hover{filter:brightness(110%)}.picker_confirm{right:0;cursor:pointer;transition:all .3s}.picker_confirm:hover{filter:brightness(110%)}.picker_panel{position:relative;height:226px;padding:24px 12px;box-sizing:border-box}.picker_mask_top,.picker_mask_bottom{position:absolute;left:0;right:0;height:72px;background:#fff;transform:translateZ(0);z-index:1;pointer-events:none}.picker_mask_top{top:24px;background:linear-gradient(to bottom,#ffffffe6,#ffffff80)}.picker_mask_top:after{content:"";display:block;position:absolute;left:0;right:0;bottom:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.picker_mask_bottom{bottom:24px;background:linear-gradient(to top,#ffffffe6,#ffffff80)}.picker_mask_bottom:before{content:"";display:block;position:absolute;left:0;right:0;top:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.picker_wheel{flex:1;overflow:hidden}.picker_wheel_wrapper{display:flex;align-items:stretch;height:100%}.picker_wheel_scroll{margin-top:72px;padding:0}.picker_wheel_item{height:34px;line-height:34px;font-size:17px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#333}.fade-enter-active,.fade-leave-active,.slide-enter-active,.slide-leave-active{transition:all .3s ease}.fade-enter-from,.fade-leave-to{opacity:0}.slide-enter-from,.slide-leave-to{opacity:.5;transform:translate3d(0,270px,0)}
|
|
1
|
+
.component-hook-picker-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#0003}.component-hook-picker{position:fixed;left:0;right:0;bottom:0;height:270px;z-index:10000;background:#fff;-webkit-user-select:none;user-select:none}.component-hook-picker_title{position:relative;height:44px;color:#333}.component-hook-picker_title:after{content:"";display:block;border-bottom:1px solid #ebebeb;left:0;right:0;transform:scaleY(.5)}.component-hook-picker_title button{position:absolute;height:44px;line-height:44px;padding:0 12px;font-size:14px;border:none;background-color:transparent}.component-hook-picker_title button:hover{background-color:transparent}.component-hook-picker_title h4{margin:0;font-size:16px;font-weight:400;height:44px;line-height:44px;text-align:center}.component-hook-picker_cancel{left:0;cursor:pointer;transition:all .3s}.component-hook-picker_cancel:hover{filter:brightness(110%)}.component-hook-picker_confirm{right:0;cursor:pointer;transition:all .3s}.component-hook-picker_confirm:hover{filter:brightness(110%)}.component-hook-picker_panel{position:relative;height:226px;padding:24px 12px;box-sizing:border-box}.component-hook-picker_mask_top,.component-hook-picker_mask_bottom{position:absolute;left:0;right:0;height:72px;background:#fff;transform:translateZ(0);z-index:1;pointer-events:none}.component-hook-picker_mask_top{top:24px;background:linear-gradient(to bottom,#ffffffe6,#ffffff80)}.component-hook-picker_mask_top:after{content:"";display:block;position:absolute;left:0;right:0;bottom:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.component-hook-picker_mask_bottom{bottom:24px;background:linear-gradient(to top,#ffffffe6,#ffffff80)}.component-hook-picker_mask_bottom:before{content:"";display:block;position:absolute;left:0;right:0;top:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.component-hook-picker_wheel{flex:1;overflow:hidden}.component-hook-picker_wheel_wrapper{display:flex;align-items:stretch;height:100%}.component-hook-picker_wheel_scroll{margin-top:72px;padding:0}.component-hook-picker_wheel_item{height:34px;line-height:34px;font-size:17px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#333}.component-hook-picker-fade-enter-active,.component-hook-picker-fade-leave-active,.component-hook-picker-slide-enter-active,.component-hook-picker-slide-leave-active{transition:all .3s ease}.component-hook-picker-fade-enter-from,.component-hook-picker-fade-leave-to{opacity:0}.component-hook-picker-slide-enter-from,.component-hook-picker-slide-leave-to{opacity:.5;transform:translate3d(0,270px,0)}
|
package/dist/vue/picker.es.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { ComponentProvideOptions } from 'vue';
|
|
|
3
3
|
import { DefineComponent } from 'vue';
|
|
4
4
|
import { PublicProps } from 'vue';
|
|
5
5
|
|
|
6
|
-
declare
|
|
6
|
+
declare type __VLS_Props = PickerComponentProps;
|
|
7
|
+
|
|
8
|
+
declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
7
9
|
"update:isShowPicker": (...args: any[]) => void;
|
|
8
10
|
"update:anchor": (...args: any[]) => void;
|
|
9
11
|
cancel: (...args: any[]) => void;
|
|
10
12
|
confirm: (...args: any[]) => void;
|
|
11
|
-
}, string, PublicProps, Readonly<
|
|
13
|
+
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
14
|
"onUpdate:isShowPicker"?: ((...args: any[]) => any) | undefined;
|
|
13
15
|
"onUpdate:anchor"?: ((...args: any[]) => any) | undefined;
|
|
14
16
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
@@ -19,7 +21,7 @@ options: Partial<PickerOptions>;
|
|
|
19
21
|
type: PickerBuiltIn;
|
|
20
22
|
data: PickerData;
|
|
21
23
|
showKey: string | Array<string>;
|
|
22
|
-
}, {}, {}, {}, string, ComponentProvideOptions, false, {},
|
|
24
|
+
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
23
25
|
export default _default;
|
|
24
26
|
|
|
25
27
|
declare type EmitKey = 'update:isShowPicker' | 'update:anchor' | 'cancel' | 'confirm';
|
package/dist/vue/picker.es.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "./index.css";
|
|
2
1
|
import { ref as L, computed as b, watch as ht, nextTick as ne, defineComponent as se, openBlock as W, createElementBlock as z, createVNode as Pt, Transition as Et, withCtx as Ct, withDirectives as Dt, createElementVNode as S, unref as D, vShow as Bt, normalizeClass as ct, normalizeStyle as ut, toDisplayString as j, Fragment as xt, renderList as At } from "vue";
|
|
3
2
|
/*!
|
|
4
3
|
* better-scroll / core
|
|
@@ -1782,7 +1781,7 @@ const ro = {
|
|
|
1782
1781
|
cancelText: "Cancel",
|
|
1783
1782
|
confirmText: "Confirm",
|
|
1784
1783
|
titleText: ""
|
|
1785
|
-
}, io = { class: "picker" }, no = { class: "picker_title" }, so = { class: "picker_panel" }, ao = { class: "picker_wheel_scroll" }, ho = /* @__PURE__ */ se({
|
|
1784
|
+
}, io = { class: "component-hook-picker" }, no = { class: "component-hook-picker_title" }, so = { class: "component-hook-picker_panel" }, ao = { class: "component-hook-picker_wheel_scroll" }, ho = /* @__PURE__ */ se({
|
|
1786
1785
|
__name: "Picker",
|
|
1787
1786
|
props: {
|
|
1788
1787
|
data: { default: () => [] },
|
|
@@ -1797,10 +1796,10 @@ const ro = {
|
|
|
1797
1796
|
setup(o, { emit: t }) {
|
|
1798
1797
|
const e = o, r = t, i = b(() => ({ ...ro, ...e.options })), n = b(() => i.value.cancelColor), s = b(() => i.value.confirmColor), l = b(() => i.value.titleColor), h = b(() => ot(e.showKey) ? e.showKey : [e.showKey]), { pickerData: a, wheelWrapper: c, cancel: u, confirm: v, closePicker: g } = oo(e, r);
|
|
1799
1798
|
return (f, d) => (W(), z("div", null, [
|
|
1800
|
-
Pt(Et, { name: "fade" }, {
|
|
1799
|
+
Pt(Et, { name: "component-hook-picker-fade" }, {
|
|
1801
1800
|
default: Ct(() => [
|
|
1802
1801
|
Dt(S("div", {
|
|
1803
|
-
class: "mask",
|
|
1802
|
+
class: "component-hook-picker-mask",
|
|
1804
1803
|
onClick: d[0] || (d[0] = //@ts-ignore
|
|
1805
1804
|
(...y) => D(g) && D(g)(...y))
|
|
1806
1805
|
}, null, 512), [
|
|
@@ -1809,18 +1808,18 @@ const ro = {
|
|
|
1809
1808
|
]),
|
|
1810
1809
|
_: 1
|
|
1811
1810
|
}),
|
|
1812
|
-
Pt(Et, { name: "slide" }, {
|
|
1811
|
+
Pt(Et, { name: "component-hook-picker-slide" }, {
|
|
1813
1812
|
default: Ct(() => [
|
|
1814
1813
|
Dt(S("div", io, [
|
|
1815
1814
|
S("div", no, [
|
|
1816
1815
|
S("button", {
|
|
1817
|
-
class: ct(["picker_cancel", i.value.cancelClass]),
|
|
1816
|
+
class: ct(["component-hook-picker_cancel", i.value.cancelClass]),
|
|
1818
1817
|
style: ut({ color: n.value }),
|
|
1819
1818
|
onClick: d[1] || (d[1] = //@ts-ignore
|
|
1820
1819
|
(...y) => D(u) && D(u)(...y))
|
|
1821
1820
|
}, j(i.value.cancelText), 7),
|
|
1822
1821
|
S("button", {
|
|
1823
|
-
class: ct(["picker_confirm", i.value.confirmClass]),
|
|
1822
|
+
class: ct(["component-hook-picker_confirm", i.value.confirmClass]),
|
|
1824
1823
|
style: ut({ color: s.value }),
|
|
1825
1824
|
onClick: d[2] || (d[2] = //@ts-ignore
|
|
1826
1825
|
(...y) => D(v) && D(v)(...y))
|
|
@@ -1831,23 +1830,23 @@ const ro = {
|
|
|
1831
1830
|
}, j(i.value.titleText), 7)
|
|
1832
1831
|
]),
|
|
1833
1832
|
S("div", so, [
|
|
1834
|
-
d[3] || (d[3] = S("div", { class: "picker_mask_top" }, null, -1)),
|
|
1835
|
-
d[4] || (d[4] = S("div", { class: "picker_mask_bottom" }, null, -1)),
|
|
1833
|
+
d[3] || (d[3] = S("div", { class: "component-hook-picker_mask_top" }, null, -1)),
|
|
1834
|
+
d[4] || (d[4] = S("div", { class: "component-hook-picker_mask_bottom" }, null, -1)),
|
|
1836
1835
|
S("div", {
|
|
1837
1836
|
ref_key: "wheelWrapper",
|
|
1838
1837
|
ref: c,
|
|
1839
|
-
class: "picker_wheel_wrapper"
|
|
1838
|
+
class: "component-hook-picker_wheel_wrapper"
|
|
1840
1839
|
}, [
|
|
1841
1840
|
(W(!0), z(xt, null, At(D(a), (y, A) => (W(), z("div", {
|
|
1842
1841
|
key: A,
|
|
1843
|
-
class: "picker_wheel"
|
|
1842
|
+
class: "component-hook-picker_wheel"
|
|
1844
1843
|
}, [
|
|
1845
1844
|
S("ul", ao, [
|
|
1846
1845
|
(W(!0), z(xt, null, At(y, (P, nt) => {
|
|
1847
1846
|
var $;
|
|
1848
1847
|
return W(), z("li", {
|
|
1849
1848
|
key: nt,
|
|
1850
|
-
class: "picker_wheel_item"
|
|
1849
|
+
class: "component-hook-picker_wheel_item"
|
|
1851
1850
|
}, j(($ = h.value) != null && $[A] && D(Je)(P) ? P[h.value[A]] : P), 1);
|
|
1852
1851
|
}), 128))
|
|
1853
1852
|
])
|
package/dist/vue/picker.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(c,M){typeof exports=="object"&&typeof module<"u"?module.exports=M(require("vue")):typeof define=="function"&&define.amd?define(["vue"],M):(c=typeof globalThis<"u"?globalThis:c||self,c.picker=M(c.Vue))})(this,function(c){"use strict";var M=document.createElement("style");M.textContent=`.mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#0003}.picker{position:fixed;left:0;right:0;bottom:0;height:270px;z-index:10000;background:#fff;-webkit-user-select:none;user-select:none}.picker_title{position:relative;height:44px;color:#333}.picker_title:after{content:"";display:block;border-bottom:1px solid #ebebeb;left:0;right:0;transform:scaleY(.5)}.picker_title button{position:absolute;height:44px;line-height:44px;padding:0 12px;font-size:14px;border:none;background-color:transparent}.picker_title h4{margin:0;font-size:16px;font-weight:400;height:44px;line-height:44px;text-align:center}.picker_cancel{left:0;cursor:pointer;transition:all .3s}.picker_cancel:hover{filter:brightness(110%)}.picker_confirm{right:0;cursor:pointer;transition:all .3s}.picker_confirm:hover{filter:brightness(110%)}.picker_panel{position:relative;height:226px;padding:24px 12px;box-sizing:border-box}.picker_mask_top,.picker_mask_bottom{position:absolute;left:0;right:0;height:72px;background:#fff;transform:translateZ(0);z-index:1;pointer-events:none}.picker_mask_top{top:24px;background:linear-gradient(to bottom,#ffffffe6,#ffffff80)}.picker_mask_top:after{content:"";display:block;position:absolute;left:0;right:0;bottom:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.picker_mask_bottom{bottom:24px;background:linear-gradient(to top,#ffffffe6,#ffffff80)}.picker_mask_bottom:before{content:"";display:block;position:absolute;left:0;right:0;top:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.picker_wheel{flex:1;overflow:hidden}.picker_wheel_wrapper{display:flex;align-items:stretch;height:100%}.picker_wheel_scroll{margin-top:72px;padding:0}.picker_wheel_item{height:34px;line-height:34px;font-size:17px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#333}.fade-enter-active,.fade-leave-active,.slide-enter-active,.slide-leave-active{transition:all .3s ease}.fade-enter-from,.fade-leave-to{opacity:0}.slide-enter-from,.slide-leave-to{opacity:.5;transform:translate3d(0,270px,0)}
|
|
1
|
+
(function(c,M){typeof exports=="object"&&typeof module<"u"?module.exports=M(require("vue")):typeof define=="function"&&define.amd?define(["vue"],M):(c=typeof globalThis<"u"?globalThis:c||self,c.picker=M(c.Vue))})(this,function(c){"use strict";var M=document.createElement("style");M.textContent=`.component-hook-picker-mask{position:fixed;top:0;right:0;bottom:0;left:0;z-index:9999;background:#0003}.component-hook-picker{position:fixed;left:0;right:0;bottom:0;height:270px;z-index:10000;background:#fff;-webkit-user-select:none;user-select:none}.component-hook-picker_title{position:relative;height:44px;color:#333}.component-hook-picker_title:after{content:"";display:block;border-bottom:1px solid #ebebeb;left:0;right:0;transform:scaleY(.5)}.component-hook-picker_title button{position:absolute;height:44px;line-height:44px;padding:0 12px;font-size:14px;border:none;background-color:transparent}.component-hook-picker_title button:hover{background-color:transparent}.component-hook-picker_title h4{margin:0;font-size:16px;font-weight:400;height:44px;line-height:44px;text-align:center}.component-hook-picker_cancel{left:0;cursor:pointer;transition:all .3s}.component-hook-picker_cancel:hover{filter:brightness(110%)}.component-hook-picker_confirm{right:0;cursor:pointer;transition:all .3s}.component-hook-picker_confirm:hover{filter:brightness(110%)}.component-hook-picker_panel{position:relative;height:226px;padding:24px 12px;box-sizing:border-box}.component-hook-picker_mask_top,.component-hook-picker_mask_bottom{position:absolute;left:0;right:0;height:72px;background:#fff;transform:translateZ(0);z-index:1;pointer-events:none}.component-hook-picker_mask_top{top:24px;background:linear-gradient(to bottom,#ffffffe6,#ffffff80)}.component-hook-picker_mask_top:after{content:"";display:block;position:absolute;left:0;right:0;bottom:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.component-hook-picker_mask_bottom{bottom:24px;background:linear-gradient(to top,#ffffffe6,#ffffff80)}.component-hook-picker_mask_bottom:before{content:"";display:block;position:absolute;left:0;right:0;top:0;border-bottom:1px solid #ebebeb;transform:scaleY(.5)}.component-hook-picker_wheel{flex:1;overflow:hidden}.component-hook-picker_wheel_wrapper{display:flex;align-items:stretch;height:100%}.component-hook-picker_wheel_scroll{margin-top:72px;padding:0}.component-hook-picker_wheel_item{height:34px;line-height:34px;font-size:17px;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#333}.component-hook-picker-fade-enter-active,.component-hook-picker-fade-leave-active,.component-hook-picker-slide-enter-active,.component-hook-picker-slide-leave-active{transition:all .3s ease}.component-hook-picker-fade-enter-from,.component-hook-picker-fade-leave-to{opacity:0}.component-hook-picker-slide-enter-from,.component-hook-picker-slide-leave-to{opacity:.5;transform:translate3d(0,270px,0)}
|
|
2
2
|
/*$vite$:1*/`,document.head.appendChild(M);/*!
|
|
3
3
|
* better-scroll / core
|
|
4
4
|
* (c) 2016-2023 ustbhuangyi
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
17
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
18
|
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */var tt=function(o,t){return tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},tt(o,t)};function W(o,t){tt(o,t);function e(){this.constructor=o}o.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var z=function(){return z=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},z.apply(this,arguments)};function vt(){for(var o=0,t=0,e=arguments.length;t<e;t++)o+=arguments[t].length;for(var r=Array(o),i=0,t=0;t<e;t++)for(var n=arguments[t],s=0,l=n.length;s<l;s++,i++)r[i]=n[s];return r}var zt=[{sourceKey:"scroller.scrollBehaviorX.currentPos",key:"x"},{sourceKey:"scroller.scrollBehaviorY.currentPos",key:"y"},{sourceKey:"scroller.scrollBehaviorX.hasScroll",key:"hasHorizontalScroll"},{sourceKey:"scroller.scrollBehaviorY.hasScroll",key:"hasVerticalScroll"},{sourceKey:"scroller.scrollBehaviorX.contentSize",key:"scrollerWidth"},{sourceKey:"scroller.scrollBehaviorY.contentSize",key:"scrollerHeight"},{sourceKey:"scroller.scrollBehaviorX.maxScrollPos",key:"maxScrollX"},{sourceKey:"scroller.scrollBehaviorY.maxScrollPos",key:"maxScrollY"},{sourceKey:"scroller.scrollBehaviorX.minScrollPos",key:"minScrollX"},{sourceKey:"scroller.scrollBehaviorY.minScrollPos",key:"minScrollY"},{sourceKey:"scroller.scrollBehaviorX.movingDirection",key:"movingDirectionX"},{sourceKey:"scroller.scrollBehaviorY.movingDirection",key:"movingDirectionY"},{sourceKey:"scroller.scrollBehaviorX.direction",key:"directionX"},{sourceKey:"scroller.scrollBehaviorY.direction",key:"directionY"},{sourceKey:"scroller.actions.enabled",key:"enabled"},{sourceKey:"scroller.animater.pending",key:"pending"},{sourceKey:"scroller.animater.stop",key:"stop"},{sourceKey:"scroller.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];function K(o){console.error("[BScroll warn]: "+o)}var S=typeof window<"u",X=S&&navigator.userAgent.toLowerCase(),Ht=!!(X&&/wechatdevtools/.test(X)),Nt=X&&X.indexOf("android")>0,Ft=function(){if(typeof X=="string"){var o=/os (\d\d?_\d(_\d)?)/,t=o.exec(X);if(!t)return!1;var e=t[1].split("_").map(function(r){return parseInt(r,10)});return e[0]===13&&e[1]>=4}return!1}(),mt=!1;if(S){var Wt="test-passive";try{var yt={};Object.defineProperty(yt,"passive",{get:function(){mt=!0}}),window.addEventListener(Wt,function(){},yt)}catch{}}function D(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var et=function(o,t){for(var e in t)o[e]=t[e];return o};function ot(o){return o==null}function gt(o,t,e){return o<t?t:o>e?e:o}var rt=S&&document.createElement("div").style,O=function(){if(!S)return!1;for(var o=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],t=0,e=o;t<e.length;t++){var r=e[t];if(rt[r.value]!==void 0)return r.key}return!1}();function w(o){return O===!1?o:O==="standard"?o==="transitionEnd"?"transitionend":o:O+o.charAt(0).toUpperCase()+o.substr(1)}function kt(o){return typeof o=="string"?document.querySelector(o):o}function Kt(o,t,e,r){var i=mt?{passive:!1,capture:!!r}:!!r;o.addEventListener(t,e,i)}function Rt(o,t,e,r){o.removeEventListener(t,e,{capture:!!r})}function Tt(o){o.cancelable&&o.preventDefault()}function bt(o){for(var t=0,e=0;o;)t-=o.offsetLeft,e-=o.offsetTop,o=o.offsetParent;return{left:t,top:e}}O&&O!=="standard"&&""+O.toLowerCase();var Vt=w("transform"),St=w("transition"),$t=S&&w("perspective")in rt,wt=S&&("ontouchstart"in window||Ht),jt=S&&St in rt,B={transform:Vt,transition:St,transitionTimingFunction:w("transitionTimingFunction"),transitionDuration:w("transitionDuration"),transitionDelay:w("transitionDelay"),transformOrigin:w("transformOrigin"),transitionEnd:w("transitionEnd"),transitionProperty:w("transitionProperty")},it={touchstart:1,touchmove:1,touchend:1,touchcancel:1,mousedown:2,mousemove:2,mouseup:2};function Pt(o){if(o instanceof window.SVGElement){var t=o.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}else return{top:o.offsetTop,left:o.offsetLeft,width:o.offsetWidth,height:o.offsetHeight}}function H(o,t){for(var e in t)if(t[e].test(o[e]))return!0;return!1}var Ut=H;function qt(o,t){var e=document.createEvent("Event");e.initEvent(t,!0,!0),e.pageX=o.pageX,e.pageY=o.pageY,o.target.dispatchEvent(e)}function Et(o,t){t===void 0&&(t="click");var e;o.type==="mouseup"?e=o:(o.type==="touchend"||o.type==="touchcancel")&&(e=o.changedTouches[0]);var r={};e&&(r.screenX=e.screenX||0,r.screenY=e.screenY||0,r.clientX=e.clientX||0,r.clientY=e.clientY||0);var i,n=!0,s=!0,l=o.ctrlKey,h=o.shiftKey,a=o.altKey,u=o.metaKey,p={ctrlKey:l,shiftKey:h,altKey:a,metaKey:u};if(typeof MouseEvent<"u")try{i=new MouseEvent(t,et(z({bubbles:n,cancelable:s},p),r))}catch{v()}else v();function v(){i=document.createEvent("Event"),i.initEvent(t,n,s),et(i,r)}i.forwardedTouchEvent=!0,i._constructed=!0,o.target.dispatchEvent(i)}function Gt(o){Et(o,"dblclick")}var _={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(o){return 1+--o*o*o*o*o}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(o){return o*(2-o)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(o){return 1- --o*o*o*o}}},Zt=1e3/60,x=S&&window;function xt(){}var Ct=function(){return S?x.requestAnimationFrame||x.webkitRequestAnimationFrame||x.mozRequestAnimationFrame||x.oRequestAnimationFrame||function(o){return window.setTimeout(o,o.interval||Zt)}:xt}(),A=function(){return S?x.cancelAnimationFrame||x.webkitCancelAnimationFrame||x.mozCancelAnimationFrame||x.oCancelAnimationFrame||function(o){window.clearTimeout(o)}:xt}(),Dt=function(o){},nt={enumerable:!0,configurable:!0,get:Dt,set:Dt},Jt=function(o,t){for(var e=t.split("."),r=0;r<e.length-1;r++)if(o=o[e[r]],typeof o!="object"||!o)return;var i=e.pop();return typeof o[i]=="function"?function(){return o[i].apply(o,arguments)}:o[i]},Qt=function(o,t,e){for(var r=t.split("."),i,n=0;n<r.length-1;n++)i=r[n],o[i]||(o[i]={}),o=o[i];o[r.pop()]=e};function te(o,t,e){nt.get=function(){return Jt(this,t)},nt.set=function(i){Qt(this,t,i)},Object.defineProperty(o,e,nt)}var C=function(){function o(t){this.events={},this.eventTypes={},this.registerType(t)}return o.prototype.on=function(t,e,r){return r===void 0&&(r=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,r]),this},o.prototype.once=function(t,e,r){var i=this;r===void 0&&(r=this),this.hasType(t);var n=function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];i.off(t,n);var h=e.apply(r,s);if(h===!0)return h};return n.fn=e,this.on(t,n),this},o.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),!e)return this.events[t]=[],this;var r=this.events[t];if(!r)return this;for(var i=r.length;i--;)(r[i][0]===e||r[i][0]&&r[i][0].fn===e)&&r.splice(i,1);return this}},o.prototype.trigger=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this.hasType(t);var i=this.events[t];if(i)for(var n=i.length,s=vt(i),l,h=0;h<n;h++){var a=s[h],u=a[0],p=a[1];if(u&&(l=u.apply(p,e),l===!0))return l}},o.prototype.registerType=function(t){var e=this;t.forEach(function(r){e.eventTypes[r]=r})},o.prototype.destroy=function(){this.events={},this.eventTypes={}},o.prototype.hasType=function(t){var e=this.eventTypes,r=e[t]===t;r||K('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+(""+Object.keys(e).map(function(i){return JSON.stringify(i)}))+"]")},o}(),R=function(){function o(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}return o.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},o.prototype.addDOMEvents=function(){this.handleDOMEvents(Kt)},o.prototype.removeDOMEvents=function(){this.handleDOMEvents(Rt)},o.prototype.handleDOMEvents=function(t){var e=this,r=this.wrapper;this.events.forEach(function(i){t(r,i.name,e,!!i.capture)})},o.prototype.handleEvent=function(t){var e=t.type;this.events.some(function(r){return r.name===e?(r.handler(t),!0):!1})},o}(),ee=function(){function o(){}return o}(),oe=function(o){W(t,o);function t(){var e=o.call(this)||this;return e.startX=0,e.startY=0,e.scrollX=!1,e.scrollY=!0,e.freeScroll=!1,e.directionLockThreshold=0,e.eventPassthrough="",e.click=!1,e.dblclick=!1,e.tap="",e.bounce={top:!0,bottom:!0,left:!0,right:!0},e.bounceTime=800,e.momentum=!0,e.momentumLimitTime=300,e.momentumLimitDistance=15,e.swipeTime=2500,e.swipeBounceTime=500,e.deceleration=.0015,e.flickLimitTime=200,e.flickLimitDistance=100,e.resizePolling=60,e.probeType=0,e.stopPropagation=!1,e.preventDefault=!0,e.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},e.tagException={tagName:/^TEXTAREA$/},e.HWCompositing=!0,e.useTransition=!0,e.bindToWrapper=!1,e.bindToTarget=!1,e.disableMouse=wt,e.disableTouch=!wt,e.autoBlur=!0,e.autoEndDistance=5,e.outOfBoundaryDampingFactor=1/3,e.specifiedIndexAsContent=0,e.quadrant=1,e}return t.prototype.merge=function(e){if(!e)return this;for(var r in e){if(r==="bounce"){this.bounce=this.resolveBounce(e[r]);continue}this[r]=e[r]}return this},t.prototype.process=function(){return this.translateZ=this.HWCompositing&&$t?" translateZ(1px)":"",this.useTransition=this.useTransition&&jt,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.scrollX=this.eventPassthrough==="horizontal"?!1:this.scrollX,this.scrollY=this.eventPassthrough==="vertical"?!1:this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=this.freeScroll?!0:this.scrollX,this.scrollY=this.freeScroll?!0:this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},t.prototype.resolveBounce=function(e){var r={top:!0,right:!0,bottom:!0,left:!0},i={top:!1,right:!1,bottom:!1,left:!1},n;return typeof e=="object"?n=et(r,e):n=e?r:i,n},t}(ee),re=function(){function o(t,e){this.wrapper=t,this.options=e,this.hooks=new C(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}return o.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,r=t.disableMouse,i=t.disableTouch,n=t.click,s=this.wrapper,l=e?s:window,h=[],a=[],u=!i,p=!r;n&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),u&&(h.push({name:"touchstart",handler:this.start.bind(this)}),a.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),p&&(h.push({name:"mousedown",handler:this.start.bind(this)}),a.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new R(s,h),this.targetEventRegister=new R(l,a)},o.prototype.beforeHandler=function(t,e){var r=this.options,i=r.preventDefault,n=r.stopPropagation,s=r.preventDefaultException,l={start:function(){return i&&!H(t.target,s)},end:function(){return i&&!H(t.target,s)},move:function(){return i}};l[e]()&&t.preventDefault(),n&&t.stopPropagation()},o.prototype.setInitiated=function(t){t===void 0&&(t=0),this.initiated=t},o.prototype.start=function(t){var e=it[t.type];if(!(this.initiated&&this.initiated!==e)){if(this.setInitiated(e),Ut(t.target,this.options.tagException)){this.setInitiated();return}if(!(e===2&&t.button!==0)&&!this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)){this.beforeHandler(t,"start");var r=t.touches?t.touches[0]:t;this.pointX=r.pageX,this.pointY=r.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)}}},o.prototype.move=function(t){if(it[t.type]===this.initiated){this.beforeHandler(t,"move");var e=t.touches?t.touches[0]:t,r=e.pageX-this.pointX,i=e.pageY-this.pointY;if(this.pointX=e.pageX,this.pointY=e.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:r,deltaY:i,e:t})){var n=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,s=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,l=this.pointX-n,h=this.pointY-s,a=this.options.autoEndDistance;(l>document.documentElement.clientWidth-a||h>document.documentElement.clientHeight-a||l<a||h<a)&&this.end(t)}}},o.prototype.end=function(t){it[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},o.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},o.prototype.setContent=function(t){t!==this.wrapper&&(this.wrapper=t,this.rebindDOMEvents())},o.prototype.rebindDOMEvents=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.handleDOMEvents()},o.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},o}(),st={x:["translateX","px"],y:["translateY","px"]},ie=function(){function o(t){this.setContent(t),this.hooks=new C(["beforeTranslate","translate"])}return o.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null),e=t[B.transform].split(")")[0].split(", "),r=+(e[12]||e[4])||0,i=+(e[13]||e[5])||0;return{x:r,y:i}},o.prototype.translate=function(t){var e=[];Object.keys(t).forEach(function(r){if(st[r]){var i=st[r][0];if(i){var n=st[r][1],s=t[r];e.push(i+"("+s+n+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,e,t),this.style[B.transform]=e.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,t)},o.prototype.setContent=function(t){this.content!==t&&(this.content=t,this.style=t.style)},o.prototype.destroy=function(){this.hooks.destroy()},o}(),Bt=function(){function o(t,e,r){this.translater=e,this.options=r,this.timer=0,this.hooks=new C(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.setContent(t)}return o.prototype.translate=function(t){this.translater.translate(t)},o.prototype.setPending=function(t){this.pending=t},o.prototype.setForceStopped=function(t){this.forceStopped=t},o.prototype.setCallStop=function(t){this.callStopWhenPending=t},o.prototype.setContent=function(t){this.content!==t&&(this.content=t,this.style=t.style,this.stop())},o.prototype.clearTimer=function(){this.timer&&(A(this.timer),this.timer=0)},o.prototype.destroy=function(){this.hooks.destroy(),A(this.timer)},o}(),ne=function(o,t,e,r){var i=function(a,u){var p=a-u,v=p>0?-1:p<0?1:0;return v},n=i(t.x,o.x),s=i(t.y,o.y),l=e.x-r.x,h=e.y-r.y;return n*l<=0&&s*h<=0},se=function(o){W(t,o);function t(){return o!==null&&o.apply(this,arguments)||this}return t.prototype.startProbe=function(e,r){var i=this,n=e,s=function(){var l=i.translater.getComputedPosition();ne(e,r,l,n)&&i.hooks.trigger(i.hooks.eventTypes.move,l),i.pending||(i.callStopWhenPending?i.callStopWhenPending=!1:i.hooks.trigger(i.hooks.eventTypes.end,l)),n=l,i.pending&&(i.timer=Ct(s))};this.callStopWhenPending&&this.setCallStop(!1),A(this.timer),s()},t.prototype.transitionTime=function(e){e===void 0&&(e=0),this.style[B.transitionDuration]=e+"ms",this.hooks.trigger(this.hooks.eventTypes.time,e)},t.prototype.transitionTimingFunction=function(e){this.style[B.transitionTimingFunction]=e,this.hooks.trigger(this.hooks.eventTypes.timeFunction,e)},t.prototype.transitionProperty=function(){this.style[B.transitionProperty]=B.transform},t.prototype.move=function(e,r,i,n){this.setPending(i>0),this.transitionTimingFunction(n),this.transitionProperty(),this.transitionTime(i),this.translate(r);var s=this.options.probeType===3;i&&s&&this.startProbe(e,r),i||(this._reflow=this.content.offsetHeight,s&&this.hooks.trigger(this.hooks.eventTypes.move,r),this.hooks.trigger(this.hooks.eventTypes.end,r))},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),A(this.timer);var r=this.translater.getComputedPosition(),i=r.x,n=r.y;this.transitionTime(),this.translate({x:i,y:n}),this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:i,y:n})}return e},t.prototype.stop=function(){var e=this.doStop();e&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(Bt),ae=function(o){W(t,o);function t(){return o!==null&&o.apply(this,arguments)||this}return t.prototype.move=function(e,r,i,n){if(!i){this.translate(r),this.options.probeType===3&&this.hooks.trigger(this.hooks.eventTypes.move,r),this.hooks.trigger(this.hooks.eventTypes.end,r);return}this.animate(e,r,i,n)},t.prototype.animate=function(e,r,i,n){var s=this,l=D(),h=l+i,a=this.options.probeType===3,u=function(){var p=D();if(p>=h){s.translate(r),a&&s.hooks.trigger(s.hooks.eventTypes.move,r),s.hooks.trigger(s.hooks.eventTypes.end,r);return}p=(p-l)/i;var v=n(p),k={};Object.keys(r).forEach(function(d){var m=e[d],g=r[d];k[d]=(g-m)*v+m}),s.translate(k),a&&s.hooks.trigger(s.hooks.eventTypes.move,k),s.pending&&(s.timer=Ct(u)),s.pending||(s.callStopWhenPending?s.callStopWhenPending=!1:s.hooks.trigger(s.hooks.eventTypes.end,r))};this.setPending(!0),this.callStopWhenPending&&this.setCallStop(!1),A(this.timer),u()},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),A(this.timer);var r=this.translater.getComputedPosition();this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,r)}return e},t.prototype.stop=function(){var e=this.doStop();e&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(Bt);function le(o,t,e){var r=e.useTransition,i={};return Object.defineProperty(i,"probeType",{enumerable:!0,configurable:!1,get:function(){return e.probeType}}),r?new se(o,t,i):new ae(o,t,i)}var _t=function(){function o(t,e,r){this.wrapper=t,this.options=r,this.hooks=new C(["beforeComputeBoundary","computeBoundary","momentum","end","ignoreHasScroll"]),this.refresh(e)}return o.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},o.prototype.move=function(t){return t=this.hasScroll?t:0,this.setMovingDirection(t),this.performDampingAlgorithm(t,this.options.outOfBoundaryDampingFactor)},o.prototype.setMovingDirection=function(t){this.movingDirection=t>0?-1:t<0?1:0},o.prototype.setDirection=function(t){this.direction=t>0?-1:t<0?1:0},o.prototype.performDampingAlgorithm=function(t,e){var r=this.currentPos+t;return(r>this.minScrollPos||r<this.maxScrollPos)&&(r>this.minScrollPos&&this.options.bounces[0]||r<this.maxScrollPos&&this.options.bounces[1]?r=this.currentPos+t*e:r=r>this.minScrollPos?this.minScrollPos:this.maxScrollPos),r},o.prototype.end=function(t){var e={duration:0},r=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&t<this.options.momentumLimitTime&&r>this.options.momentumLimitDistance){var i=this.direction===-1&&this.options.bounces[0]||this.direction===1&&this.options.bounces[1]?this.wrapperSize:0;e=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,i,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,e);return e},o.prototype.momentum=function(t,e,r,i,n,s,l){l===void 0&&(l=this.options);var h=t-e,a=Math.abs(h)/r,u=l.deceleration,p=l.swipeBounceTime,v=l.swipeTime,k=Math.min(v,a*2/u),d={destination:t+a*a/u*(h<0?-1:1),duration:k,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,d,h),d.destination<i?(d.destination=s?Math.max(i-s/4,i-s/d.rate*a):i,d.duration=p):d.destination>n&&(d.destination=s?Math.min(n+s/4,n+s/d.rate*a):n,d.duration=p),d.destination=Math.round(d.destination),d},o.prototype.updateDirection=function(){var t=this.currentPos-this.absStartPos;this.setDirection(t)},o.prototype.refresh=function(t){var e=this.options.rect,r=e.size,i=e.position,n=window.getComputedStyle(this.wrapper,null).position==="static",s=Pt(this.wrapper);this.wrapperSize=this.wrapper[r==="width"?"clientWidth":"clientHeight"],this.setContent(t);var l=Pt(this.content);this.contentSize=l[r],this.relativeOffset=l[i],n&&(this.relativeOffset-=s[i]),this.computeBoundary(),this.setDirection(0)},o.prototype.setContent=function(t){t!==this.content&&(this.content=t,this.resetState())},o.prototype.resetState=function(){this.currentPos=0,this.startPos=0,this.dist=0,this.setDirection(0),this.setMovingDirection(0),this.resetStartPos()},o.prototype.computeBoundary=function(){this.hooks.trigger(this.hooks.eventTypes.beforeComputeBoundary);var t={minScrollPos:0,maxScrollPos:this.wrapperSize-this.contentSize};t.maxScrollPos<0&&(t.maxScrollPos-=this.relativeOffset,this.options.specifiedIndexAsContent===0&&(t.minScrollPos=-this.relativeOffset)),this.hooks.trigger(this.hooks.eventTypes.computeBoundary,t),this.minScrollPos=t.minScrollPos,this.maxScrollPos=t.maxScrollPos,this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,!this.hasScroll&&this.minScrollPos<this.maxScrollPos&&(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize)},o.prototype.updatePosition=function(t){this.currentPos=t},o.prototype.getCurrentPos=function(){return this.currentPos},o.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos),e=t===this.getCurrentPos();return{position:t,inBoundary:e}},o.prototype.adjustPosition=function(t){return!this.hasScroll&&!this.hooks.trigger(this.hooks.eventTypes.ignoreHasScroll)?t=this.minScrollPos:t>this.minScrollPos?t=this.minScrollPos:t<this.maxScrollPos&&(t=this.maxScrollPos),t},o.prototype.updateStartPos=function(){this.startPos=this.currentPos},o.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},o.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},o.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},o.prototype.destroy=function(){this.hooks.destroy()},o}(),V,$,j,U,At=(V={},V.yes=function(o){return!0},V.no=function(o){return Tt(o),!1},V),ce=($={},$.horizontal=(j={},j.yes="horizontal",j.no="vertical",j),$.vertical=(U={},U.yes="vertical",U.no="horizontal",U),$),he=function(){function o(t,e,r){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=r,this.reset()}return o.prototype.reset=function(){this.directionLocked=""},o.prototype.checkMovingDirection=function(t,e,r){return this.computeDirectionLock(t,e),this.handleEventPassthrough(r)},o.prototype.adjustDelta=function(t,e){return this.directionLocked==="horizontal"?e=0:this.directionLocked==="vertical"&&(t=0),{deltaX:t,deltaY:e}},o.prototype.computeDirectionLock=function(t,e){this.directionLocked===""&&!this.freeScroll&&(t>e+this.directionLockThreshold?this.directionLocked="horizontal":e>=t+this.directionLockThreshold?this.directionLocked="vertical":this.directionLocked="none")},o.prototype.handleEventPassthrough=function(t){var e=ce[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return At.yes(t);if(this.eventPassthrough===e.no)return At.no(t)}return!1},o}(),ue=function(o,t,e){return e===2?[t,-o]:e===3?[-o,-t]:e===4?[-t,o]:[o,t]},pe=function(){function o(t,e,r,i,n){this.hooks=new C(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd","contentNotMoved","detectMovingDirection","coordinateTransformation"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=r,this.animater=i,this.options=n,this.directionLockAction=new he(n.directionLockThreshold,n.freeScroll,n.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}return o.prototype.bindActionsHandler=function(){var t=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(e){return t.enabled?t.handleStart(e):!0}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(e){var r=e.deltaX,i=e.deltaY,n=e.e;if(!t.enabled)return!0;var s=ue(r,i,t.options.quadrant),l=s[0],h=s[1],a={deltaX:l,deltaY:h};return t.hooks.trigger(t.hooks.eventTypes.coordinateTransformation,a),t.handleMove(a.deltaX,a.deltaY,n)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(e){return t.enabled?t.handleEnd(e):!0}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(e){t.enabled&&!e._constructed&&t.handleClick(e)})},o.prototype.handleStart=function(t){var e=D();this.fingerMoved=!1,this.contentMoved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.doStop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},o.prototype.handleMove=function(t,e,r){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,r)){var i=this.scrollBehaviorX.getAbsDist(t),n=this.scrollBehaviorY.getAbsDist(e),s=D();if(this.checkMomentum(i,n,s))return!0;if(this.directionLockAction.checkMovingDirection(i,n,r))return this.actionsHandler.setInitiated(),!0;var l=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.getCurrentPos(),a=this.scrollBehaviorX.move(l.deltaX),u=this.scrollBehaviorY.getCurrentPos(),p=this.scrollBehaviorY.move(l.deltaY);if(!this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)){this.fingerMoved||(this.fingerMoved=!0);var v=a!==h||p!==u;!this.contentMoved&&!v&&this.hooks.trigger(this.hooks.eventTypes.contentNotMoved),!this.contentMoved&&v&&(this.contentMoved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.contentMoved&&v&&(this.animater.translate({x:a,y:p}),this.dispatchScroll(s))}}},o.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),this.options.probeType===1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},o.prototype.checkMomentum=function(t,e,r){return r-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},o.prototype.handleEnd=function(t){if(!this.hooks.trigger(this.hooks.eventTypes.beforeEnd,t)){var e=this.getCurrentPos();if(this.scrollBehaviorX.updateDirection(),this.scrollBehaviorY.updateDirection(),this.hooks.trigger(this.hooks.eventTypes.end,t,e))return!0;e=this.ensureIntegerPos(e),this.animater.translate(e),this.endTime=D();var r=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,r)}},o.prototype.ensureIntegerPos=function(t){this.ensuringInteger=!0;var e=t.x,r=t.y,i=this.scrollBehaviorX,n=i.minScrollPos,s=i.maxScrollPos,l=this.scrollBehaviorY,h=l.minScrollPos,a=l.maxScrollPos;return e=e>0?Math.ceil(e):Math.floor(e),r=r>0?Math.ceil(r):Math.floor(r),e=gt(e,s,n),r=gt(r,a,h),{x:e,y:r}},o.prototype.handleClick=function(t){H(t.target,this.options.preventDefaultException)||(Tt(t),t.stopPropagation())},o.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},o.prototype.refresh=function(){this.endTime=0},o.prototype.destroy=function(){this.hooks.destroy()},o}();function fe(o){var t=["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException","autoEndDistance"].reduce(function(e,r){return e[r]=o[r],e},{});return t}function Yt(o,t,e,r){var i=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor","specifiedIndexAsContent"].reduce(function(n,s){return n[s]=o[s],n},{});return i.scrollable=!!o[t],i.bounces=e,i.rect=r,i}function at(o,t,e){e.forEach(function(r){var i,n;typeof r=="string"?i=n=r:(i=r.source,n=r.target),o.on(i,function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return t.trigger.apply(t,vt([n],s))})})}function de(o,t){for(var e=Object.keys(o),r=0,i=e;r<i.length;r++){var n=i[r];if(o[n]!==t[n])return!1}return!0}var Mt=1,ve=function(){function o(t,e,r){this.wrapper=t,this.content=e,this.resizeTimeout=0,this.hooks=new C(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","resize","touchEnd","end","flick","scrollCancel","momentum","scrollTo","minDistanceScroll","scrollToElement","beforeRefresh"]),this.options=r;var i=this.options.bounce,n=i.left,s=i.right,l=i.top,h=i.bottom;this.scrollBehaviorX=new _t(t,e,Yt(r,"scrollX",[n,s],{size:"width",position:"left"})),this.scrollBehaviorY=new _t(t,e,Yt(r,"scrollY",[l,h],{size:"height",position:"top"})),this.translater=new ie(this.content),this.animater=le(this.content,this.translater,this.options),this.actionsHandler=new re(this.options.bindToTarget?this.content:t,fe(this.options)),this.actions=new pe(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var a=this.resize.bind(this);this.resizeRegister=new R(window,[{name:"orientationchange",handler:a},{name:"resize",handler:a}]),this.registerTransitionEnd(),this.init()}return o.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},o.prototype.registerTransitionEnd=function(){this.transitionEndRegister=new R(this.content,[{name:B.transitionEnd,handler:this.transitionEnd.bind(this)}])},o.prototype.bindTranslater=function(){var t=this,e=this.translater.hooks;e.on(e.eventTypes.beforeTranslate,function(r){t.options.translateZ&&r.push(t.options.translateZ)}),e.on(e.eventTypes.translate,function(r){var i=t.getCurrentPos();if(t.updatePositions(r),t.actions.ensuringInteger===!0){t.actions.ensuringInteger=!1;return}(r.x!==i.x||r.y!==i.y)&&t.togglePointerEvents(!1)})},o.prototype.bindAnimater=function(){var t=this;this.animater.hooks.on(this.animater.hooks.eventTypes.end,function(e){t.resetPosition(t.options.bounceTime)||(t.animater.setPending(!1),t.hooks.trigger(t.hooks.eventTypes.scrollEnd,e))}),at(this.animater.hooks,this.hooks,[{source:this.animater.hooks.eventTypes.move,target:this.hooks.eventTypes.scroll},{source:this.animater.hooks.eventTypes.forceStop,target:this.hooks.eventTypes.scrollEnd}])},o.prototype.bindActions=function(){var t=this,e=this.actions;at(e.hooks,this.hooks,[{source:e.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:e.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:e.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:e.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:e.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:e.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),e.hooks.on(e.hooks.eventTypes.end,function(r,i){if(t.hooks.trigger(t.hooks.eventTypes.touchEnd,i),t.hooks.trigger(t.hooks.eventTypes.end,i)||!e.fingerMoved&&(t.hooks.trigger(t.hooks.eventTypes.scrollCancel),t.checkClick(r)))return!0;if(t.resetPosition(t.options.bounceTime,_.bounce))return t.animater.setForceStopped(!1),!0}),e.hooks.on(e.hooks.eventTypes.scrollEnd,function(r,i){var n=Math.abs(r.x-t.scrollBehaviorX.startPos),s=Math.abs(r.y-t.scrollBehaviorY.startPos);if(t.checkFlick(i,n,s)){t.animater.setForceStopped(!1),t.hooks.trigger(t.hooks.eventTypes.flick);return}if(t.momentum(r,i)){t.animater.setForceStopped(!1);return}e.contentMoved&&t.hooks.trigger(t.hooks.eventTypes.scrollEnd,r),t.animater.forceStopped&&t.animater.setForceStopped(!1)})},o.prototype.checkFlick=function(t,e,r){var i=1;if(this.hooks.events.flick.length>1&&t<this.options.flickLimitTime&&e<this.options.flickLimitDistance&&r<this.options.flickLimitDistance&&(r>i||e>i))return!0},o.prototype.momentum=function(t,e){var r={time:0,easing:_.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),n=this.scrollBehaviorY.end(e);if(r.newX=ot(i.destination)?r.newX:i.destination,r.newY=ot(n.destination)?r.newY:n.destination,r.time=Math.max(i.duration,n.duration),this.hooks.trigger(this.hooks.eventTypes.momentum,r,this),r.newX!==t.x||r.newY!==t.y)return(r.newX>this.scrollBehaviorX.minScrollPos||r.newX<this.scrollBehaviorX.maxScrollPos||r.newY>this.scrollBehaviorY.minScrollPos||r.newY<this.scrollBehaviorY.maxScrollPos)&&(r.easing=_.swipeBounce),this.scrollTo(r.newX,r.newY,r.time,r.easing),!0},o.prototype.checkClick=function(t){var e={preventClick:this.animater.forceStopped};if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return this.animater.setForceStopped(!1),!0;if(!e.preventClick){var r=this.options.dblclick,i=!1;if(r&&this.lastClickTime){var n=r.delay,s=n===void 0?300:n;D()-this.lastClickTime<s&&(i=!0,Gt(t))}return this.options.tap&&qt(t,this.options.tap),this.options.click&&!H(t.target,this.options.preventDefaultException)&&Et(t),this.lastClickTime=i?null:D(),!0}return!1},o.prototype.resize=function(){var t=this;this.actions.enabled&&(Nt&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.hooks.trigger(t.hooks.eventTypes.resize)},this.options.resizePolling))},o.prototype.transitionEnd=function(t){if(!(t.target!==this.content||!this.animater.pending)){var e=this.animater;e.transitionTime(),this.resetPosition(this.options.bounceTime,_.bounce)||(this.animater.setPending(!1),this.options.probeType!==3&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos()))}},o.prototype.togglePointerEvents=function(t){t===void 0&&(t=!0);for(var e=this.content.children.length?this.content.children:[this.content],r=t?"auto":"none",i=0;i<e.length;i++){var n=e[i];n.isBScrollContainer||(n.style.pointerEvents=r)}},o.prototype.refresh=function(t){var e=this.setContent(t);this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(t),this.scrollBehaviorY.refresh(t),e&&(this.translater.setContent(t),this.animater.setContent(t),this.transitionEndRegister.destroy(),this.registerTransitionEnd(),this.options.bindToTarget&&this.actionsHandler.setContent(t)),this.actions.refresh(),this.wrapperOffset=bt(this.wrapper)},o.prototype.setContent=function(t){var e=t!==this.content;return e&&(this.content=t),e},o.prototype.scrollBy=function(t,e,r,i){r===void 0&&(r=0);var n=this.getCurrentPos(),s=n.x,l=n.y;i=i||_.bounce,t+=s,e+=l,this.scrollTo(t,e,r,i)},o.prototype.scrollTo=function(t,e,r,i,n){r===void 0&&(r=0),i===void 0&&(i=_.bounce),n===void 0&&(n={start:{},end:{}});var s=this.options.useTransition?i.style:i.fn,l=this.getCurrentPos(),h=z({x:l.x,y:l.y},n.start),a=z({x:t,y:e},n.end);if(this.hooks.trigger(this.hooks.eventTypes.scrollTo,a),!de(h,a)){var u=Math.abs(a.x-h.x),p=Math.abs(a.y-h.y);u<Mt&&p<Mt&&(r=0,this.hooks.trigger(this.hooks.eventTypes.minDistanceScroll)),this.animater.move(h,a,r,s)}},o.prototype.scrollToElement=function(t,e,r,i,n){var s=kt(t),l=bt(s),h=function(u,p,v){return typeof u=="number"?u:u?Math.round(p/2-v/2):0};r=h(r,s.offsetWidth,this.wrapper.offsetWidth),i=h(i,s.offsetHeight,this.wrapper.offsetHeight);var a=function(u,p,v,k){return u-=p,u=k.adjustPosition(u-v),u};l.left=a(l.left,this.wrapperOffset.left,r,this.scrollBehaviorX),l.top=a(l.top,this.wrapperOffset.top,i,this.scrollBehaviorY),!this.hooks.trigger(this.hooks.eventTypes.scrollToElement,s,l)&&this.scrollTo(l.left,l.top,e,n)},o.prototype.resetPosition=function(t,e){t===void 0&&(t=0),e===void 0&&(e=_.bounce);var r=this.scrollBehaviorX.checkInBoundary(),i=r.position,n=r.inBoundary,s=this.scrollBehaviorY.checkInBoundary(),l=s.position,h=s.inBoundary;return n&&h?!1:(Ft&&this.reflow(),this.scrollTo(i,l,t,e),!0)},o.prototype.reflow=function(){this._reflow=this.content.offsetHeight},o.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},o.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},o.prototype.enable=function(){this.actions.enabled=!0},o.prototype.disable=function(){A(this.animater.timer),this.actions.enabled=!1},o.prototype.destroy=function(){var t=this,e=["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"];e.forEach(function(r){return t[r].destroy()})},o}(),q=function(o){W(t,o);function t(e,r){var i=o.call(this,["refresh","contentChanged","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,n=kt(e);return n?(i.plugins={},i.options=new oe().merge(r).process(),i.setContent(n).valid&&(i.hooks=new C(["refresh","enable","disable","destroy","beforeInitialScrollTo","contentChanged"]),i.init(n)),i):(K("Can not resolve the wrapper DOM."),i)}return t.use=function(e){var r=e.pluginName,i=t.plugins.some(function(n){return e===n.ctor});return i?t:ot(r)?(K("Plugin Class must specify plugin's name in static property by 'pluginName' field."),t):(t.pluginsMap[r]=!0,t.plugins.push({name:r,applyOrder:e.applyOrder,ctor:e}),t)},t.prototype.setContent=function(e){var r=!1,i=!0,n=e.children[this.options.specifiedIndexAsContent];return n?(r=this.content!==n,r&&(this.content=n)):(K("The wrapper need at least one child element to be content element to scroll."),i=!1),{valid:i,contentChanged:r}},t.prototype.init=function(e){var r=this;this.wrapper=e,e.isBScrollContainer=!0,this.scroller=new ve(e,this.content,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,function(){r.refresh()}),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(zt),this.applyPlugins(),this.refreshWithoutReset(this.content);var i=this.options,n=i.startX,s=i.startY,l={x:n,y:s};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,l)||this.scroller.scrollTo(l.x,l.y)},t.prototype.applyPlugins=function(){var e=this,r=this.options;t.plugins.sort(function(i,n){var s,l=(s={},s.pre=-1,s.post=1,s),h=i.applyOrder?l[i.applyOrder]:0,a=n.applyOrder?l[n.applyOrder]:0;return h-a}).forEach(function(i){var n=i.ctor;r[i.name]&&typeof n=="function"&&(e.plugins[i.name]=new n(e))})},t.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,function(){var e=document.activeElement;e&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")&&e.blur()})},t.prototype.eventBubbling=function(){at(this.scroller.hooks,this,[this.eventTypes.beforeScrollStart,this.eventTypes.scrollStart,this.eventTypes.scroll,this.eventTypes.scrollEnd,this.eventTypes.scrollCancel,this.eventTypes.touchEnd,this.eventTypes.flick])},t.prototype.refreshWithoutReset=function(e){this.scroller.refresh(e),this.hooks.trigger(this.hooks.eventTypes.refresh,e),this.trigger(this.eventTypes.refresh,e)},t.prototype.proxy=function(e){var r=this;e.forEach(function(i){var n=i.key,s=i.sourceKey;te(r,s,n)})},t.prototype.refresh=function(){var e=this.setContent(this.wrapper),r=e.contentChanged,i=e.valid;if(i){var n=this.content;this.refreshWithoutReset(n),r&&(this.hooks.trigger(this.hooks.eventTypes.contentChanged,n),this.trigger(this.eventTypes.contentChanged,n)),this.scroller.resetPosition()}},t.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},t.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},t.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},t.prototype.eventRegister=function(e){this.registerType(e)},t.plugins=[],t.pluginsMap={},t}(C);function N(o,t){var e=new q(o,t);return e}N.use=q.use,N.plugins=q.plugins,N.pluginsMap=q.pluginsMap;var me=N;/*!
|
|
19
|
+
***************************************************************************** */var tt=function(o,t){return tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])},tt(o,t)};function W(o,t){tt(o,t);function e(){this.constructor=o}o.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var z=function(){return z=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},z.apply(this,arguments)};function vt(){for(var o=0,t=0,e=arguments.length;t<e;t++)o+=arguments[t].length;for(var r=Array(o),n=0,t=0;t<e;t++)for(var i=arguments[t],s=0,l=i.length;s<l;s++,n++)r[n]=i[s];return r}var zt=[{sourceKey:"scroller.scrollBehaviorX.currentPos",key:"x"},{sourceKey:"scroller.scrollBehaviorY.currentPos",key:"y"},{sourceKey:"scroller.scrollBehaviorX.hasScroll",key:"hasHorizontalScroll"},{sourceKey:"scroller.scrollBehaviorY.hasScroll",key:"hasVerticalScroll"},{sourceKey:"scroller.scrollBehaviorX.contentSize",key:"scrollerWidth"},{sourceKey:"scroller.scrollBehaviorY.contentSize",key:"scrollerHeight"},{sourceKey:"scroller.scrollBehaviorX.maxScrollPos",key:"maxScrollX"},{sourceKey:"scroller.scrollBehaviorY.maxScrollPos",key:"maxScrollY"},{sourceKey:"scroller.scrollBehaviorX.minScrollPos",key:"minScrollX"},{sourceKey:"scroller.scrollBehaviorY.minScrollPos",key:"minScrollY"},{sourceKey:"scroller.scrollBehaviorX.movingDirection",key:"movingDirectionX"},{sourceKey:"scroller.scrollBehaviorY.movingDirection",key:"movingDirectionY"},{sourceKey:"scroller.scrollBehaviorX.direction",key:"directionX"},{sourceKey:"scroller.scrollBehaviorY.direction",key:"directionY"},{sourceKey:"scroller.actions.enabled",key:"enabled"},{sourceKey:"scroller.animater.pending",key:"pending"},{sourceKey:"scroller.animater.stop",key:"stop"},{sourceKey:"scroller.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];function K(o){console.error("[BScroll warn]: "+o)}var S=typeof window<"u",X=S&&navigator.userAgent.toLowerCase(),Ht=!!(X&&/wechatdevtools/.test(X)),Nt=X&&X.indexOf("android")>0,Ft=function(){if(typeof X=="string"){var o=/os (\d\d?_\d(_\d)?)/,t=o.exec(X);if(!t)return!1;var e=t[1].split("_").map(function(r){return parseInt(r,10)});return e[0]===13&&e[1]>=4}return!1}(),mt=!1;if(S){var Wt="test-passive";try{var yt={};Object.defineProperty(yt,"passive",{get:function(){mt=!0}}),window.addEventListener(Wt,function(){},yt)}catch{}}function D(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var et=function(o,t){for(var e in t)o[e]=t[e];return o};function ot(o){return o==null}function gt(o,t,e){return o<t?t:o>e?e:o}var rt=S&&document.createElement("div").style,O=function(){if(!S)return!1;for(var o=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],t=0,e=o;t<e.length;t++){var r=e[t];if(rt[r.value]!==void 0)return r.key}return!1}();function w(o){return O===!1?o:O==="standard"?o==="transitionEnd"?"transitionend":o:O+o.charAt(0).toUpperCase()+o.substr(1)}function kt(o){return typeof o=="string"?document.querySelector(o):o}function Kt(o,t,e,r){var n=mt?{passive:!1,capture:!!r}:!!r;o.addEventListener(t,e,n)}function Rt(o,t,e,r){o.removeEventListener(t,e,{capture:!!r})}function Tt(o){o.cancelable&&o.preventDefault()}function bt(o){for(var t=0,e=0;o;)t-=o.offsetLeft,e-=o.offsetTop,o=o.offsetParent;return{left:t,top:e}}O&&O!=="standard"&&""+O.toLowerCase();var Vt=w("transform"),St=w("transition"),$t=S&&w("perspective")in rt,wt=S&&("ontouchstart"in window||Ht),jt=S&&St in rt,B={transform:Vt,transition:St,transitionTimingFunction:w("transitionTimingFunction"),transitionDuration:w("transitionDuration"),transitionDelay:w("transitionDelay"),transformOrigin:w("transformOrigin"),transitionEnd:w("transitionEnd"),transitionProperty:w("transitionProperty")},nt={touchstart:1,touchmove:1,touchend:1,touchcancel:1,mousedown:2,mousemove:2,mouseup:2};function Pt(o){if(o instanceof window.SVGElement){var t=o.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}else return{top:o.offsetTop,left:o.offsetLeft,width:o.offsetWidth,height:o.offsetHeight}}function H(o,t){for(var e in t)if(t[e].test(o[e]))return!0;return!1}var Ut=H;function qt(o,t){var e=document.createEvent("Event");e.initEvent(t,!0,!0),e.pageX=o.pageX,e.pageY=o.pageY,o.target.dispatchEvent(e)}function Et(o,t){t===void 0&&(t="click");var e;o.type==="mouseup"?e=o:(o.type==="touchend"||o.type==="touchcancel")&&(e=o.changedTouches[0]);var r={};e&&(r.screenX=e.screenX||0,r.screenY=e.screenY||0,r.clientX=e.clientX||0,r.clientY=e.clientY||0);var n,i=!0,s=!0,l=o.ctrlKey,h=o.shiftKey,a=o.altKey,u=o.metaKey,p={ctrlKey:l,shiftKey:h,altKey:a,metaKey:u};if(typeof MouseEvent<"u")try{n=new MouseEvent(t,et(z({bubbles:i,cancelable:s},p),r))}catch{v()}else v();function v(){n=document.createEvent("Event"),n.initEvent(t,i,s),et(n,r)}n.forwardedTouchEvent=!0,n._constructed=!0,o.target.dispatchEvent(n)}function Gt(o){Et(o,"dblclick")}var _={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(o){return 1+--o*o*o*o*o}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(o){return o*(2-o)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(o){return 1- --o*o*o*o}}},Zt=1e3/60,x=S&&window;function xt(){}var Ct=function(){return S?x.requestAnimationFrame||x.webkitRequestAnimationFrame||x.mozRequestAnimationFrame||x.oRequestAnimationFrame||function(o){return window.setTimeout(o,o.interval||Zt)}:xt}(),A=function(){return S?x.cancelAnimationFrame||x.webkitCancelAnimationFrame||x.mozCancelAnimationFrame||x.oCancelAnimationFrame||function(o){window.clearTimeout(o)}:xt}(),Dt=function(o){},it={enumerable:!0,configurable:!0,get:Dt,set:Dt},Jt=function(o,t){for(var e=t.split("."),r=0;r<e.length-1;r++)if(o=o[e[r]],typeof o!="object"||!o)return;var n=e.pop();return typeof o[n]=="function"?function(){return o[n].apply(o,arguments)}:o[n]},Qt=function(o,t,e){for(var r=t.split("."),n,i=0;i<r.length-1;i++)n=r[i],o[n]||(o[n]={}),o=o[n];o[r.pop()]=e};function te(o,t,e){it.get=function(){return Jt(this,t)},it.set=function(n){Qt(this,t,n)},Object.defineProperty(o,e,it)}var C=function(){function o(t){this.events={},this.eventTypes={},this.registerType(t)}return o.prototype.on=function(t,e,r){return r===void 0&&(r=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,r]),this},o.prototype.once=function(t,e,r){var n=this;r===void 0&&(r=this),this.hasType(t);var i=function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];n.off(t,i);var h=e.apply(r,s);if(h===!0)return h};return i.fn=e,this.on(t,i),this},o.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),!e)return this.events[t]=[],this;var r=this.events[t];if(!r)return this;for(var n=r.length;n--;)(r[n][0]===e||r[n][0]&&r[n][0].fn===e)&&r.splice(n,1);return this}},o.prototype.trigger=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];this.hasType(t);var n=this.events[t];if(n)for(var i=n.length,s=vt(n),l,h=0;h<i;h++){var a=s[h],u=a[0],p=a[1];if(u&&(l=u.apply(p,e),l===!0))return l}},o.prototype.registerType=function(t){var e=this;t.forEach(function(r){e.eventTypes[r]=r})},o.prototype.destroy=function(){this.events={},this.eventTypes={}},o.prototype.hasType=function(t){var e=this.eventTypes,r=e[t]===t;r||K('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+(""+Object.keys(e).map(function(n){return JSON.stringify(n)}))+"]")},o}(),R=function(){function o(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}return o.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},o.prototype.addDOMEvents=function(){this.handleDOMEvents(Kt)},o.prototype.removeDOMEvents=function(){this.handleDOMEvents(Rt)},o.prototype.handleDOMEvents=function(t){var e=this,r=this.wrapper;this.events.forEach(function(n){t(r,n.name,e,!!n.capture)})},o.prototype.handleEvent=function(t){var e=t.type;this.events.some(function(r){return r.name===e?(r.handler(t),!0):!1})},o}(),ee=function(){function o(){}return o}(),oe=function(o){W(t,o);function t(){var e=o.call(this)||this;return e.startX=0,e.startY=0,e.scrollX=!1,e.scrollY=!0,e.freeScroll=!1,e.directionLockThreshold=0,e.eventPassthrough="",e.click=!1,e.dblclick=!1,e.tap="",e.bounce={top:!0,bottom:!0,left:!0,right:!0},e.bounceTime=800,e.momentum=!0,e.momentumLimitTime=300,e.momentumLimitDistance=15,e.swipeTime=2500,e.swipeBounceTime=500,e.deceleration=.0015,e.flickLimitTime=200,e.flickLimitDistance=100,e.resizePolling=60,e.probeType=0,e.stopPropagation=!1,e.preventDefault=!0,e.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},e.tagException={tagName:/^TEXTAREA$/},e.HWCompositing=!0,e.useTransition=!0,e.bindToWrapper=!1,e.bindToTarget=!1,e.disableMouse=wt,e.disableTouch=!wt,e.autoBlur=!0,e.autoEndDistance=5,e.outOfBoundaryDampingFactor=1/3,e.specifiedIndexAsContent=0,e.quadrant=1,e}return t.prototype.merge=function(e){if(!e)return this;for(var r in e){if(r==="bounce"){this.bounce=this.resolveBounce(e[r]);continue}this[r]=e[r]}return this},t.prototype.process=function(){return this.translateZ=this.HWCompositing&&$t?" translateZ(1px)":"",this.useTransition=this.useTransition&&jt,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.scrollX=this.eventPassthrough==="horizontal"?!1:this.scrollX,this.scrollY=this.eventPassthrough==="vertical"?!1:this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=this.freeScroll?!0:this.scrollX,this.scrollY=this.freeScroll?!0:this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},t.prototype.resolveBounce=function(e){var r={top:!0,right:!0,bottom:!0,left:!0},n={top:!1,right:!1,bottom:!1,left:!1},i;return typeof e=="object"?i=et(r,e):i=e?r:n,i},t}(ee),re=function(){function o(t,e){this.wrapper=t,this.options=e,this.hooks=new C(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}return o.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,r=t.disableMouse,n=t.disableTouch,i=t.click,s=this.wrapper,l=e?s:window,h=[],a=[],u=!n,p=!r;i&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),u&&(h.push({name:"touchstart",handler:this.start.bind(this)}),a.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),p&&(h.push({name:"mousedown",handler:this.start.bind(this)}),a.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new R(s,h),this.targetEventRegister=new R(l,a)},o.prototype.beforeHandler=function(t,e){var r=this.options,n=r.preventDefault,i=r.stopPropagation,s=r.preventDefaultException,l={start:function(){return n&&!H(t.target,s)},end:function(){return n&&!H(t.target,s)},move:function(){return n}};l[e]()&&t.preventDefault(),i&&t.stopPropagation()},o.prototype.setInitiated=function(t){t===void 0&&(t=0),this.initiated=t},o.prototype.start=function(t){var e=nt[t.type];if(!(this.initiated&&this.initiated!==e)){if(this.setInitiated(e),Ut(t.target,this.options.tagException)){this.setInitiated();return}if(!(e===2&&t.button!==0)&&!this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)){this.beforeHandler(t,"start");var r=t.touches?t.touches[0]:t;this.pointX=r.pageX,this.pointY=r.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)}}},o.prototype.move=function(t){if(nt[t.type]===this.initiated){this.beforeHandler(t,"move");var e=t.touches?t.touches[0]:t,r=e.pageX-this.pointX,n=e.pageY-this.pointY;if(this.pointX=e.pageX,this.pointY=e.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:r,deltaY:n,e:t})){var i=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,s=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,l=this.pointX-i,h=this.pointY-s,a=this.options.autoEndDistance;(l>document.documentElement.clientWidth-a||h>document.documentElement.clientHeight-a||l<a||h<a)&&this.end(t)}}},o.prototype.end=function(t){nt[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},o.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},o.prototype.setContent=function(t){t!==this.wrapper&&(this.wrapper=t,this.rebindDOMEvents())},o.prototype.rebindDOMEvents=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.handleDOMEvents()},o.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},o}(),st={x:["translateX","px"],y:["translateY","px"]},ne=function(){function o(t){this.setContent(t),this.hooks=new C(["beforeTranslate","translate"])}return o.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null),e=t[B.transform].split(")")[0].split(", "),r=+(e[12]||e[4])||0,n=+(e[13]||e[5])||0;return{x:r,y:n}},o.prototype.translate=function(t){var e=[];Object.keys(t).forEach(function(r){if(st[r]){var n=st[r][0];if(n){var i=st[r][1],s=t[r];e.push(n+"("+s+i+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,e,t),this.style[B.transform]=e.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,t)},o.prototype.setContent=function(t){this.content!==t&&(this.content=t,this.style=t.style)},o.prototype.destroy=function(){this.hooks.destroy()},o}(),Bt=function(){function o(t,e,r){this.translater=e,this.options=r,this.timer=0,this.hooks=new C(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.setContent(t)}return o.prototype.translate=function(t){this.translater.translate(t)},o.prototype.setPending=function(t){this.pending=t},o.prototype.setForceStopped=function(t){this.forceStopped=t},o.prototype.setCallStop=function(t){this.callStopWhenPending=t},o.prototype.setContent=function(t){this.content!==t&&(this.content=t,this.style=t.style,this.stop())},o.prototype.clearTimer=function(){this.timer&&(A(this.timer),this.timer=0)},o.prototype.destroy=function(){this.hooks.destroy(),A(this.timer)},o}(),ie=function(o,t,e,r){var n=function(a,u){var p=a-u,v=p>0?-1:p<0?1:0;return v},i=n(t.x,o.x),s=n(t.y,o.y),l=e.x-r.x,h=e.y-r.y;return i*l<=0&&s*h<=0},se=function(o){W(t,o);function t(){return o!==null&&o.apply(this,arguments)||this}return t.prototype.startProbe=function(e,r){var n=this,i=e,s=function(){var l=n.translater.getComputedPosition();ie(e,r,l,i)&&n.hooks.trigger(n.hooks.eventTypes.move,l),n.pending||(n.callStopWhenPending?n.callStopWhenPending=!1:n.hooks.trigger(n.hooks.eventTypes.end,l)),i=l,n.pending&&(n.timer=Ct(s))};this.callStopWhenPending&&this.setCallStop(!1),A(this.timer),s()},t.prototype.transitionTime=function(e){e===void 0&&(e=0),this.style[B.transitionDuration]=e+"ms",this.hooks.trigger(this.hooks.eventTypes.time,e)},t.prototype.transitionTimingFunction=function(e){this.style[B.transitionTimingFunction]=e,this.hooks.trigger(this.hooks.eventTypes.timeFunction,e)},t.prototype.transitionProperty=function(){this.style[B.transitionProperty]=B.transform},t.prototype.move=function(e,r,n,i){this.setPending(n>0),this.transitionTimingFunction(i),this.transitionProperty(),this.transitionTime(n),this.translate(r);var s=this.options.probeType===3;n&&s&&this.startProbe(e,r),n||(this._reflow=this.content.offsetHeight,s&&this.hooks.trigger(this.hooks.eventTypes.move,r),this.hooks.trigger(this.hooks.eventTypes.end,r))},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),A(this.timer);var r=this.translater.getComputedPosition(),n=r.x,i=r.y;this.transitionTime(),this.translate({x:n,y:i}),this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:n,y:i})}return e},t.prototype.stop=function(){var e=this.doStop();e&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(Bt),ae=function(o){W(t,o);function t(){return o!==null&&o.apply(this,arguments)||this}return t.prototype.move=function(e,r,n,i){if(!n){this.translate(r),this.options.probeType===3&&this.hooks.trigger(this.hooks.eventTypes.move,r),this.hooks.trigger(this.hooks.eventTypes.end,r);return}this.animate(e,r,n,i)},t.prototype.animate=function(e,r,n,i){var s=this,l=D(),h=l+n,a=this.options.probeType===3,u=function(){var p=D();if(p>=h){s.translate(r),a&&s.hooks.trigger(s.hooks.eventTypes.move,r),s.hooks.trigger(s.hooks.eventTypes.end,r);return}p=(p-l)/n;var v=i(p),k={};Object.keys(r).forEach(function(d){var m=e[d],g=r[d];k[d]=(g-m)*v+m}),s.translate(k),a&&s.hooks.trigger(s.hooks.eventTypes.move,k),s.pending&&(s.timer=Ct(u)),s.pending||(s.callStopWhenPending?s.callStopWhenPending=!1:s.hooks.trigger(s.hooks.eventTypes.end,r))};this.setPending(!0),this.callStopWhenPending&&this.setCallStop(!1),A(this.timer),u()},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),A(this.timer);var r=this.translater.getComputedPosition();this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,r)}return e},t.prototype.stop=function(){var e=this.doStop();e&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(Bt);function le(o,t,e){var r=e.useTransition,n={};return Object.defineProperty(n,"probeType",{enumerable:!0,configurable:!1,get:function(){return e.probeType}}),r?new se(o,t,n):new ae(o,t,n)}var _t=function(){function o(t,e,r){this.wrapper=t,this.options=r,this.hooks=new C(["beforeComputeBoundary","computeBoundary","momentum","end","ignoreHasScroll"]),this.refresh(e)}return o.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},o.prototype.move=function(t){return t=this.hasScroll?t:0,this.setMovingDirection(t),this.performDampingAlgorithm(t,this.options.outOfBoundaryDampingFactor)},o.prototype.setMovingDirection=function(t){this.movingDirection=t>0?-1:t<0?1:0},o.prototype.setDirection=function(t){this.direction=t>0?-1:t<0?1:0},o.prototype.performDampingAlgorithm=function(t,e){var r=this.currentPos+t;return(r>this.minScrollPos||r<this.maxScrollPos)&&(r>this.minScrollPos&&this.options.bounces[0]||r<this.maxScrollPos&&this.options.bounces[1]?r=this.currentPos+t*e:r=r>this.minScrollPos?this.minScrollPos:this.maxScrollPos),r},o.prototype.end=function(t){var e={duration:0},r=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&t<this.options.momentumLimitTime&&r>this.options.momentumLimitDistance){var n=this.direction===-1&&this.options.bounces[0]||this.direction===1&&this.options.bounces[1]?this.wrapperSize:0;e=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,n,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,e);return e},o.prototype.momentum=function(t,e,r,n,i,s,l){l===void 0&&(l=this.options);var h=t-e,a=Math.abs(h)/r,u=l.deceleration,p=l.swipeBounceTime,v=l.swipeTime,k=Math.min(v,a*2/u),d={destination:t+a*a/u*(h<0?-1:1),duration:k,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,d,h),d.destination<n?(d.destination=s?Math.max(n-s/4,n-s/d.rate*a):n,d.duration=p):d.destination>i&&(d.destination=s?Math.min(i+s/4,i+s/d.rate*a):i,d.duration=p),d.destination=Math.round(d.destination),d},o.prototype.updateDirection=function(){var t=this.currentPos-this.absStartPos;this.setDirection(t)},o.prototype.refresh=function(t){var e=this.options.rect,r=e.size,n=e.position,i=window.getComputedStyle(this.wrapper,null).position==="static",s=Pt(this.wrapper);this.wrapperSize=this.wrapper[r==="width"?"clientWidth":"clientHeight"],this.setContent(t);var l=Pt(this.content);this.contentSize=l[r],this.relativeOffset=l[n],i&&(this.relativeOffset-=s[n]),this.computeBoundary(),this.setDirection(0)},o.prototype.setContent=function(t){t!==this.content&&(this.content=t,this.resetState())},o.prototype.resetState=function(){this.currentPos=0,this.startPos=0,this.dist=0,this.setDirection(0),this.setMovingDirection(0),this.resetStartPos()},o.prototype.computeBoundary=function(){this.hooks.trigger(this.hooks.eventTypes.beforeComputeBoundary);var t={minScrollPos:0,maxScrollPos:this.wrapperSize-this.contentSize};t.maxScrollPos<0&&(t.maxScrollPos-=this.relativeOffset,this.options.specifiedIndexAsContent===0&&(t.minScrollPos=-this.relativeOffset)),this.hooks.trigger(this.hooks.eventTypes.computeBoundary,t),this.minScrollPos=t.minScrollPos,this.maxScrollPos=t.maxScrollPos,this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,!this.hasScroll&&this.minScrollPos<this.maxScrollPos&&(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize)},o.prototype.updatePosition=function(t){this.currentPos=t},o.prototype.getCurrentPos=function(){return this.currentPos},o.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos),e=t===this.getCurrentPos();return{position:t,inBoundary:e}},o.prototype.adjustPosition=function(t){return!this.hasScroll&&!this.hooks.trigger(this.hooks.eventTypes.ignoreHasScroll)?t=this.minScrollPos:t>this.minScrollPos?t=this.minScrollPos:t<this.maxScrollPos&&(t=this.maxScrollPos),t},o.prototype.updateStartPos=function(){this.startPos=this.currentPos},o.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},o.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},o.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},o.prototype.destroy=function(){this.hooks.destroy()},o}(),V,$,j,U,At=(V={},V.yes=function(o){return!0},V.no=function(o){return Tt(o),!1},V),ce=($={},$.horizontal=(j={},j.yes="horizontal",j.no="vertical",j),$.vertical=(U={},U.yes="vertical",U.no="horizontal",U),$),he=function(){function o(t,e,r){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=r,this.reset()}return o.prototype.reset=function(){this.directionLocked=""},o.prototype.checkMovingDirection=function(t,e,r){return this.computeDirectionLock(t,e),this.handleEventPassthrough(r)},o.prototype.adjustDelta=function(t,e){return this.directionLocked==="horizontal"?e=0:this.directionLocked==="vertical"&&(t=0),{deltaX:t,deltaY:e}},o.prototype.computeDirectionLock=function(t,e){this.directionLocked===""&&!this.freeScroll&&(t>e+this.directionLockThreshold?this.directionLocked="horizontal":e>=t+this.directionLockThreshold?this.directionLocked="vertical":this.directionLocked="none")},o.prototype.handleEventPassthrough=function(t){var e=ce[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return At.yes(t);if(this.eventPassthrough===e.no)return At.no(t)}return!1},o}(),ue=function(o,t,e){return e===2?[t,-o]:e===3?[-o,-t]:e===4?[-t,o]:[o,t]},pe=function(){function o(t,e,r,n,i){this.hooks=new C(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd","contentNotMoved","detectMovingDirection","coordinateTransformation"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=r,this.animater=n,this.options=i,this.directionLockAction=new he(i.directionLockThreshold,i.freeScroll,i.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}return o.prototype.bindActionsHandler=function(){var t=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(e){return t.enabled?t.handleStart(e):!0}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(e){var r=e.deltaX,n=e.deltaY,i=e.e;if(!t.enabled)return!0;var s=ue(r,n,t.options.quadrant),l=s[0],h=s[1],a={deltaX:l,deltaY:h};return t.hooks.trigger(t.hooks.eventTypes.coordinateTransformation,a),t.handleMove(a.deltaX,a.deltaY,i)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(e){return t.enabled?t.handleEnd(e):!0}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(e){t.enabled&&!e._constructed&&t.handleClick(e)})},o.prototype.handleStart=function(t){var e=D();this.fingerMoved=!1,this.contentMoved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.doStop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},o.prototype.handleMove=function(t,e,r){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,r)){var n=this.scrollBehaviorX.getAbsDist(t),i=this.scrollBehaviorY.getAbsDist(e),s=D();if(this.checkMomentum(n,i,s))return!0;if(this.directionLockAction.checkMovingDirection(n,i,r))return this.actionsHandler.setInitiated(),!0;var l=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.getCurrentPos(),a=this.scrollBehaviorX.move(l.deltaX),u=this.scrollBehaviorY.getCurrentPos(),p=this.scrollBehaviorY.move(l.deltaY);if(!this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)){this.fingerMoved||(this.fingerMoved=!0);var v=a!==h||p!==u;!this.contentMoved&&!v&&this.hooks.trigger(this.hooks.eventTypes.contentNotMoved),!this.contentMoved&&v&&(this.contentMoved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.contentMoved&&v&&(this.animater.translate({x:a,y:p}),this.dispatchScroll(s))}}},o.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),this.options.probeType===1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},o.prototype.checkMomentum=function(t,e,r){return r-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},o.prototype.handleEnd=function(t){if(!this.hooks.trigger(this.hooks.eventTypes.beforeEnd,t)){var e=this.getCurrentPos();if(this.scrollBehaviorX.updateDirection(),this.scrollBehaviorY.updateDirection(),this.hooks.trigger(this.hooks.eventTypes.end,t,e))return!0;e=this.ensureIntegerPos(e),this.animater.translate(e),this.endTime=D();var r=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,r)}},o.prototype.ensureIntegerPos=function(t){this.ensuringInteger=!0;var e=t.x,r=t.y,n=this.scrollBehaviorX,i=n.minScrollPos,s=n.maxScrollPos,l=this.scrollBehaviorY,h=l.minScrollPos,a=l.maxScrollPos;return e=e>0?Math.ceil(e):Math.floor(e),r=r>0?Math.ceil(r):Math.floor(r),e=gt(e,s,i),r=gt(r,a,h),{x:e,y:r}},o.prototype.handleClick=function(t){H(t.target,this.options.preventDefaultException)||(Tt(t),t.stopPropagation())},o.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},o.prototype.refresh=function(){this.endTime=0},o.prototype.destroy=function(){this.hooks.destroy()},o}();function fe(o){var t=["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException","autoEndDistance"].reduce(function(e,r){return e[r]=o[r],e},{});return t}function Yt(o,t,e,r){var n=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor","specifiedIndexAsContent"].reduce(function(i,s){return i[s]=o[s],i},{});return n.scrollable=!!o[t],n.bounces=e,n.rect=r,n}function at(o,t,e){e.forEach(function(r){var n,i;typeof r=="string"?n=i=r:(n=r.source,i=r.target),o.on(n,function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return t.trigger.apply(t,vt([i],s))})})}function de(o,t){for(var e=Object.keys(o),r=0,n=e;r<n.length;r++){var i=n[r];if(o[i]!==t[i])return!1}return!0}var Mt=1,ve=function(){function o(t,e,r){this.wrapper=t,this.content=e,this.resizeTimeout=0,this.hooks=new C(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","resize","touchEnd","end","flick","scrollCancel","momentum","scrollTo","minDistanceScroll","scrollToElement","beforeRefresh"]),this.options=r;var n=this.options.bounce,i=n.left,s=n.right,l=n.top,h=n.bottom;this.scrollBehaviorX=new _t(t,e,Yt(r,"scrollX",[i,s],{size:"width",position:"left"})),this.scrollBehaviorY=new _t(t,e,Yt(r,"scrollY",[l,h],{size:"height",position:"top"})),this.translater=new ne(this.content),this.animater=le(this.content,this.translater,this.options),this.actionsHandler=new re(this.options.bindToTarget?this.content:t,fe(this.options)),this.actions=new pe(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var a=this.resize.bind(this);this.resizeRegister=new R(window,[{name:"orientationchange",handler:a},{name:"resize",handler:a}]),this.registerTransitionEnd(),this.init()}return o.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},o.prototype.registerTransitionEnd=function(){this.transitionEndRegister=new R(this.content,[{name:B.transitionEnd,handler:this.transitionEnd.bind(this)}])},o.prototype.bindTranslater=function(){var t=this,e=this.translater.hooks;e.on(e.eventTypes.beforeTranslate,function(r){t.options.translateZ&&r.push(t.options.translateZ)}),e.on(e.eventTypes.translate,function(r){var n=t.getCurrentPos();if(t.updatePositions(r),t.actions.ensuringInteger===!0){t.actions.ensuringInteger=!1;return}(r.x!==n.x||r.y!==n.y)&&t.togglePointerEvents(!1)})},o.prototype.bindAnimater=function(){var t=this;this.animater.hooks.on(this.animater.hooks.eventTypes.end,function(e){t.resetPosition(t.options.bounceTime)||(t.animater.setPending(!1),t.hooks.trigger(t.hooks.eventTypes.scrollEnd,e))}),at(this.animater.hooks,this.hooks,[{source:this.animater.hooks.eventTypes.move,target:this.hooks.eventTypes.scroll},{source:this.animater.hooks.eventTypes.forceStop,target:this.hooks.eventTypes.scrollEnd}])},o.prototype.bindActions=function(){var t=this,e=this.actions;at(e.hooks,this.hooks,[{source:e.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:e.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:e.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:e.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:e.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:e.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),e.hooks.on(e.hooks.eventTypes.end,function(r,n){if(t.hooks.trigger(t.hooks.eventTypes.touchEnd,n),t.hooks.trigger(t.hooks.eventTypes.end,n)||!e.fingerMoved&&(t.hooks.trigger(t.hooks.eventTypes.scrollCancel),t.checkClick(r)))return!0;if(t.resetPosition(t.options.bounceTime,_.bounce))return t.animater.setForceStopped(!1),!0}),e.hooks.on(e.hooks.eventTypes.scrollEnd,function(r,n){var i=Math.abs(r.x-t.scrollBehaviorX.startPos),s=Math.abs(r.y-t.scrollBehaviorY.startPos);if(t.checkFlick(n,i,s)){t.animater.setForceStopped(!1),t.hooks.trigger(t.hooks.eventTypes.flick);return}if(t.momentum(r,n)){t.animater.setForceStopped(!1);return}e.contentMoved&&t.hooks.trigger(t.hooks.eventTypes.scrollEnd,r),t.animater.forceStopped&&t.animater.setForceStopped(!1)})},o.prototype.checkFlick=function(t,e,r){var n=1;if(this.hooks.events.flick.length>1&&t<this.options.flickLimitTime&&e<this.options.flickLimitDistance&&r<this.options.flickLimitDistance&&(r>n||e>n))return!0},o.prototype.momentum=function(t,e){var r={time:0,easing:_.swiper,newX:t.x,newY:t.y},n=this.scrollBehaviorX.end(e),i=this.scrollBehaviorY.end(e);if(r.newX=ot(n.destination)?r.newX:n.destination,r.newY=ot(i.destination)?r.newY:i.destination,r.time=Math.max(n.duration,i.duration),this.hooks.trigger(this.hooks.eventTypes.momentum,r,this),r.newX!==t.x||r.newY!==t.y)return(r.newX>this.scrollBehaviorX.minScrollPos||r.newX<this.scrollBehaviorX.maxScrollPos||r.newY>this.scrollBehaviorY.minScrollPos||r.newY<this.scrollBehaviorY.maxScrollPos)&&(r.easing=_.swipeBounce),this.scrollTo(r.newX,r.newY,r.time,r.easing),!0},o.prototype.checkClick=function(t){var e={preventClick:this.animater.forceStopped};if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return this.animater.setForceStopped(!1),!0;if(!e.preventClick){var r=this.options.dblclick,n=!1;if(r&&this.lastClickTime){var i=r.delay,s=i===void 0?300:i;D()-this.lastClickTime<s&&(n=!0,Gt(t))}return this.options.tap&&qt(t,this.options.tap),this.options.click&&!H(t.target,this.options.preventDefaultException)&&Et(t),this.lastClickTime=n?null:D(),!0}return!1},o.prototype.resize=function(){var t=this;this.actions.enabled&&(Nt&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.hooks.trigger(t.hooks.eventTypes.resize)},this.options.resizePolling))},o.prototype.transitionEnd=function(t){if(!(t.target!==this.content||!this.animater.pending)){var e=this.animater;e.transitionTime(),this.resetPosition(this.options.bounceTime,_.bounce)||(this.animater.setPending(!1),this.options.probeType!==3&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos()))}},o.prototype.togglePointerEvents=function(t){t===void 0&&(t=!0);for(var e=this.content.children.length?this.content.children:[this.content],r=t?"auto":"none",n=0;n<e.length;n++){var i=e[n];i.isBScrollContainer||(i.style.pointerEvents=r)}},o.prototype.refresh=function(t){var e=this.setContent(t);this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(t),this.scrollBehaviorY.refresh(t),e&&(this.translater.setContent(t),this.animater.setContent(t),this.transitionEndRegister.destroy(),this.registerTransitionEnd(),this.options.bindToTarget&&this.actionsHandler.setContent(t)),this.actions.refresh(),this.wrapperOffset=bt(this.wrapper)},o.prototype.setContent=function(t){var e=t!==this.content;return e&&(this.content=t),e},o.prototype.scrollBy=function(t,e,r,n){r===void 0&&(r=0);var i=this.getCurrentPos(),s=i.x,l=i.y;n=n||_.bounce,t+=s,e+=l,this.scrollTo(t,e,r,n)},o.prototype.scrollTo=function(t,e,r,n,i){r===void 0&&(r=0),n===void 0&&(n=_.bounce),i===void 0&&(i={start:{},end:{}});var s=this.options.useTransition?n.style:n.fn,l=this.getCurrentPos(),h=z({x:l.x,y:l.y},i.start),a=z({x:t,y:e},i.end);if(this.hooks.trigger(this.hooks.eventTypes.scrollTo,a),!de(h,a)){var u=Math.abs(a.x-h.x),p=Math.abs(a.y-h.y);u<Mt&&p<Mt&&(r=0,this.hooks.trigger(this.hooks.eventTypes.minDistanceScroll)),this.animater.move(h,a,r,s)}},o.prototype.scrollToElement=function(t,e,r,n,i){var s=kt(t),l=bt(s),h=function(u,p,v){return typeof u=="number"?u:u?Math.round(p/2-v/2):0};r=h(r,s.offsetWidth,this.wrapper.offsetWidth),n=h(n,s.offsetHeight,this.wrapper.offsetHeight);var a=function(u,p,v,k){return u-=p,u=k.adjustPosition(u-v),u};l.left=a(l.left,this.wrapperOffset.left,r,this.scrollBehaviorX),l.top=a(l.top,this.wrapperOffset.top,n,this.scrollBehaviorY),!this.hooks.trigger(this.hooks.eventTypes.scrollToElement,s,l)&&this.scrollTo(l.left,l.top,e,i)},o.prototype.resetPosition=function(t,e){t===void 0&&(t=0),e===void 0&&(e=_.bounce);var r=this.scrollBehaviorX.checkInBoundary(),n=r.position,i=r.inBoundary,s=this.scrollBehaviorY.checkInBoundary(),l=s.position,h=s.inBoundary;return i&&h?!1:(Ft&&this.reflow(),this.scrollTo(n,l,t,e),!0)},o.prototype.reflow=function(){this._reflow=this.content.offsetHeight},o.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},o.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},o.prototype.enable=function(){this.actions.enabled=!0},o.prototype.disable=function(){A(this.animater.timer),this.actions.enabled=!1},o.prototype.destroy=function(){var t=this,e=["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"];e.forEach(function(r){return t[r].destroy()})},o}(),q=function(o){W(t,o);function t(e,r){var n=o.call(this,["refresh","contentChanged","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=kt(e);return i?(n.plugins={},n.options=new oe().merge(r).process(),n.setContent(i).valid&&(n.hooks=new C(["refresh","enable","disable","destroy","beforeInitialScrollTo","contentChanged"]),n.init(i)),n):(K("Can not resolve the wrapper DOM."),n)}return t.use=function(e){var r=e.pluginName,n=t.plugins.some(function(i){return e===i.ctor});return n?t:ot(r)?(K("Plugin Class must specify plugin's name in static property by 'pluginName' field."),t):(t.pluginsMap[r]=!0,t.plugins.push({name:r,applyOrder:e.applyOrder,ctor:e}),t)},t.prototype.setContent=function(e){var r=!1,n=!0,i=e.children[this.options.specifiedIndexAsContent];return i?(r=this.content!==i,r&&(this.content=i)):(K("The wrapper need at least one child element to be content element to scroll."),n=!1),{valid:n,contentChanged:r}},t.prototype.init=function(e){var r=this;this.wrapper=e,e.isBScrollContainer=!0,this.scroller=new ve(e,this.content,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,function(){r.refresh()}),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(zt),this.applyPlugins(),this.refreshWithoutReset(this.content);var n=this.options,i=n.startX,s=n.startY,l={x:i,y:s};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,l)||this.scroller.scrollTo(l.x,l.y)},t.prototype.applyPlugins=function(){var e=this,r=this.options;t.plugins.sort(function(n,i){var s,l=(s={},s.pre=-1,s.post=1,s),h=n.applyOrder?l[n.applyOrder]:0,a=i.applyOrder?l[i.applyOrder]:0;return h-a}).forEach(function(n){var i=n.ctor;r[n.name]&&typeof i=="function"&&(e.plugins[n.name]=new i(e))})},t.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,function(){var e=document.activeElement;e&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")&&e.blur()})},t.prototype.eventBubbling=function(){at(this.scroller.hooks,this,[this.eventTypes.beforeScrollStart,this.eventTypes.scrollStart,this.eventTypes.scroll,this.eventTypes.scrollEnd,this.eventTypes.scrollCancel,this.eventTypes.touchEnd,this.eventTypes.flick])},t.prototype.refreshWithoutReset=function(e){this.scroller.refresh(e),this.hooks.trigger(this.hooks.eventTypes.refresh,e),this.trigger(this.eventTypes.refresh,e)},t.prototype.proxy=function(e){var r=this;e.forEach(function(n){var i=n.key,s=n.sourceKey;te(r,s,i)})},t.prototype.refresh=function(){var e=this.setContent(this.wrapper),r=e.contentChanged,n=e.valid;if(n){var i=this.content;this.refreshWithoutReset(i),r&&(this.hooks.trigger(this.hooks.eventTypes.contentChanged,i),this.trigger(this.eventTypes.contentChanged,i)),this.scroller.resetPosition()}},t.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},t.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},t.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},t.prototype.eventRegister=function(e){this.registerType(e)},t.plugins=[],t.pluginsMap={},t}(C);function N(o,t){var e=new q(o,t);return e}N.use=q.use,N.plugins=q.plugins,N.pluginsMap=q.pluginsMap;var me=N;/*!
|
|
20
20
|
* better-scroll / wheel
|
|
21
21
|
* (c) 2016-2023 ustbhuangyi
|
|
22
22
|
* Released under the MIT License.
|
|
23
|
-
*/var F=typeof window<"u",G=F&&navigator.userAgent.toLowerCase();G&&G.indexOf("android")>0,function(){if(typeof G=="string"){var o=/os (\d\d?_\d(_\d)?)/,t=o.exec(G);if(!t)return!1;var e=t[1].split("_").map(function(r){return parseInt(r,10)});return e[0]===13&&e[1]>=4}return!1}();var ye=!1;if(F){var ge="test-passive";try{var Xt={};Object.defineProperty(Xt,"passive",{get:function(){ye=!0}}),window.addEventListener(ge,function(){},Xt)}catch{}}var ke=function(o,t){for(var e in t)o[e]=t[e];return o},Ot=F&&document.createElement("div").style,L=function(){if(!F)return!1;for(var o=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],t=0,e=o;t<e.length;t++){var r=e[t];if(Ot[r.value]!==void 0)return r.key}return!1}();function P(o){return L===!1?o:L==="standard"?o==="transitionEnd"?"transitionend":o:L+o.charAt(0).toUpperCase()+o.substr(1)}L&&L!=="standard"&&""+L.toLowerCase();var Te=P("transform"),be=P("transition");F&&P("perspective")in Ot;var lt={transform:Te,transition:be,transitionTimingFunction:P("transitionTimingFunction"),transitionDuration:P("transitionDuration"),transitionDelay:P("transitionDelay"),transformOrigin:P("transformOrigin"),transitionEnd:P("transitionEnd"),transitionProperty:P("transitionProperty")};function Z(o,t){var e=new RegExp("(^|\\s)"+t+"(\\s|$)");return e.test(o.className)}function Se(o){return Array.prototype.slice.call(o,0)}var we={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(o){return 1+--o*o*o*o*o}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(o){return o*(2-o)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(o){return 1- --o*o*o*o}}},Pe="plugins.wheel",Ee=[{key:"wheelTo",name:"wheelTo"},{key:"getSelectedIndex",name:"getSelectedIndex"},{key:"restorePosition",name:"restorePosition"}],xe=Ee.map(function(o){return{key:o.key,sourceKey:Pe+"."+o.name}}),Lt="wheelIndexChanged",Ce={rate:4},De=function(){function o(t){this.scroll=t,this.init()}return o.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.refreshBoundary(),this.setSelectedIndex(this.options.selectedIndex)},o.prototype.handleBScroll=function(){this.scroll.proxy(xe),this.scroll.registerType([Lt])},o.prototype.handleOptions=function(){var t=this.scroll.options.wheel===!0?{}:this.scroll.options.wheel,e={wheelWrapperClass:"wheel-scroll",wheelItemClass:"wheel-item",rotate:25,adjustTime:400,selectedIndex:0,wheelDisabledItemClass:"wheel-disabled-item"};this.options=ke(e,t)},o.prototype.handleHooks=function(){var t=this,e=this.scroll,r=this.scroll.scroller,i=r.actionsHandler,n=r.scrollBehaviorX,s=r.scrollBehaviorY,l=r.animater,h=r.content;e.on(e.eventTypes.scrollEnd,function(a){var u=t.findNearestValidWheel(a.y).index;if(r.animater.forceStopped&&!t.isAdjustingPosition)return t.target=t.items[u],!0;t.setSelectedIndex(u),t.isAdjustingPosition&&(t.isAdjustingPosition=!1)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.refresh,function(a){a!==h&&(h=a,t.setSelectedIndex(t.options.selectedIndex,!0)),t.rotateX(t.scroll.y),t.wheelTo(t.selectedIndex,0)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(a){a.x=0,a.y=-(t.selectedIndex*t.itemHeight)}),r.hooks.on(r.hooks.eventTypes.checkClick,function(){var a=Se(t.items).indexOf(t.target);return a===-1||t.wheelTo(a,t.options.adjustTime,we.swipe),!0}),r.hooks.on(r.hooks.eventTypes.scrollTo,function(a){a.y=t.findNearestValidWheel(a.y).y}),r.hooks.on(r.hooks.eventTypes.minDistanceScroll,function(){var a=r.animater;a.forceStopped===!0&&(a.forceStopped=!1)}),r.hooks.on(r.hooks.eventTypes.scrollToElement,function(a,u){if(Z(a,t.options.wheelItemClass))u.top=t.findNearestValidWheel(u.top).y;else return!0}),i.hooks.on(i.hooks.eventTypes.beforeStart,function(a){t.target=a.target}),n.hooks.on(n.hooks.eventTypes.computeBoundary,function(a){a.maxScrollPos=0,a.minScrollPos=0}),s.hooks.on(s.hooks.eventTypes.computeBoundary,function(a){t.items=t.scroll.scroller.content.children,t.checkWheelAllDisabled(),t.itemHeight=t.items.length>0?s.contentSize/t.items.length:0,a.maxScrollPos=-t.itemHeight*(t.items.length-1),a.minScrollPos=0}),s.hooks.on(s.hooks.eventTypes.momentum,function(a){a.rate=Ce.rate,a.destination=t.findNearestValidWheel(a.destination).y}),s.hooks.on(s.hooks.eventTypes.end,function(a){var u=t.findNearestValidWheel(s.currentPos);a.destination=u.y,a.duration=t.options.adjustTime}),l.hooks.on(l.hooks.eventTypes.time,function(a){t.transitionDuration(a)}),l.hooks.on(l.hooks.eventTypes.timeFunction,function(a){t.timeFunction(a)}),l.hooks.on(l.hooks.eventTypes.callStop,function(){var a=t.findNearestValidWheel(t.scroll.y).index;t.isAdjustingPosition=!0,t.wheelTo(a,0)}),l.translater.hooks.on(l.translater.hooks.eventTypes.translate,function(a){t.rotateX(a.y)})},o.prototype.refreshBoundary=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,r=t.scrollBehaviorY,i=t.content;e.refresh(i),r.refresh(i)},o.prototype.setSelectedIndex=function(t,e){e===void 0&&(e=!1);var r=this.selectedIndex;this.selectedIndex=t,r!==t&&!e&&this.scroll.trigger(Lt,t)},o.prototype.getSelectedIndex=function(){return this.selectedIndex},o.prototype.wheelTo=function(t,e,r){t===void 0&&(t=0),e===void 0&&(e=0);var i=-t*this.itemHeight;this.scroll.scrollTo(0,i,e,r)},o.prototype.restorePosition=function(){var t=this.scroll.pending;if(t){var e=this.getSelectedIndex();this.scroll.scroller.animater.clearTimer(),this.wheelTo(e,0)}},o.prototype.transitionDuration=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[lt.transitionDuration]=t+"ms"},o.prototype.timeFunction=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[lt.transitionTimingFunction]=t},o.prototype.rotateX=function(t){for(var e=this.options.rotate,r=e===void 0?25:e,i=0;i<this.items.length;i++){var n=r*(t/this.itemHeight+i),s=n.toFixed(3);this.items[i].style[lt.transform]="rotateX("+s+"deg)"}},o.prototype.findNearestValidWheel=function(t){t=t>0?0:t<this.scroll.maxScrollY?this.scroll.maxScrollY:t;for(var e=Math.abs(Math.round(-t/this.itemHeight)),r=e,i=this.items,n=this.options.wheelDisabledItemClass;e>=0&&Z(i[e],n);)e--;if(e<0)for(e=r;e<=i.length-1&&Z(i[e],n);)e++;return e===i.length&&(e=r),{index:this.wheelItemsAllDisabled?-1:e,y:-e*this.itemHeight}},o.prototype.checkWheelAllDisabled=function(){var t=this.options.wheelDisabledItemClass,e=this.items;this.wheelItemsAllDisabled=!0;for(var r=0;r<e.length;r++)if(!Z(e[r],t)){this.wheelItemsAllDisabled=!1;break}},o.pluginName="wheel",o}();me.use(De);const J=Array.isArray,Be=o=>typeof o=="object"&&o!==null;function ct(o){return J(o)&&o.length===3}function _e(o){return o%4===0&&(o%100!==0||o%400===0)}function I(o,t){const e=[];for(let r=o;r<=t;r++)e.push(r);return e}function ht(o,t){const e=[];for(let r=o;r<=t;r++)e.push(`${r}`.padStart(2,"0"));return e}function Ae(){const o=ht(0,23),t=ht(0,59),e=ht(0,59),r=c.ref([]);i();function i(){const s=new Date,l=s.getHours(),h=s.getMinutes(),a=s.getSeconds();r.value=[l,h,a]}function n(s){return(ct(s)?s:r.value).map(h=>+h)}return{timeList:[o,t,e],updateDefaultTime:i,getTimeAnchors:n}}function Ye(){const e=new Date,r=e.getFullYear(),i=e.getMonth()+1,n=e.getDate(),s=c.ref(r),l=c.ref(i),h=I(1900,2100),a=I(1,12),u=c.computed(()=>{const d=[4,6,9,11],m=[1,3,5,7,8,10,12];return d.includes(l.value)?I(1,30):m.includes(l.value)?I(1,31):_e(s.value)?I(1,29):I(1,28)}),p=c.computed(()=>[h,a,u.value]);function v(d){return(ct(d)?d:[r,i,n]).map((g,Y)=>{const E=p.value[Y].indexOf(g);return E!==-1?E:0})}function k(d){const[m,g]=d;s.value=p.value[0][m],l.value=p.value[1][g]}return{selectYear:s,selectMonth:l,dateList:p,updateDateSelect:k,getDateAnchors:v}}function Me(o,t){const e=c.ref([]),r=c.ref(),i=c.ref([]),n=c.computed(()=>o.type==="date"),s=c.computed(()=>o.type==="time"),{selectYear:l,selectMonth:h,dateList:a,updateDateSelect:u,getDateAnchors:p}=Ye(),{timeList:v,updateDefaultTime:k,getTimeAnchors:d}=Ae(),m=c.computed(()=>n.value?p(o.anchor):s.value?d(o.anchor):J(o.anchor)?o.anchor:[o.anchor]);async function g(f=!1){f?Y():E(),await c.nextTick(),e.value.forEach((T,y)=>ut(y)),f||He(),Ne()}function Y(){const f={date:a==null?void 0:a.value,time:v},T=o.type,b=J(o.data[0])?[...o.data]:[o.data];e.value=f[T]??b}function E(){!n.value&&!s.value||(n.value&&u(m.value),s.value&&!ct(o.anchor)&&k())}function ut(f){var b;const T=(b=r.value)==null?void 0:b.children[f];if(!T)return;let y=i.value[f];if(y)y.refresh();else{const ft=N(T,{wheel:{selectedIndex:0,rotate:25},swipeTime:o.swipeTime??500});y=i.value[f]=ft,y.on("scrollEnd",()=>Q(f))}return y}function Q(f){if(!n.value||f===2)return;const T=i.value[f].getSelectedIndex(),y=a.value[f][T];f===0&&(l.value=y),f===1&&(h.value=y),g(!0)}function He(){i.value.forEach((f,T)=>{var b;const y=(b=m.value)==null?void 0:b[T];f.wheelTo(y??0)})}function Ne(){const f=e.value.length;if(i.value.length<=f)return;i.value.splice(f).forEach(y=>y.destroy())}function Fe(){t("cancel"),pt()}function We(){i.value.some(b=>b.isInTransition)&&Ke();const{item:T,anchor:y}=Re();t("confirm",T),t("update:anchor",y),pt()}function pt(){t("update:isShowPicker",!1)}function Ke(){i.value.forEach(f=>f.stop())}function Re(){const{item:f,anchor:T}=i.value.reduce((y,b,ft)=>{const It=b.getSelectedIndex(),dt=e.value[ft][It];return y.item.push(s.value?+dt:dt),y.anchor.push(n.value?dt:It),y},{item:[],anchor:[]});return f.length>1?{item:f,anchor:T}:{item:f[0],anchor:T[0]}}return c.watch(()=>o.data,()=>g(!0),{immediate:!0}),c.watch(()=>o.isShowPicker,f=>f&&g()),c.watch(()=>o.type,()=>{E(),g(!0)}),{pickerData:e,wheelWrapper:r,cancel:Fe,confirm:We,closePicker:pt}}const Xe={cancelClass:"",confirmClass:"",titleClass:"",cancelColor:"#999",confirmColor:"#42b983",titleColor:"",cancelText:"Cancel",confirmText:"Confirm",titleText:""},Oe={class:"picker"},Le={class:"picker_title"},Ie={class:"picker_panel"},ze={class:"picker_wheel_scroll"};return c.defineComponent({__name:"Picker",props:{data:{default:()=>[]},isShowPicker:{type:Boolean},options:{default:()=>({})},anchor:{},showKey:{default:""},swipeTime:{default:500},type:{default:""}},emits:["update:isShowPicker","update:anchor","cancel","confirm"],setup(o,{emit:t}){const e=o,r=t,i=c.computed(()=>({...Xe,...e.options})),n=c.computed(()=>i.value.cancelColor),s=c.computed(()=>i.value.confirmColor),l=c.computed(()=>i.value.titleColor),h=c.computed(()=>J(e.showKey)?e.showKey:[e.showKey]),{pickerData:a,wheelWrapper:u,cancel:p,confirm:v,closePicker:k}=Me(e,r);return(d,m)=>(c.openBlock(),c.createElementBlock("div",null,[c.createVNode(c.Transition,{name:"fade"},{default:c.withCtx(()=>[c.withDirectives(c.createElementVNode("div",{class:"mask",onClick:m[0]||(m[0]=(...g)=>c.unref(k)&&c.unref(k)(...g))},null,512),[[c.vShow,d.isShowPicker]])]),_:1}),c.createVNode(c.Transition,{name:"slide"},{default:c.withCtx(()=>[c.withDirectives(c.createElementVNode("div",Oe,[c.createElementVNode("div",Le,[c.createElementVNode("button",{class:c.normalizeClass(["picker_cancel",i.value.cancelClass]),style:c.normalizeStyle({color:n.value}),onClick:m[1]||(m[1]=(...g)=>c.unref(p)&&c.unref(p)(...g))},c.toDisplayString(i.value.cancelText),7),c.createElementVNode("button",{class:c.normalizeClass(["picker_confirm",i.value.confirmClass]),style:c.normalizeStyle({color:s.value}),onClick:m[2]||(m[2]=(...g)=>c.unref(v)&&c.unref(v)(...g))},c.toDisplayString(i.value.confirmText),7),c.createElementVNode("h4",{class:c.normalizeClass([i.value.titleClass]),style:c.normalizeStyle({color:l.value})},c.toDisplayString(i.value.titleText),7)]),c.createElementVNode("div",Ie,[m[3]||(m[3]=c.createElementVNode("div",{class:"picker_mask_top"},null,-1)),m[4]||(m[4]=c.createElementVNode("div",{class:"picker_mask_bottom"},null,-1)),c.createElementVNode("div",{ref_key:"wheelWrapper",ref:u,class:"picker_wheel_wrapper"},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(a),(g,Y)=>(c.openBlock(),c.createElementBlock("div",{key:Y,class:"picker_wheel"},[c.createElementVNode("ul",ze,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(g,(E,ut)=>{var Q;return c.openBlock(),c.createElementBlock("li",{key:ut,class:"picker_wheel_item"},c.toDisplayString((Q=h.value)!=null&&Q[Y]&&c.unref(Be)(E)?E[h.value[Y]]:E),1)}),128))])]))),128))],512)])],512),[[c.vShow,d.isShowPicker]])]),_:1})]))}})});
|
|
23
|
+
*/var F=typeof window<"u",G=F&&navigator.userAgent.toLowerCase();G&&G.indexOf("android")>0,function(){if(typeof G=="string"){var o=/os (\d\d?_\d(_\d)?)/,t=o.exec(G);if(!t)return!1;var e=t[1].split("_").map(function(r){return parseInt(r,10)});return e[0]===13&&e[1]>=4}return!1}();var ye=!1;if(F){var ge="test-passive";try{var Xt={};Object.defineProperty(Xt,"passive",{get:function(){ye=!0}}),window.addEventListener(ge,function(){},Xt)}catch{}}var ke=function(o,t){for(var e in t)o[e]=t[e];return o},Ot=F&&document.createElement("div").style,L=function(){if(!F)return!1;for(var o=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],t=0,e=o;t<e.length;t++){var r=e[t];if(Ot[r.value]!==void 0)return r.key}return!1}();function P(o){return L===!1?o:L==="standard"?o==="transitionEnd"?"transitionend":o:L+o.charAt(0).toUpperCase()+o.substr(1)}L&&L!=="standard"&&""+L.toLowerCase();var Te=P("transform"),be=P("transition");F&&P("perspective")in Ot;var lt={transform:Te,transition:be,transitionTimingFunction:P("transitionTimingFunction"),transitionDuration:P("transitionDuration"),transitionDelay:P("transitionDelay"),transformOrigin:P("transformOrigin"),transitionEnd:P("transitionEnd"),transitionProperty:P("transitionProperty")};function Z(o,t){var e=new RegExp("(^|\\s)"+t+"(\\s|$)");return e.test(o.className)}function Se(o){return Array.prototype.slice.call(o,0)}var we={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(o){return 1+--o*o*o*o*o}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(o){return o*(2-o)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(o){return 1- --o*o*o*o}}},Pe="plugins.wheel",Ee=[{key:"wheelTo",name:"wheelTo"},{key:"getSelectedIndex",name:"getSelectedIndex"},{key:"restorePosition",name:"restorePosition"}],xe=Ee.map(function(o){return{key:o.key,sourceKey:Pe+"."+o.name}}),Lt="wheelIndexChanged",Ce={rate:4},De=function(){function o(t){this.scroll=t,this.init()}return o.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.refreshBoundary(),this.setSelectedIndex(this.options.selectedIndex)},o.prototype.handleBScroll=function(){this.scroll.proxy(xe),this.scroll.registerType([Lt])},o.prototype.handleOptions=function(){var t=this.scroll.options.wheel===!0?{}:this.scroll.options.wheel,e={wheelWrapperClass:"wheel-scroll",wheelItemClass:"wheel-item",rotate:25,adjustTime:400,selectedIndex:0,wheelDisabledItemClass:"wheel-disabled-item"};this.options=ke(e,t)},o.prototype.handleHooks=function(){var t=this,e=this.scroll,r=this.scroll.scroller,n=r.actionsHandler,i=r.scrollBehaviorX,s=r.scrollBehaviorY,l=r.animater,h=r.content;e.on(e.eventTypes.scrollEnd,function(a){var u=t.findNearestValidWheel(a.y).index;if(r.animater.forceStopped&&!t.isAdjustingPosition)return t.target=t.items[u],!0;t.setSelectedIndex(u),t.isAdjustingPosition&&(t.isAdjustingPosition=!1)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.refresh,function(a){a!==h&&(h=a,t.setSelectedIndex(t.options.selectedIndex,!0)),t.rotateX(t.scroll.y),t.wheelTo(t.selectedIndex,0)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(a){a.x=0,a.y=-(t.selectedIndex*t.itemHeight)}),r.hooks.on(r.hooks.eventTypes.checkClick,function(){var a=Se(t.items).indexOf(t.target);return a===-1||t.wheelTo(a,t.options.adjustTime,we.swipe),!0}),r.hooks.on(r.hooks.eventTypes.scrollTo,function(a){a.y=t.findNearestValidWheel(a.y).y}),r.hooks.on(r.hooks.eventTypes.minDistanceScroll,function(){var a=r.animater;a.forceStopped===!0&&(a.forceStopped=!1)}),r.hooks.on(r.hooks.eventTypes.scrollToElement,function(a,u){if(Z(a,t.options.wheelItemClass))u.top=t.findNearestValidWheel(u.top).y;else return!0}),n.hooks.on(n.hooks.eventTypes.beforeStart,function(a){t.target=a.target}),i.hooks.on(i.hooks.eventTypes.computeBoundary,function(a){a.maxScrollPos=0,a.minScrollPos=0}),s.hooks.on(s.hooks.eventTypes.computeBoundary,function(a){t.items=t.scroll.scroller.content.children,t.checkWheelAllDisabled(),t.itemHeight=t.items.length>0?s.contentSize/t.items.length:0,a.maxScrollPos=-t.itemHeight*(t.items.length-1),a.minScrollPos=0}),s.hooks.on(s.hooks.eventTypes.momentum,function(a){a.rate=Ce.rate,a.destination=t.findNearestValidWheel(a.destination).y}),s.hooks.on(s.hooks.eventTypes.end,function(a){var u=t.findNearestValidWheel(s.currentPos);a.destination=u.y,a.duration=t.options.adjustTime}),l.hooks.on(l.hooks.eventTypes.time,function(a){t.transitionDuration(a)}),l.hooks.on(l.hooks.eventTypes.timeFunction,function(a){t.timeFunction(a)}),l.hooks.on(l.hooks.eventTypes.callStop,function(){var a=t.findNearestValidWheel(t.scroll.y).index;t.isAdjustingPosition=!0,t.wheelTo(a,0)}),l.translater.hooks.on(l.translater.hooks.eventTypes.translate,function(a){t.rotateX(a.y)})},o.prototype.refreshBoundary=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,r=t.scrollBehaviorY,n=t.content;e.refresh(n),r.refresh(n)},o.prototype.setSelectedIndex=function(t,e){e===void 0&&(e=!1);var r=this.selectedIndex;this.selectedIndex=t,r!==t&&!e&&this.scroll.trigger(Lt,t)},o.prototype.getSelectedIndex=function(){return this.selectedIndex},o.prototype.wheelTo=function(t,e,r){t===void 0&&(t=0),e===void 0&&(e=0);var n=-t*this.itemHeight;this.scroll.scrollTo(0,n,e,r)},o.prototype.restorePosition=function(){var t=this.scroll.pending;if(t){var e=this.getSelectedIndex();this.scroll.scroller.animater.clearTimer(),this.wheelTo(e,0)}},o.prototype.transitionDuration=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[lt.transitionDuration]=t+"ms"},o.prototype.timeFunction=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[lt.transitionTimingFunction]=t},o.prototype.rotateX=function(t){for(var e=this.options.rotate,r=e===void 0?25:e,n=0;n<this.items.length;n++){var i=r*(t/this.itemHeight+n),s=i.toFixed(3);this.items[n].style[lt.transform]="rotateX("+s+"deg)"}},o.prototype.findNearestValidWheel=function(t){t=t>0?0:t<this.scroll.maxScrollY?this.scroll.maxScrollY:t;for(var e=Math.abs(Math.round(-t/this.itemHeight)),r=e,n=this.items,i=this.options.wheelDisabledItemClass;e>=0&&Z(n[e],i);)e--;if(e<0)for(e=r;e<=n.length-1&&Z(n[e],i);)e++;return e===n.length&&(e=r),{index:this.wheelItemsAllDisabled?-1:e,y:-e*this.itemHeight}},o.prototype.checkWheelAllDisabled=function(){var t=this.options.wheelDisabledItemClass,e=this.items;this.wheelItemsAllDisabled=!0;for(var r=0;r<e.length;r++)if(!Z(e[r],t)){this.wheelItemsAllDisabled=!1;break}},o.pluginName="wheel",o}();me.use(De);const J=Array.isArray,Be=o=>typeof o=="object"&&o!==null;function ct(o){return J(o)&&o.length===3}function _e(o){return o%4===0&&(o%100!==0||o%400===0)}function I(o,t){const e=[];for(let r=o;r<=t;r++)e.push(r);return e}function ht(o,t){const e=[];for(let r=o;r<=t;r++)e.push(`${r}`.padStart(2,"0"));return e}function Ae(){const o=ht(0,23),t=ht(0,59),e=ht(0,59),r=c.ref([]);n();function n(){const s=new Date,l=s.getHours(),h=s.getMinutes(),a=s.getSeconds();r.value=[l,h,a]}function i(s){return(ct(s)?s:r.value).map(h=>+h)}return{timeList:[o,t,e],updateDefaultTime:n,getTimeAnchors:i}}function Ye(){const e=new Date,r=e.getFullYear(),n=e.getMonth()+1,i=e.getDate(),s=c.ref(r),l=c.ref(n),h=I(1900,2100),a=I(1,12),u=c.computed(()=>{const d=[4,6,9,11],m=[1,3,5,7,8,10,12];return d.includes(l.value)?I(1,30):m.includes(l.value)?I(1,31):_e(s.value)?I(1,29):I(1,28)}),p=c.computed(()=>[h,a,u.value]);function v(d){return(ct(d)?d:[r,n,i]).map((g,Y)=>{const E=p.value[Y].indexOf(g);return E!==-1?E:0})}function k(d){const[m,g]=d;s.value=p.value[0][m],l.value=p.value[1][g]}return{selectYear:s,selectMonth:l,dateList:p,updateDateSelect:k,getDateAnchors:v}}function Me(o,t){const e=c.ref([]),r=c.ref(),n=c.ref([]),i=c.computed(()=>o.type==="date"),s=c.computed(()=>o.type==="time"),{selectYear:l,selectMonth:h,dateList:a,updateDateSelect:u,getDateAnchors:p}=Ye(),{timeList:v,updateDefaultTime:k,getTimeAnchors:d}=Ae(),m=c.computed(()=>i.value?p(o.anchor):s.value?d(o.anchor):J(o.anchor)?o.anchor:[o.anchor]);async function g(f=!1){f?Y():E(),await c.nextTick(),e.value.forEach((T,y)=>ut(y)),f||He(),Ne()}function Y(){const f={date:a==null?void 0:a.value,time:v},T=o.type,b=J(o.data[0])?[...o.data]:[o.data];e.value=f[T]??b}function E(){!i.value&&!s.value||(i.value&&u(m.value),s.value&&!ct(o.anchor)&&k())}function ut(f){var b;const T=(b=r.value)==null?void 0:b.children[f];if(!T)return;let y=n.value[f];if(y)y.refresh();else{const ft=N(T,{wheel:{selectedIndex:0,rotate:25},swipeTime:o.swipeTime??500});y=n.value[f]=ft,y.on("scrollEnd",()=>Q(f))}return y}function Q(f){if(!i.value||f===2)return;const T=n.value[f].getSelectedIndex(),y=a.value[f][T];f===0&&(l.value=y),f===1&&(h.value=y),g(!0)}function He(){n.value.forEach((f,T)=>{var b;const y=(b=m.value)==null?void 0:b[T];f.wheelTo(y??0)})}function Ne(){const f=e.value.length;if(n.value.length<=f)return;n.value.splice(f).forEach(y=>y.destroy())}function Fe(){t("cancel"),pt()}function We(){n.value.some(b=>b.isInTransition)&&Ke();const{item:T,anchor:y}=Re();t("confirm",T),t("update:anchor",y),pt()}function pt(){t("update:isShowPicker",!1)}function Ke(){n.value.forEach(f=>f.stop())}function Re(){const{item:f,anchor:T}=n.value.reduce((y,b,ft)=>{const It=b.getSelectedIndex(),dt=e.value[ft][It];return y.item.push(s.value?+dt:dt),y.anchor.push(i.value?dt:It),y},{item:[],anchor:[]});return f.length>1?{item:f,anchor:T}:{item:f[0],anchor:T[0]}}return c.watch(()=>o.data,()=>g(!0),{immediate:!0}),c.watch(()=>o.isShowPicker,f=>f&&g()),c.watch(()=>o.type,()=>{E(),g(!0)}),{pickerData:e,wheelWrapper:r,cancel:Fe,confirm:We,closePicker:pt}}const Xe={cancelClass:"",confirmClass:"",titleClass:"",cancelColor:"#999",confirmColor:"#42b983",titleColor:"",cancelText:"Cancel",confirmText:"Confirm",titleText:""},Oe={class:"component-hook-picker"},Le={class:"component-hook-picker_title"},Ie={class:"component-hook-picker_panel"},ze={class:"component-hook-picker_wheel_scroll"};return c.defineComponent({__name:"Picker",props:{data:{default:()=>[]},isShowPicker:{type:Boolean},options:{default:()=>({})},anchor:{},showKey:{default:""},swipeTime:{default:500},type:{default:""}},emits:["update:isShowPicker","update:anchor","cancel","confirm"],setup(o,{emit:t}){const e=o,r=t,n=c.computed(()=>({...Xe,...e.options})),i=c.computed(()=>n.value.cancelColor),s=c.computed(()=>n.value.confirmColor),l=c.computed(()=>n.value.titleColor),h=c.computed(()=>J(e.showKey)?e.showKey:[e.showKey]),{pickerData:a,wheelWrapper:u,cancel:p,confirm:v,closePicker:k}=Me(e,r);return(d,m)=>(c.openBlock(),c.createElementBlock("div",null,[c.createVNode(c.Transition,{name:"component-hook-picker-fade"},{default:c.withCtx(()=>[c.withDirectives(c.createElementVNode("div",{class:"component-hook-picker-mask",onClick:m[0]||(m[0]=(...g)=>c.unref(k)&&c.unref(k)(...g))},null,512),[[c.vShow,d.isShowPicker]])]),_:1}),c.createVNode(c.Transition,{name:"component-hook-picker-slide"},{default:c.withCtx(()=>[c.withDirectives(c.createElementVNode("div",Oe,[c.createElementVNode("div",Le,[c.createElementVNode("button",{class:c.normalizeClass(["component-hook-picker_cancel",n.value.cancelClass]),style:c.normalizeStyle({color:i.value}),onClick:m[1]||(m[1]=(...g)=>c.unref(p)&&c.unref(p)(...g))},c.toDisplayString(n.value.cancelText),7),c.createElementVNode("button",{class:c.normalizeClass(["component-hook-picker_confirm",n.value.confirmClass]),style:c.normalizeStyle({color:s.value}),onClick:m[2]||(m[2]=(...g)=>c.unref(v)&&c.unref(v)(...g))},c.toDisplayString(n.value.confirmText),7),c.createElementVNode("h4",{class:c.normalizeClass([n.value.titleClass]),style:c.normalizeStyle({color:l.value})},c.toDisplayString(n.value.titleText),7)]),c.createElementVNode("div",Ie,[m[3]||(m[3]=c.createElementVNode("div",{class:"component-hook-picker_mask_top"},null,-1)),m[4]||(m[4]=c.createElementVNode("div",{class:"component-hook-picker_mask_bottom"},null,-1)),c.createElementVNode("div",{ref_key:"wheelWrapper",ref:u,class:"component-hook-picker_wheel_wrapper"},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(a),(g,Y)=>(c.openBlock(),c.createElementBlock("div",{key:Y,class:"component-hook-picker_wheel"},[c.createElementVNode("ul",ze,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(g,(E,ut)=>{var Q;return c.openBlock(),c.createElementBlock("li",{key:ut,class:"component-hook-picker_wheel_item"},c.toDisplayString((Q=h.value)!=null&&Q[Y]&&c.unref(Be)(E)?E[h.value[Y]]:E),1)}),128))])]))),128))],512)])],512),[[c.vShow,d.isShowPicker]])]),_:1})]))}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@component-hook/picker",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4-alpha.0",
|
|
4
4
|
"description": "Picker component with vue3 and react",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"vue": "^3.4.29"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/react-transition-group": "^4.4.
|
|
54
|
-
"vite-plugin-dts": "^4.
|
|
53
|
+
"@types/react-transition-group": "^4.4.12",
|
|
54
|
+
"vite-plugin-dts": "^4.4.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "pnpm build:vue && pnpm build:react",
|