first commit

This commit is contained in:
PC-202306242200\Administrator
2026-03-28 23:10:55 +08:00
commit 1c24452b6c
1735 changed files with 150474 additions and 0 deletions

View File

@@ -0,0 +1 @@
"use strict";const r=require("../common/props.js"),o={...r.baseProps,text:{type:[String,Array],default:""},type:r.makeStringProp("warning"),scrollable:r.makeBooleanProp(!0),delay:r.makeNumberProp(1),speed:r.makeNumberProp(50),closable:r.makeBooleanProp(!1),wrapable:r.makeBooleanProp(!1),prefix:String,color:String,backgroundColor:String,direction:r.makeStringProp("horizontal")};exports.noticeBarProps=o;

View File

@@ -0,0 +1 @@
"use strict";const e=require("../../../../common/vendor.js"),t=require("../common/util.js"),a=require("./types.js");Math||n();const n=()=>"../wd-icon/wd-icon.js",o=e.defineComponent({name:"wd-notice-bar",options:{virtualHost:!0,addGlobalClass:!0,styleIsolation:"shared"},props:a.noticeBarProps,emits:["close","next","click"],setup(a,{expose:n,emit:o}){const l=a,i=o,r=e.ref(0),u=e.ref(!0),s=e.ref(0),c=e.computed((()=>Array.isArray(l.text)?l.text:[l.text])),d=e.computed((()=>c.value[s.value])),v=e.ref(0),p=e.ref(null),h=e.ref(null),f=e.computed((()=>"horizontal"===l.direction)),m=e.computed((()=>"vertical"===l.direction)),y=e.reactive({transitionProperty:"unset",transitionDelay:"unset",transitionDuration:"unset",transform:"none",transitionTimingFunction:"linear"}),w=e.computed((()=>t.objToStyle(y))),x=e.computed((()=>{const e={};return t.isDef(l.color)&&(e.color=l.color),t.isDef(l.backgroundColor)&&(e.background=l.backgroundColor),`${t.objToStyle(e)}${l.customStyle}`})),b=e.computed((()=>{const{type:e,wrapable:t,scrollable:a}=l;let n=[];return e&&n.push(`is-${e}`),f.value?!t&&!a&&n.push("wd-notice-bar--ellipse"):n.push("wd-notice-bar--ellipse"),t&&!a&&n.push("wd-notice-bar--wrap"),n.join(" ")})),{proxy:g}=e.getCurrentInstance();function _(){D(),$()}function $(){e.nextTick$1((()=>async function(){const[e,t]=await k();if(!e.width||!t.width||!t.height)return;p.value=e,h.value=t,r.value=e.width,f.value?l.scrollable&&j({duration:t.width/l.speed,delay:l.delay,translate:-t.width}):c.value.length>1&&C(t.height)}()))}function D(){y.transitionProperty="unset",y.transitionDelay="unset",y.transitionDuration="unset",y.transform="none",y.transitionTimingFunction="linear",s.value=0,v.value=0}function T(){u.value=!1,i("close")}function j({duration:e,delay:t,translate:a}){y.transitionProperty="all",y.transitionDelay=`${t}s`,y.transitionDuration=`${e}s`,y.transform=`${"vertical"===l.direction?"translateY":"translateX"}(${a}px)`,y.transitionTimingFunction="linear"}function k(){return Promise.all([t.getRect(".wd-notice-bar__wrap",!1,g),t.getRect(".wd-notice-bar__content",!1,g)])}async function C(e){const t=-e/(c.value.length+1)*(s.value+1);j({duration:e/(c.value.length+1)/l.speed,delay:l.delay,translate:t})}function P(){f.value?j({duration:0,delay:0,translate:r.value+1}):++v.value>=c.value.length&&(v.value=0,j({duration:0,delay:0,translate:0}));const t=setTimeout((()=>{s.value>=c.value.length-1?s.value=0:s.value++,i("next",s.value),e.nextTick$1((async()=>{try{const[e,t]=await k();p.value=e,h.value=t,r.value=e.width||0}catch(e){}h.value&&h.value.width&&h.value.height&&(f.value?j({duration:(r.value+h.value.width)/l.speed,delay:l.delay,translate:-h.value.width}):C(h.value.height))})),clearTimeout(t)}),20)}function A(){const e=t.isArray(l.text)?{index:s.value,text:l.text[s.value]}:{index:0,text:l.text};i("click",e)}return e.watch((()=>l.text),(()=>{_()}),{deep:!0}),e.onMounted((()=>{$()})),e.onActivated((()=>{$()})),e.onDeactivated((()=>{D()})),n({reset:_}),(t,a)=>e.e({a:u.value},u.value?e.e({b:t.prefix},t.prefix?{c:e.p({"custom-class":"wd-notice-bar__prefix",name:t.prefix})}:{},{d:m.value},m.value?e.e({e:e.f(c.value,((t,a,n)=>({a:e.t(t),b:t}))),f:c.value.length>1},c.value.length>1?{g:e.t(c.value[0])}:{}):{h:e.t(d.value)},{i:e.s(w.value),j:e.o(P),k:e.o(A),l:t.closable},t.closable?{m:e.o(T),n:e.p({"custom-class":"wd-notice-bar__suffix",name:"close-bold"})}:{},{o:e.n(`wd-notice-bar ${t.customClass} ${b.value}`),p:e.s(x.value)}):{})}}),l=e._export_sfc(o,[["__scopeId","data-v-cd588750"]]);wx.createComponent(l);

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"wd-icon": "../wd-icon/wd-icon"
}
}

