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

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