22 lines
52 KiB
JavaScript
22 lines
52 KiB
JavaScript
|
|
import{r as l,aS as qt,aT as Xt,aU as Se,aV as Ve,aW as ht,aX as de,ao as W,aY as Ke,Q as bt,aq as vt,ar as yt,at as $t,as as te,aZ as Je,a_ as zt,an as Le,a$ as St,b0 as Ht,b1 as Gt,b2 as Vt,b3 as Kt,b4 as Oe,b5 as Jt,b6 as Yt,b7 as fe,b8 as K,ax as ce,b9 as wt,ba as Ct,bb as xt,bc as T,bd as V,be as jt,am as Ye,bf as Zt,bg as Et,bh as It,bi as Qt,bj as at,bk as er,bl as tr,bm as rr,bn as nr,bo as ar,bp as Ot,bq as or,br as ir,bs as sr,ap as ot,B as we,bt as it,au as lr,bu as cr,bv as dr,bw as ur,bx as pr,by as st,u as mr,j as h,x as fr,bz as gr,bA as _e,bB as Pt,bC as hr,bD as br,bE as vr,s as lt,bF as yr}from"./index-D2cxrzyv.js";import{P as $r}from"./index-DICUnuN_.js";import{F as ae}from"./index-KuslyOWx.js";import{R as Me,C as pe}from"./row-C5EMotZ4.js";import{C as We}from"./index-BFDbUxK1.js";import{R as Sr,I as ve}from"./index-4zw5l6IX.js";import"./useForm-CaItC8xb.js";var wr={percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,trailColor:"#D9D9D9",trailWidth:1,gapPosition:"bottom"},Cr=function(){var t=l.useRef([]),r=l.useRef(null);return l.useEffect(function(){var n=Date.now(),o=!1;t.current.forEach(function(a){if(a){o=!0;var s=a.style;s.transitionDuration=".3s, .3s, .3s, .06s",r.current&&n-r.current<100&&(s.transitionDuration="0s, 0s")}}),o&&(r.current=Date.now())}),t.current},ct=0,xr=Xt();function jr(){var e;return xr?(e=ct,ct+=1):e="TEST_OR_SSR",e}const Er=function(e){var t=l.useState(),r=qt(t,2),n=r[0],o=r[1];return l.useEffect(function(){o("rc_progress_".concat(jr()))},[]),e||n};var dt=function(t){var r=t.bg,n=t.children;return l.createElement("div",{style:{width:"100%",height:"100%",background:r}},n)};function ut(e,t){return Object.keys(e).map(function(r){var n=parseFloat(r),o="".concat(Math.floor(n*t),"%");return"".concat(e[r]," ").concat(o)})}var Ir=l.forwardRef(function(e,t){var r=e.prefixCls,n=e.color,o=e.gradientId,a=e.radius,s=e.style,i=e.ptg,c=e.strokeLinecap,u=e.strokeWidth,d=e.size,p=e.gapDegree,m=n&&Se(n)==="object",g=m?"#FFF":void 0,v=d/2,w=l.createElement("circle",{className:"".concat(r,"-circle-path"),r:a,cx:v,cy:v,stroke:g,strokeLinecap:c,strokeWidth:u,opacity:i===0?0:1,style:s,ref:t});if(!m)return w;var y="".concat(o,"-conic"),b=p?"".concat(180+p/2,"deg"):"0deg",$=ut(n,(360-p)/360),C=ut(n,1),x="conic-gradient(from ".concat(b,", ").concat($.join(", "),")"),f="linear-gradient(to ".concat(p?"bottom":"top",", ").concat(C.join(", "),")");return l.createElement(l.Fragment,null,l.createElement("mask",{id:y},w),l.createElement("foreignObject",{x:0,y:0,width:d,height:d,mask:"url(#".concat(y,")")},l.createElement(dt,{bg:f},l.createElement(dt,{bg:x}))))}),je=100,Be=function(t,r,n,o,a,s,i,c,u,d){var p=arguments.length>10&&arguments[10]!==void 0?arguments[10]:0,m=n/100*360*((360-s)/360),g=s===0?0:{bottom:0,top:180,left:90,right:-90}[i],v=(100-o)/100*r;u==="round"&&o!==100&&(v+=d/2,v>=r&&(v=r-.01));var w=je/2;return{stroke:typeof c=="string"?c:void 0,strokeDasharray:"".concat(r,"px ").concat(t),strokeDashoffset:v+p,transform:"rotate(".concat(a+m+g,"deg)"),transformOrigin:"".concat(w,"px ").concat(w,"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s",fillOpacity:0}},Or=["id","prefixCls","steps","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"];function pt(e){var t=e??[];return Array.isArray(t)?t:[t]}var Pr=function(t){var r=Ve(Ve({},wr),t),n=r.id,o=r.prefixCls,a=r.steps,s=r.strokeWidth,i=r.trailWidth,c=r.gapDegree,u=c===void 0?0:c,d=r.gapPosition,p=r.trailColor,m=r.strokeLinecap,g=r.style,v=r.className,w=r.strokeColor,y=r.percent,b=ht(r,Or),$=je/2,C=Er(n),x="".concat(C,"-gradient"),f=$-s/2,O=Math.PI*2*f,I=u>0?90+u/2:-90,F=O*((360-u)/360),k=Se(a)==="object"?a:{count:a,gap:2},j=k.count,re=k.gap,ne=pt(y),H=pt(w),G=H.find(function(q){return q&&Se(q)==="object"}),X=G&&Se(G)==="object",Z=X?"butt":m,z=Be(O,F,0,100,I,u,d,p,Z,s),Q=Cr(),D=function(){var ee=0;return ne.map(function(S,R){var U=H[R]||H[H.length-1],J=
|
||
|
|
&:not(${t}-disabled):hover,
|
||
|
|
&-hover:not(${t}-disabled)
|
||
|
|
`]:{borderColor:e.colorPrimaryHover},[`p${t}-drag-icon`]:{marginBottom:e.margin,[r]:{color:e.colorPrimary,fontSize:e.uploadThumbnailSize}},[`p${t}-text`]:{margin:`0 0 ${te(e.marginXXS)}`,color:e.colorTextHeading,fontSize:e.fontSizeLG},[`p${t}-hint`]:{color:e.colorTextDescription,fontSize:e.fontSize},[`&${t}-disabled`]:{[`p${t}-drag-icon ${r},
|
||
|
|
p${t}-text,
|
||
|
|
p${t}-hint
|
||
|
|
`]:{color:e.colorTextDisabled}}}}}},an=e=>{const{componentCls:t,iconCls:r,fontSize:n,lineHeight:o,calc:a}=e,s=`${t}-list-item`,i=`${s}-actions`,c=`${s}-action`;return{[`${t}-wrapper`]:{[`${t}-list`]:Object.assign(Object.assign({},Et()),{lineHeight:e.lineHeight,[s]:{position:"relative",height:a(e.lineHeight).mul(n).equal(),marginTop:e.marginXS,fontSize:n,display:"flex",alignItems:"center",transition:`background-color ${e.motionDurationSlow}`,borderRadius:e.borderRadiusSM,"&:hover":{backgroundColor:e.controlItemBgHover},[`${s}-name`]:Object.assign(Object.assign({},It),{padding:`0 ${te(e.paddingXS)}`,lineHeight:o,flex:"auto",transition:`all ${e.motionDurationSlow}`}),[i]:{whiteSpace:"nowrap",[c]:{opacity:0},[r]:{color:e.actionsColor,transition:`all ${e.motionDurationSlow}`},[`
|
||
|
|
${c}:focus-visible,
|
||
|
|
&.picture ${c}
|
||
|
|
`]:{opacity:1}},[`${t}-icon ${r}`]:{color:e.colorIcon,fontSize:n},[`${s}-progress`]:{position:"absolute",bottom:e.calc(e.uploadProgressOffset).mul(-1).equal(),width:"100%",paddingInlineStart:a(n).add(e.paddingXS).equal(),fontSize:n,lineHeight:0,pointerEvents:"none","> div":{margin:0}}},[`${s}:hover ${c}`]:{opacity:1},[`${s}-error`]:{color:e.colorError,[`${s}-name, ${t}-icon ${r}`]:{color:e.colorError},[i]:{[`${r}, ${r}:hover`]:{color:e.colorError},[c]:{opacity:1}}},[`${t}-list-item-container`]:{transition:`opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,"&::before":{display:"table",width:0,height:0,content:'""'}}})}}},on=e=>{const{componentCls:t}=e,r=new Je("uploadAnimateInlineIn",{from:{width:0,height:0,padding:0,opacity:0,margin:e.calc(e.marginXS).div(-2).equal()}}),n=new Je("uploadAnimateInlineOut",{to:{width:0,height:0,padding:0,opacity:0,margin:e.calc(e.marginXS).div(-2).equal()}}),o=`${t}-animate-inline`;return[{[`${t}-wrapper`]:{[`${o}-appear, ${o}-enter, ${o}-leave`]:{animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseInOutCirc,animationFillMode:"forwards"},[`${o}-appear, ${o}-enter`]:{animationName:r},[`${o}-leave`]:{animationName:n}}},{[`${t}-wrapper`]:Qt(e)},r,n]},sn=e=>{const{componentCls:t,iconCls:r,uploadThumbnailSize:n,uploadProgressOffset:o,calc:a}=e,s=`${t}-list`,i=`${s}-item`;return{[`${t}-wrapper`]:{[`
|
||
|
|
${s}${s}-picture,
|
||
|
|
${s}${s}-picture-card,
|
||
|
|
${s}${s}-picture-circle
|
||
|
|
`]:{[i]:{position:"relative",height:a(n).add(a(e.lineWidth).mul(2)).add(a(e.paddingXS).mul(2)).equal(),padding:e.paddingXS,border:`${te(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusLG,"&:hover":{background:"transparent"},[`${i}-thumbnail`]:Object.assign(Object.assign({},It),{width:n,height:n,lineHeight:te(a(n).add(e.paddingSM).equal()),textAlign:"center",flex:"none",[r]:{fontSize:e.fontSizeHeading2,color:e.colorPrimary},img:{display:"block",width:"100%",height:"100%",overflow:"hidden"}}),[`${i}-progress`]:{bottom:o,width:`calc(100% - ${te(a(e.paddingSM).mul(2).equal())})`,marginTop:0,paddingInlineStart:a(n).add(e.paddingXS).equal()}},[`${i}-error`]:{borderColor:e.colorError,[`${i}-thumbnail ${r}`]:{[`svg path[fill='${at[0]}']`]:{fill:e.colorErrorBg},[`svg path[fill='${at.primary}']`]:{fill:e.colorError}}},[`${i}-uploading`]:{borderStyle:"dashed",[`${i}-name`]:{marginBottom:o}}},[`${s}${s}-picture-circle ${i}`]:{[`&, &::before, ${i}-thumbnail`]:{borderRadius:"50%"}}}}},ln=e=>{const{componentCls:t,iconCls:r,fontSizeLG:n,colorTextLightSolid:o,calc:a}=e,s=`${t}-list`,i=`${s}-item`,c=e.uploadPicCardSize;return{[`
|
||
|
|
${t}-wrapper${t}-picture-card-wrapper,
|
||
|
|
${t}-wrapper${t}-picture-circle-wrapper
|
||
|
|
`]:Object.assign(Object.assign({},Et()),{display:"block",[`${t}${t}-select`]:{width:c,height:c,textAlign:"center",verticalAlign:"top",backgroundColor:e.colorFillAlter,border:`${te(e.lineWidth)} dashed ${e.colorBorder}`,borderRadius:e.borderRadiusLG,cursor:"pointer",transition:`border-color ${e.motionDurationSlow}`,[`> ${t}`]:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",textAlign:"center"},[`&:not(${t}-disabled):hover`]:{borderColor:e.colorPrimary}},[`${s}${s}-picture-card, ${s}${s}-picture-circle`]:{display:"flex",flexWrap:"wrap","@supports not (gap: 1px)":{"& > *":{marginBlockEnd:e.marginXS,marginInlineEnd:e.marginXS}},"@supports (gap: 1px)":{gap:e.marginXS},[`${s}-item-container`]:{display:"inline-block",width:c,height:c,verticalAlign:"top"},"&::after":{display:"none"},"&::before":{display:"none"},[i]:{height:"100%",margin:0,"&::before":{position:"absolute",zIndex:1,width:`calc(100% - ${te(a(e.paddingXS).mul(2).equal())})`,height:`calc(100% - ${te(a(e.paddingXS).mul(2).equal())})`,backgroundColor:e.colorBgMask,opacity:0,transition:`all ${e.motionDurationSlow}`,content:'" "'}},[`${i}:hover`]:{[`&::before, ${i}-actions`]:{opacity:1}},[`${i}-actions`]:{position:"absolute",insetInlineStart:0,zIndex:10,width:"100%",whiteSpace:"nowrap",textAlign:"center",opacity:0,transition:`all ${e.motionDurationSlow}`,[`
|
||
|
|
${r}-eye,
|
||
|
|
${r}-download,
|
||
|
|
${r}-delete
|
||
|
|
`]:{zIndex:10,width:n,margin:`0 ${te(e.marginXXS)}`,fontSize:n,cursor:"pointer",transition:`all ${e.motionDurationSlow}`,color:o,"&:hover":{color:o},svg:{verticalAlign:"baseline"}}},[`${i}-thumbnail, ${i}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${i}-name`]:{display:"none",textAlign:"center"},[`${i}-file + ${i}-name`]:{position:"absolute",bottom:e.margin,display:"block",width:`calc(100% - ${te(a(e.paddingXS).mul(2).equal())})`},[`${i}-uploading`]:{[`&${i}`]:{backgroundColor:e.colorFillAlter},[`&::before, ${r}-eye, ${r}-download, ${r}-delete`]:{display:"none"}},[`${i}-progress`]:{bottom:e.marginXL,width:`calc(100% - ${te(a(e.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${t}-wrapper${t}-picture-circle-wrapper`]:{[`${t}${t}-select`]:{borderRadius:"50%"}}}},cn=e=>{const{componentCls:t}=e;return{[`${t}-rtl`]:{direction:"rtl"}}},dn=e=>{const{componentCls:t,colorTextDisabled:r}=e;return{[`${t}-wrapper`]:Object.assign(Object.assign({},$t(e)),{[t]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${t}-select`]:{display:"inline-block"},[`${t}-hidden`]:{display:"none"},[`${t}-disabled`]:{color:r,cursor:"not-allowed"}})}},un=e=>({actionsColor:e.colorIcon,pictureCardSize:e.controlHeightLG*2.55}),pn=vt("Upload",e=>{const{fontSizeHeading3:t,fontHeight:r,lineWidth:n,pictureCardSize:o,calc:a}=e,s=yt(e,{uploadThumbnailSize:a(t).mul(2).equal(),uploadProgressOffset:a(a(r).div(2)).add(n).equal(),uploadPicCardSize:o});return[dn(s),nn(s),sn(s),ln(s),an(s),on(s),cn(s),er(s)]},un);var mn=function(t,r){return l.createElement(Oe,de({},t,{ref:r,icon:tr}))},fn=l.forwardRef(mn),gn=function(t,r){return l.createElement(Oe,de({},t,{ref:r,icon:rr}))},hn=l.forwardRef(gn),bn=function(t,r){return l.createElement(Oe,de({},t,{ref:r,icon:nr}))},vn=l.forwardRef(bn);function Fe(e){return Object.assign(Object.assign({},e),{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.name,size:e.size,type:e.type,uid:e.uid,percent:0,originFileObj:e})}function De(e,t){const r=ce(t),n=r.findIndex(({uid:o})=>o===e.uid);return n===-1?r.push(e):r[n]=e,r}function He(e,t){const r=e.uid!==void 0?"uid":"name";return t.filter(n=>n[r]===e[r])[0]}function yn(e,t){const r=e.uid!==void 0?"uid":"name",n=t.filter(o=>o[r]!==e[r]);return n.length===t.length?null:n}const $n=(e="")=>{const t=e.split("/"),n=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[""])[0]},Dt=e=>e.indexOf("image/")===0,Sn=e=>{if(e.type&&!e.thumbUrl)return Dt(e.type);const t=e.thumbUrl||e.url||"",r=$n(t);return/^data:image\//.test(t)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(r)?!0:!(/^data:/.test(t)||r)},me=200;function wn(e){return new Promise(t=>{if(!e.type||!Dt(e.type)){t("");return}const r=document.createElement("canvas");r.width=me,r.height=me,r.style.cssText=`position: fixed; left: 0; top: 0; width: ${me}px; height: ${me}px; z-index: 9999; display: none;`,document.body.appendChild(r);const n=r.getContext("2d"),o=new Image;if(o.onload=()=>{const{width:a,height:s}=o;let i=me,c=me,u=0,d=0;a>s?(c=s*(me/a),d=-(c-i)/2):(i=a*(me/s),u=-(i-c)/2),n.drawImage(o,u,d,i,c);const p=r.toDataURL();document.body.removeChild(r),window.URL.revokeObjectURL(o.src),t(p)},o.crossOrigin="anonymous",e.type.startsWith("image/svg+xml")){const a=new FileReader;a.onload=()=>{a.result&&typeof a.result=="string"&&(o.src=a.result)},a.readAsDataURL(e)}else if(e.type.startsWith("image/gif")){const a=new FileReader;a.onload=()=>{a.result&&t(a.result)},a.readAsDataURL(e)}else o.src=window.URL.createObjectURL(e)})}var Cn=function(t,r){return l.createElement(Oe,de({},t,{ref:r,icon:ar}))},xn=l.forwardRef(Cn);const jn=l.forwardRef(({prefixCls:e,className:t,style:r,locale:n,listType:o,file:a,items:s,progress:i,iconRender:c,actionIconRender:u,itemRender:d,isImgUrl:p,showPreviewIcon:m,showRemoveIcon:g,showDownloadIcon:v,previewIcon:w,removeIcon:y,downloadIcon:b,extra:$,onPreview:C,onDownload:x,onClose:f},O)=>{var I,F;const{status:k}=a,[j,re]=l.useState(k);l.useEffect(()=>{k!=="removed"&&re(k)},[k]);const[ne,H]=l.useSta
|