@gx-design-vue/image 0.2.0-beta.10 → 0.2.0-beta.11

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.mjs CHANGED
@@ -1,25 +1,25 @@
1
- import { createVNode as u, defineComponent as Ve, shallowRef as Te, ref as w, computed as L, watch as le, nextTick as Ye, Teleport as _e, Transition as ke, withDirectives as ze, vShow as Oe, mergeProps as We, cloneVNode as qe, watchEffect as Qe, Fragment as Je, createTextVNode as Ke } from "vue";
1
+ import { createVNode as c, defineComponent as Ve, shallowRef as Te, ref as A, reactive as Xe, computed as N, watch as q, nextTick as Ye, Teleport as _e, Transition as ke, withDirectives as ze, vShow as Oe, mergeProps as We, cloneVNode as qe, watchEffect as Qe, Fragment as Je, createTextVNode as Ke } from "vue";
2
2
  import { ExpandOutlined as et, OneToOneOutlined as tt, CloseOutlined as nt, ZoomInOutlined as at, ZoomOutOutlined as it, RotateRightOutlined as rt, RotateLeftOutlined as ot, LeftOutlined as st, RightOutlined as lt } from "@ant-design/icons-vue";
3
- import { isServer as q, getPrefixCls as Ge, getSlotVNode as Le, isInContainer as ut, isString as ct, getScrollContainer as ft, isNumber as dt } from "@gx-design-vue/pro-utils";
4
- import { useState as Ne, onMountedOrActivated as Ue } from "@gx-design-vue/pro-hooks";
5
- import { Keyframe as fe, useStyle as ht, mergeToken as gt, getTransitionProps as $e, useProStyle as vt } from "@gx-design-vue/pro-provider";
3
+ import { isServer as Q, getPrefixCls as Ge, getSlotVNode as Le, isInContainer as ut, isString as ct, getScrollContainer as ft, isNumber as dt } from "@gx-design-vue/pro-utils";
4
+ import { useState as Ne, onMountedOrActivated as ht } from "@gx-design-vue/pro-hooks";
5
+ import { Keyframe as ce, useStyle as gt, mergeToken as vt, getTransitionProps as $e, useProStyle as mt } from "@gx-design-vue/pro-provider";
6
6
  import { createTypes as pt } from "vue-types";
7
- import { useThrottleFn as mt, useEventListener as Ee } from "@vueuse/core";
8
- function g(e, t) {
9
- bt(e) && (e = "100%");
10
- var n = yt(e);
7
+ import { useThrottleFn as bt, useEventListener as Ee } from "@vueuse/core";
8
+ function v(e, t) {
9
+ yt(e) && (e = "100%");
10
+ var n = wt(e);
11
11
  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);
12
12
  }
13
13
  function re(e) {
14
14
  return Math.min(1, Math.max(0, e));
15
15
  }
