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