View File

@@ -0,0 +1 @@
<view wx:if="{{a}}" class="{{['data-v-cd588750', o]}}" style="{{p}}"><wd-icon wx:if="{{b}}" class="data-v-cd588750" u-i="cd588750-0" bind:__l="__l" u-p="{{c}}"></wd-icon><slot wx:else name="prefix"></slot><view class="wd-notice-bar__wrap data-v-cd588750"><view class="wd-notice-bar__content data-v-cd588750" style="{{i}}" bindtransitionend="{{j}}" bindtap="{{k}}"><block wx:if="{{d}}"><view wx:for="{{e}}" wx:for-item="item" wx:key="b" class="data-v-cd588750">{{item.a}}</view><view wx:if="{{f}}" class="data-v-cd588750">{{g}}</view></block><block wx:else><block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>{{h}}</block></block></view></view><wd-icon wx:if="{{l}}" class="data-v-cd588750" bindclick="{{m}}" u-i="cd588750-1" bind:__l="__l" u-p="{{n}}"></wd-icon><slot wx:else name="suffix"></slot></view>

View File

@@ -0,0 +1 @@
.wd-notice-bar.data-v-cd588750{display:flex;padding:var(--wot-notice-bar-padding, 9px 20px 9px 15px);align-items:center;font-size:var(--wot-notice-bar-fs, 12px);border-radius:var(--wot-notice-bar-border-radius, 8px);position:relative;box-sizing:border-box}.wd-notice-bar.is-warning.data-v-cd588750{background:var(--wot-notice-bar-warning-bg, #fff6c8);color:var(--wot-notice-bar-warning-color, var(--wot-color-warning, #f0883a))}.wd-notice-bar.is-info.data-v-cd588750{background:var(--wot-notice-bar-info-bg, #f4f9ff);color:var(--wot-notice-bar-info-color, var(--wot-color-theme, #4d80f0))}.wd-notice-bar.is-danger.data-v-cd588750{background:var(--wot-notice-bar-danger-bg, #feeced);color:var(--wot-notice-bar-danger-color, var(--wot-color-danger, #fa4350))}.data-v-cd588750 .wd-notice-bar__prefix{padding-right:4px;font-size:var(--wot-notice-bar-prefix-size, 18px)}.data-v-cd588750 .wd-notice-bar__suffix{text-align:center;font-size:var(--wot-notice-bar-close-size, 18px);display:inline-block;background-color:var(--wot-notice-bar-close-bg, rgba(0, 0, 0, .15));color:var(--wot-notice-bar-close-color, var(--wot-color-white, white));padding:0;border-radius:0 8px 0 4px;position:absolute;right:0;top:0}.wd-notice-bar__wrap.data-v-cd588750{position:relative;flex:1;height:var(--wot-notice-bar-line-height, 18px);overflow:hidden;line-height:var(--wot-notice-bar-line-height, 18px)}.wd-notice-bar__content.data-v-cd588750{position:absolute;white-space:nowrap}.wd-notice-bar--ellipse .wd-notice-bar__content.data-v-cd588750{position:static;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wd-notice-bar--wrap .wd-notice-bar__wrap.data-v-cd588750{height:auto}.wd-notice-bar--wrap .wd-notice-bar__content.data-v-cd588750{position:static;white-space:normal}