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