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

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,54 +1,268 @@
1
- import { ref as N, reactive as ae, onMounted as De, defineComponent as ye, createVNode as r, Teleport as ze, Transition as ge, withDirectives as we, Fragment as Se, cloneVNode as Je, vShow as he, shallowRef as Z, computed as y, watch as H, onUnmounted as et, mergeProps as pe, watchEffect as tt, createTextVNode as nt, nextTick as ot } from "vue";
2
- import { useState as xe, onMountedOrActivated as it } from "@gx-design-vue/pro-hooks";
3
- import { getTransitionProps as Ie, Keyframe as re, useStyle as at, mergeToken as lt, unit as rt, useProStyle as st } from "@gx-design-vue/pro-provider";
4
- import { classNames as oe, getPrefixCls as Ue, isNumber as Ee, getSlotVNode as $, isArray as _e, getSlot as ct, isServer as ie, isInContainer as ut, getSlotsProps as dt, isString as ft, getScrollContainer as vt } from "@gx-design-vue/pro-utils";
5
- import { useThrottleFn as mt, useEventListener as Le } from "@vueuse/core";
6
- import { omit as gt, pick as wt } from "lodash-es";
7
- import { CloseOutlined as St, LeftOutlined as ht, RightOutlined as pt, RotateLeftOutlined as It, RotateRightOutlined as Et, ZoomInOutlined as Ct, ZoomOutOutlined as yt, SwapOutlined as be } from "@ant-design/icons-vue";
8
- import { TinyColor as Y } from "@ctrl/tinycolor";
9
- function Nt(e, t) {
10
- process.env.NODE_ENV !== "production" && !e && console !== void 0 && console.error(`Warning: ${t}`);
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";
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);
11
15
  }
12
- let Fe = (e) => setTimeout(e, 16), Be = (e) => clearTimeout(e);
13
- typeof window < "u" && "requestAnimationFrame" in window && (Fe = (e) => window.requestAnimationFrame(e), Be = (e) => window.cancelAnimationFrame(e));
14
- let Te = 0;
15
- const Ne = /* @__PURE__ */ new Map();
16
- function He(e) {
17
- Ne.delete(e);
18
- }
19
- function Ce(e, t = 1) {
20
- Te += 1;
21
- const i = Te;
22
- function l(o) {
23
- if (o === 0)
24
- He(i), e();
16
+ function Be(e, n = 1) {
17
+ Le += 1;
18
+ const o = Le;
19
+ function l(t) {
20
+ if (t === 0)
21
+ je(o), e();
25
22
  else {
26
- const f = Fe(() => {
27
- l(o - 1);
23
+ const s = Xe(() => {
24
+ l(t - 1);
28
25
  });
29
- Ne.set(i, f);
26
+ Se.set(o, s);
30
27
  }
31
28
  }
32
- return l(t), i;
29
+ return l(n), o;
33
30
  }
34
- Ce.cancel = (e) => {
35
- const t = Ne.get(e);
36
- return He(t), Be(t);
31
+ Be.cancel = (e) => {
32
+ const n = Se.get(e);
33
+ return je(n), Ye(n);
34
+ };
35
+ const oe = {
36
+ x: 0,
37
+ y: 0,
38
+ rotate: 0,
39
+ scale: 1,
40
+ flipX: !1,
41
+ flipY: !1
37
42
  };
38
- function Mt(e) {
39
- const t = N(null), i = ae({ ...e }), l = N([]), o = (f) => {
40
- t.value === null && (l.value = [], t.value = Ce(() => {
41
- let c;
42
- l.value.forEach((d) => {
43
- c = { ...c, ...d };
44
- }), Object.assign(i, c), t.value = null;
45
- })), l.value.push(f);
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 });
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({
53
+ ...c.value,
54
+ ...m
55
+ });
56
+ };
57
+ return {
58
+ transform: c,
59
+ resetTransform: y,
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);
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);
70
+ }
71
+ d({
72
+ x: Y,
73
+ y: j,
74
+ scale: I
75
+ }, w);
76
+ }
46
77
  };
47
- return De(() => {
48
- t.value && Ce.cancel(t.value);
49
- }), [i, o];
50
78
  }
