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
17 KiB
2 lines
17 KiB
import{b as l,dc as de,r as h,q as fe,Q as d,P as Pe,ei as je,T as U,p as We,k as Xe,f as c,d as ie,eT as be,e_ as me,O as A,G as qe,U as x,F as Ve,g0 as Qe,R as te,fL as ae,a3 as $e,f1 as Je,g1 as Ke,V as et,fZ as tt,bC as rt,ed as nt,en as at,da as Ge,g2 as Ie,e9 as it,f$ as ot}from"./index-f4658ae7.js";import{i as lt}from"./isNumber-0bc0d001.js";import{g as ut,a as Ae}from"./css-06fbc100.js";var st={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"};const ct=st;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){vt(r,a,n[a])})}return r}function vt(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;const ft=Oe;var mt={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"};const dt=mt;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){gt(r,a,n[a])})}return r}function gt(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:dt}),null)};ye.displayName="RotateRightOutlined";ye.inheritAttrs=!1;const pt=ye;var wt={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"};const ht=wt;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){Ct(r,a,n[a])})}return r}function Ct(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:ht}),null)};Se.displayName="ZoomInOutlined";Se.inheritAttrs=!1;const Pt=Se;var bt={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"};const Ot=bt;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){yt(r,a,n[a])})}return r}function yt(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:Ot}),null)};xe.displayName="ZoomOutOutlined";xe.inheritAttrs=!1;const St=xe;function xt(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 U({},r,i);if(e<0&&a<t)return U({},r,-i)}else if(e<0||a>t)return U({},r,e<0?i:-i);return{}}function Mt(r,e,n,t){var a=ut(),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 jt=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){We(ke,e)},inject:function(){return Xe(ke,{isPreviewGroup:h(!1),previewUrls:c(function(){return new Map}),setPreviewUrls:function(){},current:h(null),setCurrent:function(){},setShowPreview:function(){},setMousePosition:function(){},registerImage:null,rootClassName:""})}},It=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=c(function(){var o={visible:void 0,onVisibleChange:function(){},getContainer:void 0,current:0};return be(e.preview)==="object"?Ee(e.preview,o):o}),i=fe(new Map),p=h(),m=c(function(){return a.value.visible}),M=c(function(){return a.value.onVisibleChange}),Z=c(function(){return a.value.getContainer}),v=h(!!m.value),C=h(null),L=c(function(){return m.value!==void 0}),P=c(function(){return Array.from(i.keys())}),N=c(function(){return P.value[a.value.current]}),H=c(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},E=function(u){v.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(),v.value=!1,C.value=null};return A(m,function(){v.value=!!m.value}),A(v,function(o,u){M.value(o,u)}),A(N,function(o){b(o)},{immediate:!0,flush:"post"}),qe(function(){!v.value&&L.value&&b(N.value)},{flush:"post"}),Me.provide({isPreviewGroup:h(!0),previewUrls:H,setPreviewUrls:D,current:p,setCurrent:b,setShowPreview:E,setMousePosition:O,registerImage:j}),function(){var o=jt(a.value,[]);return l(Ve,null,[t.default&&t.default(),l(Ze,x(x({},o),{},{"ria-hidden":!v.value,visible:v.value,prefixCls:e.previewPrefixCls,onClose:y,mousePosition:C.value,src:H.value.get(p.value),icons:e.icons,getContainer:Z.value}),null)])}}});const Ue=It;var ve={x:0,y:0},Rt=d(d({},Qe()),{src:String,alt:String,rootClassName:String,icons:{type:Object,default:function(){return{}}}}),Lt=ie({name:"Preview",inheritAttrs:!1,props:Rt,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,Z=i.zoomOut,v=i.close,C=i.left,L=i.right,P=h(1),N=h(0),H=xt(ve),D=me(H,2),b=D[0],O=D[1],E=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,_=c(function(){return S.value.size}),Q=c(function(){return Array.from(S.value.keys())}),T=c(function(){return Q.value.indexOf(z.value)}),ge=c(function(){return X.value?S.value.get(z.value):e.src}),oe=c(function(){return X.value&&_.value>1}),Y=h({wheelDirection:0}),J=function(){P.value=1,N.value=0,O(ve),t("afterClose")},le=function(){P.value++,O(ve)},f=function(){P.value>1&&P.value--,O(ve)},w=function(){N.value+=90},I=function(){N.value-=90},k=function(s){s.preventDefault(),s.stopPropagation(),T.value>0&&q(Q.value[T.value-1])},R=function(s){s.preventDefault(),s.stopPropagation(),T.value<_.value-1&&q(Q.value[T.value+1])},pe=te(U({},"".concat(e.prefixCls,"-moving"),o.value)),ue="".concat(e.prefixCls,"-operations-operation"),we="".concat(e.prefixCls,"-operations-icon"),se=[{icon:v,onClick:E,type:"close"},{icon:M,onClick:le,type:"zoomIn"},{icon:Z,onClick:f,type:"zoomOut",disabled:c(function(){return P.value===1})},{icon:m,onClick:w,type:"rotateRight"},{icon:p,onClick:I,type:"rotateLeft"}],ce=function(){if(e.visible&&o.value){var s=j.value.offsetWidth*P.value,V=j.value.offsetHeight*P.value,$=Ae(j.value),G=$.left,B=$.top,F=N.value%180!==0;o.value=!1;var K=Mt(F?V:s,F?s:V,G,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 V=s.deltaY;Y.value={wheelDirection:V}}},ne=function(){};return Pe(function(){A([function(){return e.visible},o],function(){ne();var g,s,V=ae(window,"mouseup",ce,!1),$=ae(window,"mousemove",re,!1),G=ae(window,"wheel",Ce,{passive:!1});try{window.top!==window.self&&(g=ae(window.top,"mouseup",ce,!1),s=ae(window.top,"mousemove",re,!1))}catch(B){}ne=function(){V.remove(),$.remove(),G.remove(),g&&g.remove(),s&&s.remove()}},{flush:"post",immediate:!0})}),$e(function(){ne()}),function(){var g=e.visible,s=e.prefixCls,V=e.rootClassName;return l(Ke,x(x({},a),{},{transitionName:"zoom",maskTransitionName:"fade",closable:!1,keyboard:!0,prefixCls:s,onClose:E,afterClose:J,visible:g,wrapClassName:pe,rootClassName:V,getContainer:e.getContainer}),{default:function(){return[l("ul",{class:"".concat(e.prefixCls,"-operations")},[se.map(function(G){var B=G.icon,F=G.onClick,K=G.type,ee=G.disabled;return l("li",{class:te(ue,U({},"".concat(e.prefixCls,"-operations-operation-disabled"),ee&&(ee==null?void 0:ee.value))),onClick:F,key:K},[Je(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"),U({},"".concat(e.prefixCls,"-switch-left-disabled"),T.value<=0)),onClick:k},[C]),oe.value&&l("div",{class:te("".concat(e.prefixCls,"-switch-right"),U({},"".concat(e.prefixCls,"-switch-right-disabled"),T.value>=_.value-1)),onClick:R},[L])]}})}}});const Ze=Lt;var Nt=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:et.any,fallback:String,preview:{type:[Boolean,Object],default:!0},onClick:{type:Function},onError:{type:Function}}},Ee=function(e,n){var t=d({},e);return Object.keys(n).forEach(function(a){e[a]===void 0&&(t[a]=n[a])}),t},zt=0,Te=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=c(function(){return e.prefixCls}),m=c(function(){return"".concat(p.value,"-preview")}),M=c(function(){var f={visible:void 0,onVisibleChange:function(){},getContainer:void 0};return be(e.preview)==="object"?Ee(e.preview,f):f}),Z=c(function(){return e.placeholder&&e.placeholder!==!0||a.placeholder}),v=c(function(){return M.value.visible}),C=c(function(){return M.value.getContainer}),L=c(function(){return v.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=tt(!!v.value,{value:v,onChange:P}),H=me(N,2),D=H[0],b=H[1];A(v,function(f){b(!!f)}),A(D,function(f,w){P(f,w)});var O=h(Z.value?"loading":"normal");A(function(){return e.src},function(){O.value=Z.value?"loading":"normal"});var E=h(null),j=c(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(zt++),_=c(function(){return e.preview&&!j.value}),Q=function(){O.value="normal"},T=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})):E.value={x:k,y:R}}o.value?S(!0):b(!0),i("click",w)},oe=function(){b(!1),L.value||(E.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})}),$e(J);var le=function(w){return lt(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,ce=t.crossorigin,he=t.decoding,re=t.alt,Ce=t.sizes,ne=t.srcset,g=t.usemap,s=t.class,V=t.style,$=M.value,G=$.icons,B=$.maskClassName,F=$.src,K=Nt($,["icons","maskClassName","src"]),ee=te(f,w,ue,U({},"".concat(f,"-error"),j.value)),He=j.value&&I?I:F!=null?F:k,Ye={crossorigin:ce,decoding:he,alt:re,sizes:Ce,srcset:ne,usemap:g,class:te("".concat(f,"-img"),U({},"".concat(f,"-img-placeholder"),R===!0),s),style:d({height:se},V)};return l(Ve,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:T,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(Ze,x(x({},K),{},{"aria-hidden":!D.value,visible:D.value,prefixCls:m.value,onClose:oe,mousePosition:E.value,src:He,alt:re,getContainer:C.value,icons:G,rootClassName:ue}),null)])}}});Te.PreviewGroup=Ue;const _t=Te;var Fe={rotateLeft:l(ft,null,null),rotateRight:l(pt,null,null),zoomIn:l(Pt,null,null),zoomOut:l(St,null,null),close:l(rt,null,null),left:l(nt,null,null),right:l(at,null,null)},kt=ie({name:"AImagePreviewGroup",inheritAttrs:!1,props:{previewPrefixCls:String},setup:function(e,n){var t=n.attrs,a=n.slots,i=Ge("image",e),p=i.getPrefixCls,m=c(function(){return p("image-preview",e.previewPrefixCls)});return function(){return l(Ue,x(x({},d(d({},t),e)),{},{icons:Fe,previewPrefixCls:m.value}),a)}}});const Vt=kt;var W=ie({name:"AImage",inheritAttrs:!1,props:De(),setup:function(e,n){var t=n.slots,a=n.attrs,i=Ge("image",e),p=i.prefixCls,m=i.rootPrefixCls,M=i.configProvider,Z=c(function(){var v=e.preview;if(v===!1)return v;var C=be(v)==="object"?v:{};return d(d({icons:Fe},C),{transitionName:Ie(m.value,"zoom",C.transitionName),maskTransitionName:Ie(m.value,"fade",C.maskTransitionName)})});return function(){var v,C,L=((v=M.locale)===null||v===void 0?void 0:v.Image)||it.Image;return l(_t,x(x({},d(d(d({},a),e),{prefixCls:p.value})),{},{preview:Z.value}),d(d({},t),{previewMask:(C=t.previewMask)!==null&&C!==void 0?C:function(){return l("div",{class:"".concat(p.value,"-mask-info")},[l(ot,null,null),L==null?void 0:L.preview])}}))}}});W.PreviewGroup=Vt;W.install=function(r){return r.component(W.name,W),r.component(W.PreviewGroup.name,W.PreviewGroup),r};const Ut=W;export{Ut as I};
|