@gx-design-vue/image 0.2.0-beta.8 → 0.2.0-beta.9
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.d.ts +0 -11
- package/dist/image.mjs +6 -9
- package/dist/image.umd.js +1 -1
- package/dist/props.d.ts +2 -7
- package/package.json +1 -1
package/dist/Image.d.ts
CHANGED
|
@@ -10,11 +10,6 @@ declare const GImage: import("vue").DefineComponent<{
|
|
|
10
10
|
type: import("vue").PropType<boolean>;
|
|
11
11
|
default: boolean;
|
|
12
12
|
};
|
|
13
|
-
wrapperClassName: StringConstructor;
|
|
14
|
-
wrapperStyle: {
|
|
15
|
-
type: import("vue").PropType<CSSProperties>;
|
|
16
|
-
default: undefined;
|
|
17
|
-
};
|
|
18
13
|
src: {
|
|
19
14
|
type: import("vue").PropType<string>;
|
|
20
15
|
default: string;
|
|
@@ -91,11 +86,6 @@ declare const GImage: import("vue").DefineComponent<{
|
|
|
91
86
|
type: import("vue").PropType<boolean>;
|
|
92
87
|
default: boolean;
|
|
93
88
|
};
|
|
94
|
-
wrapperClassName: StringConstructor;
|
|
95
|
-
wrapperStyle: {
|
|
96
|
-
type: import("vue").PropType<CSSProperties>;
|
|
97
|
-
default: undefined;
|
|
98
|
-
};
|
|
99
89
|
src: {
|
|
100
90
|
type: import("vue").PropType<string>;
|
|
101
91
|
default: string;
|
|
@@ -175,7 +165,6 @@ declare const GImage: import("vue").DefineComponent<{
|
|
|
175
165
|
initialIndex: number;
|
|
176
166
|
previewTeleported: boolean;
|
|
177
167
|
hideOnClickModal: boolean;
|
|
178
|
-
wrapperStyle: CSSProperties;
|
|
179
168
|
src: string;
|
|
180
169
|
alt: string;
|
|
181
170
|
fit: "contain" | "fill" | "none" | "cover" | "scale-down";
|
package/dist/image.mjs
CHANGED
|
@@ -809,8 +809,6 @@ const B = Xe, P = {
|
|
|
809
809
|
type: Boolean,
|
|
810
810
|
default: !0
|
|
811
811
|
},
|
|
812
|
-
wrapperClassName: String,
|
|
813
|
-
wrapperStyle: { type: Object, default: void 0 },
|
|
814
812
|
src: {
|
|
815
813
|
type: String,
|
|
816
814
|
default: ""
|
|
@@ -1291,7 +1289,7 @@ const ce = /* @__PURE__ */ Ve({
|
|
|
1291
1289
|
srcset: j,
|
|
1292
1290
|
usemap: ne,
|
|
1293
1291
|
class: Z,
|
|
1294
|
-
style: A
|
|
1292
|
+
style: A = {}
|
|
1295
1293
|
} = a, pe = {
|
|
1296
1294
|
crossorigin: f,
|
|
1297
1295
|
decoding: E,
|
|
@@ -1301,8 +1299,7 @@ const ce = /* @__PURE__ */ Ve({
|
|
|
1301
1299
|
usemap: ne,
|
|
1302
1300
|
style: {
|
|
1303
1301
|
...Y.value,
|
|
1304
|
-
height: e.height ? U(e.height) : void 0
|
|
1305
|
-
...A
|
|
1302
|
+
height: e.height ? U(e.height) : void 0
|
|
1306
1303
|
}
|
|
1307
1304
|
}, ae = Le(t, e, "fallback"), ie = Le(t, e, "placeholder");
|
|
1308
1305
|
return Qe(() => {
|
|
@@ -1312,11 +1309,11 @@ const ce = /* @__PURE__ */ Ve({
|
|
|
1312
1309
|
class: {
|
|
1313
1310
|
[`${o.value}`]: !0,
|
|
1314
1311
|
[`${i}`]: !0,
|
|
1315
|
-
[`${
|
|
1312
|
+
[`${Z}`]: !!Z
|
|
1316
1313
|
},
|
|
1317
1314
|
ref: (D) => T.value = D,
|
|
1318
1315
|
style: {
|
|
1319
|
-
...
|
|
1316
|
+
...A,
|
|
1320
1317
|
width: e.width ? U(e.width) : void 0,
|
|
1321
1318
|
height: e.height ? U(e.height) : void 0,
|
|
1322
1319
|
display: e.lazy ? "block" : void 0
|
|
@@ -1331,9 +1328,9 @@ const ce = /* @__PURE__ */ Ve({
|
|
|
1331
1328
|
}, [Ke("加载失败")]) : c.value && u("img", We(pe, {
|
|
1332
1329
|
class: {
|
|
1333
1330
|
[`${o.value}`]: !0,
|
|
1331
|
+
[`${e.imageClassName}`]: !!e.imageClassName,
|
|
1334
1332
|
[`${i}-inner`]: !0,
|
|
1335
|
-
[`${i}-preview`]: F.value
|
|
1336
|
-
[`${Z}`]: !!Z
|
|
1333
|
+
[`${i}-preview`]: F.value
|
|
1337
1334
|
},
|
|
1338
1335
|
alt: e.alt,
|
|
1339
1336
|
src: c.value,
|
package/dist/image.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(v,r){typeof exports=="object"&&typeof module<"u"?r(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("vue-types"),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","vue-types","@vueuse/core"],r):(v=typeof globalThis<"u"?globalThis:v||self,r(v.GImage={},v.vue,v.iconsVue,v.proUtils,v.proHooks,v.proProvider,v.vueTypes,v.core))})(this,function(v,r,T,m,ee,k,Fe,de){"use strict";function h(e,t){Pe(e)&&(e="100%");var n=je(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function te(e){return Math.min(1,Math.max(0,e))}function Pe(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function je(e){return typeof e=="string"&&e.indexOf("%")!==-1}function Ce(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function ne(e){return e<=1?"".concat(Number(e)*100,"%"):e}function R(e){return e.length===1?"0"+e:String(e)}function Ve(e,t,n){return{r:h(e,255)*255,g:h(t,255)*255,b:h(n,255)*255}}function Te(e,t,n){e=h(e,255),t=h(t,255),n=h(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),o=0,s=0,c=(a+i)/2;if(a===i)s=0,o=0;else{var u=a-i;switch(s=c>.5?u/(2-a-i):u/(a+i),a){case e:o=(t-n)/u+(t<n?6:0);break;case t:o=(n-e)/u+2;break;case n:o=(e-t)/u+4;break}o/=6}return{h:o,s,l:c}}function he(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Be(e,t,n){var a,i,o;if(e=h(e,360),t=h(t,100),n=h(n,100),t===0)i=n,o=n,a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;a=he(c,s,e+1/3),i=he(c,s,e),o=he(c,s,e-1/3)}return{r:a*255,g:i*255,b:o*255}}function ke(e,t,n){e=h(e,255),t=h(t,255),n=h(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),o=0,s=a,c=a-i,u=a===0?0:c/a;if(a===i)o=0;else{switch(a){case e:o=(t-n)/c+(t<n?6:0);break;case t:o=(n-e)/c+2;break;case n:o=(e-t)/c+4;break}o/=6}return{h:o,s:u,v:s}}function Ye(e,t,n){e=h(e,360)*6,t=h(t,100),n=h(n,100);var a=Math.floor(e),i=e-a,o=n*(1-t),s=n*(1-i*t),c=n*(1-(1-i)*t),u=a%6,x=[n,s,o,o,c,n][u],y=[c,n,n,s,o,o][u],H=[o,o,c,n,n,s][u];return{r:x*255,g:y*255,b:H*255}}function Oe(e,t,n,a){var i=[R(Math.round(e).toString(16)),R(Math.round(t).toString(16)),R(Math.round(n).toString(16))];return a&&i[0].startsWith(i[0].charAt(1))&&i[1].startsWith(i[1].charAt(1))&&i[2].startsWith(i[2].charAt(1))?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function We(e,t,n,a,i){var o=[R(Math.round(e).toString(16)),R(Math.round(t).toString(16)),R(Math.round(n).toString(16)),R(Ge(a))];return i&&o[0].startsWith(o[0].charAt(1))&&o[1].startsWith(o[1].charAt(1))&&o[2].startsWith(o[2].charAt(1))&&o[3].startsWith(o[3].charAt(1))?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function Ge(e){return Math.round(parseFloat(e)*255).toString(16)}function ze(e){return b(e)/255}function b(e){return parseInt(e,16)}function qe(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var ge={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function _e(e){var t={r:0,g:0,b:0},n=1,a=null,i=null,o=null,s=!1,c=!1;return typeof e=="string"&&(e=Qe(e)),typeof e=="object"&&(O(e.r)&&O(e.g)&&O(e.b)?(t=Ve(e.r,e.g,e.b),s=!0,c=String(e.r).substr(-1)==="%"?"prgb":"rgb"):O(e.h)&&O(e.s)&&O(e.v)?(a=ne(e.s),i=ne(e.v),t=Ye(e.h,a,i),s=!0,c="hsv"):O(e.h)&&O(e.s)&&O(e.l)&&(a=ne(e.s),o=ne(e.l),t=Be(e.h,a,o),s=!0,c="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=Ce(n),{ok:s,format:e.format||c,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var Ze="[-\\+]?\\d+%?",Xe="[-\\+]?\\d*\\.\\d+%?",E="(?:".concat(Xe,")|(?:").concat(Ze,")"),ve="[\\s|\\(]+(".concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")\\s*\\)?"),pe="[\\s|\\(]+(".concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")\\s*\\)?"),A={CSS_UNIT:new RegExp(E),rgb:new RegExp("rgb"+ve),rgba:new RegExp("rgba"+pe),hsl:new RegExp("hsl"+ve),hsla:new RegExp("hsla"+pe),hsv:new RegExp("hsv"+ve),hsva:new RegExp("hsva"+pe),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function Qe(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(ge[e])e=ge[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n=A.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=A.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=A.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=A.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=A.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=A.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=A.hex8.exec(e),n?{r:b(n[1]),g:b(n[2]),b:b(n[3]),a:ze(n[4]),format:t?"name":"hex8"}:(n=A.hex6.exec(e),n?{r:b(n[1]),g:b(n[2]),b:b(n[3]),format:t?"name":"hex"}:(n=A.hex4.exec(e),n?{r:b(n[1]+n[1]),g:b(n[2]+n[2]),b:b(n[3]+n[3]),a:ze(n[4]+n[4]),format:t?"name":"hex8"}:(n=A.hex3.exec(e),n?{r:b(n[1]+n[1]),g:b(n[2]+n[2]),b:b(n[3]+n[3]),format:t?"name":"hex"}:!1)))))))))}function O(e){return!!A.CSS_UNIT.exec(String(e))}var q=function(){function e(t,n){t===void 0&&(t=""),n===void 0&&(n={});var a;if(t instanceof e)return t;typeof t=="number"&&(t=qe(t)),this.originalInput=t;var i=_e(t);this.originalInput=t,this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this.roundA=Math.round(100*this.a)/100,this.format=(a=n.format)!==null&&a!==void 0?a:i.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=i.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),n,a,i,o=t.r/255,s=t.g/255,c=t.b/255;return o<=.03928?n=o/12.92:n=Math.pow((o+.055)/1.055,2.4),s<=.03928?a=s/12.92:a=Math.pow((s+.055)/1.055,2.4),c<=.03928?i=c/12.92:i=Math.pow((c+.055)/1.055,2.4),.2126*n+.7152*a+.0722*i},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=Ce(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=ke(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=ke(this.r,this.g,this.b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.v*100);return this.a===1?"hsv(".concat(n,", ").concat(a,"%, ").concat(i,"%)"):"hsva(".concat(n,", ").concat(a,"%, ").concat(i,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=Te(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=Te(this.r,this.g,this.b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.l*100);return this.a===1?"hsl(".concat(n,", ").concat(a,"%, ").concat(i,"%)"):"hsla(".concat(n,", ").concat(a,"%, ").concat(i,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=!1),Oe(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=!1),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=!1),We(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=!1),"#"+this.toHex8(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),n=Math.round(this.g),a=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(n,", ").concat(a,")"):"rgba(".concat(t,", ").concat(n,", ").concat(a,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(n){return"".concat(Math.round(h(n,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(n){return Math.round(h(n,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var t="#"+Oe(this.r,this.g,this.b,!1),n=0,a=Object.entries(ge);n<a.length;n++){var i=a[n],o=i[0],s=i[1];if(t===s)return o}return!1},e.prototype.toString=function(t){var n=!!t;t=t??this.format;var a=!1,i=this.a<1&&this.a>=0,o=!n&&i&&(t.startsWith("hex")||t==="name");return o?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(a=this.toRgbString()),t==="prgb"&&(a=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(a=this.toHexString()),t==="hex3"&&(a=this.toHexString(!0)),t==="hex4"&&(a=this.toHex8String(!0)),t==="hex8"&&(a=this.toHex8String()),t==="name"&&(a=this.toName()),t==="hsl"&&(a=this.toHslString()),t==="hsv"&&(a=this.toHsvString()),a||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=te(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=te(n.l),new e(n)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=te(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=te(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),a=(n.h+t)%360;return n.h=a<0?360+a:a,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var a=this.toRgb(),i=new e(t).toRgb(),o=n/100,s={r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a};return new e(s)},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var a=this.toHsl(),i=360/n,o=[this];for(a.h=(a.h-(i*t>>1)+720)%360;--t;)a.h=(a.h+i)%360,o.push(new e(a));return o},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),a=n.h,i=n.s,o=n.v,s=[],c=1/t;t--;)s.push(new e({h:a,s:i,v:o})),o=(o+c)%1;return s},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),a=new e(t).toRgb();return new e({r:a.r+(n.r-a.r)*n.a,g:a.g+(n.g-a.g)*n.a,b:a.b+(n.b-a.b)*n.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),a=n.h,i=[this],o=360/t,s=1;s<t;s++)i.push(new e({h:(a+s*o)%360,s:n.s,l:n.l}));return i},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();const Ke=new k.Keyframe("viewFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),Je=new k.Keyframe("viewFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),Ue=new k.Keyframe("viewZoomBadgeIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),et=new k.Keyframe("viewZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),Le=e=>({position:e||"absolute",inset:0});function me(e){return{position:e,top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0}}const tt=e=>({boxSizing:"border-box",margin:0,padding:0,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,listStyle:"none",fontFamily:e.fontFamily}),nt=e=>{const{componentCls:t,modalMaskBg:n,paddingSM:a,previewOperationColorDisabled:i,motionDurationSlow:o}=e,s=new q(n).setAlpha(.1),c=s.clone().setAlpha(.2);return{[`${t}-operations`]:{...tt(e),display:"flex",flexDirection:"row-reverse",alignItems:"center",color:e.previewOperationColor,listStyle:"none",background:s.toRgbString(),pointerEvents:"auto","&-operation":{marginInlineStart:a,padding:a,cursor:"pointer",transition:`all ${o}`,userSelect:"none","&:hover":{background:c.toRgbString()},"&-disabled":{color:i,pointerEvents:"none"},"&:last-of-type":{marginInlineStart:0}},"&-progress":{position:"absolute",left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%)"},"&-icon":{fontSize:e.previewOperationSize}}}},at=e=>{const{modalMaskBg:t,previewOperationColorDisabled:n,zIndexPopup:a,motionDurationSlow:i}=e,o=new q(t).setAlpha(.1),s=o.clone().setAlpha(.2);return{[`${e.componentCls}-switch-left, ${e.componentCls}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:a+1,display:"flex",alignItems:"center",justifyContent:"center",width:e.imagePreviewSwitchSize,height:e.imagePreviewSwitchSize,marginTop:-e.imagePreviewSwitchSize/2,color:e.previewOperationColor,background:o.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${i}`,pointerEvents:"auto",userSelect:"none","&:hover":{background:s.toRgbString()},["&-disabled"]:{"&, &:hover":{color:n,background:"transparent",cursor:"not-allowed",[`> ${e.iconCls}`]:{cursor:"not-allowed"}}},[`> ${e.iconCls}`]:{fontSize:e.previewOperationSize}},[`${e.componentCls}-switch-left`]:{insetInlineStart:e.marginSM},[`${e.componentCls}-switch-right`]:{insetInlineEnd:e.marginSM}}},it=e=>({[e.componentCls]:{["&-root"]:{...me("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},["&-wrapper"]:{...me("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},["&-mask"]:{...me("fixed"),zIndex:e.zIndexPopupBase,height:"100%",backgroundColor:e.colorBgMask},["&-block"]:{height:"100%",textAlign:"center",pointerEvents:"none"},["&-body"]:{...Le(),overflow:"hidden"},["&-canvas"]:{...Le(),display:"flex",justifyContent:"center",alignItems:"center","&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}},["&-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"},["&-fade-appear, &-fade-enter"]:{animationName:Ke,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},["&-fade-leave"]:{animationName:Je,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},["&-zoom-appear, &-zoom-enter"]:{animationName:Ue,opacity:0,animationTimingFunction:e.motionEaseOutCirc,animationFillMode:"both",transform:"none",animationDuration:e.motionDurationSlow,userSelect:"none"},["&-zoom-enter-active"]:{animationPlayState:"running"},["&-zoom-leave"]:{animationName:et,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%"},"&":[nt(e),at(e)]});function rt(e){return k.useStyle("ImageView",t=>{const n=k.mergeToken(t,{zIndexPopup:t.zIndexPopupBase+80,previewOperationColorDisabled:new q(t.colorTextLightSolid).setAlpha(.25).toRgbString(),modalMaskBg:new q("#000").setAlpha(.45).toRgbString(),previewOperationColor:new q(t.colorTextLightSolid).toRgbString(),previewOperationSize:t.fontSizeIcon*1.5,imagePreviewSwitchSize:t.controlHeightLG,iconCls:"anticon"});return[it(n)]},e)}const Ee=Fe.createTypes({func:void 0,bool:void 0,string:void 0,number:void 0,array:void 0,object:void 0,integer:void 0});Ee.extend([{name:"looseBool",getter:!0,type:Boolean,default:void 0},{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VueNode",getter:!0,type:null}]);const V=Ee,D={infinite:{type:Boolean,default:!0},zIndex:{type:Number,default:2e3},initialIndex:{type:Number,default:0},getContainer:{type:String}},ae={previewTeleported:{type:Boolean,default:!0},hideOnClickModal:{type:Boolean,default:!0},wrapperClassName:String,wrapperStyle:{type:Object,default:void 0},src:{type:String,default:""},alt:{type:String,default:""},fit:{type:String,default:"contain"},lazy:V.bool,scrollContainer:{type:[String,Object]},placeholder:{type:[Function,Object],default:()=>{}},fallback:{type:[Function,Object],default:()=>{}},onLoad:{type:Function},onError:{type:Function},onClick:{type:Function},disablePreview:V.bool,previewSrcList:{type:Array,default:()=>[]},imageClassName:V.string,imageStyle:V.style,width:V.number,height:V.number,zIndex:D.zIndex,infinite:D.infinite,getContainer:D.getContainer,initialIndex:D.initialIndex},ot={urlList:{type:Array,default:()=>[]},teleported:ae.previewTeleported,zIndex:D.zIndex,initialIndex:D.initialIndex,infinite:D.infinite,getContainer:ae.getContainer,onHideOnClickModal:ae.hideOnClickModal,icons:{type:Object,default:()=>({})}},B={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace"},ie=function(e,t,n,a=!1){e&&t&&n&&e.addEventListener(t,n,a)},be=function(e,t,n,a=!1){e&&t&&n&&e.removeEventListener(t,n,a)},_={CONTAIN:{name:"contain",icon:r.createVNode(T.ExpandOutlined,null,null)},ORIGINAL:{name:"original",icon:r.createVNode(T.OneToOneOutlined,null,null)}},$e=function(){return!m.isServer&&!!window.navigator.userAgent.match(/firefox/i)}()?"DOMMouseScroll":"mousewheel";function ye(e){let t=!1;return function(...n){t||(t=!0,window.requestAnimationFrame(()=>{e.apply(this,n),t=!1}))}}const Re=r.defineComponent({props:ot,emits:["close","switch"],setup:function(e,{emit:t,expose:n}){var ue,fe,j,U,He;let a=null,i=null,o=null;const s=m.getPrefixCls({suffixCls:"image-viewer"}),{wrapSSR:c,hashId:u}=rt(s),x=r.shallowRef(!1),[y,H]=ee.useState(!1),[z,M]=ee.useState(!1),L=r.ref(!0),g=r.ref(e.initialIndex),Z=r.ref(null),W=r.ref(null),X=r.ref(_.CONTAIN),d=r.ref({scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}),Q=r.computed(()=>e.urlList.length>1),re=r.computed(()=>g.value===0),oe=r.computed(()=>g.value===e.urlList.length-1),se=r.computed(()=>e.urlList[g.value]),Se=r.computed(()=>{const{scale:l,deg:w,offsetX:S,offsetY:C,enableTransition:p}=d.value,I={transform:`scale(${l}) rotate(${w}deg)`,transition:p?"transform .3s":"",marginLeft:`${S}px`,marginTop:`${C}px`};return X.value.name===_.CONTAIN.name&&(I.maxWidth=I.maxHeight="100%"),I}),le=()=>{Ie(),t("close"),d.value={scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}},xe=l=>{x.value?x.value=!1:Z.value===(l==null?void 0:l.target)&&(M(!1),g.value=e.initialIndex)},Me=()=>{a=ye(l=>{switch(l.code){case B.esc:M(!1);break;case B.space:G();break;case B.left:ce();break;case B.up:N("zoomIn");break;case B.right:J();break;case B.down:N("zoomOut");break}}),i=ye(l=>{(l.wheelDelta?l.wheelDelta:-l.detail)>0?N("zoomIn",{zoomRate:.015,enableTransition:!1}):N("zoomOut",{zoomRate:.015,enableTransition:!1})}),ie(document,"keydown",a),ie(document,$e,i)},Ie=()=>{be(document,"keydown",a),be(document,$e,i),a=null,i=null},K=()=>{L.value=!1},f=l=>{L.value=!1,l.target.alt="加载失败"},F=r.shallowRef(),$=l=>{if(L.value||l.button!==0)return;l.preventDefault(),l.stopPropagation(),clearTimeout(F.value),x.value=!0;const{offsetX:w,offsetY:S}=d.value,C=l.pageX,p=l.pageY;o=ye(I=>{d.value={...d.value,offsetX:w+I.pageX-C,offsetY:S+I.pageY-p}}),ie(document,"mousemove",o),ie(document,"mouseup",()=>{be(document,"mousemove",o),y.value&&z.value&&(F.value=setTimeout(()=>{x.value=!1}))})},P=()=>{d.value={scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}},G=()=>{if(L.value)return;const l=Object.keys(_),w=Object.values(_),S=X.value.name,p=(w.findIndex(I=>I.name===S)+1)%l.length;X.value=_[l[p]],P()},ce=()=>{if(re.value&&!e.infinite)return;const l=e.urlList.length;g.value=(g.value-1+l)%l},J=()=>{if(oe.value&&!e.infinite)return;const l=e.urlList.length;g.value=(g.value+1)%l},N=(l,w={})=>{if(L.value)return;const{zoomRate:S,rotateDeg:C,enableTransition:p}={zoomRate:.2,rotateDeg:90,enableTransition:!0,...w};switch(l){case"zoomOut":d.value.scale>.2&&(d.value.scale=parseFloat((d.value.scale-S).toFixed(3)));break;case"zoomIn":d.value.scale=parseFloat((d.value.scale+S).toFixed(3));break;case"clocelise":d.value.deg+=C;break;case"anticlocelise":d.value.deg-=C;break}d.value.enableTransition=p},Ae=[{icon:((ue=e.icons)==null?void 0:ue.close)||r.createVNode(T.CloseOutlined,null,null),onClick:l=>{l.stopPropagation(),M(!1)},type:"close"},{icon:((fe=e.icons)==null?void 0:fe.zoomIn)||r.createVNode(T.ZoomInOutlined,null,null),onClick:l=>{l.stopPropagation(),N("zoomIn")},type:"zoomIn"},{icon:((j=e.icons)==null?void 0:j.zoomOut)||r.createVNode(T.ZoomOutOutlined,null,null),onClick:l=>{l.stopPropagation(),N("zoomOut")},type:"zoomOut"},{icon:((U=e.icons)==null?void 0:U.rotateRight)||r.createVNode(T.RotateRightOutlined,null,null),onClick:l=>{l.stopPropagation(),N("anticlocelise")},type:"rotateRight"},{icon:((He=e.icons)==null?void 0:He.rotateLeft)||r.createVNode(T.RotateLeftOutlined,null,null),onClick:l=>{l.stopPropagation(),N("clocelise")},type:"rotateLeft"}];return r.watch(se,()=>{r.nextTick(()=>{W.value.complete||(L.value=!0)})}),r.watch(g,l=>{P(),t("switch",l)}),r.watch(y,l=>{l&&(z.value=l)}),ee.onMountedOrActivated(()=>{var l,w;Me(),(w=(l=Z.value)==null?void 0:l.focus)==null||w.call(l)}),n({setOpen:H}),()=>{const l=k.getTransitionProps(`${s}-fade`),w=k.getTransitionProps(`${s}-zoom`);return c(r.createVNode(r.Teleport,{to:e.getContainer||"body",disabled:!e.teleported},{default:()=>[y.value&&r.createVNode("div",{class:`${s}-root ${u.value}`},[r.createVNode(r.Transition,l,{default:()=>[r.withDirectives(r.createVNode("div",{class:`${s}-mask ${u.value}`},null),[[r.vShow,y.value&&z.value]])]}),r.createVNode("div",{ref:Z,tabindex:-1,class:[`${s}-wrapper`,`${u.value}`],onClick:S=>e.onHideOnClickModal&&xe(S)},[r.createVNode(r.Transition,r.mergeProps(w,{onAfterLeave:()=>le()}),{default:()=>{var S,C;return[r.withDirectives(r.createVNode("div",{class:`${s}-block ${u.value}`},[r.createVNode("div",{class:`${s}-content ${u.value}`},[r.createVNode("div",{class:`${s}-body ${u.value}`},[r.createVNode("div",{class:`${s}-operations-wrapper ${u.value}`,onClick:p=>p.stopPropagation()},[r.createVNode("ul",{class:`${s}-operations ${u.value}`},[Ae.map(({icon:p,onClick:I,type:Ne})=>r.createVNode("li",{class:`${s}-operations-operation ${u.value}`,onClick:I,key:Ne},[r.cloneVNode(p,{class:`${s}-operations-icon ${u.value}`})]))])]),r.createVNode("div",{class:`${s}-canvas ${u.value}`},[e.urlList.map((p,I)=>r.createVNode("img",{ref:W,class:`${s}-img ${u.value}`,style:{...Se.value,display:I===g.value?"block":"none"},key:p,src:p,onLoad:()=>K(),onError:Ne=>f(Ne),onMousedown:$},null))]),Q.value&&r.createVNode("div",{class:[`${s}-switch-left`,g.value===0&&!e.infinite?`${s}-switch-left-disabled`:"",`${u.value}`],onClick:ce},[((S=e.icons)==null?void 0:S.left)||r.createVNode(T.LeftOutlined,null,null)]),Q.value&&r.createVNode("div",{class:[`${s}-switch-right`,g.value===e.urlList.length-1&&!e.infinite?`${s}-switch-right-disabled`:"",`${u.value}`],onClick:J},[((C=e.icons)==null?void 0:C.right)||r.createVNode(T.RightOutlined,null,null)])])])]),[[r.vShow,y.value&&z.value]])]}})])])]}))}}}),we={width:"100%",height:"100%"},st=e=>({[e.componentCls]:{display:"inline-block",position:"relative",overflow:"hidden",["&-inner"]:{...we,verticalAlign:"top",opacity:1},["&-placeholder"]:{...we,backgroundColor:e.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},["&-error"]:{...we,display:"flex",alignItems:"center",justifyContent:"center",color:e.colorText,backgroundColor:e.colorBgContainerDisabled},["&-preview"]:{cursor:"pointer"}}}),lt=e=>e&&e.nodeType===Node.ELEMENT_NODE;let De="";const Y=r.defineComponent({props:ae,name:"GImage",emits:["error","click","load"],setup(e,{slots:t,emit:n,attrs:a}){const i=m.getPrefixCls({suffixCls:"image"}),{wrapSSR:o,hashId:s}=k.useProStyle("Image",[st],i),c=r.ref(),u=r.ref(""),x=r.ref(!1),y=r.ref(!0),H=r.ref(!1),z=r.ref(null),M=r.ref();let L,g;const Z=r.computed(()=>!m.isServer&&e.fit?{"object-fit":e.fit}:{}),W=r.computed(()=>{const{previewSrcList:f}=e;return Array.isArray(f)&&f.length>0}),X=r.computed(()=>{const{src:f,previewSrcList:F,initialIndex:$}=e;if($||$===0)return F.length>=$?$:0;let P=0;const G=F.indexOf(f);return G>=0&&(P=G),P}),d=()=>{m.isServer||(y.value=!0,x.value=!1,e.src?u.value=e.src:le())};function Q(){m.isInContainer(z.value,M.value)&&(d(),se())}const re=de.useThrottleFn(Q,200),oe=async()=>{if(m.isServer)return;await r.nextTick();const{scrollContainer:f}=e;lt(f)?M.value=f:m.isString(f)&&f!==""?M.value=document.querySelector(f)??void 0:z.value&&(M.value=m.getScrollContainer(z.value)),M.value&&(L=de.useEventListener(M,"scroll",re),setTimeout(()=>Q(),200))},se=()=>{m.isServer||!M.value||!re||(L(),M.value=void 0)},Se=f=>{y.value=!1,x.value=!1,n("load",f)},le=f=>{y.value=!1,x.value=!0,n("error",f)},xe=f=>{if(f.ctrlKey){if(f.deltaY<0)return f.preventDefault(),!1;if(f.deltaY>0)return f.preventDefault(),!1}},Me=()=>{!W.value||e.disablePreview||(g=de.useEventListener("wheel",xe,{passive:!1}),De=document.body.style.overflow,document.body.style.overflow="hidden",H.value=!0)},Ie=()=>{g==null||g(),document.body.style.overflow=De,H.value=!1};r.watch(()=>e.src,()=>{e.lazy?(y.value=!0,x.value=!1,se(),oe()):d()});const K=f=>m.isNumber(f)?f+"px":f;return ee.onMountedOrActivated(()=>{e.lazy?oe():d()}),()=>{const{crossorigin:f,decoding:F,alt:$,sizes:P,srcset:G,usemap:ce,class:J,style:N}=a,Ae={crossorigin:f,decoding:F,alt:$,sizes:P,srcset:G,usemap:ce,style:{...Z.value,height:e.height?K(e.height):void 0,...N}},ue=m.getSlotVNode(t,e,"fallback"),fe=m.getSlotVNode(t,e,"placeholder");return r.watchEffect(()=>{var j,U;W.value&&H.value?(j=c.value)==null||j.setOpen(!0):(U=c.value)==null||U.setOpen(!1)}),o(r.createVNode(r.Fragment,null,[r.createVNode("div",{class:{[`${s.value}`]:!0,[`${i}`]:!0,[`${e.wrapperClassName}`]:e.wrapperClassName},ref:j=>z.value=j,style:{...e.wrapperStyle,width:e.width?K(e.width):void 0,height:e.height?K(e.height):void 0,display:e.lazy?"block":void 0},onClick:()=>{n("click")}},[y.value&&(fe||r.createVNode("div",{class:`${i}-placeholder ${s.value}`},null)),x.value?ue||r.createVNode("div",{class:`${i}-error ${s.value}`},[r.createTextVNode("加载失败")]):u.value&&r.createVNode("img",r.mergeProps(Ae,{class:{[`${s.value}`]:!0,[`${i}-inner`]:!0,[`${i}-preview`]:W.value,[`${J}`]:!!J},alt:e.alt,src:u.value,onLoad:Se,onError:le,onClick:()=>Me()}),null),r.createVNode(Re,{ref:c,zIndex:e.zIndex,infinite:e.infinite,initialIndex:X.value,urlList:e.previewSrcList,getContainer:e.getContainer,onHideOnClickModal:e.hideOnClickModal,onClose:()=>Ie()},null)])]))}}});Y.isWImage=!0,Y.install=e=>(e.component(Y.name,Y),e),v.GImage=Y,v.ImageViewer=Re,v.default=Y,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(v,r){typeof exports=="object"&&typeof module<"u"?r(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("vue-types"),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","vue-types","@vueuse/core"],r):(v=typeof globalThis<"u"?globalThis:v||self,r(v.GImage={},v.vue,v.iconsVue,v.proUtils,v.proHooks,v.proProvider,v.vueTypes,v.core))})(this,function(v,r,T,p,ee,k,Fe,de){"use strict";function h(e,t){Pe(e)&&(e="100%");var n=je(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function te(e){return Math.min(1,Math.max(0,e))}function Pe(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function je(e){return typeof e=="string"&&e.indexOf("%")!==-1}function Ce(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function ne(e){return e<=1?"".concat(Number(e)*100,"%"):e}function R(e){return e.length===1?"0"+e:String(e)}function Ve(e,t,n){return{r:h(e,255)*255,g:h(t,255)*255,b:h(n,255)*255}}function Te(e,t,n){e=h(e,255),t=h(t,255),n=h(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),o=0,s=0,c=(a+i)/2;if(a===i)s=0,o=0;else{var u=a-i;switch(s=c>.5?u/(2-a-i):u/(a+i),a){case e:o=(t-n)/u+(t<n?6:0);break;case t:o=(n-e)/u+2;break;case n:o=(e-t)/u+4;break}o/=6}return{h:o,s,l:c}}function he(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Be(e,t,n){var a,i,o;if(e=h(e,360),t=h(t,100),n=h(n,100),t===0)i=n,o=n,a=n;else{var s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;a=he(c,s,e+1/3),i=he(c,s,e),o=he(c,s,e-1/3)}return{r:a*255,g:i*255,b:o*255}}function ke(e,t,n){e=h(e,255),t=h(t,255),n=h(n,255);var a=Math.max(e,t,n),i=Math.min(e,t,n),o=0,s=a,c=a-i,u=a===0?0:c/a;if(a===i)o=0;else{switch(a){case e:o=(t-n)/c+(t<n?6:0);break;case t:o=(n-e)/c+2;break;case n:o=(e-t)/c+4;break}o/=6}return{h:o,s:u,v:s}}function Ye(e,t,n){e=h(e,360)*6,t=h(t,100),n=h(n,100);var a=Math.floor(e),i=e-a,o=n*(1-t),s=n*(1-i*t),c=n*(1-(1-i)*t),u=a%6,x=[n,s,o,o,c,n][u],y=[c,n,n,s,o,o][u],H=[o,o,c,n,n,s][u];return{r:x*255,g:y*255,b:H*255}}function ze(e,t,n,a){var i=[R(Math.round(e).toString(16)),R(Math.round(t).toString(16)),R(Math.round(n).toString(16))];return a&&i[0].startsWith(i[0].charAt(1))&&i[1].startsWith(i[1].charAt(1))&&i[2].startsWith(i[2].charAt(1))?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function We(e,t,n,a,i){var o=[R(Math.round(e).toString(16)),R(Math.round(t).toString(16)),R(Math.round(n).toString(16)),R(Ge(a))];return i&&o[0].startsWith(o[0].charAt(1))&&o[1].startsWith(o[1].charAt(1))&&o[2].startsWith(o[2].charAt(1))&&o[3].startsWith(o[3].charAt(1))?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function Ge(e){return Math.round(parseFloat(e)*255).toString(16)}function Oe(e){return b(e)/255}function b(e){return parseInt(e,16)}function qe(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var ge={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function _e(e){var t={r:0,g:0,b:0},n=1,a=null,i=null,o=null,s=!1,c=!1;return typeof e=="string"&&(e=Qe(e)),typeof e=="object"&&(z(e.r)&&z(e.g)&&z(e.b)?(t=Ve(e.r,e.g,e.b),s=!0,c=String(e.r).substr(-1)==="%"?"prgb":"rgb"):z(e.h)&&z(e.s)&&z(e.v)?(a=ne(e.s),i=ne(e.v),t=Ye(e.h,a,i),s=!0,c="hsv"):z(e.h)&&z(e.s)&&z(e.l)&&(a=ne(e.s),o=ne(e.l),t=Be(e.h,a,o),s=!0,c="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=Ce(n),{ok:s,format:e.format||c,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var Ze="[-\\+]?\\d+%?",Xe="[-\\+]?\\d*\\.\\d+%?",E="(?:".concat(Xe,")|(?:").concat(Ze,")"),ve="[\\s|\\(]+(".concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")\\s*\\)?"),me="[\\s|\\(]+(".concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")[,|\\s]+(").concat(E,")\\s*\\)?"),A={CSS_UNIT:new RegExp(E),rgb:new RegExp("rgb"+ve),rgba:new RegExp("rgba"+me),hsl:new RegExp("hsl"+ve),hsla:new RegExp("hsla"+me),hsv:new RegExp("hsv"+ve),hsva:new RegExp("hsva"+me),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function Qe(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(ge[e])e=ge[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n=A.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=A.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=A.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=A.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=A.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=A.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=A.hex8.exec(e),n?{r:b(n[1]),g:b(n[2]),b:b(n[3]),a:Oe(n[4]),format:t?"name":"hex8"}:(n=A.hex6.exec(e),n?{r:b(n[1]),g:b(n[2]),b:b(n[3]),format:t?"name":"hex"}:(n=A.hex4.exec(e),n?{r:b(n[1]+n[1]),g:b(n[2]+n[2]),b:b(n[3]+n[3]),a:Oe(n[4]+n[4]),format:t?"name":"hex8"}:(n=A.hex3.exec(e),n?{r:b(n[1]+n[1]),g:b(n[2]+n[2]),b:b(n[3]+n[3]),format:t?"name":"hex"}:!1)))))))))}function z(e){return!!A.CSS_UNIT.exec(String(e))}var q=function(){function e(t,n){t===void 0&&(t=""),n===void 0&&(n={});var a;if(t instanceof e)return t;typeof t=="number"&&(t=qe(t)),this.originalInput=t;var i=_e(t);this.originalInput=t,this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this.roundA=Math.round(100*this.a)/100,this.format=(a=n.format)!==null&&a!==void 0?a:i.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=i.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),n,a,i,o=t.r/255,s=t.g/255,c=t.b/255;return o<=.03928?n=o/12.92:n=Math.pow((o+.055)/1.055,2.4),s<=.03928?a=s/12.92:a=Math.pow((s+.055)/1.055,2.4),c<=.03928?i=c/12.92:i=Math.pow((c+.055)/1.055,2.4),.2126*n+.7152*a+.0722*i},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=Ce(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=ke(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=ke(this.r,this.g,this.b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.v*100);return this.a===1?"hsv(".concat(n,", ").concat(a,"%, ").concat(i,"%)"):"hsva(".concat(n,", ").concat(a,"%, ").concat(i,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=Te(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=Te(this.r,this.g,this.b),n=Math.round(t.h*360),a=Math.round(t.s*100),i=Math.round(t.l*100);return this.a===1?"hsl(".concat(n,", ").concat(a,"%, ").concat(i,"%)"):"hsla(".concat(n,", ").concat(a,"%, ").concat(i,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=!1),ze(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=!1),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=!1),We(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=!1),"#"+this.toHex8(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),n=Math.round(this.g),a=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(n,", ").concat(a,")"):"rgba(".concat(t,", ").concat(n,", ").concat(a,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(n){return"".concat(Math.round(h(n,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(n){return Math.round(h(n,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var t="#"+ze(this.r,this.g,this.b,!1),n=0,a=Object.entries(ge);n<a.length;n++){var i=a[n],o=i[0],s=i[1];if(t===s)return o}return!1},e.prototype.toString=function(t){var n=!!t;t=t??this.format;var a=!1,i=this.a<1&&this.a>=0,o=!n&&i&&(t.startsWith("hex")||t==="name");return o?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(a=this.toRgbString()),t==="prgb"&&(a=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(a=this.toHexString()),t==="hex3"&&(a=this.toHexString(!0)),t==="hex4"&&(a=this.toHex8String(!0)),t==="hex8"&&(a=this.toHex8String()),t==="name"&&(a=this.toName()),t==="hsl"&&(a=this.toHslString()),t==="hsv"&&(a=this.toHsvString()),a||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=te(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=te(n.l),new e(n)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=te(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=te(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),a=(n.h+t)%360;return n.h=a<0?360+a:a,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var a=this.toRgb(),i=new e(t).toRgb(),o=n/100,s={r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a};return new e(s)},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var a=this.toHsl(),i=360/n,o=[this];for(a.h=(a.h-(i*t>>1)+720)%360;--t;)a.h=(a.h+i)%360,o.push(new e(a));return o},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),a=n.h,i=n.s,o=n.v,s=[],c=1/t;t--;)s.push(new e({h:a,s:i,v:o})),o=(o+c)%1;return s},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),a=new e(t).toRgb();return new e({r:a.r+(n.r-a.r)*n.a,g:a.g+(n.g-a.g)*n.a,b:a.b+(n.b-a.b)*n.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),a=n.h,i=[this],o=360/t,s=1;s<t;s++)i.push(new e({h:(a+s*o)%360,s:n.s,l:n.l}));return i},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();const Ke=new k.Keyframe("viewFadeIn",{"0%":{opacity:0},"100%":{opacity:1}}),Je=new k.Keyframe("viewFadeOut",{"0%":{opacity:1},"100%":{opacity:0}}),Ue=new k.Keyframe("viewZoomBadgeIn",{"0%":{transform:"scale(0.2)",opacity:0},"100%":{transform:"scale(1)",opacity:1}}),et=new k.Keyframe("viewZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0.2)",opacity:0}}),Le=e=>({position:e||"absolute",inset:0});function pe(e){return{position:e,top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0}}const tt=e=>({boxSizing:"border-box",margin:0,padding:0,color:e.colorText,fontSize:e.fontSize,lineHeight:e.lineHeight,listStyle:"none",fontFamily:e.fontFamily}),nt=e=>{const{componentCls:t,modalMaskBg:n,paddingSM:a,previewOperationColorDisabled:i,motionDurationSlow:o}=e,s=new q(n).setAlpha(.1),c=s.clone().setAlpha(.2);return{[`${t}-operations`]:{...tt(e),display:"flex",flexDirection:"row-reverse",alignItems:"center",color:e.previewOperationColor,listStyle:"none",background:s.toRgbString(),pointerEvents:"auto","&-operation":{marginInlineStart:a,padding:a,cursor:"pointer",transition:`all ${o}`,userSelect:"none","&:hover":{background:c.toRgbString()},"&-disabled":{color:i,pointerEvents:"none"},"&:last-of-type":{marginInlineStart:0}},"&-progress":{position:"absolute",left:{_skip_check_:!0,value:"50%"},transform:"translateX(-50%)"},"&-icon":{fontSize:e.previewOperationSize}}}},at=e=>{const{modalMaskBg:t,previewOperationColorDisabled:n,zIndexPopup:a,motionDurationSlow:i}=e,o=new q(t).setAlpha(.1),s=o.clone().setAlpha(.2);return{[`${e.componentCls}-switch-left, ${e.componentCls}-switch-right`]:{position:"fixed",insetBlockStart:"50%",zIndex:a+1,display:"flex",alignItems:"center",justifyContent:"center",width:e.imagePreviewSwitchSize,height:e.imagePreviewSwitchSize,marginTop:-e.imagePreviewSwitchSize/2,color:e.previewOperationColor,background:o.toRgbString(),borderRadius:"50%",transform:"translateY(-50%)",cursor:"pointer",transition:`all ${i}`,pointerEvents:"auto",userSelect:"none","&:hover":{background:s.toRgbString()},["&-disabled"]:{"&, &:hover":{color:n,background:"transparent",cursor:"not-allowed",[`> ${e.iconCls}`]:{cursor:"not-allowed"}}},[`> ${e.iconCls}`]:{fontSize:e.previewOperationSize}},[`${e.componentCls}-switch-left`]:{insetInlineStart:e.marginSM},[`${e.componentCls}-switch-right`]:{insetInlineEnd:e.marginSM}}},it=e=>({[e.componentCls]:{["&-root"]:{...pe("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},["&-wrapper"]:{...pe("fixed"),zIndex:e.zIndexPopup,overflow:"auto",outline:0,WebkitOverflowScrolling:"touch"},["&-mask"]:{...pe("fixed"),zIndex:e.zIndexPopupBase,height:"100%",backgroundColor:e.colorBgMask},["&-block"]:{height:"100%",textAlign:"center",pointerEvents:"none"},["&-body"]:{...Le(),overflow:"hidden"},["&-canvas"]:{...Le(),display:"flex",justifyContent:"center",alignItems:"center","&::before":{display:"inline-block",width:1,height:"50%",marginInlineEnd:-1,content:'""'}},["&-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"},["&-fade-appear, &-fade-enter"]:{animationName:Ke,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},["&-fade-leave"]:{animationName:Je,animationDuration:e.motionDurationSlow,animationTimingFunction:"linear"},["&-zoom-appear, &-zoom-enter"]:{animationName:Ue,opacity:0,animationTimingFunction:e.motionEaseOutCirc,animationFillMode:"both",transform:"none",animationDuration:e.motionDurationSlow,userSelect:"none"},["&-zoom-enter-active"]:{animationPlayState:"running"},["&-zoom-leave"]:{animationName:et,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%"},"&":[nt(e),at(e)]});function rt(e){return k.useStyle("ImageView",t=>{const n=k.mergeToken(t,{zIndexPopup:t.zIndexPopupBase+80,previewOperationColorDisabled:new q(t.colorTextLightSolid).setAlpha(.25).toRgbString(),modalMaskBg:new q("#000").setAlpha(.45).toRgbString(),previewOperationColor:new q(t.colorTextLightSolid).toRgbString(),previewOperationSize:t.fontSizeIcon*1.5,imagePreviewSwitchSize:t.controlHeightLG,iconCls:"anticon"});return[it(n)]},e)}const Ee=Fe.createTypes({func:void 0,bool:void 0,string:void 0,number:void 0,array:void 0,object:void 0,integer:void 0});Ee.extend([{name:"looseBool",getter:!0,type:Boolean,default:void 0},{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VueNode",getter:!0,type:null}]);const V=Ee,D={infinite:{type:Boolean,default:!0},zIndex:{type:Number,default:2e3},initialIndex:{type:Number,default:0},getContainer:{type:String}},ae={previewTeleported:{type:Boolean,default:!0},hideOnClickModal:{type:Boolean,default:!0},src:{type:String,default:""},alt:{type:String,default:""},fit:{type:String,default:"contain"},lazy:V.bool,scrollContainer:{type:[String,Object]},placeholder:{type:[Function,Object],default:()=>{}},fallback:{type:[Function,Object],default:()=>{}},onLoad:{type:Function},onError:{type:Function},onClick:{type:Function},disablePreview:V.bool,previewSrcList:{type:Array,default:()=>[]},imageClassName:V.string,imageStyle:V.style,width:V.number,height:V.number,zIndex:D.zIndex,infinite:D.infinite,getContainer:D.getContainer,initialIndex:D.initialIndex},ot={urlList:{type:Array,default:()=>[]},teleported:ae.previewTeleported,zIndex:D.zIndex,initialIndex:D.initialIndex,infinite:D.infinite,getContainer:ae.getContainer,onHideOnClickModal:ae.hideOnClickModal,icons:{type:Object,default:()=>({})}},B={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace"},ie=function(e,t,n,a=!1){e&&t&&n&&e.addEventListener(t,n,a)},be=function(e,t,n,a=!1){e&&t&&n&&e.removeEventListener(t,n,a)},_={CONTAIN:{name:"contain",icon:r.createVNode(T.ExpandOutlined,null,null)},ORIGINAL:{name:"original",icon:r.createVNode(T.OneToOneOutlined,null,null)}},$e=function(){return!p.isServer&&!!window.navigator.userAgent.match(/firefox/i)}()?"DOMMouseScroll":"mousewheel";function ye(e){let t=!1;return function(...n){t||(t=!0,window.requestAnimationFrame(()=>{e.apply(this,n),t=!1}))}}const Re=r.defineComponent({props:ot,emits:["close","switch"],setup:function(e,{emit:t,expose:n}){var ue,fe,j,U,He;let a=null,i=null,o=null;const s=p.getPrefixCls({suffixCls:"image-viewer"}),{wrapSSR:c,hashId:u}=rt(s),x=r.shallowRef(!1),[y,H]=ee.useState(!1),[O,M]=ee.useState(!1),L=r.ref(!0),g=r.ref(e.initialIndex),Z=r.ref(null),W=r.ref(null),X=r.ref(_.CONTAIN),d=r.ref({scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}),Q=r.computed(()=>e.urlList.length>1),re=r.computed(()=>g.value===0),oe=r.computed(()=>g.value===e.urlList.length-1),se=r.computed(()=>e.urlList[g.value]),Se=r.computed(()=>{const{scale:l,deg:w,offsetX:S,offsetY:C,enableTransition:m}=d.value,I={transform:`scale(${l}) rotate(${w}deg)`,transition:m?"transform .3s":"",marginLeft:`${S}px`,marginTop:`${C}px`};return X.value.name===_.CONTAIN.name&&(I.maxWidth=I.maxHeight="100%"),I}),le=()=>{Ie(),t("close"),d.value={scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}},xe=l=>{x.value?x.value=!1:Z.value===(l==null?void 0:l.target)&&(M(!1),g.value=e.initialIndex)},Me=()=>{a=ye(l=>{switch(l.code){case B.esc:M(!1);break;case B.space:G();break;case B.left:ce();break;case B.up:N("zoomIn");break;case B.right:J();break;case B.down:N("zoomOut");break}}),i=ye(l=>{(l.wheelDelta?l.wheelDelta:-l.detail)>0?N("zoomIn",{zoomRate:.015,enableTransition:!1}):N("zoomOut",{zoomRate:.015,enableTransition:!1})}),ie(document,"keydown",a),ie(document,$e,i)},Ie=()=>{be(document,"keydown",a),be(document,$e,i),a=null,i=null},K=()=>{L.value=!1},f=l=>{L.value=!1,l.target.alt="加载失败"},F=r.shallowRef(),$=l=>{if(L.value||l.button!==0)return;l.preventDefault(),l.stopPropagation(),clearTimeout(F.value),x.value=!0;const{offsetX:w,offsetY:S}=d.value,C=l.pageX,m=l.pageY;o=ye(I=>{d.value={...d.value,offsetX:w+I.pageX-C,offsetY:S+I.pageY-m}}),ie(document,"mousemove",o),ie(document,"mouseup",()=>{be(document,"mousemove",o),y.value&&O.value&&(F.value=setTimeout(()=>{x.value=!1}))})},P=()=>{d.value={scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}},G=()=>{if(L.value)return;const l=Object.keys(_),w=Object.values(_),S=X.value.name,m=(w.findIndex(I=>I.name===S)+1)%l.length;X.value=_[l[m]],P()},ce=()=>{if(re.value&&!e.infinite)return;const l=e.urlList.length;g.value=(g.value-1+l)%l},J=()=>{if(oe.value&&!e.infinite)return;const l=e.urlList.length;g.value=(g.value+1)%l},N=(l,w={})=>{if(L.value)return;const{zoomRate:S,rotateDeg:C,enableTransition:m}={zoomRate:.2,rotateDeg:90,enableTransition:!0,...w};switch(l){case"zoomOut":d.value.scale>.2&&(d.value.scale=parseFloat((d.value.scale-S).toFixed(3)));break;case"zoomIn":d.value.scale=parseFloat((d.value.scale+S).toFixed(3));break;case"clocelise":d.value.deg+=C;break;case"anticlocelise":d.value.deg-=C;break}d.value.enableTransition=m},Ae=[{icon:((ue=e.icons)==null?void 0:ue.close)||r.createVNode(T.CloseOutlined,null,null),onClick:l=>{l.stopPropagation(),M(!1)},type:"close"},{icon:((fe=e.icons)==null?void 0:fe.zoomIn)||r.createVNode(T.ZoomInOutlined,null,null),onClick:l=>{l.stopPropagation(),N("zoomIn")},type:"zoomIn"},{icon:((j=e.icons)==null?void 0:j.zoomOut)||r.createVNode(T.ZoomOutOutlined,null,null),onClick:l=>{l.stopPropagation(),N("zoomOut")},type:"zoomOut"},{icon:((U=e.icons)==null?void 0:U.rotateRight)||r.createVNode(T.RotateRightOutlined,null,null),onClick:l=>{l.stopPropagation(),N("anticlocelise")},type:"rotateRight"},{icon:((He=e.icons)==null?void 0:He.rotateLeft)||r.createVNode(T.RotateLeftOutlined,null,null),onClick:l=>{l.stopPropagation(),N("clocelise")},type:"rotateLeft"}];return r.watch(se,()=>{r.nextTick(()=>{W.value.complete||(L.value=!0)})}),r.watch(g,l=>{P(),t("switch",l)}),r.watch(y,l=>{l&&(O.value=l)}),ee.onMountedOrActivated(()=>{var l,w;Me(),(w=(l=Z.value)==null?void 0:l.focus)==null||w.call(l)}),n({setOpen:H}),()=>{const l=k.getTransitionProps(`${s}-fade`),w=k.getTransitionProps(`${s}-zoom`);return c(r.createVNode(r.Teleport,{to:e.getContainer||"body",disabled:!e.teleported},{default:()=>[y.value&&r.createVNode("div",{class:`${s}-root ${u.value}`},[r.createVNode(r.Transition,l,{default:()=>[r.withDirectives(r.createVNode("div",{class:`${s}-mask ${u.value}`},null),[[r.vShow,y.value&&O.value]])]}),r.createVNode("div",{ref:Z,tabindex:-1,class:[`${s}-wrapper`,`${u.value}`],onClick:S=>e.onHideOnClickModal&&xe(S)},[r.createVNode(r.Transition,r.mergeProps(w,{onAfterLeave:()=>le()}),{default:()=>{var S,C;return[r.withDirectives(r.createVNode("div",{class:`${s}-block ${u.value}`},[r.createVNode("div",{class:`${s}-content ${u.value}`},[r.createVNode("div",{class:`${s}-body ${u.value}`},[r.createVNode("div",{class:`${s}-operations-wrapper ${u.value}`,onClick:m=>m.stopPropagation()},[r.createVNode("ul",{class:`${s}-operations ${u.value}`},[Ae.map(({icon:m,onClick:I,type:Ne})=>r.createVNode("li",{class:`${s}-operations-operation ${u.value}`,onClick:I,key:Ne},[r.cloneVNode(m,{class:`${s}-operations-icon ${u.value}`})]))])]),r.createVNode("div",{class:`${s}-canvas ${u.value}`},[e.urlList.map((m,I)=>r.createVNode("img",{ref:W,class:`${s}-img ${u.value}`,style:{...Se.value,display:I===g.value?"block":"none"},key:m,src:m,onLoad:()=>K(),onError:Ne=>f(Ne),onMousedown:$},null))]),Q.value&&r.createVNode("div",{class:[`${s}-switch-left`,g.value===0&&!e.infinite?`${s}-switch-left-disabled`:"",`${u.value}`],onClick:ce},[((S=e.icons)==null?void 0:S.left)||r.createVNode(T.LeftOutlined,null,null)]),Q.value&&r.createVNode("div",{class:[`${s}-switch-right`,g.value===e.urlList.length-1&&!e.infinite?`${s}-switch-right-disabled`:"",`${u.value}`],onClick:J},[((C=e.icons)==null?void 0:C.right)||r.createVNode(T.RightOutlined,null,null)])])])]),[[r.vShow,y.value&&O.value]])]}})])])]}))}}}),we={width:"100%",height:"100%"},st=e=>({[e.componentCls]:{display:"inline-block",position:"relative",overflow:"hidden",["&-inner"]:{...we,verticalAlign:"top",opacity:1},["&-placeholder"]:{...we,backgroundColor:e.colorBgContainerDisabled,backgroundImage:"url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",backgroundRepeat:"no-repeat",backgroundPosition:"center center",backgroundSize:"30%"},["&-error"]:{...we,display:"flex",alignItems:"center",justifyContent:"center",color:e.colorText,backgroundColor:e.colorBgContainerDisabled},["&-preview"]:{cursor:"pointer"}}}),lt=e=>e&&e.nodeType===Node.ELEMENT_NODE;let De="";const Y=r.defineComponent({props:ae,name:"GImage",emits:["error","click","load"],setup(e,{slots:t,emit:n,attrs:a}){const i=p.getPrefixCls({suffixCls:"image"}),{wrapSSR:o,hashId:s}=k.useProStyle("Image",[st],i),c=r.ref(),u=r.ref(""),x=r.ref(!1),y=r.ref(!0),H=r.ref(!1),O=r.ref(null),M=r.ref();let L,g;const Z=r.computed(()=>!p.isServer&&e.fit?{"object-fit":e.fit}:{}),W=r.computed(()=>{const{previewSrcList:f}=e;return Array.isArray(f)&&f.length>0}),X=r.computed(()=>{const{src:f,previewSrcList:F,initialIndex:$}=e;if($||$===0)return F.length>=$?$:0;let P=0;const G=F.indexOf(f);return G>=0&&(P=G),P}),d=()=>{p.isServer||(y.value=!0,x.value=!1,e.src?u.value=e.src:le())};function Q(){p.isInContainer(O.value,M.value)&&(d(),se())}const re=de.useThrottleFn(Q,200),oe=async()=>{if(p.isServer)return;await r.nextTick();const{scrollContainer:f}=e;lt(f)?M.value=f:p.isString(f)&&f!==""?M.value=document.querySelector(f)??void 0:O.value&&(M.value=p.getScrollContainer(O.value)),M.value&&(L=de.useEventListener(M,"scroll",re),setTimeout(()=>Q(),200))},se=()=>{p.isServer||!M.value||!re||(L(),M.value=void 0)},Se=f=>{y.value=!1,x.value=!1,n("load",f)},le=f=>{y.value=!1,x.value=!0,n("error",f)},xe=f=>{if(f.ctrlKey){if(f.deltaY<0)return f.preventDefault(),!1;if(f.deltaY>0)return f.preventDefault(),!1}},Me=()=>{!W.value||e.disablePreview||(g=de.useEventListener("wheel",xe,{passive:!1}),De=document.body.style.overflow,document.body.style.overflow="hidden",H.value=!0)},Ie=()=>{g==null||g(),document.body.style.overflow=De,H.value=!1};r.watch(()=>e.src,()=>{e.lazy?(y.value=!0,x.value=!1,se(),oe()):d()});const K=f=>p.isNumber(f)?f+"px":f;return ee.onMountedOrActivated(()=>{e.lazy?oe():d()}),()=>{const{crossorigin:f,decoding:F,alt:$,sizes:P,srcset:G,usemap:ce,class:J,style:N={}}=a,Ae={crossorigin:f,decoding:F,alt:$,sizes:P,srcset:G,usemap:ce,style:{...Z.value,height:e.height?K(e.height):void 0}},ue=p.getSlotVNode(t,e,"fallback"),fe=p.getSlotVNode(t,e,"placeholder");return r.watchEffect(()=>{var j,U;W.value&&H.value?(j=c.value)==null||j.setOpen(!0):(U=c.value)==null||U.setOpen(!1)}),o(r.createVNode(r.Fragment,null,[r.createVNode("div",{class:{[`${s.value}`]:!0,[`${i}`]:!0,[`${J}`]:!!J},ref:j=>O.value=j,style:{...N,width:e.width?K(e.width):void 0,height:e.height?K(e.height):void 0,display:e.lazy?"block":void 0},onClick:()=>{n("click")}},[y.value&&(fe||r.createVNode("div",{class:`${i}-placeholder ${s.value}`},null)),x.value?ue||r.createVNode("div",{class:`${i}-error ${s.value}`},[r.createTextVNode("加载失败")]):u.value&&r.createVNode("img",r.mergeProps(Ae,{class:{[`${s.value}`]:!0,[`${e.imageClassName}`]:!!e.imageClassName,[`${i}-inner`]:!0,[`${i}-preview`]:W.value},alt:e.alt,src:u.value,onLoad:Se,onError:le,onClick:()=>Me()}),null),r.createVNode(Re,{ref:c,zIndex:e.zIndex,infinite:e.infinite,initialIndex:X.value,urlList:e.previewSrcList,getContainer:e.getContainer,onHideOnClickModal:e.hideOnClickModal,onClose:()=>Ie()},null)])]))}}});Y.isWImage=!0,Y.install=e=>(e.component(Y.name,Y),e),v.GImage=Y,v.ImageViewer=Re,v.default=Y,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/props.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PropType,
|
|
1
|
+
import type { PropType, VNode } from 'vue';
|
|
2
2
|
import type { WithFalse, CustomRender } from '@gx-design-vue/pro-utils';
|
|
3
3
|
type PreviewPropsIons = {
|
|
4
4
|
rotateLeft?: VNode;
|
|
@@ -18,11 +18,6 @@ export declare const gImagePorps: {
|
|
|
18
18
|
type: PropType<boolean>;
|
|
19
19
|
default: boolean;
|
|
20
20
|
};
|
|
21
|
-
wrapperClassName: StringConstructor;
|
|
22
|
-
wrapperStyle: {
|
|
23
|
-
type: PropType<CSSProperties>;
|
|
24
|
-
default: undefined;
|
|
25
|
-
};
|
|
26
21
|
src: {
|
|
27
22
|
type: PropType<string>;
|
|
28
23
|
default: string;
|
|
@@ -68,7 +63,7 @@ export declare const gImagePorps: {
|
|
|
68
63
|
imageClassName: import("vue-types").VueTypeValidableDef<string> & {
|
|
69
64
|
default: string;
|
|
70
65
|
};
|
|
71
|
-
imageStyle: import("vue-types").VueTypeValidableDef<CSSProperties>;
|
|
66
|
+
imageStyle: import("vue-types").VueTypeValidableDef<import("vue").CSSProperties>;
|
|
72
67
|
width: import("vue-types").VueTypeValidableDef<number> & {
|
|
73
68
|
default: number;
|
|
74
69
|
};
|