51
- const V = {
79
+ function Tt(e, n) {
80
+ process.env.NODE_ENV !== "production" && console !== void 0 && console.error(`Warning: ${n}`);
81
+ }
82
+ let Fe = !1;
83
+ try {
84
+ const e = Object.defineProperty({}, "passive", {
85
+ get() {
86
+ Fe = !0;
87
+ }
88
+ });
89
+ window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e);
90
+ } catch {
91
+ }
92
+ function V(e, n, o, l) {
93
+ if (e && e.addEventListener) {
94
+ let t = l;
95
+ t === void 0 && Fe && (n === "touchstart" || n === "touchmove" || n === "wheel") && (t = { passive: !1 }), e.addEventListener(n, o, t);
96
+ }
97
+ return {
98
+ remove: () => {
99
+ e && e.removeEventListener && e.removeEventListener(n, o);
100
+ }
101
+ };
102
+ }
103
+ const U = 1, Dt = 1;
104
+ function Me(e, n, o, l) {
105
+ const t = n + o, s = (o - l) / 2;
106
+ if (o > l) {
107
+ if (n > 0)
108
+ return {
109
+ [e]: s
110
+ };
111
+ if (n < 0 && t < l)
112
+ return {
113
+ [e]: -s
114
+ };
115
+ } else if (n < 0 || t > l)
116
+ return {
117
+ [e]: n < 0 ? s : -s
118
+ };
119
+ return {};
120
+ }
121
+ function He(e, n, o, l) {
122
+ const { width: t, height: s } = Ne();
123
+ let c = null;
124
+ return e <= t.value && n <= s.value ? c = {
125
+ x: 0,
126
+ y: 0
127
+ } : (e > t.value || n > s.value) && (c = {
128
+ ...Me("x", o, e, t.value),
129
+ ...Me("y", l, n, s.value)
130
+ }), c;
131
+ }
132
+ function Rt(e, n, o, l, t, s, c) {
133
+ const [h, y] = ee(!1), d = L({
134
+ diffX: 0,
135
+ diffY: 0,
136
+ transformX: 0,
137
+ transformY: 0
138
+ }), g = (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));
145
+ }, m = (a) => {
146
+ o && h.value && s({
147
+ x: a.pageX - d.value.diffX,
148
+ y: a.pageY - d.value.diffY
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))
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");
158
+ }
159
+ }, C = (a) => {
160
+ if (!o || a.deltaY === 0)
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);
165
+ };
166
+ return ye(() => {
167
+ let a, i, p, f;
168
+ if (n) {
169
+ p = V(window, "mouseup", w, !1), f = V(window, "mousemove", m, !1);
170
+ try {
171
+ window.top !== window.self && (a = V(window.top, "mouseup", w, !1), i = V(window.top, "mousemove", m, !1));
172
+ } catch (S) {
173
+ Tt(!1, `[rc-image] ${S}`);
174
+ }
175
+ }
176
+ return () => {
177
+ p == null || p.remove(), f == null || f.remove(), a == null || a.remove(), i == null || i.remove();
178
+ };
179
+ }, [o, h, () => t.value.x, () => t.value.y, () => t.value.rotate, n]), {
180
+ isMoving: h,
181
+ onMouseDown: g,
182
+ onMouseMove: m,
183
+ onMouseUp: w,
184
+ onWheel: C
185
+ };
186
+ }
187
+ function se(e, n) {
188
+ const o = e.x - n.x, l = e.y - n.y;
189
+ return Math.hypot(o, l);
190
+ }
191
+ function Nt(e, n, o, l) {
192
+ const t = se(e, o), s = se(n, l);
193
+ if (t === 0 && s === 0)
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);
196
+ return [h, y];
197
+ }
198
+ function Pt(e, n, o, l, t, s, c) {
199
+ const [h, y] = ee(!1), d = L({
200
+ point1: { x: 0, y: 0 },
201
+ point2: { x: 0, y: 0 },
202
+ eventType: "none"
203
+ }), g = (a) => {
204
+ d.value = {
205
+ ...d.value,
206
+ ...a
207
+ };
208
+ }, m = (a) => {
209
+ if (!n.value)
210
+ return;
211
+ a.stopPropagation(), y(!0);
212
+ const { touches: i = [] } = a;
213
+ i.length > 1 ? g({
214
+ point1: { x: i[0].clientX, y: i[0].clientY },
215
+ point2: { x: i[1].clientX, y: i[1].clientY },
216
+ eventType: "touchZoom"
217
+ }) : g({
218
+ point1: {
219
+ x: i[0].clientX - t.value.x,
220
+ y: i[0].clientY - t.value.y
221
+ },
222
+ eventType: "move"
223
+ });
224
+ }, w = (a) => {
225
+ const { touches: i = [] } = a, { point1: p, point2: f, eventType: S } = d.value;
226
+ if (i.length > 1 && S === "touchZoom") {
227
+ const x = {
228
+ x: i[0].clientX,
229
+ y: i[0].clientY
230
+ }, $ = {
231
+ x: i[1].clientX,
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,
236
+ point2: $,
237
+ eventType: "touchZoom"
238
+ });
239
+ } else S === "move" && (s({
240
+ x: i[0].clientX - p.x,
241
+ y: i[0].clientY - p.y
242
+ }, "move"), g({ eventType: "move" }));
243
+ }, C = () => {
244
+ if (!o.value)
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");
250
+ };
251
+ return ye(() => {
252
+ let a;
253
+ return o.value && n.value && (a = V(window, "touchmove", (i) => i.preventDefault(), {
254
+ passive: !1
255
+ })), () => {
256
+ a == null || a.remove();
257
+ };
258
+ }, [o, n]), {
259
+ isTouching: h,
260
+ onTouchStart: m,
261
+ onTouchMove: w,
262
+ onTouchEnd: C
263
+ };
264
+ }
265
+ const J = {
52
266
  infinite: {
53
267
  type: Boolean,
54
268
  default: !0
@@ -64,17 +278,9 @@ const V = {
64
278
  getContainer: {
65
279
  type: String
66
280
  }
67
- }, je = {
281
+ }, Ze = {
68
282
  preview: {
69
- type: Object,
70
- default: () => ({
71
- current: 0,
72
- infinite: !0,
73
- onHideOnClickModal: !0
74
- })
75
- },
76
- showPreview: {
77
- type: Boolean,
283
+ type: [Object, Boolean],
78
284
  default: !0
79
285
  },
80
286
  src: {
@@ -85,16 +291,22 @@ const V = {
85
291
  type: String,
86
292
  default: ""
87
293
  },
294
+ loading: {
295
+ type: String
296
+ },
88
297
  fit: {
89
298
  type: String,
90
299
  default: "contain"
91
300
  },
301
+ crossorigin: {
302
+ type: String
303
+ },
92
304
  lazy: Boolean,
93
305
  scrollContainer: {
94
306
  type: [String, Object]
95
307
  },
96
308
  placeholder: {
97
- type: [Function, Object],
309
+ type: [Function, Object, Boolean],
98
310
  default: () => {
99
311
  }
100
312
  },
@@ -112,22 +324,45 @@ const V = {
112
324
  onClick: {
113
325
  type: Function
114
326
  },
115
- imageClassName: String,
116
- imageStyle: Object,
327
+ wrapperStyle: {
328
+ type: Object,
329
+ default: () => ({})
330
+ },
331
+ wrapperClass: String,
117
332
  width: Number,
118
333
  height: Number,
119
- zIndex: V.zIndex,
120
- getContainer: V.getContainer
121
- }, j = {
122
- previewUrls: {
334
+ zIndex: J.zIndex,
335
+ getContainer: J.getContainer
336
+ }, G = {
337
+ urls: {
123
338
  type: Array,
124
339
  default: () => []
125
340
  },
341
+ open: {
342
+ type: Boolean,
343
+ default: !1
344
+ },
345
+ scaleStep: {
346
+ type: Number,
347
+ default: 0.5
348
+ },
349
+ minScale: {
350
+ type: Number,
351
+ default: 0.32
352
+ },
353
+ maxScale: {
354
+ type: Number,
355
+ default: 32
356
+ },
357
+ movable: {
358
+ type: Boolean,
359
+ default: !0
360
+ },
126
361
  disabled: Boolean,
127
- zIndex: V.zIndex,
128
- current: V.current,
129
- infinite: V.infinite,
130
- getContainer: je.getContainer,
362
+ zIndex: J.zIndex,
363
+ current: J.current,
364
+ infinite: J.infinite,
365
+ getContainer: Ze.getContainer,
131
366
  onHideOnClickModal: {
132
367
  type: Boolean,
133
368
  default: !0
@@ -136,8 +371,11 @@ const V = {
136
371
  icons: {
137
372
  type: Object,
138
373
  default: () => ({})
139
- }
140
- }, Ot = /* @__PURE__ */ ye({
374
+ },
375
+ onTransform: Function,
376
+ onOpenChange: Function,
377
+ "onUpdate:open": Function
378
+ }, Xt = /* @__PURE__ */ pe({
141
379
  name: "Operations",
142
380
  inheritAttrs: !1,
143
381
  props: {
@@ -154,111 +392,111 @@ const V = {
154
392
  showProgress: Boolean,
155
393
  prefixCls: String,
156
394
  hashId: String,
157
- zIndex: j.zIndex,
158
- icons: j.icons,
159
- infinite: j.infinite,
160
- getContainer: j.getContainer,
161
- countRender: j.countRender,
395
+ zIndex: G.zIndex,
396
+ icons: G.icons,
397
+ infinite: G.infinite,
398
+ getContainer: G.getContainer,
399
+ countRender: G.countRender,
162
400
  tools: Array,
163
401
  onClose: Function,
164
402
  onActive: Function
165
403
  },
166
404
  setup(e) {
167
- const t = (i, l) => {
168
- var o;
169
- i.preventDefault(), i.stopPropagation(), (o = e.onActive) == null || o.call(e, l);
405
+ const n = (o, l) => {
406
+ var t;
407
+ o.preventDefault(), o.stopPropagation(), (t = e.onActive) == null || t.call(e, l);
170
408
  };
171
409
  return () => {
172
410
  const {
173
- prefixCls: i,
411
+ prefixCls: o,
174
412
  hashId: l,
175
- tools: o
176
- } = e, f = Ie(`${e.prefixCls}-fade`), c = `${i}-operations-operation`, d = `${i}-operations-icon`;
177
- return r(ze, {
413
+ tools: t
414
+ } = e, s = we(`${e.prefixCls}-fade`), c = `${o}-operations-operation`, h = `${o}-operations-icon`;
415
+ return u(Ee, {
178
416
  to: e.getContainer || "body"
179
417
  }, {
180
- default: () => [r(ge, f, {
418
+ default: () => [u(ge, s, {
181
419
  default: () => {
182
- var E, g, h, C;
183
- return [we(r("div", {
184
- class: oe(`${i}-operations-wrapper`, l),
420
+ var y, d, g, m;
421
+ return [me(u("div", {
422
+ class: Q(`${o}-operations-wrapper`, l),
185
423
  style: {
186
424
  zIndex: e.zIndex
187
425
  }
188
- }, [((E = e.icons) == null ? void 0 : E.close) === null ? null : r("button", {
189
- class: `${i}-close ${l}`,
426
+ }, [((y = e.icons) == null ? void 0 : y.close) === null ? null : u("button", {
427
+ class: `${o}-close ${l}`,
190
428
  onClick: e.onClose
191
- }, [((g = e.icons) == null ? void 0 : g.close) || r(St, null, null)]), e.showSwitch && r(Se, null, [r("div", {
192
- class: oe(`${i}-switch-left ${l}`, {
193
- [`${i}-switch-left-disabled`]: e.infinite ? !1 : e.current === 0
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}`, {
431
+ [`${o}-switch-left-disabled`]: e.infinite ? !1 : e.current === 0
194
432
  }),
195
- onClick: (v) => t(v, -1)
196
- }, [((h = e.icons) == null ? void 0 : h.left) || r(ht, null, null)]), r("div", {
197
- class: oe(`${i}-switch-right ${l}`, {
198
- [`${i}-switch-right-disabled`]: e.infinite ? !1 : e.current === e.count - 1
433
+ 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}`, {
436
+ [`${o}-switch-right-disabled`]: e.infinite ? !1 : e.current === e.count - 1
199
437
  }),
200
- onClick: (v) => t(v, 1)
201
- }, [((C = e.icons) == null ? void 0 : C.right) || r(pt, null, null)])]), r("div", {
202
- class: `${i}-footer ${l}`
203
- }, [e.showProgress && r("div", {
204
- class: `${i}-progress`
205
- }, [e.countRender ? e.countRender(e.current + 1, e.count) : `${e.current + 1} / ${e.count}`]), r("div", {
438
+ onClick: (w) => n(w, 1)
439
+ }, [((m = e.icons) == null ? void 0 : m.right) || u($t, null, null)])]), u("div", {
440
+ class: `${o}-footer ${l}`
441
+ }, [e.showProgress && u("div", {
442
+ class: `${o}-progress`
443
+ }, [e.countRender ? e.countRender(e.current + 1, e.count) : `${e.current + 1} / ${e.count}`]), u("div", {
206
444
  class: `${e.prefixCls}-operations`
207
- }, [o == null ? void 0 : o.map(({
208
- icon: v,
209
- onClick: u,
210
- type: M,
211
- disabled: w
212
- }) => r("div", {
213
- class: oe(c, {
214
- [`${e.prefixCls}-operations-operation-disabled`]: w && (w == null ? void 0 : w.value)
445
+ }, [t == null ? void 0 : t.map(({
446
+ icon: w,
447
+ onClick: C,
448
+ type: a,
449
+ disabled: i
450
+ }) => u("div", {
451
+ class: Q(c, {
452
+ [`${e.prefixCls}-operations-operation-disabled`]: i && (i == null ? void 0 : i.value)
215
453
  }),
216
- onClick: u,
217
- key: M
218
- }, [Je(v, {
219
- class: d
454
+ onClick: C,
455
+ key: a
456
+ }, [ot(w, {
457
+ class: h
220
458
  })]))])])]), [[he, e.open]])];
221
459
  }
222
460
  })]
223
461
  });
224
462
  };
225
463
  }
226
- }), At = new re("viewFadeIn", {
464
+ }), Yt = new ue("viewFadeIn", {
227
465
  "0%": {
228
466
  opacity: 0
229
467
  },
230
468
  "100%": {
231
469
  opacity: 1
232
470
  }
233
- }), xt = new re("viewFadeOut", {
471
+ }), jt = new ue("viewFadeOut", {
234
472
  "0%": {
235
473
  opacity: 1
236
474
  },
237
475
  "100%": {
238
476
  opacity: 0
239
477
  }
240
- }), Lt = new re("viewZoomBadgeIn", {
478
+ }), Bt = new ue("viewZoomBadgeIn", {
241
479
  "0%": {
242
- transform: "scale(0.2)",
480
+ transform: "scale(0)",
243
481
  opacity: 0
244
482
  },
245
483
  "100%": {
246
484
  transform: "scale(1)",
247
485
  opacity: 1
248
486
  }
249
- }), bt = new re("viewZoomBadgeOut", {
487
+ }), Ft = new ue("viewZoomBadgeOut", {
250
488
  "0%": {
251
489
  transform: "scale(1)"
252
490
  },
253
491
  "100%": {
254
- transform: "scale(0.2)",
492
+ transform: "scale(0)",
255
493
  opacity: 0
256
494
  }
257
- }), Pe = (e) => ({
495
+ }), Oe = (e) => ({
258
496
  position: e || "absolute",
259
497
  inset: 0
260
498
  });
261
- function ve(e) {
499
+ function fe(e) {
262
500
  return {
263
501
  position: e,
264
502
  top: 0,
@@ -267,12 +505,12 @@ function ve(e) {
267
505
  insetInlineStart: 0
268
506
  };
269
507
  }
270
- const Tt = (e) => {
271
- const { previewCls: t, modalMaskBg: i, paddingSM: l, marginXL: o, margin: f, paddingLG: c, previewOperationColorDisabled: d, previewOperationHoverColor: E, motionDurationSlow: g, iconCls: h, colorTextLightSolid: C } = e, v = new Y(i).setAlpha(0.1), u = v.clone().setAlpha(0.2);
508
+ 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);
272
510
  return {
273
- [`${t}-footer`]: {
511
+ [`${n}-footer`]: {
274
512
  position: "fixed",
275
- bottom: o,
513
+ bottom: l,
276
514
  left: {
277
515
  _skip_check_: !0,
278
516
  value: "50%"
@@ -283,1050 +521,513 @@ const Tt = (e) => {
283
521
  color: e.previewOperationColor,
284
522
  transform: "translateX(-50%)"
285
523
  },
286
- [`${t}-progress`]: {
287
- marginBottom: f
524
+ [`${n}-progress`]: {
525
+ marginBottom: t
288
526
  },
289
- [`${t}-close`]: {
527
+ [`${n}-close`]: {
290
528
  position: "fixed",
291
- top: o,
529
+ top: l,
292
530
  right: {
293
531
  _skip_check_: !0,
294
- value: o
532
+ value: l
295
533
  },
296
534
  display: "flex",
297
- color: C,
298
- backgroundColor: v.toRgbString(),
299
- borderRadius: "50%",
300
- padding: l,
535
+ alignItems: "center",
536
+ justifyContent: "center",
537
+ color: s,
538
+ backgroundColor: g.toRgbString(),
539
+ borderRadius: e.borderRadiusLG,
540
+ backdropFilter: "saturate(180%) blur(10px)",
541
+ width: e.sizeXL,
542
+ height: e.sizeXL,
301
543
  outline: 0,
302
544
  border: 0,
303
545
  cursor: "pointer",
304
- transition: `all ${g}`,
546
+ transition: `all ${y}`,
305
547
  "&:hover": {
306
- backgroundColor: u.toRgbString()
548
+ backgroundColor: m.toRgbString()
307
549
  },
308
- [`& > ${h}`]: {
550
+ [`& > ${d}`]: {
309
551
  fontSize: e.previewOperationSize
310
552
  }
311
553
  },
312
- [`${t}-operations`]: {
554
+ [`${n}-operations`]: {
313
555
  display: "flex",
314
556
  alignItems: "center",
315
- padding: `0 ${rt(c)}`,
316
- backgroundColor: v.toRgbString(),
317
- borderRadius: 100,
557
+ gap: e.sizeXXS,
558
+ padding: e.paddingXXS,
559
+ backgroundColor: g.toRgbString(),
560
+ borderRadius: e.borderRadiusLG,
561
+ backdropFilter: "saturate(180%) blur(10px)",
318
562
  "&-operation": {
319
- marginInlineStart: l,
320
- padding: l,
563
+ display: "flex",
564
+ alignItems: "center",
565
+ justifyContent: "center",
566
+ width: e.sizeXL + 4,
567
+ height: e.sizeXL + 4,
321
568
  cursor: "pointer",
322
- transition: `all ${g}`,
569
+ color: s,
570
+ borderRadius: e.borderRadiusSM,
571
+ transition: `all ${y}`,
323
572
  userSelect: "none",
324
- [`&:not(${t}-operations-operation-disabled):hover > ${h}`]: {
325
- color: E
573
+ [`&:not(${n}-operations-operation-disabled):hover > ${d}`]: {
574
+ color: h
575
+ },
576
+ "&:hover": {
577
+ backgroundColor: w.toRgbString()
326
578
  },
327
579
  "&-disabled": {
328
- color: d,
580
+ color: c,
329
581
  cursor: "not-allowed"
330
582
  },
331
583
  "&:first-of-type": {
332
584
  marginInlineStart: 0
333
585
  },
334
- [`& > ${h}`]: {
586
+ [`& > ${d}`]: {
335
587
  fontSize: e.previewOperationSize
336
588
  }
337
589
  }
338
590
  }
339
591
  };
340
- }, Pt = (e) => {
341
- const { modalMaskBg: t, iconCls: i, previewOperationColorDisabled: l, previewCls: o, zIndexPopup: f, motionDurationSlow: c } = e, d = new Y(t).setAlpha(0.1), E = d.clone().setAlpha(0.2);
592
+ }, 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);
342
594
  return {
343
- [`${o}-switch-left, ${o}-switch-right`]: {
595
+ [`${t}-switch-left, ${t}-switch-right`]: {
344
596
  position: "fixed",
345
597
  insetBlockStart: "50%",
346
- zIndex: e.calc(f).add(1).equal(),
598
+ zIndex: e.calc(s).add(1).equal(),
347
599
  display: "flex",
348
600
  alignItems: "center",
349
601
  justifyContent: "center",
602
+ borderRadius: e.borderRadius,
603
+ backdropFilter: "saturate(180%) blur(10px)",
350
604
  width: e.imagePreviewSwitchSize,
351
605
  height: e.imagePreviewSwitchSize,
352
606
  marginTop: e.calc(e.imagePreviewSwitchSize).mul(-1).div(2).equal(),
353
- color: e.previewOperationColor,
354
- background: d.toRgbString(),
355
- borderRadius: "50%",
607
+ color: h,
608
+ background: y.toRgbString(),
356
609
  transform: "translateY(-50%)",
357
610
  cursor: "pointer",
358
611
  transition: `all ${c}`,
359
612
  userSelect: "none",
360
613
  "&:hover": {
361
- background: E.toRgbString()
614
+ background: d.toRgbString()
362
615
  },
363
616
  "&-disabled": {
364
617
  "&, &:hover": {
365
618
  color: l,
366
619
  background: "transparent",
367
620
  cursor: "not-allowed",
368
- [`> ${i}`]: {
621
+ [`> ${o}`]: {
369
622
  cursor: "not-allowed"
370
623
  }
371
624
  }
372
625
  },
373
- [`> ${i}`]: {
626
+ [`> ${o}`]: {
374
627
  fontSize: e.previewOperationSize
375
628
  }
376
629
  },
377
- [`${o}-switch-left`]: {
630
+ [`${t}-switch-left`]: {
378
631
  insetInlineStart: e.marginSM
379
632
  },
380
- [`${o}-switch-right`]: {
633
+ [`${t}-switch-right`]: {
381
634
  insetInlineEnd: e.marginSM
382
635
  }
383
636
  };
384
- }, Rt = (e) => ({
385
- [e.componentCls]: {
386
- height: "100%",
387
- textAlign: "center",
388
- pointerEvents: "none",
389
- "&-root": {
390
- ...ve("fixed"),
391
- zIndex: e.zIndexPopup,
392
- overflow: "auto",
393
- outline: 0,
394
- WebkitOverflowScrolling: "touch"
395
- },
396
- "&-wrap": {
397
- ...ve("fixed"),
398
- zIndex: e.zIndexPopup,
399
- overflow: "auto",
400
- outline: 0,
401
- WebkitOverflowScrolling: "touch"
402
- },
403
- "&-mask": {
404
- ...ve("fixed"),
405
- zIndex: e.zIndexPopupBase,
637
+ }, kt = (e) => {
638
+ const { motionEaseOut: n, motionDurationSlow: o } = e;
639
+ return {
640
+ [e.componentCls]: {
406
641
  height: "100%",
407
- backgroundColor: e.colorBgMask
408
- },
409
- "&-body": {
410
- ...Pe(),
411
- overflow: "hidden"
412
- },
413
- "&-img": {
414
- maxWidth: "100%",
415
- maxHeight: "100%",
416
- verticalAlign: "middle",
417
- transform: "scale3d(1, 1, 1)",
418
- cursor: "grab",
419
- transition: `transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,
420
- userSelect: "none",
421
- pointerEvents: "auto",
422
- "&-wrapper": {
423
- ...Pe(),
424
- display: "flex",
425
- justifyContent: "center",
426
- alignItems: "center",
427
- transition: `transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,
428
- "&::before": {
429
- display: "inline-block",
430
- width: 1,
431
- height: "50%",
432
- marginInlineEnd: -1,
433
- content: '""'
642
+ textAlign: "center",
643
+ pointerEvents: "none",
644
+ "&-root": {
645
+ ...fe("fixed"),
646
+ zIndex: e.zIndexPopup,
647
+ overflow: "auto",
648
+ outline: 0,
649
+ WebkitOverflowScrolling: "touch"
650
+ },
651
+ "&-wrap": {
652
+ ...fe("fixed"),
653
+ zIndex: e.zIndexPopup,
654
+ overflow: "auto",
655
+ outline: 0,
656
+ WebkitOverflowScrolling: "touch"
657
+ },
658
+ "&-mask": {
659
+ ...fe("fixed"),
660
+ zIndex: e.zIndexPopupBase,
661
+ height: "100%",
662
+ backgroundColor: e.colorBgMask,
663
+ backdropFilter: "blur(2px)"
664
+ },
665
+ "&-body": {
666
+ ...Oe(),
667
+ overflow: "hidden"
668
+ },
669
+ "&-img": {
670
+ maxWidth: "100%",
671
+ maxHeight: "70%",
672
+ verticalAlign: "middle",
673
+ transform: "scale3d(1, 1, 1)",
674
+ cursor: "grab",
675
+ transition: `transform ${o} ${n} 0s`,
676
+ userSelect: "none",
677
+ "&-wrapper": {
678
+ ...Oe(),
679
+ transition: `transform ${o} ${n} 0s`,
680
+ display: "flex",
681
+ justifyContent: "center",
682
+ alignItems: "center",
683
+ "& > *": {
684
+ pointerEvents: "auto"
685
+ },
686
+ "&::before": {
687
+ display: "inline-block",
688
+ width: 1,
689
+ height: "50%",
690
+ marginInlineEnd: -1,
691
+ content: '""'
692
+ }
434
693
  }
694
+ },
695
+ "&-moving": {
696
+ [`${e.componentCls}-view-img`]: {
697
+ cursor: "grabbing",
698
+ "&-wrapper": {
699
+ transitionDuration: "0s"
700
+ }
701
+ }
702
+ },
703
+ "&-mask-zoom-appear, &-mask-zoom-enter": {
704
+ animationName: Yt,
705
+ animationDuration: e.motionDurationSlow,
706
+ animationTimingFunction: "linear",
707
+ userSelect: "none"
708
+ },
709
+ "&-mask-zoom-leave": {
710
+ animationName: jt,
711
+ animationDuration: e.motionDurationSlow,
712
+ animationTimingFunction: "linear",
713
+ pointerEvents: "none"
714
+ },
715
+ "&-zoom-appear, &-zoom-enter": {
716
+ animationName: Bt,
717
+ opacity: 0,
718
+ animationTimingFunction: e.motionEaseOutCirc,
719
+ animationFillMode: "both",
720
+ transform: "none",
721
+ animationDuration: e.motionDurationMid,
722
+ userSelect: "none"
723
+ },
724
+ "&-zoom-enter-active": {
725
+ animationPlayState: "running"
726
+ },
727
+ "&-zoom-leave": {
728
+ animationName: Ft,
729
+ animationDuration: e.motionDurationSlow,
730
+ animationTimingFunction: e.motionEaseInOutCirc,
731
+ animationFillMode: "both"
435
732
  }
436
733
  },
437
- "&-fade-appear, &-fade-enter": {
438
- animationName: At,
439
- animationDuration: e.motionDurationSlow,
440
- animationTimingFunction: "linear"
441
- },
442
- "&-fade-leave": {
443
- animationName: xt,
444
- animationDuration: e.motionDurationSlow,
445
- animationTimingFunction: "linear"
446
- },
447
- "&-zoom-appear, &-zoom-enter": {
448
- animationName: Lt,
449
- opacity: 0,
450
- animationTimingFunction: e.motionEaseOutCirc,
451
- animationFillMode: "both",
452
- transform: "none",
453
- animationDuration: e.motionDurationSlow,
454
- userSelect: "none"
734
+ [`${e.componentCls}-root`]: {
735
+ [`${e.componentCls}-wrapper`]: {
736
+ zIndex: e.zIndexPopup
737
+ }
455
738
  },
456
- "&-zoom-enter-active": {
457
- animationPlayState: "running"
739
+ [`${e.componentCls}-operations-wrapper`]: {
740
+ position: "fixed",
741
+ insetBlockStart: 0,
742
+ insetInlineEnd: 0,
743
+ zIndex: e.calc(e.zIndexPopup).add(1).equal(),
744
+ width: "100%"
458
745
  },
459
- "&-zoom-leave": {
460
- animationName: bt,
461
- animationDuration: e.motionDurationSlow,
462
- animationTimingFunction: e.motionEaseOutBack,
463
- animationFillMode: "both"
464
- }
465
- },
466
- [`${e.componentCls}-root`]: {
467
- [`${e.componentCls}-wrapper`]: {
468
- zIndex: e.zIndexPopup
469
- }
470
- },
471
- [`${e.componentCls}-operations-wrapper`]: {
472
- position: "fixed",
473
- insetBlockStart: 0,
474
- insetInlineEnd: 0,
475
- zIndex: e.zIndexPopup + 1,
476
- width: "100%"
477
- },
478
- "&": [Tt(e), Pt(e)]
479
- });
480
- function $t(e) {
481
- return at("ImageViewer", (t) => {
482
- const i = lt(t, {
483
- zIndexPopup: t.zIndexPopupBase + 80,
484
- previewOperationColorDisabled: new Y(t.colorTextLightSolid).setAlpha(0.25).toRgbString(),
485
- previewOperationHoverColor: new Y(t.colorTextLightSolid).setAlpha(0.85).toRgbString(),
486
- modalMaskBg: new Y("#000").setAlpha(0.45).toRgbString(),
746
+ "&": [Ht(e), Zt(e)]
747
+ };
748
+ };
749
+ function Wt(e) {
750
+ return ut("ImageViewer", (n) => {
751
+ const o = ct(n, {
752
+ zIndexPopup: n.zIndexPopupBase + 80,
753
+ previewOperationColor: new Z(n.colorTextLightSolid).setAlpha(0.65).toRgbString(),
754
+ previewOperationHoverColor: new Z(n.colorTextLightSolid).setAlpha(0.85).toRgbString(),
755
+ previewOperationColorDisabled: new Z(n.colorTextLightSolid).setAlpha(0.25).toRgbString(),
756
+ imagePreviewSwitchSize: n.sizeXL,
757
+ modalMaskBg: new Z("#000").setAlpha(0.45).toRgbString(),
487
758
  // FIXME: Shared Token
488
- previewOperationColor: new Y(t.colorTextLightSolid).toRgbString(),
489
- previewOperationSize: t.fontSizeIcon * 1.5,
759
+ previewOperationSize: n.fontSizeIcon * 1.5,
490
760
  // FIXME: fontSizeIconLG
491
- imagePreviewSwitchSize: t.controlHeightLG,
492
- iconCls: "anticon",
493
- previewCls: t.componentCls
761
+ iconCls: ".anticon",
762
+ previewCls: n.componentCls
494
763
  });
495
- return [Rt(i)];
764
+ return [kt(o)];
496
765
  }, e);
497
766
  }
498
- let Ye = !1;
499
- try {
500
- const e = Object.defineProperty({}, "passive", {
501
- get() {
502
- Ye = !0;
503
- }
504
- });
505
- window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e);
506
- } catch {
507
- }
508
- function F(e, t, i, l) {
509
- if (e && e.addEventListener) {
510
- let o = l;
511
- o === void 0 && Ye && (t === "touchstart" || t === "touchmove" || t === "wheel") && (o = { passive: !1 }), e.addEventListener(t, i, o);
512
- }
513
- return {
514
- remove: () => {
515
- e && e.removeEventListener && e.removeEventListener(t, i);
516
- }
517
- };
518
- }
519
- const a = {
520
- /**
521
- * MAC_ENTER
522
- */
523
- MAC_ENTER: 3,
524
- /**
525
- * BACKSPACE
526
- */
527
- BACKSPACE: 8,
528
- /**
529
- * TAB
530
- */
531
- TAB: 9,
532
- /**
533
- * NUMLOCK on FF/Safari Mac
534
- */
535
- NUM_CENTER: 12,
536
- // NUMLOCK on FF/Safari Mac
537
- /**
538
- * ENTER
539
- */
540
- ENTER: 13,
541
- /**
542
- * SHIFT
543
- */
544
- SHIFT: 16,
545
- /**
546
- * CTRL
547
- */
548
- CTRL: 17,
549
- /**
550
- * ALT
551
- */
552
- ALT: 18,
553
- /**
554
- * PAUSE
555
- */
556
- PAUSE: 19,
557
- /**
558
- * CAPS_LOCK
559
- */
560
- CAPS_LOCK: 20,
767
+ const ve = {
561
768
  /**
562
769
  * ESC
563
770
  */
564
771
  ESC: 27,
565
- /**
566
- * SPACE
567
- */
568
- SPACE: 32,
569
- /**
570
- * PAGE_UP
571
- */
572
- PAGE_UP: 33,
573
- // also NUM_NORTH_EAST
574
- /**
575
- * PAGE_DOWN
576
- */
577
- PAGE_DOWN: 34,
578
- // also NUM_SOUTH_EAST
579
- /**
580
- * END
581
- */
582
- END: 35,
583
- // also NUM_SOUTH_WEST
584
- /**
585
- * HOME
586
- */
587
- HOME: 36,
588
772
  // also NUM_NORTH_WEST
589
773
  /**
590
774
  * LEFT
591
775
  */
592
776
  LEFT: 37,
593
- // also NUM_WEST
594
- /**
595
- * UP
596
- */
597
- UP: 38,
598
777
  // also NUM_NORTH
599
778
  /**
600
779
  * RIGHT
601
780
  */
602
- RIGHT: 39,
603
- // also NUM_EAST
604
- /**
605
- * DOWN
606
- */
607
- DOWN: 40,
608
- // also NUM_SOUTH
609
- /**
610
- * PRINT_SCREEN
611
- */
612
- PRINT_SCREEN: 44,
613
- /**
614
- * INSERT
615
- */
616
- INSERT: 45,
617
- // also NUM_INSERT
618
- /**
619
- * DELETE
620
- */
621
- DELETE: 46,
622
- // also NUM_DELETE
623
- /**
624
- * ZERO
625
- */
626
- ZERO: 48,
627
- /**
628
- * ONE
629
- */
630
- ONE: 49,
631
- /**
632
- * TWO
633
- */
634
- TWO: 50,
635
- /**
636
- * THREE
637
- */
638
- THREE: 51,
639
- /**
640
- * FOUR
641
- */
642
- FOUR: 52,
643
- /**
644
- * FIVE
645
- */
646
- FIVE: 53,
647
- /**
648
- * SIX
649
- */
650
- SIX: 54,
651
- /**
652
- * SEVEN
653
- */
654
- SEVEN: 55,
655
- /**
656
- * EIGHT
657
- */
658
- EIGHT: 56,
659
- /**
660
- * NINE
661
- */
662
- NINE: 57,
663
- /**
664
- * QUESTION_MARK
665
- */
666
- QUESTION_MARK: 63,
667
- // needs localization
668
- /**
669
- * A
670
- */
671
- A: 65,
672
- /**
673
- * B
674
- */
675
- B: 66,
676
- /**
677
- * C
678
- */
679
- C: 67,
680
- /**
681
- * D
682
- */
683
- D: 68,
684
- /**
685
- * E
686
- */
687
- E: 69,
688
- /**
689
- * F
690
- */
691
- F: 70,
692
- /**
693
- * G
694
- */
695
- G: 71,
696
- /**
697
- * H
698
- */
699
- H: 72,
700
- /**
701
- * I
702
- */
703
- I: 73,
704
- /**
705
- * J
706
- */
707
- J: 74,
708
- /**
709
- * K
710
- */
711
- K: 75,
712
- /**
713
- * L
714
- */
715
- L: 76,
716
- /**
717
- * M
718
- */
719
- M: 77,
720
- /**
721
- * N
722
- */
723
- N: 78,
724
- /**
725
- * O
726
- */
727
- O: 79,
728
- /**
729
- * P
730
- */
731
- P: 80,
732
- /**
733
- * Q
734
- */
735
- Q: 81,
736
- /**
737
- * R
738
- */
739
- R: 82,
740
- /**
741
- * S
742
- */
743
- S: 83,
744
- /**
745
- * T
746
- */
747
- T: 84,
748
- /**
749
- * U
750
- */
751
- U: 85,
752
- /**
753
- * V
754
- */
755
- V: 86,
756
- /**
757
- * W
758
- */
759
- W: 87,
760
- /**
761
- * X
762
- */
763
- X: 88,
764
- /**
765
- * Y
766
- */
767
- Y: 89,
768
- /**
769
- * Z
770
- */
771
- Z: 90,
772
- /**
773
- * META
774
- */
775
- META: 91,
776
- // WIN_KEY_LEFT
777
- /**
778
- * WIN_KEY_RIGHT
779
- */
780
- WIN_KEY_RIGHT: 92,
781
- /**
782
- * CONTEXT_MENU
783
- */
784
- CONTEXT_MENU: 93,
785
- /**
786
- * NUM_ZERO
787
- */
788
- NUM_ZERO: 96,
789
- /**
790
- * NUM_ONE
791
- */
792
- NUM_ONE: 97,
793
- /**
794
- * NUM_TWO
795
- */
796
- NUM_TWO: 98,
797
- /**
798
- * NUM_THREE
799
- */
800
- NUM_THREE: 99,
801
- /**
802
- * NUM_FOUR
803
- */
804
- NUM_FOUR: 100,
805
- /**
806
- * NUM_FIVE
807
- */
808
- NUM_FIVE: 101,
809
- /**
810
- * NUM_SIX
811
- */
812
- NUM_SIX: 102,
813
- /**
814
- * NUM_SEVEN
815
- */
816
- NUM_SEVEN: 103,
817
- /**
818
- * NUM_EIGHT
819
- */
820
- NUM_EIGHT: 104,
821
- /**
822
- * NUM_NINE
823
- */
824
- NUM_NINE: 105,
825
- /**
826
- * NUM_MULTIPLY
827
- */
828
- NUM_MULTIPLY: 106,
829
- /**
830
- * NUM_PLUS
831
- */
832
- NUM_PLUS: 107,
833
- /**
834
- * NUM_MINUS
835
- */
836
- NUM_MINUS: 109,
837
- /**
838
- * NUM_PERIOD
839
- */
840
- NUM_PERIOD: 110,
841
- /**
842
- * NUM_DIVISION
843
- */
844
- NUM_DIVISION: 111,
845
- /**
846
- * F1
847
- */
848
- F1: 112,
849
- /**
850
- * F2
851
- */
852
- F2: 113,
853
- /**
854
- * F3
855
- */
856
- F3: 114,
857
- /**
858
- * F4
859
- */
860
- F4: 115,
861
- /**
862
- * F5
863
- */
864
- F5: 116,
865
- /**
866
- * F6
867
- */
868
- F6: 117,
869
- /**
870
- * F7
871
- */
872
- F7: 118,
873
- /**
874
- * F8
875
- */
876
- F8: 119,
877
- /**
878
- * F9
879
- */
880
- F9: 120,
881
- /**
882
- * F10
883
- */
884
- F10: 121,
885
- /**
886
- * F11
887
- */
888
- F11: 122,
889
- /**
890
- * F12
891
- */
892
- F12: 123,
893
- /**
894
- * NUMLOCK
895
- */
896
- NUMLOCK: 144,
897
- /**
898
- * SEMICOLON
899
- */
900
- SEMICOLON: 186,
901
- // needs localization
902
- /**
903
- * DASH
904
- */
905
- DASH: 189,
906
- // needs localization
907
- /**
908
- * EQUALS
909
- */
910
- EQUALS: 187,
911
- // needs localization
912
- /**
913
- * COMMA
914
- */
915
- COMMA: 188,
916
- // needs localization
917
- /**
918
- * PERIOD
919
- */
920
- PERIOD: 190,
921
- // needs localization
922
- /**
923
- * SLASH
924
- */
925
- SLASH: 191,
926
- // needs localization
927
- /**
928
- * APOSTROPHE
929
- */
930
- APOSTROPHE: 192,
931
- // needs localization
932
- /**
933
- * SINGLE_QUOTE
934
- */
935
- SINGLE_QUOTE: 222,
936
- // needs localization
937
- /**
938
- * OPEN_SQUARE_BRACKET
939
- */
940
- OPEN_SQUARE_BRACKET: 219,
941
- // needs localization
942
- /**
943
- * BACKSLASH
944
- */
945
- BACKSLASH: 220,
946
- // needs localization
947
- /**
948
- * CLOSE_SQUARE_BRACKET
949
- */
950
- CLOSE_SQUARE_BRACKET: 221,
951
- // needs localization
952
- /**
953
- * WIN_KEY
954
- */
955
- WIN_KEY: 224,
956
- /**
957
- * MAC_FF_META
958
- */
959
- MAC_FF_META: 224,
960
- // Firefox (Gecko) fires this for the meta key instead of 91
961
- /**
962
- * WIN_IME
963
- */
964
- WIN_IME: 229,
965
- // ======================== Function ========================
966
- /**
967
- * whether text and modified key is entered at the same time.
968
- */
969
- isTextModifyingKeyEvent: function(t) {
970
- const { keyCode: i } = t;
971
- if (t.altKey && !t.ctrlKey || t.metaKey || // Function keys don't generate text
972
- i >= a.F1 && i <= a.F12)
973
- return !1;
974
- switch (i) {
975
- case a.ALT:
976
- case a.CAPS_LOCK:
977
- case a.CONTEXT_MENU:
978
- case a.CTRL:
979
- case a.DOWN:
980
- case a.END:
981
- case a.ESC:
982
- case a.HOME:
983
- case a.INSERT:
984
- case a.LEFT:
985
- case a.MAC_FF_META:
986
- case a.META:
987
- case a.NUMLOCK:
988
- case a.NUM_CENTER:
989
- case a.PAGE_DOWN:
990
- case a.PAGE_UP:
991
- case a.PAUSE:
992
- case a.PRINT_SCREEN:
993
- case a.RIGHT:
994
- case a.SHIFT:
995
- case a.UP:
996
- case a.WIN_KEY:
997
- case a.WIN_KEY_RIGHT:
998
- return !1;
999
- default:
1000
- return !0;
1001
- }
1002
- },
1003
- /**
1004
- * whether character is entered.
1005
- */
1006
- isCharacterKey: function(t) {
1007
- if (t >= a.ZERO && t <= a.NINE || t >= a.NUM_ZERO && t <= a.NUM_MULTIPLY || t >= a.A && t <= a.Z || window.navigator.userAgent.includes("WebKit") && t === 0)
1008
- return !0;
1009
- switch (t) {
1010
- case a.SPACE:
1011
- case a.QUESTION_MARK:
1012
- case a.NUM_PLUS:
1013
- case a.NUM_MINUS:
1014
- case a.NUM_PERIOD:
1015
- case a.NUM_DIVISION:
1016
- case a.SEMICOLON:
1017
- case a.DASH:
1018
- case a.EQUALS:
1019
- case a.COMMA:
1020
- case a.PERIOD:
1021
- case a.SLASH:
1022
- case a.APOSTROPHE:
1023
- case a.SINGLE_QUOTE:
1024
- case a.OPEN_SQUARE_BRACKET:
1025
- case a.BACKSLASH:
1026
- case a.CLOSE_SQUARE_BRACKET:
1027
- return !0;
1028
- default:
1029
- return !1;
1030
- }
1031
- }
1032
- };
1033
- function Dt(e) {
1034
- const t = e.getBoundingClientRect(), i = document.documentElement;
1035
- return {
1036
- left: t.left + (window.scrollX || i.scrollLeft) - (i.clientLeft || document.body.clientLeft || 0),
1037
- top: t.top + (window.scrollY || i.scrollTop) - (i.clientTop || document.body.clientTop || 0)
1038
- };
1039
- }
1040
- function zt() {
1041
- const e = document.documentElement.clientWidth, t = window.innerHeight || document.documentElement.clientHeight;
1042
- return {
1043
- width: e,
1044
- height: t
1045
- };
1046
- }
1047
- function Re(e, t, i, l) {
1048
- const o = t + i, f = (i - l) / 2;
1049
- if (i > l) {
1050
- if (t > 0)
1051
- return {
1052
- [e]: f
1053
- };
1054
- if (t < 0 && o < l)
1055
- return {
1056
- [e]: -f
1057
- };
1058
- } else if (t < 0 || o > l)
1059
- return {
1060
- [e]: t < 0 ? f : -f
1061
- };
1062
- return {};
1063
- }
1064
- function Ut(e, t, i, l) {
1065
- const { width: o, height: f } = zt();
1066
- let c = null;
1067
- return e <= o && t <= f ? c = {
1068
- x: 0,
1069
- y: 0
1070
- } : (e > o || t > f) && (c = {
1071
- ...Re("x", i, e, o),
1072
- ...Re("y", l, t, f)
1073
- }), c;
1074
- }
1075
- const D = {
1076
- x: 0,
1077
- y: 0
1078
- }, B = {
1079
- rotateLeft: r(It, null, null),
1080
- rotateRight: r(Et, null, null),
1081
- zoomIn: r(Ct, null, null),
1082
- zoomOut: r(yt, null, null),
1083
- flipX: r(be, null, null),
1084
- flipY: r(be, {
781
+ 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),
787
+ flipX: u(ze, null, null),
788
+ flipY: u(ze, {
1085
789
  rotate: 90
1086
790
  }, null)
1087
- }, Ke = ["close", "left", "right", "rotateRight", "rotateRight", "zoomOut", "flipX", "flipY", "rotateLeft"], _t = /* @__PURE__ */ ye({
791
+ }, ke = ["close", "left", "right", "rotateRight", "rotateRight", "zoomOut", "flipX", "flipY", "rotateLeft"], _t = /* @__PURE__ */ pe({
1088
792
  name: "GImagePreview",
1089
- props: j,
793
+ props: G,
1090
794
  inheritAttrs: !1,
1091
- emits: ["close", "switch", "afterClose"],
1092
- emit: Object,
795
+ slots: Object,
796
+ emits: {
797
+ close: () => !0,
798
+ transform: (e) => !0,
799
+ "update:open": (e) => !0
800
+ },
1093
801
  setup: (e, {
1094
- emit: t,
1095
- expose: i,
802
+ emit: n,
803
+ expose: o,
1096
804
  slots: l
1097
805
  }) => {
1098
- const o = Ue({
806
+ const t = De({
1099
807
  suffixCls: "image-view"
1100
808
  }), {
1101
- wrapSSR: f,
809
+ wrapSSR: s,
1102
810
  hashId: c
1103
- } = $t(o), [d, E] = xe(!1), [g, h] = xe(!1), C = N(null), v = N(e.current), u = Z(1), M = Z(0), w = Z(!1), O = ae({
1104
- x: 1,
1105
- y: 1
1106
- }), [p, L] = Mt(D), K = Z({
1107
- wheelDirection: 0
1108
- }), P = Z(), A = ae({
1109
- originX: 0,
1110
- originY: 0,
1111
- deltaX: 0,
1112
- deltaY: 0
1113
- }), R = ae(/* @__PURE__ */ new Map()), z = y(() => new Map(Array.from(R).map(([n, {
1114
- url: m
1115
- }]) => [n, m]))), Q = y(() => z.value.get(v.value)), U = y(() => z.value.size), W = y(() => Array.from(z.value.keys())), b = y(() => W.value.indexOf(v.value)), k = y(() => U.value > 1), G = y(() => U.value >= 1);
1116
- H(d, (n) => {
1117
- n && (g.value = !0);
811
+ } = Wt(t), [h, y, d] = At(e.open, {
812
+ value: F(e, "open"),
813
+ onChange: (r) => {
814
+ var z;
815
+ (z = e.onOpenChange) == null || z.call(e, r), n("update:open", r);
816
+ }
817
+ }), [g, m] = ee(!1), [w, C] = ee(!0), a = L(), {
818
+ transform: i,
819
+ resetTransform: p,
820
+ updateTransform: f,
821
+ dispatchZoomChange: S
822
+ } = Et(a, F(e, "minScale"), F(e, "maxScale"), e.onTransform), {
823
+ isMoving: x,
824
+ onMouseDown: $,
825
+ onWheel: T
826
+ } = Rt(a, F(e, "movable"), d, F(e, "scaleStep"), i, f, S), {
827
+ isTouching: M,
828
+ 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);
834
+ }, [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
+ 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);
1118
840
  });
1119
- const s = (n) => {
1120
- v.value = n;
841
+ const E = (r) => {
842
+ O.value = r;
1121
843
  };
1122
- H(() => e.current, (n) => {
1123
- Ee(n) && s(n);
844
+ K(() => e.current, (r) => {
845
+ Re(r) && E(r);
1124
846
  });
1125
- function S(n, m) {
1126
- R.set(n, {
1127
- url: m,
847
+ function te(r, z) {
848
+ P.set(r, {
849
+ url: z,
1128
850
  loading: !0,
1129
851
  canPreview: !1
1130
852
  });
1131
853
  }
1132
- const x = () => {
1133
- h(!1), v.value = e.current;
1134
- }, se = () => {
1135
- u.value = 1, M.value = 0, O.x = 1, O.y = 1, L(D), t("close");
1136
- }, ce = (n) => {
1137
- w.value || C.value === (n == null ? void 0 : n.target) && x();
1138
- }, ue = () => {
1139
- const n = R.get(v.value);
1140
- n && (n.loading = !1, n.canPreview = !0);
1141
- }, q = (n) => {
1142
- const m = R.get(v.value);
1143
- m && (m.loading = !1, m.canPreview = !1), n.target.alt = "加载失败";
1144
- }, J = () => {
1145
- if (b.value > 0 || e.infinite) {
1146
- const n = b.value - 1 < 0 ? e.previewUrls.length - 1 : b.value - 1;
1147
- s(W.value[n]);
1148
- }
1149
- }, ee = () => {
1150
- if (b.value < U.value - 1 || e.infinite) {
1151
- const n = b.value + 1 > e.previewUrls.length - 1 ? 0 : b.value + 1;
1152
- s(W.value[n]);
1153
- }
1154
- }, _ = (n) => {
1155
- n ? u.value += 0.5 : u.value++, L(D);
1156
- }, X = (n) => {
1157
- u.value > 1 && (n ? u.value -= 0.5 : u.value--), L(D);
1158
- }, de = () => {
1159
- M.value += 90;
854
+ const ce = () => {
855
+ m(!1);
1160
856
  }, We = () => {
1161
- M.value -= 90;
857
+ p("close"), n("close");
858
+ }, _e = (r) => {
859
+ x.value || N.value === (r == null ? void 0 : r.target) && ce();
1162
860
  }, Ge = () => {
1163
- O.x = -O.x;
1164
- }, Xe = () => {
1165
- O.y = -O.y;
1166
- }, Me = [{
1167
- icon: $(l, e.icons, "zoomIn") || B.zoomIn,
1168
- onClick: () => _(),
1169
- type: "zoomIn"
1170
- }, {
1171
- icon: $(l, e.icons, "zoomOut") || B.zoomOut,
1172
- onClick: () => X(),
1173
- type: "zoomOut",
1174
- disabled: y(() => u.value === 1)
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 = () => {
867
+ 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");
870
+ }
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");
875
+ }
876
+ }, Ue = () => {
877
+ S(U + e.scaleStep, "zoomIn");
878
+ }, qe = () => {
879
+ S(U / (U + e.scaleStep), "zoomOut");
880
+ }, Ke = () => {
881
+ f({
882
+ rotate: i.value.rotate + 90
883
+ }, "rotateRight");
884
+ }, Qe = () => {
885
+ f({
886
+ rotate: i.value.rotate - 90
887
+ }, "rotateLeft");
888
+ }, Je = () => {
889
+ f({
890
+ flipX: !i.value.flipX
891
+ }, "flipX");
892
+ }, et = () => {
893
+ f({
894
+ flipY: !i.value.flipY
895
+ }, "flipY");
896
+ }, Ie = [{
897
+ icon: H(l, e.icons, "flipY") || _.flipY,
898
+ onClick: et,
899
+ type: "flipY"
1175
900
  }, {
1176
- icon: $(l, e.icons, "rotateRight") || B.rotateRight,
1177
- onClick: de,
1178
- type: "rotateRight"
901
+ icon: H(l, e.icons, "flipX") || _.flipX,
902
+ onClick: Je,
903
+ type: "flipX"
1179
904
  }, {
1180
- icon: $(l, e.icons, "rotateLeft") || B.rotateLeft,
1181
- onClick: We,
905
+ icon: H(l, e.icons, "rotateLeft") || _.rotateLeft,
906
+ onClick: Qe,
1182
907
  type: "rotateLeft"
1183
908
  }, {
1184
- icon: $(l, e.icons, "flipX") || B.flipX,
1185
- onClick: Ge,
1186
- type: "flipX"
909
+ icon: H(l, e.icons, "rotateRight") || _.rotateRight,
910
+ onClick: Ke,
911
+ type: "rotateRight"
1187
912
  }, {
1188
- icon: $(l, e.icons, "flipY") || B.flipY,
1189
- onClick: Xe,
1190
- type: "flipY"
1191
- }], Oe = () => {
1192
- if (d.value && w.value && P.value) {
1193
- const n = P.value.offsetWidth * u.value, m = P.value.offsetHeight * u.value, {
1194
- left: T,
1195
- top: I
1196
- } = Dt(P.value), te = M.value % 180 !== 0;
1197
- w.value = !1;
1198
- const ne = Ut(te ? m : n, te ? n : m, T, I);
1199
- ne && L({
1200
- ...ne
1201
- });
1202
- }
1203
- }, Ze = (n) => {
1204
- n.button === 0 && (n.preventDefault(), n.stopPropagation(), A.deltaX = n.pageX - p.x, A.deltaY = n.pageY - p.y, A.originX = p.x, A.originY = p.y, w.value = !0);
1205
- }, Ae = (n) => {
1206
- d.value && w.value && L({
1207
- x: n.pageX - A.deltaX,
1208
- y: n.pageY - A.deltaY
1209
- });
1210
- }, Ve = (n) => {
1211
- if (!d.value) return;
1212
- n.preventDefault();
1213
- const m = n.deltaY;
1214
- K.value = {
1215
- wheelDirection: m
1216
- };
1217
- }, Qe = (n) => {
1218
- !d.value || !k.value || (n.keyCode === a.LEFT ? J() : n.keyCode === a.RIGHT && ee());
1219
- }, ke = () => {
1220
- d.value && (u.value !== 1 && (u.value = 1), (p.x !== D.x || p.y !== D.y) && L(D));
913
+ icon: H(l, e.icons, "zoomOut") || _.zoomOut,
914
+ onClick: () => qe(),
915
+ type: "zoomOut",
916
+ disabled: b(() => i.value.scale <= e.minScale)
917
+ }, {
918
+ icon: H(l, e.icons, "zoomIn") || _.zoomIn,
919
+ onClick: () => Ue(),
920
+ type: "zoomIn",
921
+ disabled: b(() => i.value.scale === e.maxScale)
922
+ }], tt = (r) => {
923
+ d.value && (i.value.scale !== 1 ? f({
924
+ x: 0,
925
+ y: 0,
926
+ 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());
1221
930
  };
1222
- let fe = () => {
931
+ let de = () => {
1223
932
  };
1224
- return De(() => {
1225
- H(() => e.previewUrls, (n) => {
1226
- _e(n) && n.forEach((m, T) => {
1227
- S(T, m);
933
+ return Te(() => {
934
+ K(() => e.urls, (r) => {
935
+ ft(r) && r.forEach((z, ne) => {
936
+ te(ne, z);
1228
937
  });
1229
938
  }, {
1230
939
  flush: "post",
1231
940
  immediate: !0
1232
- }), H([() => d.value, w], () => {
1233
- fe();
1234
- let n, m;
1235
- const T = F(window, "mouseup", Oe, !1), I = F(window, "mousemove", Ae, !1), te = F(window, "wheel", Ve, {
1236
- passive: !1
1237
- }), ne = F(window, "keydown", Qe, !1);
1238
- try {
1239
- window.top !== window.self && (n = F(window.top, "mouseup", Oe, !1), m = F(window.top, "mousemove", Ae, !1));
1240
- } catch (qe) {
1241
- Nt(!1, `[vc-image] ${qe}`);
1242
- }
1243
- fe = () => {
1244
- T.remove(), I.remove(), te.remove(), ne.remove(), n && n.remove(), m && m.remove();
941
+ }), K([() => d.value, () => x.value], () => {
942
+ de();
943
+ const r = V(window, "keydown", nt, !1);
944
+ de = () => {
945
+ r.remove();
1245
946
  };
1246
947
  }, {
1247
948
  flush: "post",
1248
949
  immediate: !0
1249
- }), H([K], () => {
1250
- const {
1251
- wheelDirection: n
1252
- } = K.value;
1253
- n > 0 ? X(!0) : n < 0 && _(!0);
1254
950
  });
1255
- }), et(() => {
1256
- fe();
1257
- }), i({
1258
- setOpen: E
951
+ }), at(() => {
952
+ de();
953
+ }), o({
954
+ setOpen: (r) => {
955
+ y(r), O.value = e.current;
956
+ }
1259
957
  }), () => {
1260
- const n = Ie(`${o}-fade`), m = Ie(`${o}-zoom`), T = {};
1261
- for (const I in e.icons)
1262
- T[I] = $(l, e.icons, I);
1263
- return f(r(Se, null, [r(ze, {
958
+ const r = we(`${t}-mask-zoom`), z = we(`${t}-zoom`), ne = {};
959
+ for (const R in e.icons)
960
+ ne[R] = H(l, e.icons, R);
961
+ return s(u(re, null, [u(Ee, {
1264
962
  to: e.getContainer || "body"
1265
963
  }, {
1266
- default: () => [d.value && r(Se, null, [r("div", {
1267
- class: `${o}-root ${c.value}`
1268
- }, [r(ge, n, {
1269
- default: () => [we(r("div", {
1270
- class: `${o}-mask ${c.value}`
964
+ default: () => [d.value && u(re, null, [u("div", {
965
+ class: `${t}-root ${c.value}`
966
+ }, [u(ge, r, {
967
+ default: () => [me(u("div", {
968
+ class: `${t}-mask ${c.value}`
1271
969
  }, null), [[he, d.value && g.value]])]
1272
- }), r("div", {
1273
- ref: C,
970
+ }), u("div", {
971
+ ref: N,
1274
972
  tabindex: -1,
1275
- class: [`${o}-wrap`, `${c.value}`],
1276
- onClick: (I) => e.onHideOnClickModal && ce(I)
1277
- }, [r(ge, pe(m, {
1278
- onAfterLeave: () => se()
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()
1279
977
  }), {
1280
- default: () => [we(r("div", {
978
+ default: () => [me(u("div", {
1281
979
  role: "dialog",
1282
- class: `${o} ${c.value}`
1283
- }, [r("div", {
1284
- class: `${o}-content ${c.value}`
1285
- }, [r("div", {
1286
- class: `${o}-body ${c.value}`
1287
- }, [r("div", {
1288
- class: `${o}-img-wrapper ${c.value}`,
1289
- style: {
1290
- transform: `translate3d(${p.x}px, ${p.y}px, 0)`
1291
- }
1292
- }, [r("img", {
1293
- onMousedown: Ze,
1294
- onDblclick: ke,
1295
- ref: P,
1296
- class: `${o}-img ${c.value}`,
1297
- src: Q.value,
1298
- onLoad: () => ue(),
1299
- onError: (I) => q(I),
980
+ class: `${t} ${c.value}`
981
+ }, [u("div", {
982
+ class: `${t}-content ${c.value}`
983
+ }, [u("div", {
984
+ class: `${t}-body ${c.value}`
985
+ }, [u("div", {
986
+ class: `${t}-img-wrapper ${c.value}`
987
+ }, [u("img", {
988
+ ref: a,
989
+ class: `${t}-img ${c.value}`,
990
+ src: W.value,
991
+ onLoad: () => Ge(),
992
+ onError: (R) => Ve(R),
1300
993
  style: {
1301
- transform: `scale3d(${O.x * u.value}, ${O.y * u.value}, 1) rotate(${M.value}deg)`
1302
- }
994
+ 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
+ },
997
+ onWheel: T,
998
+ onMousedown: $,
999
+ onDblclick: tt,
1000
+ onTouchstart: I,
1001
+ onTouchmove: B,
1002
+ onTouchend: k,
1003
+ onTouchcancel: k
1303
1004
  }, null)])])])]), [[he, d.value && g.value]])]
1304
1005
  })])])])]
1305
- }), d.value && g.value && r(Ot, {
1006
+ }), d.value && g.value && u(Xt, {
1306
1007
  open: d.value && g.value,
1307
1008
  hashId: c.value,
1308
- count: e.previewUrls.length,
1309
- current: v.value,
1009
+ count: e.urls.length,
1010
+ current: O.value,
1310
1011
  zIndex: e.zIndex + 1,
1311
1012
  getContainer: e.getContainer,
1312
- prefixCls: o,
1313
- icons: gt(T, Me.map(({
1314
- type: I
1315
- }) => I)),
1316
- tools: Me,
1013
+ prefixCls: t,
1014
+ icons: Pe(ne, Ie.map(({
1015
+ type: R
1016
+ }) => R)),
1017
+ tools: Ie,
1317
1018
  infinite: e.infinite,
1318
- countRender: ct(l, e, "countRenders"),
1319
- showSwitch: k.value,
1320
- showProgress: G.value,
1321
- onClose: x,
1322
- onActive: (I) => I > 0 ? ee() : J()
1019
+ countRender: vt(l, e, "countRenders"),
1020
+ showSwitch: v.value,
1021
+ showProgress: A.value,
1022
+ onClose: ce,
1023
+ onActive: (R) => R > 0 ? xe() : Ce()
1323
1024
  }, null)]));
1324
1025
  };
1325
1026
  }
1326
- }), me = {
1027
+ }), ie = {
1327
1028
  width: "100%",
1328
1029
  height: "100%"
1329
- }, Ft = () => ({
1030
+ }, Gt = () => ({
1330
1031
  position: "absolute",
1331
1032
  inset: 0,
1332
1033
  display: "flex",
@@ -1334,21 +1035,29 @@ const D = {
1334
1035
  justifyContent: "center",
1335
1036
  cursor: "pointer",
1336
1037
  opacity: 0
1337
- }), Bt = (e) => ({
1038
+ }), Vt = (e) => ({
1039
+ position: e || "absolute",
1040
+ inset: 0
1041
+ }), Ut = (e) => ({
1338
1042
  [e.componentCls]: {
1339
1043
  display: "inline-block",
1340
1044
  position: "relative",
1341
1045
  overflow: "hidden",
1342
1046
  "&-inner": {
1343
- ...me,
1047
+ ...ie,
1344
1048
  verticalAlign: "top",
1345
1049
  opacity: 1,
1346
1050
  [`&${e.componentCls}-inner-preview`]: {
1347
- userSelect: "none"
1051
+ userSelect: "none",
1052
+ cursor: "pointer"
1348
1053
  }
1349
1054
  },
1055
+ "&-wrapper": {
1056
+ ...ie,
1057
+ ...Vt()
1058
+ },
1350
1059
  "&-placeholder": {
1351
- ...me,
1060
+ ...ie,
1352
1061
  backgroundColor: e.colorBgContainerDisabled,
1353
1062
  backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
1354
1063
  backgroundRepeat: "no-repeat",
@@ -1356,161 +1065,136 @@ const D = {
1356
1065
  backgroundSize: "30%"
1357
1066
  },
1358
1067
  "&-error": {
1359
- ...me,
1068
+ ...ie,
1360
1069
  display: "flex",
1361
1070
  alignItems: "center",
1362
1071
  justifyContent: "center",
1363
1072
  color: e.colorText,
1364
1073
  backgroundColor: e.colorBgContainerDisabled
1365
1074
  },
1366
- "&-preview": Ft()
1075
+ "&-preview": Gt()
1367
1076
  }
1368
- }), Ht = (e) => e && e.nodeType === Node.ELEMENT_NODE;
1369
- let $e = "";
1370
- const jt = [...Ke, "fallback", "placeholder"], le = /* @__PURE__ */ ye({
1371
- props: je,
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,
1372
1081
  name: "GImage",
1373
- emits: ["error", "click", "load"],
1082
+ inheritAttrs: !1,
1083
+ emits: {
1084
+ click: () => !0,
1085
+ load: (e) => !0,
1086
+ error: (e) => !0
1087
+ },
1374
1088
  slots: Object,
1375
1089
  setup(e, {
1376
- slots: t,
1377
- emit: i,
1090
+ slots: n,
1091
+ emit: o,
1378
1092
  attrs: l
1379
1093
  }) {
1380
- const o = Ue({
1094
+ const t = q && "loading" in HTMLImageElement.prototype, s = De({
1381
1095
  suffixCls: "image"
1382
1096
  }), {
1383
- wrapSSR: f,
1384
- hashId: c
1385
- } = st("Image", [Bt], o), d = N(), E = N(""), g = N(!1), h = N(!0), C = N(!1), v = N(null), u = N();
1386
- let M, w;
1387
- const O = y(() => !ie && e.fit ? {
1388
- "object-fit": e.fit
1389
- } : {}), p = y(() => {
1097
+ wrapSSR: c,
1098
+ hashId: h
1099
+ } = dt("Image", [Ut], s), y = L(), d = L(), g = L(!1), m = L(!0), w = L(!1), C = L(), a = L();
1100
+ let i, p;
1101
+ const f = b(() => e.loading === "eager" ? !1 : !t && e.loading === "lazy" || e.lazy), S = b(() => q && e.fit ? {
1102
+ objectFit: e.fit
1103
+ } : {}), x = b(() => typeof e.preview == "object" ? e.preview : {}), $ = b(() => !!e.preview), T = b(() => {
1390
1104
  const {
1391
- previewUrls: s
1392
- } = e.preview;
1393
- return _e(s) && s.length > 0 || e.showPreview;
1394
- }), L = y(() => {
1395
- const {
1396
- previewUrls: s = [],
1397
- current: S = 0
1398
- } = e.preview;
1399
- if (Ee(S)) return s.length >= S ? S : 0;
1400
- const x = s.indexOf(e.src);
1401
- return x >= 0 ? x : 0;
1402
- }), K = (s) => {
1403
- E.value = e.src, h.value = !1, g.value = !1, i("load", s);
1404
- }, P = (s) => {
1405
- h.value = !1, g.value = !0, i("error", s);
1406
- }, A = () => {
1407
- if (ie) return;
1408
- h.value = !0, g.value = !1;
1409
- const s = new Image();
1410
- s.onload = (S) => K(S), s.onerror = P, Object.keys(l || {}).forEach((S) => {
1411
- if (S.toLowerCase() === "onload") return;
1412
- const x = (l || {})[S];
1413
- s.setAttribute(S, x);
1414
- }), s.src = e.src;
1415
- }, R = mt(Q, 200), z = () => {
1416
- ie || !u.value || !R || (M(), u.value = void 0);
1105
+ urls: v = [],
1106
+ current: A = 0
1107
+ } = x.value;
1108
+ if (Re(A)) return v.length >= A ? A : 0;
1109
+ const E = v.indexOf(e.src);
1110
+ 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);
1417
1113
  };
1418
- function Q() {
1419
- ut(v.value, u.value) && (A(), z());
1114
+ function k(v) {
1115
+ m.value = !1, g.value = !1, o("load", v);
1116
+ }
1117
+ function N(v) {
1118
+ m.value = !1, g.value = !0, o("error", v);
1420
1119
  }
1421
- const U = async () => {
1422
- if (ie) return;
1423
- await ot();
1120
+ function O() {
1121
+ mt(C.value, a.value) && (B(), W());
1122
+ }
1123
+ const P = pt(O, 200, !0);
1124
+ async function X() {
1125
+ if (!q) return;
1126
+ await st();
1424
1127
  const {
1425
- scrollContainer: s
1128
+ scrollContainer: v
1426
1129
  } = e;
1427
- Ht(s) ? u.value = s : ft(s) && s !== "" ? u.value = document.querySelector(s) ?? void 0 : v.value && (u.value = vt(v.value)), u.value && (M = Le(u, "scroll", R), setTimeout(() => Q(), 200));
1428
- }, W = (s) => {
1429
- if (s.ctrlKey) {
1430
- if (s.deltaY < 0)
1431
- return s.preventDefault(), !1;
1432
- if (s.deltaY > 0)
1433
- return s.preventDefault(), !1;
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));
1131
+ }
1132
+ function W() {
1133
+ !q || !a.value || !P || (i == null || i(), a.value = void 0);
1134
+ }
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;
1434
1141
  }
1435
- }, b = () => {
1436
- p.value && (w = Le("wheel", W, {
1142
+ }
1143
+ const j = () => {
1144
+ o("click"), !(m.value || g.value) && $.value && (p = $e("wheel", Y, {
1437
1145
  passive: !1
1438
- }), $e = document.body.style.overflow, document.body.style.overflow = "hidden", C.value = !0);
1439
- }, k = () => {
1440
- w == null || w(), document.body.style.overflow = $e, C.value = !1;
1146
+ }), Ae = document.body.style.overflow, document.body.style.overflow = "hidden", w.value = !0);
1147
+ }, D = () => {
1148
+ p == null || p(), document.body.style.overflow = Ae, w.value = !1;
1441
1149
  };
1442
- H(() => e.src, () => {
1443
- e.lazy ? (h.value = !0, g.value = !1, z(), U()) : A();
1444
- }), tt(() => {
1445
- var s, S;
1446
- p.value && C.value ? (s = d.value) == null || s.setOpen(!0) : (S = d.value) == null || S.setOpen(!1);
1447
- });
1448
- const G = (s) => Ee(s) ? s + "px" : s;
1449
- return it(() => {
1450
- e.lazy ? U() : A();
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();
1451
1157
  }), () => {
1452
- var X;
1453
- const {
1454
- crossorigin: s,
1455
- decoding: S,
1456
- alt: x,
1457
- sizes: se,
1458
- srcset: ce,
1459
- usemap: ue,
1460
- class: q,
1461
- style: J = {}
1462
- } = l, ee = {
1463
- crossorigin: s,
1464
- decoding: S,
1465
- alt: x,
1466
- sizes: se,
1467
- srcset: ce,
1468
- usemap: ue,
1469
- style: {
1470
- ...O.value,
1471
- height: e.height ? G(e.height) : void 0
1472
- }
1473
- }, _ = dt(jt, t, e, {
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, {
1474
1159
  render: !0
1475
1160
  });
1476
- return f(r("div", {
1161
+ return c(u("div", ae({
1477
1162
  class: {
1478
- [`${c.value}`]: !0,
1479
- [`${o}`]: !0,
1480
- [`${q}`]: !!q
1481
- },
1482
- ref: (de) => v.value = de,
1483
- style: {
1484
- width: e.width ? G(e.width) : void 0,
1485
- height: e.height ? G(e.height) : void 0,
1486
- display: e.lazy ? "block" : void 0,
1487
- ...J
1163
+ [`${h.value}`]: !0,
1164
+ [`${s}`]: !0,
1165
+ [`${l.class}`]: !!l.class
1488
1166
  },
1489
- onClick: () => {
1490
- i("click");
1491
- }
1492
- }, [h.value ? _.placeholder || r("div", {
1493
- class: `${o}-placeholder ${c.value}`
1494
- }, null) : g.value ? _.fallback || r("div", {
1495
- class: `${o}-error ${c.value}`
1496
- }, [nt("加载失败")]) : E.value && r("img", pe(ee, {
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, {
1172
+ src: d.value,
1173
+ loading: e.loading,
1174
+ style: S.value,
1497
1175
  class: {
1498
- [`${c.value}`]: !0,
1499
- [`${e.imageClassName}`]: !!e.imageClassName,
1500
- [`${o}-inner`]: !0,
1501
- [`${o}-inner-preview`]: p.value
1176
+ [`${h.value}`]: !0,
1177
+ [`${s}-placeholder`]: m.value,
1178
+ [`${s}-inner`]: !0,
1179
+ [`${s}-inner-preview`]: $.value
1502
1180
  },
1503
- alt: e.alt,
1504
- src: E.value
1505
- }), null), p.value && r("div", {
1506
- class: `${o}-preview ${c.value}`,
1507
- onClick: () => b()
1508
- }, null), p.value && r(_t, pe({
1509
- ref: d
1510
- }, e.preview, wt(_, Ke), {
1511
- previewUrls: ((X = e.preview) == null ? void 0 : X.previewUrls) || [e.src],
1512
- current: L.value,
1513
- onClose: () => k()
1181
+ crossorigin: e.crossorigin,
1182
+ width: M.value,
1183
+ height: I.value,
1184
+ onClick: j,
1185
+ onLoad: k,
1186
+ onError: N
1187
+ }), 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({
1193
+ ref: y
1194
+ }, x.value, xt(E, ke), {
1195
+ urls: x.value.urls || [e.src],
1196
+ current: T.value,
1197
+ onClose: () => D()
1514
1198
  }), null)]));
1515
1199
  };
1516
1200
  }
@@ -1520,7 +1204,7 @@ le.install = (e) => (e.component(le.name, le), e);
1520
1204
  export {
1521
1205
  le as GImage,
1522
1206
  _t as GImagePreview,
1523
- V as baseProps,
1207
+ J as baseProps,
1524
1208
  le as default,
1525
- je as imageProps
1209
+ Ze as imageProps
1526
1210
  };