@gx-design-vue/image 0.2.0-beta.23 → 0.2.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image.js +509 -1304
- package/dist/image.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/image.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue"),require("@ant-design/icons-vue"),require("@gx-design-vue/pro-utils"),require("@gx-design-vue/pro-hooks"),require("@gx-design-vue/pro-provider"),require("@ctrl/tinycolor"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@ant-design/icons-vue","@gx-design-vue/pro-utils","@gx-design-vue/pro-hooks","@gx-design-vue/pro-provider","@ctrl/tinycolor","@vueuse/core"],a):(h=typeof globalThis<"u"?globalThis:h||self,a(h.GImage={},h.vue,h.iconsVue,h.proUtils,h.proHooks,h.proProvider,h.tinycolor,h.core))})(this,function(h,a,x,m,$e,A,J,Me){"use strict";const k={infinite:{type:Boolean,default:!0},zIndex:{type:Number,default:2e3},current:{type:Number,default:0},getContainer:{type:String}},Pe={preview:{type:Object,default:()=>({current:0,infinite:!0,onHideOnClickModal:!0})},showPreview:{type:Boolean,default:!0},src:{type:String,default:""},alt:{type:String,default:""},fit:{type:String,default:"contain"},lazy:Boolean,scrollContainer:{type:[String,Object]},placeholder:{type:[Function,Object],default:()=>{}},fallback:{type:[Function,Object],default:()=>{}},onLoad:{type:Function},onError:{type:Function},onClick:{type:Function},imageClassName:String,imageStyle:Object,width:Number,height:Number,zIndex:k.zIndex,getContainer:k.getContainer},V={previewUrls:{type:Array,default:()=>[]},disabled:Boolean,zIndex:k.zIndex,current:k.current,infinite:k.infinite,getContainer:Pe.getContainer,onHideOnClickModal:Boolean,countRender:[Function,Array,Object],icons:{type:Object,default:()=>({})}};function wn(e,t){process.env.NODE_ENV!=="production"&&!e&&console!==void 0&&console.error(`Warning: ${t}`)}const yn=new A.Keyframe("viewFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),bn=new A.Keyframe("viewFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),Sn=new A.Keyframe("viewZoomBadgeIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),Tn=new A.Keyframe("viewZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),ct=e=>({position:e||"absolute",inset:0});function xe(e){return{position:e,top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0}}const In=e=>{const{previewCls:t,modalMaskBg:n,paddingSM:r,marginXL:o,margin:i,paddingLG:l,previewOperationColorDisabled:s,previewOperationHoverColor:g,motionDurationSlow:d,iconCls:S,colorTextLightSolid:O}=e,y=new J.TinyColor(n).setAlpha(.1),p=y.clone().setAlpha(.2);return{[`${t}-footer`]:{position:"fixed",bottom:o,left:{_skip_check_:!0,value:"50%"},display:"flex",flexDirection:"column",alignItems:"center",color:e.previewOperationColor,transform:"translateX(-50%)"},[`${t}-progress`]:{marginBottom:i},[`${t}-close`]:{position:"fixed",top:o,right:{_skip_check_:!0,value:o},display:"flex",color:O,backgroundColor:y.toRgbString(),borderRadius:"50%",padding:r,outline:0,border:0,cursor:"pointer",transition:`all ${d}`,"&:hover":{backgroundColor:p.toRgbString()},[`& > ${S}`]:{fontSize:e.previewOperationSize}},[`${t}-operations`]:{display:"flex",alignItems:"center",padding:`0 ${A.unit(l)}`,backgroundColor:y.toRgbString(),borderRadius:100,"&-operation":{marginInlineStart:r,padding:r,cursor:"pointer",transition:`all ${d}`,userSelect:"none",[`&:not(${t}-operations-operation-disabled):hover > ${S}`]:{color:g},"&-disabled":{color:s,cursor:"not-allowed"},"&:first-of-type":{marginInlineStart:0},[`& > ${S}`]:{fontSize:e.previewOperationSize}}}}},Cn=e=>{const{modalMaskBg:t,iconCls:n,previewOperationColorDisabled:r,previewCls:o,zIndexPopup:i,motionDurationSlow:l}=e,s=new J.TinyColor(t).setAlpha(.1),g=s.clone().setAlpha(.2);return{[`${o}-switch-left, ${o}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:e.calc(i).add(1).equal(),display:"flex",alignItems:"center",justifyContent:"center",width:e.imagePreviewSwitchSize,height:e.imagePreviewSwitchSize,marginTop:e.calc(e.imagePreviewSwitchSize).mul(-1).div(2).equal(),color:e.previewOperationColor,background:s.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${l}`,userSelect:"none","&:hover":{background:g.toRgbString()},"&-disabled":{"&, &:hover":{color:r,background:"transparent",cursor:"not-allowed",[`> ${n}`]:{cursor:"not-allowed"}}},[`> ${n}`]:{fontSize:e.previewOperationSize}},[`${o}-switch-left`]:{insetInlineStart:e.marginSM},[`${o}-switch-right`]:{insetInlineEnd:e.marginSM}}},On=e=>({[e.componentCls]:{height:"100%",textAlign:"center",pointerEvents:"none","&-root":{...xe("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},"&-wrap":{...xe("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},"&-mask":{...xe("fixed"),zIndex:e.zIndexPopupBase,height:"100%",backgroundColor:e.colorBgMask},"&-body":{...ct(),overflow:"hidden"},"&-img":{maxWidth:"100%",maxHeight:"100%",verticalAlign:"middle",transform:"scale3d(1, 1, 1)",cursor:"grab",transition:`transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,userSelect:"none",pointerEvents:"auto","&-wrapper":{...ct(),display:"flex",justifyContent:"center",alignItems:"center",transition:`transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,"&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}}},"&-fade-appear, &-fade-enter":{animationName:yn,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},"&-fade-leave":{animationName:bn,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},"&-zoom-appear, &-zoom-enter":{animationName:Sn,opacity:0,animationTimingFunction:e.motionEaseOutCirc,animationFillMode:"both",transform:"none",animationDuration:e.motionDurationSlow,userSelect:"none"},"&-zoom-enter-active":{animationPlayState:"running"},"&-zoom-leave":{animationName:Tn,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"}},[`${e.componentCls}-root`]:{[`${e.componentCls}-wrapper`]:{zIndex:e.zIndexPopup}},[`${e.componentCls}-operations-wrapper`]:{position:"fixed",insetBlockStart:0,insetInlineEnd:0,zIndex:e.zIndexPopup+1,width:"100%"},"&":[In(e),Cn(e)]});function En(e){return A.useStyle("ImageViewer",t=>{const n=A.mergeToken(t,{zIndexPopup:t.zIndexPopupBase+80,previewOperationColorDisabled:new J.TinyColor(t.colorTextLightSolid).setAlpha(.25).toRgbString(),previewOperationHoverColor:new J.TinyColor(t.colorTextLightSolid).setAlpha(.85).toRgbString(),modalMaskBg:new J.TinyColor("#000").setAlpha(.45).toRgbString(),previewOperationColor:new J.TinyColor(t.colorTextLightSolid).toRgbString(),previewOperationSize:t.fontSizeIcon*1.5,imagePreviewSwitchSize:t.controlHeightLG,iconCls:"anticon",previewCls:t.componentCls});return[On(n)]},e)}function Nn(e){const t=e.getBoundingClientRect(),n=document.documentElement;return{left:t.left+(window.scrollX||n.scrollLeft)-(n.clientLeft||document.body.clientLeft||0),top:t.top+(window.scrollY||n.scrollTop)-(n.clientTop||document.body.clientTop||0)}}function _n(){const e=document.documentElement.clientWidth,t=window.innerHeight||document.documentElement.clientHeight;return{width:e,height:t}}function st(e,t,n,r){const o=t+n,i=(n-r)/2;if(n>r){if(t>0)return{[e]:i};if(t<0&&o<r)return{[e]:-i}}else if(t<0||o>r)return{[e]:t<0?i:-i};return{}}function An(e,t,n,r){const{width:o,height:i}=_n();let l=null;return e<=o&&t<=i?l={x:0,y:0}:(e>o||t>i)&&(l={...st("x",n,e,o),...st("y",r,t,i)}),l}let ut=!1;try{const e=Object.defineProperty({},"passive",{get(){ut=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch{}function ee(e,t,n,r){if(e&&e.addEventListener){let o=r;o===void 0&&ut&&(t==="touchstart"||t==="touchmove"||t==="wheel")&&(o={passive:!1}),e.addEventListener(t,n,o)}return{remove:()=>{e&&e.removeEventListener&&e.removeEventListener(t,n)}}}const u={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(t){const{keyCode:n}=t;if(t.altKey&&!t.ctrlKey||t.metaKey||n>=u.F1&&n<=u.F12)return!1;switch(n){case u.ALT:case u.CAPS_LOCK:case u.CONTEXT_MENU:case u.CTRL:case u.DOWN:case u.END:case u.ESC:case u.HOME:case u.INSERT:case u.LEFT:case u.MAC_FF_META:case u.META:case u.NUMLOCK:case u.NUM_CENTER:case u.PAGE_DOWN:case u.PAGE_UP:case u.PAUSE:case u.PRINT_SCREEN:case u.RIGHT:case u.SHIFT:case u.UP:case u.WIN_KEY:case u.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(t){if(t>=u.ZERO&&t<=u.NINE||t>=u.NUM_ZERO&&t<=u.NUM_MULTIPLY||t>=u.A&&t<=u.Z||window.navigator.userAgent.includes("WebKit")&&t===0)return!0;switch(t){case u.SPACE:case u.QUESTION_MARK:case u.NUM_PLUS:case u.NUM_MINUS:case u.NUM_PERIOD:case u.NUM_DIVISION:case u.SEMICOLON:case u.DASH:case u.EQUALS:case u.COMMA:case u.PERIOD:case u.SLASH:case u.APOSTROPHE:case u.SINGLE_QUOTE:case u.OPEN_SQUARE_BRACKET:case u.BACKSLASH:case u.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};let ft=e=>setTimeout(e,16),dt=e=>clearTimeout(e);typeof window<"u"&&"requestAnimationFrame"in window&&(ft=e=>window.requestAnimationFrame(e),dt=e=>window.cancelAnimationFrame(e));let gt=0;const Le=new Map;function ht(e){Le.delete(e)}function je(e,t=1){gt+=1;const n=gt;function r(o){if(o===0)ht(n),e();else{const i=ft(()=>{r(o-1)});Le.set(n,i)}}return r(t),n}je.cancel=e=>{const t=Le.get(e);return ht(t),dt(t)};function $n(e){const t=a.ref(null),n=a.reactive({...e}),r=a.ref([]),o=i=>{t.value===null&&(r.value=[],t.value=je(()=>{let l;r.value.forEach(s=>{l={...l,...s}}),Object.assign(n,l),t.value=null})),r.value.push(i)};return a.onMounted(()=>{t.value&&je.cancel(t.value)}),[n,o]}const Mn=a.defineComponent({name:"Operations",inheritAttrs:!1,props:{open:Boolean,count:{type:Number,default:0},current:{type:Number,default:0},showSwitch:Boolean,showProgress:Boolean,prefixCls:String,hashId:String,zIndex:V.zIndex,icons:V.icons,infinite:V.infinite,getContainer:V.getContainer,countRender:V.countRender,tools:Array,onClose:Function,onActive:Function},setup(e){const t=(n,r)=>{var o;n.preventDefault(),n.stopPropagation(),(o=e.onActive)==null||o.call(e,r)};return()=>{const{prefixCls:n,hashId:r,tools:o}=e,i=A.getTransitionProps(`${e.prefixCls}-fade`),l=`${n}-operations-operation`,s=`${n}-operations-icon`;return a.createVNode(a.Teleport,{to:e.getContainer||"body"},{default:()=>[a.createVNode(a.Transition,i,{default:()=>{var g,d,S,O;return[a.withDirectives(a.createVNode("div",{class:m.classNames(`${n}-operations-wrapper`,r),style:{zIndex:e.zIndex}},[((g=e.icons)==null?void 0:g.close)===null?null:a.createVNode("button",{class:`${n}-close ${r}`,onClick:e.onClose},[((d=e.icons)==null?void 0:d.close)||a.createVNode(x.CloseOutlined,null,null)]),e.showSwitch&&a.createVNode(a.Fragment,null,[a.createVNode("div",{class:m.classNames(`${n}-switch-left ${r}`,{[`${n}-switch-left-disabled`]:e.infinite?!1:e.current===0}),onClick:y=>t(y,-1)},[((S=e.icons)==null?void 0:S.left)||a.createVNode(x.LeftOutlined,null,null)]),a.createVNode("div",{className:m.classNames(`${n}-switch-right ${r}`,{[`${n}-switch-right-disabled`]:e.infinite?!1:e.current===e.count-1}),onClick:y=>t(y,1)},[((O=e.icons)==null?void 0:O.right)||a.createVNode(x.RightOutlined,null,null)])]),a.createVNode("div",{class:`${n}-footer ${r}`},[e.showProgress&&a.createVNode("div",{class:`${n}-progress`},[e.countRender?e.countRender(e.current+1,e.count):`${e.current+1} / ${e.count}`]),a.createVNode("div",{class:`${e.prefixCls}-operations`},[o==null?void 0:o.map(({icon:y,onClick:p,type:_,disabled:I})=>a.createVNode("div",{class:m.classNames(l,{[`${e.prefixCls}-operations-operation-disabled`]:I&&(I==null?void 0:I.value)}),onClick:p,key:_},[a.cloneVNode(y,{class:s})]))])])]),[[a.vShow,e.open]])]}})]})}}});var pt=typeof global=="object"&&global&&global.Object===Object&&global,Pn=typeof self=="object"&&self&&self.Object===Object&&self,$=pt||Pn||Function("return this")(),M=$.Symbol,mt=Object.prototype,xn=mt.hasOwnProperty,Ln=mt.toString,se=M?M.toStringTag:void 0;function jn(e){var t=xn.call(e,se),n=e[se];try{e[se]=void 0;var r=!0}catch{}var o=Ln.call(e);return r&&(t?e[se]=n:delete e[se]),o}var Rn=Object.prototype,Dn=Rn.toString;function zn(e){return Dn.call(e)}var Fn="[object Null]",Un="[object Undefined]",vt=M?M.toStringTag:void 0;function H(e){return e==null?e===void 0?Un:Fn:vt&&vt in Object(e)?jn(e):zn(e)}function G(e){return e!=null&&typeof e=="object"}var Bn="[object Symbol]";function Re(e){return typeof e=="symbol"||G(e)&&H(e)==Bn}function wt(e,t){for(var n=-1,r=e==null?0:e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}var D=Array.isArray,Vn=1/0,yt=M?M.prototype:void 0,bt=yt?yt.toString:void 0;function St(e){if(typeof e=="string")return e;if(D(e))return wt(e,St)+"";if(Re(e))return bt?bt.call(e):"";var t=e+"";return t=="0"&&1/e==-Vn?"-0":t}function K(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Hn(e){return e}var Gn="[object AsyncFunction]",Kn="[object Function]",Yn="[object GeneratorFunction]",Wn="[object Proxy]";function Tt(e){if(!K(e))return!1;var t=H(e);return t==Kn||t==Yn||t==Gn||t==Wn}var De=$["__core-js_shared__"],It=function(){var e=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Xn(e){return!!It&&It in e}var Zn=Function.prototype,Qn=Zn.toString;function Y(e){if(e!=null){try{return Qn.call(e)}catch{}try{return e+""}catch{}}return""}var qn=/[\\^$.*+?()[\]{}|]/g,Jn=/^\[object .+?Constructor\]$/,kn=Function.prototype,er=Object.prototype,tr=kn.toString,nr=er.hasOwnProperty,rr=RegExp("^"+tr.call(nr).replace(qn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function or(e){if(!K(e)||Xn(e))return!1;var t=Tt(e)?rr:Jn;return t.test(Y(e))}function ar(e,t){return e==null?void 0:e[t]}function W(e,t){var n=ar(e,t);return or(n)?n:void 0}var ze=W($,"WeakMap"),Ct=Object.create,ir=function(){function e(){}return function(t){if(!K(t))return{};if(Ct)return Ct(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function lr(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function cr(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var sr=800,ur=16,fr=Date.now;function dr(e){var t=0,n=0;return function(){var r=fr(),o=ur-(r-n);if(n=r,o>0){if(++t>=sr)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function gr(e){return function(){return e}}var we=function(){try{var e=W(Object,"defineProperty");return e({},"",{}),e}catch{}}(),hr=we?function(e,t){return we(e,"toString",{configurable:!0,enumerable:!1,value:gr(t),writable:!0})}:Hn,pr=dr(hr);function mr(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var vr=9007199254740991,wr=/^(?:0|[1-9]\d*)$/;function Fe(e,t){var n=typeof e;return t=t??vr,!!t&&(n=="number"||n!="symbol"&&wr.test(e))&&e>-1&&e%1==0&&e<t}function Ot(e,t,n){t=="__proto__"&&we?we(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Et(e,t){return e===t||e!==e&&t!==t}var yr=Object.prototype,br=yr.hasOwnProperty;function Ue(e,t,n){var r=e[t];(!(br.call(e,t)&&Et(r,n))||n===void 0&&!(t in e))&&Ot(e,t,n)}function ue(e,t,n,r){var o=!n;n||(n={});for(var i=-1,l=t.length;++i<l;){var s=t[i],g=void 0;g===void 0&&(g=e[s]),o?Ot(n,s,g):Ue(n,s,g)}return n}var Nt=Math.max;function Sr(e,t,n){return t=Nt(t===void 0?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=Nt(r.length-t,0),l=Array(i);++o<i;)l[o]=r[t+o];o=-1;for(var s=Array(t+1);++o<t;)s[o]=r[o];return s[t]=n(l),lr(e,this,s)}}var Tr=9007199254740991;function Be(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Tr}function _t(e){return e!=null&&Be(e.length)&&!Tt(e)}var Ir=Object.prototype;function Ve(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Ir;return e===n}function Cr(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Or="[object Arguments]";function At(e){return G(e)&&H(e)==Or}var $t=Object.prototype,Er=$t.hasOwnProperty,Nr=$t.propertyIsEnumerable,He=At(function(){return arguments}())?At:function(e){return G(e)&&Er.call(e,"callee")&&!Nr.call(e,"callee")};function _r(){return!1}var Mt=typeof h=="object"&&h&&!h.nodeType&&h,Pt=Mt&&typeof module=="object"&&module&&!module.nodeType&&module,Ar=Pt&&Pt.exports===Mt,xt=Ar?$.Buffer:void 0,$r=xt?xt.isBuffer:void 0,Lt=$r||_r,Mr="[object Arguments]",Pr="[object Array]",xr="[object Boolean]",Lr="[object Date]",jr="[object Error]",Rr="[object Function]",Dr="[object Map]",zr="[object Number]",Fr="[object Object]",Ur="[object RegExp]",Br="[object Set]",Vr="[object String]",Hr="[object WeakMap]",Gr="[object ArrayBuffer]",Kr="[object DataView]",Yr="[object Float32Array]",Wr="[object Float64Array]",Xr="[object Int8Array]",Zr="[object Int16Array]",Qr="[object Int32Array]",qr="[object Uint8Array]",Jr="[object Uint8ClampedArray]",kr="[object Uint16Array]",eo="[object Uint32Array]",w={};w[Yr]=w[Wr]=w[Xr]=w[Zr]=w[Qr]=w[qr]=w[Jr]=w[kr]=w[eo]=!0,w[Mr]=w[Pr]=w[Gr]=w[xr]=w[Kr]=w[Lr]=w[jr]=w[Rr]=w[Dr]=w[zr]=w[Fr]=w[Ur]=w[Br]=w[Vr]=w[Hr]=!1;function to(e){return G(e)&&Be(e.length)&&!!w[H(e)]}function Ge(e){return function(t){return e(t)}}var jt=typeof h=="object"&&h&&!h.nodeType&&h,fe=jt&&typeof module=="object"&&module&&!module.nodeType&&module,no=fe&&fe.exports===jt,Ke=no&&pt.process,te=function(){try{var e=fe&&fe.require&&fe.require("util").types;return e||Ke&&Ke.binding&&Ke.binding("util")}catch{}}(),Rt=te&&te.isTypedArray,ro=Rt?Ge(Rt):to,oo=Object.prototype,ao=oo.hasOwnProperty;function Dt(e,t){var n=D(e),r=!n&&He(e),o=!n&&!r&&Lt(e),i=!n&&!r&&!o&&ro(e),l=n||r||o||i,s=l?Cr(e.length,String):[],g=s.length;for(var d in e)(t||ao.call(e,d))&&!(l&&(d=="length"||o&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Fe(d,g)))&&s.push(d);return s}function zt(e,t){return function(n){return e(t(n))}}var io=zt(Object.keys,Object),lo=Object.prototype,co=lo.hasOwnProperty;function so(e){if(!Ve(e))return io(e);var t=[];for(var n in Object(e))co.call(e,n)&&n!="constructor"&&t.push(n);return t}function Ye(e){return _t(e)?Dt(e):so(e)}function uo(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var fo=Object.prototype,go=fo.hasOwnProperty;function ho(e){if(!K(e))return uo(e);var t=Ve(e),n=[];for(var r in e)r=="constructor"&&(t||!go.call(e,r))||n.push(r);return n}function We(e){return _t(e)?Dt(e,!0):ho(e)}var po=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mo=/^\w*$/;function vo(e,t){if(D(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Re(e)?!0:mo.test(e)||!po.test(e)||t!=null&&e in Object(t)}var de=W(Object,"create");function wo(){this.__data__=de?de(null):{},this.size=0}function yo(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var bo="__lodash_hash_undefined__",So=Object.prototype,To=So.hasOwnProperty;function Io(e){var t=this.__data__;if(de){var n=t[e];return n===bo?void 0:n}return To.call(t,e)?t[e]:void 0}var Co=Object.prototype,Oo=Co.hasOwnProperty;function Eo(e){var t=this.__data__;return de?t[e]!==void 0:Oo.call(t,e)}var No="__lodash_hash_undefined__";function _o(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=de&&t===void 0?No:t,this}function X(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}X.prototype.clear=wo,X.prototype.delete=yo,X.prototype.get=Io,X.prototype.has=Eo,X.prototype.set=_o;function Ao(){this.__data__=[],this.size=0}function ye(e,t){for(var n=e.length;n--;)if(Et(e[n][0],t))return n;return-1}var $o=Array.prototype,Mo=$o.splice;function Po(e){var t=this.__data__,n=ye(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Mo.call(t,n,1),--this.size,!0}function xo(e){var t=this.__data__,n=ye(t,e);return n<0?void 0:t[n][1]}function Lo(e){return ye(this.__data__,e)>-1}function jo(e,t){var n=this.__data__,r=ye(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function L(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}L.prototype.clear=Ao,L.prototype.delete=Po,L.prototype.get=xo,L.prototype.has=Lo,L.prototype.set=jo;var ge=W($,"Map");function Ro(){this.size=0,this.__data__={hash:new X,map:new(ge||L),string:new X}}function Do(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function be(e,t){var n=e.__data__;return Do(t)?n[typeof t=="string"?"string":"hash"]:n.map}function zo(e){var t=be(this,e).delete(e);return this.size-=t?1:0,t}function Fo(e){return be(this,e).get(e)}function Uo(e){return be(this,e).has(e)}function Bo(e,t){var n=be(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function z(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}z.prototype.clear=Ro,z.prototype.delete=zo,z.prototype.get=Fo,z.prototype.has=Uo,z.prototype.set=Bo;var Vo="Expected a function";function Xe(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Vo);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var l=e.apply(this,r);return n.cache=i.set(o,l)||i,l};return n.cache=new(Xe.Cache||z),n}Xe.Cache=z;var Ho=500;function Go(e){var t=Xe(e,function(r){return n.size===Ho&&n.clear(),r}),n=t.cache;return t}var Ko=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yo=/\\(\\)?/g,Wo=Go(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Ko,function(n,r,o,i){t.push(o?i.replace(Yo,"$1"):r||n)}),t});function Xo(e){return e==null?"":St(e)}function ne(e,t){return D(e)?e:vo(e,t)?[e]:Wo(Xo(e))}var Zo=1/0;function Se(e){if(typeof e=="string"||Re(e))return e;var t=e+"";return t=="0"&&1/e==-Zo?"-0":t}function Ft(e,t){t=ne(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Se(t[n++])];return n&&n==r?e:void 0}function Ze(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}var Ut=M?M.isConcatSpreadable:void 0;function Qo(e){return D(e)||He(e)||!!(Ut&&e&&e[Ut])}function qo(e,t,n,r,o){var i=-1,l=e.length;for(n||(n=Qo),o||(o=[]);++i<l;){var s=e[i];n(s)?Ze(o,s):o[o.length]=s}return o}function Jo(e){var t=e==null?0:e.length;return t?qo(e):[]}function Bt(e){return pr(Sr(e,void 0,Jo),e+"")}var Qe=zt(Object.getPrototypeOf,Object),ko="[object Object]",ea=Function.prototype,ta=Object.prototype,Vt=ea.toString,na=ta.hasOwnProperty,ra=Vt.call(Object);function oa(e){if(!G(e)||H(e)!=ko)return!1;var t=Qe(e);if(t===null)return!0;var n=na.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Vt.call(n)==ra}function aa(e,t,n){var r=-1,o=e.length;t<0&&(t=-t>o?0:o+t),n=n>o?o:n,n<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++r<o;)i[r]=e[r+t];return i}function ia(){this.__data__=new L,this.size=0}function la(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function ca(e){return this.__data__.get(e)}function sa(e){return this.__data__.has(e)}var ua=200;function fa(e,t){var n=this.__data__;if(n instanceof L){var r=n.__data__;if(!ge||r.length<ua-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new z(r)}return n.set(e,t),this.size=n.size,this}function re(e){var t=this.__data__=new L(e);this.size=t.size}re.prototype.clear=ia,re.prototype.delete=la,re.prototype.get=ca,re.prototype.has=sa,re.prototype.set=fa;function da(e,t){return e&&ue(t,Ye(t),e)}function ga(e,t){return e&&ue(t,We(t),e)}var Ht=typeof h=="object"&&h&&!h.nodeType&&h,Gt=Ht&&typeof module=="object"&&module&&!module.nodeType&&module,ha=Gt&&Gt.exports===Ht,Kt=ha?$.Buffer:void 0,Yt=Kt?Kt.allocUnsafe:void 0;function pa(e,t){if(t)return e.slice();var n=e.length,r=Yt?Yt(n):new e.constructor(n);return e.copy(r),r}function ma(e,t){for(var n=-1,r=e==null?0:e.length,o=0,i=[];++n<r;){var l=e[n];t(l,n,e)&&(i[o++]=l)}return i}function Wt(){return[]}var va=Object.prototype,wa=va.propertyIsEnumerable,Xt=Object.getOwnPropertySymbols,qe=Xt?function(e){return e==null?[]:(e=Object(e),ma(Xt(e),function(t){return wa.call(e,t)}))}:Wt;function ya(e,t){return ue(e,qe(e),t)}var ba=Object.getOwnPropertySymbols,Zt=ba?function(e){for(var t=[];e;)Ze(t,qe(e)),e=Qe(e);return t}:Wt;function Sa(e,t){return ue(e,Zt(e),t)}function Qt(e,t,n){var r=t(e);return D(e)?r:Ze(r,n(e))}function Ta(e){return Qt(e,Ye,qe)}function qt(e){return Qt(e,We,Zt)}var Je=W($,"DataView"),ke=W($,"Promise"),et=W($,"Set"),Jt="[object Map]",Ia="[object Object]",kt="[object Promise]",en="[object Set]",tn="[object WeakMap]",nn="[object DataView]",Ca=Y(Je),Oa=Y(ge),Ea=Y(ke),Na=Y(et),_a=Y(ze),j=H;(Je&&j(new Je(new ArrayBuffer(1)))!=nn||ge&&j(new ge)!=Jt||ke&&j(ke.resolve())!=kt||et&&j(new et)!=en||ze&&j(new ze)!=tn)&&(j=function(e){var t=H(e),n=t==Ia?e.constructor:void 0,r=n?Y(n):"";if(r)switch(r){case Ca:return nn;case Oa:return Jt;case Ea:return kt;case Na:return en;case _a:return tn}return t});var Aa=Object.prototype,$a=Aa.hasOwnProperty;function Ma(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&$a.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var rn=$.Uint8Array;function tt(e){var t=new e.constructor(e.byteLength);return new rn(t).set(new rn(e)),t}function Pa(e,t){var n=t?tt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var xa=/\w*$/;function La(e){var t=new e.constructor(e.source,xa.exec(e));return t.lastIndex=e.lastIndex,t}var on=M?M.prototype:void 0,an=on?on.valueOf:void 0;function ja(e){return an?Object(an.call(e)):{}}function Ra(e,t){var n=t?tt(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Da="[object Boolean]",za="[object Date]",Fa="[object Map]",Ua="[object Number]",Ba="[object RegExp]",Va="[object Set]",Ha="[object String]",Ga="[object Symbol]",Ka="[object ArrayBuffer]",Ya="[object DataView]",Wa="[object Float32Array]",Xa="[object Float64Array]",Za="[object Int8Array]",Qa="[object Int16Array]",qa="[object Int32Array]",Ja="[object Uint8Array]",ka="[object Uint8ClampedArray]",ei="[object Uint16Array]",ti="[object Uint32Array]";function ni(e,t,n){var r=e.constructor;switch(t){case Ka:return tt(e);case Da:case za:return new r(+e);case Ya:return Pa(e,n);case Wa:case Xa:case Za:case Qa:case qa:case Ja:case ka:case ei:case ti:return Ra(e,n);case Fa:return new r;case Ua:case Ha:return new r(e);case Ba:return La(e);case Va:return new r;case Ga:return ja(e)}}function ri(e){return typeof e.constructor=="function"&&!Ve(e)?ir(Qe(e)):{}}var oi="[object Map]";function ai(e){return G(e)&&j(e)==oi}var ln=te&&te.isMap,ii=ln?Ge(ln):ai,li="[object Set]";function ci(e){return G(e)&&j(e)==li}var cn=te&&te.isSet,si=cn?Ge(cn):ci,ui=1,fi=2,di=4,sn="[object Arguments]",gi="[object Array]",hi="[object Boolean]",pi="[object Date]",mi="[object Error]",un="[object Function]",vi="[object GeneratorFunction]",wi="[object Map]",yi="[object Number]",fn="[object Object]",bi="[object RegExp]",Si="[object Set]",Ti="[object String]",Ii="[object Symbol]",Ci="[object WeakMap]",Oi="[object ArrayBuffer]",Ei="[object DataView]",Ni="[object Float32Array]",_i="[object Float64Array]",Ai="[object Int8Array]",$i="[object Int16Array]",Mi="[object Int32Array]",Pi="[object Uint8Array]",xi="[object Uint8ClampedArray]",Li="[object Uint16Array]",ji="[object Uint32Array]",v={};v[sn]=v[gi]=v[Oi]=v[Ei]=v[hi]=v[pi]=v[Ni]=v[_i]=v[Ai]=v[$i]=v[Mi]=v[wi]=v[yi]=v[fn]=v[bi]=v[Si]=v[Ti]=v[Ii]=v[Pi]=v[xi]=v[Li]=v[ji]=!0,v[mi]=v[un]=v[Ci]=!1;function Te(e,t,n,r,o,i){var l,s=t&ui,g=t&fi,d=t&di;if(n&&(l=o?n(e,r,o,i):n(e)),l!==void 0)return l;if(!K(e))return e;var S=D(e);if(S){if(l=Ma(e),!s)return cr(e,l)}else{var O=j(e),y=O==un||O==vi;if(Lt(e))return pa(e,s);if(O==fn||O==sn||y&&!o){if(l=g||y?{}:ri(e),!s)return g?Sa(e,ga(l,e)):ya(e,da(l,e))}else{if(!v[O])return o?e:{};l=ni(e,O,s)}}i||(i=new re);var p=i.get(e);if(p)return p;i.set(e,l),si(e)?e.forEach(function(C){l.add(Te(C,t,n,C,e,i))}):ii(e)&&e.forEach(function(C,b){l.set(b,Te(C,t,n,b,e,i))});var _=d?g?qt:Ta:g?We:Ye,I=S?void 0:_(e);return mr(I||e,function(C,b){I&&(b=C,C=e[b]),Ue(l,b,Te(C,t,n,b,e,i))}),l}function Ri(e,t){return e!=null&&t in Object(e)}function Di(e,t,n){t=ne(t,e);for(var r=-1,o=t.length,i=!1;++r<o;){var l=Se(t[r]);if(!(i=e!=null&&n(e,l)))break;e=e[l]}return i||++r!=o?i:(o=e==null?0:e.length,!!o&&Be(o)&&Fe(l,o)&&(D(e)||He(e)))}function zi(e,t){return e!=null&&Di(e,t,Ri)}function Fi(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function Ui(e,t){return t.length<2?e:Ft(e,aa(t,0,-1))}function Bi(e,t){return t=ne(t,e),e=Ui(e,t),e==null||delete e[Se(Fi(t))]}function Vi(e){return oa(e)?void 0:e}var Hi=1,Gi=2,Ki=4,Yi=Bt(function(e,t){var n={};if(e==null)return n;var r=!1;t=wt(t,function(i){return i=ne(i,e),r||(r=i.length>1),i}),ue(e,qt(e),n),r&&(n=Te(n,Hi|Gi|Ki,Vi));for(var o=t.length;o--;)Bi(n,t[o]);return n});function Wi(e,t,n,r){if(!K(e))return e;t=ne(t,e);for(var o=-1,i=t.length,l=i-1,s=e;s!=null&&++o<i;){var g=Se(t[o]),d=n;if(g==="__proto__"||g==="constructor"||g==="prototype")return e;if(o!=l){var S=s[g];d=void 0,d===void 0&&(d=K(S)?S:Fe(t[o+1])?[]:{})}Ue(s,g,d),s=s[g]}return e}function Xi(e,t,n){for(var r=-1,o=t.length,i={};++r<o;){var l=t[r],s=Ft(e,l);n(s,l)&&Wi(i,ne(l,e),s)}return i}function Zi(e,t){return Xi(e,t,function(n,r){return zi(e,r)})}var Qi=Bt(function(e,t){return e==null?{}:Zi(e,t)});const Z={x:0,y:0},oe={rotateLeft:a.createVNode(x.RotateLeftOutlined,null,null),rotateRight:a.createVNode(x.RotateRightOutlined,null,null),zoomIn:a.createVNode(x.ZoomInOutlined,null,null),zoomOut:a.createVNode(x.ZoomOutOutlined,null,null),flipX:a.createVNode(x.SwapOutlined,null,null),flipY:a.createVNode(x.SwapOutlined,{rotate:90},null)},dn=["close","left","right","rotateRight","rotateRight","zoomOut","flipX","flipY","rotateLeft"],gn=a.defineComponent({name:"GImageViewer",props:V,inheritAttrs:!1,emits:["close","switch","afterClose"],emit:Object,setup:(e,{emit:t,expose:n,slots:r})=>{const o=m.getPrefixCls({suffixCls:"image-view"}),{wrapSSR:i,hashId:l}=En(o),[s,g]=$e.useState(!1),[d,S]=$e.useState(!1),O=a.ref(null),y=a.ref(e.current),p=a.shallowRef(1),_=a.shallowRef(0),I=a.shallowRef(!1),C=a.reactive({x:1,y:1}),[b,F]=$n(Z),he=a.shallowRef({wheelDirection:0}),Q=a.shallowRef(),P=a.reactive({originX:0,originY:0,deltaX:0,deltaY:0}),q=a.reactive(new Map),ie=a.computed(()=>new Map(Array.from(q).map(([c,{url:T}])=>[c,T]))),Ie=a.computed(()=>ie.value.get(y.value)),le=a.computed(()=>ie.value.size),pe=a.computed(()=>Array.from(ie.value.keys())),U=a.computed(()=>pe.value.indexOf(y.value)),Ce=a.computed(()=>le.value>1),me=a.computed(()=>le.value>=1);a.watch(s,c=>{c&&(d.value=!0)});const f=c=>{y.value=c};a.watch(()=>e.current,c=>{m.isNumber(c)&&f(c)});function E(c,T){q.set(c,{url:T,loading:!0,canPreview:!1})}const R=()=>{S(!1),y.value=e.current},rt=()=>{p.value=1,_.value=0,C.x=1,C.y=1,F(Z),t("close")},ot=c=>{I.value||O.value===(c==null?void 0:c.target)&&R()},at=()=>{const c=q.get(y.value);c&&(c.loading=!1,c.canPreview=!0)},Oe=c=>{const T=q.get(y.value);T&&(T.loading=!1,T.canPreview=!1),c.target.alt="加载失败"},Ee=()=>{if(U.value>0||e.infinite){const c=U.value-1<0?e.previewUrls.length-1:U.value-1;f(pe.value[c])}},Ne=()=>{if(U.value<le.value-1||e.infinite){const c=U.value+1>e.previewUrls.length-1?0:U.value+1;f(pe.value[c])}},ce=c=>{c?p.value+=.5:p.value++,F(Z)},ve=c=>{p.value>1&&(c?p.value-=.5:p.value--),F(Z)},it=()=>{_.value+=90},tl=()=>{_.value-=90},nl=()=>{C.x=-C.x},rl=()=>{C.y=-C.y},pn=[{icon:m.getSlotVNode(r,e.icons,"zoomIn")||oe.zoomIn,onClick:()=>ce(),type:"zoomIn"},{icon:m.getSlotVNode(r,e.icons,"zoomOut")||oe.zoomOut,onClick:()=>ve(),type:"zoomOut",disabled:a.computed(()=>p.value===1)},{icon:m.getSlotVNode(r,e.icons,"rotateRight")||oe.rotateRight,onClick:it,type:"rotateRight"},{icon:m.getSlotVNode(r,e.icons,"rotateLeft")||oe.rotateLeft,onClick:tl,type:"rotateLeft"},{icon:m.getSlotVNode(r,e.icons,"flipX")||oe.flipX,onClick:nl,type:"flipX"},{icon:m.getSlotVNode(r,e.icons,"flipY")||oe.flipY,onClick:rl,type:"flipY"}],mn=()=>{if(s.value&&I.value&&Q.value){const c=Q.value.offsetWidth*p.value,T=Q.value.offsetHeight*p.value,{left:B,top:N}=Nn(Q.value),_e=_.value%180!==0;I.value=!1;const Ae=An(_e?T:c,_e?c:T,B,N);Ae&&F({...Ae})}},ol=c=>{c.button===0&&(c.preventDefault(),c.stopPropagation(),P.deltaX=c.pageX-b.x,P.deltaY=c.pageY-b.y,P.originX=b.x,P.originY=b.y,I.value=!0)},vn=c=>{s.value&&I.value&&F({x:c.pageX-P.deltaX,y:c.pageY-P.deltaY})},al=c=>{if(!s.value)return;c.preventDefault();const T=c.deltaY;he.value={wheelDirection:T}},il=c=>{!s.value||!Ce.value||(c.keyCode===u.LEFT?Ee():c.keyCode===u.RIGHT&&Ne())},ll=()=>{s.value&&(p.value!==1&&(p.value=1),(b.x!==Z.x||b.y!==Z.y)&&F(Z))};let lt=()=>{};return a.onMounted(()=>{a.watch(()=>e.previewUrls,c=>{m.isArray(c)&&c.forEach((T,B)=>{E(B,T)})},{flush:"post",immediate:!0}),a.watch([()=>s.value,I],()=>{lt();let c,T;const B=ee(window,"mouseup",mn,!1),N=ee(window,"mousemove",vn,!1),_e=ee(window,"wheel",al,{passive:!1}),Ae=ee(window,"keydown",il,!1);try{window.top!==window.self&&(c=ee(window.top,"mouseup",mn,!1),T=ee(window.top,"mousemove",vn,!1))}catch(cl){wn(!1,`[vc-image] ${cl}`)}lt=()=>{B.remove(),N.remove(),_e.remove(),Ae.remove(),c&&c.remove(),T&&T.remove()}},{flush:"post",immediate:!0}),a.watch([he],()=>{const{wheelDirection:c}=he.value;c>0?ve(!0):c<0&&ce(!0)})}),a.onUnmounted(()=>{lt()}),n({setOpen:g}),()=>{const c=A.getTransitionProps(`${o}-fade`),T=A.getTransitionProps(`${o}-zoom`),B={};for(const N in e.icons)B[N]=m.getSlotVNode(r,e.icons,N);return i(a.createVNode(a.Fragment,null,[a.createVNode(a.Teleport,{to:e.getContainer||"body"},{default:()=>[s.value&&a.createVNode(a.Fragment,null,[a.createVNode("div",{class:`${o}-root ${l.value}`},[a.createVNode(a.Transition,c,{default:()=>[a.withDirectives(a.createVNode("div",{class:`${o}-mask ${l.value}`},null),[[a.vShow,s.value&&d.value]])]}),a.createVNode("div",{ref:O,tabindex:-1,class:[`${o}-wrap`,`${l.value}`],onClick:N=>e.onHideOnClickModal&&ot(N)},[a.createVNode(a.Transition,a.mergeProps(T,{onAfterLeave:()=>rt()}),{default:()=>[a.withDirectives(a.createVNode("div",{role:"dialog",class:`${o} ${l.value}`},[a.createVNode("div",{class:`${o}-content ${l.value}`},[a.createVNode("div",{class:`${o}-body ${l.value}`},[a.createVNode("div",{class:`${o}-img-wrapper ${l.value}`,style:{transform:`translate3d(${b.x}px, ${b.y}px, 0)`}},[a.createVNode("img",{onMousedown:ol,onDblclick:ll,ref:Q,class:`${o}-img ${l.value}`,src:Ie.value,onLoad:()=>at(),onError:N=>Oe(N),style:{transform:`scale3d(${C.x*p.value}, ${C.y*p.value}, 1) rotate(${_.value}deg)`}},null)])])])]),[[a.vShow,s.value&&d.value]])]})])])])]}),s.value&&d.value&&a.createVNode(Mn,{open:s.value&&d.value,hashId:l.value,count:e.previewUrls.length,current:y.value,zIndex:e.zIndex+1,getContainer:e.getContainer,prefixCls:o,icons:Yi(B,pn.map(({type:N})=>N)),tools:pn,infinite:e.infinite,countRender:m.getSlot(r,e,"countRenders"),showSwitch:Ce.value,showProgress:me.value,onClose:R,onActive:N=>N>0?Ne():Ee()},null)]))}}}),nt={width:"100%",height:"100%"},qi=()=>({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",opacity:0}),Ji=e=>({[e.componentCls]:{display:"inline-block",position:"relative",overflow:"hidden","&-inner":{...nt,verticalAlign:"top",opacity:1,[`&${e.componentCls}-inner-preview`]:{userSelect:"none"}},"&-placeholder":{...nt,backgroundColor:e.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},"&-error":{...nt,display:"flex",alignItems:"center",justifyContent:"center",color:e.colorText,backgroundColor:e.colorBgContainerDisabled},"&-preview":qi()}}),ki=e=>e&&e.nodeType===Node.ELEMENT_NODE;let hn="";const el=[...dn,"fallback","placeholder"],ae=a.defineComponent({props:Pe,name:"GImage",emits:["error","click","load"],slots:Object,setup(e,{slots:t,emit:n,attrs:r}){const o=m.getPrefixCls({suffixCls:"image"}),{wrapSSR:i,hashId:l}=A.useProStyle("Image",[Ji],o),s=a.ref(),g=a.ref(""),d=a.ref(!1),S=a.ref(!0),O=a.ref(!1),y=a.ref(null),p=a.ref();let _,I;const C=a.computed(()=>!m.isServer&&e.fit?{"object-fit":e.fit}:{}),b=a.computed(()=>{const{previewUrls:f}=e.preview;return m.isArray(f)&&f.length>0||e.showPreview}),F=a.computed(()=>{const{previewUrls:f=[],current:E=0}=e.preview;if(m.isNumber(E))return f.length>=E?E:0;const R=f.indexOf(e.src);return R>=0?R:0}),he=f=>{g.value=e.src,S.value=!1,d.value=!1,n("load",f)},Q=f=>{S.value=!1,d.value=!0,n("error",f)},P=()=>{if(m.isServer)return;S.value=!0,d.value=!1;const f=new Image;f.onload=E=>he(E),f.onerror=Q,Object.keys(r||{}).forEach(E=>{if(E.toLowerCase()==="onload")return;const R=(r||{})[E];f.setAttribute(E,R)}),f.src=e.src},q=Me.useThrottleFn(Ie,200),ie=()=>{m.isServer||!p.value||!q||(_(),p.value=void 0)};function Ie(){m.isInContainer(y.value,p.value)&&(P(),ie())}const le=async()=>{if(m.isServer)return;await a.nextTick();const{scrollContainer:f}=e;ki(f)?p.value=f:m.isString(f)&&f!==""?p.value=document.querySelector(f)??void 0:y.value&&(p.value=m.getScrollContainer(y.value)),p.value&&(_=Me.useEventListener(p,"scroll",q),setTimeout(()=>Ie(),200))},pe=f=>{if(f.ctrlKey){if(f.deltaY<0)return f.preventDefault(),!1;if(f.deltaY>0)return f.preventDefault(),!1}},U=()=>{b.value&&(I=Me.useEventListener("wheel",pe,{passive:!1}),hn=document.body.style.overflow,document.body.style.overflow="hidden",O.value=!0)},Ce=()=>{I==null||I(),document.body.style.overflow=hn,O.value=!1};a.watch(()=>e.src,()=>{e.lazy?(S.value=!0,d.value=!1,ie(),le()):P()}),a.watchEffect(()=>{var f,E;b.value&&O.value?(f=s.value)==null||f.setOpen(!0):(E=s.value)==null||E.setOpen(!1)});const me=f=>m.isNumber(f)?f+"px":f;return $e.onMountedOrActivated(()=>{e.lazy?le():P()}),()=>{var ve;const{crossorigin:f,decoding:E,alt:R,sizes:rt,srcset:ot,usemap:at,class:Oe,style:Ee={}}=r,Ne={crossorigin:f,decoding:E,alt:R,sizes:rt,srcset:ot,usemap:at,style:{...C.value,height:e.height?me(e.height):void 0}},ce=m.getSlotsProps(el,t,e,{render:!0});return i(a.createVNode("div",{class:{[`${l.value}`]:!0,[`${o}`]:!0,[`${Oe}`]:!!Oe},ref:it=>y.value=it,style:{width:e.width?me(e.width):void 0,height:e.height?me(e.height):void 0,display:e.lazy?"block":void 0,...Ee},onClick:()=>{n("click")}},[S.value?ce.placeholder||a.createVNode("div",{class:`${o}-placeholder ${l.value}`},null):d.value?ce.fallback||a.createVNode("div",{class:`${o}-error ${l.value}`},[a.createTextVNode("加载失败")]):g.value&&a.createVNode("img",a.mergeProps(Ne,{class:{[`${l.value}`]:!0,[`${e.imageClassName}`]:!!e.imageClassName,[`${o}-inner`]:!0,[`${o}-inner-preview`]:b.value},alt:e.alt,src:g.value}),null),b.value&&a.createVNode("div",{class:`${o}-preview ${l.value}`,onClick:()=>U()},null),b.value&&a.createVNode(gn,a.mergeProps({ref:s},e.preview,Qi(ce,dn),{previewUrls:((ve=e.preview)==null?void 0:ve.previewUrls)||[e.src],current:F.value,onClose:()=>Ce()}),null)]))}}});ae.isGImage=!0,ae.install=e=>(e.component(ae.name,ae),e),h.GImage=ae,h.ImagePreview=gn,h.baseProps=k,h.default=ae,h.imagePorps=Pe,h.imagePreviewProps=V,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(v,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@ant-design/icons-vue"),require("@gx-design-vue/pro-utils"),require("@gx-design-vue/pro-hooks"),require("@gx-design-vue/pro-provider"),require("@ctrl/tinycolor"),require("lodash-es"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@ant-design/icons-vue","@gx-design-vue/pro-utils","@gx-design-vue/pro-hooks","@gx-design-vue/pro-provider","@ctrl/tinycolor","lodash-es","@vueuse/core"],t):(v=typeof globalThis<"u"?globalThis:v||self,t(v.GImage={},v.vue,v.iconsVue,v.proUtils,v.proHooks,v.proProvider,v.tinycolor,v.lodashEs,v.core))})(this,function(v,t,L,u,oe,y,F,we,ie){"use strict";const V={infinite:{type:Boolean,default:!0},zIndex:{type:Number,default:2e3},current:{type:Number,default:0},getContainer:{type:String}},ae={preview:{type:Object,default:()=>({current:0,infinite:!0,onHideOnClickModal:!0})},showPreview:{type:Boolean,default:!0},src:{type:String,default:""},alt:{type:String,default:""},fit:{type:String,default:"contain"},lazy:Boolean,scrollContainer:{type:[String,Object]},placeholder:{type:[Function,Object],default:()=>{}},fallback:{type:[Function,Object],default:()=>{}},onLoad:{type:Function},onError:{type:Function},onClick:{type:Function},imageClassName:String,imageStyle:Object,width:Number,height:Number,zIndex:V.zIndex,getContainer:V.getContainer},$={previewUrls:{type:Array,default:()=>[]},disabled:Boolean,zIndex:V.zIndex,current:V.current,infinite:V.infinite,getContainer:ae.getContainer,onHideOnClickModal:Boolean,countRender:[Function,Array,Object],icons:{type:Object,default:()=>({})}};function Le(e,n){process.env.NODE_ENV!=="production"&&!e&&console!==void 0&&console.error(`Warning: ${n}`)}const Te=new y.Keyframe("viewFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),be=new y.Keyframe("viewFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),Pe=new y.Keyframe("viewZoomBadgeIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),Re=new y.Keyframe("viewZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),ve=e=>({position:e||"absolute",inset:0});function re(e){return{position:e,top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0}}const $e=e=>{const{previewCls:n,modalMaskBg:a,paddingSM:l,marginXL:i,margin:g,paddingLG:c,previewOperationColorDisabled:f,previewOperationHoverColor:p,motionDurationSlow:h,iconCls:I,colorTextLightSolid:M}=e,m=new F.TinyColor(a).setAlpha(.1),d=m.clone().setAlpha(.2);return{[`${n}-footer`]:{position:"fixed",bottom:i,left:{_skip_check_:!0,value:"50%"},display:"flex",flexDirection:"column",alignItems:"center",color:e.previewOperationColor,transform:"translateX(-50%)"},[`${n}-progress`]:{marginBottom:g},[`${n}-close`]:{position:"fixed",top:i,right:{_skip_check_:!0,value:i},display:"flex",color:M,backgroundColor:m.toRgbString(),borderRadius:"50%",padding:l,outline:0,border:0,cursor:"pointer",transition:`all ${h}`,"&:hover":{backgroundColor:d.toRgbString()},[`& > ${I}`]:{fontSize:e.previewOperationSize}},[`${n}-operations`]:{display:"flex",alignItems:"center",padding:`0 ${y.unit(c)}`,backgroundColor:m.toRgbString(),borderRadius:100,"&-operation":{marginInlineStart:l,padding:l,cursor:"pointer",transition:`all ${h}`,userSelect:"none",[`&:not(${n}-operations-operation-disabled):hover > ${I}`]:{color:p},"&-disabled":{color:f,cursor:"not-allowed"},"&:first-of-type":{marginInlineStart:0},[`& > ${I}`]:{fontSize:e.previewOperationSize}}}}},De=e=>{const{modalMaskBg:n,iconCls:a,previewOperationColorDisabled:l,previewCls:i,zIndexPopup:g,motionDurationSlow:c}=e,f=new F.TinyColor(n).setAlpha(.1),p=f.clone().setAlpha(.2);return{[`${i}-switch-left, ${i}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:e.calc(g).add(1).equal(),display:"flex",alignItems:"center",justifyContent:"center",width:e.imagePreviewSwitchSize,height:e.imagePreviewSwitchSize,marginTop:e.calc(e.imagePreviewSwitchSize).mul(-1).div(2).equal(),color:e.previewOperationColor,background:f.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${c}`,userSelect:"none","&:hover":{background:p.toRgbString()},"&-disabled":{"&, &:hover":{color:l,background:"transparent",cursor:"not-allowed",[`> ${a}`]:{cursor:"not-allowed"}}},[`> ${a}`]:{fontSize:e.previewOperationSize}},[`${i}-switch-left`]:{insetInlineStart:e.marginSM},[`${i}-switch-right`]:{insetInlineEnd:e.marginSM}}},ze=e=>({[e.componentCls]:{height:"100%",textAlign:"center",pointerEvents:"none","&-root":{...re("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},"&-wrap":{...re("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},"&-mask":{...re("fixed"),zIndex:e.zIndexPopupBase,height:"100%",backgroundColor:e.colorBgMask},"&-body":{...ve(),overflow:"hidden"},"&-img":{maxWidth:"100%",maxHeight:"100%",verticalAlign:"middle",transform:"scale3d(1, 1, 1)",cursor:"grab",transition:`transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,userSelect:"none",pointerEvents:"auto","&-wrapper":{...ve(),display:"flex",justifyContent:"center",alignItems:"center",transition:`transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,"&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}}},"&-fade-appear, &-fade-enter":{animationName:Te,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},"&-fade-leave":{animationName:be,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},"&-zoom-appear, &-zoom-enter":{animationName:Pe,opacity:0,animationTimingFunction:e.motionEaseOutCirc,animationFillMode:"both",transform:"none",animationDuration:e.motionDurationSlow,userSelect:"none"},"&-zoom-enter-active":{animationPlayState:"running"},"&-zoom-leave":{animationName:Re,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"}},[`${e.componentCls}-root`]:{[`${e.componentCls}-wrapper`]:{zIndex:e.zIndexPopup}},[`${e.componentCls}-operations-wrapper`]:{position:"fixed",insetBlockStart:0,insetInlineEnd:0,zIndex:e.zIndexPopup+1,width:"100%"},"&":[$e(e),De(e)]});function _e(e){return y.useStyle("ImageViewer",n=>{const a=y.mergeToken(n,{zIndexPopup:n.zIndexPopupBase+80,previewOperationColorDisabled:new F.TinyColor(n.colorTextLightSolid).setAlpha(.25).toRgbString(),previewOperationHoverColor:new F.TinyColor(n.colorTextLightSolid).setAlpha(.85).toRgbString(),modalMaskBg:new F.TinyColor("#000").setAlpha(.45).toRgbString(),previewOperationColor:new F.TinyColor(n.colorTextLightSolid).toRgbString(),previewOperationSize:n.fontSizeIcon*1.5,imagePreviewSwitchSize:n.controlHeightLG,iconCls:"anticon",previewCls:n.componentCls});return[ze(a)]},e)}function Fe(e){const n=e.getBoundingClientRect(),a=document.documentElement;return{left:n.left+(window.scrollX||a.scrollLeft)-(a.clientLeft||document.body.clientLeft||0),top:n.top+(window.scrollY||a.scrollTop)-(a.clientTop||document.body.clientTop||0)}}function Ve(){const e=document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight;return{width:e,height:n}}function he(e,n,a,l){const i=n+a,g=(a-l)/2;if(a>l){if(n>0)return{[e]:g};if(n<0&&i<l)return{[e]:-g}}else if(n<0||i>l)return{[e]:n<0?g:-g};return{}}function Ue(e,n,a,l){const{width:i,height:g}=Ve();let c=null;return e<=i&&n<=g?c={x:0,y:0}:(e>i||n>g)&&(c={...he("x",a,e,i),...he("y",l,n,g)}),c}let Se=!1;try{const e=Object.defineProperty({},"passive",{get(){Se=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch{}function U(e,n,a,l){if(e&&e.addEventListener){let i=l;i===void 0&&Se&&(n==="touchstart"||n==="touchmove"||n==="wheel")&&(i={passive:!1}),e.addEventListener(n,a,i)}return{remove:()=>{e&&e.removeEventListener&&e.removeEventListener(n,a)}}}const r={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(n){const{keyCode:a}=n;if(n.altKey&&!n.ctrlKey||n.metaKey||a>=r.F1&&a<=r.F12)return!1;switch(a){case r.ALT:case r.CAPS_LOCK:case r.CONTEXT_MENU:case r.CTRL:case r.DOWN:case r.END:case r.ESC:case r.HOME:case r.INSERT:case r.LEFT:case r.MAC_FF_META:case r.META:case r.NUMLOCK:case r.NUM_CENTER:case r.PAGE_DOWN:case r.PAGE_UP:case r.PAUSE:case r.PRINT_SCREEN:case r.RIGHT:case r.SHIFT:case r.UP:case r.WIN_KEY:case r.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(n){if(n>=r.ZERO&&n<=r.NINE||n>=r.NUM_ZERO&&n<=r.NUM_MULTIPLY||n>=r.A&&n<=r.Z||window.navigator.userAgent.includes("WebKit")&&n===0)return!0;switch(n){case r.SPACE:case r.QUESTION_MARK:case r.NUM_PLUS:case r.NUM_MINUS:case r.NUM_PERIOD:case r.NUM_DIVISION:case r.SEMICOLON:case r.DASH:case r.EQUALS:case r.COMMA:case r.PERIOD:case r.SLASH:case r.APOSTROPHE:case r.SINGLE_QUOTE:case r.OPEN_SQUARE_BRACKET:case r.BACKSLASH:case r.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};let Ne=e=>setTimeout(e,16),Ie=e=>clearTimeout(e);typeof window<"u"&&"requestAnimationFrame"in window&&(Ne=e=>window.requestAnimationFrame(e),Ie=e=>window.cancelAnimationFrame(e));let Ce=0;const le=new Map;function Ee(e){le.delete(e)}function se(e,n=1){Ce+=1;const a=Ce;function l(i){if(i===0)Ee(a),e();else{const g=Ne(()=>{l(i-1)});le.set(a,g)}}return l(n),a}se.cancel=e=>{const n=le.get(e);return Ee(n),Ie(n)};function je(e){const n=t.ref(null),a=t.reactive({...e}),l=t.ref([]),i=g=>{n.value===null&&(l.value=[],n.value=se(()=>{let c;l.value.forEach(f=>{c={...c,...f}}),Object.assign(a,c),n.value=null})),l.value.push(g)};return t.onMounted(()=>{n.value&&se.cancel(n.value)}),[a,i]}const Be=t.defineComponent({name:"Operations",inheritAttrs:!1,props:{open:Boolean,count:{type:Number,default:0},current:{type:Number,default:0},showSwitch:Boolean,showProgress:Boolean,prefixCls:String,hashId:String,zIndex:$.zIndex,icons:$.icons,infinite:$.infinite,getContainer:$.getContainer,countRender:$.countRender,tools:Array,onClose:Function,onActive:Function},setup(e){const n=(a,l)=>{var i;a.preventDefault(),a.stopPropagation(),(i=e.onActive)==null||i.call(e,l)};return()=>{const{prefixCls:a,hashId:l,tools:i}=e,g=y.getTransitionProps(`${e.prefixCls}-fade`),c=`${a}-operations-operation`,f=`${a}-operations-icon`;return t.createVNode(t.Teleport,{to:e.getContainer||"body"},{default:()=>[t.createVNode(t.Transition,g,{default:()=>{var p,h,I,M;return[t.withDirectives(t.createVNode("div",{class:u.classNames(`${a}-operations-wrapper`,l),style:{zIndex:e.zIndex}},[((p=e.icons)==null?void 0:p.close)===null?null:t.createVNode("button",{class:`${a}-close ${l}`,onClick:e.onClose},[((h=e.icons)==null?void 0:h.close)||t.createVNode(L.CloseOutlined,null,null)]),e.showSwitch&&t.createVNode(t.Fragment,null,[t.createVNode("div",{class:u.classNames(`${a}-switch-left ${l}`,{[`${a}-switch-left-disabled`]:e.infinite?!1:e.current===0}),onClick:m=>n(m,-1)},[((I=e.icons)==null?void 0:I.left)||t.createVNode(L.LeftOutlined,null,null)]),t.createVNode("div",{className:u.classNames(`${a}-switch-right ${l}`,{[`${a}-switch-right-disabled`]:e.infinite?!1:e.current===e.count-1}),onClick:m=>n(m,1)},[((M=e.icons)==null?void 0:M.right)||t.createVNode(L.RightOutlined,null,null)])]),t.createVNode("div",{class:`${a}-footer ${l}`},[e.showProgress&&t.createVNode("div",{class:`${a}-progress`},[e.countRender?e.countRender(e.current+1,e.count):`${e.current+1} / ${e.count}`]),t.createVNode("div",{class:`${e.prefixCls}-operations`},[i==null?void 0:i.map(({icon:m,onClick:d,type:O,disabled:S})=>t.createVNode("div",{class:u.classNames(c,{[`${e.prefixCls}-operations-operation-disabled`]:S&&(S==null?void 0:S.value)}),onClick:d,key:O},[t.cloneVNode(m,{class:f})]))])])]),[[t.vShow,e.open]])]}})]})}}}),D={x:0,y:0},j={rotateLeft:t.createVNode(L.RotateLeftOutlined,null,null),rotateRight:t.createVNode(L.RotateRightOutlined,null,null),zoomIn:t.createVNode(L.ZoomInOutlined,null,null),zoomOut:t.createVNode(L.ZoomOutOutlined,null,null),flipX:t.createVNode(L.SwapOutlined,null,null),flipY:t.createVNode(L.SwapOutlined,{rotate:90},null)},pe=["close","left","right","rotateRight","rotateRight","zoomOut","flipX","flipY","rotateLeft"],ye=t.defineComponent({name:"GImageViewer",props:$,inheritAttrs:!1,emits:["close","switch","afterClose"],emit:Object,setup:(e,{emit:n,expose:a,slots:l})=>{const i=u.getPrefixCls({suffixCls:"image-view"}),{wrapSSR:g,hashId:c}=_e(i),[f,p]=oe.useState(!1),[h,I]=oe.useState(!1),M=t.ref(null),m=t.ref(e.current),d=t.shallowRef(1),O=t.shallowRef(0),S=t.shallowRef(!1),A=t.reactive({x:1,y:1}),[C,b]=je(D),W=t.shallowRef({wheelDirection:0}),z=t.shallowRef(),x=t.reactive({originX:0,originY:0,deltaX:0,deltaY:0}),_=t.reactive(new Map),H=t.computed(()=>new Map(Array.from(_).map(([o,{url:w}])=>[o,w]))),Q=t.computed(()=>H.value.get(m.value)),K=t.computed(()=>H.value.size),G=t.computed(()=>Array.from(H.value.keys())),P=t.computed(()=>G.value.indexOf(m.value)),k=t.computed(()=>K.value>1),X=t.computed(()=>K.value>=1);t.watch(f,o=>{o&&(h.value=!0)});const s=o=>{m.value=o};t.watch(()=>e.current,o=>{u.isNumber(o)&&s(o)});function N(o,w){_.set(o,{url:w,loading:!0,canPreview:!1})}const T=()=>{I(!1),m.value=e.current},ue=()=>{d.value=1,O.value=0,A.x=1,A.y=1,b(D),n("close")},de=o=>{S.value||M.value===(o==null?void 0:o.target)&&T()},fe=()=>{const o=_.get(m.value);o&&(o.loading=!1,o.canPreview=!0)},q=o=>{const w=_.get(m.value);w&&(w.loading=!1,w.canPreview=!1),o.target.alt="加载失败"},J=()=>{if(P.value>0||e.infinite){const o=P.value-1<0?e.previewUrls.length-1:P.value-1;s(G.value[o])}},ee=()=>{if(P.value<K.value-1||e.infinite){const o=P.value+1>e.previewUrls.length-1?0:P.value+1;s(G.value[o])}},Y=o=>{o?d.value+=.5:d.value++,b(D)},Z=o=>{d.value>1&&(o?d.value-=.5:d.value--),b(D)},ge=()=>{O.value+=90},Ge=()=>{O.value-=90},Xe=()=>{A.x=-A.x},Ze=()=>{A.y=-A.y},Oe=[{icon:u.getSlotVNode(l,e.icons,"zoomIn")||j.zoomIn,onClick:()=>Y(),type:"zoomIn"},{icon:u.getSlotVNode(l,e.icons,"zoomOut")||j.zoomOut,onClick:()=>Z(),type:"zoomOut",disabled:t.computed(()=>d.value===1)},{icon:u.getSlotVNode(l,e.icons,"rotateRight")||j.rotateRight,onClick:ge,type:"rotateRight"},{icon:u.getSlotVNode(l,e.icons,"rotateLeft")||j.rotateLeft,onClick:Ge,type:"rotateLeft"},{icon:u.getSlotVNode(l,e.icons,"flipX")||j.flipX,onClick:Xe,type:"flipX"},{icon:u.getSlotVNode(l,e.icons,"flipY")||j.flipY,onClick:Ze,type:"flipY"}],Ae=()=>{if(f.value&&S.value&&z.value){const o=z.value.offsetWidth*d.value,w=z.value.offsetHeight*d.value,{left:R,top:E}=Fe(z.value),te=O.value%180!==0;S.value=!1;const ne=Ue(te?w:o,te?o:w,R,E);ne&&b({...ne})}},Qe=o=>{o.button===0&&(o.preventDefault(),o.stopPropagation(),x.deltaX=o.pageX-C.x,x.deltaY=o.pageY-C.y,x.originX=C.x,x.originY=C.y,S.value=!0)},xe=o=>{f.value&&S.value&&b({x:o.pageX-x.deltaX,y:o.pageY-x.deltaY})},ke=o=>{if(!f.value)return;o.preventDefault();const w=o.deltaY;W.value={wheelDirection:w}},qe=o=>{!f.value||!k.value||(o.keyCode===r.LEFT?J():o.keyCode===r.RIGHT&&ee())},Je=()=>{f.value&&(d.value!==1&&(d.value=1),(C.x!==D.x||C.y!==D.y)&&b(D))};let me=()=>{};return t.onMounted(()=>{t.watch(()=>e.previewUrls,o=>{u.isArray(o)&&o.forEach((w,R)=>{N(R,w)})},{flush:"post",immediate:!0}),t.watch([()=>f.value,S],()=>{me();let o,w;const R=U(window,"mouseup",Ae,!1),E=U(window,"mousemove",xe,!1),te=U(window,"wheel",ke,{passive:!1}),ne=U(window,"keydown",qe,!1);try{window.top!==window.self&&(o=U(window.top,"mouseup",Ae,!1),w=U(window.top,"mousemove",xe,!1))}catch(et){Le(!1,`[vc-image] ${et}`)}me=()=>{R.remove(),E.remove(),te.remove(),ne.remove(),o&&o.remove(),w&&w.remove()}},{flush:"post",immediate:!0}),t.watch([W],()=>{const{wheelDirection:o}=W.value;o>0?Z(!0):o<0&&Y(!0)})}),t.onUnmounted(()=>{me()}),a({setOpen:p}),()=>{const o=y.getTransitionProps(`${i}-fade`),w=y.getTransitionProps(`${i}-zoom`),R={};for(const E in e.icons)R[E]=u.getSlotVNode(l,e.icons,E);return g(t.createVNode(t.Fragment,null,[t.createVNode(t.Teleport,{to:e.getContainer||"body"},{default:()=>[f.value&&t.createVNode(t.Fragment,null,[t.createVNode("div",{class:`${i}-root ${c.value}`},[t.createVNode(t.Transition,o,{default:()=>[t.withDirectives(t.createVNode("div",{class:`${i}-mask ${c.value}`},null),[[t.vShow,f.value&&h.value]])]}),t.createVNode("div",{ref:M,tabindex:-1,class:[`${i}-wrap`,`${c.value}`],onClick:E=>e.onHideOnClickModal&&de(E)},[t.createVNode(t.Transition,t.mergeProps(w,{onAfterLeave:()=>ue()}),{default:()=>[t.withDirectives(t.createVNode("div",{role:"dialog",class:`${i} ${c.value}`},[t.createVNode("div",{class:`${i}-content ${c.value}`},[t.createVNode("div",{class:`${i}-body ${c.value}`},[t.createVNode("div",{class:`${i}-img-wrapper ${c.value}`,style:{transform:`translate3d(${C.x}px, ${C.y}px, 0)`}},[t.createVNode("img",{onMousedown:Qe,onDblclick:Je,ref:z,class:`${i}-img ${c.value}`,src:Q.value,onLoad:()=>fe(),onError:E=>q(E),style:{transform:`scale3d(${A.x*d.value}, ${A.y*d.value}, 1) rotate(${O.value}deg)`}},null)])])])]),[[t.vShow,f.value&&h.value]])]})])])])]}),f.value&&h.value&&t.createVNode(Be,{open:f.value&&h.value,hashId:c.value,count:e.previewUrls.length,current:m.value,zIndex:e.zIndex+1,getContainer:e.getContainer,prefixCls:i,icons:we.omit(R,Oe.map(({type:E})=>E)),tools:Oe,infinite:e.infinite,countRender:u.getSlot(l,e,"countRenders"),showSwitch:k.value,showProgress:X.value,onClose:T,onActive:E=>E>0?ee():J()},null)]))}}}),ce={width:"100%",height:"100%"},He=()=>({position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",opacity:0}),Ke=e=>({[e.componentCls]:{display:"inline-block",position:"relative",overflow:"hidden","&-inner":{...ce,verticalAlign:"top",opacity:1,[`&${e.componentCls}-inner-preview`]:{userSelect:"none"}},"&-placeholder":{...ce,backgroundColor:e.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},"&-error":{...ce,display:"flex",alignItems:"center",justifyContent:"center",color:e.colorText,backgroundColor:e.colorBgContainerDisabled},"&-preview":He()}}),Ye=e=>e&&e.nodeType===Node.ELEMENT_NODE;let Me="";const We=[...pe,"fallback","placeholder"],B=t.defineComponent({props:ae,name:"GImage",emits:["error","click","load"],slots:Object,setup(e,{slots:n,emit:a,attrs:l}){const i=u.getPrefixCls({suffixCls:"image"}),{wrapSSR:g,hashId:c}=y.useProStyle("Image",[Ke],i),f=t.ref(),p=t.ref(""),h=t.ref(!1),I=t.ref(!0),M=t.ref(!1),m=t.ref(null),d=t.ref();let O,S;const A=t.computed(()=>!u.isServer&&e.fit?{"object-fit":e.fit}:{}),C=t.computed(()=>{const{previewUrls:s}=e.preview;return u.isArray(s)&&s.length>0||e.showPreview}),b=t.computed(()=>{const{previewUrls:s=[],current:N=0}=e.preview;if(u.isNumber(N))return s.length>=N?N:0;const T=s.indexOf(e.src);return T>=0?T:0}),W=s=>{p.value=e.src,I.value=!1,h.value=!1,a("load",s)},z=s=>{I.value=!1,h.value=!0,a("error",s)},x=()=>{if(u.isServer)return;I.value=!0,h.value=!1;const s=new Image;s.onload=N=>W(N),s.onerror=z,Object.keys(l||{}).forEach(N=>{if(N.toLowerCase()==="onload")return;const T=(l||{})[N];s.setAttribute(N,T)}),s.src=e.src},_=ie.useThrottleFn(Q,200),H=()=>{u.isServer||!d.value||!_||(O(),d.value=void 0)};function Q(){u.isInContainer(m.value,d.value)&&(x(),H())}const K=async()=>{if(u.isServer)return;await t.nextTick();const{scrollContainer:s}=e;Ye(s)?d.value=s:u.isString(s)&&s!==""?d.value=document.querySelector(s)??void 0:m.value&&(d.value=u.getScrollContainer(m.value)),d.value&&(O=ie.useEventListener(d,"scroll",_),setTimeout(()=>Q(),200))},G=s=>{if(s.ctrlKey){if(s.deltaY<0)return s.preventDefault(),!1;if(s.deltaY>0)return s.preventDefault(),!1}},P=()=>{C.value&&(S=ie.useEventListener("wheel",G,{passive:!1}),Me=document.body.style.overflow,document.body.style.overflow="hidden",M.value=!0)},k=()=>{S==null||S(),document.body.style.overflow=Me,M.value=!1};t.watch(()=>e.src,()=>{e.lazy?(I.value=!0,h.value=!1,H(),K()):x()}),t.watchEffect(()=>{var s,N;C.value&&M.value?(s=f.value)==null||s.setOpen(!0):(N=f.value)==null||N.setOpen(!1)});const X=s=>u.isNumber(s)?s+"px":s;return oe.onMountedOrActivated(()=>{e.lazy?K():x()}),()=>{var Z;const{crossorigin:s,decoding:N,alt:T,sizes:ue,srcset:de,usemap:fe,class:q,style:J={}}=l,ee={crossorigin:s,decoding:N,alt:T,sizes:ue,srcset:de,usemap:fe,style:{...A.value,height:e.height?X(e.height):void 0}},Y=u.getSlotsProps(We,n,e,{render:!0});return g(t.createVNode("div",{class:{[`${c.value}`]:!0,[`${i}`]:!0,[`${q}`]:!!q},ref:ge=>m.value=ge,style:{width:e.width?X(e.width):void 0,height:e.height?X(e.height):void 0,display:e.lazy?"block":void 0,...J},onClick:()=>{a("click")}},[I.value?Y.placeholder||t.createVNode("div",{class:`${i}-placeholder ${c.value}`},null):h.value?Y.fallback||t.createVNode("div",{class:`${i}-error ${c.value}`},[t.createTextVNode("加载失败")]):p.value&&t.createVNode("img",t.mergeProps(ee,{class:{[`${c.value}`]:!0,[`${e.imageClassName}`]:!!e.imageClassName,[`${i}-inner`]:!0,[`${i}-inner-preview`]:C.value},alt:e.alt,src:p.value}),null),C.value&&t.createVNode("div",{class:`${i}-preview ${c.value}`,onClick:()=>P()},null),C.value&&t.createVNode(ye,t.mergeProps({ref:f},e.preview,we.pick(Y,pe),{previewUrls:((Z=e.preview)==null?void 0:Z.previewUrls)||[e.src],current:b.value,onClose:()=>k()}),null)]))}}});B.isGImage=!0,B.install=e=>(e.component(B.name,B),e),v.GImage=B,v.ImagePreview=ye,v.baseProps=V,v.default=B,v.imagePorps=ae,v.imagePreviewProps=$,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|