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