@gx-design-vue/image 0.2.0-beta.27 → 0.2.0-beta.28

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,38 +1,38 @@
1
- import { ref as L, defineComponent as pe, createVNode as u, Teleport as Ee, Transition as ge, withDirectives as me, Fragment as re, cloneVNode as ot, vShow as he, toRef as F, reactive as it, computed as b, watch as K, onMounted as Te, onUnmounted as at, mergeProps as ae, watchEffect as lt, createTextVNode as rt, nextTick as st } from "vue";
2
- import { getTransitionProps as we, Keyframe as ue, useStyle as ut, mergeToken as ct, useProStyle as dt, unit as be } from "@gx-design-vue/pro-provider";
3
- import { classNames as Q, getPrefixCls as De, isNumber as Re, getSlotVNode as H, isArray as ft, getSlot as vt, getSlotsProps as gt, isInContainer as mt, isString as ht, getScrollContainer as wt } from "@gx-design-vue/pro-utils";
4
- import { useWindowSize as Ne, isClient as q, useThrottleFn as pt, useEventListener as $e } from "@vueuse/core";
5
- import { isEqual as yt, cloneDeep as St, omit as Pe, fromPairs as Ct, pick as xt } from "lodash-es";
6
- import { CloseOutlined as It, LeftOutlined as bt, RightOutlined as $t, SwapOutlined as ze, ZoomOutOutlined as zt, ZoomInOutlined as Lt, RotateRightOutlined as Mt, RotateLeftOutlined as Ot } from "@ant-design/icons-vue";
7
- import { useState as ee, useEffect as ye, useMergedState as At } from "@gx-design-vue/pro-hooks";
1
+ import { ref as L, defineComponent as Se, createVNode as u, Teleport as Te, Transition as he, withDirectives as we, Fragment as se, cloneVNode as it, vShow as pe, toRef as k, reactive as at, computed as b, watch as J, onMounted as De, onUnmounted as lt, mergeProps as le, watchEffect as rt, nextTick as st } from "vue";
2
+ import { CloseOutlined as ut, LeftOutlined as ct, RightOutlined as dt, SwapOutlined as ze, ZoomOutOutlined as ft, ZoomInOutlined as vt, RotateRightOutlined as gt, RotateLeftOutlined as mt, EyeOutlined as ht } from "@ant-design/icons-vue";
3
+ import { getTransitionProps as ye, Keyframe as ce, useStyle as wt, mergeToken as pt, unit as ee, FastColor as yt, useProStyle as St } from "@gx-design-vue/pro-provider";
4
+ import { classNames as X, getPrefixCls as Re, isNumber as Ne, getSlotVNode as H, isArray as Ct, getSlot as Pe, getSlotsProps as xt, isInContainer as It, isString as bt, getScrollContainer as $t } from "@gx-design-vue/pro-utils";
5
+ import { useWindowSize as Xe, isClient as Q, useThrottleFn as zt, useEventListener as Le } from "@vueuse/core";
6
+ import { isEqual as Lt, cloneDeep as Ot, omit as Ye, fromPairs as Mt, pick as At } from "lodash-es";
7
+ import { useState as ne, useEffect as Ce, useMergedState as Et } from "@gx-design-vue/pro-hooks";
8
8
  import { TinyColor as Z } from "@ctrl/tinycolor";
