@gx-design-vue/image 0.2.0-alpha.4 → 0.2.0-alpha.5
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 +2 -2
- package/dist/ImagePreview.js +23 -14
- package/dist/g-image.esm.js +348 -527
- package/dist/g-image.js +1 -1
- package/package.json +6 -6
package/dist/g-image.esm.js
CHANGED
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, Transition as n, computed as r, createVNode as i,
|
|
2
|
-
import {
|
|
3
|
-
import { proGenStyleHooks as
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createVNode as i, defineComponent as a, isVNode as o, mergeDefaults as s, mergeProps as c, nextTick as l, onMounted as u, onScopeDispose as d, onUnmounted as f, ref as p, toRef as m, unref as h, watch as g, watchEffect as _ } from "vue";
|
|
2
|
+
import { GIcon as v } from "@gx-design-vue/icon";
|
|
3
|
+
import { proGenStyleHooks as y, unit as b } from "@gx-design-vue/pro-provider";
|
|
4
|
+
import { isClient as x, useEventListener as S, useScrollLock as C, useThrottleFn as w, useWindowSize as T } from "@vueuse/core";
|
|
5
|
+
import { useBaseConfig as ee } from "antdv-next/config-provider/context";
|
|
6
|
+
import te from "antdv-next/config-provider/hooks/useCSSVarCls";
|
|
7
|
+
import { message as E } from "antdv-next";
|
|
7
8
|
//#region ../pro-utils/dist/is/type.js
|
|
8
|
-
function
|
|
9
|
+
function D(e, t) {
|
|
9
10
|
return Object.prototype.toString.call(e) === `[object ${t}]`;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function O(e) {
|
|
12
13
|
return typeof e == "boolean";
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function k(e) {
|
|
15
16
|
return typeof e == "number";
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function A(e) {
|
|
18
19
|
return Array.isArray === void 0 ? Object.prototype.toString.call(e) === "[object Array]" : Array.isArray(e);
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
return e !== null &&
|
|
21
|
+
function j(e) {
|
|
22
|
+
return e !== null && D(e, "Object");
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function M(e) {
|
|
24
25
|
return typeof e == "string";
|
|
25
26
|
}
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region ../pro-utils/dist/is/server.js
|
|
28
|
-
var
|
|
29
|
-
typeof window < "u" && "requestAnimationFrame" in window && (
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
|
|
29
|
+
var N = typeof window > "u", P = (e) => setTimeout(e, 16), F = (e) => clearTimeout(e);
|
|
30
|
+
typeof window < "u" && "requestAnimationFrame" in window && (P = (e) => window.requestAnimationFrame(e), F = (e) => window.cancelAnimationFrame(e));
|
|
31
|
+
var I = 0, L = /* @__PURE__ */ new Map();
|
|
32
|
+
function R(e) {
|
|
33
|
+
L.delete(e);
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
let n =
|
|
35
|
+
function z(e, t = 1) {
|
|
36
|
+
I += 1;
|
|
37
|
+
let n = I;
|
|
37
38
|
function r(t) {
|
|
38
|
-
if (t === 0)
|
|
39
|
+
if (t === 0) R(n), e();
|
|
39
40
|
else {
|
|
40
|
-
let e =
|
|
41
|
+
let e = P(() => {
|
|
41
42
|
r(t - 1);
|
|
42
43
|
});
|
|
43
|
-
|
|
44
|
+
L.set(n, e);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
return r(t), n;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
-
let t =
|
|
50
|
-
return
|
|
49
|
+
z.cancel = (e) => {
|
|
50
|
+
let t = L.get(e);
|
|
51
|
+
return R(t), F(t);
|
|
51
52
|
};
|
|
52
53
|
//#endregion
|
|
53
54
|
//#region ../pro-utils/dist/dom/scroll.js
|
|
54
|
-
function
|
|
55
|
+
function ne(e) {
|
|
55
56
|
return e.replace(/[-_](.)/g, (e, t) => t.toUpperCase());
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
if (
|
|
59
|
-
t =
|
|
58
|
+
function B(e, t) {
|
|
59
|
+
if (N || !e || !t) return "";
|
|
60
|
+
t = ne(t), t === "float" && (t = "cssFloat");
|
|
60
61
|
try {
|
|
61
62
|
let n = e.style[t];
|
|
62
63
|
if (n) return n;
|
|
@@ -66,11 +67,11 @@ function G(e, t) {
|
|
|
66
67
|
return e.style[t];
|
|
67
68
|
}
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
if (!
|
|
70
|
+
function V(e, t) {
|
|
71
|
+
if (!N) return (t == null ? B(e, "overflow") : t ? B(e, "overflow-y") : B(e, "overflow-x")).match(/(scroll|auto|overlay)/);
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
-
if (
|
|
73
|
+
function H(e, t) {
|
|
74
|
+
if (N) return;
|
|
74
75
|
let n = e;
|
|
75
76
|
for (; n;) {
|
|
76
77
|
if ([
|
|
@@ -78,274 +79,85 @@ function me(e, t) {
|
|
|
78
79
|
document,
|
|
79
80
|
document.documentElement
|
|
80
81
|
].includes(n)) return window;
|
|
81
|
-
if (
|
|
82
|
+
if (V(n, t)) return n;
|
|
82
83
|
n = n.parentNode;
|
|
83
84
|
}
|
|
84
85
|
return n;
|
|
85
86
|
}
|
|
86
87
|
//#endregion
|
|
87
88
|
//#region ../pro-utils/dist/object/classNames.js
|
|
88
|
-
function
|
|
89
|
+
function U(...e) {
|
|
89
90
|
let t = [];
|
|
90
91
|
for (let n = 0; n < e.length; n++) {
|
|
91
92
|
let r = e[n];
|
|
92
93
|
if (r) {
|
|
93
|
-
if (
|
|
94
|
-
else if (
|
|
95
|
-
let n =
|
|
94
|
+
if (M(r)) t.push(r);
|
|
95
|
+
else if (A(r)) for (let e = 0; e < r.length; e++) {
|
|
96
|
+
let n = U(r[e]);
|
|
96
97
|
n && t.push(n);
|
|
97
98
|
}
|
|
98
|
-
else if (
|
|
99
|
+
else if (j(r)) for (let e in r) r[e] && t.push(e);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
return t.filter((e) => e).join(" ");
|
|
102
103
|
}
|
|
103
104
|
//#endregion
|
|
104
105
|
//#region ../pro-utils/dist/slots/index.js
|
|
105
|
-
function
|
|
106
|
+
function W({ vnode: e, defaultVNode: t }, ...n) {
|
|
106
107
|
return e === !1 ? null : typeof e == "function" ? e?.(...n) : e || t;
|
|
107
108
|
}
|
|
108
|
-
function
|
|
109
|
-
return e === !1 ? !1 : e === !0 ? t ?? n :
|
|
109
|
+
function G({ value: e, slotsValue: t, defaultVNode: n, render: r }) {
|
|
110
|
+
return e === !1 ? !1 : e === !0 ? t ?? n : j(e) && r ? o(e) ? e : t : e || t;
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
-
let { slots: n, key: r = "default", render: i, props: a, defaultChildren: o } = e, s = a[r], c = n?.[r], l = typeof o == "function" ? o?.() : o, u =
|
|
112
|
+
function re(e, ...t) {
|
|
113
|
+
let { slots: n, key: r = "default", render: i, props: a, defaultChildren: o } = e, s = a[r], c = n?.[r], l = typeof o == "function" ? o?.() : o, u = G({
|
|
113
114
|
value: s,
|
|
114
115
|
slotsValue: c,
|
|
115
116
|
defaultVNode: l,
|
|
116
117
|
render: i
|
|
117
118
|
});
|
|
118
|
-
return u === !1 ? !1 : i ?
|
|
119
|
+
return u === !1 ? !1 : i ? W({
|
|
119
120
|
vnode: u,
|
|
120
121
|
defaultVNode: l
|
|
121
122
|
}, ...t) : u;
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
-
let { slots: n, key: r = "default", props: i, defaultChildren: a } = e, o = i[r], s = n?.[r]?.(...t), c = typeof a == "function" ? a?.() : a, l =
|
|
124
|
+
function K(e, ...t) {
|
|
125
|
+
let { slots: n, key: r = "default", props: i, defaultChildren: a } = e, o = i[r], s = n?.[r]?.(...t), c = typeof a == "function" ? a?.() : a, l = G({
|
|
125
126
|
value: o,
|
|
126
127
|
slotsValue: s,
|
|
127
128
|
defaultVNode: c,
|
|
128
129
|
render: !0
|
|
129
130
|
});
|
|
130
|
-
return l === !1 ? !1 :
|
|
131
|
+
return l === !1 ? !1 : W({
|
|
131
132
|
vnode: l,
|
|
132
133
|
defaultVNode: c
|
|
133
134
|
}, ...t);
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function ie(e, ...t) {
|
|
136
137
|
let { slots: n, props: r, keys: i, render: a, defaultVNodes: o } = e, s = {};
|
|
137
138
|
return i.forEach((e, i) => {
|
|
138
|
-
let c = o ? o[i] : null, l = a ?
|
|
139
|
+
let c = o ? o[i] : null, l = a ? K({
|
|
139
140
|
slots: n,
|
|
140
141
|
props: r,
|
|
141
142
|
key: e,
|
|
142
143
|
defaultChildren: c
|
|
143
|
-
}, ...t) :
|
|
144
|
+
}, ...t) : re({
|
|
144
145
|
slots: n,
|
|
145
146
|
props: r,
|
|
146
147
|
key: e,
|
|
147
148
|
render: !1,
|
|
148
149
|
defaultChildren: c
|
|
149
150
|
}, ...t);
|
|
150
|
-
(
|
|
151
|
+
(O(l) || l) && (s[e] = l);
|
|
151
152
|
}), s;
|
|
152
153
|
}
|
|
153
154
|
//#endregion
|
|
154
|
-
//#region ../../node_modules/.pnpm/@vueuse+shared@14.3.0_vue@3.5.27_typescript@6.0.3_/node_modules/@vueuse/shared/dist/index.js
|
|
155
|
-
function ye(e, t) {
|
|
156
|
-
return c() ? (_(e, t), !0) : !1;
|
|
157
|
-
}
|
|
158
|
-
var J = /* @__PURE__ */ new WeakMap(), be = (...e) => {
|
|
159
|
-
let t = e[0], n = s()?.proxy ?? c();
|
|
160
|
-
if (n == null && !l()) throw Error("injectLocal must be called in setup");
|
|
161
|
-
return n && J.has(n) && t in J.get(n) ? J.get(n)[t] : u(...e);
|
|
162
|
-
}, Y = typeof window < "u" && typeof document < "u";
|
|
163
|
-
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
164
|
-
var xe = Object.prototype.toString, Se = (e) => xe.call(e) === "[object Object]", Ce = () => {}, we = /* @__PURE__ */ Te();
|
|
165
|
-
function Te() {
|
|
166
|
-
var e, t;
|
|
167
|
-
return Y && !!(!((e = window) == null || (e = e.navigator) == null) && e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window) == null || (t = t.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
|
|
168
|
-
}
|
|
169
|
-
function Ee(...e) {
|
|
170
|
-
if (e.length !== 1) return S(...e);
|
|
171
|
-
let t = e[0];
|
|
172
|
-
return typeof t == "function" ? y(a(() => ({
|
|
173
|
-
get: t,
|
|
174
|
-
set: Ce
|
|
175
|
-
}))) : b(t);
|
|
176
|
-
}
|
|
177
|
-
function De(e, t) {
|
|
178
|
-
function n(...n) {
|
|
179
|
-
return new Promise((r, i) => {
|
|
180
|
-
Promise.resolve(e(() => t.apply(this, n), {
|
|
181
|
-
fn: t,
|
|
182
|
-
thisArg: this,
|
|
183
|
-
args: n
|
|
184
|
-
})).then(r).catch(i);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
return n;
|
|
188
|
-
}
|
|
189
|
-
function Oe(...e) {
|
|
190
|
-
let t = 0, n, r = !0, i = Ce, a, o, s, c, l;
|
|
191
|
-
!d(e[0]) && typeof e[0] == "object" ? {delay: o, trailing: s = !0, leading: c = !0, rejectOnCancel: l = !1} = e[0] : [o, s = !0, c = !0, l = !1] = e;
|
|
192
|
-
let u = () => {
|
|
193
|
-
n && (clearTimeout(n), n = void 0, i(), i = Ce);
|
|
194
|
-
};
|
|
195
|
-
return (e) => {
|
|
196
|
-
let d = C(o), f = Date.now() - t, p = () => a = e();
|
|
197
|
-
return u(), d <= 0 ? (t = Date.now(), p()) : (f > d ? (t = Date.now(), (c || !r) && p()) : s && (a = new Promise((e, a) => {
|
|
198
|
-
i = l ? a : e, n = setTimeout(() => {
|
|
199
|
-
t = Date.now(), r = !0, e(p()), u();
|
|
200
|
-
}, Math.max(0, d - f));
|
|
201
|
-
})), !c && !n && (n = setTimeout(() => r = !0, d)), r = !1, a);
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
function ke(e) {
|
|
205
|
-
return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
|
|
206
|
-
}
|
|
207
|
-
function Ae(e) {
|
|
208
|
-
return Array.isArray(e) ? e : [e];
|
|
209
|
-
}
|
|
210
|
-
function je(e) {
|
|
211
|
-
return e || s();
|
|
212
|
-
}
|
|
213
|
-
function Me(e, t = 200, n = !1, r = !0, i = !1) {
|
|
214
|
-
return De(Oe(t, n, r, i), e);
|
|
215
|
-
}
|
|
216
|
-
function Ne(e, t = !0, n) {
|
|
217
|
-
je(n) ? g(e, n) : t ? e() : h(e);
|
|
218
|
-
}
|
|
219
|
-
function Pe(e, t, n) {
|
|
220
|
-
return T(e, t, {
|
|
221
|
-
...n,
|
|
222
|
-
immediate: !0
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
//#endregion
|
|
226
|
-
//#region ../../node_modules/.pnpm/@vueuse+core@14.3.0_vue@3.5.27_typescript@6.0.3_/node_modules/@vueuse/core/dist/index.js
|
|
227
|
-
var Fe = Y ? window : void 0;
|
|
228
|
-
Y && window.document, Y && window.navigator, Y && window.location;
|
|
229
|
-
function Ie(e) {
|
|
230
|
-
let t = C(e);
|
|
231
|
-
return t?.$el ?? t;
|
|
232
|
-
}
|
|
233
|
-
function X(...e) {
|
|
234
|
-
let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), n = r(() => {
|
|
235
|
-
let t = Ae(C(e[0])).filter((e) => e != null);
|
|
236
|
-
return t.every((e) => typeof e != "string") ? t : void 0;
|
|
237
|
-
});
|
|
238
|
-
return Pe(() => [
|
|
239
|
-
n.value?.map((e) => Ie(e)) ?? [Fe].filter((e) => e != null),
|
|
240
|
-
Ae(C(n.value ? e[1] : e[0])),
|
|
241
|
-
Ae(w(n.value ? e[2] : e[1])),
|
|
242
|
-
C(n.value ? e[3] : e[2])
|
|
243
|
-
], ([e, n, r, i], a, o) => {
|
|
244
|
-
if (!e?.length || !n?.length || !r?.length) return;
|
|
245
|
-
let s = Se(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
|
|
246
|
-
o(() => {
|
|
247
|
-
c.forEach((e) => e());
|
|
248
|
-
});
|
|
249
|
-
}, { flush: "post" });
|
|
250
|
-
}
|
|
251
|
-
function Le() {
|
|
252
|
-
let e = x(!1), t = s();
|
|
253
|
-
return t && g(() => {
|
|
254
|
-
e.value = !0;
|
|
255
|
-
}, t), e;
|
|
256
|
-
}
|
|
257
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
258
|
-
function Re(e) {
|
|
259
|
-
let t = Le();
|
|
260
|
-
return r(() => (t.value, !!e()));
|
|
261
|
-
}
|
|
262
|
-
var ze = Symbol("vueuse-ssr-width");
|
|
263
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
264
|
-
function Be() {
|
|
265
|
-
let e = l() ? be(ze, null) : null;
|
|
266
|
-
return typeof e == "number" ? e : void 0;
|
|
267
|
-
}
|
|
268
|
-
function Ve(e, t = {}) {
|
|
269
|
-
let { window: n = Fe, ssrWidth: i = /* @__PURE__ */ Be() } = t, a = /* @__PURE__ */ Re(() => n && "matchMedia" in n && typeof n.matchMedia == "function"), o = x(typeof i == "number"), s = x(), c = x(!1);
|
|
270
|
-
return E(() => {
|
|
271
|
-
if (o.value) {
|
|
272
|
-
o.value = !a.value, c.value = C(e).split(",").some((e) => {
|
|
273
|
-
let t = e.includes("not all"), n = e.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), r = e.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), a = !!(n || r);
|
|
274
|
-
return n && a && (a = i >= ke(n[1])), r && a && (a = i <= ke(r[1])), t ? !a : a;
|
|
275
|
-
});
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
a.value && (s.value = n.matchMedia(C(e)), c.value = s.value.matches);
|
|
279
|
-
}), X(s, "change", (e) => {
|
|
280
|
-
c.value = e.matches;
|
|
281
|
-
}, { passive: !0 }), r(() => c.value);
|
|
282
|
-
}
|
|
283
|
-
function He(e) {
|
|
284
|
-
return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
|
|
285
|
-
}
|
|
286
|
-
function Ue(e) {
|
|
287
|
-
let t = window.getComputedStyle(e);
|
|
288
|
-
if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && e.clientWidth < e.scrollWidth || t.overflowY === "auto" && e.clientHeight < e.scrollHeight) return !0;
|
|
289
|
-
{
|
|
290
|
-
let t = e.parentNode;
|
|
291
|
-
return !t || t.tagName === "BODY" ? !1 : Ue(t);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
function We(e) {
|
|
295
|
-
let t = e || window.event, n = t.target;
|
|
296
|
-
return Ue(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
|
|
297
|
-
}
|
|
298
|
-
var Ge = /* @__PURE__ */ new WeakMap();
|
|
299
|
-
function Ke(e, t = !1) {
|
|
300
|
-
let n = x(t), i = null, a = "";
|
|
301
|
-
T(Ee(e), (e) => {
|
|
302
|
-
let t = He(C(e));
|
|
303
|
-
if (t) {
|
|
304
|
-
let e = t;
|
|
305
|
-
if (Ge.get(e) || Ge.set(e, e.style.overflow), e.style.overflow !== "hidden" && (a = e.style.overflow), e.style.overflow === "hidden") return n.value = !0;
|
|
306
|
-
if (n.value) return e.style.overflow = "hidden";
|
|
307
|
-
}
|
|
308
|
-
}, { immediate: !0 });
|
|
309
|
-
let o = () => {
|
|
310
|
-
let t = He(C(e));
|
|
311
|
-
!t || n.value || (we && (i = X(t, "touchmove", (e) => {
|
|
312
|
-
We(e);
|
|
313
|
-
}, { passive: !1 })), t.style.overflow = "hidden", n.value = !0);
|
|
314
|
-
}, s = () => {
|
|
315
|
-
let t = He(C(e));
|
|
316
|
-
!t || !n.value || (we && i?.(), t.style.overflow = a, Ge.delete(t), n.value = !1);
|
|
317
|
-
};
|
|
318
|
-
return ye(s), r({
|
|
319
|
-
get() {
|
|
320
|
-
return n.value;
|
|
321
|
-
},
|
|
322
|
-
set(e) {
|
|
323
|
-
e ? o() : s();
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
function qe(e = {}) {
|
|
328
|
-
let { window: t = Fe, initialWidth: n = Infinity, initialHeight: r = Infinity, listenOrientation: i = !0, includeScrollbar: a = !0, type: o = "inner" } = e, s = x(n), c = x(r), l = () => {
|
|
329
|
-
if (t) if (o === "outer") s.value = t.outerWidth, c.value = t.outerHeight;
|
|
330
|
-
else if (o === "visual" && t.visualViewport) {
|
|
331
|
-
let { width: e, height: n, scale: r } = t.visualViewport;
|
|
332
|
-
s.value = Math.round(e * r), c.value = Math.round(n * r);
|
|
333
|
-
} else a ? (s.value = t.innerWidth, c.value = t.innerHeight) : (s.value = t.document.documentElement.clientWidth, c.value = t.document.documentElement.clientHeight);
|
|
334
|
-
};
|
|
335
|
-
l(), Ne(l);
|
|
336
|
-
let u = { passive: !0 };
|
|
337
|
-
return X("resize", l, u), t && o === "visual" && t.visualViewport && X(t.visualViewport, "resize", l, u), i && T(Ve("(orientation: portrait)"), () => l()), {
|
|
338
|
-
width: s,
|
|
339
|
-
height: c
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
//#endregion
|
|
343
155
|
//#region src/hooks/useImagePreview.ts
|
|
344
|
-
function
|
|
345
|
-
let { canPreview: t } = e, n =
|
|
346
|
-
return
|
|
156
|
+
function ae(e) {
|
|
157
|
+
let { canPreview: t } = e, n = p(!1), r = p(null), i = C(document.body, !1), a;
|
|
158
|
+
return d(() => {
|
|
347
159
|
a !== void 0 && (window.cancelAnimationFrame(a), a = void 0), i.value = !1;
|
|
348
|
-
}),
|
|
160
|
+
}), S("wheel", (e) => {
|
|
349
161
|
n.value && e.ctrlKey && e.preventDefault();
|
|
350
162
|
}, { passive: !1 }), {
|
|
351
163
|
showViewer: n,
|
|
@@ -365,12 +177,12 @@ function Je(e) {
|
|
|
365
177
|
}
|
|
366
178
|
//#endregion
|
|
367
179
|
//#region ../pro-hooks/dist/core/useIsIos.js
|
|
368
|
-
var
|
|
369
|
-
typeof window > "u" ||
|
|
180
|
+
var q = (typeof window > "u" ? !1 : /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window.MSStream;
|
|
181
|
+
typeof window > "u" || q || window.safari;
|
|
370
182
|
//#endregion
|
|
371
183
|
//#region ../pro-hooks/dist/core/useState.js
|
|
372
|
-
function
|
|
373
|
-
let t =
|
|
184
|
+
function J(e) {
|
|
185
|
+
let t = p(typeof e == "function" ? e() : e);
|
|
374
186
|
function n(e) {
|
|
375
187
|
t.value = e;
|
|
376
188
|
}
|
|
@@ -378,36 +190,36 @@ function Xe(e) {
|
|
|
378
190
|
}
|
|
379
191
|
//#endregion
|
|
380
192
|
//#region ../pro-hooks/dist/core/useMergedState.js
|
|
381
|
-
function
|
|
382
|
-
let { defaultValue: n, value: r =
|
|
383
|
-
r.value !== void 0 && (i =
|
|
384
|
-
let a =
|
|
193
|
+
function oe(e, t) {
|
|
194
|
+
let { defaultValue: n, value: r = p() } = t || {}, i = typeof e == "function" ? e() : e;
|
|
195
|
+
r.value !== void 0 && (i = h(r)), n !== void 0 && (i = typeof n == "function" ? n() : n);
|
|
196
|
+
let a = p(i), o = p(i), [s, c] = J([o.value]), l = _(() => {
|
|
385
197
|
let e = r.value === void 0 ? a.value : r.value;
|
|
386
198
|
t?.postState && (e = t.postState(e, a.value)), o.value = e;
|
|
387
|
-
}), u =
|
|
199
|
+
}), u = g(s, () => {
|
|
388
200
|
let e = s.value[0];
|
|
389
201
|
a.value !== e && t?.onChange?.(a.value, e);
|
|
390
202
|
}, { deep: !0 });
|
|
391
|
-
function
|
|
203
|
+
function f(e) {
|
|
392
204
|
a.value = e;
|
|
393
205
|
}
|
|
394
|
-
function
|
|
395
|
-
|
|
206
|
+
function m(e) {
|
|
207
|
+
f(e), c([o.value]);
|
|
396
208
|
}
|
|
397
|
-
let
|
|
209
|
+
let v = g(r, () => {
|
|
398
210
|
a.value = r.value;
|
|
399
211
|
});
|
|
400
|
-
return
|
|
401
|
-
l(), u(),
|
|
212
|
+
return d(() => {
|
|
213
|
+
l(), u(), v();
|
|
402
214
|
}), [
|
|
403
215
|
o,
|
|
404
|
-
|
|
216
|
+
m,
|
|
405
217
|
a
|
|
406
218
|
];
|
|
407
219
|
}
|
|
408
220
|
//#endregion
|
|
409
221
|
//#region src/hooks/useImageTransform.ts
|
|
410
|
-
var
|
|
222
|
+
var Y = {
|
|
411
223
|
x: 0,
|
|
412
224
|
y: 0,
|
|
413
225
|
rotate: 0,
|
|
@@ -415,15 +227,15 @@ var Qe = {
|
|
|
415
227
|
flipX: !1,
|
|
416
228
|
flipY: !1
|
|
417
229
|
};
|
|
418
|
-
function
|
|
419
|
-
let { imageRef: t, minScale: n, maxScale: r, windowWidth: i, windowHeight: a, onTransform: o } = e, s =
|
|
230
|
+
function se(e) {
|
|
231
|
+
let { imageRef: t, minScale: n, maxScale: r, windowWidth: i, windowHeight: a, onTransform: o } = e, s = p(null), c = p([]), [l, u] = J({ ...Y }), d = (e) => {
|
|
420
232
|
let t = { ...l.value };
|
|
421
|
-
u({ ...
|
|
422
|
-
transform: { ...
|
|
233
|
+
u({ ...Y }), (t.x !== 0 || t.y !== 0 || t.scale !== 1 || t.rotate !== 0 || t.flipX || t.flipY) && o?.({
|
|
234
|
+
transform: { ...Y },
|
|
423
235
|
action: e
|
|
424
236
|
});
|
|
425
237
|
}, f = (e, t) => {
|
|
426
|
-
s.value === null && (c.value = [], s.value =
|
|
238
|
+
s.value === null && (c.value = [], s.value = z(() => {
|
|
427
239
|
let e = { ...l.value };
|
|
428
240
|
for (let t of c.value) e = {
|
|
429
241
|
...e,
|
|
@@ -447,14 +259,14 @@ function $e(e) {
|
|
|
447
259
|
if (!d) return;
|
|
448
260
|
let { width: p, height: m, offsetWidth: h, offsetHeight: g, offsetLeft: _, offsetTop: v } = d, y = e, b = l.value.scale * e;
|
|
449
261
|
b > r.value ? (b = r.value, y = r.value / l.value.scale) : b < n.value && (b = u ? b : n.value, y = b / l.value.scale);
|
|
450
|
-
let x = s ?? i.value / 2, S = c ?? a.value / 2, C = y - 1, w = C * p * .5, T = C * m * .5,
|
|
262
|
+
let x = s ?? i.value / 2, S = c ?? a.value / 2, C = y - 1, w = C * p * .5, T = C * m * .5, ee = C * (x - l.value.x - _), te = C * (S - l.value.y - v), E = l.value.x - (ee - w), D = l.value.y - (te - T);
|
|
451
263
|
if (e < 1 && b === 1) {
|
|
452
264
|
let e = h * b, t = g * b;
|
|
453
|
-
e <= i.value && t <= a.value && (
|
|
265
|
+
e <= i.value && t <= a.value && (E = 0, D = 0);
|
|
454
266
|
}
|
|
455
267
|
f({
|
|
456
|
-
x:
|
|
457
|
-
y:
|
|
268
|
+
x: E,
|
|
269
|
+
y: D,
|
|
458
270
|
scale: b
|
|
459
271
|
}, o);
|
|
460
272
|
}
|
|
@@ -462,7 +274,7 @@ function $e(e) {
|
|
|
462
274
|
}
|
|
463
275
|
//#endregion
|
|
464
276
|
//#region src/hooks/useImageBoundary.ts
|
|
465
|
-
function
|
|
277
|
+
function ce(e, t, n, r) {
|
|
466
278
|
let i = t + n, a = (n - r) / 2;
|
|
467
279
|
if (n > r) {
|
|
468
280
|
if (t > 0) return { [e]: a };
|
|
@@ -470,34 +282,34 @@ function et(e, t, n, r) {
|
|
|
470
282
|
} else if (t < 0 || i > r) return { [e]: t < 0 ? a : -a };
|
|
471
283
|
return {};
|
|
472
284
|
}
|
|
473
|
-
function
|
|
285
|
+
function le(e) {
|
|
474
286
|
let { imageWidth: t, imageHeight: n, imageLeft: r, imageTop: i, windowWidth: a, windowHeight: o } = e;
|
|
475
287
|
return t <= a && n <= o ? {
|
|
476
288
|
x: 0,
|
|
477
289
|
y: 0
|
|
478
290
|
} : t > a || n > o ? {
|
|
479
|
-
...
|
|
480
|
-
...
|
|
291
|
+
...ce("x", r, t, a),
|
|
292
|
+
...ce("y", i, n, o)
|
|
481
293
|
} : null;
|
|
482
294
|
}
|
|
483
295
|
//#endregion
|
|
484
296
|
//#region src/hooks/useMouseEvent.ts
|
|
485
|
-
var
|
|
486
|
-
function
|
|
487
|
-
let { imageRef: t, movable: n, visible: r, scaleStep: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u =
|
|
297
|
+
var ue = 1, de = 2;
|
|
298
|
+
function fe(e) {
|
|
299
|
+
let { imageRef: t, movable: n, visible: r, scaleStep: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u = p(!1), d = p({
|
|
488
300
|
diffX: 0,
|
|
489
301
|
diffY: 0,
|
|
490
302
|
transformX: 0,
|
|
491
303
|
transformY: 0
|
|
492
304
|
});
|
|
493
|
-
return
|
|
305
|
+
return S(window, "mouseup", () => {
|
|
494
306
|
if (!r.value || !u.value) return;
|
|
495
307
|
u.value = !1;
|
|
496
308
|
let { transformX: e, transformY: n } = d.value;
|
|
497
309
|
if (!(a.value.x !== e && a.value.y !== n)) return;
|
|
498
310
|
let i = t.value;
|
|
499
311
|
if (!i) return;
|
|
500
|
-
let s = i.offsetWidth * a.value.scale, f = i.offsetHeight * a.value.scale, { left: p, top: m } = i.getBoundingClientRect(), h = a.value.rotate % 180 != 0, g =
|
|
312
|
+
let s = i.offsetWidth * a.value.scale, f = i.offsetHeight * a.value.scale, { left: p, top: m } = i.getBoundingClientRect(), h = a.value.rotate % 180 != 0, g = le({
|
|
501
313
|
imageWidth: h ? f : s,
|
|
502
314
|
imageHeight: h ? s : f,
|
|
503
315
|
imageLeft: p,
|
|
@@ -506,7 +318,7 @@ function it(e) {
|
|
|
506
318
|
windowHeight: l.value
|
|
507
319
|
});
|
|
508
320
|
g && o({ ...g }, "dragRebound");
|
|
509
|
-
}),
|
|
321
|
+
}), S(window, "mousemove", (e) => {
|
|
510
322
|
!r.value || !u.value || o({
|
|
511
323
|
x: e.pageX - d.value.diffX,
|
|
512
324
|
y: e.pageY - d.value.diffY
|
|
@@ -523,24 +335,24 @@ function it(e) {
|
|
|
523
335
|
},
|
|
524
336
|
onWheel: (e) => {
|
|
525
337
|
if (!r.value || e.deltaY === 0) return;
|
|
526
|
-
let t =
|
|
527
|
-
e.deltaY > 0 && (t =
|
|
338
|
+
let t = ue + Math.min(Math.abs(e.deltaY / 100), de) * i.value;
|
|
339
|
+
e.deltaY > 0 && (t = ue / t), s(t, "wheel", e.clientX, e.clientY);
|
|
528
340
|
}
|
|
529
341
|
};
|
|
530
342
|
}
|
|
531
343
|
//#endregion
|
|
532
344
|
//#region src/hooks/useTouchEvent.ts
|
|
533
|
-
function
|
|
345
|
+
function X(e, t) {
|
|
534
346
|
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
535
347
|
}
|
|
536
|
-
function
|
|
537
|
-
let i =
|
|
348
|
+
function pe(e, t, n, r) {
|
|
349
|
+
let i = X(e, n), a = X(t, r);
|
|
538
350
|
if (i === 0 && a === 0) return [e.x, e.y];
|
|
539
351
|
let o = i / (i + a);
|
|
540
352
|
return [e.x + o * (t.x - e.x), e.y + o * (t.y - e.y)];
|
|
541
353
|
}
|
|
542
|
-
function
|
|
543
|
-
let { imageRef: t, movable: n, visible: r, minScale: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u =
|
|
354
|
+
function me(e) {
|
|
355
|
+
let { imageRef: t, movable: n, visible: r, minScale: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u = p(!1), d = p({
|
|
544
356
|
point1: {
|
|
545
357
|
x: 0,
|
|
546
358
|
y: 0
|
|
@@ -556,7 +368,7 @@ function st(e) {
|
|
|
556
368
|
...e
|
|
557
369
|
};
|
|
558
370
|
};
|
|
559
|
-
return
|
|
371
|
+
return S(window, "touchmove", (e) => {
|
|
560
372
|
r.value && n.value && e.preventDefault();
|
|
561
373
|
}, { passive: !1 }), {
|
|
562
374
|
isTouching: u,
|
|
@@ -591,8 +403,8 @@ function st(e) {
|
|
|
591
403
|
}, i = {
|
|
592
404
|
x: t[1].clientX,
|
|
593
405
|
y: t[1].clientY
|
|
594
|
-
}, [a, o] =
|
|
595
|
-
s(
|
|
406
|
+
}, [a, o] = pe(n, r, e, i);
|
|
407
|
+
s(X(e, i) / X(n, r), "touchZoom", a, o, !0), f({
|
|
596
408
|
point1: e,
|
|
597
409
|
point2: i,
|
|
598
410
|
eventType: "touchZoom"
|
|
@@ -611,7 +423,7 @@ function st(e) {
|
|
|
611
423
|
}, "touchZoom");
|
|
612
424
|
let e = t.value;
|
|
613
425
|
if (!e) return;
|
|
614
|
-
let n = e.offsetWidth * a.value.scale, s = e.offsetHeight * a.value.scale, { left: d, top: p } = e.getBoundingClientRect(), m = a.value.rotate % 180 != 0, h =
|
|
426
|
+
let n = e.offsetWidth * a.value.scale, s = e.offsetHeight * a.value.scale, { left: d, top: p } = e.getBoundingClientRect(), m = a.value.rotate % 180 != 0, h = le({
|
|
615
427
|
imageWidth: m ? s : n,
|
|
616
428
|
imageHeight: m ? n : s,
|
|
617
429
|
imageLeft: d,
|
|
@@ -625,7 +437,7 @@ function st(e) {
|
|
|
625
437
|
}
|
|
626
438
|
//#endregion
|
|
627
439
|
//#region src/style/preview.ts
|
|
628
|
-
function
|
|
440
|
+
function he(e) {
|
|
629
441
|
return {
|
|
630
442
|
zIndexPopup: `calc(${e.zIndexPopupBase} + 80)`,
|
|
631
443
|
previewOperationColor: e.colorTextDescription,
|
|
@@ -635,7 +447,7 @@ function ct(e) {
|
|
|
635
447
|
previewOperationSize: e.fontSizeLG
|
|
636
448
|
};
|
|
637
449
|
}
|
|
638
|
-
var
|
|
450
|
+
var ge = (e) => {
|
|
639
451
|
let t = e.componentCls, { motionEaseOut: n, motionDurationSlow: r, previewOperationSize: i, zIndexPopup: a } = e, o = {
|
|
640
452
|
position: "absolute",
|
|
641
453
|
color: e.previewOperationColor,
|
|
@@ -734,7 +546,7 @@ var lt = (e) => {
|
|
|
734
546
|
padding: e.paddingXXS,
|
|
735
547
|
color: e.previewOperationColor,
|
|
736
548
|
backgroundColor: e.colorBgContainer,
|
|
737
|
-
border: `${
|
|
549
|
+
border: `${b(e.lineWidth)} ${e.lineType} ${e.colorFillTertiary}`,
|
|
738
550
|
borderRadius: e.borderRadiusLG,
|
|
739
551
|
fontSize: i,
|
|
740
552
|
"&-action": {
|
|
@@ -769,7 +581,7 @@ var lt = (e) => {
|
|
|
769
581
|
}
|
|
770
582
|
}
|
|
771
583
|
} };
|
|
772
|
-
},
|
|
584
|
+
}, _e = (e) => {
|
|
773
585
|
let t = e.componentCls, { motionDurationSlow: n, motionEaseOut: r } = e;
|
|
774
586
|
return { [`${t}`]: {
|
|
775
587
|
"&-fade-enter-active, &-fade-leave-active": {
|
|
@@ -795,22 +607,25 @@ var lt = (e) => {
|
|
|
795
607
|
[`${t}-close, ${t}-switch, ${t}-footer`]: { opacity: 1 }
|
|
796
608
|
}
|
|
797
609
|
} };
|
|
798
|
-
},
|
|
799
|
-
rotateLeft: i(
|
|
800
|
-
rotateRight: i(
|
|
801
|
-
zoomIn: i(
|
|
802
|
-
zoomOut: i(
|
|
803
|
-
flipX: i(
|
|
804
|
-
flipY: i(
|
|
805
|
-
|
|
806
|
-
|
|
610
|
+
}, ve = y("GImagePreview", (e) => [ge(e), _e(e)], he), ye = 1, Z = {
|
|
611
|
+
rotateLeft: i(v, { type: "RotateLeftOutlined" }, null),
|
|
612
|
+
rotateRight: i(v, { type: "RotateRightOutlined" }, null),
|
|
613
|
+
zoomIn: i(v, { type: "ZoomInOutlined" }, null),
|
|
614
|
+
zoomOut: i(v, { type: "ZoomOutOutlined" }, null),
|
|
615
|
+
flipX: i(v, { type: "SwapOutlined" }, null),
|
|
616
|
+
flipY: i(v, {
|
|
617
|
+
type: "SwapOutlined",
|
|
618
|
+
rotate: 90
|
|
619
|
+
}, null),
|
|
620
|
+
copy: i(v, { type: "CopyOutlined" }, null),
|
|
621
|
+
download: i(v, { type: "DownloadOutlined" }, null)
|
|
807
622
|
}, Q = {
|
|
808
623
|
copySuccess: "复制成功",
|
|
809
624
|
copyFailed: "复制失败",
|
|
810
625
|
downloadSuccess: "下载成功",
|
|
811
626
|
downloadFailed: "下载失败"
|
|
812
627
|
};
|
|
813
|
-
function
|
|
628
|
+
function be(e) {
|
|
814
629
|
try {
|
|
815
630
|
let t = new URL(e, window.location.href).pathname.match(/\/([^/]+)$/)?.[1];
|
|
816
631
|
return t ? decodeURIComponent(t) : "image";
|
|
@@ -819,7 +634,7 @@ function pt(e) {
|
|
|
819
634
|
return t ? decodeURIComponent(t) : "image";
|
|
820
635
|
}
|
|
821
636
|
}
|
|
822
|
-
function
|
|
637
|
+
function xe(e) {
|
|
823
638
|
let t = {
|
|
824
639
|
"image/gif": "gif",
|
|
825
640
|
"image/jpg": "jpg",
|
|
@@ -830,12 +645,12 @@ function mt(e) {
|
|
|
830
645
|
}, n = e?.toLowerCase();
|
|
831
646
|
return t[n] || n?.split("/")[1]?.split("+")[0] || "png";
|
|
832
647
|
}
|
|
833
|
-
async function
|
|
648
|
+
async function Se(e) {
|
|
834
649
|
let t = await fetch(e, { mode: "cors" });
|
|
835
650
|
if (!t.ok) throw Error(`Failed to fetch image: ${t.status}`);
|
|
836
651
|
return t.blob();
|
|
837
652
|
}
|
|
838
|
-
async function
|
|
653
|
+
async function Ce(e) {
|
|
839
654
|
return new Promise((t, n) => {
|
|
840
655
|
let r = new Image(), i = URL.createObjectURL(e);
|
|
841
656
|
r.onload = () => {
|
|
@@ -855,52 +670,52 @@ async function gt(e) {
|
|
|
855
670
|
}, r.src = i;
|
|
856
671
|
});
|
|
857
672
|
}
|
|
858
|
-
async function
|
|
673
|
+
async function we(e) {
|
|
859
674
|
let t = (e.type || "").toLowerCase();
|
|
860
|
-
return t === "image/png" || t === "image/svg+xml" ? { [t]: e } : { "image/png": await
|
|
675
|
+
return t === "image/png" || t === "image/svg+xml" ? { [t]: e } : { "image/png": await Ce(e) };
|
|
861
676
|
}
|
|
862
|
-
function
|
|
863
|
-
let n =
|
|
864
|
-
return n.includes(".") ? n.endsWith(".svg+xml") ? n.replace(/\.svg\+xml$/i, ".svg") : n : `${n}.${
|
|
677
|
+
function Te(e, t) {
|
|
678
|
+
let n = be(e);
|
|
679
|
+
return n.includes(".") ? n.endsWith(".svg+xml") ? n.replace(/\.svg\+xml$/i, ".svg") : n : `${n}.${xe(t)}`;
|
|
865
680
|
}
|
|
866
|
-
function
|
|
681
|
+
function Ee(e, t) {
|
|
867
682
|
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
868
683
|
r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), r.remove(), URL.revokeObjectURL(n);
|
|
869
684
|
}
|
|
870
|
-
var
|
|
871
|
-
let { width:
|
|
872
|
-
value:
|
|
685
|
+
var De = /* @__PURE__ */ a((a, { emit: o, slots: s, expose: c }) => {
|
|
686
|
+
let { width: d, height: h } = T(), { prefixCls: _ } = ee("pro-image-preview", a), y = te(_), [b, x] = ve(_, y), [S, C] = oe(a.open, {
|
|
687
|
+
value: m(a, "open"),
|
|
873
688
|
onChange: (e) => {
|
|
874
689
|
a.onOpenChange?.(e), o("update:open", e);
|
|
875
690
|
}
|
|
876
|
-
}),
|
|
877
|
-
imageRef:
|
|
878
|
-
minScale:
|
|
879
|
-
maxScale:
|
|
880
|
-
windowWidth:
|
|
881
|
-
windowHeight:
|
|
691
|
+
}), w = p(!0), D = p(), O = p(), k = p(a.current ?? 0), A = p(!1), j = p(!1), { transform: M, resetTransform: N, updateTransform: P, dispatchZoomChange: F } = se({
|
|
692
|
+
imageRef: D,
|
|
693
|
+
minScale: m(a, "minScale"),
|
|
694
|
+
maxScale: m(a, "maxScale"),
|
|
695
|
+
windowWidth: d,
|
|
696
|
+
windowHeight: h,
|
|
882
697
|
onTransform: a.onTransform
|
|
883
|
-
}), { isMoving:
|
|
884
|
-
imageRef:
|
|
885
|
-
movable:
|
|
886
|
-
visible:
|
|
887
|
-
scaleStep:
|
|
888
|
-
transform:
|
|
889
|
-
updateTransform:
|
|
890
|
-
dispatchZoomChange:
|
|
891
|
-
windowWidth:
|
|
892
|
-
windowHeight:
|
|
893
|
-
}), { isTouching:
|
|
894
|
-
imageRef:
|
|
895
|
-
movable:
|
|
896
|
-
visible:
|
|
897
|
-
minScale:
|
|
898
|
-
transform:
|
|
899
|
-
updateTransform:
|
|
900
|
-
dispatchZoomChange:
|
|
901
|
-
windowWidth:
|
|
902
|
-
windowHeight:
|
|
903
|
-
}),
|
|
698
|
+
}), { isMoving: I, onMouseDown: L, onWheel: R } = fe({
|
|
699
|
+
imageRef: D,
|
|
700
|
+
movable: m(a, "movable"),
|
|
701
|
+
visible: S,
|
|
702
|
+
scaleStep: m(a, "scaleStep"),
|
|
703
|
+
transform: M,
|
|
704
|
+
updateTransform: P,
|
|
705
|
+
dispatchZoomChange: F,
|
|
706
|
+
windowWidth: d,
|
|
707
|
+
windowHeight: h
|
|
708
|
+
}), { isTouching: z, onTouchStart: ne, onTouchMove: B, onTouchEnd: V } = me({
|
|
709
|
+
imageRef: D,
|
|
710
|
+
movable: m(a, "movable"),
|
|
711
|
+
visible: S,
|
|
712
|
+
minScale: m(a, "minScale"),
|
|
713
|
+
transform: M,
|
|
714
|
+
updateTransform: P,
|
|
715
|
+
dispatchZoomChange: F,
|
|
716
|
+
windowWidth: d,
|
|
717
|
+
windowHeight: h
|
|
718
|
+
}), H = r(() => a.urls[k.value]), W = r(() => a.urls.length > 1), G = r(() => a.urls.length >= 1), re = r(() => a.mask === !1 ? {
|
|
904
719
|
visible: !1,
|
|
905
720
|
blur: !1
|
|
906
721
|
} : a.mask && typeof a.mask == "object" && !("type" in a.mask) ? {
|
|
@@ -909,95 +724,95 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
909
724
|
} : {
|
|
910
725
|
visible: !0,
|
|
911
726
|
blur: !0
|
|
912
|
-
}),
|
|
727
|
+
}), ae = r(() => {
|
|
913
728
|
let e = {};
|
|
914
729
|
return a.mousePosition && (e.transformOrigin = `${a.mousePosition.x}px ${a.mousePosition.y}px`), e;
|
|
915
730
|
});
|
|
916
|
-
|
|
917
|
-
e !== void 0 && (
|
|
918
|
-
}),
|
|
919
|
-
e !== void 0 && (
|
|
731
|
+
g(() => a.current, (e) => {
|
|
732
|
+
e !== void 0 && (k.value = e);
|
|
733
|
+
}), g(() => a.current, (e) => {
|
|
734
|
+
e !== void 0 && (k.value = e);
|
|
920
735
|
});
|
|
921
|
-
let
|
|
922
|
-
|
|
923
|
-
},
|
|
924
|
-
|
|
925
|
-
},
|
|
926
|
-
if (
|
|
927
|
-
let e =
|
|
928
|
-
|
|
929
|
-
|
|
736
|
+
let q = () => {
|
|
737
|
+
C(!1), a.onClose?.(), o("close");
|
|
738
|
+
}, J = () => {
|
|
739
|
+
I.value || q();
|
|
740
|
+
}, Y = () => {
|
|
741
|
+
if (k.value > 0 || a.infinite) {
|
|
742
|
+
let e = k.value - 1 < 0 ? a.urls.length - 1 : k.value - 1;
|
|
743
|
+
w.value = !1, k.value = e, N("prev"), l(() => {
|
|
744
|
+
w.value = !0;
|
|
930
745
|
});
|
|
931
746
|
}
|
|
932
|
-
},
|
|
933
|
-
if (
|
|
934
|
-
let e =
|
|
935
|
-
|
|
936
|
-
|
|
747
|
+
}, ce = () => {
|
|
748
|
+
if (k.value < a.urls.length - 1 || a.infinite) {
|
|
749
|
+
let e = k.value + 1 > a.urls.length - 1 ? 0 : k.value + 1;
|
|
750
|
+
w.value = !1, k.value = e, N("next"), l(() => {
|
|
751
|
+
w.value = !0;
|
|
937
752
|
});
|
|
938
753
|
}
|
|
754
|
+
}, le = () => {
|
|
755
|
+
F(ye + (a.scaleStep ?? .5), "zoomIn");
|
|
756
|
+
}, ue = () => {
|
|
757
|
+
F(ye / (ye + (a.scaleStep ?? .5)), "zoomOut");
|
|
939
758
|
}, de = () => {
|
|
940
|
-
|
|
941
|
-
},
|
|
942
|
-
|
|
943
|
-
}, G = () => {
|
|
944
|
-
M({ rotate: A.value.rotate + 90 }, "rotateRight");
|
|
759
|
+
P({ rotate: M.value.rotate + 90 }, "rotateRight");
|
|
760
|
+
}, X = () => {
|
|
761
|
+
P({ rotate: M.value.rotate - 90 }, "rotateLeft");
|
|
945
762
|
}, pe = () => {
|
|
946
|
-
|
|
947
|
-
}, me = () => {
|
|
948
|
-
M({ flipX: !A.value.flipX }, "flipX");
|
|
763
|
+
P({ flipX: !M.value.flipX }, "flipX");
|
|
949
764
|
}, he = () => {
|
|
950
|
-
|
|
765
|
+
P({ flipY: !M.value.flipY }, "flipY");
|
|
951
766
|
}, ge = async () => {
|
|
952
|
-
if (!(!
|
|
767
|
+
if (!(!H.value || A.value)) {
|
|
953
768
|
if (!navigator.clipboard || !window.ClipboardItem) {
|
|
954
|
-
|
|
769
|
+
E.error(Q.copyFailed);
|
|
955
770
|
return;
|
|
956
771
|
}
|
|
957
|
-
|
|
772
|
+
A.value = !0;
|
|
958
773
|
try {
|
|
959
|
-
let e = await
|
|
960
|
-
await navigator.clipboard.write([new ClipboardItem(e)]),
|
|
774
|
+
let e = await we(await Se(H.value));
|
|
775
|
+
await navigator.clipboard.write([new ClipboardItem(e)]), E.success(Q.copySuccess);
|
|
961
776
|
} catch {
|
|
962
|
-
|
|
777
|
+
E.error(Q.copyFailed);
|
|
963
778
|
} finally {
|
|
964
|
-
|
|
779
|
+
A.value = !1;
|
|
965
780
|
}
|
|
966
781
|
}
|
|
967
782
|
}, _e = async () => {
|
|
968
|
-
if (!(!
|
|
969
|
-
|
|
783
|
+
if (!(!H.value || j.value)) {
|
|
784
|
+
j.value = !0;
|
|
970
785
|
try {
|
|
971
|
-
let e = await
|
|
972
|
-
|
|
786
|
+
let e = await Se(H.value);
|
|
787
|
+
Ee(e, Te(H.value, e.type)), E.success(Q.downloadSuccess);
|
|
973
788
|
} catch {
|
|
974
|
-
|
|
789
|
+
E.error(Q.downloadFailed);
|
|
975
790
|
} finally {
|
|
976
|
-
|
|
791
|
+
j.value = !1;
|
|
977
792
|
}
|
|
978
793
|
}
|
|
979
|
-
},
|
|
980
|
-
|
|
794
|
+
}, be = (e) => {
|
|
795
|
+
S.value && (M.value.scale === 1 ? F(ye + (a.scaleStep ?? .5), "doubleClick", e.clientX, e.clientY) : P({
|
|
981
796
|
x: 0,
|
|
982
797
|
y: 0,
|
|
983
798
|
scale: 1
|
|
984
799
|
}, "doubleClick"));
|
|
985
|
-
},
|
|
800
|
+
}, xe = (e) => {
|
|
986
801
|
if (e.key === "Escape") {
|
|
987
|
-
|
|
802
|
+
q();
|
|
988
803
|
return;
|
|
989
804
|
}
|
|
990
|
-
!
|
|
991
|
-
},
|
|
992
|
-
|
|
993
|
-
let e = (e) =>
|
|
994
|
-
window.addEventListener("keydown", e),
|
|
995
|
-
}),
|
|
996
|
-
|
|
805
|
+
!S.value || !W.value || (e.key === "ArrowLeft" ? Y() : e.key === "ArrowRight" && ce());
|
|
806
|
+
}, Ce;
|
|
807
|
+
u(() => {
|
|
808
|
+
let e = (e) => xe(e);
|
|
809
|
+
window.addEventListener("keydown", e), Ce = () => window.removeEventListener("keydown", e);
|
|
810
|
+
}), f(() => {
|
|
811
|
+
Ce?.();
|
|
997
812
|
}), c({ setOpen: (e) => {
|
|
998
|
-
|
|
813
|
+
C(e), k.value = a.current ?? 0;
|
|
999
814
|
} });
|
|
1000
|
-
let
|
|
815
|
+
let De = () => ie({
|
|
1001
816
|
slots: s,
|
|
1002
817
|
props: { ...a.icons },
|
|
1003
818
|
keys: [
|
|
@@ -1021,8 +836,8 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
1021
836
|
Z.copy,
|
|
1022
837
|
Z.download
|
|
1023
838
|
]
|
|
1024
|
-
}),
|
|
1025
|
-
let e =
|
|
839
|
+
}), Oe = () => {
|
|
840
|
+
let e = De();
|
|
1026
841
|
return [
|
|
1027
842
|
{
|
|
1028
843
|
icon: e.flipY,
|
|
@@ -1031,71 +846,77 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
1031
846
|
},
|
|
1032
847
|
{
|
|
1033
848
|
icon: e.flipX,
|
|
1034
|
-
onClick:
|
|
849
|
+
onClick: pe,
|
|
1035
850
|
type: "flipX"
|
|
1036
851
|
},
|
|
1037
852
|
{
|
|
1038
853
|
icon: e.rotateLeft,
|
|
1039
|
-
onClick:
|
|
854
|
+
onClick: X,
|
|
1040
855
|
type: "rotateLeft"
|
|
1041
856
|
},
|
|
1042
857
|
{
|
|
1043
858
|
icon: e.rotateRight,
|
|
1044
|
-
onClick:
|
|
859
|
+
onClick: de,
|
|
1045
860
|
type: "rotateRight"
|
|
1046
861
|
},
|
|
1047
862
|
{
|
|
1048
863
|
icon: e.zoomOut,
|
|
1049
|
-
onClick:
|
|
864
|
+
onClick: ue,
|
|
1050
865
|
type: "zoomOut",
|
|
1051
|
-
disabled: r(() =>
|
|
866
|
+
disabled: r(() => M.value.scale <= (a.minScale ?? 1))
|
|
1052
867
|
},
|
|
1053
868
|
{
|
|
1054
869
|
icon: e.zoomIn,
|
|
1055
|
-
onClick:
|
|
870
|
+
onClick: le,
|
|
1056
871
|
type: "zoomIn",
|
|
1057
|
-
disabled: r(() =>
|
|
872
|
+
disabled: r(() => M.value.scale === (a.maxScale ?? 50))
|
|
1058
873
|
},
|
|
1059
874
|
{
|
|
1060
|
-
icon:
|
|
875
|
+
icon: A.value ? i(v, {
|
|
876
|
+
type: "Spinning",
|
|
877
|
+
spin: !0
|
|
878
|
+
}, null) : e.copy,
|
|
1061
879
|
onClick: ge,
|
|
1062
880
|
type: "copy",
|
|
1063
|
-
disabled: r(() =>
|
|
881
|
+
disabled: r(() => A.value)
|
|
1064
882
|
},
|
|
1065
883
|
{
|
|
1066
|
-
icon:
|
|
884
|
+
icon: j.value ? i(v, {
|
|
885
|
+
type: "Spinning",
|
|
886
|
+
spin: !0
|
|
887
|
+
}, null) : e.download,
|
|
1067
888
|
onClick: _e,
|
|
1068
889
|
type: "download",
|
|
1069
|
-
disabled: r(() =>
|
|
890
|
+
disabled: r(() => j.value)
|
|
1070
891
|
}
|
|
1071
892
|
];
|
|
1072
893
|
};
|
|
1073
894
|
return () => {
|
|
1074
895
|
let r = {
|
|
1075
|
-
transform: `translate3d(${
|
|
1076
|
-
transitionDuration: !
|
|
1077
|
-
}, o =
|
|
896
|
+
transform: `translate3d(${M.value.x}px, ${M.value.y}px, 0) scale3d(${M.value.flipX ? "-" : ""}${M.value.scale}, ${M.value.flipY ? "-" : ""}${M.value.scale}, 1) rotate(${M.value.rotate}deg)`,
|
|
897
|
+
transitionDuration: !w.value || z.value ? "0s" : void 0
|
|
898
|
+
}, o = K({
|
|
1078
899
|
slots: s,
|
|
1079
900
|
props: { close: a.icons?.close },
|
|
1080
901
|
key: "close"
|
|
1081
|
-
}), c =
|
|
902
|
+
}), c = K({
|
|
1082
903
|
slots: s,
|
|
1083
904
|
props: { left: a.icons?.left },
|
|
1084
905
|
key: "left"
|
|
1085
|
-
}), l =
|
|
906
|
+
}), l = K({
|
|
1086
907
|
slots: s,
|
|
1087
908
|
props: { right: a.icons?.right },
|
|
1088
909
|
key: "right"
|
|
1089
|
-
}), u = `${
|
|
910
|
+
}), u = `${_.value}-actions-action`, d = Oe();
|
|
1090
911
|
return i(t, { to: a.getContainer || "body" }, { default: () => [i(n, {
|
|
1091
|
-
name: `${
|
|
912
|
+
name: `${_.value}-fade`,
|
|
1092
913
|
appear: !0,
|
|
1093
|
-
onAfterLeave: () =>
|
|
1094
|
-
}, { default: () => [
|
|
1095
|
-
ref:
|
|
1096
|
-
class:
|
|
1097
|
-
[`${
|
|
1098
|
-
[`${
|
|
914
|
+
onAfterLeave: () => N("close")
|
|
915
|
+
}, { default: () => [S.value && i("div", {
|
|
916
|
+
ref: O,
|
|
917
|
+
class: U(_.value, b.value, x.value, y.value, {
|
|
918
|
+
[`${_.value}-movable`]: a.movable,
|
|
919
|
+
[`${_.value}-moving`]: I.value
|
|
1099
920
|
}),
|
|
1100
921
|
style: { zIndex: a.zIndex },
|
|
1101
922
|
role: "dialog",
|
|
@@ -1103,50 +924,50 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
1103
924
|
"aria-label": "Image",
|
|
1104
925
|
tabindex: -1
|
|
1105
926
|
}, [
|
|
1106
|
-
|
|
1107
|
-
class:
|
|
1108
|
-
onClick: a.onHideOnClickModal ?
|
|
927
|
+
re.value.visible && i("div", {
|
|
928
|
+
class: U(`${_.value}-mask`, a.maskClass, { [`${_.value}-mask-blur`]: re.value.blur }),
|
|
929
|
+
onClick: a.onHideOnClickModal ? J : void 0
|
|
1109
930
|
}, null),
|
|
1110
931
|
i("div", {
|
|
1111
|
-
class: `${
|
|
1112
|
-
style:
|
|
932
|
+
class: `${_.value}-body`,
|
|
933
|
+
style: ae.value
|
|
1113
934
|
}, [i("img", {
|
|
1114
|
-
ref:
|
|
1115
|
-
class: `${
|
|
1116
|
-
src:
|
|
935
|
+
ref: D,
|
|
936
|
+
class: `${_.value}-img`,
|
|
937
|
+
src: H.value,
|
|
1117
938
|
alt: "Image",
|
|
1118
939
|
loading: "eager",
|
|
1119
940
|
decoding: "sync",
|
|
1120
941
|
style: r,
|
|
1121
|
-
onWheel:
|
|
1122
|
-
onMousedown:
|
|
1123
|
-
onDblclick:
|
|
1124
|
-
onTouchstart:
|
|
1125
|
-
onTouchmove:
|
|
1126
|
-
onTouchend:
|
|
1127
|
-
onTouchcancel:
|
|
942
|
+
onWheel: R,
|
|
943
|
+
onMousedown: L,
|
|
944
|
+
onDblclick: be,
|
|
945
|
+
onTouchstart: ne,
|
|
946
|
+
onTouchmove: B,
|
|
947
|
+
onTouchend: V,
|
|
948
|
+
onTouchcancel: V
|
|
1128
949
|
}, null)]),
|
|
1129
950
|
i("button", {
|
|
1130
951
|
type: "button",
|
|
1131
|
-
class: `${
|
|
1132
|
-
onClick:
|
|
1133
|
-
}, [o || i(
|
|
1134
|
-
|
|
952
|
+
class: `${_.value}-close`,
|
|
953
|
+
onClick: q
|
|
954
|
+
}, [o || i(v, { type: "CloseOutlined" }, null)]),
|
|
955
|
+
W.value && i(e, null, [i("button", {
|
|
1135
956
|
type: "button",
|
|
1136
|
-
class:
|
|
957
|
+
class: U(`${_.value}-switch`, `${_.value}-switch-prev`, { [`${_.value}-switch-disabled`]: !a.infinite && k.value === 0 }),
|
|
1137
958
|
onClick: (e) => {
|
|
1138
|
-
e.preventDefault(), e.stopPropagation(),
|
|
959
|
+
e.preventDefault(), e.stopPropagation(), Y();
|
|
1139
960
|
}
|
|
1140
|
-
}, [c || i(
|
|
961
|
+
}, [c || i(v, { type: "LeftOutlined" }, null)]), i("button", {
|
|
1141
962
|
type: "button",
|
|
1142
|
-
class:
|
|
963
|
+
class: U(`${_.value}-switch`, `${_.value}-switch-next`, { [`${_.value}-switch-disabled`]: !a.infinite && k.value === a.urls.length - 1 }),
|
|
1143
964
|
onClick: (e) => {
|
|
1144
|
-
e.preventDefault(), e.stopPropagation(),
|
|
965
|
+
e.preventDefault(), e.stopPropagation(), ce();
|
|
1145
966
|
}
|
|
1146
|
-
}, [l || i(
|
|
1147
|
-
i("div", { class: `${
|
|
967
|
+
}, [l || i(v, { type: "RightOutlined" }, null)])]),
|
|
968
|
+
i("div", { class: `${_.value}-footer` }, [G.value && i("div", { class: `${_.value}-progress` }, [a.countRender ? a.countRender(k.value + 1, a.urls.length) : `${k.value + 1} / ${a.urls.length}`]), i("div", { class: `${_.value}-actions` }, [d.map(({ icon: e, onClick: t, type: n, disabled: r }) => i("button", {
|
|
1148
969
|
type: "button",
|
|
1149
|
-
class:
|
|
970
|
+
class: U(u, `${u}-${n}`, { [`${u}-disabled`]: r && r.value }),
|
|
1150
971
|
onClick: () => {
|
|
1151
972
|
r?.value || t();
|
|
1152
973
|
},
|
|
@@ -1157,7 +978,7 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
1157
978
|
])] })] });
|
|
1158
979
|
};
|
|
1159
980
|
}, {
|
|
1160
|
-
props:
|
|
981
|
+
props: /*@__PURE__*/ s({
|
|
1161
982
|
class: {
|
|
1162
983
|
type: String,
|
|
1163
984
|
required: !1
|
|
@@ -1285,7 +1106,7 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
1285
1106
|
],
|
|
1286
1107
|
name: "GImagePreview",
|
|
1287
1108
|
inheritAttrs: !1
|
|
1288
|
-
}),
|
|
1109
|
+
}), Oe = (e) => {
|
|
1289
1110
|
let { motionDurationSlow: t, paddingXXS: n, marginXXS: r, colorTextLightSolid: i } = e;
|
|
1290
1111
|
return {
|
|
1291
1112
|
position: "absolute",
|
|
@@ -1302,14 +1123,14 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
1302
1123
|
overflow: "hidden",
|
|
1303
1124
|
whiteSpace: "nowrap",
|
|
1304
1125
|
textOverflow: "ellipsis",
|
|
1305
|
-
padding: `0 ${
|
|
1126
|
+
padding: `0 ${b(n)}`,
|
|
1306
1127
|
".anticon": {
|
|
1307
1128
|
marginInlineEnd: r,
|
|
1308
1129
|
svg: { verticalAlign: "baseline" }
|
|
1309
1130
|
}
|
|
1310
1131
|
}
|
|
1311
1132
|
};
|
|
1312
|
-
},
|
|
1133
|
+
}, ke = (e) => {
|
|
1313
1134
|
let t = {
|
|
1314
1135
|
width: "100%",
|
|
1315
1136
|
height: "100%"
|
|
@@ -1345,67 +1166,67 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
|
|
|
1345
1166
|
position: "absolute",
|
|
1346
1167
|
inset: 0
|
|
1347
1168
|
},
|
|
1348
|
-
[`${e.componentCls}-mask`]: { ...
|
|
1169
|
+
[`${e.componentCls}-mask`]: { ...Oe(e) },
|
|
1349
1170
|
[`${e.componentCls}-mask:hover`]: { opacity: 1 }
|
|
1350
1171
|
} };
|
|
1351
|
-
},
|
|
1172
|
+
}, Ae = y("GImage", (e) => [ke(e)]), je = {
|
|
1352
1173
|
src: "",
|
|
1353
1174
|
alt: "",
|
|
1354
1175
|
fit: "contain",
|
|
1355
1176
|
preview: !0,
|
|
1356
1177
|
loading: "eager"
|
|
1357
1178
|
};
|
|
1358
|
-
function
|
|
1179
|
+
function Me(e) {
|
|
1359
1180
|
return e && e.nodeType === 1;
|
|
1360
1181
|
}
|
|
1361
|
-
var $ = /* @__PURE__ */
|
|
1362
|
-
let
|
|
1182
|
+
var $ = /* @__PURE__ */ a((t, { emit: n, slots: a, expose: o, attrs: s }) => {
|
|
1183
|
+
let d = x && "loading" in HTMLImageElement.prototype, { prefixCls: f } = ee("pro-image", t), m = te(f), [h, _] = Ae(f, m), y = p(), C = p(!1), T = p(!0), E = p(), D = p(), O, A = r(() => t.loading === "eager" ? !1 : !d && t.loading === "lazy" || t.lazy), j = r(() => x && t.fit ? {
|
|
1363
1184
|
...t.imageStyle,
|
|
1364
1185
|
objectFit: t.fit
|
|
1365
|
-
} : { ...t.imageStyle }),
|
|
1366
|
-
let { urls: e = [], current: n = 0 } =
|
|
1367
|
-
if (
|
|
1186
|
+
} : { ...t.imageStyle }), N = r(() => typeof t.preview == "object" ? t.preview : {}), P = r(() => !!t.preview), F = r(() => {
|
|
1187
|
+
let { urls: e = [], current: n = 0 } = N.value;
|
|
1188
|
+
if (k(n)) return e.length >= n ? n : 0;
|
|
1368
1189
|
let r = e.indexOf(t.src ?? "");
|
|
1369
1190
|
return r >= 0 ? r : 0;
|
|
1370
|
-
}),
|
|
1371
|
-
|
|
1372
|
-
},
|
|
1373
|
-
|
|
1374
|
-
},
|
|
1375
|
-
|
|
1376
|
-
},
|
|
1377
|
-
if (!
|
|
1378
|
-
let e =
|
|
1191
|
+
}), I = r(() => b(t.width)), L = r(() => b(t.height)), { showViewer: R, mousePosition: z, openPreview: ne, closePreview: B } = ae({ canPreview: P }), V = () => {
|
|
1192
|
+
x && (T.value = !0, C.value = !1, y.value = t.src);
|
|
1193
|
+
}, W = (e) => {
|
|
1194
|
+
C.value || (T.value = !1, C.value = !1, t.onLoad?.(e), n("load", e));
|
|
1195
|
+
}, G = (e) => {
|
|
1196
|
+
T.value = !1, C.value = !0, t.onError?.(e), n("error", e);
|
|
1197
|
+
}, re = () => {
|
|
1198
|
+
if (!E.value || !D.value) return !1;
|
|
1199
|
+
let e = E.value.getBoundingClientRect(), t = D.value.getBoundingClientRect ? D.value.getBoundingClientRect() : {
|
|
1379
1200
|
top: 0,
|
|
1380
|
-
bottom:
|
|
1201
|
+
bottom: D.value.innerHeight ?? 0,
|
|
1381
1202
|
left: 0,
|
|
1382
|
-
right:
|
|
1203
|
+
right: D.value.innerWidth ?? 0
|
|
1383
1204
|
};
|
|
1384
1205
|
return e.top < t.bottom && e.bottom > t.top && e.left < t.right && e.right > t.left;
|
|
1385
|
-
},
|
|
1386
|
-
|
|
1387
|
-
}, 200, !0),
|
|
1388
|
-
if (!
|
|
1389
|
-
await
|
|
1206
|
+
}, K = w(() => {
|
|
1207
|
+
re() && (V(), O?.(), O = void 0);
|
|
1208
|
+
}, 200, !0), q = async () => {
|
|
1209
|
+
if (!x) return;
|
|
1210
|
+
await l();
|
|
1390
1211
|
let { scrollContainer: e } = t;
|
|
1391
|
-
|
|
1392
|
-
},
|
|
1393
|
-
let r =
|
|
1394
|
-
if (t.onClick?.(r), n("click", r), !(
|
|
1212
|
+
Me(e) ? D.value = e : M(e) && e !== "" ? D.value = document.querySelector(e) ?? void 0 : E.value && (D.value = H(E.value)), D.value && (O = S(D.value, "scroll", K), setTimeout(K, 100));
|
|
1213
|
+
}, J = (e) => {
|
|
1214
|
+
let r = T.value ? "loaded" : C.value ? "error" : "success";
|
|
1215
|
+
if (t.onClick?.(r), n("click", r), !(T.value || C.value) && P.value) {
|
|
1395
1216
|
let t = e.currentTarget?.getBoundingClientRect();
|
|
1396
|
-
|
|
1217
|
+
ne(t ? {
|
|
1397
1218
|
...e,
|
|
1398
1219
|
clientX: t.x + t.width / 2,
|
|
1399
1220
|
clientY: t.y + t.height / 2
|
|
1400
1221
|
} : e);
|
|
1401
1222
|
}
|
|
1402
1223
|
};
|
|
1403
|
-
return
|
|
1404
|
-
|
|
1405
|
-
}),
|
|
1406
|
-
|
|
1224
|
+
return g(() => t.src, () => {
|
|
1225
|
+
A.value ? (T.value = !0, C.value = !1, O?.(), q()) : V();
|
|
1226
|
+
}), u(() => {
|
|
1227
|
+
A.value ? q() : V();
|
|
1407
1228
|
}), o({ setOpen: (e) => {
|
|
1408
|
-
e ?
|
|
1229
|
+
e ? ne() : B();
|
|
1409
1230
|
} }), () => {
|
|
1410
1231
|
let n = {}, r = {};
|
|
1411
1232
|
for (let [e, t] of Object.entries(s)) /^(?:data-|on[A-Z])/i.test(e) || [
|
|
@@ -1413,7 +1234,7 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
|
|
|
1413
1234
|
"style",
|
|
1414
1235
|
"class"
|
|
1415
1236
|
].includes(e) ? n[e] = t : r[e] = t;
|
|
1416
|
-
let o =
|
|
1237
|
+
let o = ie({
|
|
1417
1238
|
slots: a,
|
|
1418
1239
|
props: t,
|
|
1419
1240
|
keys: [
|
|
@@ -1423,53 +1244,53 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
|
|
|
1423
1244
|
],
|
|
1424
1245
|
render: !0
|
|
1425
1246
|
});
|
|
1426
|
-
return i("div",
|
|
1427
|
-
class:
|
|
1428
|
-
ref:
|
|
1247
|
+
return i("div", c({
|
|
1248
|
+
class: U(f.value, h.value, _.value, m.value, t.class),
|
|
1249
|
+
ref: E
|
|
1429
1250
|
}, n, {
|
|
1430
1251
|
style: {
|
|
1431
|
-
width:
|
|
1432
|
-
height:
|
|
1252
|
+
width: b(t.size) || I.value,
|
|
1253
|
+
height: b(t.size) || L.value,
|
|
1433
1254
|
...n.style || {}
|
|
1434
1255
|
},
|
|
1435
1256
|
onClick: (e) => {
|
|
1436
|
-
|
|
1257
|
+
C.value && J(e);
|
|
1437
1258
|
}
|
|
1438
1259
|
}), [
|
|
1439
|
-
|
|
1440
|
-
src:
|
|
1260
|
+
C.value ? i("div", { class: U(`${f.value}-error`) }, [o.fallback]) : i(e, null, [i("img", c(r, {
|
|
1261
|
+
src: y.value,
|
|
1441
1262
|
loading: t.loading,
|
|
1442
|
-
style:
|
|
1443
|
-
class:
|
|
1444
|
-
[`${
|
|
1445
|
-
[`${
|
|
1263
|
+
style: j.value,
|
|
1264
|
+
class: U(t.imageClass, `${f.value}-img`, {
|
|
1265
|
+
[`${f.value}-img-placeholder`]: t.placeholder === !0,
|
|
1266
|
+
[`${f.value}-img-preview`]: P.value
|
|
1446
1267
|
}),
|
|
1447
1268
|
crossorigin: t.crossOrigin,
|
|
1448
|
-
width:
|
|
1449
|
-
height:
|
|
1450
|
-
onClick:
|
|
1451
|
-
onLoad:
|
|
1452
|
-
onError:
|
|
1453
|
-
}), null),
|
|
1454
|
-
class:
|
|
1455
|
-
onClick:
|
|
1269
|
+
width: I.value,
|
|
1270
|
+
height: L.value,
|
|
1271
|
+
onClick: J,
|
|
1272
|
+
onLoad: W,
|
|
1273
|
+
onError: G
|
|
1274
|
+
}), null), T.value && i("div", {
|
|
1275
|
+
class: U(`${f.value}-placeholder`),
|
|
1276
|
+
onClick: J
|
|
1456
1277
|
}, [o.placeholder])]),
|
|
1457
|
-
|
|
1458
|
-
class:
|
|
1278
|
+
N.value.mask && P.value && i("div", {
|
|
1279
|
+
class: U(`${f.value}-mask`, N.value.maskClass),
|
|
1459
1280
|
style: { display: n.style?.display === "none" ? "none" : void 0 }
|
|
1460
|
-
}, [o.mask || i("div", { class:
|
|
1461
|
-
|
|
1462
|
-
urls:
|
|
1463
|
-
current:
|
|
1464
|
-
zIndex: t.zIndex ??
|
|
1465
|
-
open:
|
|
1466
|
-
mousePosition:
|
|
1467
|
-
onClose: () =>
|
|
1281
|
+
}, [o.mask || i("div", { class: U(`${f.value}-mask-info`) }, [i(v, { type: "EyeOutlined" }, null)])]),
|
|
1282
|
+
P.value && i(De, c(N.value, {
|
|
1283
|
+
urls: N.value.urls || (t.src ? [t.src] : []),
|
|
1284
|
+
current: F.value,
|
|
1285
|
+
zIndex: t.zIndex ?? N.value.zIndex,
|
|
1286
|
+
open: R.value,
|
|
1287
|
+
mousePosition: z.value,
|
|
1288
|
+
onClose: () => B()
|
|
1468
1289
|
}), a)
|
|
1469
1290
|
]);
|
|
1470
1291
|
};
|
|
1471
1292
|
}, {
|
|
1472
|
-
props:
|
|
1293
|
+
props: /*@__PURE__*/ s({
|
|
1473
1294
|
rootClass: {
|
|
1474
1295
|
type: String,
|
|
1475
1296
|
required: !1
|
|
@@ -1573,7 +1394,7 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
|
|
|
1573
1394
|
type: Function,
|
|
1574
1395
|
required: !1
|
|
1575
1396
|
}
|
|
1576
|
-
},
|
|
1397
|
+
}, je),
|
|
1577
1398
|
emits: [
|
|
1578
1399
|
"click",
|
|
1579
1400
|
"load",
|
|
@@ -1583,6 +1404,6 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
|
|
|
1583
1404
|
inheritAttrs: !1
|
|
1584
1405
|
});
|
|
1585
1406
|
$.isGImage = !0, $.install = (e) => (e.component($.name, $), e);
|
|
1586
|
-
var
|
|
1407
|
+
var Ne = $;
|
|
1587
1408
|
//#endregion
|
|
1588
|
-
export {
|
|
1409
|
+
export { Ne as GImage, De as GImagePreview };
|