| 1 |
- import{i as l,bk as de,dd as We,de as Xe,r as h,s as fe,_ as d,p as Pe,ba as je,a5 as E,aL as qe,a0 as Qe,c as v,a as ie,aE as be,aN as me,aa as A,K as Je,a6 as x,au as $e,df as Ke,a4 as te,bz as ae,ar as Ge,aH as et,dg as tt,Y as rt,be as nt,at,bp as it,bq as ot,$ as Ve,d as lt,cQ as ut,bs as Ie}from"./index.ae52ebae.js";import{g as st,a as Ae}from"./css.bcd121de.js";var vt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M672 418H144c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H188V494h440v326z"}},{tag:"path",attrs:{d:"M819.3 328.5c-78.8-100.7-196-153.6-314.6-154.2l-.2-64c0-6.5-7.6-10.1-12.6-6.1l-128 101c-4 3.1-3.9 9.1 0 12.3L492 318.6c5.1 4 12.7.4 12.6-6.1v-63.9c12.9.1 25.9.9 38.8 2.5 42.1 5.2 82.1 18.2 119 38.7 38.1 21.2 71.2 49.7 98.4 84.3 27.1 34.7 46.7 73.7 58.1 115.8a325.95 325.95 0 016.5 140.9h74.9c14.8-103.6-11.3-213-81-302.3z"}}]},name:"rotate-left",theme:"outlined"},ct=vt;function Re(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?Object(arguments[e]):{},t=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),t.forEach(function(a){ft(r,a,n[a])})}return r}function ft(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}var Oe=function(e,n){var t=Re({},e,n.attrs);return l(de,Re({},t,{icon:ct}),null)};Oe.displayName="RotateLeftOutlined";Oe.inheritAttrs=!1;var mt=Oe,dt={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M480.5 251.2c13-1.6 25.9-2.4 38.8-2.5v63.9c0 6.5 7.5 10.1 12.6 6.1L660 217.6c4-3.2 4-9.2 0-12.3l-128-101c-5.1-4-12.6-.4-12.6 6.1l-.2 64c-118.6.5-235.8 53.4-314.6 154.2A399.75 399.75 0 00123.5 631h74.9c-.9-5.3-1.7-10.7-2.4-16.1-5.1-42.1-2.1-84.1 8.9-124.8 11.4-42.2 31-81.1 58.1-115.8 27.2-34.7 60.3-63.2 98.4-84.3 37-20.6 76.9-33.6 119.1-38.8z"}},{tag:"path",attrs:{d:"M880 418H352c-17.7 0-32 14.3-32 32v414c0 17.7 14.3 32 32 32h528c17.7 0 32-14.3 32-32V450c0-17.7-14.3-32-32-32zm-44 402H396V494h440v326z"}}]},name:"rotate-right",theme:"outlined"},gt=dt;function Le(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?Object(arguments[e]):{},t=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),t.forEach(function(a){pt(r,a,n[a])})}return r}function pt(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}var ye=function(e,n){var t=Le({},e,n.attrs);return l(de,Le({},t,{icon:gt}),null)};ye.displayName="RotateRightOutlined";ye.inheritAttrs=!1;var wt=ye,ht={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-in",theme:"outlined"},Ct=ht;function Ne(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?Object(arguments[e]):{},t=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),t.forEach(function(a){Pt(r,a,n[a])})}return r}function Pt(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}var Se=function(e,n){var t=Ne({},e,n.attrs);return l(de,Ne({},t,{icon:Ct}),null)};Se.displayName="ZoomInOutlined";Se.inheritAttrs=!1;var bt=Se,Ot={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"}}]},name:"zoom-out",theme:"outlined"},yt=Ot;function ze(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?Object(arguments[e]):{},t=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable}))),t.forEach(function(a){St(r,a,n[a])})}return r}function St(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}var xe=function(e,n){var t=ze({},e,n.attrs);return l(de,ze({},t,{icon:yt}),null)};xe.displayName="ZoomOutOutlined";xe.inheritAttrs=!1;var xt=xe,Mt="[object Number]";function jt(r){return typeof r=="number"||We(r)&&Xe(r)==Mt}function It(r){var e=h(null),n=fe(d({},r)),t=h([]),a=function(p){e.value===null&&(t.value=[],e.value=je(function(){var m;t.value.forEach(function(M){m=d(d({},m),M)}),d(n,m),e.value=null})),t.value.push(p)};return Pe(function(){e.value&&je.cancel(e.value)}),[n,a]}function _e(r,e,n,t){var a=e+n,i=(n-t)/2;if(n>t){if(e>0)return E({},r,i);if(e<0&&a<t)return E({},r,-i)}else if(e<0||a>t)return E({},r,e<0?i:-i);return{}}function Rt(r,e,n,t){var a=st(),i=a.width,p=a.height,m=null;return r<=i&&e<=p?m={x:0,y:0}:(r>i||e>p)&&(m=d(d({},_e("x",n,r,i)),_e("y",t,e,p))),m}var Lt=globalThis&&globalThis.__rest||function(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(r);a<t.length;a++)e.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(r,t[a])&&(n[t[a]]=r[t[a]]);return n},ke=Symbol("previewGroupContext"),Me={provide:function(e){qe(ke,e)},inject:function(){return Qe(ke,{isPreviewGroup:h(!1),previewUrls:v(function(){return new Map}),setPreviewUrls:function(){},current:h(null),setCurrent:function(){},setShowPreview:function(){},setMousePosition:function(){},registerImage:null,rootClassName:""})}},Nt=ie({name:"PreviewGroup",inheritAttrs:!1,props:{previewPrefixCls:String,preview:{type:[Boolean,Object],default:!0},icons:{type:Object,default:function(){return{}}}},setup:function(e,n){var t=n.slots,a=v(function(){var o={visible:void 0,onVisibleChange:function(){},getContainer:void 0,current:0};return be(e.preview)==="object"?Te(e.preview,o):o}),i=fe(new Map),p=h(),m=v(function(){return a.value.visible}),M=v(function(){return a.value.onVisibleChange}),U=v(function(){return a.value.getContainer}),c=h(!!m.value),C=h(null),L=v(function(){return m.value!==void 0}),P=v(function(){return Array.from(i.keys())}),N=v(function(){return P.value[a.value.current]}),F=v(function(){return new Map(Array.from(i).filter(function(o){var u=me(o,2),S=u[1].canPreview;return!!S}).map(function(o){var u=me(o,2),S=u[0],z=u[1].url;return[S,z]}))}),D=function(u,S){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;i.set(u,{url:S,canPreview:z})},b=function(u){p.value=u},O=function(u){C.value=u},T=function(u){c.value=u},j=function(u,S){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,X=function(){i.delete(u)};return i.set(u,{url:S,canPreview:z}),X},y=function(u){u==null||u.stopPropagation(),c.value=!1,C.value=null};return A(m,function(){c.value=!!m.value}),A(c,function(o,u){M.value(o,u)}),A(N,function(o){b(o)},{immediate:!0,flush:"post"}),Je(function(){!c.value&&L.value&&b(N.value)},{flush:"post"}),Me.provide({isPreviewGroup:h(!0),previewUrls:F,setPreviewUrls:D,current:p,setCurrent:b,setShowPreview:T,setMousePosition:O,registerImage:j}),function(){var o=Lt(a.value,[]);return l($e,null,[t.default&&t.default(),l(Ue,x(x({},o),{},{"ria-hidden":!c.value,visible:c.value,prefixCls:e.previewPrefixCls,onClose:y,mousePosition:C.value,src:F.value.get(p.value),icons:e.icons,getContainer:U.value}),null)])}}}),Ee=Nt,ce={x:0,y:0},zt=d(d({},Ke()),{src:String,alt:String,rootClassName:String,icons:{type:Object,default:function(){return{}}}}),_t=ie({name:"Preview",inheritAttrs:!1,props:zt,emits:["close","afterClose"],setup:function(e,n){var t=n.emit,a=n.attrs,i=fe(e.icons),p=i.rotateLeft,m=i.rotateRight,M=i.zoomIn,U=i.zoomOut,c=i.close,C=i.left,L=i.right,P=h(1),N=h(0),F=It(ce),D=me(F,2),b=D[0],O=D[1],T=function(){return t("close")},j=h(),y=fe({originX:0,originY:0,deltaX:0,deltaY:0}),o=h(!1),u=Me.inject(),S=u.previewUrls,z=u.current,X=u.isPreviewGroup,q=u.setCurrent,_=v(function(){return S.value.size}),Q=v(function(){return Array.from(S.value.keys())}),Z=v(function(){return Q.value.indexOf(z.value)}),ge=v(function(){return X.value?S.value.get(z.value):e.src}),oe=v(function(){return X.value&&_.value>1}),Y=h({wheelDirection:0}),J=function(){P.value=1,N.value=0,O(ce),t("afterClose")},le=function(){P.value++,O(ce)},f=function(){P.value>1&&P.value--,O(ce)},w=function(){N.value+=90},I=function(){N.value-=90},k=function(s){s.preventDefault(),s.stopPropagation(),Z.value>0&&q(Q.value[Z.value-1])},R=function(s){s.preventDefault(),s.stopPropagation(),Z.value<_.value-1&&q(Q.value[Z.value+1])},pe=te(E({},"".concat(e.prefixCls,"-moving"),o.value)),ue="".concat(e.prefixCls,"-operations-operation"),we="".concat(e.prefixCls,"-operations-icon"),se=[{icon:c,onClick:T,type:"close"},{icon:M,onClick:le,type:"zoomIn"},{icon:U,onClick:f,type:"zoomOut",disabled:v(function(){return P.value===1})},{icon:m,onClick:w,type:"rotateRight"},{icon:p,onClick:I,type:"rotateLeft"}],ve=function(){if(e.visible&&o.value){var s=j.value.offsetWidth*P.value,$=j.value.offsetHeight*P.value,G=Ae(j.value),V=G.left,B=G.top,H=N.value%180!==0;o.value=!1;var K=Rt(H?$:s,H?s:$,V,B);K&&O(d({},K))}},he=function(s){s.button===0&&(s.preventDefault(),s.stopPropagation(),y.deltaX=s.pageX-b.x,y.deltaY=s.pageY-b.y,y.originX=b.x,y.originY=b.y,o.value=!0)},re=function(s){e.visible&&o.value&&O({x:s.pageX-y.deltaX,y:s.pageY-y.deltaY})},Ce=function(s){if(!!e.visible){s.preventDefault();var $=s.deltaY;Y.value={wheelDirection:$}}},ne=function(){};return Pe(function(){A([function(){return e.visible},o],function(){ne();var g,s,$=ae(window,"mouseup",ve,!1),G=ae(window,"mousemove",re,!1),V=ae(window,"wheel",Ce,{passive:!1});try{window.top!==window.self&&(g=ae(window.top,"mouseup",ve,!1),s=ae(window.top,"mousemove",re,!1))}catch(B){}ne=function(){$.remove(),G.remove(),V.remove(),g&&g.remove(),s&&s.remove()}},{flush:"post",immediate:!0})}),Ge(function(){ne()}),function(){var g=e.visible,s=e.prefixCls,$=e.rootClassName;return l(tt,x(x({},a),{},{transitionName:"zoom",maskTransitionName:"fade",closable:!1,keyboard:!0,prefixCls:s,onClose:T,afterClose:J,visible:g,wrapClassName:pe,rootClassName:$,getContainer:e.getContainer}),{default:function(){return[l("ul",{class:"".concat(e.prefixCls,"-operations")},[se.map(function(V){var B=V.icon,H=V.onClick,K=V.type,ee=V.disabled;return l("li",{class:te(ue,E({},"".concat(e.prefixCls,"-operations-operation-disabled"),ee&&(ee==null?void 0:ee.value))),onClick:H,key:K},[et(B,{class:we})])})]),l("div",{class:"".concat(e.prefixCls,"-img-wrapper"),style:{transform:"translate3d(".concat(b.x,"px, ").concat(b.y,"px, 0)")}},[l("img",{onMousedown:he,ref:j,class:"".concat(e.prefixCls,"-img"),src:ge.value,alt:e.alt,style:{transform:"scale3d(".concat(P.value,", ").concat(P.value,", 1) rotate(").concat(N.value,"deg)")}},null)]),oe.value&&l("div",{class:te("".concat(e.prefixCls,"-switch-left"),E({},"".concat(e.prefixCls,"-switch-left-disabled"),Z.value<=0)),onClick:k},[C]),oe.value&&l("div",{class:te("".concat(e.prefixCls,"-switch-right"),E({},"".concat(e.prefixCls,"-switch-right-disabled"),Z.value>=_.value-1)),onClick:R},[L])]}})}}}),Ue=_t,kt=globalThis&&globalThis.__rest||function(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(r);a<t.length;a++)e.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(r,t[a])&&(n[t[a]]=r[t[a]]);return n},De=function(){return{src:String,wrapperClassName:String,wrapperStyle:{type:Object,default:void 0},rootClassName:String,prefixCls:String,previewPrefixCls:String,placeholder:rt.any,fallback:String,preview:{type:[Boolean,Object],default:!0},onClick:{type:Function},onError:{type:Function}}},Te=function(e,n){var t=d({},e);return Object.keys(n).forEach(function(a){e[a]===void 0&&(t[a]=n[a])}),t},$t=0,Ze=ie({name:"Image",inheritAttrs:!1,props:De(),emits:["click","error"],setup:function(e,n){var t=n.attrs,a=n.slots,i=n.emit,p=v(function(){return e.prefixCls}),m=v(function(){return"".concat(p.value,"-preview")}),M=v(function(){var f={visible:void 0,onVisibleChange:function(){},getContainer:void 0};return be(e.preview)==="object"?Te(e.preview,f):f}),U=v(function(){return e.placeholder&&e.placeholder!==!0||a.placeholder}),c=v(function(){return M.value.visible}),C=v(function(){return M.value.getContainer}),L=v(function(){return c.value!==void 0}),P=function(w,I){var k,R;(R=(k=M.value).onVisibleChange)===null||R===void 0||R.call(k,w,I)},N=nt(!!c.value,{value:c,onChange:P}),F=me(N,2),D=F[0],b=F[1];A(c,function(f){b(Boolean(f))}),A(D,function(f,w){P(f,w)});var O=h(U.value?"loading":"normal");A(function(){return e.src},function(){O.value=U.value?"loading":"normal"});var T=h(null),j=v(function(){return O.value==="error"}),y=Me.inject(),o=y.isPreviewGroup,u=y.setCurrent,S=y.setShowPreview,z=y.setMousePosition,X=y.registerImage,q=h($t++),_=v(function(){return e.preview&&!j.value}),Q=function(){O.value="normal"},Z=function(w){O.value="error",i("error",w)},ge=function(w){if(!L.value){var I=Ae(w.target),k=I.left,R=I.top;o.value?(u(q.value),z({x:k,y:R})):T.value={x:k,y:R}}o.value?S(!0):b(!0),i("click",w)},oe=function(){b(!1),L.value||(T.value=null)},Y=h(null);A(function(){return Y},function(){O.value==="loading"&&Y.value.complete&&(Y.value.naturalWidth||Y.value.naturalHeight)&&Q()});var J=function(){};Pe(function(){A([function(){return e.src},_],function(){if(J(),!o.value)return function(){};J=X(q.value,e.src,_.value),_.value||J()},{flush:"post",immediate:!0})}),Ge(J);var le=function(w){return jt(w)?w+"px":w};return function(){var f=e.prefixCls,w=e.wrapperClassName,I=e.fallback,k=e.src,R=e.placeholder,pe=e.wrapperStyle,ue=e.rootClassName,we=t.width,se=t.height,ve=t.crossorigin,he=t.decoding,re=t.alt,Ce=t.sizes,ne=t.srcset,g=t.usemap,s=t.class,$=t.style,G=M.value,V=G.icons,B=G.maskClassName,H=G.src,K=kt(G,["icons","maskClassName","src"]),ee=te(f,w,ue,E({},"".concat(f,"-error"),j.value)),Fe=j.value&&I?I:H!=null?H:k,Ye={crossorigin:ve,decoding:he,alt:re,sizes:Ce,srcset:ne,usemap:g,class:te("".concat(f,"-img"),E({},"".concat(f,"-img-placeholder"),R===!0),s),style:d({height:se},$)};return l($e,null,[l("div",{class:ee,onClick:_.value?ge:function(Be){i("click",Be)},style:d({width:le(we),height:le(se)},pe)},[l("img",x(x(x({},Ye),j.value&&I?{src:I}:{onLoad:Q,onError:Z,src:k}),{},{ref:Y}),null),O.value==="loading"&&l("div",{"aria-hidden":"true",class:"".concat(f,"-placeholder")},[R||a.placeholder&&a.placeholder()]),a.previewMask&&_.value&&l("div",{class:["".concat(f,"-mask"),B]},[a.previewMask()])]),!o.value&&_.value&&l(Ue,x(x({},K),{},{"aria-hidden":!D.value,visible:D.value,prefixCls:m.value,onClose:oe,mousePosition:T.value,src:Fe,alt:re,getContainer:C.value,icons:V,rootClassName:ue}),null)])}}});Ze.PreviewGroup=Ee;var Gt=Ze,He={rotateLeft:l(mt,null,null),rotateRight:l(wt,null,null),zoomIn:l(bt,null,null),zoomOut:l(xt,null,null),close:l(at,null,null),left:l(it,null,null),right:l(ot,null,null)},Vt=ie({name:"AImagePreviewGroup",inheritAttrs:!1,props:{previewPrefixCls:String},setup:function(e,n){var t=n.attrs,a=n.slots,i=Ve("image",e),p=i.getPrefixCls,m=v(function(){return p("image-preview",e.previewPrefixCls)});return function(){return l(Ee,x(x({},d(d({},t),e)),{},{icons:He,previewPrefixCls:m.value}),a)}}}),At=Vt,W=ie({name:"AImage",inheritAttrs:!1,props:De(),setup:function(e,n){var t=n.slots,a=n.attrs,i=Ve("image",e),p=i.prefixCls,m=i.rootPrefixCls,M=i.configProvider,U=v(function(){var c=e.preview;if(c===!1)return c;var C=be(c)==="object"?c:{};return d(d({icons:He},C),{transitionName:Ie(m.value,"zoom",C.transitionName),maskTransitionName:Ie(m.value,"fade",C.maskTransitionName)})});return function(){var c,C,L=((c=M.locale)===null||c===void 0?void 0:c.Image)||lt.Image;return l(Gt,x(x({},d(d(d({},a),e),{prefixCls:p.value})),{},{preview:U.value}),d(d({},t),{previewMask:(C=t.previewMask)!==null&&C!==void 0?C:function(){return l("div",{class:"".concat(p.value,"-mask-info")},[l(ut,null,null),L==null?void 0:L.preview])}}))}}});W.PreviewGroup=At;W.install=function(r){return r.component(W.name,W),r.component(W.PreviewGroup.name,W.PreviewGroup),r};var Dt=W;export{Dt as I};
|