@gx-design-vue/image 0.2.0-beta.31 → 0.2.0-beta.32
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 +430 -418
- package/dist/image.umd.cjs +3 -3
- package/package.json +4 -4
package/dist/image.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Gx Design Pro
|
|
3
|
-
* Version: 0.2.0-beta.
|
|
3
|
+
* Version: 0.2.0-beta.31
|
|
4
4
|
* Author: gx12358
|
|
5
5
|
* Copyright (C) 2024 gx12358
|
|
6
6
|
* License: MIT License
|
|
7
7
|
* Description: Gx Design Image
|
|
8
|
-
* Date Created: 2025-08-
|
|
8
|
+
* Date Created: 2025-08-17
|
|
9
9
|
* Homepage:
|
|
10
10
|
* Contact: gx12358@gmail.com
|
|
11
11
|
*/
|
|
12
|
-
import { ref as $, defineComponent as
|
|
13
|
-
import { CloseOutlined as
|
|
14
|
-
import { getTransitionProps as
|
|
15
|
-
import { classNames as X, getPrefixCls as
|
|
16
|
-
import { useWindowSize as
|
|
17
|
-
import { isEqual as Lt, cloneDeep as $t, omit as
|
|
18
|
-
import { useState as
|
|
12
|
+
import { ref as $, defineComponent as we, createVNode as u, Teleport as Te, Transition as ge, withDirectives as me, Fragment as le, cloneVNode as nt, vShow as pe, toRef as H, reactive as ot, computed as b, watch as K, onMounted as Ae, onUnmounted as it, mergeProps as ie, watchEffect as at, nextTick as lt } from "vue";
|
|
13
|
+
import { CloseOutlined as rt, LeftOutlined as st, RightOutlined as ut, SwapOutlined as be, ZoomOutOutlined as ct, ZoomInOutlined as dt, RotateRightOutlined as ft, RotateLeftOutlined as vt, EyeOutlined as gt } from "@ant-design/icons-vue";
|
|
14
|
+
import { getTransitionProps as he, Keyframe as se, useStyle as mt, mergeToken as pt, unit as Q, FastColor as ht, useProStyle as wt } from "@gx-design-vue/pro-provider";
|
|
15
|
+
import { classNames as X, getPrefixCls as Ee, isNumber as De, isArray as yt, getSlot as St, getSlotsProps as Re, isInContainer as Ct, isString as xt, getScrollContainer as It } from "@gx-design-vue/pro-utils";
|
|
16
|
+
import { useWindowSize as Pe, isClient as q, useThrottleFn as bt, useEventListener as Le } from "@vueuse/core";
|
|
17
|
+
import { isEqual as Lt, cloneDeep as $t, omit as Ne, fromPairs as zt } from "lodash-es";
|
|
18
|
+
import { useState as ee, useEffect as ye, useMergedState as Mt } from "@gx-design-vue/pro-hooks";
|
|
19
19
|
import { TinyColor as F } from "@ctrl/tinycolor";
|
|
20
|
-
const
|
|
20
|
+
const J = {
|
|
21
21
|
infinite: {
|
|
22
22
|
type: Boolean,
|
|
23
23
|
default: !0
|
|
@@ -33,7 +33,7 @@ const te = {
|
|
|
33
33
|
getContainer: {
|
|
34
34
|
type: String
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, Xe = {
|
|
37
37
|
preview: {
|
|
38
38
|
type: [Object, Boolean],
|
|
39
39
|
default: !0
|
|
@@ -87,9 +87,9 @@ const te = {
|
|
|
87
87
|
size: Number,
|
|
88
88
|
width: Number,
|
|
89
89
|
height: Number,
|
|
90
|
-
zIndex:
|
|
91
|
-
getContainer:
|
|
92
|
-
},
|
|
90
|
+
zIndex: J.zIndex,
|
|
91
|
+
getContainer: J.getContainer
|
|
92
|
+
}, U = {
|
|
93
93
|
urls: {
|
|
94
94
|
type: Array,
|
|
95
95
|
default: () => []
|
|
@@ -115,10 +115,10 @@ const te = {
|
|
|
115
115
|
default: !0
|
|
116
116
|
},
|
|
117
117
|
disabled: Boolean,
|
|
118
|
-
zIndex:
|
|
119
|
-
current:
|
|
120
|
-
infinite:
|
|
121
|
-
getContainer:
|
|
118
|
+
zIndex: J.zIndex,
|
|
119
|
+
current: J.current,
|
|
120
|
+
infinite: J.infinite,
|
|
121
|
+
getContainer: Xe.getContainer,
|
|
122
122
|
onHideOnClickModal: {
|
|
123
123
|
type: Boolean,
|
|
124
124
|
default: !0
|
|
@@ -132,33 +132,33 @@ const te = {
|
|
|
132
132
|
onOpenChange: Function,
|
|
133
133
|
"onUpdate:open": Function
|
|
134
134
|
};
|
|
135
|
-
let
|
|
136
|
-
typeof window < "u" && "requestAnimationFrame" in window && (
|
|
137
|
-
let
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
|
|
135
|
+
let Ye = (e) => setTimeout(e, 16), je = (e) => clearTimeout(e);
|
|
136
|
+
typeof window < "u" && "requestAnimationFrame" in window && (Ye = (e) => window.requestAnimationFrame(e), je = (e) => window.cancelAnimationFrame(e));
|
|
137
|
+
let $e = 0;
|
|
138
|
+
const Se = /* @__PURE__ */ new Map();
|
|
139
|
+
function Be(e) {
|
|
140
|
+
Se.delete(e);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
const o =
|
|
145
|
-
function
|
|
142
|
+
function Fe(e, t = 1) {
|
|
143
|
+
$e += 1;
|
|
144
|
+
const o = $e;
|
|
145
|
+
function r(n) {
|
|
146
146
|
if (n === 0)
|
|
147
|
-
|
|
147
|
+
Be(o), e();
|
|
148
148
|
else {
|
|
149
|
-
const
|
|
150
|
-
|
|
149
|
+
const s = Ye(() => {
|
|
150
|
+
r(n - 1);
|
|
151
151
|
});
|
|
152
|
-
|
|
152
|
+
Se.set(o, s);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
return
|
|
155
|
+
return r(t), o;
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
const t =
|
|
159
|
-
return
|
|
157
|
+
Fe.cancel = (e) => {
|
|
158
|
+
const t = Se.get(e);
|
|
159
|
+
return Be(t), je(t);
|
|
160
160
|
};
|
|
161
|
-
const
|
|
161
|
+
const oe = {
|
|
162
162
|
x: 0,
|
|
163
163
|
y: 0,
|
|
164
164
|
rotate: 0,
|
|
@@ -166,16 +166,16 @@ const ae = {
|
|
|
166
166
|
flipX: !1,
|
|
167
167
|
flipY: !1
|
|
168
168
|
};
|
|
169
|
-
function Ot(e, t, o,
|
|
170
|
-
const n = $(null),
|
|
171
|
-
|
|
169
|
+
function Ot(e, t, o, r) {
|
|
170
|
+
const n = $(null), s = $([]), [c, h] = ee(oe), v = (m) => {
|
|
171
|
+
h(oe), Lt(oe, c.value) || r?.({ transform: oe, action: m });
|
|
172
172
|
}, d = (m, C) => {
|
|
173
|
-
n.value === null && (
|
|
173
|
+
n.value === null && (s.value = [], n.value = Fe(() => {
|
|
174
174
|
let x = $t(c.value);
|
|
175
|
-
|
|
176
|
-
x = { ...x, ...
|
|
177
|
-
}), n.value = null,
|
|
178
|
-
})),
|
|
175
|
+
s.value.forEach((i) => {
|
|
176
|
+
x = { ...x, ...i };
|
|
177
|
+
}), n.value = null, r?.({ transform: x, action: C }), h(x);
|
|
178
|
+
})), s.value.push({
|
|
179
179
|
...c.value,
|
|
180
180
|
...m
|
|
181
181
|
});
|
|
@@ -184,15 +184,15 @@ function Ot(e, t, o, i) {
|
|
|
184
184
|
transform: c,
|
|
185
185
|
resetTransform: v,
|
|
186
186
|
updateTransform: d,
|
|
187
|
-
dispatchZoomChange: (m, C, x,
|
|
188
|
-
const { width: w, height:
|
|
189
|
-
let
|
|
190
|
-
I > o.value ? (I = o.value,
|
|
191
|
-
const k = x ?? innerWidth / 2,
|
|
192
|
-
let j = c.value.x - (Y -
|
|
187
|
+
dispatchZoomChange: (m, C, x, i, a) => {
|
|
188
|
+
const { width: w, height: p, offsetWidth: y, offsetHeight: S, offsetLeft: L, offsetTop: A } = e.value;
|
|
189
|
+
let z = m, I = c.value.scale * m;
|
|
190
|
+
I > o.value ? (I = o.value, z = o.value / c.value.scale) : I < t.value && (I = a ? I : t.value, z = I / c.value.scale);
|
|
191
|
+
const k = x ?? innerWidth / 2, Z = i ?? innerHeight / 2, R = z - 1, M = R * w * 0.5, P = R * p * 0.5, Y = R * (k - c.value.x - L), W = R * (Z - c.value.y - A);
|
|
192
|
+
let j = c.value.x - (Y - M), B = c.value.y - (W - P);
|
|
193
193
|
if (m < 1 && I === 1) {
|
|
194
|
-
const
|
|
195
|
-
|
|
194
|
+
const E = y * I, f = S * I, { width: N, height: O } = Pe();
|
|
195
|
+
E <= N.value && f <= O.value && (j = 0, B = 0);
|
|
196
196
|
}
|
|
197
197
|
d({
|
|
198
198
|
x: j,
|
|
@@ -205,20 +205,20 @@ function Ot(e, t, o, i) {
|
|
|
205
205
|
function Tt(e, t) {
|
|
206
206
|
process.env.NODE_ENV !== "production" && console !== void 0 && console.error(`Warning: ${t}`);
|
|
207
207
|
}
|
|
208
|
-
let
|
|
208
|
+
let ke = !1;
|
|
209
209
|
try {
|
|
210
210
|
const e = Object.defineProperty({}, "passive", {
|
|
211
211
|
get() {
|
|
212
|
-
|
|
212
|
+
ke = !0;
|
|
213
213
|
}
|
|
214
214
|
});
|
|
215
215
|
window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e);
|
|
216
216
|
} catch {
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function G(e, t, o, r) {
|
|
219
219
|
if (e && e.addEventListener) {
|
|
220
|
-
let n =
|
|
221
|
-
n === void 0 &&
|
|
220
|
+
let n = r;
|
|
221
|
+
n === void 0 && ke && (t === "touchstart" || t === "touchmove" || t === "wheel") && (n = { passive: !1 }), e.addEventListener(t, o, n);
|
|
222
222
|
}
|
|
223
223
|
return {
|
|
224
224
|
remove: () => {
|
|
@@ -226,169 +226,169 @@ function V(e, t, o, i) {
|
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
const
|
|
230
|
-
function
|
|
231
|
-
const n = t + o,
|
|
232
|
-
if (o >
|
|
229
|
+
const V = 1, At = 1;
|
|
230
|
+
function ze(e, t, o, r) {
|
|
231
|
+
const n = t + o, s = (o - r) / 2;
|
|
232
|
+
if (o > r) {
|
|
233
233
|
if (t > 0)
|
|
234
234
|
return {
|
|
235
|
-
[e]:
|
|
235
|
+
[e]: s
|
|
236
236
|
};
|
|
237
|
-
if (t < 0 && n <
|
|
237
|
+
if (t < 0 && n < r)
|
|
238
238
|
return {
|
|
239
|
-
[e]: -
|
|
239
|
+
[e]: -s
|
|
240
240
|
};
|
|
241
|
-
} else if (t < 0 || n >
|
|
241
|
+
} else if (t < 0 || n > r)
|
|
242
242
|
return {
|
|
243
|
-
[e]: t < 0 ?
|
|
243
|
+
[e]: t < 0 ? s : -s
|
|
244
244
|
};
|
|
245
245
|
return {};
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
const { width: n, height:
|
|
247
|
+
function He(e, t, o, r) {
|
|
248
|
+
const { width: n, height: s } = Pe();
|
|
249
249
|
let c = null;
|
|
250
|
-
return e <= n.value && t <=
|
|
250
|
+
return e <= n.value && t <= s.value ? c = {
|
|
251
251
|
x: 0,
|
|
252
252
|
y: 0
|
|
253
|
-
} : (e > n.value || t >
|
|
254
|
-
...
|
|
255
|
-
...
|
|
253
|
+
} : (e > n.value || t > s.value) && (c = {
|
|
254
|
+
...ze("x", o, e, n.value),
|
|
255
|
+
...ze("y", r, t, s.value)
|
|
256
256
|
}), c;
|
|
257
257
|
}
|
|
258
|
-
function Et(e, t, o,
|
|
259
|
-
const [
|
|
258
|
+
function Et(e, t, o, r, n, s, c) {
|
|
259
|
+
const [h, v] = ee(!1), d = $({
|
|
260
260
|
diffX: 0,
|
|
261
261
|
diffY: 0,
|
|
262
262
|
transformX: 0,
|
|
263
263
|
transformY: 0
|
|
264
|
-
}), g = (
|
|
265
|
-
!t ||
|
|
266
|
-
diffX:
|
|
267
|
-
diffY:
|
|
264
|
+
}), g = (i) => {
|
|
265
|
+
!t || i.button !== 0 || (i.preventDefault(), i.stopPropagation(), d.value = {
|
|
266
|
+
diffX: i.pageX - n.value.x,
|
|
267
|
+
diffY: i.pageY - n.value.y,
|
|
268
268
|
transformX: n.value.x,
|
|
269
269
|
transformY: n.value.y
|
|
270
270
|
}, v(!0));
|
|
271
|
-
}, m = (
|
|
272
|
-
o &&
|
|
273
|
-
x:
|
|
274
|
-
y:
|
|
271
|
+
}, m = (i) => {
|
|
272
|
+
o && h.value && s({
|
|
273
|
+
x: i.pageX - d.value.diffX,
|
|
274
|
+
y: i.pageY - d.value.diffY
|
|
275
275
|
}, "move");
|
|
276
276
|
}, C = () => {
|
|
277
|
-
if (o &&
|
|
277
|
+
if (o && h.value) {
|
|
278
278
|
v(!1);
|
|
279
|
-
const { transformX:
|
|
280
|
-
if (!(n.value.x !==
|
|
279
|
+
const { transformX: i, transformY: a } = d.value;
|
|
280
|
+
if (!(n.value.x !== i && n.value.y !== a))
|
|
281
281
|
return;
|
|
282
|
-
const
|
|
283
|
-
|
|
282
|
+
const p = e.value.offsetWidth * n.value.scale, y = e.value.offsetHeight * n.value.scale, { left: S, top: L } = e.value.getBoundingClientRect(), A = n.value.rotate % 180 !== 0, z = He(A ? y : p, A ? p : y, S, L);
|
|
283
|
+
z && s({ ...z }, "dragRebound");
|
|
284
284
|
}
|
|
285
|
-
}, x = (
|
|
286
|
-
if (!o ||
|
|
285
|
+
}, x = (i) => {
|
|
286
|
+
if (!o || i.deltaY === 0)
|
|
287
287
|
return;
|
|
288
|
-
const
|
|
289
|
-
let
|
|
290
|
-
|
|
288
|
+
const a = Math.abs(i.deltaY / 100), w = Math.min(a, At);
|
|
289
|
+
let p = V + w * r.value;
|
|
290
|
+
i.deltaY > 0 && (p = V / p), c(p, "wheel", i.clientX, i.clientY);
|
|
291
291
|
};
|
|
292
|
-
return
|
|
293
|
-
let
|
|
292
|
+
return ye(() => {
|
|
293
|
+
let i, a, w, p;
|
|
294
294
|
if (t) {
|
|
295
|
-
w =
|
|
295
|
+
w = G(window, "mouseup", C, !1), p = G(window, "mousemove", m, !1);
|
|
296
296
|
try {
|
|
297
|
-
window.top !== window.self && (
|
|
297
|
+
window.top !== window.self && (i = G(window.top, "mouseup", C, !1), a = G(window.top, "mousemove", m, !1));
|
|
298
298
|
} catch (y) {
|
|
299
299
|
Tt(!1, `[rc-image] ${y}`);
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
return () => {
|
|
303
|
-
w?.remove(),
|
|
303
|
+
w?.remove(), p?.remove(), i?.remove(), a?.remove();
|
|
304
304
|
};
|
|
305
|
-
}, [o,
|
|
306
|
-
isMoving:
|
|
305
|
+
}, [o, h, () => n.value.x, () => n.value.y, () => n.value.rotate, t]), {
|
|
306
|
+
isMoving: h,
|
|
307
307
|
onMouseDown: g,
|
|
308
308
|
onMouseMove: m,
|
|
309
309
|
onMouseUp: C,
|
|
310
310
|
onWheel: x
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
const o = e.x - t.x,
|
|
315
|
-
return Math.hypot(o,
|
|
313
|
+
function re(e, t) {
|
|
314
|
+
const o = e.x - t.x, r = e.y - t.y;
|
|
315
|
+
return Math.hypot(o, r);
|
|
316
316
|
}
|
|
317
|
-
function Dt(e, t, o,
|
|
318
|
-
const n =
|
|
319
|
-
if (n === 0 &&
|
|
317
|
+
function Dt(e, t, o, r) {
|
|
318
|
+
const n = re(e, o), s = re(t, r);
|
|
319
|
+
if (n === 0 && s === 0)
|
|
320
320
|
return [e.x, e.y];
|
|
321
|
-
const c = n / (n +
|
|
322
|
-
return [
|
|
321
|
+
const c = n / (n + s), h = e.x + c * (t.x - e.x), v = e.y + c * (t.y - e.y);
|
|
322
|
+
return [h, v];
|
|
323
323
|
}
|
|
324
|
-
function Rt(e, t, o,
|
|
325
|
-
const [
|
|
324
|
+
function Rt(e, t, o, r, n, s, c) {
|
|
325
|
+
const [h, v] = ee(!1), d = $({
|
|
326
326
|
point1: { x: 0, y: 0 },
|
|
327
327
|
point2: { x: 0, y: 0 },
|
|
328
328
|
eventType: "none"
|
|
329
|
-
}), g = (
|
|
329
|
+
}), g = (i) => {
|
|
330
330
|
d.value = {
|
|
331
331
|
...d.value,
|
|
332
|
-
...
|
|
332
|
+
...i
|
|
333
333
|
};
|
|
334
|
-
}, m = (
|
|
334
|
+
}, m = (i) => {
|
|
335
335
|
if (!t.value)
|
|
336
336
|
return;
|
|
337
|
-
|
|
338
|
-
const { touches:
|
|
339
|
-
|
|
340
|
-
point1: { x:
|
|
341
|
-
point2: { x:
|
|
337
|
+
i.stopPropagation(), v(!0);
|
|
338
|
+
const { touches: a = [] } = i;
|
|
339
|
+
a.length > 1 ? g({
|
|
340
|
+
point1: { x: a[0].clientX, y: a[0].clientY },
|
|
341
|
+
point2: { x: a[1].clientX, y: a[1].clientY },
|
|
342
342
|
eventType: "touchZoom"
|
|
343
343
|
}) : g({
|
|
344
344
|
point1: {
|
|
345
|
-
x:
|
|
346
|
-
y:
|
|
345
|
+
x: a[0].clientX - n.value.x,
|
|
346
|
+
y: a[0].clientY - n.value.y
|
|
347
347
|
},
|
|
348
348
|
eventType: "move"
|
|
349
349
|
});
|
|
350
|
-
}, C = (
|
|
351
|
-
const { touches:
|
|
352
|
-
if (
|
|
350
|
+
}, C = (i) => {
|
|
351
|
+
const { touches: a = [] } = i, { point1: w, point2: p, eventType: y } = d.value;
|
|
352
|
+
if (a.length > 1 && y === "touchZoom") {
|
|
353
353
|
const S = {
|
|
354
|
-
x:
|
|
355
|
-
y:
|
|
354
|
+
x: a[0].clientX,
|
|
355
|
+
y: a[0].clientY
|
|
356
356
|
}, L = {
|
|
357
|
-
x:
|
|
358
|
-
y:
|
|
359
|
-
}, [
|
|
360
|
-
c(I, "touchZoom",
|
|
357
|
+
x: a[1].clientX,
|
|
358
|
+
y: a[1].clientY
|
|
359
|
+
}, [A, z] = Dt(w, p, S, L), I = re(S, L) / re(w, p);
|
|
360
|
+
c(I, "touchZoom", A, z, !0), g({
|
|
361
361
|
point1: S,
|
|
362
362
|
point2: L,
|
|
363
363
|
eventType: "touchZoom"
|
|
364
364
|
});
|
|
365
|
-
} else y === "move" && (
|
|
366
|
-
x:
|
|
367
|
-
y:
|
|
365
|
+
} else y === "move" && (s({
|
|
366
|
+
x: a[0].clientX - w.x,
|
|
367
|
+
y: a[0].clientY - w.y
|
|
368
368
|
}, "move"), g({ eventType: "move" }));
|
|
369
369
|
}, x = () => {
|
|
370
370
|
if (!o.value)
|
|
371
371
|
return;
|
|
372
|
-
if (
|
|
373
|
-
return
|
|
374
|
-
const
|
|
375
|
-
S &&
|
|
372
|
+
if (h && v(!1), g({ eventType: "none" }), r.value > n.value.scale)
|
|
373
|
+
return s({ x: 0, y: 0, scale: r.value }, "touchZoom");
|
|
374
|
+
const i = e.value.offsetWidth * n.value.scale, a = e.value.offsetHeight * n.value.scale, { left: w, top: p } = e.value.getBoundingClientRect(), y = n.value.rotate % 180 !== 0, S = He(y ? a : i, y ? i : a, w, p);
|
|
375
|
+
S && s({ ...S }, "dragRebound");
|
|
376
376
|
};
|
|
377
|
-
return
|
|
378
|
-
let
|
|
379
|
-
return o.value && t.value && (
|
|
377
|
+
return ye(() => {
|
|
378
|
+
let i;
|
|
379
|
+
return o.value && t.value && (i = G(window, "touchmove", (a) => a.preventDefault(), {
|
|
380
380
|
passive: !1
|
|
381
381
|
})), () => {
|
|
382
|
-
|
|
382
|
+
i?.remove();
|
|
383
383
|
};
|
|
384
384
|
}, [o, t]), {
|
|
385
|
-
isTouching:
|
|
385
|
+
isTouching: h,
|
|
386
386
|
onTouchStart: m,
|
|
387
387
|
onTouchMove: C,
|
|
388
388
|
onTouchEnd: x
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
|
-
const
|
|
391
|
+
const Pt = /* @__PURE__ */ we({
|
|
392
392
|
name: "Operations",
|
|
393
393
|
inheritAttrs: !1,
|
|
394
394
|
props: {
|
|
@@ -405,86 +405,86 @@ const Nt = /* @__PURE__ */ Ce({
|
|
|
405
405
|
showProgress: Boolean,
|
|
406
406
|
prefixCls: String,
|
|
407
407
|
hashId: String,
|
|
408
|
-
zIndex:
|
|
409
|
-
icons:
|
|
410
|
-
infinite:
|
|
411
|
-
getContainer:
|
|
412
|
-
countRender:
|
|
408
|
+
zIndex: U.zIndex,
|
|
409
|
+
icons: U.icons,
|
|
410
|
+
infinite: U.infinite,
|
|
411
|
+
getContainer: U.getContainer,
|
|
412
|
+
countRender: U.countRender,
|
|
413
413
|
tools: Array,
|
|
414
414
|
onClose: Function,
|
|
415
415
|
onActive: Function
|
|
416
416
|
},
|
|
417
417
|
setup(e) {
|
|
418
|
-
const t = (o,
|
|
419
|
-
o.preventDefault(), o.stopPropagation(), e.onActive?.(
|
|
418
|
+
const t = (o, r) => {
|
|
419
|
+
o.preventDefault(), o.stopPropagation(), e.onActive?.(r);
|
|
420
420
|
};
|
|
421
421
|
return () => {
|
|
422
422
|
const {
|
|
423
423
|
prefixCls: o,
|
|
424
|
-
hashId:
|
|
424
|
+
hashId: r,
|
|
425
425
|
tools: n
|
|
426
|
-
} = e,
|
|
427
|
-
return
|
|
426
|
+
} = e, s = he(`${e.prefixCls}-fade`), c = `${o}-operations-operation`, h = `${o}-operations-icon`;
|
|
427
|
+
return u(Te, {
|
|
428
428
|
to: e.getContainer || "body"
|
|
429
429
|
}, {
|
|
430
|
-
default: () => [
|
|
431
|
-
default: () => [
|
|
432
|
-
class: X(`${o}-operations-wrapper`,
|
|
430
|
+
default: () => [u(ge, s, {
|
|
431
|
+
default: () => [me(u("div", {
|
|
432
|
+
class: X(`${o}-operations-wrapper`, r),
|
|
433
433
|
style: {
|
|
434
434
|
zIndex: e.zIndex
|
|
435
435
|
}
|
|
436
|
-
}, [e.icons?.close === null ? null :
|
|
437
|
-
class: `${o}-close ${
|
|
436
|
+
}, [e.icons?.close === null ? null : u("button", {
|
|
437
|
+
class: `${o}-close ${r}`,
|
|
438
438
|
onClick: e.onClose
|
|
439
|
-
}, [e.icons?.close ||
|
|
440
|
-
class: X(`${o}-switch-left ${
|
|
439
|
+
}, [e.icons?.close || u(rt, null, null)]), e.showSwitch && u(le, null, [u("div", {
|
|
440
|
+
class: X(`${o}-switch-left ${r}`, {
|
|
441
441
|
[`${o}-switch-left-disabled`]: e.infinite ? !1 : e.current === 0
|
|
442
442
|
}),
|
|
443
443
|
onClick: (v) => t(v, -1)
|
|
444
|
-
}, [e.icons?.left ||
|
|
445
|
-
class: X(`${o}-switch-right ${
|
|
444
|
+
}, [e.icons?.left || u(st, null, null)]), u("div", {
|
|
445
|
+
class: X(`${o}-switch-right ${r}`, {
|
|
446
446
|
[`${o}-switch-right-disabled`]: e.infinite ? !1 : e.current === e.count - 1
|
|
447
447
|
}),
|
|
448
448
|
onClick: (v) => t(v, 1)
|
|
449
|
-
}, [e.icons?.right ||
|
|
450
|
-
class: `${o}-footer ${
|
|
451
|
-
}, [e.showProgress &&
|
|
449
|
+
}, [e.icons?.right || u(ut, null, null)])]), u("div", {
|
|
450
|
+
class: `${o}-footer ${r}`
|
|
451
|
+
}, [e.showProgress && u("div", {
|
|
452
452
|
class: `${o}-progress`
|
|
453
|
-
}, [e.countRender ? e.countRender(e.current + 1, e.count) : `${e.current + 1} / ${e.count}`]),
|
|
453
|
+
}, [e.countRender ? e.countRender(e.current + 1, e.count) : `${e.current + 1} / ${e.count}`]), u("div", {
|
|
454
454
|
class: `${e.prefixCls}-operations`
|
|
455
455
|
}, [n?.map(({
|
|
456
456
|
icon: v,
|
|
457
457
|
onClick: d,
|
|
458
458
|
type: g,
|
|
459
459
|
disabled: m
|
|
460
|
-
}) =>
|
|
460
|
+
}) => u("div", {
|
|
461
461
|
class: X(c, {
|
|
462
462
|
[`${e.prefixCls}-operations-operation-disabled`]: m && m?.value
|
|
463
463
|
}),
|
|
464
464
|
onClick: d,
|
|
465
465
|
key: g
|
|
466
|
-
}, [
|
|
467
|
-
class:
|
|
468
|
-
})]))])])]), [[
|
|
466
|
+
}, [nt(v, {
|
|
467
|
+
class: h
|
|
468
|
+
})]))])])]), [[pe, e.open]])]
|
|
469
469
|
})]
|
|
470
470
|
});
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
|
-
}),
|
|
473
|
+
}), Nt = new se("viewFadeIn", {
|
|
474
474
|
"0%": {
|
|
475
475
|
opacity: 0
|
|
476
476
|
},
|
|
477
477
|
"100%": {
|
|
478
478
|
opacity: 1
|
|
479
479
|
}
|
|
480
|
-
}), Xt = new
|
|
480
|
+
}), Xt = new se("viewFadeOut", {
|
|
481
481
|
"0%": {
|
|
482
482
|
opacity: 1
|
|
483
483
|
},
|
|
484
484
|
"100%": {
|
|
485
485
|
opacity: 0
|
|
486
486
|
}
|
|
487
|
-
}), Yt = new
|
|
487
|
+
}), Yt = new se("viewZoomBadgeIn", {
|
|
488
488
|
"0%": {
|
|
489
489
|
transform: "scale(0)",
|
|
490
490
|
opacity: 0
|
|
@@ -493,7 +493,7 @@ const Nt = /* @__PURE__ */ Ce({
|
|
|
493
493
|
transform: "scale(1)",
|
|
494
494
|
opacity: 1
|
|
495
495
|
}
|
|
496
|
-
}), jt = new
|
|
496
|
+
}), jt = new se("viewZoomBadgeOut", {
|
|
497
497
|
"0%": {
|
|
498
498
|
transform: "scale(1)"
|
|
499
499
|
},
|
|
@@ -501,11 +501,11 @@ const Nt = /* @__PURE__ */ Ce({
|
|
|
501
501
|
transform: "scale(0)",
|
|
502
502
|
opacity: 0
|
|
503
503
|
}
|
|
504
|
-
}),
|
|
504
|
+
}), Me = (e) => ({
|
|
505
505
|
position: e || "absolute",
|
|
506
506
|
inset: 0
|
|
507
507
|
});
|
|
508
|
-
function
|
|
508
|
+
function de(e) {
|
|
509
509
|
return {
|
|
510
510
|
position: e,
|
|
511
511
|
top: 0,
|
|
@@ -515,11 +515,11 @@ function ge(e) {
|
|
|
515
515
|
};
|
|
516
516
|
}
|
|
517
517
|
const Bt = (e) => {
|
|
518
|
-
const { previewCls: t, modalMaskBg: o, marginXL:
|
|
518
|
+
const { previewCls: t, modalMaskBg: o, marginXL: r, margin: n, colorTextLightSolid: s, previewOperationColorDisabled: c, previewOperationHoverColor: h, motionDurationSlow: v, iconCls: d } = e, g = new F(o).setAlpha(0.1), m = g.clone().setAlpha(0.2), C = new F(o).setAlpha(0.5), x = new F(o).setAlpha(0.03);
|
|
519
519
|
return {
|
|
520
520
|
[`${t}-footer`]: {
|
|
521
521
|
position: "fixed",
|
|
522
|
-
bottom:
|
|
522
|
+
bottom: r,
|
|
523
523
|
left: {
|
|
524
524
|
_skip_check_: !0,
|
|
525
525
|
value: "50%"
|
|
@@ -535,15 +535,15 @@ const Bt = (e) => {
|
|
|
535
535
|
},
|
|
536
536
|
[`${t}-close`]: {
|
|
537
537
|
position: "fixed",
|
|
538
|
-
top:
|
|
538
|
+
top: r,
|
|
539
539
|
right: {
|
|
540
540
|
_skip_check_: !0,
|
|
541
|
-
value:
|
|
541
|
+
value: r
|
|
542
542
|
},
|
|
543
543
|
display: "flex",
|
|
544
544
|
alignItems: "center",
|
|
545
545
|
justifyContent: "center",
|
|
546
|
-
color:
|
|
546
|
+
color: s,
|
|
547
547
|
backgroundColor: g.toRgbString(),
|
|
548
548
|
borderRadius: e.borderRadiusLG,
|
|
549
549
|
backdropFilter: "saturate(180%) blur(10px)",
|
|
@@ -576,12 +576,12 @@ const Bt = (e) => {
|
|
|
576
576
|
width: e.sizeXL + 4,
|
|
577
577
|
height: e.sizeXL + 4,
|
|
578
578
|
cursor: "pointer",
|
|
579
|
-
color:
|
|
579
|
+
color: s,
|
|
580
580
|
borderRadius: e.borderRadiusSM,
|
|
581
581
|
transition: `all ${v}`,
|
|
582
582
|
userSelect: "none",
|
|
583
583
|
[`&:not(${t}-operations-operation-disabled):hover > ${d}`]: {
|
|
584
|
-
color:
|
|
584
|
+
color: h
|
|
585
585
|
},
|
|
586
586
|
"&:hover": {
|
|
587
587
|
backgroundColor: x.toRgbString()
|
|
@@ -600,12 +600,12 @@ const Bt = (e) => {
|
|
|
600
600
|
}
|
|
601
601
|
};
|
|
602
602
|
}, Ft = (e) => {
|
|
603
|
-
const { modalMaskBg: t, iconCls: o, previewOperationColorDisabled:
|
|
603
|
+
const { modalMaskBg: t, iconCls: o, previewOperationColorDisabled: r, previewCls: n, zIndexPopup: s, motionDurationSlow: c, colorTextLightSolid: h } = e, v = new F(t).setAlpha(0.1), d = v.clone().setAlpha(0.2);
|
|
604
604
|
return {
|
|
605
605
|
[`${n}-switch-left, ${n}-switch-right`]: {
|
|
606
606
|
position: "fixed",
|
|
607
607
|
insetBlockStart: "50%",
|
|
608
|
-
zIndex: e.calc(
|
|
608
|
+
zIndex: e.calc(s).add(1).equal(),
|
|
609
609
|
display: "flex",
|
|
610
610
|
alignItems: "center",
|
|
611
611
|
justifyContent: "center",
|
|
@@ -614,7 +614,7 @@ const Bt = (e) => {
|
|
|
614
614
|
width: e.imagePreviewSwitchSize,
|
|
615
615
|
height: e.imagePreviewSwitchSize,
|
|
616
616
|
marginTop: e.calc(e.imagePreviewSwitchSize).mul(-1).div(2).equal(),
|
|
617
|
-
color:
|
|
617
|
+
color: h,
|
|
618
618
|
background: v.toRgbString(),
|
|
619
619
|
transform: "translateY(-50%)",
|
|
620
620
|
cursor: "pointer",
|
|
@@ -625,7 +625,7 @@ const Bt = (e) => {
|
|
|
625
625
|
},
|
|
626
626
|
"&-disabled": {
|
|
627
627
|
"&, &:hover": {
|
|
628
|
-
color:
|
|
628
|
+
color: r,
|
|
629
629
|
background: "transparent",
|
|
630
630
|
cursor: "not-allowed",
|
|
631
631
|
[`> ${o}`]: {
|
|
@@ -652,28 +652,28 @@ const Bt = (e) => {
|
|
|
652
652
|
textAlign: "center",
|
|
653
653
|
pointerEvents: "none",
|
|
654
654
|
"&-root": {
|
|
655
|
-
...
|
|
655
|
+
...de("fixed"),
|
|
656
656
|
zIndex: e.zIndexPopup,
|
|
657
657
|
overflow: "auto",
|
|
658
658
|
outline: 0,
|
|
659
659
|
WebkitOverflowScrolling: "touch"
|
|
660
660
|
},
|
|
661
661
|
"&-wrap": {
|
|
662
|
-
...
|
|
662
|
+
...de("fixed"),
|
|
663
663
|
zIndex: e.zIndexPopup,
|
|
664
664
|
overflow: "auto",
|
|
665
665
|
outline: 0,
|
|
666
666
|
WebkitOverflowScrolling: "touch"
|
|
667
667
|
},
|
|
668
668
|
"&-mask": {
|
|
669
|
-
...
|
|
669
|
+
...de("fixed"),
|
|
670
670
|
zIndex: e.zIndexPopupBase,
|
|
671
671
|
height: "100%",
|
|
672
672
|
backgroundColor: e.colorBgMask,
|
|
673
673
|
backdropFilter: "blur(8px)"
|
|
674
674
|
},
|
|
675
675
|
"&-body": {
|
|
676
|
-
...
|
|
676
|
+
...Me(),
|
|
677
677
|
overflow: "hidden"
|
|
678
678
|
},
|
|
679
679
|
"&-img": {
|
|
@@ -685,7 +685,7 @@ const Bt = (e) => {
|
|
|
685
685
|
transition: `transform ${o} ${t} 0s`,
|
|
686
686
|
userSelect: "none",
|
|
687
687
|
"&-wrapper": {
|
|
688
|
-
...
|
|
688
|
+
...Me(),
|
|
689
689
|
transition: `transform ${o} ${t} 0s`,
|
|
690
690
|
display: "flex",
|
|
691
691
|
justifyContent: "center",
|
|
@@ -711,7 +711,7 @@ const Bt = (e) => {
|
|
|
711
711
|
}
|
|
712
712
|
},
|
|
713
713
|
"&-mask-zoom-appear, &-mask-zoom-enter": {
|
|
714
|
-
animationName:
|
|
714
|
+
animationName: Nt,
|
|
715
715
|
animationDuration: e.motionDurationSlow,
|
|
716
716
|
animationTimingFunction: "linear",
|
|
717
717
|
userSelect: "none"
|
|
@@ -757,7 +757,7 @@ const Bt = (e) => {
|
|
|
757
757
|
};
|
|
758
758
|
};
|
|
759
759
|
function Ht(e) {
|
|
760
|
-
return
|
|
760
|
+
return mt("ImageViewer", (t) => {
|
|
761
761
|
const o = pt(t, {
|
|
762
762
|
zIndexPopup: t.zIndexPopupBase + 80,
|
|
763
763
|
previewOperationColor: new F(t.colorTextLightSolid).setAlpha(0.65).toRgbString(),
|
|
@@ -774,7 +774,7 @@ function Ht(e) {
|
|
|
774
774
|
return [kt(o)];
|
|
775
775
|
}, e);
|
|
776
776
|
}
|
|
777
|
-
const
|
|
777
|
+
const fe = {
|
|
778
778
|
/**
|
|
779
779
|
* ESC
|
|
780
780
|
*/
|
|
@@ -789,18 +789,18 @@ const me = {
|
|
|
789
789
|
* RIGHT
|
|
790
790
|
*/
|
|
791
791
|
RIGHT: 39
|
|
792
|
-
},
|
|
793
|
-
rotateLeft:
|
|
794
|
-
rotateRight:
|
|
795
|
-
zoomIn:
|
|
796
|
-
zoomOut:
|
|
797
|
-
flipX:
|
|
798
|
-
flipY:
|
|
792
|
+
}, _ = {
|
|
793
|
+
rotateLeft: u(vt, null, null),
|
|
794
|
+
rotateRight: u(ft, null, null),
|
|
795
|
+
zoomIn: u(dt, null, null),
|
|
796
|
+
zoomOut: u(ct, null, null),
|
|
797
|
+
flipX: u(be, null, null),
|
|
798
|
+
flipY: u(be, {
|
|
799
799
|
rotate: 90
|
|
800
800
|
}, null)
|
|
801
|
-
}, Zt = /* @__PURE__ */
|
|
801
|
+
}, Zt = /* @__PURE__ */ we({
|
|
802
802
|
name: "GImagePreview",
|
|
803
|
-
props:
|
|
803
|
+
props: U,
|
|
804
804
|
inheritAttrs: !1,
|
|
805
805
|
slots: Object,
|
|
806
806
|
emits: {
|
|
@@ -811,229 +811,242 @@ const me = {
|
|
|
811
811
|
setup: (e, {
|
|
812
812
|
emit: t,
|
|
813
813
|
expose: o,
|
|
814
|
-
slots:
|
|
814
|
+
slots: r
|
|
815
815
|
}) => {
|
|
816
|
-
const n =
|
|
816
|
+
const n = Ee({
|
|
817
817
|
suffixCls: "image-view"
|
|
818
818
|
}), {
|
|
819
|
-
wrapSSR:
|
|
819
|
+
wrapSSR: s,
|
|
820
820
|
hashId: c
|
|
821
|
-
} = Ht(n), [
|
|
821
|
+
} = Ht(n), [h, v, d] = Mt(e.open, {
|
|
822
822
|
value: H(e, "open"),
|
|
823
|
-
onChange: (
|
|
824
|
-
e.onOpenChange?.(
|
|
823
|
+
onChange: (l) => {
|
|
824
|
+
e.onOpenChange?.(l), t("update:open", l);
|
|
825
825
|
}
|
|
826
|
-
}), [g, m] =
|
|
827
|
-
transform:
|
|
826
|
+
}), [g, m] = ee(!1), [C, x] = ee(!0), i = $(), {
|
|
827
|
+
transform: a,
|
|
828
828
|
resetTransform: w,
|
|
829
|
-
updateTransform:
|
|
829
|
+
updateTransform: p,
|
|
830
830
|
dispatchZoomChange: y
|
|
831
|
-
} = Ot(
|
|
831
|
+
} = Ot(i, H(e, "minScale"), H(e, "maxScale"), e.onTransform), {
|
|
832
832
|
isMoving: S,
|
|
833
833
|
onMouseDown: L,
|
|
834
|
-
onWheel:
|
|
835
|
-
} = Et(
|
|
836
|
-
isTouching:
|
|
834
|
+
onWheel: A
|
|
835
|
+
} = Et(i, H(e, "movable"), d, H(e, "scaleStep"), a, p, y), {
|
|
836
|
+
isTouching: z,
|
|
837
837
|
onTouchStart: I,
|
|
838
838
|
onTouchMove: k,
|
|
839
|
-
onTouchEnd:
|
|
840
|
-
} = Rt(
|
|
841
|
-
|
|
839
|
+
onTouchEnd: Z
|
|
840
|
+
} = Rt(i, H(e, "movable"), d, H(e, "minScale"), a, p, y);
|
|
841
|
+
ye(() => {
|
|
842
842
|
C.value || x(!0);
|
|
843
843
|
}, [C]);
|
|
844
|
-
const R = $(null),
|
|
845
|
-
url:
|
|
846
|
-
}]) => [
|
|
847
|
-
|
|
848
|
-
|
|
844
|
+
const R = $(null), M = $(e.current), P = ot(/* @__PURE__ */ new Map()), Y = b(() => new Map(Array.from(P).map(([l, {
|
|
845
|
+
url: T
|
|
846
|
+
}]) => [l, T]))), W = b(() => Y.value.get(M.value)), j = b(() => Y.value.size), B = b(() => Array.from(Y.value.keys())), E = b(() => B.value.indexOf(M.value)), f = b(() => j.value > 1), N = b(() => j.value >= 1);
|
|
847
|
+
K(d, (l) => {
|
|
848
|
+
l && (g.value = !0);
|
|
849
849
|
});
|
|
850
|
-
const
|
|
851
|
-
|
|
850
|
+
const O = (l) => {
|
|
851
|
+
M.value = l;
|
|
852
852
|
};
|
|
853
|
-
|
|
854
|
-
|
|
853
|
+
K(() => e.current, (l) => {
|
|
854
|
+
De(l) && O(l);
|
|
855
855
|
});
|
|
856
|
-
function
|
|
857
|
-
|
|
858
|
-
url:
|
|
856
|
+
function te(l, T) {
|
|
857
|
+
P.set(l, {
|
|
858
|
+
url: T,
|
|
859
859
|
loading: !0,
|
|
860
860
|
canPreview: !1
|
|
861
861
|
});
|
|
862
862
|
}
|
|
863
|
-
const
|
|
863
|
+
const ue = () => {
|
|
864
864
|
m(!1);
|
|
865
|
-
},
|
|
865
|
+
}, Ze = () => {
|
|
866
866
|
w("close"), t("close");
|
|
867
|
-
},
|
|
868
|
-
S.value || R.value ===
|
|
869
|
-
},
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
},
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
},
|
|
876
|
-
if (
|
|
877
|
-
const
|
|
878
|
-
|
|
867
|
+
}, We = (l) => {
|
|
868
|
+
S.value || R.value === l?.target && ue();
|
|
869
|
+
}, _e = () => {
|
|
870
|
+
const l = P.get(M.value);
|
|
871
|
+
l && (l.loading = !1, l.canPreview = !0);
|
|
872
|
+
}, Ue = (l) => {
|
|
873
|
+
const T = P.get(M.value);
|
|
874
|
+
T && (T.loading = !1, T.canPreview = !1), l.target.alt = "加载失败";
|
|
875
|
+
}, Ce = () => {
|
|
876
|
+
if (E.value > 0 || e.infinite) {
|
|
877
|
+
const l = E.value - 1 < 0 ? e.urls.length - 1 : E.value - 1;
|
|
878
|
+
O(B.value[l]), w("prev");
|
|
879
879
|
}
|
|
880
|
-
},
|
|
881
|
-
if (
|
|
882
|
-
const
|
|
883
|
-
|
|
880
|
+
}, xe = () => {
|
|
881
|
+
if (E.value < j.value - 1 || e.infinite) {
|
|
882
|
+
const l = E.value + 1 > e.urls.length - 1 ? 0 : E.value + 1;
|
|
883
|
+
O(B.value[l]), w("next");
|
|
884
884
|
}
|
|
885
|
+
}, Ge = () => {
|
|
886
|
+
y(V + e.scaleStep, "zoomIn");
|
|
885
887
|
}, Ve = () => {
|
|
886
|
-
y(
|
|
888
|
+
y(V / (V + e.scaleStep), "zoomOut");
|
|
887
889
|
}, qe = () => {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
h({
|
|
891
|
-
rotate: l.value.rotate + 90
|
|
890
|
+
p({
|
|
891
|
+
rotate: a.value.rotate + 90
|
|
892
892
|
}, "rotateRight");
|
|
893
|
-
},
|
|
894
|
-
|
|
895
|
-
rotate:
|
|
893
|
+
}, Ke = () => {
|
|
894
|
+
p({
|
|
895
|
+
rotate: a.value.rotate - 90
|
|
896
896
|
}, "rotateLeft");
|
|
897
|
-
},
|
|
898
|
-
|
|
899
|
-
flipX: !
|
|
897
|
+
}, Qe = () => {
|
|
898
|
+
p({
|
|
899
|
+
flipX: !a.value.flipX
|
|
900
900
|
}, "flipX");
|
|
901
|
-
},
|
|
902
|
-
|
|
903
|
-
flipY: !
|
|
901
|
+
}, Je = () => {
|
|
902
|
+
p({
|
|
903
|
+
flipY: !a.value.flipY
|
|
904
904
|
}, "flipY");
|
|
905
|
-
},
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
905
|
+
}, Ie = () => {
|
|
906
|
+
const l = Re({
|
|
907
|
+
slots: r,
|
|
908
|
+
props: e.icons,
|
|
909
|
+
keys: ["flipY", "flipX", "rotateLeft", "rotateRight", "zoomOut", "zoomIn"],
|
|
910
|
+
render: !0,
|
|
911
|
+
defaultVNodes: [_.flipY, _.flipX, _.rotateLeft, _.rotateRight, _.zoomOut, _.zoomIn]
|
|
912
|
+
});
|
|
913
|
+
return [{
|
|
914
|
+
icon: l.flipY,
|
|
915
|
+
onClick: Je,
|
|
916
|
+
type: "flipY"
|
|
917
|
+
}, {
|
|
918
|
+
icon: l.flipX,
|
|
919
|
+
onClick: Qe,
|
|
920
|
+
type: "flipX"
|
|
921
|
+
}, {
|
|
922
|
+
icon: l.rotateLeft,
|
|
923
|
+
onClick: Ke,
|
|
924
|
+
type: "rotateLeft"
|
|
925
|
+
}, {
|
|
926
|
+
icon: l.rotateRight,
|
|
927
|
+
onClick: qe,
|
|
928
|
+
type: "rotateRight"
|
|
929
|
+
}, {
|
|
930
|
+
icon: l.zoomOut,
|
|
931
|
+
onClick: () => Ve(),
|
|
932
|
+
type: "zoomOut",
|
|
933
|
+
disabled: b(() => a.value.scale <= e.minScale)
|
|
934
|
+
}, {
|
|
935
|
+
icon: l.zoomIn,
|
|
936
|
+
onClick: () => Ge(),
|
|
937
|
+
type: "zoomIn",
|
|
938
|
+
disabled: b(() => a.value.scale === e.maxScale)
|
|
939
|
+
}];
|
|
940
|
+
}, et = (l) => {
|
|
941
|
+
d.value && (a.value.scale !== 1 ? p({
|
|
933
942
|
x: 0,
|
|
934
943
|
y: 0,
|
|
935
944
|
scale: 1
|
|
936
|
-
}, "doubleClick") : y(
|
|
937
|
-
},
|
|
938
|
-
|
|
945
|
+
}, "doubleClick") : y(V + e.scaleStep, "doubleClick", l.clientX, l.clientY));
|
|
946
|
+
}, tt = (l) => {
|
|
947
|
+
l.keyCode === fe.ESC && ue(), !(!d.value || !f.value) && (l.keyCode === fe.LEFT ? Ce() : l.keyCode === fe.RIGHT && xe());
|
|
939
948
|
};
|
|
940
|
-
let
|
|
949
|
+
let ce = () => {
|
|
941
950
|
};
|
|
942
|
-
return
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
951
|
+
return Ae(() => {
|
|
952
|
+
K(() => e.urls, (l) => {
|
|
953
|
+
yt(l) && l.forEach((T, ne) => {
|
|
954
|
+
te(ne, T);
|
|
946
955
|
});
|
|
947
956
|
}, {
|
|
948
957
|
flush: "post",
|
|
949
958
|
immediate: !0
|
|
950
|
-
}),
|
|
951
|
-
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
959
|
+
}), K([() => d.value, () => S.value], () => {
|
|
960
|
+
ce();
|
|
961
|
+
const l = G(window, "keydown", tt, !1);
|
|
962
|
+
ce = () => {
|
|
963
|
+
l.remove();
|
|
955
964
|
};
|
|
956
965
|
}, {
|
|
957
966
|
flush: "post",
|
|
958
967
|
immediate: !0
|
|
959
968
|
});
|
|
960
|
-
}),
|
|
961
|
-
|
|
969
|
+
}), it(() => {
|
|
970
|
+
ce();
|
|
962
971
|
}), o({
|
|
963
|
-
setOpen: (
|
|
964
|
-
v(
|
|
972
|
+
setOpen: (l) => {
|
|
973
|
+
v(l), M.value = e.current;
|
|
965
974
|
}
|
|
966
975
|
}), () => {
|
|
967
|
-
const
|
|
976
|
+
const l = he(`${n}-mask-zoom`), T = he(`${n}-zoom`), ne = {};
|
|
968
977
|
for (const D in e.icons)
|
|
969
|
-
|
|
970
|
-
return
|
|
978
|
+
ne[D] = getSlotVNode(r, e.icons, D);
|
|
979
|
+
return s(u(le, null, [u(Te, {
|
|
971
980
|
to: e.getContainer || "body"
|
|
972
981
|
}, {
|
|
973
|
-
default: () => [d.value &&
|
|
982
|
+
default: () => [d.value && u(le, null, [u("div", {
|
|
974
983
|
class: `${n}-root ${c.value}`
|
|
975
|
-
}, [
|
|
976
|
-
default: () => [
|
|
984
|
+
}, [u(ge, l, {
|
|
985
|
+
default: () => [me(u("div", {
|
|
977
986
|
class: `${n}-mask ${c.value}`
|
|
978
|
-
}, null), [[
|
|
979
|
-
}),
|
|
987
|
+
}, null), [[pe, d.value && g.value]])]
|
|
988
|
+
}), u("div", {
|
|
980
989
|
ref: R,
|
|
981
990
|
tabindex: -1,
|
|
982
991
|
class: [`${n}-wrap`, `${c.value}`, S.value && `${n}-moving`],
|
|
983
|
-
onClick: (D) => e.onHideOnClickModal &&
|
|
984
|
-
}, [
|
|
985
|
-
onAfterLeave: () =>
|
|
992
|
+
onClick: (D) => e.onHideOnClickModal && We(D)
|
|
993
|
+
}, [u(ge, ie(T, {
|
|
994
|
+
onAfterLeave: () => Ze()
|
|
986
995
|
}), {
|
|
987
|
-
default: () => [
|
|
996
|
+
default: () => [me(u("div", {
|
|
988
997
|
role: "dialog",
|
|
989
998
|
class: `${n} ${c.value}`
|
|
990
|
-
}, [
|
|
999
|
+
}, [u("div", {
|
|
991
1000
|
class: `${n}-content ${c.value}`
|
|
992
|
-
}, [
|
|
1001
|
+
}, [u("div", {
|
|
993
1002
|
class: `${n}-body ${c.value}`
|
|
994
|
-
}, [
|
|
1003
|
+
}, [u("div", {
|
|
995
1004
|
class: `${n}-img-wrapper ${c.value}`
|
|
996
|
-
}, [
|
|
997
|
-
ref:
|
|
1005
|
+
}, [u("img", {
|
|
1006
|
+
ref: i,
|
|
998
1007
|
class: `${n}-img ${c.value}`,
|
|
999
|
-
src:
|
|
1000
|
-
onLoad: () =>
|
|
1001
|
-
onError: (D) =>
|
|
1008
|
+
src: W.value,
|
|
1009
|
+
onLoad: () => _e(),
|
|
1010
|
+
onError: (D) => Ue(D),
|
|
1002
1011
|
style: {
|
|
1003
|
-
transform: `translate3d(${
|
|
1004
|
-
transitionDuration: !C.value ||
|
|
1012
|
+
transform: `translate3d(${a.value.x}px, ${a.value.y}px, 0) scale3d(${a.value.flipX ? "-" : ""}${a.value.scale}, ${a.value.flipY ? "-" : ""}${a.value.scale}, 1) rotate(${a.value.rotate}deg)`,
|
|
1013
|
+
transitionDuration: !C.value || z.value ? "0s" : void 0
|
|
1005
1014
|
},
|
|
1006
|
-
onWheel:
|
|
1015
|
+
onWheel: A,
|
|
1007
1016
|
onMousedown: L,
|
|
1008
|
-
onDblclick:
|
|
1017
|
+
onDblclick: et,
|
|
1009
1018
|
onTouchstart: I,
|
|
1010
1019
|
onTouchmove: k,
|
|
1011
|
-
onTouchend:
|
|
1012
|
-
onTouchcancel:
|
|
1013
|
-
}, null)])])])]), [[
|
|
1020
|
+
onTouchend: Z,
|
|
1021
|
+
onTouchcancel: Z
|
|
1022
|
+
}, null)])])])]), [[pe, d.value && g.value]])]
|
|
1014
1023
|
})])])])]
|
|
1015
|
-
}), d.value && g.value &&
|
|
1024
|
+
}), d.value && g.value && u(Pt, {
|
|
1016
1025
|
open: d.value && g.value,
|
|
1017
1026
|
hashId: c.value,
|
|
1018
1027
|
count: e.urls.length,
|
|
1019
|
-
current:
|
|
1028
|
+
current: M.value,
|
|
1020
1029
|
zIndex: e.zIndex + 1,
|
|
1021
1030
|
getContainer: e.getContainer,
|
|
1022
1031
|
prefixCls: n,
|
|
1023
|
-
icons:
|
|
1032
|
+
icons: Ne(ne, Ie().map(({
|
|
1024
1033
|
type: D
|
|
1025
1034
|
}) => D)),
|
|
1026
|
-
tools:
|
|
1035
|
+
tools: Ie(),
|
|
1027
1036
|
infinite: e.infinite,
|
|
1028
|
-
countRender:
|
|
1037
|
+
countRender: St({
|
|
1038
|
+
slots: r,
|
|
1039
|
+
props: e,
|
|
1040
|
+
key: "countRender"
|
|
1041
|
+
}),
|
|
1029
1042
|
showSwitch: f.value,
|
|
1030
|
-
showProgress:
|
|
1031
|
-
onClose:
|
|
1032
|
-
onActive: (D) => D > 0 ?
|
|
1043
|
+
showProgress: N.value,
|
|
1044
|
+
onClose: ue,
|
|
1045
|
+
onActive: (D) => D > 0 ? xe() : Ce()
|
|
1033
1046
|
}, null)]));
|
|
1034
1047
|
};
|
|
1035
1048
|
}
|
|
1036
|
-
}),
|
|
1049
|
+
}), ve = {
|
|
1037
1050
|
width: "100%",
|
|
1038
1051
|
height: "100%"
|
|
1039
1052
|
}, Wt = {
|
|
@@ -1041,7 +1054,7 @@ const me = {
|
|
|
1041
1054
|
whiteSpace: "nowrap",
|
|
1042
1055
|
textOverflow: "ellipsis"
|
|
1043
1056
|
}, _t = (e) => {
|
|
1044
|
-
const { motionDurationSlow: t, paddingXXS: o, marginXXS:
|
|
1057
|
+
const { motionDurationSlow: t, paddingXXS: o, marginXXS: r, colorTextLightSolid: n } = e, s = ".anticon";
|
|
1045
1058
|
return {
|
|
1046
1059
|
position: "absolute",
|
|
1047
1060
|
inset: 0,
|
|
@@ -1049,15 +1062,15 @@ const me = {
|
|
|
1049
1062
|
alignItems: "center",
|
|
1050
1063
|
justifyContent: "center",
|
|
1051
1064
|
color: n,
|
|
1052
|
-
background: new
|
|
1065
|
+
background: new ht("#000").setA(0.5).toRgbString(),
|
|
1053
1066
|
cursor: "pointer",
|
|
1054
1067
|
opacity: 0,
|
|
1055
1068
|
transition: `opacity ${t}`,
|
|
1056
1069
|
[`.${e.componentCls}-mask-info`]: {
|
|
1057
1070
|
...Wt,
|
|
1058
|
-
padding: `0 ${
|
|
1059
|
-
[
|
|
1060
|
-
marginInlineEnd:
|
|
1071
|
+
padding: `0 ${Q(o)}`,
|
|
1072
|
+
[s]: {
|
|
1073
|
+
marginInlineEnd: r,
|
|
1061
1074
|
svg: {
|
|
1062
1075
|
verticalAlign: "baseline"
|
|
1063
1076
|
}
|
|
@@ -1073,7 +1086,7 @@ const me = {
|
|
|
1073
1086
|
position: "relative",
|
|
1074
1087
|
overflow: "hidden",
|
|
1075
1088
|
[`${e.componentCls}-img`]: {
|
|
1076
|
-
...
|
|
1089
|
+
...ve,
|
|
1077
1090
|
verticalAlign: "top",
|
|
1078
1091
|
opacity: 1,
|
|
1079
1092
|
[`&${e.componentCls}-img-preview`]: {
|
|
@@ -1081,7 +1094,7 @@ const me = {
|
|
|
1081
1094
|
cursor: "pointer"
|
|
1082
1095
|
},
|
|
1083
1096
|
"&-placeholder": {
|
|
1084
|
-
...
|
|
1097
|
+
...ve,
|
|
1085
1098
|
backgroundColor: e.colorBgContainerDisabled,
|
|
1086
1099
|
backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
|
|
1087
1100
|
backgroundRepeat: "no-repeat",
|
|
@@ -1090,7 +1103,7 @@ const me = {
|
|
|
1090
1103
|
}
|
|
1091
1104
|
},
|
|
1092
1105
|
[`${e.componentCls}-error`]: {
|
|
1093
|
-
...
|
|
1106
|
+
...ve,
|
|
1094
1107
|
display: "flex",
|
|
1095
1108
|
alignItems: "center",
|
|
1096
1109
|
justifyContent: "center"
|
|
@@ -1106,9 +1119,9 @@ const me = {
|
|
|
1106
1119
|
}
|
|
1107
1120
|
}
|
|
1108
1121
|
}), Vt = (e) => typeof Element > "u" ? !1 : e instanceof Element;
|
|
1109
|
-
let
|
|
1110
|
-
const
|
|
1111
|
-
props:
|
|
1122
|
+
let Oe = "";
|
|
1123
|
+
const ae = /* @__PURE__ */ we({
|
|
1124
|
+
props: Xe,
|
|
1112
1125
|
name: "GImage",
|
|
1113
1126
|
inheritAttrs: !1,
|
|
1114
1127
|
emits: {
|
|
@@ -1120,49 +1133,49 @@ const se = /* @__PURE__ */ Ce({
|
|
|
1120
1133
|
setup(e, {
|
|
1121
1134
|
slots: t,
|
|
1122
1135
|
emit: o,
|
|
1123
|
-
attrs:
|
|
1136
|
+
attrs: r
|
|
1124
1137
|
}) {
|
|
1125
|
-
const n =
|
|
1138
|
+
const n = q && "loading" in HTMLImageElement.prototype, s = Ee({
|
|
1126
1139
|
suffixCls: "image"
|
|
1127
1140
|
}), {
|
|
1128
1141
|
wrapSSR: c,
|
|
1129
|
-
hashId:
|
|
1130
|
-
} =
|
|
1131
|
-
let
|
|
1132
|
-
const
|
|
1142
|
+
hashId: h
|
|
1143
|
+
} = wt("Image", [Gt], s), v = $(), d = $(), g = $(!1), m = $(!0), C = $(!1), x = $(), i = $();
|
|
1144
|
+
let a, w;
|
|
1145
|
+
const p = b(() => e.loading === "eager" ? !1 : !n && e.loading === "lazy" || e.lazy), y = b(() => q && e.fit ? {
|
|
1133
1146
|
...e.imageStyle,
|
|
1134
1147
|
objectFit: e.fit
|
|
1135
|
-
} : e.imageStyle), S = b(() => typeof e.preview == "object" ? e.preview : {}), L = b(() => !!e.preview),
|
|
1148
|
+
} : e.imageStyle), S = b(() => typeof e.preview == "object" ? e.preview : {}), L = b(() => !!e.preview), A = b(() => {
|
|
1136
1149
|
const {
|
|
1137
1150
|
urls: f = [],
|
|
1138
|
-
current:
|
|
1151
|
+
current: N = 0
|
|
1139
1152
|
} = S.value;
|
|
1140
|
-
if (
|
|
1141
|
-
const
|
|
1142
|
-
return
|
|
1143
|
-
}),
|
|
1144
|
-
|
|
1153
|
+
if (De(N)) return f.length >= N ? N : 0;
|
|
1154
|
+
const O = f.indexOf(e.src);
|
|
1155
|
+
return O >= 0 ? O : 0;
|
|
1156
|
+
}), z = b(() => Q(e.width)), I = b(() => Q(e.height)), k = () => {
|
|
1157
|
+
q && (m.value = !0, g.value = !1, d.value = e.src);
|
|
1145
1158
|
};
|
|
1146
|
-
function
|
|
1159
|
+
function Z(f) {
|
|
1147
1160
|
g.value || (m.value = !1, g.value = !1, o("load", f));
|
|
1148
1161
|
}
|
|
1149
1162
|
function R(f) {
|
|
1150
1163
|
m.value = !1, g.value = !0, o("error", f);
|
|
1151
1164
|
}
|
|
1152
|
-
function
|
|
1153
|
-
Ct(x.value,
|
|
1165
|
+
function M() {
|
|
1166
|
+
Ct(x.value, i.value) && (k(), W());
|
|
1154
1167
|
}
|
|
1155
|
-
const
|
|
1168
|
+
const P = bt(M, 200, !0);
|
|
1156
1169
|
async function Y() {
|
|
1157
|
-
if (!
|
|
1158
|
-
await
|
|
1170
|
+
if (!q) return;
|
|
1171
|
+
await lt();
|
|
1159
1172
|
const {
|
|
1160
1173
|
scrollContainer: f
|
|
1161
1174
|
} = e;
|
|
1162
|
-
Vt(f) ?
|
|
1175
|
+
Vt(f) ? i.value = f : xt(f) && f !== "" ? i.value = document.querySelector(f) ?? void 0 : x.value && (i.value = It(x.value)), i.value && (a = Le(i, "scroll", P), setTimeout(() => M(), 100));
|
|
1163
1176
|
}
|
|
1164
|
-
function
|
|
1165
|
-
!
|
|
1177
|
+
function W() {
|
|
1178
|
+
!q || !i.value || !P || (a?.(), i.value = void 0);
|
|
1166
1179
|
}
|
|
1167
1180
|
function j(f) {
|
|
1168
1181
|
if (f.ctrlKey) {
|
|
@@ -1173,78 +1186,77 @@ const se = /* @__PURE__ */ Ce({
|
|
|
1173
1186
|
}
|
|
1174
1187
|
}
|
|
1175
1188
|
const B = () => {
|
|
1176
|
-
o("click"), !(m.value || g.value) && L.value && (w =
|
|
1189
|
+
o("click"), !(m.value || g.value) && L.value && (w = Le("wheel", j, {
|
|
1177
1190
|
passive: !1
|
|
1178
|
-
}),
|
|
1179
|
-
},
|
|
1180
|
-
w?.(), document.body.style.overflow =
|
|
1191
|
+
}), Oe = document.body.style.overflow, document.body.style.overflow = "hidden", C.value = !0);
|
|
1192
|
+
}, E = () => {
|
|
1193
|
+
w?.(), document.body.style.overflow = Oe, C.value = !1;
|
|
1181
1194
|
};
|
|
1182
|
-
return
|
|
1183
|
-
|
|
1184
|
-
}),
|
|
1195
|
+
return K(() => e.src, () => {
|
|
1196
|
+
p.value ? (m.value = !0, g.value = !1, W(), Y()) : k();
|
|
1197
|
+
}), at(() => {
|
|
1185
1198
|
L.value && C.value ? v.value?.setOpen(!0) : v.value?.setOpen(!1);
|
|
1186
|
-
}),
|
|
1187
|
-
|
|
1199
|
+
}), Ae(() => {
|
|
1200
|
+
p.value ? Y() : k();
|
|
1188
1201
|
}), () => {
|
|
1189
|
-
const f =
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}), K = re(t, e, "placeholder", {
|
|
1202
|
+
const f = zt(Object.entries(r).filter(([te]) => /^(?:data-|on[A-Z])/i.test(te) || ["id", "style", "class"].includes(te))), N = Ne(r, Object.keys(f)), O = Re({
|
|
1203
|
+
slots: t,
|
|
1204
|
+
props: e,
|
|
1205
|
+
keys: ["fallback", "mask", "placeholder"],
|
|
1194
1206
|
render: !0
|
|
1195
1207
|
});
|
|
1196
|
-
return c(
|
|
1208
|
+
return c(u("div", ie({
|
|
1197
1209
|
class: {
|
|
1198
|
-
[`${
|
|
1199
|
-
[`${
|
|
1210
|
+
[`${h.value}`]: !0,
|
|
1211
|
+
[`${s}`]: !0
|
|
1200
1212
|
},
|
|
1201
1213
|
ref: x
|
|
1202
1214
|
}, f, {
|
|
1203
1215
|
style: {
|
|
1204
|
-
width:
|
|
1205
|
-
height:
|
|
1216
|
+
width: Q(e.size) || z.value,
|
|
1217
|
+
height: Q(e.size) || I.value,
|
|
1206
1218
|
...f.style || {}
|
|
1207
1219
|
}
|
|
1208
|
-
}), [g.value ?
|
|
1209
|
-
class: X(
|
|
1210
|
-
}, [
|
|
1220
|
+
}), [g.value ? u("div", {
|
|
1221
|
+
class: X(h.value, `${s}-error`)
|
|
1222
|
+
}, [O.fallback]) : u(le, null, [u("img", ie(N, {
|
|
1211
1223
|
src: d.value,
|
|
1212
1224
|
loading: e.loading,
|
|
1213
1225
|
style: y.value,
|
|
1214
|
-
class: X(
|
|
1215
|
-
[`${
|
|
1216
|
-
[`${
|
|
1226
|
+
class: X(h.value, e.imageClass, `${s}-img`, {
|
|
1227
|
+
[`${s}-img-placeholder`]: e.placeholder === !0,
|
|
1228
|
+
[`${s}-img-preview`]: L.value
|
|
1217
1229
|
}),
|
|
1218
1230
|
crossorigin: e.crossOrigin,
|
|
1219
|
-
width:
|
|
1231
|
+
width: z.value,
|
|
1220
1232
|
height: I.value,
|
|
1221
1233
|
onClick: B,
|
|
1222
|
-
onLoad:
|
|
1234
|
+
onLoad: Z,
|
|
1223
1235
|
onError: R
|
|
1224
|
-
}), null), m.value &&
|
|
1225
|
-
class: X(`${
|
|
1226
|
-
}, [
|
|
1227
|
-
class: X(`${
|
|
1236
|
+
}), null), m.value && u("div", {
|
|
1237
|
+
class: X(`${s}-placeholder`, h.value)
|
|
1238
|
+
}, [O.placeholder])]), S.value.mask && L.value && u("div", {
|
|
1239
|
+
class: X(`${s}-mask`, S.value.maskClass, h.value),
|
|
1228
1240
|
style: {
|
|
1229
1241
|
display: f.style?.display === "none" ? "none" : void 0
|
|
1230
1242
|
}
|
|
1231
|
-
}, [
|
|
1232
|
-
class: X(`${
|
|
1233
|
-
}, [
|
|
1243
|
+
}, [O.mask || u("div", {
|
|
1244
|
+
class: X(`${s}-mask-info`, h.value)
|
|
1245
|
+
}, [u(gt, null, null)])]), L.value && u(Zt, ie({
|
|
1234
1246
|
ref: v
|
|
1235
1247
|
}, S.value, {
|
|
1236
1248
|
urls: S.value.urls || [e.src],
|
|
1237
|
-
current:
|
|
1238
|
-
onClose: () =>
|
|
1249
|
+
current: A.value,
|
|
1250
|
+
onClose: () => E()
|
|
1239
1251
|
}), t)]));
|
|
1240
1252
|
};
|
|
1241
1253
|
}
|
|
1242
1254
|
});
|
|
1243
|
-
|
|
1244
|
-
|
|
1255
|
+
ae.isGImage = !0;
|
|
1256
|
+
ae.install = (e) => (e.component(ae.name, ae), e);
|
|
1245
1257
|
export {
|
|
1246
|
-
|
|
1258
|
+
ae as GImage,
|
|
1247
1259
|
Zt as GImagePreview,
|
|
1248
|
-
|
|
1249
|
-
|
|
1260
|
+
J as baseProps,
|
|
1261
|
+
Xe as imageProps
|
|
1250
1262
|
};
|