16
- function bt(e) {
16
+ function yt(e) {
17
17
  return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1;
18
18
  }
19
- function yt(e) {
19
+ function wt(e) {
20
20
  return typeof e == "string" && e.indexOf("%") !== -1;
21
21
  }
22
- function Ze(e) {
22
+ function Ue(e) {
23
23
  return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
24
24
  }
25
25
  function oe(e) {
@@ -28,29 +28,29 @@ function oe(e) {
28
28
  function H(e) {
29
29
  return e.length === 1 ? "0" + e : String(e);
30
30
  }
31
- function wt(e, t, n) {
31
+ function St(e, t, n) {
32
32
  return {
33
- r: g(e, 255) * 255,
34
- g: g(t, 255) * 255,
35
- b: g(n, 255) * 255
33
+ r: v(e, 255) * 255,
34
+ g: v(t, 255) * 255,
35
+ b: v(n, 255) * 255
36
36
  };
37
37
  }
38
38
  function Re(e, t, n) {
39
- e = g(e, 255), t = g(t, 255), n = g(n, 255);
39
+ e = v(e, 255), t = v(t, 255), n = v(n, 255);
40
40
  var a = Math.max(e, t, n), i = Math.min(e, t, n), r = 0, o = 0, l = (a + i) / 2;
41
41
  if (a === i)
42
42
  o = 0, r = 0;
43
43
  else {
44
- var c = a - i;
45
- switch (o = l > 0.5 ? c / (2 - a - i) : c / (a + i), a) {
44
+ var f = a - i;
45
+ switch (o = l > 0.5 ? f / (2 - a - i) : f / (a + i), a) {
46
46
  case e:
47
- r = (t - n) / c + (t < n ? 6 : 0);
47
+ r = (t - n) / f + (t < n ? 6 : 0);
48
48
  break;
49
49
  case t:
50
- r = (n - e) / c + 2;
50
+ r = (n - e) / f + 2;
51
51
  break;
52
52
  case n:
53
- r = (e - t) / c + 4;
53
+ r = (e - t) / f + 4;
54
54
  break;
55
55
  }
56
56
  r /= 6;
@@ -60,9 +60,9 @@ function Re(e, t, n) {
60
60
  function be(e, t, n) {
61
61
  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;
62
62
  }
63
- function St(e, t, n) {
63
+ function xt(e, t, n) {
64
64
  var a, i, r;
65
- if (e = g(e, 360), t = g(t, 100), n = g(n, 100), t === 0)
65
+ if (e = v(e, 360), t = v(t, 100), n = v(n, 100), t === 0)
66
66
  i = n, r = n, a = n;
67
67
  else {
68
68
  var o = n < 0.5 ? n * (1 + t) : n + t - n * t, l = 2 * n - o;
@@ -71,8 +71,8 @@ function St(e, t, n) {
71
71
  return { r: a * 255, g: i * 255, b: r * 255 };
72
72
  }
73
73
  function De(e, t, n) {
74
- e = g(e, 255), t = g(t, 255), n = g(n, 255);
75
- 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;
74
+ e = v(e, 255), t = v(t, 255), n = v(n, 255);
75
+ var a = Math.max(e, t, n), i = Math.min(e, t, n), r = 0, o = a, l = a - i, f = a === 0 ? 0 : l / a;
76
76
  if (a === i)
77
77
  r = 0;
78
78
  else {
@@ -89,12 +89,12 @@ function De(e, t, n) {
89
89
  }
90
90
  r /= 6;
91
91
  }
92
- return { h: r, s: c, v: o };
92
+ return { h: r, s: f, v: o };
93
93
  }
94
- function xt(e, t, n) {
95
- e = g(e, 360) * 6, t = g(t, 100), n = g(n, 100);
96
- 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], $ = [r, r, l, n, n, o][c];
97
- return { r: S * 255, g: p * 255, b: $ * 255 };
94
+ function Mt(e, t, n) {
95
+ e = v(e, 360) * 6, t = v(t, 100), n = v(n, 100);
96
+ var a = Math.floor(e), i = e - a, r = n * (1 - t), o = n * (1 - i * t), l = n * (1 - (1 - i) * t), f = a % 6, S = [n, o, r, r, l, n][f], m = [l, n, n, o, r, r][f], E = [r, r, l, n, n, o][f];
97
+ return { r: S * 255, g: m * 255, b: E * 255 };
98
98
  }
99
99
  function He(e, t, n, a) {
100
100
  var i = [
@@ -104,25 +104,25 @@ function He(e, t, n, a) {
104
104
  ];
105
105
  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("");
106
106
  }
107
- function Mt(e, t, n, a, i) {
107
+ function It(e, t, n, a, i) {
108
108
  var r = [
109
109
  H(Math.round(e).toString(16)),
110
110
  H(Math.round(t).toString(16)),
111
111
  H(Math.round(n).toString(16)),
112
- H(It(a))
112
+ H(At(a))
113
113
  ];
114
114
  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("");
115
115
  }
116
- function It(e) {
116
+ function At(e) {
117
117
  return Math.round(parseFloat(e) * 255).toString(16);
118
118
  }
119
119
  function Pe(e) {
120
- return y(e) / 255;
120
+ return w(e) / 255;
121
121
  }
122
- function y(e) {
122
+ function w(e) {
123
123
  return parseInt(e, 16);
124
124
  }
125
- function At(e) {
125
+ function Ct(e) {
126
126
  return {
127
127
  r: e >> 16,
128
128
  g: (e & 65280) >> 8,
@@ -279,9 +279,9 @@ var Ae = {
279
279
  yellow: "#ffff00",
280
280
  yellowgreen: "#9acd32"
281
281
  };
282
- function Ct(e) {
282
+ function Tt(e) {
283
283
  var t = { r: 0, g: 0, b: 0 }, n = 1, a = null, i = null, r = null, o = !1, l = !1;
284
- return typeof e == "string" && (e = zt(e)), typeof e == "object" && (z(e.r) && z(e.g) && z(e.b) ? (t = wt(e.r, e.g, e.b), o = !0, l = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : z(e.h) && z(e.s) && z(e.v) ? (a = oe(e.s), i = oe(e.v), t = xt(e.h, a, i), o = !0, l = "hsv") : z(e.h) && z(e.s) && z(e.l) && (a = oe(e.s), r = oe(e.l), t = St(e.h, a, r), o = !0, l = "hsl"), Object.prototype.hasOwnProperty.call(e, "a") && (n = e.a)), n = Ze(n), {
284
+ return typeof e == "string" && (e = Ot(e)), typeof e == "object" && (L(e.r) && L(e.g) && L(e.b) ? (t = St(e.r, e.g, e.b), o = !0, l = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : L(e.h) && L(e.s) && L(e.v) ? (a = oe(e.s), i = oe(e.v), t = Mt(e.h, a, i), o = !0, l = "hsv") : L(e.h) && L(e.s) && L(e.l) && (a = oe(e.s), r = oe(e.l), t = xt(e.h, a, r), o = !0, l = "hsl"), Object.prototype.hasOwnProperty.call(e, "a") && (n = e.a)), n = Ue(n), {
285
285
  ok: o,
286
286
  format: e.format || l,
287
287
  r: Math.min(255, Math.max(t.r, 0)),
@@ -290,8 +290,8 @@ function Ct(e) {
290
290
  a: n
291
291
  };
292
292
  }
293
- 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*\\)?"), I = {
294
- CSS_UNIT: new RegExp(N),
293
+ var kt = "[-\\+]?\\d+%?", zt = "[-\\+]?\\d*\\.\\d+%?", $ = "(?:".concat(zt, ")|(?:").concat(kt, ")"), ye = "[\\s|\\(]+(".concat($, ")[,|\\s]+(").concat($, ")[,|\\s]+(").concat($, ")\\s*\\)?"), we = "[\\s|\\(]+(".concat($, ")[,|\\s]+(").concat($, ")[,|\\s]+(").concat($, ")[,|\\s]+(").concat($, ")\\s*\\)?"), C = {
294
+ CSS_UNIT: new RegExp($),
295
295
  rgb: new RegExp("rgb" + ye),
296
296
  rgba: new RegExp("rgba" + we),
297
297
  hsl: new RegExp("hsl" + ye),
@@ -303,7 +303,7 @@ var Tt = "[-\\+]?\\d+%?", kt = "[-\\+]?\\d*\\.\\d+%?", N = "(?:".concat(kt, ")|(
303
303
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
304
304
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
305
305
  };
306
- function zt(e) {
306
+ function Ot(e) {
307
307
  if (e = e.trim().toLowerCase(), e.length === 0)
308
308
  return !1;
309
309
  var t = !1;
@@ -311,35 +311,35 @@ function zt(e) {
311
311
  e = Ae[e], t = !0;
312
312
  else if (e === "transparent")
313
313
  return { r: 0, g: 0, b: 0, a: 0, format: "name" };
314
- var n = I.rgb.exec(e);
315
- return n ? { r: n[1], g: n[2], b: n[3] } : (n = I.rgba.exec(e), n ? { r: n[1], g: n[2], b: n[3], a: n[4] } : (n = I.hsl.exec(e), n ? { h: n[1], s: n[2], l: n[3] } : (n = I.hsla.exec(e), n ? { h: n[1], s: n[2], l: n[3], a: n[4] } : (n = I.hsv.exec(e), n ? { h: n[1], s: n[2], v: n[3] } : (n = I.hsva.exec(e), n ? { h: n[1], s: n[2], v: n[3], a: n[4] } : (n = I.hex8.exec(e), n ? {
316
- r: y(n[1]),
317
- g: y(n[2]),
318
- b: y(n[3]),
314
+ var n = C.rgb.exec(e);
315
+ return n ? { r: n[1], g: n[2], b: n[3] } : (n = C.rgba.exec(e), n ? { r: n[1], g: n[2], b: n[3], a: n[4] } : (n = C.hsl.exec(e), n ? { h: n[1], s: n[2], l: n[3] } : (n = C.hsla.exec(e), n ? { h: n[1], s: n[2], l: n[3], a: n[4] } : (n = C.hsv.exec(e), n ? { h: n[1], s: n[2], v: n[3] } : (n = C.hsva.exec(e), n ? { h: n[1], s: n[2], v: n[3], a: n[4] } : (n = C.hex8.exec(e), n ? {
316
+ r: w(n[1]),
317
+ g: w(n[2]),
318
+ b: w(n[3]),
319
319
  a: Pe(n[4]),
320
320
  format: t ? "name" : "hex8"
321
- } : (n = I.hex6.exec(e), n ? {
322
- r: y(n[1]),
323
- g: y(n[2]),
324
- b: y(n[3]),
321
+ } : (n = C.hex6.exec(e), n ? {
322
+ r: w(n[1]),
323
+ g: w(n[2]),
324
+ b: w(n[3]),
325
325
  format: t ? "name" : "hex"
326
- } : (n = I.hex4.exec(e), n ? {
327
- r: y(n[1] + n[1]),
328
- g: y(n[2] + n[2]),
329
- b: y(n[3] + n[3]),
326
+ } : (n = C.hex4.exec(e), n ? {
327
+ r: w(n[1] + n[1]),
328
+ g: w(n[2] + n[2]),
329
+ b: w(n[3] + n[3]),
330
330
  a: Pe(n[4] + n[4]),
331
331
  format: t ? "name" : "hex8"
332
- } : (n = I.hex3.exec(e), n ? {
333
- r: y(n[1] + n[1]),
334
- g: y(n[2] + n[2]),
335
- b: y(n[3] + n[3]),
332
+ } : (n = C.hex3.exec(e), n ? {
333
+ r: w(n[1] + n[1]),
334
+ g: w(n[2] + n[2]),
335
+ b: w(n[3] + n[3]),
336
336
  format: t ? "name" : "hex"
337
337
  } : !1)))))))));
338
338
  }
339
- function z(e) {
340
- return !!I.CSS_UNIT.exec(String(e));
339
+ function L(e) {
340
+ return !!C.CSS_UNIT.exec(String(e));
341
341
  }
342
- var Q = (
342
+ var J = (
343
343
  /** @class */
344
344
  function() {
345
345
  function e(t, n) {
@@ -347,8 +347,8 @@ var Q = (
347
347
  var a;
348
348
  if (t instanceof e)
349
349
  return t;
350
- typeof t == "number" && (t = At(t)), this.originalInput = t;
351
- var i = Ct(t);
350
+ typeof t == "number" && (t = Ct(t)), this.originalInput = t;
351
+ var i = Tt(t);
352
352
  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;
353
353
  }
354
354
  return e.prototype.isDark = function() {
@@ -364,7 +364,7 @@ var Q = (
364
364
  }, e.prototype.getAlpha = function() {
365
365
  return this.a;
366
366
  }, e.prototype.setAlpha = function(t) {
367
- return this.a = Ze(t), this.roundA = Math.round(100 * this.a) / 100, this;
367
+ return this.a = Ue(t), this.roundA = Math.round(100 * this.a) / 100, this;
368
368
  }, e.prototype.isMonochrome = function() {
369
369
  var t = this.toHsl().s;
370
370
  return t === 0;
@@ -385,7 +385,7 @@ var Q = (
385
385
  }, e.prototype.toHexString = function(t) {
386
386
  return t === void 0 && (t = !1), "#" + this.toHex(t);
387
387
  }, e.prototype.toHex8 = function(t) {
388
- return t === void 0 && (t = !1), Mt(this.r, this.g, this.b, this.a, t);
388
+ return t === void 0 && (t = !1), It(this.r, this.g, this.b, this.a, t);
389
389
  }, e.prototype.toHex8String = function(t) {
390
390
  return t === void 0 && (t = !1), "#" + this.toHex8(t);
391
391
  }, e.prototype.toRgb = function() {
@@ -400,7 +400,7 @@ var Q = (
400
400
  return this.a === 1 ? "rgb(".concat(t, ", ").concat(n, ", ").concat(a, ")") : "rgba(".concat(t, ", ").concat(n, ", ").concat(a, ", ").concat(this.roundA, ")");
401
401
  }, e.prototype.toPercentageRgb = function() {
402
402
  var t = function(n) {
403
- return "".concat(Math.round(g(n, 255) * 100), "%");
403
+ return "".concat(Math.round(v(n, 255) * 100), "%");
404
404
  };
405
405
  return {
406
406
  r: t(this.r),
@@ -410,7 +410,7 @@ var Q = (
410
410
  };
411
411
  }, e.prototype.toPercentageRgbString = function() {
412
412
  var t = function(n) {
413
- return Math.round(g(n, 255) * 100);
413
+ return Math.round(v(n, 255) * 100);
414
414
  };
415
415
  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, ")");
416
416
  }, e.prototype.toName = function() {
@@ -512,21 +512,21 @@ var Q = (
512
512
  }, e;
513
513
  }()
514
514
  );
515
- const Ot = new fe("viewFadeIn", {
515
+ const Lt = new ce("viewFadeIn", {
516
516
  "0%": {
517
517
  opacity: 0
518
518
  },
519
519
  "100%": {
520
520
  opacity: 1
521
521
  }
522
- }), Lt = new fe("viewFadeOut", {
522
+ }), Nt = new ce("viewFadeOut", {
523
523
  "0%": {
524
524
  opacity: 1
525
525
  },
526
526
  "100%": {
527
527
  opacity: 0
528
528
  }
529
- }), Nt = new fe("viewZoomBadgeIn", {
529
+ }), $t = new ce("viewZoomBadgeIn", {
530
530
  "0%": {
531
531
  transform: "scale(0.2)",
532
532
  opacity: 0
@@ -535,7 +535,7 @@ const Ot = new fe("viewFadeIn", {
535
535
  transform: "scale(1)",
536
536
  opacity: 1
537
537
  }
538
- }), $t = new fe("viewZoomBadgeOut", {
538
+ }), Et = new ce("viewZoomBadgeOut", {
539
539
  "0%": {
540
540
  transform: "scale(1)"
541
541
  },
@@ -556,7 +556,7 @@ function Se(e) {
556
556
  insetInlineStart: 0
557
557
  };
558
558
  }
559
- const Et = (e) => ({
559
+ const Rt = (e) => ({
560
560
  boxSizing: "border-box",
561
561
  margin: 0,
562
562
  padding: 0,
@@ -565,11 +565,11 @@ const Et = (e) => ({
565
565
  lineHeight: e.lineHeight,
566
566
  listStyle: "none",
567
567
  fontFamily: e.fontFamily
568
- }), Rt = (e) => {
569
- 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);
568
+ }), Dt = (e) => {
569
+ const { componentCls: t, modalMaskBg: n, paddingSM: a, previewOperationColorDisabled: i, motionDurationSlow: r } = e, o = new J(n).setAlpha(0.1), l = o.clone().setAlpha(0.2);
570
570
  return {
571
571
  [`${t}-operations`]: {
572
- ...Et(e),
572
+ ...Rt(e),
573
573
  display: "flex",
574
574
  flexDirection: "row-reverse",
575
575
  alignItems: "center",
@@ -604,8 +604,8 @@ const Et = (e) => ({
604
604
  }
605
605
  }
606
606
  };
607
- }, Dt = (e) => {
608
- const { modalMaskBg: t, previewOperationColorDisabled: n, zIndexPopup: a, motionDurationSlow: i } = e, r = new Q(t).setAlpha(0.1), o = r.clone().setAlpha(0.2);
607
+ }, Ht = (e) => {
608
+ const { modalMaskBg: t, previewOperationColorDisabled: n, zIndexPopup: a, motionDurationSlow: i } = e, r = new J(t).setAlpha(0.1), o = r.clone().setAlpha(0.2);
609
609
  return {
610
610
  [`${e.componentCls}-switch-left, ${e.componentCls}-switch-right`]: {
611
611
  position: "fixed",
@@ -649,7 +649,7 @@ const Et = (e) => ({
649
649
  insetInlineEnd: e.marginSM
650
650
  }
651
651
  };
652
- }, Ht = (e) => ({
652
+ }, Pt = (e) => ({
653
653
  [e.componentCls]: {
654
654
  ["&-root"]: {
655
655
  ...Se("fixed"),
@@ -704,17 +704,17 @@ const Et = (e) => ({
704
704
  pointerEvents: "auto"
705
705
  },
706
706
  ["&-fade-appear, &-fade-enter"]: {
707
- animationName: Ot,
707
+ animationName: Lt,
708
708
  animationDuration: e.motionDurationSlow,
709
709
  animationTimingFunction: "linear"
710
710
  },
711
711
  ["&-fade-leave"]: {
712
- animationName: Lt,
712
+ animationName: Nt,
713
713
  animationDuration: e.motionDurationSlow,
714
714
  animationTimingFunction: "linear"
715
715
  },
716
716
  ["&-zoom-appear, &-zoom-enter"]: {
717
- animationName: Nt,
717
+ animationName: $t,
718
718
  opacity: 0,
719
719
  animationTimingFunction: e.motionEaseOutCirc,
720
720
  animationFillMode: "both",
@@ -726,7 +726,7 @@ const Et = (e) => ({
726
726
  animationPlayState: "running"
727
727
  },
728
728
  ["&-zoom-leave"]: {
729
- animationName: $t,
729
+ animationName: Et,
730
730
  animationDuration: e.motionDurationSlow,
731
731
  animationTimingFunction: e.motionEaseOutBack,
732
732
  animationFillMode: "both"
@@ -744,23 +744,23 @@ const Et = (e) => ({
744
744
  zIndex: e.zIndexPopup + 1,
745
745
  width: "100%"
746
746
  },
747
- "&": [Rt(e), Dt(e)]
747
+ "&": [Dt(e), Ht(e)]
748
748
  });
749
- function Pt(e) {
750
- return ht("ImageView", (t) => {
751
- const n = gt(t, {
749
+ function Ft(e) {
750
+ return gt("ImageView", (t) => {
751
+ const n = vt(t, {
752
752
  zIndexPopup: t.zIndexPopupBase + 80,
753
- previewOperationColorDisabled: new Q(t.colorTextLightSolid).setAlpha(0.25).toRgbString(),
754
- modalMaskBg: new Q("#000").setAlpha(0.45).toRgbString(),
755
- previewOperationColor: new Q(t.colorTextLightSolid).toRgbString(),
753
+ previewOperationColorDisabled: new J(t.colorTextLightSolid).setAlpha(0.25).toRgbString(),
754
+ modalMaskBg: new J("#000").setAlpha(0.45).toRgbString(),
755
+ previewOperationColor: new J(t.colorTextLightSolid).toRgbString(),
756
756
  previewOperationSize: t.fontSizeIcon * 1.5,
757
757
  imagePreviewSwitchSize: t.controlHeightLG,
758
758
  iconCls: "anticon"
759
759
  });
760
- return [Ht(n)];
760
+ return [Pt(n)];
761
761
  }, e);
762
762
  }
763
- const Xe = pt({
763
+ const Ze = pt({
764
764
  func: void 0,
765
765
  bool: void 0,
766
766
  string: void 0,
@@ -769,7 +769,7 @@ const Xe = pt({
769
769
  object: void 0,
770
770
  integer: void 0
771
771
  });
772
- Xe.extend([{
772
+ Ze.extend([{
773
773
  name: "looseBool",
774
774
  getter: !0,
775
775
  type: Boolean,
@@ -784,7 +784,7 @@ Xe.extend([{
784
784
  getter: !0,
785
785
  type: null
786
786
  }]);
787
- const B = Xe, P = {
787
+ const V = Ze, P = {
788
788
  infinite: {
789
789
  type: Boolean,
790
790
  default: !0
@@ -800,7 +800,7 @@ const B = Xe, P = {
800
800
  getContainer: {
801
801
  type: String
802
802
  }
803
- }, ue = {
803
+ }, le = {
804
804
  previewTeleported: {
805
805
  type: Boolean,
806
806
  default: !0
@@ -821,7 +821,7 @@ const B = Xe, P = {
821
821
  type: String,
822
822
  default: "contain"
823
823
  },
824
- lazy: B.bool,
824
+ lazy: V.bool,
825
825
  scrollContainer: {
826
826
  type: [String, Object]
827
827
  },
@@ -844,35 +844,39 @@ const B = Xe, P = {
844
844
  onClick: {
845
845
  type: Function
846
846
  },
847
- disablePreview: B.bool,
847
+ disablePreview: V.bool,
848
848
  previewSrcList: {
849
849
  type: Array,
850
850
  default: () => []
851
851
  },
852
- imageClassName: B.string,
853
- imageStyle: B.style,
854
- width: B.number,
855
- height: B.number,
852
+ imageClassName: V.string,
853
+ imageStyle: V.style,
854
+ width: V.number,
855
+ height: V.number,
856
856
  zIndex: P.zIndex,
857
857
  infinite: P.infinite,
858
858
  getContainer: P.getContainer,
859
- initialIndex: P.initialIndex
860
- }, Ft = {
859
+ initialIndex: {
860
+ ...P.initialIndex,
861
+ default: () => {
862
+ }
863
+ }
864
+ }, jt = {
861
865
  urlList: {
862
866
  type: Array,
863
867
  default: () => []
864
868
  },
865
- teleported: ue.previewTeleported,
869
+ teleported: le.previewTeleported,
866
870
  zIndex: P.zIndex,
867
871
  initialIndex: P.initialIndex,
868
872
  infinite: P.infinite,
869
- getContainer: ue.getContainer,
870
- onHideOnClickModal: ue.hideOnClickModal,
873
+ getContainer: le.getContainer,
874
+ onHideOnClickModal: le.hideOnClickModal,
871
875
  icons: {
872
876
  type: Object,
873
877
  default: () => ({})
874
878
  }
875
- }, V = {
879
+ }, Y = {
876
880
  tab: "Tab",
877
881
  enter: "Enter",
878
882
  space: "Space",
@@ -890,15 +894,15 @@ const B = Xe, P = {
890
894
  }, _ = {
891
895
  CONTAIN: {
892
896
  name: "contain",
893
- icon: u(et, null, null)
897
+ icon: c(et, null, null)
894
898
  },
895
899
  ORIGINAL: {
896
900
  name: "original",
897
- icon: u(tt, null, null)
901
+ icon: c(tt, null, null)
898
902
  }
899
- }, jt = function() {
900
- return !q && !!window.navigator.userAgent.match(/firefox/i);
901
- }, je = jt() ? "DOMMouseScroll" : "mousewheel";
903
+ }, Bt = function() {
904
+ return !Q && !!window.navigator.userAgent.match(/firefox/i);
905
+ }, je = Bt() ? "DOMMouseScroll" : "mousewheel";
902
906
  function Me(e) {
903
907
  let t = !1;
904
908
  return function(...n) {
@@ -907,8 +911,8 @@ function Me(e) {
907
911
  }));
908
912
  };
909
913
  }
910
- const Bt = /* @__PURE__ */ Ve({
911
- props: Ft,
914
+ const Vt = /* @__PURE__ */ Ve({
915
+ props: jt,
912
916
  emits: ["close", "switch"],
913
917
  setup: function(e, {
914
918
  emit: t,
@@ -920,29 +924,31 @@ const Bt = /* @__PURE__ */ Ve({
920
924
  suffixCls: "image-viewer"
921
925
  }), {
922
926
  wrapSSR: l,
923
- hashId: c
924
- } = Pt(o), S = Te(!1), [p, $] = Ne(!1), [T, x] = Ne(!1), k = w(!0), h = w(e.initialIndex), Y = w(null), F = w(null), W = w(_.CONTAIN), d = w({
925
- scale: 1,
926
- deg: 0,
927
- offsetX: 0,
928
- offsetY: 0,
929
- enableTransition: !1
930
- }), G = L(() => e.urlList.length > 1), J = L(() => h.value === 0), K = L(() => h.value === e.urlList.length - 1), ee = L(() => e.urlList[h.value]), de = L(() => {
927
+ hashId: f
928
+ } = Ft(o), S = Te(!1), [m, E] = Ne(!1), [z, x] = Ne(!1), O = A(!0), g = A(e.initialIndex), F = A(null), j = A(null), W = A(_.CONTAIN), d = Xe({
929
+ transform: {
930
+ scale: 1,
931
+ deg: 0,
932
+ offsetX: 0,
933
+ offsetY: 0,
934
+ enableTransition: !1
935
+ }
936
+ }), G = N(() => e.urlList.length > 1), K = N(() => g.value === 0), ee = N(() => g.value === e.urlList.length - 1), te = N(() => e.urlList[g.value]), fe = N(() => {
931
937
  const {
932
938
  scale: s,
933
- deg: m,
934
- offsetX: b,
935
- offsetY: C,
936
- enableTransition: v
937
- } = d.value, M = {
938
- transform: `scale(${s}) rotate(${m}deg)`,
939
- transition: v ? "transform .3s" : "",
940
- marginLeft: `${b}px`,
941
- marginTop: `${C}px`
939
+ deg: M,
940
+ offsetX: h,
941
+ offsetY: y,
942
+ enableTransition: p
943
+ } = d.transform, I = {
944
+ transform: `scale(${s}) rotate(${M}deg)`,
945
+ transition: p ? "transform .3s" : "",
946
+ marginLeft: `${h}px`,
947
+ marginTop: `${y}px`
942
948
  };
943
- return W.value.name === _.CONTAIN.name && (M.maxWidth = M.maxHeight = "100%"), M;
944
- }), te = () => {
945
- ve(), t("close"), d.value = {
949
+ return W.value.name === _.CONTAIN.name && (I.maxWidth = I.maxHeight = "100%"), I;
950
+ }), de = () => {
951
+ ve(), t("close"), d.transform = {
946
952
  scale: 1,
947
953
  deg: 0,
948
954
  offsetX: 0,
@@ -950,34 +956,34 @@ const Bt = /* @__PURE__ */ Ve({
950
956
  enableTransition: !1
951
957
  };
952
958
  }, he = (s) => {
953
- S.value ? S.value = !1 : Y.value === (s == null ? void 0 : s.target) && (x(!1), h.value = e.initialIndex);
959
+ S.value ? S.value = !1 : F.value === (s == null ? void 0 : s.target) && (x(!1), g.value = e.initialIndex);
954
960
  }, ge = () => {
955
961
  a = Me((s) => {
956
962
  switch (s.code) {
957
- case V.esc:
963
+ case Y.esc:
958
964
  x(!1);
959
965
  break;
960
- case V.space:
961
- j();
966
+ case Y.space:
967
+ B();
962
968
  break;
963
- case V.left:
969
+ case Y.left:
964
970
  ne();
965
971
  break;
966
- case V.up:
967
- A("zoomIn");
972
+ case Y.up:
973
+ k("zoomIn");
968
974
  break;
969
- case V.right:
975
+ case Y.right:
970
976
  Z();
971
977
  break;
972
- case V.down:
973
- A("zoomOut");
978
+ case Y.down:
979
+ k("zoomOut");
974
980
  break;
975
981
  }
976
982
  }), i = Me((s) => {
977
- (s.wheelDelta ? s.wheelDelta : -s.detail) > 0 ? A("zoomIn", {
983
+ (s.wheelDelta ? s.wheelDelta : -s.detail) > 0 ? k("zoomIn", {
978
984
  zoomRate: 0.015,
979
985
  enableTransition: !1
980
- }) : A("zoomOut", {
986
+ }) : k("zoomOut", {
981
987
  zoomRate: 0.015,
982
988
  enableTransition: !1
983
989
  });
@@ -985,187 +991,187 @@ const Bt = /* @__PURE__ */ Ve({
985
991
  }, ve = () => {
986
992
  xe(document, "keydown", a), xe(document, je, i), a = null, i = null;
987
993
  }, U = () => {
988
- k.value = !1;
989
- }, f = (s) => {
990
- k.value = !1, s.target.alt = "加载失败";
991
- }, E = Te(), O = (s) => {
992
- if (k.value || s.button !== 0)
994
+ O.value = !1;
995
+ }, u = (s) => {
996
+ O.value = !1, s.target.alt = "加载失败";
997
+ }, b = Te(), T = (s) => {
998
+ if (O.value || s.button !== 0)
993
999
  return;
994
- s.preventDefault(), s.stopPropagation(), clearTimeout(E.value), S.value = !0;
1000
+ s.preventDefault(), s.stopPropagation(), clearTimeout(b.value), S.value = !0;
995
1001
  const {
996
- offsetX: m,
997
- offsetY: b
998
- } = d.value, C = s.pageX, v = s.pageY;
999
- r = Me((M) => {
1000
- d.value = {
1001
- ...d.value,
1002
- offsetX: m + M.pageX - C,
1003
- offsetY: b + M.pageY - v
1002
+ offsetX: M,
1003
+ offsetY: h
1004
+ } = d.transform, y = s.pageX, p = s.pageY;
1005
+ r = Me((I) => {
1006
+ d.transform = {
1007
+ ...d.transform,
1008
+ offsetX: M + I.pageX - y,
1009
+ offsetY: h + I.pageY - p
1004
1010
  };
1005
1011
  }), se(document, "mousemove", r), se(document, "mouseup", () => {
1006
- xe(document, "mousemove", r), p.value && T.value && (E.value = setTimeout(() => {
1012
+ xe(document, "mousemove", r), m.value && z.value && (b.value = setTimeout(() => {
1007
1013
  S.value = !1;
1008
1014
  }));
1009
1015
  });
1010
1016
  }, R = () => {
1011
- d.value = {
1017
+ d.transform = {
1012
1018
  scale: 1,
1013
1019
  deg: 0,
1014
1020
  offsetX: 0,
1015
1021
  offsetY: 0,
1016
1022
  enableTransition: !1
1017
1023
  };
1018
- }, j = () => {
1019
- if (k.value)
1024
+ }, B = () => {
1025
+ if (O.value)
1020
1026
  return;
1021
- const s = Object.keys(_), m = Object.values(_), b = W.value.name, v = (m.findIndex((M) => M.name === b) + 1) % s.length;
1022
- W.value = _[s[v]], R();
1027
+ const s = Object.keys(_), M = Object.values(_), h = W.value.name, p = (M.findIndex((I) => I.name === h) + 1) % s.length;
1028
+ W.value = _[s[p]], R();
1023
1029
  }, ne = () => {
1024
- if (J.value && !e.infinite)
1030
+ if (K.value && !e.infinite)
1025
1031
  return;
1026
1032
  const s = e.urlList.length;
1027
- h.value = (h.value - 1 + s) % s;
1033
+ g.value = (g.value - 1 + s) % s;
1028
1034
  }, Z = () => {
1029
- if (K.value && !e.infinite)
1035
+ if (ee.value && !e.infinite)
1030
1036
  return;
1031
1037
  const s = e.urlList.length;
1032
- h.value = (h.value + 1) % s;
1033
- }, A = (s, m = {}) => {
1034
- if (k.value)
1038
+ g.value = (g.value + 1) % s;
1039
+ }, k = (s, M = {}) => {
1040
+ if (O.value)
1035
1041
  return;
1036
1042
  const {
1037
- zoomRate: b,
1038
- rotateDeg: C,
1039
- enableTransition: v
1043
+ zoomRate: h,
1044
+ rotateDeg: y,
1045
+ enableTransition: p
1040
1046
  } = {
1041
1047
  zoomRate: 0.2,
1042
1048
  rotateDeg: 90,
1043
1049
  enableTransition: !0,
1044
- ...m
1050
+ ...M
1045
1051
  };
1046
1052
  switch (s) {
1047
1053
  case "zoomOut":
1048
- d.value.scale > 0.2 && (d.value.scale = parseFloat((d.value.scale - b).toFixed(3)));
1054
+ d.transform.scale > 0.2 && (d.transform.scale = parseFloat((d.transform.scale - h).toFixed(3)));
1049
1055
  break;
1050
1056
  case "zoomIn":
1051
- d.value.scale = parseFloat((d.value.scale + b).toFixed(3));
1057
+ d.transform.scale = parseFloat((d.transform.scale + h).toFixed(3));
1052
1058
  break;
1053
1059
  case "clocelise":
1054
- d.value.deg += C;
1060
+ d.transform.deg += y;
1055
1061
  break;
1056
1062
  case "anticlocelise":
1057
- d.value.deg -= C;
1063
+ d.transform.deg -= y;
1058
1064
  break;
1059
1065
  }
1060
- d.value.enableTransition = v;
1061
- }, pe = [{
1062
- icon: ((ae = e.icons) == null ? void 0 : ae.close) || u(nt, null, null),
1066
+ d.transform.enableTransition = p;
1067
+ }, me = [{
1068
+ icon: ((ae = e.icons) == null ? void 0 : ae.close) || c(nt, null, null),
1063
1069
  onClick: (s) => {
1064
1070
  s.stopPropagation(), x(!1);
1065
1071
  },
1066
1072
  type: "close"
1067
1073
  }, {
1068
- icon: ((ie = e.icons) == null ? void 0 : ie.zoomIn) || u(at, null, null),
1074
+ icon: ((ie = e.icons) == null ? void 0 : ie.zoomIn) || c(at, null, null),
1069
1075
  onClick: (s) => {
1070
- s.stopPropagation(), A("zoomIn");
1076
+ s.stopPropagation(), k("zoomIn");
1071
1077
  },
1072
1078
  type: "zoomIn"
1073
1079
  }, {
1074
- icon: ((D = e.icons) == null ? void 0 : D.zoomOut) || u(it, null, null),
1080
+ icon: ((D = e.icons) == null ? void 0 : D.zoomOut) || c(it, null, null),
1075
1081
  onClick: (s) => {
1076
- s.stopPropagation(), A("zoomOut");
1082
+ s.stopPropagation(), k("zoomOut");
1077
1083
  },
1078
1084
  type: "zoomOut"
1079
1085
  }, {
1080
- icon: ((X = e.icons) == null ? void 0 : X.rotateRight) || u(rt, null, null),
1086
+ icon: ((X = e.icons) == null ? void 0 : X.rotateRight) || c(rt, null, null),
1081
1087
  onClick: (s) => {
1082
- s.stopPropagation(), A("anticlocelise");
1088
+ s.stopPropagation(), k("anticlocelise");
1083
1089
  },
1084
1090
  type: "rotateRight"
1085
1091
  }, {
1086
- icon: ((Ce = e.icons) == null ? void 0 : Ce.rotateLeft) || u(ot, null, null),
1092
+ icon: ((Ce = e.icons) == null ? void 0 : Ce.rotateLeft) || c(ot, null, null),
1087
1093
  onClick: (s) => {
1088
- s.stopPropagation(), A("clocelise");
1094
+ s.stopPropagation(), k("clocelise");
1089
1095
  },
1090
1096
  type: "rotateLeft"
1091
1097
  }];
1092
- return le(ee, () => {
1098
+ return q(te, () => {
1093
1099
  Ye(() => {
1094
- F.value.complete || (k.value = !0);
1100
+ j.value.complete || (O.value = !0);
1095
1101
  });
1096
- }), le(h, (s) => {
1102
+ }), q(g, (s) => {
1097
1103
  R(), t("switch", s);
1098
- }), le(p, (s) => {
1099
- s && (T.value = s);
1100
- }), Ue(() => {
1101
- var s, m;
1102
- ge(), (m = (s = Y.value) == null ? void 0 : s.focus) == null || m.call(s);
1104
+ }), q(m, (s) => {
1105
+ s && (z.value = s);
1106
+ }), q([() => m.value, () => F.value], ([s, M]) => {
1107
+ var h, y;
1108
+ s && M && (ge(), (y = (h = F.value) == null ? void 0 : h.focus) == null || y.call(h));
1103
1109
  }), n({
1104
- setOpen: $
1110
+ setOpen: E
1105
1111
  }), () => {
1106
- const s = $e(`${o}-fade`), m = $e(`${o}-zoom`);
1107
- return l(u(_e, {
1112
+ const s = $e(`${o}-fade`), M = $e(`${o}-zoom`);
1113
+ return l(c(_e, {
1108
1114
  to: e.getContainer || "body",
1109
1115
  disabled: !e.teleported
1110
1116
  }, {
1111
- default: () => [p.value && u("div", {
1112
- class: `${o}-root ${c.value}`
1113
- }, [u(ke, s, {
1114
- default: () => [ze(u("div", {
1115
- class: `${o}-mask ${c.value}`
1116
- }, null), [[Oe, p.value && T.value]])]
1117
- }), u("div", {
1118
- ref: Y,
1117
+ default: () => [m.value && c("div", {
1118
+ class: `${o}-root ${f.value}`
1119
+ }, [c(ke, s, {
1120
+ default: () => [ze(c("div", {
1121
+ class: `${o}-mask ${f.value}`
1122
+ }, null), [[Oe, m.value && z.value]])]
1123
+ }), c("div", {
1124
+ ref: F,
1119
1125
  tabindex: -1,
1120
- class: [`${o}-wrapper`, `${c.value}`],
1121
- onClick: (b) => e.onHideOnClickModal && he(b)
1122
- }, [u(ke, We(m, {
1123
- onAfterLeave: () => te()
1126
+ class: [`${o}-wrapper`, `${f.value}`],
1127
+ onClick: (h) => e.onHideOnClickModal && he(h)
1128
+ }, [c(ke, We(M, {
1129
+ onAfterLeave: () => de()
1124
1130
  }), {
1125
1131
  default: () => {
1126
- var b, C;
1127
- return [ze(u("div", {
1128
- class: `${o}-block ${c.value}`
1129
- }, [u("div", {
1130
- class: `${o}-content ${c.value}`
1131
- }, [u("div", {
1132
- class: `${o}-body ${c.value}`
1133
- }, [u("div", {
1134
- class: `${o}-operations-wrapper ${c.value}`,
1135
- onClick: (v) => v.stopPropagation()
1136
- }, [u("ul", {
1137
- class: `${o}-operations ${c.value}`
1138
- }, [pe.map(({
1139
- icon: v,
1140
- onClick: M,
1141
- type: me
1142
- }) => u("li", {
1143
- class: `${o}-operations-operation ${c.value}`,
1144
- onClick: M,
1145
- key: me
1146
- }, [qe(v, {
1147
- class: `${o}-operations-icon ${c.value}`
1148
- })]))])]), u("div", {
1149
- class: `${o}-canvas ${c.value}`
1150
- }, [e.urlList.map((v, M) => u("img", {
1151
- ref: F,
1152
- class: `${o}-img ${c.value}`,
1132
+ var h, y;
1133
+ return [ze(c("div", {
1134
+ class: `${o}-block ${f.value}`
1135
+ }, [c("div", {
1136
+ class: `${o}-content ${f.value}`
1137
+ }, [c("div", {
1138
+ class: `${o}-body ${f.value}`
1139
+ }, [c("div", {
1140
+ class: `${o}-operations-wrapper ${f.value}`,
1141
+ onClick: (p) => p.stopPropagation()
1142
+ }, [c("ul", {
1143
+ class: `${o}-operations ${f.value}`
1144
+ }, [me.map(({
1145
+ icon: p,
1146
+ onClick: I,
1147
+ type: pe
1148
+ }) => c("li", {
1149
+ class: `${o}-operations-operation ${f.value}`,
1150
+ onClick: I,
1151
+ key: pe
1152
+ }, [qe(p, {
1153
+ class: `${o}-operations-icon ${f.value}`
1154
+ })]))])]), c("div", {
1155
+ class: `${o}-canvas ${f.value}`
1156
+ }, [e.urlList.map((p, I) => c("img", {
1157
+ ref: j,
1158
+ class: `${o}-img ${f.value}`,
1153
1159
  style: {
1154
- ...de.value,
1155
- display: M === h.value ? "block" : "none"
1160
+ ...fe.value,
1161
+ display: I === g.value ? "block" : "none"
1156
1162
  },
1157
- key: v,
1158
- src: v,
1163
+ key: p,
1164
+ src: p,
1159
1165
  onLoad: () => U(),
1160
- onError: (me) => f(me),
1161
- onMousedown: O
1162
- }, null))]), G.value && u("div", {
1163
- class: [`${o}-switch-left`, h.value === 0 && !e.infinite ? `${o}-switch-left-disabled` : "", `${c.value}`],
1166
+ onError: (pe) => u(pe),
1167
+ onMousedown: T
1168
+ }, null))]), G.value && c("div", {
1169
+ class: [`${o}-switch-left`, g.value === 0 && !e.infinite ? `${o}-switch-left-disabled` : "", `${f.value}`],
1164
1170
  onClick: ne
1165
- }, [((b = e.icons) == null ? void 0 : b.left) || u(st, null, null)]), G.value && u("div", {
1166
- class: [`${o}-switch-right`, h.value === e.urlList.length - 1 && !e.infinite ? `${o}-switch-right-disabled` : "", `${c.value}`],
1171
+ }, [((h = e.icons) == null ? void 0 : h.left) || c(st, null, null)]), G.value && c("div", {
1172
+ class: [`${o}-switch-right`, g.value === e.urlList.length - 1 && !e.infinite ? `${o}-switch-right-disabled` : "", `${f.value}`],
1167
1173
  onClick: Z
1168
- }, [((C = e.icons) == null ? void 0 : C.right) || u(lt, null, null)])])])]), [[Oe, p.value && T.value]])];
1174
+ }, [((y = e.icons) == null ? void 0 : y.right) || c(lt, null, null)])])])]), [[Oe, m.value && z.value]])];
1169
1175
  }
1170
1176
  })])])]
1171
1177
  }));
@@ -1174,7 +1180,7 @@ const Bt = /* @__PURE__ */ Ve({
1174
1180
  }), Ie = {
1175
1181
  width: "100%",
1176
1182
  height: "100%"
1177
- }, Vt = (e) => ({
1183
+ }, Yt = (e) => ({
1178
1184
  [e.componentCls]: {
1179
1185
  display: "inline-block",
1180
1186
  position: "relative",
@@ -1204,10 +1210,10 @@ const Bt = /* @__PURE__ */ Ve({
1204
1210
  cursor: "pointer"
1205
1211
  }
1206
1212
  }
1207
- }), Yt = (e) => e && e.nodeType === Node.ELEMENT_NODE;
1213
+ }), Wt = (e) => e && e.nodeType === Node.ELEMENT_NODE;
1208
1214
  let Be = "";
1209
- const ce = /* @__PURE__ */ Ve({
1210
- props: ue,
1215
+ const ue = /* @__PURE__ */ Ve({
1216
+ props: le,
1211
1217
  name: "GImage",
1212
1218
  emits: ["error", "click", "load"],
1213
1219
  setup(e, {
@@ -1220,124 +1226,131 @@ const ce = /* @__PURE__ */ Ve({
1220
1226
  }), {
1221
1227
  wrapSSR: r,
1222
1228
  hashId: o
1223
- } = vt("Image", [Vt], i), l = w(), c = w(""), S = w(!1), p = w(!0), $ = w(!1), T = w(null), x = w();
1224
- let k, h;
1225
- const Y = L(() => !q && e.fit ? {
1229
+ } = mt("Image", [Yt], i), l = A(), f = A(""), S = A(!1), m = A(!0), E = A(!1), z = A(null), x = A();
1230
+ let O, g;
1231
+ const F = N(() => !Q && e.fit ? {
1226
1232
  "object-fit": e.fit
1227
- } : {}), F = L(() => {
1233
+ } : {}), j = N(() => {
1228
1234
  const {
1229
- previewSrcList: f
1235
+ previewSrcList: u
1230
1236
  } = e;
1231
- return Array.isArray(f) && f.length > 0;
1232
- }), W = L(() => {
1237
+ return Array.isArray(u) && u.length > 0;
1238
+ }), W = N(() => {
1233
1239
  const {
1234
- src: f,
1235
- previewSrcList: E,
1236
- initialIndex: O
1240
+ src: u,
1241
+ previewSrcList: b,
1242
+ initialIndex: T
1237
1243
  } = e;
1238
- if (O || O === 0)
1239
- return E.length >= O ? O : 0;
1244
+ if (T || T === 0)
1245
+ return b.length >= T ? T : 0;
1240
1246
  let R = 0;
1241
- const j = E.indexOf(f);
1242
- return j >= 0 && (R = j), R;
1247
+ const B = b.indexOf(u);
1248
+ return B >= 0 && (R = B), R;
1243
1249
  }), d = () => {
1244
- q || (p.value = !0, S.value = !1, e.src ? c.value = e.src : te());
1250
+ if (Q)
1251
+ return;
1252
+ m.value = !0, S.value = !1;
1253
+ const u = new Image();
1254
+ u.onload = (b) => fe(b), u.onerror = de, Object.keys(a || {}).forEach((b) => {
1255
+ if (b.toLowerCase() === "onload")
1256
+ return;
1257
+ const T = (a || {})[b];
1258
+ u.setAttribute(b, T);
1259
+ }), u.src = e.src;
1245
1260
  };
1246
1261
  function G() {
1247
- ut(T.value, x.value) && (d(), ee());
1262
+ ut(z.value, x.value) && (d(), te());
1248
1263
  }
1249
- const J = mt(G, 200), K = async () => {
1250
- if (q)
1264
+ const K = bt(G, 200), ee = async () => {
1265
+ if (Q)
1251
1266
  return;
1252
1267
  await Ye();
1253
1268
  const {
1254
- scrollContainer: f
1269
+ scrollContainer: u
1255
1270
  } = e;
1256
- Yt(f) ? x.value = f : ct(f) && f !== "" ? x.value = document.querySelector(f) ?? void 0 : T.value && (x.value = ft(T.value)), x.value && (k = Ee(x, "scroll", J), setTimeout(() => G(), 200));
1257
- }, ee = () => {
1258
- q || !x.value || !J || (k(), x.value = void 0);
1259
- }, de = (f) => {
1260
- p.value = !1, S.value = !1, n("load", f);
1261
- }, te = (f) => {
1262
- p.value = !1, S.value = !0, n("error", f);
1263
- }, he = (f) => {
1264
- if (f.ctrlKey) {
1265
- if (f.deltaY < 0)
1266
- return f.preventDefault(), !1;
1267
- if (f.deltaY > 0)
1268
- return f.preventDefault(), !1;
1271
+ Wt(u) ? x.value = u : ct(u) && u !== "" ? x.value = document.querySelector(u) ?? void 0 : z.value && (x.value = ft(z.value)), x.value && (O = Ee(x, "scroll", K), setTimeout(() => G(), 200));
1272
+ }, te = () => {
1273
+ Q || !x.value || !K || (O(), x.value = void 0);
1274
+ }, fe = (u) => {
1275
+ f.value = e.src, m.value = !1, S.value = !1, n("load", u);
1276
+ }, de = (u) => {
1277
+ m.value = !1, S.value = !0, n("error", u);
1278
+ }, he = (u) => {
1279
+ if (u.ctrlKey) {
1280
+ if (u.deltaY < 0)
1281
+ return u.preventDefault(), !1;
1282
+ if (u.deltaY > 0)
1283
+ return u.preventDefault(), !1;
1269
1284
  }
1270
1285
  }, ge = () => {
1271
- !F.value || e.disablePreview || (h = Ee("wheel", he, {
1286
+ !j.value || e.disablePreview || (g = Ee("wheel", he, {
1272
1287
  passive: !1
1273
- }), Be = document.body.style.overflow, document.body.style.overflow = "hidden", $.value = !0);
1288
+ }), Be = document.body.style.overflow, document.body.style.overflow = "hidden", E.value = !0);
1274
1289
  }, ve = () => {
1275
- h == null || h(), document.body.style.overflow = Be, $.value = !1;
1290
+ g == null || g(), document.body.style.overflow = Be, E.value = !1;
1276
1291
  };
1277
- le(() => e.src, () => {
1278
- e.lazy ? (p.value = !0, S.value = !1, ee(), K()) : d();
1292
+ q(() => e.src, () => {
1293
+ e.lazy ? (m.value = !0, S.value = !1, te(), ee()) : d();
1279
1294
  });
1280
- const U = (f) => dt(f) ? f + "px" : f;
1281
- return Ue(() => {
1282
- e.lazy ? K() : d();
1295
+ const U = (u) => dt(u) ? u + "px" : u;
1296
+ return ht(() => {
1297
+ e.lazy ? ee() : d();
1283
1298
  }), () => {
1284
1299
  const {
1285
- crossorigin: f,
1286
- decoding: E,
1287
- alt: O,
1300
+ crossorigin: u,
1301
+ decoding: b,
1302
+ alt: T,
1288
1303
  sizes: R,
1289
- srcset: j,
1304
+ srcset: B,
1290
1305
  usemap: ne,
1291
1306
  class: Z,
1292
- style: A = {}
1293
- } = a, pe = {
1294
- crossorigin: f,
1295
- decoding: E,
1296
- alt: O,
1307
+ style: k = {}
1308
+ } = a, me = {
1309
+ crossorigin: u,
1310
+ decoding: b,
1311
+ alt: T,
1297
1312
  sizes: R,
1298
- srcset: j,
1313
+ srcset: B,
1299
1314
  usemap: ne,
1300
1315
  style: {
1301
- ...Y.value,
1316
+ ...F.value,
1302
1317
  height: e.height ? U(e.height) : void 0
1303
1318
  }
1304
1319
  }, ae = Le(t, e, "fallback"), ie = Le(t, e, "placeholder");
1305
1320
  return Qe(() => {
1306
1321
  var D, X;
1307
- F.value && $.value ? (D = l.value) == null || D.setOpen(!0) : (X = l.value) == null || X.setOpen(!1);
1308
- }), r(u(Je, null, [u("div", {
1322
+ j.value && E.value ? (D = l.value) == null || D.setOpen(!0) : (X = l.value) == null || X.setOpen(!1);
1323
+ }), r(c(Je, null, [c("div", {
1309
1324
  class: {
1310
1325
  [`${o.value}`]: !0,
1311
1326
  [`${i}`]: !0,
1312
1327
  [`${Z}`]: !!Z
1313
1328
  },
1314
- ref: (D) => T.value = D,
1329
+ ref: (D) => z.value = D,
1315
1330
  style: {
1316
- ...A,
1317
1331
  width: e.width ? U(e.width) : void 0,
1318
1332
  height: e.height ? U(e.height) : void 0,
1319
- display: e.lazy ? "block" : void 0
1333
+ display: e.lazy ? "block" : void 0,
1334
+ ...k
1320
1335
  },
1321
1336
  onClick: () => {
1322
1337
  n("click");
1323
1338
  }
1324
- }, [p.value && (ie || u("div", {
1339
+ }, [m.value ? ie || c("div", {
1325
1340
  class: `${i}-placeholder ${o.value}`
1326
- }, null)), S.value ? ae || u("div", {
1341
+ }, null) : S.value ? ae || c("div", {
1327
1342
  class: `${i}-error ${o.value}`
1328
- }, [Ke("加载失败")]) : c.value && u("img", We(pe, {
1343
+ }, [Ke("加载失败")]) : f.value && c("img", We(me, {
1329
1344
  class: {
1330
1345
  [`${o.value}`]: !0,
1331
1346
  [`${e.imageClassName}`]: !!e.imageClassName,
1332
1347
  [`${i}-inner`]: !0,
1333
- [`${i}-preview`]: F.value
1348
+ [`${i}-preview`]: j.value
1334
1349
  },
1335
1350
  alt: e.alt,
1336
- src: c.value,
1337
- onLoad: de,
1338
- onError: te,
1351
+ src: f.value,
1339
1352
  onClick: () => ge()
1340
- }), null), u(Bt, {
1353
+ }), null), c(Vt, {
1341
1354
  ref: l,
1342
1355
  zIndex: e.zIndex,
1343
1356
  infinite: e.infinite,
@@ -1350,10 +1363,10 @@ const ce = /* @__PURE__ */ Ve({
1350
1363
  };
1351
1364
  }
1352
1365
  });
1353
- ce.isWImage = !0;
1354
- ce.install = (e) => (e.component(ce.name, ce), e);
1366
+ ue.isWImage = !0;
1367
+ ue.install = (e) => (e.component(ue.name, ue), e);
1355
1368
  export {
1356
- ce as GImage,
1357
- Bt as ImageViewer,
1358
- ce as default
1369
+ ue as GImage,
1370
+ Vt as ImageViewer,
1371
+ ue as default
1359
1372
  };