1 |
- import{_ as ie,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 le,b as d,G as De,aa as xe,aQ as Be,a7 as Me,y as ke,K as $e,L as Oe,M as je,T as z,$ as He,a0 as Pe}from"./index.1417328f.js";const Ie=()=>{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)}}()},qe=(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,C=arguments.length;if(typeof n=="boolean"&&(m=n,n=arguments[1]||{},t++),typeof n!="object"&&typeof n!="function"&&(n={}),t===C)return n;for(;t<C;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:Ie,arrayEqual:qe,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),C=v(0),S=v(0),E=v(0),M=v(0),k=v(""),_=null,N=null,$=null,U=null,Y=null,O=!1,j="ease-in",{classOption:p}=c;p.key===void 0&&(p.key=0);const V=B(`wrap${p.key}`,null),X=B(`slotList${p.key}`,null),G=B(`realBox${p.key}`,null);let J=s(()=>e(t)<0),K=s(()=>Math.abs(e(t))<e(E)-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})),l=s(()=>F({},e(se),p));const re=s(()=>e(J)?"":e(l).switchDisabledClass);let ce=s(()=>e(K)?"":e(l).switchDisabledClass),fe=s(()=>({position:"absolute",margin:`${e(C)/2}px 0 0 -${e(l).switchOffset}px`,transform:"translate(-100%,-50%)"})),de=s(()=>({position:"absolute",margin:`${e(C)/2}px 0 0 ${e(S)+e(l).switchOffset}px`,transform:"translateY(-50%)"})),H=s(()=>e(l).direction!=="bottom"&&e(l).direction!=="top"),Q=s(()=>e(H)?{float:"left",overflow:"hidden"}:{overflow:"hidden"}),me=s(()=>({transform:`translate(${e(t)}px,${e(n)}px)`,transition:`all ${j} ${e(m)}ms`,overflow:"hidden"})),P=s(()=>e(l).navigation),I=s(()=>e(P)?!1:e(l).autoPlay),Z=s(()=>c.data.length>=e(l).limitMoveNum),ee=s(()=>e(l).hoverStop&&e(I)&&e(Z)),q=s(()=>e(l).openTouch),te=s(()=>e(l).isSingleRemUnit?parseInt(window.getComputedStyle(document.documentElement,null).fontSize):1),R=s(()=>e(l).singleWidth*e(te)),W=s(()=>e(l).singleHeight*e(te)),w=s(()=>{let a,i=e(l).step;if(e(H)?a=e(R):a=e(W),a>0&&a%i>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 i});function pe(){t.value=0,n.value=0,b(),ne()}function he(){if(!!e(J)){if(Math.abs(e(t))<e(l).switchSingleStep){t.value=0;return}t.value+=e(l).switchSingleStep}}function ve(){if(!!e(K)){if(e(E)-e(S)+e(t)<e(l).switchSingleStep){t.value=e(S)-e(E);return}t.value-=e(l).switchSingleStep}}function b(){cancelAnimationFrame(N||"")}function we(a){if(!e(q))return;let i;const r=a.targetTouches[0],{waitTime:h,singleHeight:T,singleWidth:be}=e(l);$={x:r.pageX,y:r.pageY},U=e(n),Y=e(t),!!T&&!!be?(i&&clearTimeout(i),i=setTimeout(()=>{b()},h+20)):b()}function ye(a){if(!e(q)||a.targetTouches.length>1||a.scale&&a.scale!==1)return;const i=a.targetTouches[0],{direction:r}=e(l);let h={x:i.pageX-$.x,y:i.pageY-$.y};a.preventDefault();const T=Math.abs(h.x)<Math.abs(h.y)?1:0;T===1&&r==="bottom"||T===1&&r==="top"?n.value=U+h.y:(T===0&&r==="left"||T===0&&r==="right")&&(t.value=Y+h.x)}function ge(){if(!e(q))return;let a;const i=e(l).direction;if(m.value=50,i==="top")e(n)>0&&(n.value=0);else if(i==="bottom"){let r=e(M)/2*-1;e(n)<r&&(n.value=r)}else if(i==="left")e(t)>0&&(t.value=0);else if(i==="right"){let r=e(E)*-1;e(t)<r&&(t.value=r)}a&&clearTimeout(a),a=setTimeout(()=>{m.value=0,y()},e(m))}function Se(){e(ee)&&Ce()}function _e(){e(ee)&&Fe()}function y(){O||(N=requestAnimationFrame(function(){const a=e(M)/2,i=e(E)/2;let{direction:r,waitTime:h}=e(l);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))>=i&&(u("scrollEnd"),t.value=0),t.value-=w.value):r==="right"&&(e(t)>=0&&(u("scrollEnd"),t.value=i*-1),t.value+=w.value),_&&clearTimeout(_),e(W)?Math.abs(e(n))%e(W)<e(w)?_=setTimeout(()=>{y()},h):y():e(R)&&Math.abs(e(t))%e(R)<e(w)?_=setTimeout(()=>{y()},h):y()}))}function ne(){De(()=>{const{switchDelay:a}=e(l);if(k.value="",e(H)){C.value=e(V).offsetHeight,S.value=e(V).offsetWidth;let i=e(X).offsetWidth;e(I)&&(i=i*2+1),e(G).style.width=i+"px",E.value=i}if(e(I))j="ease-in",m.value=0;else{j="linear",m.value=a;return}e(Z)?(k.value=e(X).innerHTML,setTimeout(()=>{M.value=e(G).offsetHeight,y()},0)):(b(),n.value=t.value=0)})}function Fe(){O=!1,y()}function Ce(){O=!0,_&&clearTimeout(_),b()}function Ee(a){a.preventDefault(),!(e(l).direction==="left"||e(l).direction==="right")&&xe(()=>{a.deltaY>0?n.value-=w.value:n.value+=w.value},50)()}return Te(()=>{ne()}),Ae(()=>{b(),clearTimeout(_)}),f({reset:pe}),(a,i)=>(A(),D("div",{ref:"wrap"+e(p).key},[e(P)?(A(),D("div",{key:0,style:x(e(fe)),class:ae(e(re)),onClick:he},[L(a.$slots,"left-switch")],6)):le("v-if",!0),e(P)?(A(),D("div",{key:1,style:x(e(de)),class:ae(e(ce)),onClick:ve},[L(a.$slots,"right-switch")],6)):le("v-if",!0),d("div",{ref:"realBox"+e(p).key,style:x(e(me)),onMouseenter:Se,onMouseleave:_e,onTouchstart:we,onTouchmove:ye,onTouchend:ge,onMousewheel:Ee},[d("div",{ref:"slotList"+e(p).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=ie(ze,[["__file","/Users/apple/Desktop/Company Projects/accout-vue3-ui/src/components/ReSeamlessScroll/src/index.vue"]]);const Ue=Be(Ne);const Ye=o=>(He("data-v-1ac0eab6"),o=o(),Pe(),o),Ve={class:"infinite"},Xe=Ye(()=>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",Ve,[Xe,ke(e(Ue),{ref_key:"scroll",ref:f,data:e(u),"class-option":e(c),class:"warp"},{default:$e(()=>[d("ul",Ge,[(A(!0),D(Oe,null,je(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=ie(Ze,[["__scopeId","data-v-1ac0eab6"],["__file","/Users/apple/Desktop/Company Projects/accout-vue3-ui/src/views/welcome/components/Infinite.vue"]]);export{tt as default};
|