2024-06-23 14:49:34 +08:00
|
|
|
|
import{dA as Ke,co as te,aj as n,d as Q,dB as Qe,ba as ve,bL as ke,b0 as kt,b1 as Et,dC as Bt,bx as U,b6 as b,dD as Ae,c3 as Dt,bT as Ut,bb as S,z as $,b8 as Mt,S as zt,dE as ye,dF as ue,aC as et,bM as ne,a as j,b7 as pe,bd as tt,bW as At,be as M,dG as Ft,cb as Fe,dH as jt,T as Re,U as he,dI as $t,H as Nt,a3 as Vt,cJ as Ht,dJ as Se,bV as Ee,dK as Zt,i as je,cy as Ie,cq as me,cx as Wt,bf as Xt,cM as ot,bN as Yt,B as le,dL as Gt,dM as qt,cA as Jt,by as V,dN as $e,bD as K,dO as Kt,dP as Qt,b9 as eo,bc as to,dQ as oo,bh as Ne,an as no,o as Be,b as nt,e as rt,c as ro,w as Te,f as Ve,g as io,t as ao,h as lo,$ as ge,aA as so,dR as uo,A as He}from"./index-D3rICic-.js";import{_ as co}from"./Progress-BRSG0yYs.js";import{f as it}from"./Grid-CRDcRyPk.js";function fo(e,t,o,r){for(var l=-1,i=e==null?0:e.length;++l<i;)o=t(o,e[l],l,e);return o}function ho(e){return function(t){return e==null?void 0:e[t]}}var go={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},vo=ho(go),po=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mo="\\u0300-\\u036f",wo="\\ufe20-\\ufe2f",bo="\\u20d0-\\u20ff",xo=mo+wo+bo,Co="["+xo+"]",yo=RegExp(Co,"g");function Ro(e){return e=Ke(e),e&&e.replace(po,vo).replace(yo,"")}var To=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function _o(e){return e.match(To)||[]}var Lo=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Oo(e){return Lo.test(e)}var at="\\ud800-\\udfff",So="\\u0300-\\u036f",Io="\\ufe20-\\ufe2f",Po="\\u20d0-\\u20ff",ko=So+Io+Po,lt="\\u2700-\\u27bf",st="a-z\\xdf-\\xf6\\xf8-\\xff",Eo="\\xac\\xb1\\xd7\\xf7",Bo="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Do="\\u2000-\\u206f",Uo=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",dt="A-Z\\xc0-\\xd6\\xd8-\\xde",Mo="\\ufe0e\\ufe0f",ut=Eo+Bo+Do+Uo,ct="['’]",Ze="["+ut+"]",zo="["+ko+"]",ft="\\d+",Ao="["+lt+"]",ht="["+st+"]",gt="[^"+at+ut+ft+lt+st+dt+"]",Fo="\\ud83c[\\udffb-\\udfff]",jo="(?:"+zo+"|"+Fo+")",$o="[^"+at+"]",vt="(?:\\ud83c[\\udde6-\\uddff]){2}",pt="[\\ud800-\\udbff][\\udc00-\\udfff]",ie="["+dt+"]",No="\\u200d",We="(?:"+ht+"|"+gt+")",Vo="(?:"+ie+"|"+gt+")",Xe="(?:"+ct+"(?:d|ll|m|re|s|t|ve))?",Ye="(?:"+ct+"(?:D|LL|M|RE|S|T|VE))?",mt=jo+"?",wt="["+Mo+"]?",Ho="(?:"+No+"(?:"+[$o,vt,pt].join("|")+")"+wt+mt+")*",Zo="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Wo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Xo=wt+mt+Ho,Yo="(?:"+[Ao,vt,pt].join("|")+")"+Xo,Go=RegExp([ie+"?"+ht+"+"+Xe+"(?="+[Ze,ie,"$"].join("|")+")",Vo+"+"+Ye+"(?="+[Ze,ie+We,"$"].join("|")+")",ie+"?"+We+"+"+Xe,ie+"+"+Ye,Wo,Zo,ft,Yo].join("|"),"g");function qo(e){return e.match(Go)||[]}function Jo(e,t,o){return e=Ke(e),t=t,t===void 0?Oo(e)?qo(e):_o(e):e.match(t)||[]}var Ko="['’]",Qo=Reg
|
2024-06-03 00:12:29 +08:00
|
|
|
|
position: fixed;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
`),b("image-preview-overlay",`
|
|
|
|
|
z-index: -1;
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
background: rgba(0, 0, 0, .3);
|
|
|
|
|
`,[Ae()]),b("image-preview-toolbar",`
|
|
|
|
|
z-index: 1;
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
border-radius: var(--n-toolbar-border-radius);
|
|
|
|
|
height: 48px;
|
|
|
|
|
bottom: 40px;
|
|
|
|
|
padding: 0 12px;
|
|
|
|
|
background: var(--n-toolbar-color);
|
|
|
|
|
box-shadow: var(--n-toolbar-box-shadow);
|
|
|
|
|
color: var(--n-toolbar-icon-color);
|
|
|
|
|
transition: color .3s var(--n-bezier);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
`,[b("base-icon",`
|
|
|
|
|
padding: 0 8px;
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
`),Ae()]),b("image-preview-wrapper",`
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
`,[Dt()]),b("image-preview",`
|
|
|
|
|
user-select: none;
|
|
|
|
|
-webkit-user-select: none;
|
|
|
|
|
pointer-events: all;
|
|
|
|
|
margin: auto;
|
|
|
|
|
max-height: calc(100vh - 32px);
|
|
|
|
|
max-width: calc(100vw - 32px);
|
|
|
|
|
transition: transform .3s var(--n-bezier);
|
|
|
|
|
`),b("image",`
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
max-height: 100%;
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
`,[Ut("preview-disabled",`
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
`),U("img",`
|
|
|
|
|
border-radius: inherit;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`)])]),ce=32,Ct=Q({name:"ImagePreview",props:Object.assign(Object.assign({},De),{onNext:Function,onPrev:Function,clsPrefix:{type:String,required:!0}}),setup(e){const t=ve("Image","-image",xn,pn,e,S(e,"clsPrefix"));let o=null;const r=$(null),l=$(null),i=$(void 0),u=$(!1),c=$(!1),{localeRef:d}=Mt("Image");function a(){const{value:h}=l;if(!o||!h)return;const{style:m}=h,g=o.getBoundingClientRect(),L=g.left+g.width/2,O=g.top+g.height/2;m.transformOrigin=`${L}px ${O}px`}function s(h){var m,g;switch(h.key){case" ":h.preventDefault();break;case"ArrowLeft":(m=e.onPrev)===null||m===void 0||m.call(e);break;case"ArrowRight":(g=e.onNext)===null||g===void 0||g.call(e);break;case"Escape":Ue();break}}zt(u,h=>{h?ye("keydown",document,s):ue("keydown",document,s)}),et(()=>{ue("keydown",document,s)});let f=0,C=0,w=0,x=0,A=0,Z=0,F=0,N=0,X=!1;function I(h){const{clientX:m,clientY:g}=h;w=m-f,x=g-C,Ht(q)}function p(h){const{mouseUpClientX:m,mouseUpClientY:g,mouseDownClientX:L,mouseDownClientY:O}=h,H=L-m,G=O-g,J=`vertical${G>0?"Top":"Bottom"}`,oe=`horizontal${H>0?"Left":"Right"}`;return{moveVerticalDirection:J,moveHorizontalDirection:oe,deltaHorizontal:H,deltaVertical:G}}function y(h){const{value:m}=r;if(!m)return{offsetX:0,offsetY:0};const g=m.getBoundingClientRect(),{moveVerticalDirection:L,moveHorizontalDirection:O,deltaHorizontal:H,deltaVertical:G}=h||{};let J=0,oe=0;return g.width<=window.innerWidth?J=0:g.left>0?J=(g.width-window.innerWidth)/2:g.right<window.innerWidth?J=-(g.width-window.innerWidth)/2:O==="horizontalRight"?J=Math.min((g.width-window.innerWidth)/2,A-(H??0)):J=Math.max(-((g.width-window.innerWidth)/2),A-(H??0)),g.height<=window.innerHeight?oe=0:g.top>0?oe=(g.height-window.innerHeight)/2:g.bottom<window.innerHeight?oe=-(g.height-window.innerHeight)/2:L==="verticalBottom"?oe=Math.min((g.height-window.innerHeight)/2,Z-(G??0)):oe=Math.max(-((g.height-window.innerHeight)/2),Z-(G??0)),{offsetX:J,offsetY:oe}}function R(h){ue("mousemove",document,I),ue("mouseup",document,R);const{clientX:m,clientY:g}=h;X=!1;const L=p({mouseUpClientX:m,mouseUpClientY:g,mouseDownClientX:F,mouseDownClientY:N}),O=y(L);w=O.offsetX,x=O.offsetY,q()}const E=ne(xt,null);function v(h){var m,g;if((g=(m=E==null?void 0:E.previewedImgPropsRef.value)===null||m===void 0?void 0:m.onMousedown)===null||g===void 0||g.call(m,h),h.button!==0)return;const{clientX:L,clientY:O}=h;X=!0,f=L-w,C=O-x,A=w,Z=x,F=L,N=O,q(),ye("mousemove",document,I),ye("mouseup",document,R)}function P(h){var m,g;(g=(m=E==null?void 0:E.previewedImgPropsRef.value)===null||m===void 0?void 0:m.onDblclick)===null||g===void 0||g.call(m,h);const L=de();T=T===L?1:L,q()}const _=1.5;let z=0,T=1,B=0;function D(){T=1,z=0}function k(){var h;D(),B=0,(h=e.onPrev)===null||h===void 0||h.call(e)}function Y(){var h;D(),B=0,(h=e.onNext)===null||h===void 0||h.call(e)}function W(){B-=90,q()}function ee(){B+=90,q()}function we(){const{value:h}=r;if(!h)return 1;const{innerWidth:m,innerHeight:g}=window,L=Math.max(1,h.naturalHeight/(g-ce)),O=Math.max(1,h.naturalWidth/(m-ce));return Math.max(3,L*2,O*2)}function de(){const{value:h}=r;if(!h)return 1;const{innerWidth:m,innerHeight:g}=window,L=h.naturalHeight/(g-ce),O=h.naturalWidth/(m-ce);return L<1&&O<1?1:Math.max(L,O)}function be(){const h=we();T<h&&(z+=1,T=Math.min(h,Math.pow(_,z)),q())}function xe(){if(T>.5){const h=T;z-=1,T=Math.max(.5,Math.pow(_,z));const m=h-T;q(!1);const g=y();T+=m,q(!1),T-=m,w=g.offsetX,x=g.offsetY,q()}}function Ce(){const h=i.value;h&&it(h,void 0)}function q(h=!0){var m;const{value:g}=r;if(!g)return;const{style:L}=g,O=Nt((m=E==null?void 0:E.previewedImgPropsRef.value)===null||m===void 0?void 0:m.style);let H="";if(typeof O=="string")H=O+";";else for(const J in O)H+=`${tn(J)}: ${O[J]};`;const G=`transform-origin: center; transform: translateX(${w}px) translateY(${x}px) rotate(${B}deg) scale(${T});`;X?L.cssText=H+"cursor: grabbing; transition: none;"+G:L.cssText=H+"cursor: grab;"+G+(h?"":"transition: none;"),h||g.offsetHeight}function Ue(){u.value=!u.value,c.value=!0}function St(){T=de(),z=Math.ceil(Math.log(T)/Math.log(_)),w=0,x=0,q()}const It={setPr
|
2024-06-03 00:12:29 +08:00
|
|
|
|
display: block;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`)]),V("drag-over",[b("upload-dragger",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
border: var(--n-dragger-border-hover);
|
|
|
|
|
`)])]),b("upload-dragger",`
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
border-radius: var(--n-border-radius);
|
|
|
|
|
padding: 24px;
|
|
|
|
|
opacity: 1;
|
|
|
|
|
transition:
|
|
|
|
|
opacity .3s var(--n-bezier),
|
|
|
|
|
border-color .3s var(--n-bezier),
|
|
|
|
|
background-color .3s var(--n-bezier);
|
|
|
|
|
background-color: var(--n-dragger-color);
|
|
|
|
|
border: var(--n-dragger-border);
|
|
|
|
|
`,[U("&:hover",`
|
|
|
|
|
border: var(--n-dragger-border-hover);
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`),V("disabled",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
`)]),b("upload-trigger",`
|
|
|
|
|
display: inline-block;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
opacity: 1;
|
|
|
|
|
transition: opacity .3s var(--n-bezier);
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`,[U("+",[b("upload-file-list","margin-top: 8px;")]),V("disabled",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
opacity: var(--n-item-disabled-opacity);
|
|
|
|
|
cursor: not-allowed;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`),V("image-card",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
width: 96px;
|
|
|
|
|
height: 96px;
|
|
|
|
|
`,[b("base-icon",`
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
`),b("upload-dragger",`
|
|
|
|
|
padding: 0;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
`)])]),b("upload-file-list",`
|
|
|
|
|
line-height: var(--n-line-height);
|
|
|
|
|
opacity: 1;
|
|
|
|
|
transition: opacity .3s var(--n-bezier);
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`,[U("a, img","outline: none;"),V("disabled",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
opacity: var(--n-item-disabled-opacity);
|
|
|
|
|
cursor: not-allowed;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`,[b("upload-file","cursor: not-allowed;")]),V("grid",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(auto-fill, 96px);
|
|
|
|
|
grid-gap: 8px;
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
`),b("upload-file",`
|
|
|
|
|
display: block;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
cursor: default;
|
|
|
|
|
padding: 0px 12px 0 6px;
|
|
|
|
|
transition: background-color .3s var(--n-bezier);
|
|
|
|
|
border-radius: var(--n-border-radius);
|
|
|
|
|
`,[$e(),b("progress",[$e({foldPadding:!0})]),U("&:hover",`
|
|
|
|
|
background-color: var(--n-item-color-hover);
|
|
|
|
|
`,[b("upload-file-info",[K("action",`
|
|
|
|
|
opacity: 1;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`)])]),V("image-type",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
border-radius: var(--n-border-radius);
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
text-decoration-color: #0000;
|
|
|
|
|
`,[b("upload-file-info",`
|
|
|
|
|
padding-top: 0px;
|
|
|
|
|
padding-bottom: 0px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 6px 0;
|
|
|
|
|
`,[b("progress",`
|
|
|
|
|
padding: 2px 0;
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
`),K("name",`
|
|
|
|
|
padding: 0 8px;
|
|
|
|
|
`),K("thumbnail",`
|
|
|
|
|
width: 32px;
|
|
|
|
|
height: 32px;
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
`,[U("img",`
|
|
|
|
|
width: 100%;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`)])])]),V("text-type",[b("progress",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding-bottom: 6px;
|
|
|
|
|
margin-bottom: 6px;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`)]),V("image-card-type",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
width: 96px;
|
|
|
|
|
height: 96px;
|
|
|
|
|
border: var(--n-item-border-image-card);
|
|
|
|
|
border-radius: var(--n-border-radius);
|
|
|
|
|
padding: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
transition: border-color .3s var(--n-bezier), background-color .3s var(--n-bezier);
|
|
|
|
|
border-radius: var(--n-border-radius);
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
`,[b("progress",`
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 8px;
|
|
|
|
|
bottom: 8px;
|
|
|
|
|
right: 8px;
|
|
|
|
|
width: unset;
|
|
|
|
|
`),b("upload-file-info",`
|
|
|
|
|
padding: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
`,[K("thumbnail",`
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
`,[U("img",`
|
|
|
|
|
width: 100%;
|
|
|
|
|
`)])]),U("&::before",`
|
|
|
|
|
position: absolute;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
border-radius: inherit;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
transition: opacity .2s var(--n-bezier);
|
|
|
|
|
content: "";
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`),U("&:hover",[U("&::before","opacity: 1;"),b("upload-file-info",[K("thumbnail","opacity: .12;")])])]),V("error-status",[U("&:hover",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
background-color: var(--n-item-color-hover-error);
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`),b("upload-file-info",[K("name","color: var(--n-item-text-color-error);"),K("thumbnail","color: var(--n-item-text-color-error);")]),V("image-card-type",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
border: var(--n-item-border-image-card-error);
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`)]),V("with-url",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
`,[b("upload-file-info",[K("name",`
|
|
|
|
|
color: var(--n-item-text-color-success);
|
|
|
|
|
text-decoration-color: var(--n-item-text-color-success);
|
|
|
|
|
`,[U("a",`
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
`)])])]),b("upload-file-info",`
|
|
|
|
|
position: relative;
|
|
|
|
|
padding-top: 6px;
|
|
|
|
|
padding-bottom: 6px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
|
`,[K("thumbnail",`
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
opacity: 1;
|
|
|
|
|
transition: opacity .2s var(--n-bezier);
|
|
|
|
|
color: var(--n-item-icon-color);
|
|
|
|
|
`,[b("base-icon",`
|
|
|
|
|
margin-right: 2px;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
transition: color .3s var(--n-bezier);
|
|
|
|
|
`)]),K("action",`
|
|
|
|
|
padding-top: inherit;
|
|
|
|
|
padding-bottom: inherit;
|
|
|
|
|
position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
width: 80px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
transition: opacity .2s var(--n-bezier);
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
opacity: 0;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`,[b("button",[U("&:not(:last-child)",{marginRight:"4px"}),b("base-icon",[U("svg",[Kt()])])]),V("image-type",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
position: relative;
|
|
|
|
|
max-width: 80px;
|
|
|
|
|
width: auto;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`),V("image-card-type",`
|
2024-06-03 00:12:29 +08:00
|
|
|
|
z-index: 2;
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
left: 0;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
top: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
`)]),K("name",`
|
|
|
|
|
color: var(--n-item-text-color);
|
|
|
|
|
flex: 1;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
text-decoration-color: #0000;
|
|
|
|
|
font-size: var(--n-font-size);
|
|
|
|
|
transition:
|
|
|
|
|
color .3s var(--n-bezier),
|
|
|
|
|
text-decoration-color .3s var(--n-bezier);
|
|
|
|
|
`,[U("a",`
|
|
|
|
|
color: inherit;
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
`)])])])]),b("upload-file-input",`
|
|
|
|
|
display: none;
|
|
|
|
|
width: 0;
|
|
|
|
|
height: 0;
|
|
|
|
|
opacity: 0;
|
2024-06-23 14:49:34 +08:00
|
|
|
|
`)]);var Je=function(e,t,o,r){function l(i){return i instanceof o?i:new o(function(u){u(i)})}return new(o||(o=Promise))(function(i,u){function c(s){try{a(r.next(s))}catch(f){u(f)}}function d(s){try{a(r.throw(s))}catch(f){u(f)}}function a(s){s.done?i(s.value):l(s.value).then(c,d)}a((r=r.apply(e,t||[])).next())})};function Fn(e,t,o){const{doChange:r,xhrMap:l}=e;let i=0;function u(d){var a;let s=Object.assign({},t,{status:"error",percentage:i});l.delete(t.id),s=se(((a=e.onError)===null||a===void 0?void 0:a.call(e,{file:s,event:d}))||s),r(s,d)}function c(d){var a;if(e.isErrorState){if(e.isErrorState(o)){u(d);return}}else if(o.status<200||o.status>=300){u(d);return}let s=Object.assign({},t,{status:"finished",percentage:i});l.delete(t.id),s=se(((a=e.onFinish)===null||a===void 0?void 0:a.call(e,{file:s,event:d}))||s),r(s,d)}return{handleXHRLoad:c,handleXHRError:u,handleXHRAbort(d){const a=Object.assign({},t,{status:"removed",file:null,percentage:i});l.delete(t.id),r(a,d)},handleXHRProgress(d){const a=Object.assign({},t,{status:"uploading"});if(d.lengthComputable){const s=Math.ceil(d.loaded/d.total*100);a.percentage=s,i=s}r(a,d)}}}function jn(e){const{inst:t,file:o,data:r,headers:l,withCredentials:i,action:u,customRequest:c}=e,{doChange:d}=e.inst;let a=0;c({file:o,data:r,headers:l,withCredentials:i,action:u,onProgress(s){const f=Object.assign({},o,{status:"uploading"}),C=s.percent;f.percentage=C,a=C,d(f)},onFinish(){var s;let f=Object.assign({},o,{status:"finished",percentage:a});f=se(((s=t.onFinish)===null||s===void 0?void 0:s.call(t,{file:f}))||f),d(f)},onError(){var s;let f=Object.assign({},o,{status:"error",percentage:a});f=se(((s=t.onError)===null||s===void 0?void 0:s.call(t,{file:f}))||f),d(f)}})}function $n(e,t,o){const r=Fn(e,t,o);o.onabort=r.handleXHRAbort,o.onerror=r.handleXHRError,o.onload=r.handleXHRLoad,o.upload&&(o.upload.onprogress=r.handleXHRProgress)}function Ot(e,t){return typeof e=="function"?e({file:t}):e||{}}function Nn(e,t,o){const r=Ot(t,o);r&&Object.keys(r).forEach(l=>{e.setRequestHeader(l,r[l])})}function Vn(e,t,o){const r=Ot(t,o);r&&Object.keys(r).forEach(l=>{e.append(l,r[l])})}function Hn(e,t,o,{method:r,action:l,withCredentials:i,responseType:u,headers:c,data:d}){const a=new XMLHttpRequest;a.responseType=u,e.xhrMap.set(o.id,a),a.withCredentials=i;const s=new FormData;if(Vn(s,d,o),o.file!==null&&s.append(t,o.file),$n(e,o,a),l!==void 0){a.open(r.toUpperCase(),l),Nn(a,c,o),a.send(s);const f=Object.assign({},o,{status:"uploading"});e.doChange(f)}}const Zn=Object.assign(Object.assign({},ve.props),{name:{type:String,default:"file"},accept:String,action:String,customRequest:Function,directory:Boolean,directoryDnd:{type:Boolean,default:void 0},method:{type:String,default:"POST"},multiple:Boolean,showFileList:{type:Boolean,default:!0},data:[Object,Function],headers:[Object,Function],withCredentials:Boolean,responseType:{type:String,default:""},disabled:{type:Boolean,default:void 0},onChange:Function,onRemove:Function,onFinish:Function,onError:Function,onBeforeUpload:Function,isErrorState:Function,onDownload:Function,defaultUpload:{type:Boolean,default:!0},fileList:Array,"onUpdate:fileList":[Function,Array],onUpdateFileList:[Function,Array],fileListClass:String,fileListStyle:[String,Object],defaultFileList:{type:Array,default:()=>[]},showCancelButton:{type:Boolean,default:!0},showRemoveButton:{type:Boolean,default:!0},showDownloadButton:Boolean,showRetryButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},listType:{type:String,default:"text"},onPreview:Function,shouldUseThumbnailUrl:{type:Function,default:e=>On?_t(e):!1},createThumbnailUrl:Function,abstract:Boolean,max:Number,showTrigger:{type:Boolean,default:!0},imageGroupProps:Object,inputProps:Object,triggerClass:String,triggerStyle:[String,Object],renderIcon:Function}),Wn=Q({name:"Upload",props:Zn,setup(e){e.abstract&&e.listType==="image-card"&&me("upload","when the list-type is image-card, abstract is not supported.");const{mergedClsPrefixRef:t,inlineThemeDisabled:o}=pe(e),r=ve("Upload","-upload",An,Qt,e,t),l=eo(e),i=j(()=>{const{
|