You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
10 KiB

8 months ago
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[134],{81643:function(ae,b,t){t.d(b,{Z:function(){return e}});const e=p=>p?typeof p=="function"?p():p:null},7134:function(ae,b,t){t.d(b,{C:function(){return pe}});var e=t(67294),p=t(93967),h=t.n(p),W=t(9220),j=t(42550),G=t(74443),A=t(53124),F=t(98675),V=t(25378),c=e.createContext({}),n=t(54548),a=t(14747),o=t(91945),l=t(45503);const r=s=>{const{antCls:d,componentCls:g,iconCls:i,avatarBg:f,avatarColor:Q,containerSize:z,containerSizeLG:O,containerSizeSM:I,textFontSize:y,textFontSizeLG:N,textFontSizeSM:ne,borderRadius:M,borderRadiusLG:_,borderRadiusSM:U,lineWidth:Y,lineType:k}=s,K=(Z,R,q)=>({width:Z,height:Z,borderRadius:"50%",[`&${g}-square`]:{borderRadius:q},[`&${g}-icon`]:{fontSize:R,[`> ${i}`]:{margin:0}}});return{[g]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,a.Wf)(s)),{position:"relative",display:"inline-flex",justifyContent:"center",alignItems:"center",overflow:"hidden",color:Q,whiteSpace:"nowrap",textAlign:"center",verticalAlign:"middle",background:f,border:`${(0,n.bf)(Y)} ${k} transparent`,["&-image"]:{background:"transparent"},[`${d}-image-img`]:{display:"block"}}),K(z,y,M)),{["&-lg"]:Object.assign({},K(O,N,_)),["&-sm"]:Object.assign({},K(I,ne,U)),"> img":{display:"block",width:"100%",height:"100%",objectFit:"cover"}})}},m=s=>{const{componentCls:d,groupBorderColor:g,groupOverlapping:i,groupSpace:f}=s;return{[`${d}-group`]:{display:"inline-flex",[`${d}`]:{borderColor:g},["> *:not(:first-child)"]:{marginInlineStart:i}},[`${d}-group-popover`]:{[`${d} + ${d}`]:{marginInlineStart:f}}}},P=s=>{const{controlHeight:d,controlHeightLG:g,controlHeightSM:i,fontSize:f,fontSizeLG:Q,fontSizeXL:z,fontSizeHeading3:O,marginXS:I,marginXXS:y,colorBorderBg:N}=s;return{containerSize:d,containerSizeLG:g,containerSizeSM:i,textFontSize:Math.round((Q+z)/2),textFontSizeLG:O,textFontSizeSM:f,groupSpace:y,groupOverlapping:-I,groupBorderColor:N}};var E=(0,o.I$)("Avatar",s=>{const{colorTextLightSolid:d,colorTextPlaceholder:g}=s,i=(0,l.TS)(s,{avatarBg:g,avatarColor:d});return[r(i),m(i)]},P),C=t(35792),w=function(s,d){var g={};for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&d.indexOf(i)<0&&(g[i]=s[i]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var f=0,i=Object.getOwnPropertySymbols(s);f<i.length;f++)d.indexOf(i[f])<0&&Object.prototype.propertyIsEnumerable.call(s,i[f])&&(g[i[f]]=s[i[f]]);return g};const H=(s,d)=>{const[g,i]=e.useState(1),[f,Q]=e.useState(!1),[z,O]=e.useState(!0),I=e.useRef(null),y=e.useRef(null),N=(0,j.sQ)(d,I),{getPrefixCls:ne,avatar:M}=e.useContext(A.E_),_=e.useContext(c),U=()=>{if(!y.current||!I.current)return;const u=y.current.offsetWidth,v=I.current.offsetWidth;if(u!==0&&v!==0){const{gap:T=4}=s;T*2<v&&i(v-T*2<u?(v-T*2)/u:1)}};e.useEffect(()=>{Q(!0)},[]),e.useEffect(()=>{O(!0),i(1)},[s.src]),e.useEffect(U,[s.gap]);const Y=()=>{const{onError:u}=s;(u==null?void 0:u())!==!1&&O(!1)},{prefixCls:k,shape:K,size:Z,src:R,srcSet:q,icon:D,className:re,rootClassName:ee,alt:oe,draggable:Ee,children:ge,crossOrigin:Ce}=s,ie=w(s,["prefixCls","shape","size","src","srcSet","icon","className","rootClassName","alt","draggable","children","crossOrigin"]),S=(0,F.Z)(u=>{var v,T;return(T=(v=Z!=null?Z:_==null?void 0:_.size)!==null&&v!==void 0?v:u)!==null&&T!==void 0?T:"default"}),Oe=Object.keys(typeof S=="object"?S||{}:{}).some(u=>["xs","sm","md","lg","xl","xxl"].includes(u)),ue=(0,V.Z)(Oe),he=e.useMemo(()=>{if(typeof S!="object")return{};const u=G.c4.find(T=>ue[T]),v=S[u];return v?{width:v,height:v,fontSize:v&&(D||ge)?v/2:18}:{}},[ue,S]),$=ne("avatar",k),ve=(0,C.Z)($),[Pe,ye,Se]=E($,ve),xe=h()({[`${$}-lg`]:S==="large",[`${$}-sm`]:S==="small"}),fe=e.isValidElement(R),Me=K||(_==null?void 0:_.shape)||"circle",_e=h()($,xe,M==null?void 0:M.className,`${$}-${Me}`,{[`${$}-image`]:fe||R&&z,[`${$}-icon`]:!!D},Se,ve,re,ee,ye),De=typeof S=="number"?{width:S,height:S,fontSize:D?S/2:18}:{};let te;if(typeof R=="string"&&z)te=e.createElement("img",{src:R,draggable:Ee,srcSet:q,onError:Y,alt:oe,crossOrigin:Ce});else if(fe)te=R;els