index.5c0d538f.js 2.5 KB

1
  1. import{b2 as R,a_ as G,a as Y,$ as q,r as m,bw as y,a4 as z,a5 as s,i as t,at as J,aG as K,bd as Q,cP as U,w as W,v as X,a6 as O,cR as Z,Y as i,aR as ee,d8 as ae,aT as ne,aS as le,d9 as te,da as oe,db as se,dc as ce}from"./index.ae52ebae.js";var ie={success:ee,info:ae,error:ne,warning:le},re={success:te,info:oe,error:se,warning:ce},ue=G("success","info","warning","error"),de=function(){return{type:i.oneOf(ue),closable:{type:Boolean,default:void 0},closeText:i.any,message:i.any,description:i.any,afterClose:Function,showIcon:{type:Boolean,default:void 0},prefixCls:String,banner:{type:Boolean,default:void 0},icon:i.any,closeIcon:i.any,onClose:Function}},ve=Y({name:"AAlert",inheritAttrs:!1,props:de(),setup:function(a,v){var c=v.slots,_=v.emit,g=v.attrs,B=v.expose,b=q("alert",a),H=b.prefixCls,L=b.direction,r=m(!1),I=m(!1),w=m(),N=function(l){l.preventDefault();var o=w.value;o.style.height="".concat(o.offsetHeight,"px"),o.style.height="".concat(o.offsetHeight,"px"),r.value=!0,_("close",l)},T=function(){var l;r.value=!1,I.value=!0,(l=a.afterClose)===null||l===void 0||l.call(a)};B({animationEnd:T});var j=m({});return function(){var n,l,o=a.banner,A=a.closeIcon,P=A===void 0?(l=c.closeIcon)===null||l===void 0?void 0:l.call(c):A,h=a.closable,u=a.type,d=a.showIcon,x=y(c,a,"closeText"),f=y(c,a,"description"),E=y(c,a,"message"),p=y(c,a,"icon");d=o&&d===void 0?!0:d,u=o&&u===void 0?"warning":u||"info";var k=(f?re:ie)[u]||null;x&&(h=!0);var e=H.value,V=z(e,(n={},s(n,"".concat(e,"-").concat(u),!0),s(n,"".concat(e,"-closing"),r.value),s(n,"".concat(e,"-with-description"),!!f),s(n,"".concat(e,"-no-icon"),!d),s(n,"".concat(e,"-banner"),!!o),s(n,"".concat(e,"-closable"),h),s(n,"".concat(e,"-rtl"),L.value==="rtl"),n)),$=h?t("button",{type:"button",onClick:N,class:"".concat(e,"-close-icon"),tabindex:0},[x?t("span",{class:"".concat(e,"-close-text")},[x]):P===void 0?t(J,null,null):P]):null,D=p&&(K(p)?Q(p,{class:"".concat(e,"-icon")}):t("span",{class:"".concat(e,"-icon")},[p]))||t(k,{class:"".concat(e,"-icon")},null),M=U("".concat(e,"-motion"),{appear:!1,css:!0,onAfterLeave:T,onBeforeLeave:function(C){C.style.maxHeight="".concat(C.offsetHeight,"px")},onLeave:function(C){C.style.maxHeight="0px"}});return I.value?null:t(Z,M,{default:function(){return[W(t("div",O(O({role:"alert"},g),{},{style:[g.style,j.value],class:[g.class,V],"data-show":!r.value,ref:w}),[d?D:null,t("div",{class:"".concat(e,"-content")},[E?t("div",{class:"".concat(e,"-message")},[E]):null,f?t("div",{class:"".concat(e,"-description")},[f]):null]),$]),[[X,!r.value]])]}})}}}),pe=R(ve);export{pe as A};