@gx-design-vue/image 0.2.0-beta.21 → 0.2.0-beta.22

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 CHANGED
@@ -1,35 +1,12 @@
1
- import { createTypes as Ze } from "vue-types";
2
- import { createVNode as f, defineComponent as Ve, shallowRef as Te, ref as C, reactive as Xe, computed as L, watch as _, nextTick as Ye, Teleport as _e, Transition as ke, withDirectives as ze, vShow as Oe, mergeProps as We, cloneVNode as qe, watchEffect as Qe, createTextVNode as Je } from "vue";
3
- import { ExpandOutlined as Ke, OneToOneOutlined as et, CloseOutlined as tt, ZoomInOutlined as nt, ZoomOutOutlined as at, RotateRightOutlined as it, RotateLeftOutlined as rt, LeftOutlined as ot, RightOutlined as st } from "@ant-design/icons-vue";
4
- import { isServer as q, getPrefixCls as Ge, isInContainer as lt, getSlotVNode as Le, isString as ut, getScrollContainer as ct, isNumber as ft } from "@gx-design-vue/pro-utils";
5
- import { useState as Ne, onMountedOrActivated as dt } from "@gx-design-vue/pro-hooks";
6
- import { Keyframe as fe, useStyle as ht, mergeToken as gt, getTransitionProps as Ee, useProStyle as vt } from "@gx-design-vue/pro-provider";
7
- import { useThrottleFn as mt, useEventListener as $e } from "@vueuse/core";
8
- const R = Ze({
9
- func: void 0,
10
- bool: void 0,
11
- string: void 0,
12
- number: void 0,
13
- array: void 0,
14
- object: void 0,
15
- integer: void 0
16
- });
17
- R.extend([{
18
- name: "looseBool",
19
- getter: !0,
20
- type: Boolean,
21
- default: void 0
22
- }, {
23
- name: "style",
24
- getter: !0,
25
- type: [String, Object],
26
- default: void 0
27
- }, {
28
- name: "VueNode",
29
- getter: !0,
30
- type: null
31
- }]);
32
- const D = {
1
+ import Z from "ant-design-vue/es/_util/vue-types";
2
+ import { ref as M, reactive as re, onMounted as De, defineComponent as Me, createVNode as r, Teleport as Ue, Transition as Se, withDirectives as he, Fragment as Ie, cloneVNode as Je, vShow as pe, shallowRef as V, computed as y, watch as j, onUnmounted as et, mergeProps as ze, watchEffect as tt, createTextVNode as nt, nextTick as ot } from "vue";
3
+ import { CloseOutlined as it, LeftOutlined as at, RightOutlined as lt, RotateLeftOutlined as rt, RotateRightOutlined as st, ZoomInOutlined as ct, ZoomOutOutlined as ut, SwapOutlined as xe } from "@ant-design/icons-vue";
4
+ import { classNames as ae, getPrefixCls as _e, isNumber as Ee, getSlotVNode as L, isArray as Fe, getSlot as dt, isServer as le, isInContainer as ft, isString as vt, getScrollContainer as gt } from "@gx-design-vue/pro-utils";
5
+ import { useState as Le, onMountedOrActivated as mt } from "@gx-design-vue/pro-hooks";
6
+ import { Keyframe as ue, useStyle as wt, mergeToken as St, unit as ht, getTransitionProps as Ce, useProStyle as It } from "@gx-design-vue/pro-provider";
7
+ import { TinyColor as K } from "@ctrl/tinycolor";
8
+ import { useThrottleFn as pt, useEventListener as Te } from "@vueuse/core";
9
+ const U = {
33
10
  infinite: {
34
11
  type: Boolean,
35
12
  default: !0
@@ -38,14 +15,14 @@ const D = {
38
15
  type: Number,
39
16
  default: 2e3
40
17
  },
41
- initialIndex: {
18
+ current: {
42
19
  type: Number,
43
20
  default: 0
44
21
  },
45
22
  getContainer: {
46
23
  type: String
47
24
  }
48
- }, ue = {
25
+ }, se = {
49
26
  previewTeleported: {
50
27
  type: Boolean,
51
28
  default: !0
@@ -66,7 +43,7 @@ const D = {
66
43
  type: String,
67
44
  default: "contain"
68
45
  },
69
- lazy: R.bool,
46
+ lazy: Z.bool,
70
47
  scrollContainer: {
71
48
  type: [String, Object]
72
49
  },
@@ -89,564 +66,57 @@ const D = {
89
66
  onClick: {
90
67
  type: Function
91
68
  },
92
- disablePreview: R.bool,
93
- previewSrcList: {
69
+ previewUrls: {
94
70
  type: Array,
95
71
  default: () => []
96
72
  },
97
- imageClassName: R.string,
98
- imageStyle: R.style,
99
- width: R.number,
100
- height: R.number,
101
- zIndex: D.zIndex,
102
- infinite: D.infinite,
103
- getContainer: D.getContainer,
104
- initialIndex: {
105
- ...D.initialIndex,
73
+ imageClassName: Z.string,
74
+ imageStyle: Z.style,
75
+ width: Z.number,
76
+ height: Z.number,
77
+ zIndex: U.zIndex,
78
+ infinite: U.infinite,
79
+ getContainer: U.getContainer,
80
+ current: {
81
+ ...U.current,
106
82
  default: () => {
107
83
  }
108
84
  }
109
- }, pt = {
110
- urlList: {
85
+ }, Y = {
86
+ previewUrls: {
111
87
  type: Array,
112
88
  default: () => []
113
89
  },
114
- teleported: ue.previewTeleported,
115
- zIndex: D.zIndex,
116
- initialIndex: D.initialIndex,
117
- infinite: D.infinite,
118
- getContainer: ue.getContainer,
119
- onHideOnClickModal: ue.hideOnClickModal,
90
+ teleported: se.previewTeleported,
91
+ zIndex: U.zIndex,
92
+ current: U.current,
93
+ infinite: U.infinite,
94
+ getContainer: se.getContainer,
95
+ onHideOnClickModal: se.hideOnClickModal,
96
+ countRender: [Function, Array, Object],
120
97
  icons: {
121
98
  type: Object,
122
99
  default: () => ({})
123
100
  }
124
101
  };
125
- function v(e, t) {
126
- bt(e) && (e = "100%");
127
- var n = yt(e);
128
- 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);
129
- }
130
- function oe(e) {
131
- return Math.min(1, Math.max(0, e));
132
- }
133
- function bt(e) {
134
- return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1;
135
- }
136
- function yt(e) {
137
- return typeof e == "string" && e.indexOf("%") !== -1;
138
- }
139
- function Ue(e) {
140
- return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
141
- }
142
- function se(e) {
143
- return e <= 1 ? "".concat(Number(e) * 100, "%") : e;
144
- }
145
- function H(e) {
146
- return e.length === 1 ? "0" + e : String(e);
147
- }
148
- function wt(e, t, n) {
149
- return {
150
- r: v(e, 255) * 255,
151
- g: v(t, 255) * 255,
152
- b: v(n, 255) * 255
153
- };
154
- }
155
- function Re(e, t, n) {
156
- e = v(e, 255), t = v(t, 255), n = v(n, 255);
157
- var a = Math.max(e, t, n), i = Math.min(e, t, n), r = 0, o = 0, l = (a + i) / 2;
158
- if (a === i)
159
- o = 0, r = 0;
160
- else {
161
- var c = a - i;
162
- switch (o = l > 0.5 ? c / (2 - a - i) : c / (a + i), a) {
163
- case e:
164
- r = (t - n) / c + (t < n ? 6 : 0);
165
- break;
166
- case t:
167
- r = (n - e) / c + 2;
168
- break;
169
- case n:
170
- r = (e - t) / c + 4;
171
- break;
172
- }
173
- r /= 6;
174
- }
175
- return { h: r, s: o, l };
176
- }
177
- function be(e, t, n) {
178
- 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;
179
- }
180
- function St(e, t, n) {
181
- var a, i, r;
182
- if (e = v(e, 360), t = v(t, 100), n = v(n, 100), t === 0)
183
- i = n, r = n, a = n;
184
- else {
185
- var o = n < 0.5 ? n * (1 + t) : n + t - n * t, l = 2 * n - o;
186
- a = be(l, o, e + 1 / 3), i = be(l, o, e), r = be(l, o, e - 1 / 3);
187
- }
188
- return { r: a * 255, g: i * 255, b: r * 255 };
189
- }
190
- function De(e, t, n) {
191
- e = v(e, 255), t = v(t, 255), n = v(n, 255);
192
- var a = Math.max(e, t, n), i = Math.min(e, t, n), r = 0, o = a, l = a - i, c = a === 0 ? 0 : l / a;
193
- if (a === i)
194
- r = 0;
195
- else {
196
- switch (a) {
197
- case e:
198
- r = (t - n) / l + (t < n ? 6 : 0);
199
- break;
200
- case t:
201
- r = (n - e) / l + 2;
202
- break;
203
- case n:
204
- r = (e - t) / l + 4;
205
- break;
206
- }
207
- r /= 6;
208
- }
209
- return { h: r, s: c, v: o };
210
- }
211
- function xt(e, t, n) {
212
- e = v(e, 360) * 6, t = v(t, 100), n = v(n, 100);
213
- var a = Math.floor(e), i = e - a, r = n * (1 - t), o = n * (1 - i * t), l = n * (1 - (1 - i) * t), c = a % 6, S = [n, o, r, r, l, n][c], p = [l, n, n, o, r, r][c], E = [r, r, l, n, n, o][c];
214
- return { r: S * 255, g: p * 255, b: E * 255 };
215
- }
216
- function He(e, t, n, a) {
217
- var i = [
218
- H(Math.round(e).toString(16)),
219
- H(Math.round(t).toString(16)),
220
- H(Math.round(n).toString(16))
221
- ];
222
- 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("");
223
- }
224
- function Mt(e, t, n, a, i) {
225
- var r = [
226
- H(Math.round(e).toString(16)),
227
- H(Math.round(t).toString(16)),
228
- H(Math.round(n).toString(16)),
229
- H(It(a))
230
- ];
231
- return i && r[0].startsWith(r[0].charAt(1)) && r[1].startsWith(r[1].charAt(1)) && r[2].startsWith(r[2].charAt(1)) && r[3].startsWith(r[3].charAt(1)) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) + r[3].charAt(0) : r.join("");
232
- }
233
- function It(e) {
234
- return Math.round(parseFloat(e) * 255).toString(16);
235
- }
236
- function Pe(e) {
237
- return w(e) / 255;
238
- }
239
- function w(e) {
240
- return parseInt(e, 16);
241
- }
242
- function At(e) {
243
- return {
244
- r: e >> 16,
245
- g: (e & 65280) >> 8,
246
- b: e & 255
247
- };
248
- }
249
- var Ae = {
250
- aliceblue: "#f0f8ff",
251
- antiquewhite: "#faebd7",
252
- aqua: "#00ffff",
253
- aquamarine: "#7fffd4",
254
- azure: "#f0ffff",
255
- beige: "#f5f5dc",
256
- bisque: "#ffe4c4",
257
- black: "#000000",
258
- blanchedalmond: "#ffebcd",
259
- blue: "#0000ff",
260
- blueviolet: "#8a2be2",
261
- brown: "#a52a2a",
262
- burlywood: "#deb887",
263
- cadetblue: "#5f9ea0",
264
- chartreuse: "#7fff00",
265
- chocolate: "#d2691e",
266
- coral: "#ff7f50",
267
- cornflowerblue: "#6495ed",
268
- cornsilk: "#fff8dc",
269
- crimson: "#dc143c",
270
- cyan: "#00ffff",
271
- darkblue: "#00008b",
272
- darkcyan: "#008b8b",
273
- darkgoldenrod: "#b8860b",
274
- darkgray: "#a9a9a9",
275
- darkgreen: "#006400",
276
- darkgrey: "#a9a9a9",
277
- darkkhaki: "#bdb76b",
278
- darkmagenta: "#8b008b",
279
- darkolivegreen: "#556b2f",
280
- darkorange: "#ff8c00",
281
- darkorchid: "#9932cc",
282
- darkred: "#8b0000",
283
- darksalmon: "#e9967a",
284
- darkseagreen: "#8fbc8f",
285
- darkslateblue: "#483d8b",
286
- darkslategray: "#2f4f4f",
287
- darkslategrey: "#2f4f4f",
288
- darkturquoise: "#00ced1",
289
- darkviolet: "#9400d3",
290
- deeppink: "#ff1493",
291
- deepskyblue: "#00bfff",
292
- dimgray: "#696969",
293
- dimgrey: "#696969",
294
- dodgerblue: "#1e90ff",
295
- firebrick: "#b22222",
296
- floralwhite: "#fffaf0",
297
- forestgreen: "#228b22",
298
- fuchsia: "#ff00ff",
299
- gainsboro: "#dcdcdc",
300
- ghostwhite: "#f8f8ff",
301
- goldenrod: "#daa520",
302
- gold: "#ffd700",
303
- gray: "#808080",
304
- green: "#008000",
305
- greenyellow: "#adff2f",
306
- grey: "#808080",
307
- honeydew: "#f0fff0",
308
- hotpink: "#ff69b4",
309
- indianred: "#cd5c5c",
310
- indigo: "#4b0082",
311
- ivory: "#fffff0",
312
- khaki: "#f0e68c",
313
- lavenderblush: "#fff0f5",
314
- lavender: "#e6e6fa",
315
- lawngreen: "#7cfc00",
316
- lemonchiffon: "#fffacd",
317
- lightblue: "#add8e6",
318
- lightcoral: "#f08080",
319
- lightcyan: "#e0ffff",
320
- lightgoldenrodyellow: "#fafad2",
321
- lightgray: "#d3d3d3",
322
- lightgreen: "#90ee90",
323
- lightgrey: "#d3d3d3",
324
- lightpink: "#ffb6c1",
325
- lightsalmon: "#ffa07a",
326
- lightseagreen: "#20b2aa",
327
- lightskyblue: "#87cefa",
328
- lightslategray: "#778899",
329
- lightslategrey: "#778899",
330
- lightsteelblue: "#b0c4de",
331
- lightyellow: "#ffffe0",
332
- lime: "#00ff00",
333
- limegreen: "#32cd32",
334
- linen: "#faf0e6",
335
- magenta: "#ff00ff",
336
- maroon: "#800000",
337
- mediumaquamarine: "#66cdaa",
338
- mediumblue: "#0000cd",
339
- mediumorchid: "#ba55d3",
340
- mediumpurple: "#9370db",
341
- mediumseagreen: "#3cb371",
342
- mediumslateblue: "#7b68ee",
343
- mediumspringgreen: "#00fa9a",
344
- mediumturquoise: "#48d1cc",
345
- mediumvioletred: "#c71585",
346
- midnightblue: "#191970",
347
- mintcream: "#f5fffa",
348
- mistyrose: "#ffe4e1",
349
- moccasin: "#ffe4b5",
350
- navajowhite: "#ffdead",
351
- navy: "#000080",
352
- oldlace: "#fdf5e6",
353
- olive: "#808000",
354
- olivedrab: "#6b8e23",
355
- orange: "#ffa500",
356
- orangered: "#ff4500",
357
- orchid: "#da70d6",
358
- palegoldenrod: "#eee8aa",
359
- palegreen: "#98fb98",
360
- paleturquoise: "#afeeee",
361
- palevioletred: "#db7093",
362
- papayawhip: "#ffefd5",
363
- peachpuff: "#ffdab9",
364
- peru: "#cd853f",
365
- pink: "#ffc0cb",
366
- plum: "#dda0dd",
367
- powderblue: "#b0e0e6",
368
- purple: "#800080",
369
- rebeccapurple: "#663399",
370
- red: "#ff0000",
371
- rosybrown: "#bc8f8f",
372
- royalblue: "#4169e1",
373
- saddlebrown: "#8b4513",
374
- salmon: "#fa8072",
375
- sandybrown: "#f4a460",
376
- seagreen: "#2e8b57",
377
- seashell: "#fff5ee",
378
- sienna: "#a0522d",
379
- silver: "#c0c0c0",
380
- skyblue: "#87ceeb",
381
- slateblue: "#6a5acd",
382
- slategray: "#708090",
383
- slategrey: "#708090",
384
- snow: "#fffafa",
385
- springgreen: "#00ff7f",
386
- steelblue: "#4682b4",
387
- tan: "#d2b48c",
388
- teal: "#008080",
389
- thistle: "#d8bfd8",
390
- tomato: "#ff6347",
391
- turquoise: "#40e0d0",
392
- violet: "#ee82ee",
393
- wheat: "#f5deb3",
394
- white: "#ffffff",
395
- whitesmoke: "#f5f5f5",
396
- yellow: "#ffff00",
397
- yellowgreen: "#9acd32"
398
- };
399
- function Ct(e) {
400
- var t = { r: 0, g: 0, b: 0 }, n = 1, a = null, i = null, r = null, o = !1, l = !1;
401
- return typeof e == "string" && (e = zt(e)), typeof e == "object" && (O(e.r) && O(e.g) && O(e.b) ? (t = wt(e.r, e.g, e.b), o = !0, l = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : O(e.h) && O(e.s) && O(e.v) ? (a = se(e.s), i = se(e.v), t = xt(e.h, a, i), o = !0, l = "hsv") : O(e.h) && O(e.s) && O(e.l) && (a = se(e.s), r = se(e.l), t = St(e.h, a, r), o = !0, l = "hsl"), Object.prototype.hasOwnProperty.call(e, "a") && (n = e.a)), n = Ue(n), {
402
- ok: o,
403
- format: e.format || l,
404
- r: Math.min(255, Math.max(t.r, 0)),
405
- g: Math.min(255, Math.max(t.g, 0)),
406
- b: Math.min(255, Math.max(t.b, 0)),
407
- a: n
408
- };
409
- }
410
- var Tt = "[-\\+]?\\d+%?", kt = "[-\\+]?\\d*\\.\\d+%?", N = "(?:".concat(kt, ")|(?:").concat(Tt, ")"), ye = "[\\s|\\(]+(".concat(N, ")[,|\\s]+(").concat(N, ")[,|\\s]+(").concat(N, ")\\s*\\)?"), we = "[\\s|\\(]+(".concat(N, ")[,|\\s]+(").concat(N, ")[,|\\s]+(").concat(N, ")[,|\\s]+(").concat(N, ")\\s*\\)?"), T = {
411
- CSS_UNIT: new RegExp(N),
412
- rgb: new RegExp("rgb" + ye),
413
- rgba: new RegExp("rgba" + we),
414
- hsl: new RegExp("hsl" + ye),
415
- hsla: new RegExp("hsla" + we),
416
- hsv: new RegExp("hsv" + ye),
417
- hsva: new RegExp("hsva" + we),
418
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
419
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
420
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
421
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
422
- };
423
- function zt(e) {
424
- if (e = e.trim().toLowerCase(), e.length === 0)
425
- return !1;
426
- var t = !1;
427
- if (Ae[e])
428
- e = Ae[e], t = !0;
429
- else if (e === "transparent")
430
- return { r: 0, g: 0, b: 0, a: 0, format: "name" };
431
- var n = T.rgb.exec(e);
432
- return n ? { r: n[1], g: n[2], b: n[3] } : (n = T.rgba.exec(e), n ? { r: n[1], g: n[2], b: n[3], a: n[4] } : (n = T.hsl.exec(e), n ? { h: n[1], s: n[2], l: n[3] } : (n = T.hsla.exec(e), n ? { h: n[1], s: n[2], l: n[3], a: n[4] } : (n = T.hsv.exec(e), n ? { h: n[1], s: n[2], v: n[3] } : (n = T.hsva.exec(e), n ? { h: n[1], s: n[2], v: n[3], a: n[4] } : (n = T.hex8.exec(e), n ? {
433
- r: w(n[1]),
434
- g: w(n[2]),
435
- b: w(n[3]),
436
- a: Pe(n[4]),
437
- format: t ? "name" : "hex8"
438
- } : (n = T.hex6.exec(e), n ? {
439
- r: w(n[1]),
440
- g: w(n[2]),
441
- b: w(n[3]),
442
- format: t ? "name" : "hex"
443
- } : (n = T.hex4.exec(e), n ? {
444
- r: w(n[1] + n[1]),
445
- g: w(n[2] + n[2]),
446
- b: w(n[3] + n[3]),
447
- a: Pe(n[4] + n[4]),
448
- format: t ? "name" : "hex8"
449
- } : (n = T.hex3.exec(e), n ? {
450
- r: w(n[1] + n[1]),
451
- g: w(n[2] + n[2]),
452
- b: w(n[3] + n[3]),
453
- format: t ? "name" : "hex"
454
- } : !1)))))))));
102
+ function Et(e, t) {
103
+ process.env.NODE_ENV !== "production" && !e && console !== void 0 && console.error(`Warning: ${t}`);
455
104
  }
456
- function O(e) {
457
- return !!T.CSS_UNIT.exec(String(e));
458
- }
459
- var Q = (
460
- /** @class */
461
- function() {
462
- function e(t, n) {
463
- t === void 0 && (t = ""), n === void 0 && (n = {});
464
- var a;
465
- if (t instanceof e)
466
- return t;
467
- typeof t == "number" && (t = At(t)), this.originalInput = t;
468
- var i = Ct(t);
469
- 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;
470
- }
471
- return e.prototype.isDark = function() {
472
- return this.getBrightness() < 128;
473
- }, e.prototype.isLight = function() {
474
- return !this.isDark();
475
- }, e.prototype.getBrightness = function() {
476
- var t = this.toRgb();
477
- return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
478
- }, e.prototype.getLuminance = function() {
479
- var t = this.toRgb(), n, a, i, r = t.r / 255, o = t.g / 255, l = t.b / 255;
480
- return r <= 0.03928 ? n = r / 12.92 : n = Math.pow((r + 0.055) / 1.055, 2.4), o <= 0.03928 ? a = o / 12.92 : a = Math.pow((o + 0.055) / 1.055, 2.4), l <= 0.03928 ? i = l / 12.92 : i = Math.pow((l + 0.055) / 1.055, 2.4), 0.2126 * n + 0.7152 * a + 0.0722 * i;
481
- }, e.prototype.getAlpha = function() {
482
- return this.a;
483
- }, e.prototype.setAlpha = function(t) {
484
- return this.a = Ue(t), this.roundA = Math.round(100 * this.a) / 100, this;
485
- }, e.prototype.isMonochrome = function() {
486
- var t = this.toHsl().s;
487
- return t === 0;
488
- }, e.prototype.toHsv = function() {
489
- var t = De(this.r, this.g, this.b);
490
- return { h: t.h * 360, s: t.s, v: t.v, a: this.a };
491
- }, e.prototype.toHsvString = function() {
492
- var t = De(this.r, this.g, this.b), n = Math.round(t.h * 360), a = Math.round(t.s * 100), i = Math.round(t.v * 100);
493
- return this.a === 1 ? "hsv(".concat(n, ", ").concat(a, "%, ").concat(i, "%)") : "hsva(".concat(n, ", ").concat(a, "%, ").concat(i, "%, ").concat(this.roundA, ")");
494
- }, e.prototype.toHsl = function() {
495
- var t = Re(this.r, this.g, this.b);
496
- return { h: t.h * 360, s: t.s, l: t.l, a: this.a };
497
- }, e.prototype.toHslString = function() {
498
- var t = Re(this.r, this.g, this.b), n = Math.round(t.h * 360), a = Math.round(t.s * 100), i = Math.round(t.l * 100);
499
- return this.a === 1 ? "hsl(".concat(n, ", ").concat(a, "%, ").concat(i, "%)") : "hsla(".concat(n, ", ").concat(a, "%, ").concat(i, "%, ").concat(this.roundA, ")");
500
- }, e.prototype.toHex = function(t) {
501
- return t === void 0 && (t = !1), He(this.r, this.g, this.b, t);
502
- }, e.prototype.toHexString = function(t) {
503
- return t === void 0 && (t = !1), "#" + this.toHex(t);
504
- }, e.prototype.toHex8 = function(t) {
505
- return t === void 0 && (t = !1), Mt(this.r, this.g, this.b, this.a, t);
506
- }, e.prototype.toHex8String = function(t) {
507
- return t === void 0 && (t = !1), "#" + this.toHex8(t);
508
- }, e.prototype.toHexShortString = function(t) {
509
- return t === void 0 && (t = !1), this.a === 1 ? this.toHexString(t) : this.toHex8String(t);
510
- }, e.prototype.toRgb = function() {
511
- return {
512
- r: Math.round(this.r),
513
- g: Math.round(this.g),
514
- b: Math.round(this.b),
515
- a: this.a
516
- };
517
- }, e.prototype.toRgbString = function() {
518
- var t = Math.round(this.r), n = Math.round(this.g), a = Math.round(this.b);
519
- return this.a === 1 ? "rgb(".concat(t, ", ").concat(n, ", ").concat(a, ")") : "rgba(".concat(t, ", ").concat(n, ", ").concat(a, ", ").concat(this.roundA, ")");
520
- }, e.prototype.toPercentageRgb = function() {
521
- var t = function(n) {
522
- return "".concat(Math.round(v(n, 255) * 100), "%");
523
- };
524
- return {
525
- r: t(this.r),
526
- g: t(this.g),
527
- b: t(this.b),
528
- a: this.a
529
- };
530
- }, e.prototype.toPercentageRgbString = function() {
531
- var t = function(n) {
532
- return Math.round(v(n, 255) * 100);
533
- };
534
- 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, ")");
535
- }, e.prototype.toName = function() {
536
- if (this.a === 0)
537
- return "transparent";
538
- if (this.a < 1)
539
- return !1;
540
- for (var t = "#" + He(this.r, this.g, this.b, !1), n = 0, a = Object.entries(Ae); n < a.length; n++) {
541
- var i = a[n], r = i[0], o = i[1];
542
- if (t === o)
543
- return r;
544
- }
545
- return !1;
546
- }, e.prototype.toString = function(t) {
547
- var n = !!t;
548
- t = t ?? this.format;
549
- var a = !1, i = this.a < 1 && this.a >= 0, r = !n && i && (t.startsWith("hex") || t === "name");
550
- return r ? 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());
551
- }, e.prototype.toNumber = function() {
552
- return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
553
- }, e.prototype.clone = function() {
554
- return new e(this.toString());
555
- }, e.prototype.lighten = function(t) {
556
- t === void 0 && (t = 10);
557
- var n = this.toHsl();
558
- return n.l += t / 100, n.l = oe(n.l), new e(n);
559
- }, e.prototype.brighten = function(t) {
560
- t === void 0 && (t = 10);
561
- var n = this.toRgb();
562
- 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);
563
- }, e.prototype.darken = function(t) {
564
- t === void 0 && (t = 10);
565
- var n = this.toHsl();
566
- return n.l -= t / 100, n.l = oe(n.l), new e(n);
567
- }, e.prototype.tint = function(t) {
568
- return t === void 0 && (t = 10), this.mix("white", t);
569
- }, e.prototype.shade = function(t) {
570
- return t === void 0 && (t = 10), this.mix("black", t);
571
- }, e.prototype.desaturate = function(t) {
572
- t === void 0 && (t = 10);
573
- var n = this.toHsl();
574
- return n.s -= t / 100, n.s = oe(n.s), new e(n);
575
- }, e.prototype.saturate = function(t) {
576
- t === void 0 && (t = 10);
577
- var n = this.toHsl();
578
- return n.s += t / 100, n.s = oe(n.s), new e(n);
579
- }, e.prototype.greyscale = function() {
580
- return this.desaturate(100);
581
- }, e.prototype.spin = function(t) {
582
- var n = this.toHsl(), a = (n.h + t) % 360;
583
- return n.h = a < 0 ? 360 + a : a, new e(n);
584
- }, e.prototype.mix = function(t, n) {
585
- n === void 0 && (n = 50);
586
- var a = this.toRgb(), i = new e(t).toRgb(), r = n / 100, o = {
587
- r: (i.r - a.r) * r + a.r,
588
- g: (i.g - a.g) * r + a.g,
589
- b: (i.b - a.b) * r + a.b,
590
- a: (i.a - a.a) * r + a.a
591
- };
592
- return new e(o);
593
- }, e.prototype.analogous = function(t, n) {
594
- t === void 0 && (t = 6), n === void 0 && (n = 30);
595
- var a = this.toHsl(), i = 360 / n, r = [this];
596
- for (a.h = (a.h - (i * t >> 1) + 720) % 360; --t; )
597
- a.h = (a.h + i) % 360, r.push(new e(a));
598
- return r;
599
- }, e.prototype.complement = function() {
600
- var t = this.toHsl();
601
- return t.h = (t.h + 180) % 360, new e(t);
602
- }, e.prototype.monochromatic = function(t) {
603
- t === void 0 && (t = 6);
604
- for (var n = this.toHsv(), a = n.h, i = n.s, r = n.v, o = [], l = 1 / t; t--; )
605
- o.push(new e({ h: a, s: i, v: r })), r = (r + l) % 1;
606
- return o;
607
- }, e.prototype.splitcomplement = function() {
608
- var t = this.toHsl(), n = t.h;
609
- return [
610
- this,
611
- new e({ h: (n + 72) % 360, s: t.s, l: t.l }),
612
- new e({ h: (n + 216) % 360, s: t.s, l: t.l })
613
- ];
614
- }, e.prototype.onBackground = function(t) {
615
- var n = this.toRgb(), a = new e(t).toRgb(), i = n.a + a.a * (1 - n.a);
616
- return new e({
617
- r: (n.r * n.a + a.r * a.a * (1 - n.a)) / i,
618
- g: (n.g * n.a + a.g * a.a * (1 - n.a)) / i,
619
- b: (n.b * n.a + a.b * a.a * (1 - n.a)) / i,
620
- a: i
621
- });
622
- }, e.prototype.triad = function() {
623
- return this.polyad(3);
624
- }, e.prototype.tetrad = function() {
625
- return this.polyad(4);
626
- }, e.prototype.polyad = function(t) {
627
- for (var n = this.toHsl(), a = n.h, i = [this], r = 360 / t, o = 1; o < t; o++)
628
- i.push(new e({ h: (a + o * r) % 360, s: n.s, l: n.l }));
629
- return i;
630
- }, e.prototype.equals = function(t) {
631
- return this.toRgbString() === new e(t).toRgbString();
632
- }, e;
633
- }()
634
- );
635
- const Ot = new fe("viewFadeIn", {
105
+ const Ct = new ue("viewFadeIn", {
636
106
  "0%": {
637
107
  opacity: 0
638
108
  },
639
109
  "100%": {
640
110
  opacity: 1
641
111
  }
642
- }), Lt = new fe("viewFadeOut", {
112
+ }), yt = new ue("viewFadeOut", {
643
113
  "0%": {
644
114
  opacity: 1
645
115
  },
646
116
  "100%": {
647
117
  opacity: 0
648
118
  }
649
- }), Nt = new fe("viewZoomBadgeIn", {
119
+ }), Mt = new ue("viewZoomBadgeIn", {
650
120
  "0%": {
651
121
  transform: "scale(0.2)",
652
122
  opacity: 0
@@ -655,7 +125,7 @@ const Ot = new fe("viewFadeIn", {
655
125
  transform: "scale(1)",
656
126
  opacity: 1
657
127
  }
658
- }), Et = new fe("viewZoomBadgeOut", {
128
+ }), Nt = new ue("viewZoomBadgeOut", {
659
129
  "0%": {
660
130
  transform: "scale(1)"
661
131
  },
@@ -663,11 +133,11 @@ const Ot = new fe("viewFadeIn", {
663
133
  transform: "scale(0.2)",
664
134
  opacity: 0
665
135
  }
666
- }), Fe = (e) => ({
136
+ }), be = (e) => ({
667
137
  position: e || "absolute",
668
138
  inset: 0
669
139
  });
670
- function Se(e) {
140
+ function me(e) {
671
141
  return {
672
142
  position: e,
673
143
  top: 0,
@@ -676,143 +146,149 @@ function Se(e) {
676
146
  insetInlineStart: 0
677
147
  };
678
148
  }
679
- const $t = (e) => ({
680
- boxSizing: "border-box",
681
- margin: 0,
682
- padding: 0,
683
- color: e.colorText,
684
- fontSize: e.fontSize,
685
- lineHeight: e.lineHeight,
686
- listStyle: "none",
687
- fontFamily: e.fontFamily
688
- }), Rt = (e) => {
689
- const { componentCls: t, modalMaskBg: n, paddingSM: a, previewOperationColorDisabled: i, motionDurationSlow: r } = e, o = new Q(n).setAlpha(0.1), l = o.clone().setAlpha(0.2);
149
+ const Ot = (e) => {
150
+ const { previewCls: t, modalMaskBg: i, paddingSM: l, marginXL: o, margin: f, paddingLG: c, previewOperationColorDisabled: d, previewOperationHoverColor: p, motionDurationSlow: m, iconCls: h, colorTextLightSolid: C } = e, v = new K(i).setAlpha(0.1), u = v.clone().setAlpha(0.2);
690
151
  return {
691
- [`${t}-operations`]: {
692
- ...$t(e),
152
+ [`${t}-footer`]: {
153
+ position: "fixed",
154
+ bottom: o,
155
+ left: {
156
+ _skip_check_: !0,
157
+ value: "50%"
158
+ },
693
159
  display: "flex",
694
- flexDirection: "row-reverse",
160
+ flexDirection: "column",
695
161
  alignItems: "center",
696
162
  color: e.previewOperationColor,
697
- listStyle: "none",
698
- background: o.toRgbString(),
699
- pointerEvents: "auto",
163
+ transform: "translateX(-50%)"
164
+ },
165
+ [`${t}-progress`]: {
166
+ marginBottom: f
167
+ },
168
+ [`${t}-close`]: {
169
+ position: "fixed",
170
+ top: o,
171
+ right: {
172
+ _skip_check_: !0,
173
+ value: o
174
+ },
175
+ display: "flex",
176
+ color: C,
177
+ backgroundColor: v.toRgbString(),
178
+ borderRadius: "50%",
179
+ padding: l,
180
+ outline: 0,
181
+ border: 0,
182
+ cursor: "pointer",
183
+ transition: `all ${m}`,
184
+ "&:hover": {
185
+ backgroundColor: u.toRgbString()
186
+ },
187
+ [`& > ${h}`]: {
188
+ fontSize: e.previewOperationSize
189
+ }
190
+ },
191
+ [`${t}-operations`]: {
192
+ display: "flex",
193
+ alignItems: "center",
194
+ padding: `0 ${ht(c)}`,
195
+ backgroundColor: v.toRgbString(),
196
+ borderRadius: 100,
700
197
  "&-operation": {
701
- marginInlineStart: a,
702
- padding: a,
198
+ marginInlineStart: l,
199
+ padding: l,
703
200
  cursor: "pointer",
704
- transition: `all ${r}`,
201
+ transition: `all ${m}`,
705
202
  userSelect: "none",
706
- "&:hover": {
707
- background: l.toRgbString()
203
+ [`&:not(${t}-operations-operation-disabled):hover > ${h}`]: {
204
+ color: p
708
205
  },
709
206
  "&-disabled": {
710
- color: i,
711
- pointerEvents: "none"
207
+ color: d,
208
+ cursor: "not-allowed"
712
209
  },
713
- "&:last-of-type": {
210
+ "&:first-of-type": {
714
211
  marginInlineStart: 0
212
+ },
213
+ [`& > ${h}`]: {
214
+ fontSize: e.previewOperationSize
715
215
  }
716
- },
717
- "&-progress": {
718
- position: "absolute",
719
- left: { _skip_check_: !0, value: "50%" },
720
- transform: "translateX(-50%)"
721
- },
722
- "&-icon": {
723
- fontSize: e.previewOperationSize
724
216
  }
725
217
  }
726
218
  };
727
- }, Dt = (e) => {
728
- const { modalMaskBg: t, previewOperationColorDisabled: n, zIndexPopup: a, motionDurationSlow: i } = e, r = new Q(t).setAlpha(0.1), o = r.clone().setAlpha(0.2);
219
+ }, At = (e) => {
220
+ const { modalMaskBg: t, iconCls: i, previewOperationColorDisabled: l, previewCls: o, zIndexPopup: f, motionDurationSlow: c } = e, d = new K(t).setAlpha(0.1), p = d.clone().setAlpha(0.2);
729
221
  return {
730
- [`${e.componentCls}-switch-left, ${e.componentCls}-switch-right`]: {
222
+ [`${o}-switch-left, ${o}-switch-right`]: {
731
223
  position: "fixed",
732
224
  insetBlockStart: "50%",
733
- zIndex: a + 1,
225
+ zIndex: e.calc(f).add(1).equal(),
734
226
  display: "flex",
735
227
  alignItems: "center",
736
228
  justifyContent: "center",
737
229
  width: e.imagePreviewSwitchSize,
738
230
  height: e.imagePreviewSwitchSize,
739
- marginTop: -e.imagePreviewSwitchSize / 2,
231
+ marginTop: e.calc(e.imagePreviewSwitchSize).mul(-1).div(2).equal(),
740
232
  color: e.previewOperationColor,
741
- background: r.toRgbString(),
233
+ background: d.toRgbString(),
742
234
  borderRadius: "50%",
743
235
  transform: "translateY(-50%)",
744
236
  cursor: "pointer",
745
- transition: `all ${i}`,
746
- pointerEvents: "auto",
237
+ transition: `all ${c}`,
747
238
  userSelect: "none",
748
239
  "&:hover": {
749
- background: o.toRgbString()
240
+ background: p.toRgbString()
750
241
  },
751
242
  "&-disabled": {
752
243
  "&, &:hover": {
753
- color: n,
244
+ color: l,
754
245
  background: "transparent",
755
246
  cursor: "not-allowed",
756
- [`> ${e.iconCls}`]: {
247
+ [`> ${i}`]: {
757
248
  cursor: "not-allowed"
758
249
  }
759
250
  }
760
251
  },
761
- [`> ${e.iconCls}`]: {
252
+ [`> ${i}`]: {
762
253
  fontSize: e.previewOperationSize
763
254
  }
764
255
  },
765
- [`${e.componentCls}-switch-left`]: {
256
+ [`${o}-switch-left`]: {
766
257
  insetInlineStart: e.marginSM
767
258
  },
768
- [`${e.componentCls}-switch-right`]: {
259
+ [`${o}-switch-right`]: {
769
260
  insetInlineEnd: e.marginSM
770
261
  }
771
262
  };
772
- }, Ht = (e) => ({
263
+ }, xt = (e) => ({
773
264
  [e.componentCls]: {
265
+ height: "100%",
266
+ textAlign: "center",
267
+ pointerEvents: "none",
774
268
  "&-root": {
775
- ...Se("fixed"),
269
+ ...me("fixed"),
776
270
  zIndex: e.zIndexPopup,
777
271
  overflow: "auto",
778
272
  outline: 0,
779
273
  WebkitOverflowScrolling: "touch"
780
274
  },
781
- "&-wrapper": {
782
- ...Se("fixed"),
275
+ "&-wrap": {
276
+ ...me("fixed"),
783
277
  zIndex: e.zIndexPopup,
784
278
  overflow: "auto",
785
279
  outline: 0,
786
280
  WebkitOverflowScrolling: "touch"
787
281
  },
788
282
  "&-mask": {
789
- ...Se("fixed"),
283
+ ...me("fixed"),
790
284
  zIndex: e.zIndexPopupBase,
791
285
  height: "100%",
792
286
  backgroundColor: e.colorBgMask
793
287
  },
794
- "&-block": {
795
- height: "100%",
796
- textAlign: "center",
797
- pointerEvents: "none"
798
- },
799
288
  "&-body": {
800
- ...Fe(),
289
+ ...be(),
801
290
  overflow: "hidden"
802
291
  },
803
- "&-canvas": {
804
- ...Fe(),
805
- display: "flex",
806
- justifyContent: "center",
807
- alignItems: "center",
808
- "&::before": {
809
- display: "inline-block",
810
- width: 1,
811
- height: "50%",
812
- marginInlineEnd: -1,
813
- content: '""'
814
- }
815
- },
816
292
  "&-img": {
817
293
  maxWidth: "100%",
818
294
  maxHeight: "100%",
@@ -821,20 +297,34 @@ const $t = (e) => ({
821
297
  cursor: "grab",
822
298
  transition: `transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,
823
299
  userSelect: "none",
824
- pointerEvents: "auto"
300
+ pointerEvents: "auto",
301
+ "&-wrapper": {
302
+ ...be(),
303
+ display: "flex",
304
+ justifyContent: "center",
305
+ alignItems: "center",
306
+ transition: `transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,
307
+ "&::before": {
308
+ display: "inline-block",
309
+ width: 1,
310
+ height: "50%",
311
+ marginInlineEnd: -1,
312
+ content: '""'
313
+ }
314
+ }
825
315
  },
826
316
  "&-fade-appear, &-fade-enter": {
827
- animationName: Ot,
317
+ animationName: Ct,
828
318
  animationDuration: e.motionDurationSlow,
829
319
  animationTimingFunction: "linear"
830
320
  },
831
321
  "&-fade-leave": {
832
- animationName: Lt,
322
+ animationName: yt,
833
323
  animationDuration: e.motionDurationSlow,
834
324
  animationTimingFunction: "linear"
835
325
  },
836
326
  "&-zoom-appear, &-zoom-enter": {
837
- animationName: Nt,
327
+ animationName: Mt,
838
328
  opacity: 0,
839
329
  animationTimingFunction: e.motionEaseOutCirc,
840
330
  animationFillMode: "both",
@@ -846,7 +336,7 @@ const $t = (e) => ({
846
336
  animationPlayState: "running"
847
337
  },
848
338
  "&-zoom-leave": {
849
- animationName: Et,
339
+ animationName: Nt,
850
340
  animationDuration: e.motionDurationSlow,
851
341
  animationTimingFunction: e.motionEaseOutBack,
852
342
  animationFillMode: "both"
@@ -864,339 +354,1003 @@ const $t = (e) => ({
864
354
  zIndex: e.zIndexPopup + 1,
865
355
  width: "100%"
866
356
  },
867
- "&": [Rt(e), Dt(e)]
357
+ "&": [Ot(e), At(e)]
868
358
  });
869
- function Pt(e) {
870
- return ht("ImageView", (t) => {
871
- const n = gt(t, {
359
+ function Lt(e) {
360
+ return wt("ImageViewer", (t) => {
361
+ const i = St(t, {
872
362
  zIndexPopup: t.zIndexPopupBase + 80,
873
- previewOperationColorDisabled: new Q(t.colorTextLightSolid).setAlpha(0.25).toRgbString(),
874
- modalMaskBg: new Q("#000").setAlpha(0.45).toRgbString(),
363
+ previewOperationColorDisabled: new K(t.colorTextLightSolid).setAlpha(0.25).toRgbString(),
364
+ previewOperationHoverColor: new K(t.colorTextLightSolid).setAlpha(0.85).toRgbString(),
365
+ modalMaskBg: new K("#000").setAlpha(0.45).toRgbString(),
875
366
  // FIXME: Shared Token
876
- previewOperationColor: new Q(t.colorTextLightSolid).toRgbString(),
367
+ previewOperationColor: new K(t.colorTextLightSolid).toRgbString(),
877
368
  previewOperationSize: t.fontSizeIcon * 1.5,
878
369
  // FIXME: fontSizeIconLG
879
370
  imagePreviewSwitchSize: t.controlHeightLG,
880
- iconCls: "anticon"
371
+ iconCls: "anticon",
372
+ previewCls: t.componentCls
881
373
  });
882
- return [Ht(n)];
374
+ return [xt(i)];
883
375
  }, e);
884
376
  }
885
- const Y = {
886
- tab: "Tab",
887
- enter: "Enter",
888
- space: "Space",
889
- left: "ArrowLeft",
890
- // 37
891
- up: "ArrowUp",
892
- // 38
893
- right: "ArrowRight",
894
- // 39
895
- down: "ArrowDown",
896
- // 40
897
- esc: "Escape",
898
- delete: "Delete",
899
- backspace: "Backspace"
900
- }, le = function(e, t, n, a = !1) {
901
- e && t && n && e.addEventListener(t, n, a);
902
- }, xe = function(e, t, n, a = !1) {
903
- e && t && n && e.removeEventListener(t, n, a);
904
- }, X = {
905
- CONTAIN: {
906
- name: "contain",
907
- icon: f(Ke, null, null)
377
+ function Tt(e) {
378
+ const t = e.getBoundingClientRect(), i = document.documentElement;
379
+ return {
380
+ left: t.left + (window.scrollX || i.scrollLeft) - (i.clientLeft || document.body.clientLeft || 0),
381
+ top: t.top + (window.scrollY || i.scrollTop) - (i.clientTop || document.body.clientTop || 0)
382
+ };
383
+ }
384
+ function bt() {
385
+ const e = document.documentElement.clientWidth, t = window.innerHeight || document.documentElement.clientHeight;
386
+ return {
387
+ width: e,
388
+ height: t
389
+ };
390
+ }
391
+ function Pe(e, t, i, l) {
392
+ const o = t + i, f = (i - l) / 2;
393
+ if (i > l) {
394
+ if (t > 0)
395
+ return {
396
+ [e]: f
397
+ };
398
+ if (t < 0 && o < l)
399
+ return {
400
+ [e]: -f
401
+ };
402
+ } else if (t < 0 || o > l)
403
+ return {
404
+ [e]: t < 0 ? f : -f
405
+ };
406
+ return {};
407
+ }
408
+ function Pt(e, t, i, l) {
409
+ const { width: o, height: f } = bt();
410
+ let c = null;
411
+ return e <= o && t <= f ? c = {
412
+ x: 0,
413
+ y: 0
414
+ } : (e > o || t > f) && (c = {
415
+ ...Pe("x", i, e, o),
416
+ ...Pe("y", l, t, f)
417
+ }), c;
418
+ }
419
+ let Be = !1;
420
+ try {
421
+ const e = Object.defineProperty({}, "passive", {
422
+ get() {
423
+ Be = !0;
424
+ }
425
+ });
426
+ window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e);
427
+ } catch {
428
+ }
429
+ function B(e, t, i, l) {
430
+ if (e && e.addEventListener) {
431
+ let o = l;
432
+ o === void 0 && Be && (t === "touchstart" || t === "touchmove" || t === "wheel") && (o = { passive: !1 }), e.addEventListener(t, i, o);
433
+ }
434
+ return {
435
+ remove: () => {
436
+ e && e.removeEventListener && e.removeEventListener(t, i);
437
+ }
438
+ };
439
+ }
440
+ const a = {
441
+ /**
442
+ * MAC_ENTER
443
+ */
444
+ MAC_ENTER: 3,
445
+ /**
446
+ * BACKSPACE
447
+ */
448
+ BACKSPACE: 8,
449
+ /**
450
+ * TAB
451
+ */
452
+ TAB: 9,
453
+ /**
454
+ * NUMLOCK on FF/Safari Mac
455
+ */
456
+ NUM_CENTER: 12,
457
+ // NUMLOCK on FF/Safari Mac
458
+ /**
459
+ * ENTER
460
+ */
461
+ ENTER: 13,
462
+ /**
463
+ * SHIFT
464
+ */
465
+ SHIFT: 16,
466
+ /**
467
+ * CTRL
468
+ */
469
+ CTRL: 17,
470
+ /**
471
+ * ALT
472
+ */
473
+ ALT: 18,
474
+ /**
475
+ * PAUSE
476
+ */
477
+ PAUSE: 19,
478
+ /**
479
+ * CAPS_LOCK
480
+ */
481
+ CAPS_LOCK: 20,
482
+ /**
483
+ * ESC
484
+ */
485
+ ESC: 27,
486
+ /**
487
+ * SPACE
488
+ */
489
+ SPACE: 32,
490
+ /**
491
+ * PAGE_UP
492
+ */
493
+ PAGE_UP: 33,
494
+ // also NUM_NORTH_EAST
495
+ /**
496
+ * PAGE_DOWN
497
+ */
498
+ PAGE_DOWN: 34,
499
+ // also NUM_SOUTH_EAST
500
+ /**
501
+ * END
502
+ */
503
+ END: 35,
504
+ // also NUM_SOUTH_WEST
505
+ /**
506
+ * HOME
507
+ */
508
+ HOME: 36,
509
+ // also NUM_NORTH_WEST
510
+ /**
511
+ * LEFT
512
+ */
513
+ LEFT: 37,
514
+ // also NUM_WEST
515
+ /**
516
+ * UP
517
+ */
518
+ UP: 38,
519
+ // also NUM_NORTH
520
+ /**
521
+ * RIGHT
522
+ */
523
+ RIGHT: 39,
524
+ // also NUM_EAST
525
+ /**
526
+ * DOWN
527
+ */
528
+ DOWN: 40,
529
+ // also NUM_SOUTH
530
+ /**
531
+ * PRINT_SCREEN
532
+ */
533
+ PRINT_SCREEN: 44,
534
+ /**
535
+ * INSERT
536
+ */
537
+ INSERT: 45,
538
+ // also NUM_INSERT
539
+ /**
540
+ * DELETE
541
+ */
542
+ DELETE: 46,
543
+ // also NUM_DELETE
544
+ /**
545
+ * ZERO
546
+ */
547
+ ZERO: 48,
548
+ /**
549
+ * ONE
550
+ */
551
+ ONE: 49,
552
+ /**
553
+ * TWO
554
+ */
555
+ TWO: 50,
556
+ /**
557
+ * THREE
558
+ */
559
+ THREE: 51,
560
+ /**
561
+ * FOUR
562
+ */
563
+ FOUR: 52,
564
+ /**
565
+ * FIVE
566
+ */
567
+ FIVE: 53,
568
+ /**
569
+ * SIX
570
+ */
571
+ SIX: 54,
572
+ /**
573
+ * SEVEN
574
+ */
575
+ SEVEN: 55,
576
+ /**
577
+ * EIGHT
578
+ */
579
+ EIGHT: 56,
580
+ /**
581
+ * NINE
582
+ */
583
+ NINE: 57,
584
+ /**
585
+ * QUESTION_MARK
586
+ */
587
+ QUESTION_MARK: 63,
588
+ // needs localization
589
+ /**
590
+ * A
591
+ */
592
+ A: 65,
593
+ /**
594
+ * B
595
+ */
596
+ B: 66,
597
+ /**
598
+ * C
599
+ */
600
+ C: 67,
601
+ /**
602
+ * D
603
+ */
604
+ D: 68,
605
+ /**
606
+ * E
607
+ */
608
+ E: 69,
609
+ /**
610
+ * F
611
+ */
612
+ F: 70,
613
+ /**
614
+ * G
615
+ */
616
+ G: 71,
617
+ /**
618
+ * H
619
+ */
620
+ H: 72,
621
+ /**
622
+ * I
623
+ */
624
+ I: 73,
625
+ /**
626
+ * J
627
+ */
628
+ J: 74,
629
+ /**
630
+ * K
631
+ */
632
+ K: 75,
633
+ /**
634
+ * L
635
+ */
636
+ L: 76,
637
+ /**
638
+ * M
639
+ */
640
+ M: 77,
641
+ /**
642
+ * N
643
+ */
644
+ N: 78,
645
+ /**
646
+ * O
647
+ */
648
+ O: 79,
649
+ /**
650
+ * P
651
+ */
652
+ P: 80,
653
+ /**
654
+ * Q
655
+ */
656
+ Q: 81,
657
+ /**
658
+ * R
659
+ */
660
+ R: 82,
661
+ /**
662
+ * S
663
+ */
664
+ S: 83,
665
+ /**
666
+ * T
667
+ */
668
+ T: 84,
669
+ /**
670
+ * U
671
+ */
672
+ U: 85,
673
+ /**
674
+ * V
675
+ */
676
+ V: 86,
677
+ /**
678
+ * W
679
+ */
680
+ W: 87,
681
+ /**
682
+ * X
683
+ */
684
+ X: 88,
685
+ /**
686
+ * Y
687
+ */
688
+ Y: 89,
689
+ /**
690
+ * Z
691
+ */
692
+ Z: 90,
693
+ /**
694
+ * META
695
+ */
696
+ META: 91,
697
+ // WIN_KEY_LEFT
698
+ /**
699
+ * WIN_KEY_RIGHT
700
+ */
701
+ WIN_KEY_RIGHT: 92,
702
+ /**
703
+ * CONTEXT_MENU
704
+ */
705
+ CONTEXT_MENU: 93,
706
+ /**
707
+ * NUM_ZERO
708
+ */
709
+ NUM_ZERO: 96,
710
+ /**
711
+ * NUM_ONE
712
+ */
713
+ NUM_ONE: 97,
714
+ /**
715
+ * NUM_TWO
716
+ */
717
+ NUM_TWO: 98,
718
+ /**
719
+ * NUM_THREE
720
+ */
721
+ NUM_THREE: 99,
722
+ /**
723
+ * NUM_FOUR
724
+ */
725
+ NUM_FOUR: 100,
726
+ /**
727
+ * NUM_FIVE
728
+ */
729
+ NUM_FIVE: 101,
730
+ /**
731
+ * NUM_SIX
732
+ */
733
+ NUM_SIX: 102,
734
+ /**
735
+ * NUM_SEVEN
736
+ */
737
+ NUM_SEVEN: 103,
738
+ /**
739
+ * NUM_EIGHT
740
+ */
741
+ NUM_EIGHT: 104,
742
+ /**
743
+ * NUM_NINE
744
+ */
745
+ NUM_NINE: 105,
746
+ /**
747
+ * NUM_MULTIPLY
748
+ */
749
+ NUM_MULTIPLY: 106,
750
+ /**
751
+ * NUM_PLUS
752
+ */
753
+ NUM_PLUS: 107,
754
+ /**
755
+ * NUM_MINUS
756
+ */
757
+ NUM_MINUS: 109,
758
+ /**
759
+ * NUM_PERIOD
760
+ */
761
+ NUM_PERIOD: 110,
762
+ /**
763
+ * NUM_DIVISION
764
+ */
765
+ NUM_DIVISION: 111,
766
+ /**
767
+ * F1
768
+ */
769
+ F1: 112,
770
+ /**
771
+ * F2
772
+ */
773
+ F2: 113,
774
+ /**
775
+ * F3
776
+ */
777
+ F3: 114,
778
+ /**
779
+ * F4
780
+ */
781
+ F4: 115,
782
+ /**
783
+ * F5
784
+ */
785
+ F5: 116,
786
+ /**
787
+ * F6
788
+ */
789
+ F6: 117,
790
+ /**
791
+ * F7
792
+ */
793
+ F7: 118,
794
+ /**
795
+ * F8
796
+ */
797
+ F8: 119,
798
+ /**
799
+ * F9
800
+ */
801
+ F9: 120,
802
+ /**
803
+ * F10
804
+ */
805
+ F10: 121,
806
+ /**
807
+ * F11
808
+ */
809
+ F11: 122,
810
+ /**
811
+ * F12
812
+ */
813
+ F12: 123,
814
+ /**
815
+ * NUMLOCK
816
+ */
817
+ NUMLOCK: 144,
818
+ /**
819
+ * SEMICOLON
820
+ */
821
+ SEMICOLON: 186,
822
+ // needs localization
823
+ /**
824
+ * DASH
825
+ */
826
+ DASH: 189,
827
+ // needs localization
828
+ /**
829
+ * EQUALS
830
+ */
831
+ EQUALS: 187,
832
+ // needs localization
833
+ /**
834
+ * COMMA
835
+ */
836
+ COMMA: 188,
837
+ // needs localization
838
+ /**
839
+ * PERIOD
840
+ */
841
+ PERIOD: 190,
842
+ // needs localization
843
+ /**
844
+ * SLASH
845
+ */
846
+ SLASH: 191,
847
+ // needs localization
848
+ /**
849
+ * APOSTROPHE
850
+ */
851
+ APOSTROPHE: 192,
852
+ // needs localization
853
+ /**
854
+ * SINGLE_QUOTE
855
+ */
856
+ SINGLE_QUOTE: 222,
857
+ // needs localization
858
+ /**
859
+ * OPEN_SQUARE_BRACKET
860
+ */
861
+ OPEN_SQUARE_BRACKET: 219,
862
+ // needs localization
863
+ /**
864
+ * BACKSLASH
865
+ */
866
+ BACKSLASH: 220,
867
+ // needs localization
868
+ /**
869
+ * CLOSE_SQUARE_BRACKET
870
+ */
871
+ CLOSE_SQUARE_BRACKET: 221,
872
+ // needs localization
873
+ /**
874
+ * WIN_KEY
875
+ */
876
+ WIN_KEY: 224,
877
+ /**
878
+ * MAC_FF_META
879
+ */
880
+ MAC_FF_META: 224,
881
+ // Firefox (Gecko) fires this for the meta key instead of 91
882
+ /**
883
+ * WIN_IME
884
+ */
885
+ WIN_IME: 229,
886
+ // ======================== Function ========================
887
+ /**
888
+ * whether text and modified key is entered at the same time.
889
+ */
890
+ isTextModifyingKeyEvent: function(t) {
891
+ const { keyCode: i } = t;
892
+ if (t.altKey && !t.ctrlKey || t.metaKey || // Function keys don't generate text
893
+ i >= a.F1 && i <= a.F12)
894
+ return !1;
895
+ switch (i) {
896
+ case a.ALT:
897
+ case a.CAPS_LOCK:
898
+ case a.CONTEXT_MENU:
899
+ case a.CTRL:
900
+ case a.DOWN:
901
+ case a.END:
902
+ case a.ESC:
903
+ case a.HOME:
904
+ case a.INSERT:
905
+ case a.LEFT:
906
+ case a.MAC_FF_META:
907
+ case a.META:
908
+ case a.NUMLOCK:
909
+ case a.NUM_CENTER:
910
+ case a.PAGE_DOWN:
911
+ case a.PAGE_UP:
912
+ case a.PAUSE:
913
+ case a.PRINT_SCREEN:
914
+ case a.RIGHT:
915
+ case a.SHIFT:
916
+ case a.UP:
917
+ case a.WIN_KEY:
918
+ case a.WIN_KEY_RIGHT:
919
+ return !1;
920
+ default:
921
+ return !0;
922
+ }
908
923
  },
909
- ORIGINAL: {
910
- name: "original",
911
- icon: f(et, null, null)
924
+ /**
925
+ * whether character is entered.
926
+ */
927
+ isCharacterKey: function(t) {
928
+ if (t >= a.ZERO && t <= a.NINE || t >= a.NUM_ZERO && t <= a.NUM_MULTIPLY || t >= a.A && t <= a.Z || window.navigator.userAgent.includes("WebKit") && t === 0)
929
+ return !0;
930
+ switch (t) {
931
+ case a.SPACE:
932
+ case a.QUESTION_MARK:
933
+ case a.NUM_PLUS:
934
+ case a.NUM_MINUS:
935
+ case a.NUM_PERIOD:
936
+ case a.NUM_DIVISION:
937
+ case a.SEMICOLON:
938
+ case a.DASH:
939
+ case a.EQUALS:
940
+ case a.COMMA:
941
+ case a.PERIOD:
942
+ case a.SLASH:
943
+ case a.APOSTROPHE:
944
+ case a.SINGLE_QUOTE:
945
+ case a.OPEN_SQUARE_BRACKET:
946
+ case a.BACKSLASH:
947
+ case a.CLOSE_SQUARE_BRACKET:
948
+ return !0;
949
+ default:
950
+ return !1;
951
+ }
912
952
  }
913
- }, Ft = function() {
914
- return !q && !!window.navigator.userAgent.match(/firefox/i);
915
- }, je = Ft() ? "DOMMouseScroll" : "mousewheel";
916
- function Me(e) {
917
- let t = !1;
918
- return function(...n) {
919
- t || (t = !0, window.requestAnimationFrame(() => {
920
- e.apply(this, n), t = !1;
921
- }));
953
+ };
954
+ let He = (e) => setTimeout(e, 16), je = (e) => clearTimeout(e);
955
+ typeof window < "u" && "requestAnimationFrame" in window && (He = (e) => window.requestAnimationFrame(e), je = (e) => window.cancelAnimationFrame(e));
956
+ let Re = 0;
957
+ const Ne = /* @__PURE__ */ new Map();
958
+ function Ye(e) {
959
+ Ne.delete(e);
960
+ }
961
+ function ye(e, t = 1) {
962
+ Re += 1;
963
+ const i = Re;
964
+ function l(o) {
965
+ if (o === 0)
966
+ Ye(i), e();
967
+ else {
968
+ const f = He(() => {
969
+ l(o - 1);
970
+ });
971
+ Ne.set(i, f);
972
+ }
973
+ }
974
+ return l(t), i;
975
+ }
976
+ ye.cancel = (e) => {
977
+ const t = Ne.get(e);
978
+ return Ye(t), je(t);
979
+ };
980
+ function Rt(e) {
981
+ const t = M(null), i = re({ ...e }), l = M([]), o = (f) => {
982
+ t.value === null && (l.value = [], t.value = ye(() => {
983
+ let c;
984
+ l.value.forEach((d) => {
985
+ c = { ...c, ...d };
986
+ }), Object.assign(i, c), t.value = null;
987
+ })), l.value.push(f);
922
988
  };
989
+ return De(() => {
990
+ t.value && ye.cancel(t.value);
991
+ }), [i, o];
923
992
  }
924
- const jt = /* @__PURE__ */ Ve({
925
- props: pt,
926
- emits: ["close", "switch"],
993
+ const $t = /* @__PURE__ */ Me({
994
+ name: "Operations",
995
+ inheritAttrs: !1,
996
+ props: {
997
+ open: Boolean,
998
+ count: {
999
+ type: Number,
1000
+ default: 0
1001
+ },
1002
+ current: {
1003
+ type: Number,
1004
+ default: 0
1005
+ },
1006
+ showSwitch: Boolean,
1007
+ showProgress: Boolean,
1008
+ prefixCls: String,
1009
+ hashId: String,
1010
+ zIndex: Y.zIndex,
1011
+ icons: Y.icons,
1012
+ infinite: Y.infinite,
1013
+ getContainer: Y.getContainer,
1014
+ countRender: Y.countRender,
1015
+ tools: Array,
1016
+ onClose: Function,
1017
+ onActive: Function
1018
+ },
1019
+ setup(e) {
1020
+ const t = (i, l) => {
1021
+ var o;
1022
+ i.preventDefault(), i.stopPropagation(), (o = e.onActive) == null || o.call(e, l);
1023
+ };
1024
+ return () => {
1025
+ const {
1026
+ prefixCls: i,
1027
+ hashId: l,
1028
+ tools: o
1029
+ } = e, f = Ce(`${e.prefixCls}-fade`), c = `${i}-operations-operation`, d = `${i}-operations-icon`;
1030
+ return r(Ue, {
1031
+ to: e.getContainer || "body"
1032
+ }, {
1033
+ default: () => [r(Se, f, {
1034
+ default: () => {
1035
+ var p, m, h, C;
1036
+ return [he(r("div", {
1037
+ class: ae(`${i}-operations-wrapper`, l),
1038
+ style: {
1039
+ zIndex: e.zIndex
1040
+ }
1041
+ }, [((p = e.icons) == null ? void 0 : p.close) === null ? null : r("button", {
1042
+ class: `${i}-close ${l}`,
1043
+ onClick: e.onClose
1044
+ }, [((m = e.icons) == null ? void 0 : m.close) || r(it, null, null)]), e.showSwitch && r(Ie, null, [r("div", {
1045
+ class: ae(`${i}-switch-left ${l}`, {
1046
+ [`${i}-switch-left-disabled`]: e.infinite ? !1 : e.current === 0
1047
+ }),
1048
+ onClick: (v) => t(v, -1)
1049
+ }, [((h = e.icons) == null ? void 0 : h.left) || r(at, null, null)]), r("div", {
1050
+ className: ae(`${i}-switch-right ${l}`, {
1051
+ [`${i}-switch-right-disabled`]: e.infinite ? !1 : e.current === e.count - 1
1052
+ }),
1053
+ onClick: (v) => t(v, 1)
1054
+ }, [((C = e.icons) == null ? void 0 : C.right) || r(lt, null, null)])]), r("div", {
1055
+ class: `${i}-footer ${l}`
1056
+ }, [e.showProgress && r("div", {
1057
+ class: `${i}-progress`
1058
+ }, [e.countRender ? e.countRender(e.current + 1, e.count) : `${e.current + 1} / ${e.count}`]), r("div", {
1059
+ class: `${e.prefixCls}-operations`
1060
+ }, [o == null ? void 0 : o.map(({
1061
+ icon: v,
1062
+ onClick: u,
1063
+ type: N,
1064
+ disabled: w
1065
+ }) => r("div", {
1066
+ class: ae(c, {
1067
+ [`${e.prefixCls}-operations-operation-disabled`]: w && (w == null ? void 0 : w.value)
1068
+ }),
1069
+ onClick: u,
1070
+ key: N
1071
+ }, [Je(v, {
1072
+ class: d
1073
+ })]))])])]), [[pe, e.open]])];
1074
+ }
1075
+ })]
1076
+ });
1077
+ };
1078
+ }
1079
+ }), D = {
1080
+ x: 0,
1081
+ y: 0
1082
+ }, H = {
1083
+ rotateLeft: r(rt, null, null),
1084
+ rotateRight: r(st, null, null),
1085
+ zoomIn: r(ct, null, null),
1086
+ zoomOut: r(ut, null, null),
1087
+ flipX: r(xe, null, null),
1088
+ flipY: r(xe, {
1089
+ rotate: 90
1090
+ }, null)
1091
+ }, Dt = /* @__PURE__ */ Me({
1092
+ name: "GImageViewer",
1093
+ props: Y,
1094
+ inheritAttrs: !1,
1095
+ emits: ["close", "switch", "afterClose"],
927
1096
  setup: (e, {
928
1097
  emit: t,
929
- expose: n
1098
+ expose: i,
1099
+ slots: l
930
1100
  }) => {
931
- var ie, re, $, Z, Ce;
932
- let a = null, i = null, r = null;
933
- const o = Ge({
934
- suffixCls: "image-viewer"
1101
+ const o = _e({
1102
+ suffixCls: "image-view"
935
1103
  }), {
936
- wrapSSR: l,
1104
+ wrapSSR: f,
937
1105
  hashId: c
938
- } = Pt(o), S = Te(!1), [p, E] = Ne(!1), [k, x] = Ne(!1), z = C(!0), h = C(e.initialIndex), P = C(null), F = C(null), W = C(X.CONTAIN), m = Xe({
939
- transform: {
940
- scale: 1,
941
- deg: 0,
942
- offsetX: 0,
943
- offsetY: 0,
944
- enableTransition: !1
1106
+ } = Lt(o), [d, p] = Le(!1), [m, h] = Le(!1), C = M(null), v = M(e.current), u = V(1), N = V(0), w = V(!1), O = re({
1107
+ x: 1,
1108
+ y: 1
1109
+ }), [I, T] = Rt(D), W = V({
1110
+ wheelDirection: 0
1111
+ }), R = V(), A = re({
1112
+ originX: 0,
1113
+ originY: 0,
1114
+ deltaX: 0,
1115
+ deltaY: 0
1116
+ }), $ = re(/* @__PURE__ */ new Map()), z = y(() => new Map(Array.from($).map(([n, {
1117
+ url: g
1118
+ }]) => [n, g]))), Q = y(() => z.value.get(v.value)), _ = y(() => z.value.size), G = y(() => Array.from(z.value.keys())), b = y(() => G.value.indexOf(v.value)), k = y(() => _.value > 1), X = y(() => _.value >= 1);
1119
+ j(d, (n) => {
1120
+ n && (m.value = !0);
1121
+ });
1122
+ const s = (n) => {
1123
+ v.value = n;
1124
+ };
1125
+ j(() => e.current, (n) => {
1126
+ Ee(n) && s(n);
1127
+ });
1128
+ function S(n, g) {
1129
+ $.set(n, {
1130
+ url: g,
1131
+ loading: !0,
1132
+ canPreview: !1
1133
+ });
1134
+ }
1135
+ const x = () => {
1136
+ h(!1), v.value = e.current;
1137
+ }, F = () => {
1138
+ u.value = 1, N.value = 0, O.x = 1, O.y = 1, T(D), t("close");
1139
+ }, de = (n) => {
1140
+ w.value || C.value === (n == null ? void 0 : n.target) && x();
1141
+ }, fe = () => {
1142
+ const n = $.get(v.value);
1143
+ n && (n.loading = !1, n.canPreview = !0);
1144
+ }, q = (n) => {
1145
+ const g = $.get(v.value);
1146
+ g && (g.loading = !1, g.canPreview = !1), n.target.alt = "加载失败";
1147
+ }, J = () => {
1148
+ if (b.value > 0 || e.infinite) {
1149
+ const n = b.value - 1 < 0 ? e.previewUrls.length - 1 : b.value - 1;
1150
+ s(G.value[n]);
945
1151
  }
946
- }), J = L(() => e.urlList.length > 1), G = L(() => h.value === 0), K = L(() => h.value === e.urlList.length - 1), ee = L(() => e.urlList[h.value]), te = L(() => {
947
- const {
948
- scale: s,
949
- deg: I,
950
- offsetX: d,
951
- offsetY: y,
952
- enableTransition: b
953
- } = m.transform, A = {
954
- transform: `scale(${s}) rotate(${I}deg)`,
955
- transition: b ? "transform .3s" : "",
956
- marginLeft: `${d}px`,
957
- marginTop: `${y}px`
958
- };
959
- return W.value.name === X.CONTAIN.name && (A.maxWidth = A.maxHeight = "100%"), A;
960
- }), ne = () => {
961
- xe(document, "keydown", a), xe(document, je, i), a = null, i = null;
962
- }, de = () => {
963
- ne(), t("close"), m.transform = {
964
- scale: 1,
965
- deg: 0,
966
- offsetX: 0,
967
- offsetY: 0,
968
- enableTransition: !1
969
- };
970
- }, he = (s) => {
971
- S.value ? S.value = !1 : P.value === (s == null ? void 0 : s.target) && (x(!1), h.value = e.initialIndex);
972
- }, ae = () => {
973
- m.transform = {
974
- scale: 1,
975
- deg: 0,
976
- offsetX: 0,
977
- offsetY: 0,
978
- enableTransition: !1
979
- };
980
- }, j = () => {
981
- if (G.value && !e.infinite) return;
982
- const s = e.urlList.length;
983
- h.value = (h.value - 1 + s) % s;
984
- }, u = () => {
985
- if (K.value && !e.infinite) return;
986
- const s = e.urlList.length;
987
- h.value = (h.value + 1) % s;
988
- }, M = () => {
989
- if (z.value) return;
990
- const s = Object.keys(X), I = Object.values(X), d = W.value.name, b = (I.findIndex((A) => A.name === d) + 1) % s.length;
991
- W.value = X[s[b]], ae();
992
- }, g = (s, I = {}) => {
993
- if (z.value) return;
994
- const {
995
- zoomRate: d,
996
- rotateDeg: y,
997
- enableTransition: b
998
- } = {
999
- zoomRate: 0.2,
1000
- rotateDeg: 90,
1001
- enableTransition: !0,
1002
- ...I
1003
- };
1004
- switch (s) {
1005
- case "zoomOut":
1006
- m.transform.scale > 0.2 && (m.transform.scale = Number.parseFloat((m.transform.scale - d).toFixed(3)));
1007
- break;
1008
- case "zoomIn":
1009
- m.transform.scale = Number.parseFloat((m.transform.scale + d).toFixed(3));
1010
- break;
1011
- case "clocelise":
1012
- m.transform.deg += y;
1013
- break;
1014
- case "anticlocelise":
1015
- m.transform.deg -= y;
1016
- break;
1152
+ }, ee = () => {
1153
+ if (b.value < _.value - 1 || e.infinite) {
1154
+ const n = b.value + 1 > e.previewUrls.length - 1 ? 0 : b.value + 1;
1155
+ s(G.value[n]);
1017
1156
  }
1018
- m.transform.enableTransition = b;
1019
- }, B = () => {
1020
- a = Me((s) => {
1021
- switch (s.code) {
1022
- case Y.esc:
1023
- x(!1);
1024
- break;
1025
- case Y.space:
1026
- M();
1027
- break;
1028
- case Y.left:
1029
- j();
1030
- break;
1031
- case Y.up:
1032
- g("zoomIn");
1033
- break;
1034
- case Y.right:
1035
- u();
1036
- break;
1037
- case Y.down:
1038
- g("zoomOut");
1039
- break;
1040
- }
1041
- }), i = Me((s) => {
1042
- (s.wheelDelta ? s.wheelDelta : -s.detail) > 0 ? g("zoomIn", {
1043
- zoomRate: 0.015,
1044
- enableTransition: !1
1045
- }) : g("zoomOut", {
1046
- zoomRate: 0.015,
1047
- enableTransition: !1
1048
- });
1049
- }), le(document, "keydown", a), le(document, je, i);
1050
- }, V = () => {
1051
- z.value = !1;
1052
- }, ge = (s) => {
1053
- z.value = !1, s.target.alt = "加载失败";
1054
- }, U = Te(), ve = (s) => {
1055
- if (z.value || s.button !== 0) return;
1056
- s.preventDefault(), s.stopPropagation(), clearTimeout(U.value), S.value = !0;
1057
- const {
1058
- offsetX: I,
1059
- offsetY: d
1060
- } = m.transform, y = s.pageX, b = s.pageY;
1061
- r = Me((A) => {
1062
- m.transform = {
1063
- ...m.transform,
1064
- offsetX: I + A.pageX - y,
1065
- offsetY: d + A.pageY - b
1066
- };
1067
- }), le(document, "mousemove", r), le(document, "mouseup", () => {
1068
- xe(document, "mousemove", r), p.value && k.value && (U.value = setTimeout(() => {
1069
- S.value = !1;
1070
- }));
1071
- });
1072
- }, me = [{
1073
- icon: ((ie = e.icons) == null ? void 0 : ie.close) || f(tt, null, null),
1074
- onClick: (s) => {
1075
- s.stopPropagation(), x(!1);
1076
- },
1077
- type: "close"
1078
- }, {
1079
- icon: ((re = e.icons) == null ? void 0 : re.zoomIn) || f(nt, null, null),
1080
- onClick: (s) => {
1081
- s.stopPropagation(), g("zoomIn");
1082
- },
1157
+ }, te = (n) => {
1158
+ n ? u.value += 0.5 : u.value++, T(D);
1159
+ }, ne = (n) => {
1160
+ u.value > 1 && (n ? u.value -= 0.5 : u.value--), T(D);
1161
+ }, ve = () => {
1162
+ N.value += 90;
1163
+ }, Ke = () => {
1164
+ N.value -= 90;
1165
+ }, We = () => {
1166
+ O.x = -O.x;
1167
+ }, Ge = () => {
1168
+ O.y = -O.y;
1169
+ }, Xe = [{
1170
+ icon: L(l, e.icons, "zoomIn") || H.zoomIn,
1171
+ onClick: () => te(),
1083
1172
  type: "zoomIn"
1084
1173
  }, {
1085
- icon: (($ = e.icons) == null ? void 0 : $.zoomOut) || f(at, null, null),
1086
- onClick: (s) => {
1087
- s.stopPropagation(), g("zoomOut");
1088
- },
1089
- type: "zoomOut"
1174
+ icon: L(l, e.icons, "zoomOut") || H.zoomOut,
1175
+ onClick: () => ne(),
1176
+ type: "zoomOut",
1177
+ disabled: y(() => u.value === 1)
1090
1178
  }, {
1091
- icon: ((Z = e.icons) == null ? void 0 : Z.rotateRight) || f(it, null, null),
1092
- onClick: (s) => {
1093
- s.stopPropagation(), g("anticlocelise");
1094
- },
1179
+ icon: L(l, e.icons, "rotateRight") || H.rotateRight,
1180
+ onClick: ve,
1095
1181
  type: "rotateRight"
1096
1182
  }, {
1097
- icon: ((Ce = e.icons) == null ? void 0 : Ce.rotateLeft) || f(rt, null, null),
1098
- onClick: (s) => {
1099
- s.stopPropagation(), g("clocelise");
1100
- },
1183
+ icon: L(l, e.icons, "rotateLeft") || H.rotateLeft,
1184
+ onClick: Ke,
1101
1185
  type: "rotateLeft"
1102
- }];
1103
- return _(ee, () => {
1104
- Ye(() => {
1105
- F.value.complete || (z.value = !0);
1186
+ }, {
1187
+ icon: L(l, e.icons, "flipX") || H.flipX,
1188
+ onClick: We,
1189
+ type: "flipX"
1190
+ }, {
1191
+ icon: L(l, e.icons, "flipY") || H.flipY,
1192
+ onClick: Ge,
1193
+ type: "flipY"
1194
+ }], Oe = () => {
1195
+ if (d.value && w.value && R.value) {
1196
+ const n = R.value.offsetWidth * u.value, g = R.value.offsetHeight * u.value, {
1197
+ left: P,
1198
+ top: E
1199
+ } = Tt(R.value), oe = N.value % 180 !== 0;
1200
+ w.value = !1;
1201
+ const ie = Pt(oe ? g : n, oe ? n : g, P, E);
1202
+ ie && T({
1203
+ ...ie
1204
+ });
1205
+ }
1206
+ }, Ze = (n) => {
1207
+ n.button === 0 && (n.preventDefault(), n.stopPropagation(), A.deltaX = n.pageX - I.x, A.deltaY = n.pageY - I.y, A.originX = I.x, A.originY = I.y, w.value = !0);
1208
+ }, Ae = (n) => {
1209
+ d.value && w.value && T({
1210
+ x: n.pageX - A.deltaX,
1211
+ y: n.pageY - A.deltaY
1106
1212
  });
1107
- }), _(h, (s) => {
1108
- ae(), t("switch", s);
1109
- }), _(p, (s) => {
1110
- s && (k.value = s);
1111
- }), _([() => p.value, () => P.value], ([s, I]) => {
1112
- var d, y;
1113
- s && I && (B(), (y = (d = P.value) == null ? void 0 : d.focus) == null || y.call(d));
1114
- }), n({
1115
- setOpen: E
1213
+ }, Ve = (n) => {
1214
+ if (!d.value) return;
1215
+ n.preventDefault();
1216
+ const g = n.deltaY;
1217
+ W.value = {
1218
+ wheelDirection: g
1219
+ };
1220
+ }, Qe = (n) => {
1221
+ !d.value || !k.value || (n.keyCode === a.LEFT ? J() : n.keyCode === a.RIGHT && ee());
1222
+ }, ke = () => {
1223
+ d.value && (u.value !== 1 && (u.value = 1), (I.x !== D.x || I.y !== D.y) && T(D));
1224
+ };
1225
+ let ge = () => {
1226
+ };
1227
+ return De(() => {
1228
+ j(() => e.previewUrls, (n) => {
1229
+ Fe(n) && n.forEach((g, P) => {
1230
+ S(P, g);
1231
+ });
1232
+ }, {
1233
+ flush: "post",
1234
+ immediate: !0
1235
+ }), j([() => d.value, w], () => {
1236
+ ge();
1237
+ let n, g;
1238
+ const P = B(window, "mouseup", Oe, !1), E = B(window, "mousemove", Ae, !1), oe = B(window, "wheel", Ve, {
1239
+ passive: !1
1240
+ }), ie = B(window, "keydown", Qe, !1);
1241
+ try {
1242
+ window.top !== window.self && (n = B(window.top, "mouseup", Oe, !1), g = B(window.top, "mousemove", Ae, !1));
1243
+ } catch (qe) {
1244
+ Et(!1, `[vc-image] ${qe}`);
1245
+ }
1246
+ ge = () => {
1247
+ P.remove(), E.remove(), oe.remove(), ie.remove(), n && n.remove(), g && g.remove();
1248
+ };
1249
+ }, {
1250
+ flush: "post",
1251
+ immediate: !0
1252
+ }), j([W], () => {
1253
+ const {
1254
+ wheelDirection: n
1255
+ } = W.value;
1256
+ n > 0 ? ne(!0) : n < 0 && te(!0);
1257
+ });
1258
+ }), et(() => {
1259
+ ge();
1260
+ }), i({
1261
+ setOpen: p
1116
1262
  }), () => {
1117
- const s = Ee(`${o}-fade`), I = Ee(`${o}-zoom`);
1118
- return l(f(_e, {
1263
+ const n = Ce(`${o}-fade`), g = Ce(`${o}-zoom`), P = {};
1264
+ for (const E in e.icons)
1265
+ P[E] = L(l, e.icons, E);
1266
+ return f(r(Ie, null, [r(Ue, {
1119
1267
  to: e.getContainer || "body",
1120
1268
  disabled: !e.teleported
1121
1269
  }, {
1122
- default: () => [p.value && f("div", {
1270
+ default: () => [d.value && r(Ie, null, [r("div", {
1123
1271
  class: `${o}-root ${c.value}`
1124
- }, [f(ke, s, {
1125
- default: () => [ze(f("div", {
1272
+ }, [r(Se, n, {
1273
+ default: () => [he(r("div", {
1126
1274
  class: `${o}-mask ${c.value}`
1127
- }, null), [[Oe, p.value && k.value]])]
1128
- }), f("div", {
1129
- ref: P,
1275
+ }, null), [[pe, d.value && m.value]])]
1276
+ }), r("div", {
1277
+ ref: C,
1130
1278
  tabindex: -1,
1131
- class: [`${o}-wrapper`, `${c.value}`],
1132
- onClick: (d) => e.onHideOnClickModal && he(d)
1133
- }, [f(ke, We(I, {
1134
- onAfterLeave: () => de()
1279
+ class: [`${o}-wrap`, `${c.value}`],
1280
+ onClick: (E) => e.onHideOnClickModal && de(E)
1281
+ }, [r(Se, ze(g, {
1282
+ onAfterLeave: () => F()
1135
1283
  }), {
1136
- default: () => {
1137
- var d, y;
1138
- return [ze(f("div", {
1139
- class: `${o}-block ${c.value}`
1140
- }, [f("div", {
1141
- class: `${o}-content ${c.value}`
1142
- }, [f("div", {
1143
- class: `${o}-body ${c.value}`
1144
- }, [f("div", {
1145
- class: `${o}-operations-wrapper ${c.value}`,
1146
- onClick: (b) => b.stopPropagation()
1147
- }, [f("ul", {
1148
- class: `${o}-operations ${c.value}`
1149
- }, [me.map(({
1150
- icon: b,
1151
- onClick: A,
1152
- type: pe
1153
- }) => f("li", {
1154
- class: `${o}-operations-operation ${c.value}`,
1155
- onClick: A,
1156
- key: pe
1157
- }, [qe(b, {
1158
- class: `${o}-operations-icon ${c.value}`
1159
- })]))])]), f("div", {
1160
- class: `${o}-canvas ${c.value}`
1161
- }, [e.urlList.map((b, A) => f("img", {
1162
- ref: F,
1163
- class: `${o}-img ${c.value}`,
1164
- style: {
1165
- ...te.value,
1166
- display: A === h.value ? "block" : "none"
1167
- },
1168
- key: b,
1169
- src: b,
1170
- onLoad: () => V(),
1171
- onError: (pe) => ge(pe),
1172
- onMousedown: ve
1173
- }, null))]), J.value && f("div", {
1174
- class: [`${o}-switch-left`, h.value === 0 && !e.infinite ? `${o}-switch-left-disabled` : "", `${c.value}`],
1175
- onClick: () => j()
1176
- }, [((d = e.icons) == null ? void 0 : d.left) || f(ot, null, null)]), J.value && f("div", {
1177
- class: [`${o}-switch-right`, h.value === e.urlList.length - 1 && !e.infinite ? `${o}-switch-right-disabled` : "", `${c.value}`],
1178
- onClick: () => u()
1179
- }, [((y = e.icons) == null ? void 0 : y.right) || f(st, null, null)])])])]), [[Oe, p.value && k.value]])];
1180
- }
1181
- })])])]
1182
- }));
1284
+ default: () => [he(r("div", {
1285
+ role: "dialog",
1286
+ class: `${o} ${c.value}`
1287
+ }, [r("div", {
1288
+ class: `${o}-content ${c.value}`
1289
+ }, [r("div", {
1290
+ class: `${o}-body ${c.value}`
1291
+ }, [r("div", {
1292
+ class: `${o}-img-wrapper ${c.value}`,
1293
+ style: {
1294
+ transform: `translate3d(${I.x}px, ${I.y}px, 0)`
1295
+ }
1296
+ }, [r("img", {
1297
+ onMousedown: Ze,
1298
+ onDblclick: ke,
1299
+ ref: R,
1300
+ class: `${o}-img ${c.value}`,
1301
+ src: Q.value,
1302
+ onLoad: () => fe(),
1303
+ onError: (E) => q(E),
1304
+ style: {
1305
+ transform: `scale3d(${O.x * u.value}, ${O.y * u.value}, 1) rotate(${N.value}deg)`
1306
+ }
1307
+ }, null)])])])]), [[pe, d.value && m.value]])]
1308
+ })])])])]
1309
+ }), d.value && m.value && r($t, {
1310
+ open: d.value && m.value,
1311
+ hashId: c.value,
1312
+ count: e.previewUrls.length,
1313
+ current: v.value,
1314
+ zIndex: e.zIndex + 1,
1315
+ getContainer: e.getContainer,
1316
+ prefixCls: o,
1317
+ icons: P,
1318
+ tools: Xe,
1319
+ infinite: e.infinite,
1320
+ countRender: dt(l, e, "countRenders"),
1321
+ showSwitch: k.value,
1322
+ showProgress: X.value,
1323
+ onClose: x,
1324
+ onActive: (E) => E > 0 ? ee() : J()
1325
+ }, null)]));
1183
1326
  };
1184
1327
  }
1185
- }), Ie = {
1328
+ }), we = {
1186
1329
  width: "100%",
1187
1330
  height: "100%"
1188
- }, Bt = (e) => ({
1331
+ }, Ut = () => ({
1332
+ position: "absolute",
1333
+ inset: 0,
1334
+ display: "flex",
1335
+ alignItems: "center",
1336
+ justifyContent: "center",
1337
+ cursor: "pointer",
1338
+ opacity: 0
1339
+ }), zt = (e) => ({
1189
1340
  [e.componentCls]: {
1190
1341
  display: "inline-block",
1191
1342
  position: "relative",
1192
1343
  overflow: "hidden",
1193
1344
  "&-inner": {
1194
- ...Ie,
1345
+ ...we,
1195
1346
  verticalAlign: "top",
1196
- opacity: 1
1347
+ opacity: 1,
1348
+ [`&${e.componentCls}-inner-preview`]: {
1349
+ userSelect: "none"
1350
+ }
1197
1351
  },
1198
1352
  "&-placeholder": {
1199
- ...Ie,
1353
+ ...we,
1200
1354
  backgroundColor: e.colorBgContainerDisabled,
1201
1355
  backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
1202
1356
  backgroundRepeat: "no-repeat",
@@ -1204,163 +1358,156 @@ const jt = /* @__PURE__ */ Ve({
1204
1358
  backgroundSize: "30%"
1205
1359
  },
1206
1360
  "&-error": {
1207
- ...Ie,
1361
+ ...we,
1208
1362
  display: "flex",
1209
1363
  alignItems: "center",
1210
1364
  justifyContent: "center",
1211
1365
  color: e.colorText,
1212
1366
  backgroundColor: e.colorBgContainerDisabled
1213
1367
  },
1214
- "&-preview": {
1215
- cursor: "pointer"
1216
- }
1368
+ "&-preview": Ut()
1217
1369
  }
1218
- }), Vt = (e) => e && e.nodeType === Node.ELEMENT_NODE;
1219
- let Be = "";
1220
- const ce = /* @__PURE__ */ Ve({
1221
- props: ue,
1370
+ }), _t = (e) => e && e.nodeType === Node.ELEMENT_NODE;
1371
+ let $e = "";
1372
+ const ce = /* @__PURE__ */ Me({
1373
+ props: se,
1222
1374
  name: "GImage",
1223
1375
  emits: ["error", "click", "load"],
1224
1376
  slots: Object,
1225
1377
  setup(e, {
1226
1378
  slots: t,
1227
- emit: n,
1228
- attrs: a
1379
+ emit: i,
1380
+ attrs: l
1229
1381
  }) {
1230
- const i = Ge({
1382
+ const o = _e({
1231
1383
  suffixCls: "image"
1232
1384
  }), {
1233
- wrapSSR: r,
1234
- hashId: o
1235
- } = vt("Image", [Bt], i), l = C(), c = C(""), S = C(!1), p = C(!0), E = C(!1), k = C(null), x = C();
1236
- let z, h;
1237
- const P = L(() => !q && e.fit ? {
1385
+ wrapSSR: f,
1386
+ hashId: c
1387
+ } = It("Image", [zt], o), d = M(), p = M(""), m = M(!1), h = M(!0), C = M(!1), v = M(null), u = M();
1388
+ let N, w;
1389
+ const O = y(() => !le && e.fit ? {
1238
1390
  "object-fit": e.fit
1239
- } : {}), F = L(() => {
1240
- const {
1241
- previewSrcList: u
1242
- } = e;
1243
- return Array.isArray(u) && u.length > 0;
1244
- }), W = L(() => {
1391
+ } : {}), I = y(() => Fe(e.previewUrls) && e.previewUrls.length > 0), T = y(() => {
1245
1392
  const {
1246
- src: u,
1247
- previewSrcList: M,
1248
- initialIndex: g
1393
+ src: s,
1394
+ previewUrls: S,
1395
+ current: x
1249
1396
  } = e;
1250
- if (g || g === 0) return M.length >= g ? g : 0;
1251
- let B = 0;
1252
- const V = M.indexOf(u);
1253
- return V >= 0 && (B = V), B;
1254
- }), m = (u) => {
1255
- c.value = e.src, p.value = !1, S.value = !1, n("load", u);
1256
- }, J = (u) => {
1257
- p.value = !1, S.value = !0, n("error", u);
1258
- }, G = () => {
1259
- if (q) return;
1260
- p.value = !0, S.value = !1;
1261
- const u = new Image();
1262
- u.onload = (M) => m(M), u.onerror = J, Object.keys(a || {}).forEach((M) => {
1263
- if (M.toLowerCase() === "onload") return;
1264
- const g = (a || {})[M];
1265
- u.setAttribute(M, g);
1266
- }), u.src = e.src;
1267
- }, K = mt(te, 200), ee = () => {
1268
- q || !x.value || !K || (z(), x.value = void 0);
1397
+ if (Ee(x)) return S.length >= x ? x : 0;
1398
+ const F = S.indexOf(s);
1399
+ return F >= 0 ? F : 0;
1400
+ }), W = (s) => {
1401
+ p.value = e.src, h.value = !1, m.value = !1, i("load", s);
1402
+ }, R = (s) => {
1403
+ h.value = !1, m.value = !0, i("error", s);
1404
+ }, A = () => {
1405
+ if (le) return;
1406
+ h.value = !0, m.value = !1;
1407
+ const s = new Image();
1408
+ s.onload = (S) => W(S), s.onerror = R, Object.keys(l || {}).forEach((S) => {
1409
+ if (S.toLowerCase() === "onload") return;
1410
+ const x = (l || {})[S];
1411
+ s.setAttribute(S, x);
1412
+ }), s.src = e.src;
1413
+ }, $ = pt(Q, 200), z = () => {
1414
+ le || !u.value || !$ || (N(), u.value = void 0);
1269
1415
  };
1270
- function te() {
1271
- lt(k.value, x.value) && (G(), ee());
1416
+ function Q() {
1417
+ ft(v.value, u.value) && (A(), z());
1272
1418
  }
1273
- const ne = async () => {
1274
- if (q) return;
1275
- await Ye();
1419
+ const _ = async () => {
1420
+ if (le) return;
1421
+ await ot();
1276
1422
  const {
1277
- scrollContainer: u
1423
+ scrollContainer: s
1278
1424
  } = e;
1279
- Vt(u) ? x.value = u : ut(u) && u !== "" ? x.value = document.querySelector(u) ?? void 0 : k.value && (x.value = ct(k.value)), x.value && (z = $e(x, "scroll", K), setTimeout(() => te(), 200));
1280
- }, de = (u) => {
1281
- if (u.ctrlKey) {
1282
- if (u.deltaY < 0)
1283
- return u.preventDefault(), !1;
1284
- if (u.deltaY > 0)
1285
- return u.preventDefault(), !1;
1425
+ _t(s) ? u.value = s : vt(s) && s !== "" ? u.value = document.querySelector(s) ?? void 0 : v.value && (u.value = gt(v.value)), u.value && (N = Te(u, "scroll", $), setTimeout(() => Q(), 200));
1426
+ }, G = (s) => {
1427
+ if (s.ctrlKey) {
1428
+ if (s.deltaY < 0)
1429
+ return s.preventDefault(), !1;
1430
+ if (s.deltaY > 0)
1431
+ return s.preventDefault(), !1;
1286
1432
  }
1287
- }, he = () => {
1288
- !F.value || e.disablePreview || (h = $e("wheel", de, {
1433
+ }, b = () => {
1434
+ I.value && (w = Te("wheel", G, {
1289
1435
  passive: !1
1290
- }), Be = document.body.style.overflow, document.body.style.overflow = "hidden", E.value = !0);
1291
- }, ae = () => {
1292
- h == null || h(), document.body.style.overflow = Be, E.value = !1;
1436
+ }), $e = document.body.style.overflow, document.body.style.overflow = "hidden", C.value = !0);
1437
+ }, k = () => {
1438
+ w == null || w(), document.body.style.overflow = $e, C.value = !1;
1293
1439
  };
1294
- _(() => e.src, () => {
1295
- e.lazy ? (p.value = !0, S.value = !1, ee(), ne()) : G();
1440
+ j(() => e.src, () => {
1441
+ e.lazy ? (h.value = !0, m.value = !1, z(), _()) : A();
1442
+ }), tt(() => {
1443
+ var s, S;
1444
+ I.value && C.value ? (s = d.value) == null || s.setOpen(!0) : (S = d.value) == null || S.setOpen(!1);
1296
1445
  });
1297
- const j = (u) => ft(u) ? u + "px" : u;
1298
- return dt(() => {
1299
- e.lazy ? ne() : G();
1446
+ const X = (s) => Ee(s) ? s + "px" : s;
1447
+ return mt(() => {
1448
+ e.lazy ? _() : A();
1300
1449
  }), () => {
1301
1450
  const {
1302
- crossorigin: u,
1303
- decoding: M,
1304
- alt: g,
1305
- sizes: B,
1306
- srcset: V,
1307
- usemap: ge,
1308
- class: U,
1309
- style: ve = {}
1310
- } = a, me = {
1311
- crossorigin: u,
1312
- decoding: M,
1313
- alt: g,
1314
- sizes: B,
1315
- srcset: V,
1316
- usemap: ge,
1451
+ crossorigin: s,
1452
+ decoding: S,
1453
+ alt: x,
1454
+ sizes: F,
1455
+ srcset: de,
1456
+ usemap: fe,
1457
+ class: q,
1458
+ style: J = {}
1459
+ } = l, ee = {
1460
+ crossorigin: s,
1461
+ decoding: S,
1462
+ alt: x,
1463
+ sizes: F,
1464
+ srcset: de,
1465
+ usemap: fe,
1317
1466
  style: {
1318
- ...P.value,
1319
- height: e.height ? j(e.height) : void 0
1467
+ ...O.value,
1468
+ height: e.height ? X(e.height) : void 0
1320
1469
  }
1321
- }, ie = Le(t, e, "fallback"), re = Le(t, e, "placeholder");
1322
- return Qe(() => {
1323
- var $, Z;
1324
- F.value && E.value ? ($ = l.value) == null || $.setOpen(!0) : (Z = l.value) == null || Z.setOpen(!1);
1325
- }), r(f("div", {
1470
+ }, te = L(t, e, "fallback"), ne = L(t, e, "placeholder");
1471
+ return f(r("div", {
1326
1472
  class: {
1327
- [`${o.value}`]: !0,
1328
- [`${i}`]: !0,
1329
- [`${U}`]: !!U
1473
+ [`${c.value}`]: !0,
1474
+ [`${o}`]: !0,
1475
+ [`${q}`]: !!q
1330
1476
  },
1331
- ref: ($) => k.value = $,
1477
+ ref: (ve) => v.value = ve,
1332
1478
  style: {
1333
- width: e.width ? j(e.width) : void 0,
1334
- height: e.height ? j(e.height) : void 0,
1479
+ width: e.width ? X(e.width) : void 0,
1480
+ height: e.height ? X(e.height) : void 0,
1335
1481
  display: e.lazy ? "block" : void 0,
1336
- ...ve
1482
+ ...J
1337
1483
  },
1338
1484
  onClick: () => {
1339
- n("click");
1485
+ i("click");
1340
1486
  }
1341
- }, [p.value ? re || f("div", {
1342
- class: `${i}-placeholder ${o.value}`
1343
- }, null) : S.value ? ie || f("div", {
1344
- class: `${i}-error ${o.value}`
1345
- }, [Je("加载失败")]) : c.value && f("img", We(me, {
1487
+ }, [h.value ? ne || r("div", {
1488
+ class: `${o}-placeholder ${c.value}`
1489
+ }, null) : m.value ? te || r("div", {
1490
+ class: `${o}-error ${c.value}`
1491
+ }, [nt("加载失败")]) : p.value && r("img", ze(ee, {
1346
1492
  class: {
1347
- [`${o.value}`]: !0,
1493
+ [`${c.value}`]: !0,
1348
1494
  [`${e.imageClassName}`]: !!e.imageClassName,
1349
- [`${i}-inner`]: !0,
1350
- [`${i}-preview`]: F.value
1495
+ [`${o}-inner`]: !0,
1496
+ [`${o}-inner-preview`]: I.value
1351
1497
  },
1352
1498
  alt: e.alt,
1353
- src: c.value,
1354
- onClick: () => he()
1355
- }), null), f(jt, {
1356
- ref: l,
1499
+ src: p.value
1500
+ }), null), I.value && r("div", {
1501
+ class: `${o}-preview ${c.value}`,
1502
+ onClick: () => b()
1503
+ }, null), r(Dt, {
1504
+ ref: d,
1357
1505
  zIndex: e.zIndex,
1358
1506
  infinite: e.infinite,
1359
- initialIndex: W.value,
1360
- urlList: e.previewSrcList,
1507
+ current: T.value,
1508
+ previewUrls: e.previewUrls,
1361
1509
  getContainer: e.getContainer,
1362
- onHideOnClickModal: e.hideOnClickModal,
1363
- onClose: () => ae()
1510
+ onClose: () => k()
1364
1511
  }, null)]));
1365
1512
  };
1366
1513
  }
@@ -1369,8 +1516,9 @@ ce.isGImage = !0;
1369
1516
  ce.install = (e) => (e.component(ce.name, ce), e);
1370
1517
  export {
1371
1518
  ce as GImage,
1372
- jt as ImageViewer,
1519
+ Dt as ImagePreview,
1520
+ U as baseProps,
1373
1521
  ce as default,
1374
- ue as imagePorps,
1375
- pt as imageViewProps
1522
+ se as imagePorps,
1523
+ Y as imagePreviewProps
1376
1524
  };