Infinite.00856a6c.js 8.1 KB

1
  1. import{_ as le,d as oe,E as v,B,af as s,u as e,aW as Te,aX as Ae,o as A,c as D,V as x,J as ae,ap as L,a as ie,b as d,G as De,aa as xe,aH as Be,a7 as Me,y as ke,K as $e,L as Oe,M as He,T as z,$ as je,a0 as Ie}from"./index.743f0c80.js";const qe=()=>{window.cancelAnimationFrame=(()=>window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(o){return window.clearTimeout(o)})(),window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(o){return window.setTimeout(o,1e3/60)}}()},Pe=(o,f)=>{if(o===f)return!0;if(o.length!==f.length)return!1;for(let u=0;u<o.length;++u)if(o[u]!==f[u])return!1;return!0};function ue(){Array.isArray||(Array.isArray=function(S){return Object.prototype.toString.call(S)==="[object Array]"});let o,f,u,c,g,F,t=1,n=arguments[0]||{},m=!1,E=arguments.length;if(typeof n=="boolean"&&(m=n,n=arguments[1]||{},t++),typeof n!="object"&&typeof n!="function"&&(n={}),t===E)return n;for(;t<E;t++)if((f=arguments[t])!=null)for(o in f)u=n[o],c=f[o],g=Array.isArray(c),m&&c&&(typeof c=="object"||g)?(g?(g=!1,F=u&&Array.isArray(u)?u:[]):F=u&&typeof u=="object"?u:{},n[o]=ue(m,F,c)):c!==void 0&&(n[o]=c);return n}var Re=Object.freeze(Object.defineProperty({__proto__:null,animationFrame:qe,arrayEqual:Pe,copyObj:ue},Symbol.toStringTag,{value:"Module"}));const We=["innerHTML"],Le={name:"ReSeamlessScroll"},ze=oe({...Le,props:{data:{type:Array},classOption:{type:Object}},emits:["scrollEnd"],setup(o,{expose:f,emit:u}){const c=o,{animationFrame:g,copyObj:F}=Re;g();let t=v(0),n=v(0),m=v(0),E=v(0),S=v(0),C=v(0),M=v(0),k=v(""),_=null,N=null,$=null,Y=null,V=null,O=!1,H="ease-in",{classOption:h}=c;h.key===void 0&&(h.key=0);const X=B(`wrap${h.key}`,null),U=B(`slotList${h.key}`,null),G=B(`realBox${h.key}`,null);let J=s(()=>e(t)<0),K=s(()=>Math.abs(e(t))<e(C)-e(S)),se=s(()=>({step:1,limitMoveNum:5,hoverStop:!0,direction:"top",openTouch:!0,singleHeight:0,singleWidth:0,waitTime:1e3,switchOffset:30,autoPlay:!0,navigation:!1,switchSingleStep:134,switchDelay:400,switchDisabledClass:"disabled",isSingleRemUnit:!1})),i=s(()=>F({},e(se),h));const re=s(()=>e(J)?"":e(i).switchDisabledClass);let ce=s(()=>e(K)?"":e(i).switchDisabledClass),fe=s(()=>({position:"absolute",margin:`${e(E)/2}px 0 0 -${e(i).switchOffset}px`,transform:"translate(-100%,-50%)"})),de=s(()=>({position:"absolute",margin:`${e(E)/2}px 0 0 ${e(S)+e(i).switchOffset}px`,transform:"translateY(-50%)"})),j=s(()=>e(i).direction!=="bottom"&&e(i).direction!=="top"),Q=s(()=>e(j)?{float:"left",overflow:"hidden"}:{overflow:"hidden"}),me=s(()=>({transform:`translate(${e(t)}px,${e(n)}px)`,transition:`all ${H} ${e(m)}ms`,overflow:"hidden"})),I=s(()=>e(i).navigation),q=s(()=>e(I)?!1:e(i).autoPlay),Z=s(()=>c.data.length>=e(i).limitMoveNum),ee=s(()=>e(i).hoverStop&&e(q)&&e(Z)),P=s(()=>e(i).openTouch),te=s(()=>e(i).isSingleRemUnit?parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1),R=s(()=>e(i).singleWidth*e(te)),W=s(()=>e(i).singleHeight*e(te)),w=s(()=>{let a,l=e(i).step;if(e(j)?a=e(R):a=e(W),a>0&&a%l>0)throw"\u5982\u679C\u8BBE\u7F6E\u4E86\u5355\u6B65\u6EDA\u52A8\uFF0Cstep\u9700\u662F\u5355\u6B65\u5927\u5C0F\u7684\u7EA6\u6570\uFF0C\u5426\u5219\u65E0\u6CD5\u4FDD\u8BC1\u5355\u6B65\u6EDA\u52A8\u7ED3\u675F\u7684\u4F4D\u7F6E\u662F\u5426\u51C6\u786E";return l});function he(){t.value=0,n.value=0,b(),ne()}function pe(){if(!!e(J)){if(Math.abs(e(t))<e(i).switchSingleStep){t.value=0;return}t.value+=e(i).switchSingleStep}}function ve(){if(!!e(K)){if(e(C)-e(S)+e(t)<e(i).switchSingleStep){t.value=e(S)-e(C);return}t.value-=e(i).switchSingleStep}}function b(){cancelAnimationFrame(N||"")}function we(a){if(!e(P))return;let l;const r=a.targetTouches[0],{waitTime:p,singleHeight:T,singleWidth:be}=e(i);$={x:r.pageX,y:r.pageY},Y=e(n),V=e(t),!!T&&!!be?(l&&clearTimeout(l),l=setTimeout(()=>{b()},p+20)):b()}function ye(a){if(!e(P)||a.targetTouches.length>1||a.scale&&a.scale!==1)return;const l=a.targetTouches[0],{direction:r}=e(i);let p={x:l.pageX-$.x,y:l.pageY-$.y};a.preventDefault();const T=Math.abs(p.x)<Math.abs(p.y)?1:0;T===1&&r==="bottom"||T===1&&r==="top"?n.value=Y+p.y:(T===0&&r==="left"||T===0&&r==="right")&&(t.value=V+p.x)}function ge(){if(!e(P))return;let a;const l=e(i).direction;if(m.value=50,l==="top")e(n)>0&&(n.value=0);else if(l==="bottom"){let r=e(M)/2*-1;e(n)<r&&(n.value=r)}else if(l==="left")e(t)>0&&(t.value=0);else if(l==="right"){let r=e(C)*-1;e(t)<r&&(t.value=r)}a&&clearTimeout(a),a=setTimeout(()=>{m.value=0,y()},e(m))}function Se(){e(ee)&&Ee()}function _e(){e(ee)&&Fe()}function y(){O||(N=requestAnimationFrame(function(){const a=e(M)/2,l=e(C)/2;let{direction:r,waitTime:p}=e(i);r==="top"?(Math.abs(e(n))>=a&&(u("scrollEnd"),n.value=0),n.value-=w.value):r==="bottom"?(e(n)>=0&&(u("scrollEnd"),n.value=a*-1),n.value+=w.value):r==="left"?(Math.abs(e(t))>=l&&(u("scrollEnd"),t.value=0),t.value-=w.value):r==="right"&&(e(t)>=0&&(u("scrollEnd"),t.value=l*-1),t.value+=w.value),_&&clearTimeout(_),e(W)?Math.abs(e(n))%e(W)<e(w)?_=setTimeout(()=>{y()},p):y():e(R)&&Math.abs(e(t))%e(R)<e(w)?_=setTimeout(()=>{y()},p):y()}))}function ne(){De(()=>{const{switchDelay:a}=e(i);if(k.value="",e(j)){E.value=e(X).offsetHeight,S.value=e(X).offsetWidth;let l=e(U).offsetWidth;e(q)&&(l=l*2+1),e(G).style.width=l+"px",C.value=l}if(e(q))H="ease-in",m.value=0;else{H="linear",m.value=a;return}e(Z)?(k.value=e(U).innerHTML,setTimeout(()=>{M.value=e(G).offsetHeight,y()},0)):(b(),n.value=t.value=0)})}function Fe(){O=!1,y()}function Ee(){O=!0,_&&clearTimeout(_),b()}function Ce(a){a.preventDefault(),!(e(i).direction==="left"||e(i).direction==="right")&&xe(()=>{a.deltaY>0?n.value-=w.value:n.value+=w.value},50)()}return Te(()=>{ne()}),Ae(()=>{b(),clearTimeout(_)}),f({reset:he}),(a,l)=>(A(),D("div",{ref:"wrap"+e(h).key},[e(I)?(A(),D("div",{key:0,style:x(e(fe)),class:ae(e(re)),onClick:pe},[L(a.$slots,"left-switch")],6)):ie("v-if",!0),e(I)?(A(),D("div",{key:1,style:x(e(de)),class:ae(e(ce)),onClick:ve},[L(a.$slots,"right-switch")],6)):ie("v-if",!0),d("div",{ref:"realBox"+e(h).key,style:x(e(me)),onMouseenter:Se,onMouseleave:_e,onTouchstart:we,onTouchmove:ye,onTouchend:ge,onMousewheel:Ce},[d("div",{ref:"slotList"+e(h).key,style:x(e(Q))},[L(a.$slots,"default")],4),d("div",{innerHTML:e(k),style:x(e(Q))},null,12,We)],36)],512))}});var Ne=le(ze,[["__file","D:/work/accout-vue3-ui/src/components/ReSeamlessScroll/src/index.vue"]]);const Ye=Be(Ne);const Ve=o=>(je("data-v-1ac0eab6"),o=o(),Ie(),o),Xe={class:"infinite"},Ue=Ve(()=>d("ul",{class:"top"},[d("li",null,"\u66F4\u65B0\u65E5\u671F"),d("li",null,"\u9879\u76EE\u540D\u79F0"),d("li",null,"Star\u6570\u91CF")],-1)),Ge={class:"item"},Je=["textContent"],Ke=["textContent"],Qe=["textContent"],Ze=oe({__name:"Infinite",setup(o){const f=B("scroll",null);let u=v([{date:"2021-09-01",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1000"},{date:"2021-09-02",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1100"},{date:"2021-09-03",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1200"},{date:"2021-09-04",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1300"},{date:"2021-09-05",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1400"},{date:"2021-09-06",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1500"},{date:"2021-09-07",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1600"},{date:"2021-09-08",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1700"},{date:"2021-09-09",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1800"},{date:"2021-09-10",name:"\u91C7\u9500\u7ED3\u7B97\u5E73\u53F0",star:"1900"}]),c=Me({direction:"top"});return(g,F)=>(A(),D("div",Xe,[Ue,ke(e(Ye),{ref_key:"scroll",ref:f,data:e(u),"class-option":e(c),class:"warp"},{default:$e(()=>[d("ul",Ge,[(A(!0),D(Oe,null,He(e(u),(t,n)=>(A(),D("li",{key:n},[d("span",{textContent:z(t.date)},null,8,Je),d("span",{textContent:z(t.name)},null,8,Ke),d("span",{textContent:z(t.star)},null,8,Qe)]))),128))])]),_:1},8,["data","class-option"])]))}});var tt=le(Ze,[["__scopeId","data-v-1ac0eab6"],["__file","D:/work/accout-vue3-ui/src/views/welcome/components/Infinite.vue"]]);export{tt as default};