deep-clone-legacy-b1adca57.js 2.0 KB

1
  1. System.register(["./index-legacy-67665670.js"],(function(e,t){"use strict";var o,r,n,a,l,s,i,c,u,d,f,p,b,g,m,y,h,w,v;return{setters:[e=>{o=e.x,r=e.D,n=e.d,a=e.H,l=e.r,s=e.ah,i=e.a3,c=e.W,u=e.ad,d=e.j,f=e.av,p=e.aB,b=e.a,g=e.V,m=e.a9,y=e.at,h=e.Y,w=e.ai,v=e.w}],execute:function(){const[t,x]=o("notice-bar"),k={text:String,mode:String,color:String,delay:r(1),speed:r(60),leftIcon:String,wrapable:Boolean,background:String,scrollable:{type:Boolean,"default":null}};var S=n({name:t,props:k,emits:["close","replay"],setup(e,{emit:t,slots:o}){let r,n=0,v=0;const k=a(),S=a(),j=l({show:!0,offset:0,duration:0}),A=o=>{"closeable"===e.mode&&(j.show=!1,t("close",o))},B=()=>{if(o["right-icon"])return o["right-icon"]();const t="closeable"===e.mode?"cross":"link"===e.mode?"arrow":void 0;return t?b(g,{name:t,"class":x("right-icon"),onClick:A},null):void 0},I=()=>{j.offset=n,j.duration=0,h((()=>{y((()=>{j.offset=-v,j.duration=(v+n)/+e.speed,t("replay")}))}))},T=()=>{const t=!1===e.scrollable&&!e.wrapable,r={transform:j.offset?`translateX(${j.offset}px)`:"",transitionDuration:`${j.duration}s`};return b("div",{ref:k,role:"marquee","class":x("wrap")},[b("div",{ref:S,style:r,"class":[x("content"),{"van-ellipsis":t}],onTransitionend:I},[o["default"]?o["default"]():e.text])])},D=()=>{const{delay:t,speed:o,scrollable:a}=e,l=w(t)?1e3*+t:0;n=0,v=0,j.offset=0,j.duration=0,clearTimeout(r),r=setTimeout((()=>{if(!k.value||!S.value||!1===a)return;const e=m(k).width,t=m(S).width;(a||t>e)&&y((()=>{n=e,v=t,j.offset=-v,j.duration=v/+o}))}),l)};return s(D),i(D),c("pageshow",D),u({reset:D}),d((()=>[e.text,e.scrollable]),D),()=>{const{color:t,wrapable:r,background:n}=e;return f(b("div",{role:"alert","class":x({wrapable:r}),style:{color:t,background:n}},[o["left-icon"]?o["left-icon"]():e.leftIcon?b(g,{"class":x("left-icon"),name:e.leftIcon},null):void 0,T(),B()]),[[p,j.show]])}}});e("N",v(S));const j=e("d",(e=>{if(null===e)return null;const t=Object.assign({},e);return Object.keys(t).forEach((o=>t[o]="object"==typeof e[o]?j(e[o]):e[o])),Array.isArray(e)?(t.length=e.length,Array.from(t)):t}))}}}));