9
- let Xe = (e) => setTimeout(e, 16), Ye = (e) => clearTimeout(e);
10
- typeof window < "u" && "requestAnimationFrame" in window && (Xe = (e) => window.requestAnimationFrame(e), Ye = (e) => window.cancelAnimationFrame(e));
11
- let Le = 0;
12
- const Se = /* @__PURE__ */ new Map();
13
- function je(e) {
14
- Se.delete(e);
9
+ let je = (e) => setTimeout(e, 16), Be = (e) => clearTimeout(e);
10
+ typeof window < "u" && "requestAnimationFrame" in window && (je = (e) => window.requestAnimationFrame(e), Be = (e) => window.cancelAnimationFrame(e));
11
+ let Oe = 0;
12
+ const xe = /* @__PURE__ */ new Map();
13
+ function Fe(e) {
14
+ xe.delete(e);
15
15
  }
16
- function Be(e, n = 1) {
17
- Le += 1;
18
- const o = Le;
16
+ function ke(e, n = 1) {
17
+ Oe += 1;
18
+ const o = Oe;
19
19
  function l(t) {
20
20
  if (t === 0)
21
- je(o), e();
21
+ Fe(o), e();
22
22
  else {
23
- const s = Xe(() => {
23
+ const r = je(() => {
24
24
  l(t - 1);
25
25
  });
26
- Se.set(o, s);
26
+ xe.set(o, r);
27
27
  }
28
28
  }
29
29
  return l(n), o;
30
30
  }
31
- Be.cancel = (e) => {
32
- const n = Se.get(e);
33
- return je(n), Ye(n);
31
+ ke.cancel = (e) => {
32
+ const n = xe.get(e);
33
+ return Fe(n), Be(n);
34
34
  };
35
- const oe = {
35
+ const ae = {
36
36
  x: 0,
37
37
  y: 0,
38
38
  rotate: 0,
@@ -40,16 +40,16 @@ const oe = {
40
40
  flipX: !1,
41
41
  flipY: !1
42
42
  };
43
- function Et(e, n, o, l) {
44
- const t = L(null), s = L([]), [c, h] = ee(oe), y = (m) => {
45
- h(oe), yt(oe, c.value) || l == null || l({ transform: oe, action: m });
43
+ function Tt(e, n, o, l) {
44
+ const t = L(null), r = L([]), [c, h] = ne(ae), y = (m) => {
45
+ h(ae), Lt(ae, c.value) || l == null || l({ transform: ae, action: m });
46
46
  }, d = (m, w) => {
47
- t.value === null && (s.value = [], t.value = Be(() => {
48
- let C = St(c.value);
49
- s.value.forEach((a) => {
50
- C = { ...C, ...a };
51
- }), t.value = null, l == null || l({ transform: C, action: w }), h(C);
52
- })), s.value.push({
47
+ t.value === null && (r.value = [], t.value = ke(() => {
48
+ let x = Ot(c.value);
49
+ r.value.forEach((a) => {
50
+ x = { ...x, ...a };
51
+ }), t.value = null, l == null || l({ transform: x, action: w }), h(x);
52
+ })), r.value.push({
53
53
  ...c.value,
54
54
  ...m
55
55
  });
@@ -58,41 +58,41 @@ function Et(e, n, o, l) {
58
58
  transform: c,
59
59
  resetTransform: y,
60
60
  updateTransform: d,
61
- dispatchZoomChange: (m, w, C, a, i) => {
62
- const { width: p, height: f, offsetWidth: S, offsetHeight: x, offsetLeft: $, offsetTop: T } = e.value;
63
- let M = m, I = c.value.scale * m;
64
- I > o.value ? (I = o.value, M = o.value / c.value.scale) : I < n.value && (I = i ? I : n.value, M = I / c.value.scale);
65
- const B = C ?? innerWidth / 2, k = a ?? innerHeight / 2, N = M - 1, O = N * p * 0.5, P = N * f * 0.5, X = N * (B - c.value.x - $), W = N * (k - c.value.y - T);
66
- let Y = c.value.x - (X - O), j = c.value.y - (W - P);
61
+ dispatchZoomChange: (m, w, x, a, i) => {
62
+ const { width: p, height: g, offsetWidth: S, offsetHeight: C, offsetLeft: $, offsetTop: T } = e.value;
63
+ let O = m, I = c.value.scale * m;
64
+ I > o.value ? (I = o.value, O = o.value / c.value.scale) : I < n.value && (I = i ? I : n.value, O = I / c.value.scale);
65
+ const F = x ?? innerWidth / 2, W = a ?? innerHeight / 2, N = O - 1, M = N * p * 0.5, P = N * g * 0.5, Y = N * (F - c.value.x - $), _ = N * (W - c.value.y - T);
66
+ let j = c.value.x - (Y - M), B = c.value.y - (_ - P);
67
67
  if (m < 1 && I === 1) {
68
- const D = S * I, v = x * I, { width: A, height: E } = Ne();
69
- D <= A.value && v <= E.value && (Y = 0, j = 0);
68
+ const D = S * I, f = C * I, { width: A, height: E } = Xe();
69
+ D <= A.value && f <= E.value && (j = 0, B = 0);
70
70
  }
71
71
  d({
72
- x: Y,
73
- y: j,
72
+ x: j,
73
+ y: B,
74
74
  scale: I
75
75
  }, w);
76
76
  }
77
77
  };
78
78
  }
79
- function Tt(e, n) {
79
+ function Dt(e, n) {
80
80
  process.env.NODE_ENV !== "production" && console !== void 0 && console.error(`Warning: ${n}`);
81
81
  }
82
- let Fe = !1;
82
+ let He = !1;
83
83
  try {
84
84
  const e = Object.defineProperty({}, "passive", {
85
85
  get() {
86
- Fe = !0;
86
+ He = !0;
87
87
  }
88
88
  });
89
89
  window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e);
90
90
  } catch {
91
91
  }
92
- function V(e, n, o, l) {
92
+ function q(e, n, o, l) {
93
93
  if (e && e.addEventListener) {
94
94
  let t = l;
95
- t === void 0 && Fe && (n === "touchstart" || n === "touchmove" || n === "wheel") && (t = { passive: !1 }), e.addEventListener(n, o, t);
95
+ t === void 0 && He && (n === "touchstart" || n === "touchmove" || n === "wheel") && (t = { passive: !1 }), e.addEventListener(n, o, t);
96
96
  }
97
97
  return {
98
98
  remove: () => {
@@ -100,42 +100,42 @@ function V(e, n, o, l) {
100
100
  }
101
101
  };
102
102
  }
103
- const U = 1, Dt = 1;
103
+ const K = 1, Rt = 1;
104
104
  function Me(e, n, o, l) {
105
- const t = n + o, s = (o - l) / 2;
105
+ const t = n + o, r = (o - l) / 2;
106
106
  if (o > l) {
107
107
  if (n > 0)
108
108
  return {
109
- [e]: s
109
+ [e]: r
110
110
  };
111
111
  if (n < 0 && t < l)
112
112
  return {
113
- [e]: -s
113
+ [e]: -r
114
114
  };
115
115
  } else if (n < 0 || t > l)
116
116
  return {
117
- [e]: n < 0 ? s : -s
117
+ [e]: n < 0 ? r : -r
118
118
  };
119
119
  return {};
120
120
  }
121
- function He(e, n, o, l) {
122
- const { width: t, height: s } = Ne();
121
+ function Ze(e, n, o, l) {
122
+ const { width: t, height: r } = Xe();
123
123
  let c = null;
124
- return e <= t.value && n <= s.value ? c = {
124
+ return e <= t.value && n <= r.value ? c = {
125
125
  x: 0,
126
126
  y: 0
127
- } : (e > t.value || n > s.value) && (c = {
127
+ } : (e > t.value || n > r.value) && (c = {
128
128
  ...Me("x", o, e, t.value),
129
- ...Me("y", l, n, s.value)
129
+ ...Me("y", l, n, r.value)
130
130
  }), c;
131
131
  }
132
- function Rt(e, n, o, l, t, s, c) {
133
- const [h, y] = ee(!1), d = L({
132
+ function Nt(e, n, o, l, t, r, c) {
133
+ const [h, y] = ne(!1), d = L({
134
134
  diffX: 0,
135
135
  diffY: 0,
136
136
  transformX: 0,
137
137
  transformY: 0
138
- }), g = (a) => {
138
+ }), v = (a) => {
139
139
  !n || a.button !== 0 || (a.preventDefault(), a.stopPropagation(), d.value = {
140
140
  diffX: a.pageX - t.value.x,
141
141
  diffY: a.pageY - t.value.y,
@@ -143,7 +143,7 @@ function Rt(e, n, o, l, t, s, c) {
143
143
  transformY: t.value.y
144
144
  }, y(!0));
145
145
  }, m = (a) => {
146
- o && h.value && s({
146
+ o && h.value && r({
147
147
  x: a.pageX - d.value.diffX,
148
148
  y: a.pageY - d.value.diffY
149
149
  }, "move");
@@ -153,54 +153,54 @@ function Rt(e, n, o, l, t, s, c) {
153
153
  const { transformX: a, transformY: i } = d.value;
154
154
  if (!(t.value.x !== a && t.value.y !== i))
155
155
  return;
156
- const f = e.value.offsetWidth * t.value.scale, S = e.value.offsetHeight * t.value.scale, { left: x, top: $ } = e.value.getBoundingClientRect(), T = t.value.rotate % 180 !== 0, M = He(T ? S : f, T ? f : S, x, $);
157
- M && s({ ...M }, "dragRebound");
156
+ const g = e.value.offsetWidth * t.value.scale, S = e.value.offsetHeight * t.value.scale, { left: C, top: $ } = e.value.getBoundingClientRect(), T = t.value.rotate % 180 !== 0, O = Ze(T ? S : g, T ? g : S, C, $);
157
+ O && r({ ...O }, "dragRebound");
158
158
  }
159
- }, C = (a) => {
159
+ }, x = (a) => {
160
160
  if (!o || a.deltaY === 0)
161
161
  return;
162
- const i = Math.abs(a.deltaY / 100), p = Math.min(i, Dt);
163
- let f = U + p * l.value;
164
- a.deltaY > 0 && (f = U / f), c(f, "wheel", a.clientX, a.clientY);
162
+ const i = Math.abs(a.deltaY / 100), p = Math.min(i, Rt);
163
+ let g = K + p * l.value;
164
+ a.deltaY > 0 && (g = K / g), c(g, "wheel", a.clientX, a.clientY);
165
165
  };
166
- return ye(() => {
167
- let a, i, p, f;
166
+ return Ce(() => {
167
+ let a, i, p, g;
168
168
  if (n) {
169
- p = V(window, "mouseup", w, !1), f = V(window, "mousemove", m, !1);
169
+ p = q(window, "mouseup", w, !1), g = q(window, "mousemove", m, !1);
170
170
  try {
171
- window.top !== window.self && (a = V(window.top, "mouseup", w, !1), i = V(window.top, "mousemove", m, !1));
171
+ window.top !== window.self && (a = q(window.top, "mouseup", w, !1), i = q(window.top, "mousemove", m, !1));
172
172
  } catch (S) {
173
- Tt(!1, `[rc-image] ${S}`);
173
+ Dt(!1, `[rc-image] ${S}`);
174
174
  }
175
175
  }
176
176
  return () => {
177
- p == null || p.remove(), f == null || f.remove(), a == null || a.remove(), i == null || i.remove();
177
+ p == null || p.remove(), g == null || g.remove(), a == null || a.remove(), i == null || i.remove();
178
178
  };
179
179
  }, [o, h, () => t.value.x, () => t.value.y, () => t.value.rotate, n]), {
180
180
  isMoving: h,
181
- onMouseDown: g,
181
+ onMouseDown: v,
182
182
  onMouseMove: m,
183
183
  onMouseUp: w,
184
- onWheel: C
184
+ onWheel: x
185
185
  };
186
186
  }
187
- function se(e, n) {
187
+ function ue(e, n) {
188
188
  const o = e.x - n.x, l = e.y - n.y;
189
189
  return Math.hypot(o, l);
190
190
  }
191
- function Nt(e, n, o, l) {
192
- const t = se(e, o), s = se(n, l);
193
- if (t === 0 && s === 0)
191
+ function Pt(e, n, o, l) {
192
+ const t = ue(e, o), r = ue(n, l);
193
+ if (t === 0 && r === 0)
194
194
  return [e.x, e.y];
195
- const c = t / (t + s), h = e.x + c * (n.x - e.x), y = e.y + c * (n.y - e.y);
195
+ const c = t / (t + r), h = e.x + c * (n.x - e.x), y = e.y + c * (n.y - e.y);
196
196
  return [h, y];
197
197
  }
198
- function Pt(e, n, o, l, t, s, c) {
199
- const [h, y] = ee(!1), d = L({
198
+ function Xt(e, n, o, l, t, r, c) {
199
+ const [h, y] = ne(!1), d = L({
200
200
  point1: { x: 0, y: 0 },
201
201
  point2: { x: 0, y: 0 },
202
202
  eventType: "none"
203
- }), g = (a) => {
203
+ }), v = (a) => {
204
204
  d.value = {
205
205
  ...d.value,
206
206
  ...a
@@ -210,11 +210,11 @@ function Pt(e, n, o, l, t, s, c) {
210
210
  return;
211
211
  a.stopPropagation(), y(!0);
212
212
  const { touches: i = [] } = a;
213
- i.length > 1 ? g({
213
+ i.length > 1 ? v({
214
214
  point1: { x: i[0].clientX, y: i[0].clientY },
215
215
  point2: { x: i[1].clientX, y: i[1].clientY },
216
216
  eventType: "touchZoom"
217
- }) : g({
217
+ }) : v({
218
218
  point1: {
219
219
  x: i[0].clientX - t.value.x,
220
220
  y: i[0].clientY - t.value.y
@@ -222,35 +222,35 @@ function Pt(e, n, o, l, t, s, c) {
222
222
  eventType: "move"
223
223
  });
224
224
  }, w = (a) => {
225
- const { touches: i = [] } = a, { point1: p, point2: f, eventType: S } = d.value;
225
+ const { touches: i = [] } = a, { point1: p, point2: g, eventType: S } = d.value;
226
226
  if (i.length > 1 && S === "touchZoom") {
227
- const x = {
227
+ const C = {
228
228
  x: i[0].clientX,
229
229
  y: i[0].clientY
230
230
  }, $ = {
231
231
  x: i[1].clientX,
232
232
  y: i[1].clientY
233
- }, [T, M] = Nt(p, f, x, $), I = se(x, $) / se(p, f);
234
- c(I, "touchZoom", T, M, !0), g({
235
- point1: x,
233
+ }, [T, O] = Pt(p, g, C, $), I = ue(C, $) / ue(p, g);
234
+ c(I, "touchZoom", T, O, !0), v({
235
+ point1: C,
236
236
  point2: $,
237
237
  eventType: "touchZoom"
238
238
  });
239
- } else S === "move" && (s({
239
+ } else S === "move" && (r({
240
240
  x: i[0].clientX - p.x,
241
241
  y: i[0].clientY - p.y
242
- }, "move"), g({ eventType: "move" }));
243
- }, C = () => {
242
+ }, "move"), v({ eventType: "move" }));
243
+ }, x = () => {
244
244
  if (!o.value)
245
245
  return;
246
- if (h && y(!1), g({ eventType: "none" }), l.value > t.value.scale)
247
- return s({ x: 0, y: 0, scale: l.value }, "touchZoom");
248
- const a = e.value.offsetWidth * t.value.scale, i = e.value.offsetHeight * t.value.scale, { left: p, top: f } = e.value.getBoundingClientRect(), S = t.value.rotate % 180 !== 0, x = He(S ? i : a, S ? a : i, p, f);
249
- x && s({ ...x }, "dragRebound");
246
+ if (h && y(!1), v({ eventType: "none" }), l.value > t.value.scale)
247
+ return r({ x: 0, y: 0, scale: l.value }, "touchZoom");
248
+ const a = e.value.offsetWidth * t.value.scale, i = e.value.offsetHeight * t.value.scale, { left: p, top: g } = e.value.getBoundingClientRect(), S = t.value.rotate % 180 !== 0, C = Ze(S ? i : a, S ? a : i, p, g);
249
+ C && r({ ...C }, "dragRebound");
250
250
  };
251
- return ye(() => {
251
+ return Ce(() => {
252
252
  let a;
253
- return o.value && n.value && (a = V(window, "touchmove", (i) => i.preventDefault(), {
253
+ return o.value && n.value && (a = q(window, "touchmove", (i) => i.preventDefault(), {
254
254
  passive: !1
255
255
  })), () => {
256
256
  a == null || a.remove();
@@ -259,10 +259,10 @@ function Pt(e, n, o, l, t, s, c) {
259
259
  isTouching: h,
260
260
  onTouchStart: m,
261
261
  onTouchMove: w,
262
- onTouchEnd: C
262
+ onTouchEnd: x
263
263
  };
264
264
  }
265
- const J = {
265
+ const te = {
266
266
  infinite: {
267
267
  type: Boolean,
268
268
  default: !0
@@ -278,7 +278,7 @@ const J = {
278
278
  getContainer: {
279
279
  type: String
280
280
  }
281
- }, Ze = {
281
+ }, We = {
282
282
  preview: {
283
283
  type: [Object, Boolean],
284
284
  default: !0
@@ -298,7 +298,7 @@ const J = {
298
298
  type: String,
299
299
  default: "contain"
300
300
  },
301
- crossorigin: {
301
+ crossOrigin: {
302
302
  type: String
303
303
  },
304
304
  lazy: Boolean,
@@ -324,16 +324,17 @@ const J = {
324
324
  onClick: {
325
325
  type: Function
326
326
  },
327
- wrapperStyle: {
327
+ imageStyle: {
328
328
  type: Object,
329
329
  default: () => ({})
330
330
  },
331
- wrapperClass: String,
331
+ imageClass: String,
332
+ size: Number,
332
333
  width: Number,
333
334
  height: Number,
334
- zIndex: J.zIndex,
335
- getContainer: J.getContainer
336
- }, G = {
335
+ zIndex: te.zIndex,
336
+ getContainer: te.getContainer
337
+ }, V = {
337
338
  urls: {
338
339
  type: Array,
339
340
  default: () => []
@@ -359,10 +360,10 @@ const J = {
359
360
  default: !0
360
361
  },
361
362
  disabled: Boolean,
362
- zIndex: J.zIndex,
363
- current: J.current,
364
- infinite: J.infinite,
365
- getContainer: Ze.getContainer,
363
+ zIndex: te.zIndex,
364
+ current: te.current,
365
+ infinite: te.infinite,
366
+ getContainer: We.getContainer,
366
367
  onHideOnClickModal: {
367
368
  type: Boolean,
368
369
  default: !0
@@ -375,7 +376,7 @@ const J = {
375
376
  onTransform: Function,
376
377
  onOpenChange: Function,
377
378
  "onUpdate:open": Function
378
- }, Xt = /* @__PURE__ */ pe({
379
+ }, Yt = /* @__PURE__ */ Se({
379
380
  name: "Operations",
380
381
  inheritAttrs: !1,
381
382
  props: {
@@ -392,11 +393,11 @@ const J = {
392
393
  showProgress: Boolean,
393
394
  prefixCls: String,
394
395
  hashId: String,
395
- zIndex: G.zIndex,
396
- icons: G.icons,
397
- infinite: G.infinite,
398
- getContainer: G.getContainer,
399
- countRender: G.countRender,
396
+ zIndex: V.zIndex,
397
+ icons: V.icons,
398
+ infinite: V.infinite,
399
+ getContainer: V.getContainer,
400
+ countRender: V.countRender,
400
401
  tools: Array,
401
402
  onClose: Function,
402
403
  onActive: Function
@@ -411,32 +412,32 @@ const J = {
411
412
  prefixCls: o,
412
413
  hashId: l,
413
414
  tools: t
414
- } = e, s = we(`${e.prefixCls}-fade`), c = `${o}-operations-operation`, h = `${o}-operations-icon`;
415
- return u(Ee, {
415
+ } = e, r = ye(`${e.prefixCls}-fade`), c = `${o}-operations-operation`, h = `${o}-operations-icon`;
416
+ return u(Te, {
416
417
  to: e.getContainer || "body"
417
418
  }, {
418
- default: () => [u(ge, s, {
419
+ default: () => [u(he, r, {
419
420
  default: () => {
420
- var y, d, g, m;
421
- return [me(u("div", {
422
- class: Q(`${o}-operations-wrapper`, l),
421
+ var y, d, v, m;
422
+ return [we(u("div", {
423
+ class: X(`${o}-operations-wrapper`, l),
423
424
  style: {
424
425
  zIndex: e.zIndex
425
426
  }
426
427
  }, [((y = e.icons) == null ? void 0 : y.close) === null ? null : u("button", {
427
428
  class: `${o}-close ${l}`,
428
429
  onClick: e.onClose
429
- }, [((d = e.icons) == null ? void 0 : d.close) || u(It, null, null)]), e.showSwitch && u(re, null, [u("div", {
430
- class: Q(`${o}-switch-left ${l}`, {
430
+ }, [((d = e.icons) == null ? void 0 : d.close) || u(ut, null, null)]), e.showSwitch && u(se, null, [u("div", {
431
+ class: X(`${o}-switch-left ${l}`, {
431
432
  [`${o}-switch-left-disabled`]: e.infinite ? !1 : e.current === 0
432
433
  }),
433
434
  onClick: (w) => n(w, -1)
434
- }, [((g = e.icons) == null ? void 0 : g.left) || u(bt, null, null)]), u("div", {
435
- class: Q(`${o}-switch-right ${l}`, {
435
+ }, [((v = e.icons) == null ? void 0 : v.left) || u(ct, null, null)]), u("div", {
436
+ class: X(`${o}-switch-right ${l}`, {
436
437
  [`${o}-switch-right-disabled`]: e.infinite ? !1 : e.current === e.count - 1
437
438
  }),
438
439
  onClick: (w) => n(w, 1)
439
- }, [((m = e.icons) == null ? void 0 : m.right) || u($t, null, null)])]), u("div", {
440
+ }, [((m = e.icons) == null ? void 0 : m.right) || u(dt, null, null)])]), u("div", {
440
441
  class: `${o}-footer ${l}`
441
442
  }, [e.showProgress && u("div", {
442
443
  class: `${o}-progress`
@@ -444,38 +445,38 @@ const J = {
444
445
  class: `${e.prefixCls}-operations`
445
446
  }, [t == null ? void 0 : t.map(({
446
447
  icon: w,
447
- onClick: C,
448
+ onClick: x,
448
449
  type: a,
449
450
  disabled: i
450
451
  }) => u("div", {
451
- class: Q(c, {
452
+ class: X(c, {
452
453
  [`${e.prefixCls}-operations-operation-disabled`]: i && (i == null ? void 0 : i.value)
453
454
  }),
454
- onClick: C,
455
+ onClick: x,
455
456
  key: a
456
- }, [ot(w, {
457
+ }, [it(w, {
457
458
  class: h
458
- })]))])])]), [[he, e.open]])];
459
+ })]))])])]), [[pe, e.open]])];
459
460
  }
460
461
  })]
461
462
  });
462
463
  };
463
464
  }
464
- }), Yt = new ue("viewFadeIn", {
465
+ }), jt = new ce("viewFadeIn", {
465
466
  "0%": {
466
467
  opacity: 0
467
468
  },
468
469
  "100%": {
469
470
  opacity: 1
470
471
  }
471
- }), jt = new ue("viewFadeOut", {
472
+ }), Bt = new ce("viewFadeOut", {
472
473
  "0%": {
473
474
  opacity: 1
474
475
  },
475
476
  "100%": {
476
477
  opacity: 0
477
478
  }
478
- }), Bt = new ue("viewZoomBadgeIn", {
479
+ }), Ft = new ce("viewZoomBadgeIn", {
479
480
  "0%": {
480
481
  transform: "scale(0)",
481
482
  opacity: 0
@@ -484,7 +485,7 @@ const J = {
484
485
  transform: "scale(1)",
485
486
  opacity: 1
486
487
  }
487
- }), Ft = new ue("viewZoomBadgeOut", {
488
+ }), kt = new ce("viewZoomBadgeOut", {
488
489
  "0%": {
489
490
  transform: "scale(1)"
490
491
  },
@@ -492,11 +493,11 @@ const J = {
492
493
  transform: "scale(0)",
493
494
  opacity: 0
494
495
  }
495
- }), Oe = (e) => ({
496
+ }), Ae = (e) => ({
496
497
  position: e || "absolute",
497
498
  inset: 0
498
499
  });
499
- function fe(e) {
500
+ function ve(e) {
500
501
  return {
501
502
  position: e,
502
503
  top: 0,
@@ -506,7 +507,7 @@ function fe(e) {
506
507
  };
507
508
  }
508
509
  const Ht = (e) => {
509
- const { previewCls: n, modalMaskBg: o, marginXL: l, margin: t, colorTextLightSolid: s, previewOperationColorDisabled: c, previewOperationHoverColor: h, motionDurationSlow: y, iconCls: d } = e, g = new Z(o).setAlpha(0.1), m = g.clone().setAlpha(0.2), w = new Z(o).setAlpha(0.06);
510
+ const { previewCls: n, modalMaskBg: o, marginXL: l, margin: t, colorTextLightSolid: r, previewOperationColorDisabled: c, previewOperationHoverColor: h, motionDurationSlow: y, iconCls: d } = e, v = new Z(o).setAlpha(0.1), m = v.clone().setAlpha(0.2), w = new Z(o).setAlpha(0.06);
510
511
  return {
511
512
  [`${n}-footer`]: {
512
513
  position: "fixed",
@@ -534,8 +535,8 @@ const Ht = (e) => {
534
535
  display: "flex",
535
536
  alignItems: "center",
536
537
  justifyContent: "center",
537
- color: s,
538
- backgroundColor: g.toRgbString(),
538
+ color: r,
539
+ backgroundColor: v.toRgbString(),
539
540
  borderRadius: e.borderRadiusLG,
540
541
  backdropFilter: "saturate(180%) blur(10px)",
541
542
  width: e.sizeXL,
@@ -556,7 +557,7 @@ const Ht = (e) => {
556
557
  alignItems: "center",
557
558
  gap: e.sizeXXS,
558
559
  padding: e.paddingXXS,
559
- backgroundColor: g.toRgbString(),
560
+ backgroundColor: v.toRgbString(),
560
561
  borderRadius: e.borderRadiusLG,
561
562
  backdropFilter: "saturate(180%) blur(10px)",
562
563
  "&-operation": {
@@ -566,7 +567,7 @@ const Ht = (e) => {
566
567
  width: e.sizeXL + 4,
567
568
  height: e.sizeXL + 4,
568
569
  cursor: "pointer",
569
- color: s,
570
+ color: r,
570
571
  borderRadius: e.borderRadiusSM,
571
572
  transition: `all ${y}`,
572
573
  userSelect: "none",
@@ -590,12 +591,12 @@ const Ht = (e) => {
590
591
  }
591
592
  };
592
593
  }, Zt = (e) => {
593
- const { modalMaskBg: n, iconCls: o, previewOperationColorDisabled: l, previewCls: t, zIndexPopup: s, motionDurationSlow: c, colorTextLightSolid: h } = e, y = new Z(n).setAlpha(0.1), d = y.clone().setAlpha(0.2);
594
+ const { modalMaskBg: n, iconCls: o, previewOperationColorDisabled: l, previewCls: t, zIndexPopup: r, motionDurationSlow: c, colorTextLightSolid: h } = e, y = new Z(n).setAlpha(0.1), d = y.clone().setAlpha(0.2);
594
595
  return {
595
596
  [`${t}-switch-left, ${t}-switch-right`]: {
596
597
  position: "fixed",
597
598
  insetBlockStart: "50%",
598
- zIndex: e.calc(s).add(1).equal(),
599
+ zIndex: e.calc(r).add(1).equal(),
599
600
  display: "flex",
600
601
  alignItems: "center",
601
602
  justifyContent: "center",
@@ -634,7 +635,7 @@ const Ht = (e) => {
634
635
  insetInlineEnd: e.marginSM
635
636
  }
636
637
  };
637
- }, kt = (e) => {
638
+ }, Wt = (e) => {
638
639
  const { motionEaseOut: n, motionDurationSlow: o } = e;
639
640
  return {
640
641
  [e.componentCls]: {
@@ -642,28 +643,28 @@ const Ht = (e) => {
642
643
  textAlign: "center",
643
644
  pointerEvents: "none",
644
645
  "&-root": {
645
- ...fe("fixed"),
646
+ ...ve("fixed"),
646
647
  zIndex: e.zIndexPopup,
647
648
  overflow: "auto",
648
649
  outline: 0,
649
650
  WebkitOverflowScrolling: "touch"
650
651
  },
651
652
  "&-wrap": {
652
- ...fe("fixed"),
653
+ ...ve("fixed"),
653
654
  zIndex: e.zIndexPopup,
654
655
  overflow: "auto",
655
656
  outline: 0,
656
657
  WebkitOverflowScrolling: "touch"
657
658
  },
658
659
  "&-mask": {
659
- ...fe("fixed"),
660
+ ...ve("fixed"),
660
661
  zIndex: e.zIndexPopupBase,
661
662
  height: "100%",
662
663
  backgroundColor: e.colorBgMask,
663
664
  backdropFilter: "blur(2px)"
664
665
  },
665
666
  "&-body": {
666
- ...Oe(),
667
+ ...Ae(),
667
668
  overflow: "hidden"
668
669
  },
669
670
  "&-img": {
@@ -675,7 +676,7 @@ const Ht = (e) => {
675
676
  transition: `transform ${o} ${n} 0s`,
676
677
  userSelect: "none",
677
678
  "&-wrapper": {
678
- ...Oe(),
679
+ ...Ae(),
679
680
  transition: `transform ${o} ${n} 0s`,
680
681
  display: "flex",
681
682
  justifyContent: "center",
@@ -701,19 +702,19 @@ const Ht = (e) => {
701
702
  }
702
703
  },
703
704
  "&-mask-zoom-appear, &-mask-zoom-enter": {
704
- animationName: Yt,
705
+ animationName: jt,
705
706
  animationDuration: e.motionDurationSlow,
706
707
  animationTimingFunction: "linear",
707
708
  userSelect: "none"
708
709
  },
709
710
  "&-mask-zoom-leave": {
710
- animationName: jt,
711
+ animationName: Bt,
711
712
  animationDuration: e.motionDurationSlow,
712
713
  animationTimingFunction: "linear",
713
714
  pointerEvents: "none"
714
715
  },
715
716
  "&-zoom-appear, &-zoom-enter": {
716
- animationName: Bt,
717
+ animationName: Ft,
717
718
  opacity: 0,
718
719
  animationTimingFunction: e.motionEaseOutCirc,
719
720
  animationFillMode: "both",
@@ -725,7 +726,7 @@ const Ht = (e) => {
725
726
  animationPlayState: "running"
726
727
  },
727
728
  "&-zoom-leave": {
728
- animationName: Ft,
729
+ animationName: kt,
729
730
  animationDuration: e.motionDurationSlow,
730
731
  animationTimingFunction: e.motionEaseInOutCirc,
731
732
  animationFillMode: "both"
@@ -746,9 +747,9 @@ const Ht = (e) => {
746
747
  "&": [Ht(e), Zt(e)]
747
748
  };
748
749
  };
749
- function Wt(e) {
750
- return ut("ImageViewer", (n) => {
751
- const o = ct(n, {
750
+ function _t(e) {
751
+ return wt("ImageViewer", (n) => {
752
+ const o = pt(n, {
752
753
  zIndexPopup: n.zIndexPopupBase + 80,
753
754
  previewOperationColor: new Z(n.colorTextLightSolid).setAlpha(0.65).toRgbString(),
754
755
  previewOperationHoverColor: new Z(n.colorTextLightSolid).setAlpha(0.85).toRgbString(),
@@ -761,10 +762,10 @@ function Wt(e) {
761
762
  iconCls: ".anticon",
762
763
  previewCls: n.componentCls
763
764
  });
764
- return [kt(o)];
765
+ return [Wt(o)];
765
766
  }, e);
766
767
  }
767
- const ve = {
768
+ const ge = {
768
769
  /**
769
770
  * ESC
770
771
  */
@@ -779,18 +780,18 @@ const ve = {
779
780
  * RIGHT
780
781
  */
781
782
  RIGHT: 39
782
- }, _ = {
783
- rotateLeft: u(Ot, null, null),
784
- rotateRight: u(Mt, null, null),
785
- zoomIn: u(Lt, null, null),
786
- zoomOut: u(zt, null, null),
783
+ }, U = {
784
+ rotateLeft: u(mt, null, null),
785
+ rotateRight: u(gt, null, null),
786
+ zoomIn: u(vt, null, null),
787
+ zoomOut: u(ft, null, null),
787
788
  flipX: u(ze, null, null),
788
789
  flipY: u(ze, {
789
790
  rotate: 90
790
791
  }, null)
791
- }, ke = ["close", "left", "right", "rotateRight", "rotateRight", "zoomOut", "flipX", "flipY", "rotateLeft"], _t = /* @__PURE__ */ pe({
792
+ }, _e = ["close", "left", "right", "rotateRight", "rotateRight", "zoomOut", "flipX", "flipY", "rotateLeft"], Gt = /* @__PURE__ */ Se({
792
793
  name: "GImagePreview",
793
- props: G,
794
+ props: V,
794
795
  inheritAttrs: !1,
795
796
  slots: Object,
796
797
  emits: {
@@ -803,179 +804,179 @@ const ve = {
803
804
  expose: o,
804
805
  slots: l
805
806
  }) => {
806
- const t = De({
807
+ const t = Re({
807
808
  suffixCls: "image-view"
808
809
  }), {
809
- wrapSSR: s,
810
+ wrapSSR: r,
810
811
  hashId: c
811
- } = Wt(t), [h, y, d] = At(e.open, {
812
- value: F(e, "open"),
813
- onChange: (r) => {
812
+ } = _t(t), [h, y, d] = Et(e.open, {
813
+ value: k(e, "open"),
814
+ onChange: (s) => {
814
815
  var z;
815
- (z = e.onOpenChange) == null || z.call(e, r), n("update:open", r);
816
+ (z = e.onOpenChange) == null || z.call(e, s), n("update:open", s);
816
817
  }
817
- }), [g, m] = ee(!1), [w, C] = ee(!0), a = L(), {
818
+ }), [v, m] = ne(!1), [w, x] = ne(!0), a = L(), {
818
819
  transform: i,
819
820
  resetTransform: p,
820
- updateTransform: f,
821
+ updateTransform: g,
821
822
  dispatchZoomChange: S
822
- } = Et(a, F(e, "minScale"), F(e, "maxScale"), e.onTransform), {
823
- isMoving: x,
823
+ } = Tt(a, k(e, "minScale"), k(e, "maxScale"), e.onTransform), {
824
+ isMoving: C,
824
825
  onMouseDown: $,
825
826
  onWheel: T
826
- } = Rt(a, F(e, "movable"), d, F(e, "scaleStep"), i, f, S), {
827
- isTouching: M,
827
+ } = Nt(a, k(e, "movable"), d, k(e, "scaleStep"), i, g, S), {
828
+ isTouching: O,
828
829
  onTouchStart: I,
829
- onTouchMove: B,
830
- onTouchEnd: k
831
- } = Pt(a, F(e, "movable"), d, F(e, "minScale"), i, f, S);
832
- ye(() => {
833
- w.value || C(!0);
830
+ onTouchMove: F,
831
+ onTouchEnd: W
832
+ } = Xt(a, k(e, "movable"), d, k(e, "minScale"), i, g, S);
833
+ Ce(() => {
834
+ w.value || x(!0);
834
835
  }, [w]);
835
- const N = L(null), O = L(e.current), P = it(/* @__PURE__ */ new Map()), X = b(() => new Map(Array.from(P).map(([r, {
836
+ const N = L(null), M = L(e.current), P = at(/* @__PURE__ */ new Map()), Y = b(() => new Map(Array.from(P).map(([s, {
836
837
  url: z
837
- }]) => [r, z]))), W = b(() => X.value.get(O.value)), Y = b(() => X.value.size), j = b(() => Array.from(X.value.keys())), D = b(() => j.value.indexOf(O.value)), v = b(() => Y.value > 1), A = b(() => Y.value >= 1);
838
- K(d, (r) => {
839
- r && (g.value = !0);
838
+ }]) => [s, z]))), _ = b(() => Y.value.get(M.value)), j = b(() => Y.value.size), B = b(() => Array.from(Y.value.keys())), D = b(() => B.value.indexOf(M.value)), f = b(() => j.value > 1), A = b(() => j.value >= 1);
839
+ J(d, (s) => {
840
+ s && (v.value = !0);
840
841
  });
841
- const E = (r) => {
842
- O.value = r;
842
+ const E = (s) => {
843
+ M.value = s;
843
844
  };
844
- K(() => e.current, (r) => {
845
- Re(r) && E(r);
845
+ J(() => e.current, (s) => {
846
+ Ne(s) && E(s);
846
847
  });
847
- function te(r, z) {
848
- P.set(r, {
848
+ function de(s, z) {
849
+ P.set(s, {
849
850
  url: z,
850
851
  loading: !0,
851
852
  canPreview: !1
852
853
  });
853
854
  }
854
- const ce = () => {
855
+ const G = () => {
855
856
  m(!1);
856
- }, We = () => {
857
+ }, oe = () => {
857
858
  p("close"), n("close");
858
- }, _e = (r) => {
859
- x.value || N.value === (r == null ? void 0 : r.target) && ce();
860
- }, Ge = () => {
861
- const r = P.get(O.value);
862
- r && (r.loading = !1, r.canPreview = !0);
863
- }, Ve = (r) => {
864
- const z = P.get(O.value);
865
- z && (z.loading = !1, z.canPreview = !1), r.target.alt = "加载失败";
866
- }, Ce = () => {
859
+ }, Ge = (s) => {
860
+ C.value || N.value === (s == null ? void 0 : s.target) && G();
861
+ }, Ue = () => {
862
+ const s = P.get(M.value);
863
+ s && (s.loading = !1, s.canPreview = !0);
864
+ }, Ve = (s) => {
865
+ const z = P.get(M.value);
866
+ z && (z.loading = !1, z.canPreview = !1), s.target.alt = "加载失败";
867
+ }, Ie = () => {
867
868
  if (D.value > 0 || e.infinite) {
868
- const r = D.value - 1 < 0 ? e.urls.length - 1 : D.value - 1;
869
- E(j.value[r]), p("prev");
869
+ const s = D.value - 1 < 0 ? e.urls.length - 1 : D.value - 1;
870
+ E(B.value[s]), p("prev");
870
871
  }
871
- }, xe = () => {
872
- if (D.value < Y.value - 1 || e.infinite) {
873
- const r = D.value + 1 > e.urls.length - 1 ? 0 : D.value + 1;
874
- E(j.value[r]), p("next");
872
+ }, be = () => {
873
+ if (D.value < j.value - 1 || e.infinite) {
874
+ const s = D.value + 1 > e.urls.length - 1 ? 0 : D.value + 1;
875
+ E(B.value[s]), p("next");
875
876
  }
876
- }, Ue = () => {
877
- S(U + e.scaleStep, "zoomIn");
878
877
  }, qe = () => {
879
- S(U / (U + e.scaleStep), "zoomOut");
878
+ S(K + e.scaleStep, "zoomIn");
880
879
  }, Ke = () => {
881
- f({
880
+ S(K / (K + e.scaleStep), "zoomOut");
881
+ }, Qe = () => {
882
+ g({
882
883
  rotate: i.value.rotate + 90
883
884
  }, "rotateRight");
884
- }, Qe = () => {
885
- f({
885
+ }, Je = () => {
886
+ g({
886
887
  rotate: i.value.rotate - 90
887
888
  }, "rotateLeft");
888
- }, Je = () => {
889
- f({
889
+ }, et = () => {
890
+ g({
890
891
  flipX: !i.value.flipX
891
892
  }, "flipX");
892
- }, et = () => {
893
- f({
893
+ }, tt = () => {
894
+ g({
894
895
  flipY: !i.value.flipY
895
896
  }, "flipY");
896
- }, Ie = [{
897
- icon: H(l, e.icons, "flipY") || _.flipY,
898
- onClick: et,
897
+ }, $e = [{
898
+ icon: H(l, e.icons, "flipY") || U.flipY,
899
+ onClick: tt,
899
900
  type: "flipY"
900
901
  }, {
901
- icon: H(l, e.icons, "flipX") || _.flipX,
902
- onClick: Je,
902
+ icon: H(l, e.icons, "flipX") || U.flipX,
903
+ onClick: et,
903
904
  type: "flipX"
904
905
  }, {
905
- icon: H(l, e.icons, "rotateLeft") || _.rotateLeft,
906
- onClick: Qe,
906
+ icon: H(l, e.icons, "rotateLeft") || U.rotateLeft,
907
+ onClick: Je,
907
908
  type: "rotateLeft"
908
909
  }, {
909
- icon: H(l, e.icons, "rotateRight") || _.rotateRight,
910
- onClick: Ke,
910
+ icon: H(l, e.icons, "rotateRight") || U.rotateRight,
911
+ onClick: Qe,
911
912
  type: "rotateRight"
912
913
  }, {
913
- icon: H(l, e.icons, "zoomOut") || _.zoomOut,
914
- onClick: () => qe(),
914
+ icon: H(l, e.icons, "zoomOut") || U.zoomOut,
915
+ onClick: () => Ke(),
915
916
  type: "zoomOut",
916
917
  disabled: b(() => i.value.scale <= e.minScale)
917
918
  }, {
918
- icon: H(l, e.icons, "zoomIn") || _.zoomIn,
919
- onClick: () => Ue(),
919
+ icon: H(l, e.icons, "zoomIn") || U.zoomIn,
920
+ onClick: () => qe(),
920
921
  type: "zoomIn",
921
922
  disabled: b(() => i.value.scale === e.maxScale)
922
- }], tt = (r) => {
923
- d.value && (i.value.scale !== 1 ? f({
923
+ }], nt = (s) => {
924
+ d.value && (i.value.scale !== 1 ? g({
924
925
  x: 0,
925
926
  y: 0,
926
927
  scale: 1
927
- }, "doubleClick") : S(U + e.scaleStep, "doubleClick", r.clientX, r.clientY));
928
- }, nt = (r) => {
929
- r.keyCode === ve.ESC && ce(), !(!d.value || !v.value) && (r.keyCode === ve.LEFT ? Ce() : r.keyCode === ve.RIGHT && xe());
928
+ }, "doubleClick") : S(K + e.scaleStep, "doubleClick", s.clientX, s.clientY));
929
+ }, ot = (s) => {
930
+ s.keyCode === ge.ESC && G(), !(!d.value || !f.value) && (s.keyCode === ge.LEFT ? Ie() : s.keyCode === ge.RIGHT && be());
930
931
  };
931
- let de = () => {
932
+ let fe = () => {
932
933
  };
933
- return Te(() => {
934
- K(() => e.urls, (r) => {
935
- ft(r) && r.forEach((z, ne) => {
936
- te(ne, z);
934
+ return De(() => {
935
+ J(() => e.urls, (s) => {
936
+ Ct(s) && s.forEach((z, ie) => {
937
+ de(ie, z);
937
938
  });
938
939
  }, {
939
940
  flush: "post",
940
941
  immediate: !0
941
- }), K([() => d.value, () => x.value], () => {
942
- de();
943
- const r = V(window, "keydown", nt, !1);
944
- de = () => {
945
- r.remove();
942
+ }), J([() => d.value, () => C.value], () => {
943
+ fe();
944
+ const s = q(window, "keydown", ot, !1);
945
+ fe = () => {
946
+ s.remove();
946
947
  };
947
948
  }, {
948
949
  flush: "post",
949
950
  immediate: !0
950
951
  });
951
- }), at(() => {
952
- de();
952
+ }), lt(() => {
953
+ fe();
953
954
  }), o({
954
- setOpen: (r) => {
955
- y(r), O.value = e.current;
955
+ setOpen: (s) => {
956
+ y(s), M.value = e.current;
956
957
  }
957
958
  }), () => {
958
- const r = we(`${t}-mask-zoom`), z = we(`${t}-zoom`), ne = {};
959
+ const s = ye(`${t}-mask-zoom`), z = ye(`${t}-zoom`), ie = {};
959
960
  for (const R in e.icons)
960
- ne[R] = H(l, e.icons, R);
961
- return s(u(re, null, [u(Ee, {
961
+ ie[R] = H(l, e.icons, R);
962
+ return r(u(se, null, [u(Te, {
962
963
  to: e.getContainer || "body"
963
964
  }, {
964
- default: () => [d.value && u(re, null, [u("div", {
965
+ default: () => [d.value && u(se, null, [u("div", {
965
966
  class: `${t}-root ${c.value}`
966
- }, [u(ge, r, {
967
- default: () => [me(u("div", {
967
+ }, [u(he, s, {
968
+ default: () => [we(u("div", {
968
969
  class: `${t}-mask ${c.value}`
969
- }, null), [[he, d.value && g.value]])]
970
+ }, null), [[pe, d.value && v.value]])]
970
971
  }), u("div", {
971
972
  ref: N,
972
973
  tabindex: -1,
973
- class: [`${t}-wrap`, `${c.value}`, x.value && `${t}-moving`],
974
- onClick: (R) => e.onHideOnClickModal && _e(R)
975
- }, [u(ge, ae(z, {
976
- onAfterLeave: () => We()
974
+ class: [`${t}-wrap`, `${c.value}`, C.value && `${t}-moving`],
975
+ onClick: (R) => e.onHideOnClickModal && Ge(R)
976
+ }, [u(he, le(z, {
977
+ onAfterLeave: () => oe()
977
978
  }), {
978
- default: () => [me(u("div", {
979
+ default: () => [we(u("div", {
979
980
  role: "dialog",
980
981
  class: `${t} ${c.value}`
981
982
  }, [u("div", {
@@ -987,97 +988,119 @@ const ve = {
987
988
  }, [u("img", {
988
989
  ref: a,
989
990
  class: `${t}-img ${c.value}`,
990
- src: W.value,
991
- onLoad: () => Ge(),
991
+ src: _.value,
992
+ onLoad: () => Ue(),
992
993
  onError: (R) => Ve(R),
993
994
  style: {
994
995
  transform: `translate3d(${i.value.x}px, ${i.value.y}px, 0) scale3d(${i.value.flipX ? "-" : ""}${i.value.scale}, ${i.value.flipY ? "-" : ""}${i.value.scale}, 1) rotate(${i.value.rotate}deg)`,
995
- transitionDuration: !w.value || M.value ? "0s" : void 0
996
+ transitionDuration: !w.value || O.value ? "0s" : void 0
996
997
  },
997
998
  onWheel: T,
998
999
  onMousedown: $,
999
- onDblclick: tt,
1000
+ onDblclick: nt,
1000
1001
  onTouchstart: I,
1001
- onTouchmove: B,
1002
- onTouchend: k,
1003
- onTouchcancel: k
1004
- }, null)])])])]), [[he, d.value && g.value]])]
1002
+ onTouchmove: F,
1003
+ onTouchend: W,
1004
+ onTouchcancel: W
1005
+ }, null)])])])]), [[pe, d.value && v.value]])]
1005
1006
  })])])])]
1006
- }), d.value && g.value && u(Xt, {
1007
- open: d.value && g.value,
1007
+ }), d.value && v.value && u(Yt, {
1008
+ open: d.value && v.value,
1008
1009
  hashId: c.value,
1009
1010
  count: e.urls.length,
1010
- current: O.value,
1011
+ current: M.value,
1011
1012
  zIndex: e.zIndex + 1,
1012
1013
  getContainer: e.getContainer,
1013
1014
  prefixCls: t,
1014
- icons: Pe(ne, Ie.map(({
1015
+ icons: Ye(ie, $e.map(({
1015
1016
  type: R
1016
1017
  }) => R)),
1017
- tools: Ie,
1018
+ tools: $e,
1018
1019
  infinite: e.infinite,
1019
- countRender: vt(l, e, "countRenders"),
1020
- showSwitch: v.value,
1020
+ countRender: Pe(l, e, "countRenders"),
1021
+ showSwitch: f.value,
1021
1022
  showProgress: A.value,
1022
- onClose: ce,
1023
- onActive: (R) => R > 0 ? xe() : Ce()
1023
+ onClose: G,
1024
+ onActive: (R) => R > 0 ? be() : Ie()
1024
1025
  }, null)]));
1025
1026
  };
1026
1027
  }
1027
- }), ie = {
1028
+ }), me = {
1028
1029
  width: "100%",
1029
1030
  height: "100%"
1030
- }, Gt = () => ({
1031
- position: "absolute",
1032
- inset: 0,
1033
- display: "flex",
1034
- alignItems: "center",
1035
- justifyContent: "center",
1036
- cursor: "pointer",
1037
- opacity: 0
1038
- }), Vt = (e) => ({
1031
+ }, Ut = {
1032
+ overflow: "hidden",
1033
+ whiteSpace: "nowrap",
1034
+ textOverflow: "ellipsis"
1035
+ }, Vt = (e) => {
1036
+ const { motionDurationSlow: n, paddingXXS: o, marginXXS: l, colorTextLightSolid: t } = e, r = ".anticon";
1037
+ return {
1038
+ position: "absolute",
1039
+ inset: 0,
1040
+ display: "flex",
1041
+ alignItems: "center",
1042
+ justifyContent: "center",
1043
+ color: t,
1044
+ background: new yt("#000").setA(0.5).toRgbString(),
1045
+ cursor: "pointer",
1046
+ opacity: 0,
1047
+ transition: `opacity ${n}`,
1048
+ [`.${e.componentCls}-mask-info`]: {
1049
+ ...Ut,
1050
+ padding: `0 ${ee(o)}`,
1051
+ [r]: {
1052
+ marginInlineEnd: l,
1053
+ svg: {
1054
+ verticalAlign: "baseline"
1055
+ }
1056
+ }
1057
+ }
1058
+ };
1059
+ }, qt = (e) => ({
1039
1060
  position: e || "absolute",
1040
1061
  inset: 0
1041
- }), Ut = (e) => ({
1062
+ }), Kt = (e) => ({
1042
1063
  [e.componentCls]: {
1043
1064
  display: "inline-block",
1044
1065
  position: "relative",
1045
1066
  overflow: "hidden",
1046
- "&-inner": {
1047
- ...ie,
1067
+ [`${e.componentCls}-img`]: {
1068
+ ...me,
1048
1069
  verticalAlign: "top",
1049
1070
  opacity: 1,
1050
- [`&${e.componentCls}-inner-preview`]: {
1071
+ [`&${e.componentCls}-img-preview`]: {
1051
1072
  userSelect: "none",
1052
1073
  cursor: "pointer"
1074
+ },
1075
+ "&-placeholder": {
1076
+ ...me,
1077
+ backgroundColor: e.colorBgContainerDisabled,
1078
+ backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
1079
+ backgroundRepeat: "no-repeat",
1080
+ backgroundPosition: "center center",
1081
+ backgroundSize: "30%"
1053
1082
  }
1054
1083
  },
1055
- "&-wrapper": {
1056
- ...ie,
1057
- ...Vt()
1058
- },
1059
- "&-placeholder": {
1060
- ...ie,
1061
- backgroundColor: e.colorBgContainerDisabled,
1062
- backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
1063
- backgroundRepeat: "no-repeat",
1064
- backgroundPosition: "center center",
1065
- backgroundSize: "30%"
1066
- },
1067
- "&-error": {
1068
- ...ie,
1084
+ [`${e.componentCls}-error`]: {
1085
+ ...me,
1069
1086
  display: "flex",
1070
1087
  alignItems: "center",
1071
- justifyContent: "center",
1072
- color: e.colorText,
1073
- backgroundColor: e.colorBgContainerDisabled
1088
+ justifyContent: "center"
1074
1089
  },
1075
- "&-preview": Gt()
1090
+ [`${e.componentCls}-placeholder`]: {
1091
+ ...qt()
1092
+ },
1093
+ [`${e.componentCls}-mask`]: {
1094
+ ...Vt(e)
1095
+ },
1096
+ [`${e.componentCls}-mask:hover`]: {
1097
+ opacity: 1
1098
+ }
1076
1099
  }
1077
- }), qt = (e) => typeof Element > "u" ? !1 : e instanceof Element;
1078
- let Ae = "";
1079
- const Kt = [...ke, "fallback", "placeholder"], le = /* @__PURE__ */ pe({
1080
- props: Ze,
1100
+ }), Qt = (e) => typeof Element > "u" ? !1 : e instanceof Element;
1101
+ let Ee = "";
1102
+ const Jt = [..._e, "placeholder", "fallback"], re = /* @__PURE__ */ Se({
1103
+ props: We,
1081
1104
  name: "GImage",
1082
1105
  inheritAttrs: !1,
1083
1106
  emits: {
@@ -1091,120 +1114,128 @@ const Kt = [...ke, "fallback", "placeholder"], le = /* @__PURE__ */ pe({
1091
1114
  emit: o,
1092
1115
  attrs: l
1093
1116
  }) {
1094
- const t = q && "loading" in HTMLImageElement.prototype, s = De({
1117
+ const t = Q && "loading" in HTMLImageElement.prototype, r = Re({
1095
1118
  suffixCls: "image"
1096
1119
  }), {
1097
1120
  wrapSSR: c,
1098
1121
  hashId: h
1099
- } = dt("Image", [Ut], s), y = L(), d = L(), g = L(!1), m = L(!0), w = L(!1), C = L(), a = L();
1122
+ } = St("Image", [Kt], r), y = L(), d = L(), v = L(!1), m = L(!0), w = L(!1), x = L(), a = L();
1100
1123
  let i, p;
1101
- const f = b(() => e.loading === "eager" ? !1 : !t && e.loading === "lazy" || e.lazy), S = b(() => q && e.fit ? {
1124
+ const g = b(() => e.loading === "eager" ? !1 : !t && e.loading === "lazy" || e.lazy), S = b(() => Q && e.fit ? {
1125
+ ...e.imageStyle,
1102
1126
  objectFit: e.fit
1103
- } : {}), x = b(() => typeof e.preview == "object" ? e.preview : {}), $ = b(() => !!e.preview), T = b(() => {
1127
+ } : e.imageStyle), C = b(() => typeof e.preview == "object" ? e.preview : {}), $ = b(() => !!e.preview), T = b(() => {
1104
1128
  const {
1105
- urls: v = [],
1129
+ urls: f = [],
1106
1130
  current: A = 0
1107
- } = x.value;
1108
- if (Re(A)) return v.length >= A ? A : 0;
1109
- const E = v.indexOf(e.src);
1131
+ } = C.value;
1132
+ if (Ne(A)) return f.length >= A ? A : 0;
1133
+ const E = f.indexOf(e.src);
1110
1134
  return E >= 0 ? E : 0;
1111
- }), M = b(() => be(e.width)), I = b(() => be(e.height)), B = () => {
1112
- q && (m.value = !0, g.value = !1, d.value = e.src);
1135
+ }), O = b(() => ee(e.width)), I = b(() => ee(e.height)), F = () => {
1136
+ Q && (m.value = !0, v.value = !1, d.value = e.src);
1113
1137
  };
1114
- function k(v) {
1115
- m.value = !1, g.value = !1, o("load", v);
1138
+ function W(f) {
1139
+ v.value || (m.value = !1, v.value = !1, o("load", f));
1116
1140
  }
1117
- function N(v) {
1118
- m.value = !1, g.value = !0, o("error", v);
1141
+ function N(f) {
1142
+ m.value = !1, v.value = !0, o("error", f);
1119
1143
  }
1120
- function O() {
1121
- mt(C.value, a.value) && (B(), W());
1144
+ function M() {
1145
+ It(x.value, a.value) && (F(), _());
1122
1146
  }
1123
- const P = pt(O, 200, !0);
1124
- async function X() {
1125
- if (!q) return;
1147
+ const P = zt(M, 200, !0);
1148
+ async function Y() {
1149
+ if (!Q) return;
1126
1150
  await st();
1127
1151
  const {
1128
- scrollContainer: v
1152
+ scrollContainer: f
1129
1153
  } = e;
1130
- qt(v) ? a.value = v : ht(v) && v !== "" ? a.value = document.querySelector(v) ?? void 0 : C.value && (a.value = wt(C.value)), a.value && (i = $e(a, "scroll", P), setTimeout(() => O(), 100));
1154
+ Qt(f) ? a.value = f : bt(f) && f !== "" ? a.value = document.querySelector(f) ?? void 0 : x.value && (a.value = $t(x.value)), a.value && (i = Le(a, "scroll", P), setTimeout(() => M(), 100));
1131
1155
  }
1132
- function W() {
1133
- !q || !a.value || !P || (i == null || i(), a.value = void 0);
1156
+ function _() {
1157
+ !Q || !a.value || !P || (i == null || i(), a.value = void 0);
1134
1158
  }
1135
- function Y(v) {
1136
- if (v.ctrlKey) {
1137
- if (v.deltaY < 0)
1138
- return v.preventDefault(), !1;
1139
- if (v.deltaY > 0)
1140
- return v.preventDefault(), !1;
1159
+ function j(f) {
1160
+ if (f.ctrlKey) {
1161
+ if (f.deltaY < 0)
1162
+ return f.preventDefault(), !1;
1163
+ if (f.deltaY > 0)
1164
+ return f.preventDefault(), !1;
1141
1165
  }
1142
1166
  }
1143
- const j = () => {
1144
- o("click"), !(m.value || g.value) && $.value && (p = $e("wheel", Y, {
1167
+ const B = () => {
1168
+ o("click"), !(m.value || v.value) && $.value && (p = Le("wheel", j, {
1145
1169
  passive: !1
1146
- }), Ae = document.body.style.overflow, document.body.style.overflow = "hidden", w.value = !0);
1170
+ }), Ee = document.body.style.overflow, document.body.style.overflow = "hidden", w.value = !0);
1147
1171
  }, D = () => {
1148
- p == null || p(), document.body.style.overflow = Ae, w.value = !1;
1172
+ p == null || p(), document.body.style.overflow = Ee, w.value = !1;
1149
1173
  };
1150
- return K(() => e.src, () => {
1151
- f.value ? (m.value = !0, g.value = !1, W(), X()) : B();
1152
- }), lt(() => {
1153
- var v, A;
1154
- $.value && w.value ? (v = y.value) == null || v.setOpen(!0) : (A = y.value) == null || A.setOpen(!1);
1155
- }), Te(() => {
1156
- f.value ? X() : B();
1174
+ return J(() => e.src, () => {
1175
+ g.value ? (m.value = !0, v.value = !1, _(), Y()) : F();
1176
+ }), rt(() => {
1177
+ var f, A;
1178
+ $.value && w.value ? (f = y.value) == null || f.setOpen(!0) : (A = y.value) == null || A.setOpen(!1);
1179
+ }), De(() => {
1180
+ g.value ? Y() : F();
1157
1181
  }), () => {
1158
- const v = Ct(Object.entries(l).filter(([te]) => /^(?:data-|on[A-Z])/i.test(te) || ["id", "style"].includes(te))), A = Pe(l, Object.keys(v)), E = gt(Kt, n, e, {
1182
+ var G;
1183
+ const f = Mt(Object.entries(l).filter(([oe]) => /^(?:data-|on[A-Z])/i.test(oe) || ["id", "style", "class"].includes(oe))), A = Ye(l, Object.keys(f)), E = xt(Jt, n, e, {
1159
1184
  render: !0
1160
- });
1161
- return c(u("div", ae({
1185
+ }), de = Pe(n, e, ["preview", "mask"], !0);
1186
+ return c(u("div", le({
1162
1187
  class: {
1163
1188
  [`${h.value}`]: !0,
1164
- [`${s}`]: !0,
1165
- [`${l.class}`]: !!l.class
1189
+ [`${r}`]: !0
1166
1190
  },
1167
- ref: C
1168
- }, v), [g.value ? E.fallback || u("div", {
1169
- "aria-hidden": "true",
1170
- class: `${s}-error ${h.value}`
1171
- }, [rt("加载失败")]) : u(re, null, [d.value !== void 0 && u("img", ae(A, {
1191
+ ref: x
1192
+ }, f, {
1193
+ style: {
1194
+ width: ee(e.size) || O.value,
1195
+ height: ee(e.size) || I.value,
1196
+ ...f.style || {}
1197
+ }
1198
+ }), [v.value ? u("div", {
1199
+ class: X(h.value, `${r}-error`)
1200
+ }, [E.fallback]) : u(se, null, [u("img", le(A, {
1172
1201
  src: d.value,
1173
1202
  loading: e.loading,
1174
1203
  style: S.value,
1175
- class: {
1176
- [`${h.value}`]: !0,
1177
- [`${s}-placeholder`]: m.value,
1178
- [`${s}-inner`]: !0,
1179
- [`${s}-inner-preview`]: $.value
1180
- },
1181
- crossorigin: e.crossorigin,
1182
- width: M.value,
1204
+ class: X(h.value, e.imageClass, `${r}-img`, {
1205
+ [`${r}-img-placeholder`]: e.placeholder === !0,
1206
+ [`${r}-img-preview`]: $.value
1207
+ }),
1208
+ crossorigin: e.crossOrigin,
1209
+ width: O.value,
1183
1210
  height: I.value,
1184
- onClick: j,
1185
- onLoad: k,
1211
+ onClick: B,
1212
+ onLoad: W,
1186
1213
  onError: N
1187
1214
  }), null), m.value && u("div", {
1188
- class: Q(`${s}-wrapper`, h.value)
1189
- }, [E.placeholder || u("div", {
1190
- "aria-hidden": "true",
1191
- class: `${s}-placeholder ${h.value}`
1192
- }, null)])]), $.value && u(_t, ae({
1215
+ class: X(`${r}-placeholder`, h.value)
1216
+ }, [E.placeholder])]), C.value.mask && $.value && u("div", {
1217
+ class: X(`${r}-mask`, C.value.maskClass, h.value),
1218
+ style: {
1219
+ display: ((G = f.style) == null ? void 0 : G.display) === "none" ? "none" : void 0
1220
+ }
1221
+ }, [de || u("div", {
1222
+ class: X(`${r}-mask-info`, h.value)
1223
+ }, [u(ht, null, null)])]), $.value && u(Gt, le({
1193
1224
  ref: y
1194
- }, x.value, xt(E, ke), {
1195
- urls: x.value.urls || [e.src],
1225
+ }, C.value, At(E, _e), {
1226
+ urls: C.value.urls || [e.src],
1196
1227
  current: T.value,
1197
1228
  onClose: () => D()
1198
1229
  }), null)]));
1199
1230
  };
1200
1231
  }
1201
1232
  });
1202
- le.isGImage = !0;
1203
- le.install = (e) => (e.component(le.name, le), e);
1233
+ re.isGImage = !0;
1234
+ re.install = (e) => (e.component(re.name, re), e);
1204
1235
  export {
1205
- le as GImage,
1206
- _t as GImagePreview,
1207
- J as baseProps,
1208
- le as default,
1209
- Ze as imageProps
1236
+ re as GImage,
1237
+ Gt as GImagePreview,
1238
+ te as baseProps,
1239
+ re as default,
1240
+ We as imageProps
1210
1241
  };