@gx-design-vue/image 0.2.0-beta.22 → 0.2.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Image.d.ts +61 -69
- package/dist/ImagePreview/Operations.d.ts +1 -1
- package/dist/ImagePreview/index.d.ts +7 -20
- package/dist/ImagePreview/props.d.ts +13 -8
- package/dist/image.js +286 -285
- package/dist/image.umd.cjs +1 -1
- package/dist/props.d.ts +22 -31
- package/package.json +2 -1
package/dist/image.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Z from "
|
|
2
|
-
import { ref as M, reactive as re, onMounted as De, defineComponent as Me, createVNode as r, Teleport as Ue, Transition as Se, withDirectives as he, Fragment as Ie, cloneVNode as Je, vShow as pe, shallowRef as V, computed as y, watch as j, onUnmounted as et, mergeProps as ze, watchEffect as tt, createTextVNode as nt, nextTick as ot } from "vue";
|
|
1
|
+
import { ref as N, reactive as ae, onMounted as De, defineComponent as ye, createVNode as r, Teleport as ze, Transition as ge, withDirectives as we, Fragment as Se, cloneVNode as Je, vShow as he, shallowRef as Z, computed as y, watch as H, onUnmounted as et, mergeProps as pe, watchEffect as tt, createTextVNode as nt, nextTick as ot } from "vue";
|
|
3
2
|
import { CloseOutlined as it, LeftOutlined as at, RightOutlined as lt, RotateLeftOutlined as rt, RotateRightOutlined as st, ZoomInOutlined as ct, ZoomOutOutlined as ut, SwapOutlined as xe } from "@ant-design/icons-vue";
|
|
4
|
-
import { classNames as
|
|
5
|
-
import { useState as Le, onMountedOrActivated as
|
|
6
|
-
import { Keyframe as
|
|
7
|
-
import { TinyColor as
|
|
8
|
-
import {
|
|
9
|
-
|
|
3
|
+
import { classNames as oe, getPrefixCls as Ue, isNumber as Ie, getSlotVNode as $, isArray as _e, getSlot as dt, isServer as ie, isInContainer as ft, getSlotsProps as vt, isString as mt, getScrollContainer as gt } from "@gx-design-vue/pro-utils";
|
|
4
|
+
import { useState as Le, onMountedOrActivated as wt } from "@gx-design-vue/pro-hooks";
|
|
5
|
+
import { Keyframe as re, useStyle as St, mergeToken as ht, unit as pt, getTransitionProps as Ee, useProStyle as It } from "@gx-design-vue/pro-provider";
|
|
6
|
+
import { TinyColor as Y } from "@ctrl/tinycolor";
|
|
7
|
+
import { omit as Et, pick as Ct } from "lodash-es";
|
|
8
|
+
import { useThrottleFn as yt, useEventListener as be } from "@vueuse/core";
|
|
9
|
+
const V = {
|
|
10
10
|
infinite: {
|
|
11
11
|
type: Boolean,
|
|
12
12
|
default: !0
|
|
@@ -22,12 +22,16 @@ const U = {
|
|
|
22
22
|
getContainer: {
|
|
23
23
|
type: String
|
|
24
24
|
}
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
type:
|
|
28
|
-
default:
|
|
25
|
+
}, Fe = {
|
|
26
|
+
preview: {
|
|
27
|
+
type: Object,
|
|
28
|
+
default: () => ({
|
|
29
|
+
current: 0,
|
|
30
|
+
infinite: !0,
|
|
31
|
+
onHideOnClickModal: !0
|
|
32
|
+
})
|
|
29
33
|
},
|
|
30
|
-
|
|
34
|
+
showPreview: {
|
|
31
35
|
type: Boolean,
|
|
32
36
|
default: !0
|
|
33
37
|
},
|
|
@@ -43,7 +47,7 @@ const U = {
|
|
|
43
47
|
type: String,
|
|
44
48
|
default: "contain"
|
|
45
49
|
},
|
|
46
|
-
lazy:
|
|
50
|
+
lazy: Boolean,
|
|
47
51
|
scrollContainer: {
|
|
48
52
|
type: [String, Object]
|
|
49
53
|
},
|
|
@@ -66,57 +70,47 @@ const U = {
|
|
|
66
70
|
onClick: {
|
|
67
71
|
type: Function
|
|
68
72
|
},
|
|
73
|
+
imageClassName: String,
|
|
74
|
+
imageStyle: Object,
|
|
75
|
+
width: Number,
|
|
76
|
+
height: Number,
|
|
77
|
+
zIndex: V.zIndex,
|
|
78
|
+
getContainer: V.getContainer
|
|
79
|
+
}, j = {
|
|
69
80
|
previewUrls: {
|
|
70
81
|
type: Array,
|
|
71
82
|
default: () => []
|
|
72
83
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
getContainer: U.getContainer,
|
|
80
|
-
current: {
|
|
81
|
-
...U.current,
|
|
82
|
-
default: () => {
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}, Y = {
|
|
86
|
-
previewUrls: {
|
|
87
|
-
type: Array,
|
|
88
|
-
default: () => []
|
|
89
|
-
},
|
|
90
|
-
teleported: se.previewTeleported,
|
|
91
|
-
zIndex: U.zIndex,
|
|
92
|
-
current: U.current,
|
|
93
|
-
infinite: U.infinite,
|
|
94
|
-
getContainer: se.getContainer,
|
|
95
|
-
onHideOnClickModal: se.hideOnClickModal,
|
|
84
|
+
disabled: Boolean,
|
|
85
|
+
zIndex: V.zIndex,
|
|
86
|
+
current: V.current,
|
|
87
|
+
infinite: V.infinite,
|
|
88
|
+
getContainer: Fe.getContainer,
|
|
89
|
+
onHideOnClickModal: Boolean,
|
|
96
90
|
countRender: [Function, Array, Object],
|
|
97
91
|
icons: {
|
|
98
92
|
type: Object,
|
|
99
93
|
default: () => ({})
|
|
100
94
|
}
|
|
101
95
|
};
|
|
102
|
-
function
|
|
96
|
+
function Nt(e, t) {
|
|
103
97
|
process.env.NODE_ENV !== "production" && !e && console !== void 0 && console.error(`Warning: ${t}`);
|
|
104
98
|
}
|
|
105
|
-
const
|
|
99
|
+
const Mt = new re("viewFadeIn", {
|
|
106
100
|
"0%": {
|
|
107
101
|
opacity: 0
|
|
108
102
|
},
|
|
109
103
|
"100%": {
|
|
110
104
|
opacity: 1
|
|
111
105
|
}
|
|
112
|
-
}),
|
|
106
|
+
}), Ot = new re("viewFadeOut", {
|
|
113
107
|
"0%": {
|
|
114
108
|
opacity: 1
|
|
115
109
|
},
|
|
116
110
|
"100%": {
|
|
117
111
|
opacity: 0
|
|
118
112
|
}
|
|
119
|
-
}),
|
|
113
|
+
}), At = new re("viewZoomBadgeIn", {
|
|
120
114
|
"0%": {
|
|
121
115
|
transform: "scale(0.2)",
|
|
122
116
|
opacity: 0
|
|
@@ -125,7 +119,7 @@ const Ct = new ue("viewFadeIn", {
|
|
|
125
119
|
transform: "scale(1)",
|
|
126
120
|
opacity: 1
|
|
127
121
|
}
|
|
128
|
-
}),
|
|
122
|
+
}), xt = new re("viewZoomBadgeOut", {
|
|
129
123
|
"0%": {
|
|
130
124
|
transform: "scale(1)"
|
|
131
125
|
},
|
|
@@ -133,11 +127,11 @@ const Ct = new ue("viewFadeIn", {
|
|
|
133
127
|
transform: "scale(0.2)",
|
|
134
128
|
opacity: 0
|
|
135
129
|
}
|
|
136
|
-
}),
|
|
130
|
+
}), Te = (e) => ({
|
|
137
131
|
position: e || "absolute",
|
|
138
132
|
inset: 0
|
|
139
133
|
});
|
|
140
|
-
function
|
|
134
|
+
function ve(e) {
|
|
141
135
|
return {
|
|
142
136
|
position: e,
|
|
143
137
|
top: 0,
|
|
@@ -146,8 +140,8 @@ function me(e) {
|
|
|
146
140
|
insetInlineStart: 0
|
|
147
141
|
};
|
|
148
142
|
}
|
|
149
|
-
const
|
|
150
|
-
const { previewCls: t, modalMaskBg: i, paddingSM: l, marginXL: o, margin: f, paddingLG: c, previewOperationColorDisabled: d, previewOperationHoverColor:
|
|
143
|
+
const Lt = (e) => {
|
|
144
|
+
const { previewCls: t, modalMaskBg: i, paddingSM: l, marginXL: o, margin: f, paddingLG: c, previewOperationColorDisabled: d, previewOperationHoverColor: E, motionDurationSlow: g, iconCls: h, colorTextLightSolid: C } = e, v = new Y(i).setAlpha(0.1), u = v.clone().setAlpha(0.2);
|
|
151
145
|
return {
|
|
152
146
|
[`${t}-footer`]: {
|
|
153
147
|
position: "fixed",
|
|
@@ -180,7 +174,7 @@ const Ot = (e) => {
|
|
|
180
174
|
outline: 0,
|
|
181
175
|
border: 0,
|
|
182
176
|
cursor: "pointer",
|
|
183
|
-
transition: `all ${
|
|
177
|
+
transition: `all ${g}`,
|
|
184
178
|
"&:hover": {
|
|
185
179
|
backgroundColor: u.toRgbString()
|
|
186
180
|
},
|
|
@@ -191,17 +185,17 @@ const Ot = (e) => {
|
|
|
191
185
|
[`${t}-operations`]: {
|
|
192
186
|
display: "flex",
|
|
193
187
|
alignItems: "center",
|
|
194
|
-
padding: `0 ${
|
|
188
|
+
padding: `0 ${pt(c)}`,
|
|
195
189
|
backgroundColor: v.toRgbString(),
|
|
196
190
|
borderRadius: 100,
|
|
197
191
|
"&-operation": {
|
|
198
192
|
marginInlineStart: l,
|
|
199
193
|
padding: l,
|
|
200
194
|
cursor: "pointer",
|
|
201
|
-
transition: `all ${
|
|
195
|
+
transition: `all ${g}`,
|
|
202
196
|
userSelect: "none",
|
|
203
197
|
[`&:not(${t}-operations-operation-disabled):hover > ${h}`]: {
|
|
204
|
-
color:
|
|
198
|
+
color: E
|
|
205
199
|
},
|
|
206
200
|
"&-disabled": {
|
|
207
201
|
color: d,
|
|
@@ -216,8 +210,8 @@ const Ot = (e) => {
|
|
|
216
210
|
}
|
|
217
211
|
}
|
|
218
212
|
};
|
|
219
|
-
},
|
|
220
|
-
const { modalMaskBg: t, iconCls: i, previewOperationColorDisabled: l, previewCls: o, zIndexPopup: f, motionDurationSlow: c } = e, d = new
|
|
213
|
+
}, bt = (e) => {
|
|
214
|
+
const { modalMaskBg: t, iconCls: i, previewOperationColorDisabled: l, previewCls: o, zIndexPopup: f, motionDurationSlow: c } = e, d = new Y(t).setAlpha(0.1), E = d.clone().setAlpha(0.2);
|
|
221
215
|
return {
|
|
222
216
|
[`${o}-switch-left, ${o}-switch-right`]: {
|
|
223
217
|
position: "fixed",
|
|
@@ -237,7 +231,7 @@ const Ot = (e) => {
|
|
|
237
231
|
transition: `all ${c}`,
|
|
238
232
|
userSelect: "none",
|
|
239
233
|
"&:hover": {
|
|
240
|
-
background:
|
|
234
|
+
background: E.toRgbString()
|
|
241
235
|
},
|
|
242
236
|
"&-disabled": {
|
|
243
237
|
"&, &:hover": {
|
|
@@ -260,33 +254,33 @@ const Ot = (e) => {
|
|
|
260
254
|
insetInlineEnd: e.marginSM
|
|
261
255
|
}
|
|
262
256
|
};
|
|
263
|
-
},
|
|
257
|
+
}, Tt = (e) => ({
|
|
264
258
|
[e.componentCls]: {
|
|
265
259
|
height: "100%",
|
|
266
260
|
textAlign: "center",
|
|
267
261
|
pointerEvents: "none",
|
|
268
262
|
"&-root": {
|
|
269
|
-
...
|
|
263
|
+
...ve("fixed"),
|
|
270
264
|
zIndex: e.zIndexPopup,
|
|
271
265
|
overflow: "auto",
|
|
272
266
|
outline: 0,
|
|
273
267
|
WebkitOverflowScrolling: "touch"
|
|
274
268
|
},
|
|
275
269
|
"&-wrap": {
|
|
276
|
-
...
|
|
270
|
+
...ve("fixed"),
|
|
277
271
|
zIndex: e.zIndexPopup,
|
|
278
272
|
overflow: "auto",
|
|
279
273
|
outline: 0,
|
|
280
274
|
WebkitOverflowScrolling: "touch"
|
|
281
275
|
},
|
|
282
276
|
"&-mask": {
|
|
283
|
-
...
|
|
277
|
+
...ve("fixed"),
|
|
284
278
|
zIndex: e.zIndexPopupBase,
|
|
285
279
|
height: "100%",
|
|
286
280
|
backgroundColor: e.colorBgMask
|
|
287
281
|
},
|
|
288
282
|
"&-body": {
|
|
289
|
-
...
|
|
283
|
+
...Te(),
|
|
290
284
|
overflow: "hidden"
|
|
291
285
|
},
|
|
292
286
|
"&-img": {
|
|
@@ -299,7 +293,7 @@ const Ot = (e) => {
|
|
|
299
293
|
userSelect: "none",
|
|
300
294
|
pointerEvents: "auto",
|
|
301
295
|
"&-wrapper": {
|
|
302
|
-
...
|
|
296
|
+
...Te(),
|
|
303
297
|
display: "flex",
|
|
304
298
|
justifyContent: "center",
|
|
305
299
|
alignItems: "center",
|
|
@@ -314,17 +308,17 @@ const Ot = (e) => {
|
|
|
314
308
|
}
|
|
315
309
|
},
|
|
316
310
|
"&-fade-appear, &-fade-enter": {
|
|
317
|
-
animationName:
|
|
311
|
+
animationName: Mt,
|
|
318
312
|
animationDuration: e.motionDurationSlow,
|
|
319
313
|
animationTimingFunction: "linear"
|
|
320
314
|
},
|
|
321
315
|
"&-fade-leave": {
|
|
322
|
-
animationName:
|
|
316
|
+
animationName: Ot,
|
|
323
317
|
animationDuration: e.motionDurationSlow,
|
|
324
318
|
animationTimingFunction: "linear"
|
|
325
319
|
},
|
|
326
320
|
"&-zoom-appear, &-zoom-enter": {
|
|
327
|
-
animationName:
|
|
321
|
+
animationName: At,
|
|
328
322
|
opacity: 0,
|
|
329
323
|
animationTimingFunction: e.motionEaseOutCirc,
|
|
330
324
|
animationFillMode: "both",
|
|
@@ -336,7 +330,7 @@ const Ot = (e) => {
|
|
|
336
330
|
animationPlayState: "running"
|
|
337
331
|
},
|
|
338
332
|
"&-zoom-leave": {
|
|
339
|
-
animationName:
|
|
333
|
+
animationName: xt,
|
|
340
334
|
animationDuration: e.motionDurationSlow,
|
|
341
335
|
animationTimingFunction: e.motionEaseOutBack,
|
|
342
336
|
animationFillMode: "both"
|
|
@@ -354,34 +348,34 @@ const Ot = (e) => {
|
|
|
354
348
|
zIndex: e.zIndexPopup + 1,
|
|
355
349
|
width: "100%"
|
|
356
350
|
},
|
|
357
|
-
"&": [
|
|
351
|
+
"&": [Lt(e), bt(e)]
|
|
358
352
|
});
|
|
359
|
-
function
|
|
360
|
-
return
|
|
361
|
-
const i =
|
|
353
|
+
function Pt(e) {
|
|
354
|
+
return St("ImageViewer", (t) => {
|
|
355
|
+
const i = ht(t, {
|
|
362
356
|
zIndexPopup: t.zIndexPopupBase + 80,
|
|
363
|
-
previewOperationColorDisabled: new
|
|
364
|
-
previewOperationHoverColor: new
|
|
365
|
-
modalMaskBg: new
|
|
357
|
+
previewOperationColorDisabled: new Y(t.colorTextLightSolid).setAlpha(0.25).toRgbString(),
|
|
358
|
+
previewOperationHoverColor: new Y(t.colorTextLightSolid).setAlpha(0.85).toRgbString(),
|
|
359
|
+
modalMaskBg: new Y("#000").setAlpha(0.45).toRgbString(),
|
|
366
360
|
// FIXME: Shared Token
|
|
367
|
-
previewOperationColor: new
|
|
361
|
+
previewOperationColor: new Y(t.colorTextLightSolid).toRgbString(),
|
|
368
362
|
previewOperationSize: t.fontSizeIcon * 1.5,
|
|
369
363
|
// FIXME: fontSizeIconLG
|
|
370
364
|
imagePreviewSwitchSize: t.controlHeightLG,
|
|
371
365
|
iconCls: "anticon",
|
|
372
366
|
previewCls: t.componentCls
|
|
373
367
|
});
|
|
374
|
-
return [
|
|
368
|
+
return [Tt(i)];
|
|
375
369
|
}, e);
|
|
376
370
|
}
|
|
377
|
-
function
|
|
371
|
+
function Rt(e) {
|
|
378
372
|
const t = e.getBoundingClientRect(), i = document.documentElement;
|
|
379
373
|
return {
|
|
380
374
|
left: t.left + (window.scrollX || i.scrollLeft) - (i.clientLeft || document.body.clientLeft || 0),
|
|
381
375
|
top: t.top + (window.scrollY || i.scrollTop) - (i.clientTop || document.body.clientTop || 0)
|
|
382
376
|
};
|
|
383
377
|
}
|
|
384
|
-
function
|
|
378
|
+
function $t() {
|
|
385
379
|
const e = document.documentElement.clientWidth, t = window.innerHeight || document.documentElement.clientHeight;
|
|
386
380
|
return {
|
|
387
381
|
width: e,
|
|
@@ -405,8 +399,8 @@ function Pe(e, t, i, l) {
|
|
|
405
399
|
};
|
|
406
400
|
return {};
|
|
407
401
|
}
|
|
408
|
-
function
|
|
409
|
-
const { width: o, height: f } =
|
|
402
|
+
function Dt(e, t, i, l) {
|
|
403
|
+
const { width: o, height: f } = $t();
|
|
410
404
|
let c = null;
|
|
411
405
|
return e <= o && t <= f ? c = {
|
|
412
406
|
x: 0,
|
|
@@ -426,7 +420,7 @@ try {
|
|
|
426
420
|
window.addEventListener("testPassive", null, e), window.removeEventListener("testPassive", null, e);
|
|
427
421
|
} catch {
|
|
428
422
|
}
|
|
429
|
-
function
|
|
423
|
+
function F(e, t, i, l) {
|
|
430
424
|
if (e && e.addEventListener) {
|
|
431
425
|
let o = l;
|
|
432
426
|
o === void 0 && Be && (t === "touchstart" || t === "touchmove" || t === "wheel") && (o = { passive: !1 }), e.addEventListener(t, i, o);
|
|
@@ -958,7 +952,7 @@ const Ne = /* @__PURE__ */ new Map();
|
|
|
958
952
|
function Ye(e) {
|
|
959
953
|
Ne.delete(e);
|
|
960
954
|
}
|
|
961
|
-
function
|
|
955
|
+
function Ce(e, t = 1) {
|
|
962
956
|
Re += 1;
|
|
963
957
|
const i = Re;
|
|
964
958
|
function l(o) {
|
|
@@ -973,13 +967,13 @@ function ye(e, t = 1) {
|
|
|
973
967
|
}
|
|
974
968
|
return l(t), i;
|
|
975
969
|
}
|
|
976
|
-
|
|
970
|
+
Ce.cancel = (e) => {
|
|
977
971
|
const t = Ne.get(e);
|
|
978
972
|
return Ye(t), je(t);
|
|
979
973
|
};
|
|
980
|
-
function
|
|
981
|
-
const t =
|
|
982
|
-
t.value === null && (l.value = [], t.value =
|
|
974
|
+
function zt(e) {
|
|
975
|
+
const t = N(null), i = ae({ ...e }), l = N([]), o = (f) => {
|
|
976
|
+
t.value === null && (l.value = [], t.value = Ce(() => {
|
|
983
977
|
let c;
|
|
984
978
|
l.value.forEach((d) => {
|
|
985
979
|
c = { ...c, ...d };
|
|
@@ -987,10 +981,10 @@ function Rt(e) {
|
|
|
987
981
|
})), l.value.push(f);
|
|
988
982
|
};
|
|
989
983
|
return De(() => {
|
|
990
|
-
t.value &&
|
|
984
|
+
t.value && Ce.cancel(t.value);
|
|
991
985
|
}), [i, o];
|
|
992
986
|
}
|
|
993
|
-
const
|
|
987
|
+
const Ut = /* @__PURE__ */ ye({
|
|
994
988
|
name: "Operations",
|
|
995
989
|
inheritAttrs: !1,
|
|
996
990
|
props: {
|
|
@@ -1007,11 +1001,11 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1007
1001
|
showProgress: Boolean,
|
|
1008
1002
|
prefixCls: String,
|
|
1009
1003
|
hashId: String,
|
|
1010
|
-
zIndex:
|
|
1011
|
-
icons:
|
|
1012
|
-
infinite:
|
|
1013
|
-
getContainer:
|
|
1014
|
-
countRender:
|
|
1004
|
+
zIndex: j.zIndex,
|
|
1005
|
+
icons: j.icons,
|
|
1006
|
+
infinite: j.infinite,
|
|
1007
|
+
getContainer: j.getContainer,
|
|
1008
|
+
countRender: j.countRender,
|
|
1015
1009
|
tools: Array,
|
|
1016
1010
|
onClose: Function,
|
|
1017
1011
|
onActive: Function
|
|
@@ -1026,28 +1020,28 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1026
1020
|
prefixCls: i,
|
|
1027
1021
|
hashId: l,
|
|
1028
1022
|
tools: o
|
|
1029
|
-
} = e, f =
|
|
1030
|
-
return r(
|
|
1023
|
+
} = e, f = Ee(`${e.prefixCls}-fade`), c = `${i}-operations-operation`, d = `${i}-operations-icon`;
|
|
1024
|
+
return r(ze, {
|
|
1031
1025
|
to: e.getContainer || "body"
|
|
1032
1026
|
}, {
|
|
1033
|
-
default: () => [r(
|
|
1027
|
+
default: () => [r(ge, f, {
|
|
1034
1028
|
default: () => {
|
|
1035
|
-
var
|
|
1036
|
-
return [
|
|
1037
|
-
class:
|
|
1029
|
+
var E, g, h, C;
|
|
1030
|
+
return [we(r("div", {
|
|
1031
|
+
class: oe(`${i}-operations-wrapper`, l),
|
|
1038
1032
|
style: {
|
|
1039
1033
|
zIndex: e.zIndex
|
|
1040
1034
|
}
|
|
1041
|
-
}, [((
|
|
1035
|
+
}, [((E = e.icons) == null ? void 0 : E.close) === null ? null : r("button", {
|
|
1042
1036
|
class: `${i}-close ${l}`,
|
|
1043
1037
|
onClick: e.onClose
|
|
1044
|
-
}, [((
|
|
1045
|
-
class:
|
|
1038
|
+
}, [((g = e.icons) == null ? void 0 : g.close) || r(it, null, null)]), e.showSwitch && r(Se, null, [r("div", {
|
|
1039
|
+
class: oe(`${i}-switch-left ${l}`, {
|
|
1046
1040
|
[`${i}-switch-left-disabled`]: e.infinite ? !1 : e.current === 0
|
|
1047
1041
|
}),
|
|
1048
1042
|
onClick: (v) => t(v, -1)
|
|
1049
1043
|
}, [((h = e.icons) == null ? void 0 : h.left) || r(at, null, null)]), r("div", {
|
|
1050
|
-
className:
|
|
1044
|
+
className: oe(`${i}-switch-right ${l}`, {
|
|
1051
1045
|
[`${i}-switch-right-disabled`]: e.infinite ? !1 : e.current === e.count - 1
|
|
1052
1046
|
}),
|
|
1053
1047
|
onClick: (v) => t(v, 1)
|
|
@@ -1060,17 +1054,17 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1060
1054
|
}, [o == null ? void 0 : o.map(({
|
|
1061
1055
|
icon: v,
|
|
1062
1056
|
onClick: u,
|
|
1063
|
-
type:
|
|
1057
|
+
type: M,
|
|
1064
1058
|
disabled: w
|
|
1065
1059
|
}) => r("div", {
|
|
1066
|
-
class:
|
|
1060
|
+
class: oe(c, {
|
|
1067
1061
|
[`${e.prefixCls}-operations-operation-disabled`]: w && (w == null ? void 0 : w.value)
|
|
1068
1062
|
}),
|
|
1069
1063
|
onClick: u,
|
|
1070
|
-
key:
|
|
1064
|
+
key: M
|
|
1071
1065
|
}, [Je(v, {
|
|
1072
1066
|
class: d
|
|
1073
|
-
})]))])])]), [[
|
|
1067
|
+
})]))])])]), [[he, e.open]])];
|
|
1074
1068
|
}
|
|
1075
1069
|
})]
|
|
1076
1070
|
});
|
|
@@ -1079,7 +1073,7 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1079
1073
|
}), D = {
|
|
1080
1074
|
x: 0,
|
|
1081
1075
|
y: 0
|
|
1082
|
-
},
|
|
1076
|
+
}, B = {
|
|
1083
1077
|
rotateLeft: r(rt, null, null),
|
|
1084
1078
|
rotateRight: r(st, null, null),
|
|
1085
1079
|
zoomIn: r(ct, null, null),
|
|
@@ -1088,200 +1082,200 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1088
1082
|
flipY: r(xe, {
|
|
1089
1083
|
rotate: 90
|
|
1090
1084
|
}, null)
|
|
1091
|
-
},
|
|
1085
|
+
}, Ke = ["close", "left", "right", "rotateRight", "rotateRight", "zoomOut", "flipX", "flipY", "rotateLeft"], _t = /* @__PURE__ */ ye({
|
|
1092
1086
|
name: "GImageViewer",
|
|
1093
|
-
props:
|
|
1087
|
+
props: j,
|
|
1094
1088
|
inheritAttrs: !1,
|
|
1095
1089
|
emits: ["close", "switch", "afterClose"],
|
|
1090
|
+
emit: Object,
|
|
1096
1091
|
setup: (e, {
|
|
1097
1092
|
emit: t,
|
|
1098
1093
|
expose: i,
|
|
1099
1094
|
slots: l
|
|
1100
1095
|
}) => {
|
|
1101
|
-
const o =
|
|
1096
|
+
const o = Ue({
|
|
1102
1097
|
suffixCls: "image-view"
|
|
1103
1098
|
}), {
|
|
1104
1099
|
wrapSSR: f,
|
|
1105
1100
|
hashId: c
|
|
1106
|
-
} =
|
|
1101
|
+
} = Pt(o), [d, E] = Le(!1), [g, h] = Le(!1), C = N(null), v = N(e.current), u = Z(1), M = Z(0), w = Z(!1), O = ae({
|
|
1107
1102
|
x: 1,
|
|
1108
1103
|
y: 1
|
|
1109
|
-
}), [
|
|
1104
|
+
}), [p, L] = zt(D), K = Z({
|
|
1110
1105
|
wheelDirection: 0
|
|
1111
|
-
}),
|
|
1106
|
+
}), P = Z(), A = ae({
|
|
1112
1107
|
originX: 0,
|
|
1113
1108
|
originY: 0,
|
|
1114
1109
|
deltaX: 0,
|
|
1115
1110
|
deltaY: 0
|
|
1116
|
-
}),
|
|
1117
|
-
url:
|
|
1118
|
-
}]) => [n,
|
|
1119
|
-
|
|
1120
|
-
n && (
|
|
1111
|
+
}), R = ae(/* @__PURE__ */ new Map()), z = y(() => new Map(Array.from(R).map(([n, {
|
|
1112
|
+
url: m
|
|
1113
|
+
}]) => [n, m]))), Q = y(() => z.value.get(v.value)), U = y(() => z.value.size), W = y(() => Array.from(z.value.keys())), b = y(() => W.value.indexOf(v.value)), k = y(() => U.value > 1), G = y(() => U.value >= 1);
|
|
1114
|
+
H(d, (n) => {
|
|
1115
|
+
n && (g.value = !0);
|
|
1121
1116
|
});
|
|
1122
1117
|
const s = (n) => {
|
|
1123
1118
|
v.value = n;
|
|
1124
1119
|
};
|
|
1125
|
-
|
|
1126
|
-
|
|
1120
|
+
H(() => e.current, (n) => {
|
|
1121
|
+
Ie(n) && s(n);
|
|
1127
1122
|
});
|
|
1128
|
-
function S(n,
|
|
1129
|
-
|
|
1130
|
-
url:
|
|
1123
|
+
function S(n, m) {
|
|
1124
|
+
R.set(n, {
|
|
1125
|
+
url: m,
|
|
1131
1126
|
loading: !0,
|
|
1132
1127
|
canPreview: !1
|
|
1133
1128
|
});
|
|
1134
1129
|
}
|
|
1135
1130
|
const x = () => {
|
|
1136
1131
|
h(!1), v.value = e.current;
|
|
1137
|
-
},
|
|
1138
|
-
u.value = 1,
|
|
1139
|
-
},
|
|
1132
|
+
}, se = () => {
|
|
1133
|
+
u.value = 1, M.value = 0, O.x = 1, O.y = 1, L(D), t("close");
|
|
1134
|
+
}, ce = (n) => {
|
|
1140
1135
|
w.value || C.value === (n == null ? void 0 : n.target) && x();
|
|
1141
|
-
},
|
|
1142
|
-
const n =
|
|
1136
|
+
}, ue = () => {
|
|
1137
|
+
const n = R.get(v.value);
|
|
1143
1138
|
n && (n.loading = !1, n.canPreview = !0);
|
|
1144
1139
|
}, q = (n) => {
|
|
1145
|
-
const
|
|
1146
|
-
|
|
1140
|
+
const m = R.get(v.value);
|
|
1141
|
+
m && (m.loading = !1, m.canPreview = !1), n.target.alt = "加载失败";
|
|
1147
1142
|
}, J = () => {
|
|
1148
1143
|
if (b.value > 0 || e.infinite) {
|
|
1149
1144
|
const n = b.value - 1 < 0 ? e.previewUrls.length - 1 : b.value - 1;
|
|
1150
|
-
s(
|
|
1145
|
+
s(W.value[n]);
|
|
1151
1146
|
}
|
|
1152
1147
|
}, ee = () => {
|
|
1153
|
-
if (b.value <
|
|
1148
|
+
if (b.value < U.value - 1 || e.infinite) {
|
|
1154
1149
|
const n = b.value + 1 > e.previewUrls.length - 1 ? 0 : b.value + 1;
|
|
1155
|
-
s(
|
|
1150
|
+
s(W.value[n]);
|
|
1156
1151
|
}
|
|
1157
|
-
},
|
|
1158
|
-
n ? u.value += 0.5 : u.value++,
|
|
1159
|
-
},
|
|
1160
|
-
u.value > 1 && (n ? u.value -= 0.5 : u.value--),
|
|
1161
|
-
},
|
|
1162
|
-
|
|
1163
|
-
}, Ke = () => {
|
|
1164
|
-
N.value -= 90;
|
|
1152
|
+
}, _ = (n) => {
|
|
1153
|
+
n ? u.value += 0.5 : u.value++, L(D);
|
|
1154
|
+
}, X = (n) => {
|
|
1155
|
+
u.value > 1 && (n ? u.value -= 0.5 : u.value--), L(D);
|
|
1156
|
+
}, de = () => {
|
|
1157
|
+
M.value += 90;
|
|
1165
1158
|
}, We = () => {
|
|
1166
|
-
|
|
1159
|
+
M.value -= 90;
|
|
1167
1160
|
}, Ge = () => {
|
|
1161
|
+
O.x = -O.x;
|
|
1162
|
+
}, Xe = () => {
|
|
1168
1163
|
O.y = -O.y;
|
|
1169
|
-
},
|
|
1170
|
-
icon:
|
|
1171
|
-
onClick: () =>
|
|
1164
|
+
}, Me = [{
|
|
1165
|
+
icon: $(l, e.icons, "zoomIn") || B.zoomIn,
|
|
1166
|
+
onClick: () => _(),
|
|
1172
1167
|
type: "zoomIn"
|
|
1173
1168
|
}, {
|
|
1174
|
-
icon:
|
|
1175
|
-
onClick: () =>
|
|
1169
|
+
icon: $(l, e.icons, "zoomOut") || B.zoomOut,
|
|
1170
|
+
onClick: () => X(),
|
|
1176
1171
|
type: "zoomOut",
|
|
1177
1172
|
disabled: y(() => u.value === 1)
|
|
1178
1173
|
}, {
|
|
1179
|
-
icon:
|
|
1180
|
-
onClick:
|
|
1174
|
+
icon: $(l, e.icons, "rotateRight") || B.rotateRight,
|
|
1175
|
+
onClick: de,
|
|
1181
1176
|
type: "rotateRight"
|
|
1182
1177
|
}, {
|
|
1183
|
-
icon:
|
|
1184
|
-
onClick:
|
|
1178
|
+
icon: $(l, e.icons, "rotateLeft") || B.rotateLeft,
|
|
1179
|
+
onClick: We,
|
|
1185
1180
|
type: "rotateLeft"
|
|
1186
1181
|
}, {
|
|
1187
|
-
icon:
|
|
1188
|
-
onClick:
|
|
1182
|
+
icon: $(l, e.icons, "flipX") || B.flipX,
|
|
1183
|
+
onClick: Ge,
|
|
1189
1184
|
type: "flipX"
|
|
1190
1185
|
}, {
|
|
1191
|
-
icon:
|
|
1192
|
-
onClick:
|
|
1186
|
+
icon: $(l, e.icons, "flipY") || B.flipY,
|
|
1187
|
+
onClick: Xe,
|
|
1193
1188
|
type: "flipY"
|
|
1194
1189
|
}], Oe = () => {
|
|
1195
|
-
if (d.value && w.value &&
|
|
1196
|
-
const n =
|
|
1197
|
-
left:
|
|
1198
|
-
top:
|
|
1199
|
-
} =
|
|
1190
|
+
if (d.value && w.value && P.value) {
|
|
1191
|
+
const n = P.value.offsetWidth * u.value, m = P.value.offsetHeight * u.value, {
|
|
1192
|
+
left: T,
|
|
1193
|
+
top: I
|
|
1194
|
+
} = Rt(P.value), te = M.value % 180 !== 0;
|
|
1200
1195
|
w.value = !1;
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1203
|
-
...
|
|
1196
|
+
const ne = Dt(te ? m : n, te ? n : m, T, I);
|
|
1197
|
+
ne && L({
|
|
1198
|
+
...ne
|
|
1204
1199
|
});
|
|
1205
1200
|
}
|
|
1206
1201
|
}, Ze = (n) => {
|
|
1207
|
-
n.button === 0 && (n.preventDefault(), n.stopPropagation(), A.deltaX = n.pageX -
|
|
1202
|
+
n.button === 0 && (n.preventDefault(), n.stopPropagation(), A.deltaX = n.pageX - p.x, A.deltaY = n.pageY - p.y, A.originX = p.x, A.originY = p.y, w.value = !0);
|
|
1208
1203
|
}, Ae = (n) => {
|
|
1209
|
-
d.value && w.value &&
|
|
1204
|
+
d.value && w.value && L({
|
|
1210
1205
|
x: n.pageX - A.deltaX,
|
|
1211
1206
|
y: n.pageY - A.deltaY
|
|
1212
1207
|
});
|
|
1213
1208
|
}, Ve = (n) => {
|
|
1214
1209
|
if (!d.value) return;
|
|
1215
1210
|
n.preventDefault();
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
wheelDirection:
|
|
1211
|
+
const m = n.deltaY;
|
|
1212
|
+
K.value = {
|
|
1213
|
+
wheelDirection: m
|
|
1219
1214
|
};
|
|
1220
1215
|
}, Qe = (n) => {
|
|
1221
1216
|
!d.value || !k.value || (n.keyCode === a.LEFT ? J() : n.keyCode === a.RIGHT && ee());
|
|
1222
1217
|
}, ke = () => {
|
|
1223
|
-
d.value && (u.value !== 1 && (u.value = 1), (
|
|
1218
|
+
d.value && (u.value !== 1 && (u.value = 1), (p.x !== D.x || p.y !== D.y) && L(D));
|
|
1224
1219
|
};
|
|
1225
|
-
let
|
|
1220
|
+
let fe = () => {
|
|
1226
1221
|
};
|
|
1227
1222
|
return De(() => {
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
S(
|
|
1223
|
+
H(() => e.previewUrls, (n) => {
|
|
1224
|
+
_e(n) && n.forEach((m, T) => {
|
|
1225
|
+
S(T, m);
|
|
1231
1226
|
});
|
|
1232
1227
|
}, {
|
|
1233
1228
|
flush: "post",
|
|
1234
1229
|
immediate: !0
|
|
1235
|
-
}),
|
|
1236
|
-
|
|
1237
|
-
let n,
|
|
1238
|
-
const
|
|
1230
|
+
}), H([() => d.value, w], () => {
|
|
1231
|
+
fe();
|
|
1232
|
+
let n, m;
|
|
1233
|
+
const T = F(window, "mouseup", Oe, !1), I = F(window, "mousemove", Ae, !1), te = F(window, "wheel", Ve, {
|
|
1239
1234
|
passive: !1
|
|
1240
|
-
}),
|
|
1235
|
+
}), ne = F(window, "keydown", Qe, !1);
|
|
1241
1236
|
try {
|
|
1242
|
-
window.top !== window.self && (n =
|
|
1237
|
+
window.top !== window.self && (n = F(window.top, "mouseup", Oe, !1), m = F(window.top, "mousemove", Ae, !1));
|
|
1243
1238
|
} catch (qe) {
|
|
1244
|
-
|
|
1239
|
+
Nt(!1, `[vc-image] ${qe}`);
|
|
1245
1240
|
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1241
|
+
fe = () => {
|
|
1242
|
+
T.remove(), I.remove(), te.remove(), ne.remove(), n && n.remove(), m && m.remove();
|
|
1248
1243
|
};
|
|
1249
1244
|
}, {
|
|
1250
1245
|
flush: "post",
|
|
1251
1246
|
immediate: !0
|
|
1252
|
-
}),
|
|
1247
|
+
}), H([K], () => {
|
|
1253
1248
|
const {
|
|
1254
1249
|
wheelDirection: n
|
|
1255
|
-
} =
|
|
1256
|
-
n > 0 ?
|
|
1250
|
+
} = K.value;
|
|
1251
|
+
n > 0 ? X(!0) : n < 0 && _(!0);
|
|
1257
1252
|
});
|
|
1258
1253
|
}), et(() => {
|
|
1259
|
-
|
|
1254
|
+
fe();
|
|
1260
1255
|
}), i({
|
|
1261
|
-
setOpen:
|
|
1256
|
+
setOpen: E
|
|
1262
1257
|
}), () => {
|
|
1263
|
-
const n =
|
|
1264
|
-
for (const
|
|
1265
|
-
|
|
1266
|
-
return f(r(
|
|
1267
|
-
to: e.getContainer || "body"
|
|
1268
|
-
disabled: !e.teleported
|
|
1258
|
+
const n = Ee(`${o}-fade`), m = Ee(`${o}-zoom`), T = {};
|
|
1259
|
+
for (const I in e.icons)
|
|
1260
|
+
T[I] = $(l, e.icons, I);
|
|
1261
|
+
return f(r(Se, null, [r(ze, {
|
|
1262
|
+
to: e.getContainer || "body"
|
|
1269
1263
|
}, {
|
|
1270
|
-
default: () => [d.value && r(
|
|
1264
|
+
default: () => [d.value && r(Se, null, [r("div", {
|
|
1271
1265
|
class: `${o}-root ${c.value}`
|
|
1272
|
-
}, [r(
|
|
1273
|
-
default: () => [
|
|
1266
|
+
}, [r(ge, n, {
|
|
1267
|
+
default: () => [we(r("div", {
|
|
1274
1268
|
class: `${o}-mask ${c.value}`
|
|
1275
|
-
}, null), [[
|
|
1269
|
+
}, null), [[he, d.value && g.value]])]
|
|
1276
1270
|
}), r("div", {
|
|
1277
1271
|
ref: C,
|
|
1278
1272
|
tabindex: -1,
|
|
1279
1273
|
class: [`${o}-wrap`, `${c.value}`],
|
|
1280
|
-
onClick: (
|
|
1281
|
-
}, [r(
|
|
1282
|
-
onAfterLeave: () =>
|
|
1274
|
+
onClick: (I) => e.onHideOnClickModal && ce(I)
|
|
1275
|
+
}, [r(ge, pe(m, {
|
|
1276
|
+
onAfterLeave: () => se()
|
|
1283
1277
|
}), {
|
|
1284
|
-
default: () => [
|
|
1278
|
+
default: () => [we(r("div", {
|
|
1285
1279
|
role: "dialog",
|
|
1286
1280
|
class: `${o} ${c.value}`
|
|
1287
1281
|
}, [r("div", {
|
|
@@ -1291,44 +1285,46 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1291
1285
|
}, [r("div", {
|
|
1292
1286
|
class: `${o}-img-wrapper ${c.value}`,
|
|
1293
1287
|
style: {
|
|
1294
|
-
transform: `translate3d(${
|
|
1288
|
+
transform: `translate3d(${p.x}px, ${p.y}px, 0)`
|
|
1295
1289
|
}
|
|
1296
1290
|
}, [r("img", {
|
|
1297
1291
|
onMousedown: Ze,
|
|
1298
1292
|
onDblclick: ke,
|
|
1299
|
-
ref:
|
|
1293
|
+
ref: P,
|
|
1300
1294
|
class: `${o}-img ${c.value}`,
|
|
1301
1295
|
src: Q.value,
|
|
1302
|
-
onLoad: () =>
|
|
1303
|
-
onError: (
|
|
1296
|
+
onLoad: () => ue(),
|
|
1297
|
+
onError: (I) => q(I),
|
|
1304
1298
|
style: {
|
|
1305
|
-
transform: `scale3d(${O.x * u.value}, ${O.y * u.value}, 1) rotate(${
|
|
1299
|
+
transform: `scale3d(${O.x * u.value}, ${O.y * u.value}, 1) rotate(${M.value}deg)`
|
|
1306
1300
|
}
|
|
1307
|
-
}, null)])])])]), [[
|
|
1301
|
+
}, null)])])])]), [[he, d.value && g.value]])]
|
|
1308
1302
|
})])])])]
|
|
1309
|
-
}), d.value &&
|
|
1310
|
-
open: d.value &&
|
|
1303
|
+
}), d.value && g.value && r(Ut, {
|
|
1304
|
+
open: d.value && g.value,
|
|
1311
1305
|
hashId: c.value,
|
|
1312
1306
|
count: e.previewUrls.length,
|
|
1313
1307
|
current: v.value,
|
|
1314
1308
|
zIndex: e.zIndex + 1,
|
|
1315
1309
|
getContainer: e.getContainer,
|
|
1316
1310
|
prefixCls: o,
|
|
1317
|
-
icons:
|
|
1318
|
-
|
|
1311
|
+
icons: Et(T, Me.map(({
|
|
1312
|
+
type: I
|
|
1313
|
+
}) => I)),
|
|
1314
|
+
tools: Me,
|
|
1319
1315
|
infinite: e.infinite,
|
|
1320
1316
|
countRender: dt(l, e, "countRenders"),
|
|
1321
1317
|
showSwitch: k.value,
|
|
1322
|
-
showProgress:
|
|
1318
|
+
showProgress: G.value,
|
|
1323
1319
|
onClose: x,
|
|
1324
|
-
onActive: (
|
|
1320
|
+
onActive: (I) => I > 0 ? ee() : J()
|
|
1325
1321
|
}, null)]));
|
|
1326
1322
|
};
|
|
1327
1323
|
}
|
|
1328
|
-
}),
|
|
1324
|
+
}), me = {
|
|
1329
1325
|
width: "100%",
|
|
1330
1326
|
height: "100%"
|
|
1331
|
-
},
|
|
1327
|
+
}, Ft = () => ({
|
|
1332
1328
|
position: "absolute",
|
|
1333
1329
|
inset: 0,
|
|
1334
1330
|
display: "flex",
|
|
@@ -1336,13 +1332,13 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1336
1332
|
justifyContent: "center",
|
|
1337
1333
|
cursor: "pointer",
|
|
1338
1334
|
opacity: 0
|
|
1339
|
-
}),
|
|
1335
|
+
}), Bt = (e) => ({
|
|
1340
1336
|
[e.componentCls]: {
|
|
1341
1337
|
display: "inline-block",
|
|
1342
1338
|
position: "relative",
|
|
1343
1339
|
overflow: "hidden",
|
|
1344
1340
|
"&-inner": {
|
|
1345
|
-
...
|
|
1341
|
+
...me,
|
|
1346
1342
|
verticalAlign: "top",
|
|
1347
1343
|
opacity: 1,
|
|
1348
1344
|
[`&${e.componentCls}-inner-preview`]: {
|
|
@@ -1350,7 +1346,7 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1350
1346
|
}
|
|
1351
1347
|
},
|
|
1352
1348
|
"&-placeholder": {
|
|
1353
|
-
...
|
|
1349
|
+
...me,
|
|
1354
1350
|
backgroundColor: e.colorBgContainerDisabled,
|
|
1355
1351
|
backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
|
|
1356
1352
|
backgroundRepeat: "no-repeat",
|
|
@@ -1358,19 +1354,19 @@ const $t = /* @__PURE__ */ Me({
|
|
|
1358
1354
|
backgroundSize: "30%"
|
|
1359
1355
|
},
|
|
1360
1356
|
"&-error": {
|
|
1361
|
-
...
|
|
1357
|
+
...me,
|
|
1362
1358
|
display: "flex",
|
|
1363
1359
|
alignItems: "center",
|
|
1364
1360
|
justifyContent: "center",
|
|
1365
1361
|
color: e.colorText,
|
|
1366
1362
|
backgroundColor: e.colorBgContainerDisabled
|
|
1367
1363
|
},
|
|
1368
|
-
"&-preview":
|
|
1364
|
+
"&-preview": Ft()
|
|
1369
1365
|
}
|
|
1370
|
-
}),
|
|
1366
|
+
}), Ht = (e) => e && e.nodeType === Node.ELEMENT_NODE;
|
|
1371
1367
|
let $e = "";
|
|
1372
|
-
const
|
|
1373
|
-
props:
|
|
1368
|
+
const jt = [...Ke, "fallback", "placeholder"], le = /* @__PURE__ */ ye({
|
|
1369
|
+
props: Fe,
|
|
1374
1370
|
name: "GImage",
|
|
1375
1371
|
emits: ["error", "click", "load"],
|
|
1376
1372
|
slots: Object,
|
|
@@ -1379,51 +1375,55 @@ const ce = /* @__PURE__ */ Me({
|
|
|
1379
1375
|
emit: i,
|
|
1380
1376
|
attrs: l
|
|
1381
1377
|
}) {
|
|
1382
|
-
const o =
|
|
1378
|
+
const o = Ue({
|
|
1383
1379
|
suffixCls: "image"
|
|
1384
1380
|
}), {
|
|
1385
1381
|
wrapSSR: f,
|
|
1386
1382
|
hashId: c
|
|
1387
|
-
} = It("Image", [
|
|
1388
|
-
let
|
|
1389
|
-
const O = y(() => !
|
|
1383
|
+
} = It("Image", [Bt], o), d = N(), E = N(""), g = N(!1), h = N(!0), C = N(!1), v = N(null), u = N();
|
|
1384
|
+
let M, w;
|
|
1385
|
+
const O = y(() => !ie && e.fit ? {
|
|
1390
1386
|
"object-fit": e.fit
|
|
1391
|
-
} : {}),
|
|
1387
|
+
} : {}), p = y(() => {
|
|
1392
1388
|
const {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1389
|
+
previewUrls: s
|
|
1390
|
+
} = e.preview;
|
|
1391
|
+
return _e(s) && s.length > 0 || e.showPreview;
|
|
1392
|
+
}), L = y(() => {
|
|
1393
|
+
const {
|
|
1394
|
+
previewUrls: s = [],
|
|
1395
|
+
current: S = 0
|
|
1396
|
+
} = e.preview;
|
|
1397
|
+
if (Ie(S)) return s.length >= S ? S : 0;
|
|
1398
|
+
const x = s.indexOf(e.src);
|
|
1399
|
+
return x >= 0 ? x : 0;
|
|
1400
|
+
}), K = (s) => {
|
|
1401
|
+
E.value = e.src, h.value = !1, g.value = !1, i("load", s);
|
|
1402
|
+
}, P = (s) => {
|
|
1403
|
+
h.value = !1, g.value = !0, i("error", s);
|
|
1404
1404
|
}, A = () => {
|
|
1405
|
-
if (
|
|
1406
|
-
h.value = !0,
|
|
1405
|
+
if (ie) return;
|
|
1406
|
+
h.value = !0, g.value = !1;
|
|
1407
1407
|
const s = new Image();
|
|
1408
|
-
s.onload = (S) =>
|
|
1408
|
+
s.onload = (S) => K(S), s.onerror = P, Object.keys(l || {}).forEach((S) => {
|
|
1409
1409
|
if (S.toLowerCase() === "onload") return;
|
|
1410
1410
|
const x = (l || {})[S];
|
|
1411
1411
|
s.setAttribute(S, x);
|
|
1412
1412
|
}), s.src = e.src;
|
|
1413
|
-
},
|
|
1414
|
-
|
|
1413
|
+
}, R = yt(Q, 200), z = () => {
|
|
1414
|
+
ie || !u.value || !R || (M(), u.value = void 0);
|
|
1415
1415
|
};
|
|
1416
1416
|
function Q() {
|
|
1417
1417
|
ft(v.value, u.value) && (A(), z());
|
|
1418
1418
|
}
|
|
1419
|
-
const
|
|
1420
|
-
if (
|
|
1419
|
+
const U = async () => {
|
|
1420
|
+
if (ie) return;
|
|
1421
1421
|
await ot();
|
|
1422
1422
|
const {
|
|
1423
1423
|
scrollContainer: s
|
|
1424
1424
|
} = e;
|
|
1425
|
-
|
|
1426
|
-
},
|
|
1425
|
+
Ht(s) ? u.value = s : mt(s) && s !== "" ? u.value = document.querySelector(s) ?? void 0 : v.value && (u.value = gt(v.value)), u.value && (M = be(u, "scroll", R), setTimeout(() => Q(), 200));
|
|
1426
|
+
}, W = (s) => {
|
|
1427
1427
|
if (s.ctrlKey) {
|
|
1428
1428
|
if (s.deltaY < 0)
|
|
1429
1429
|
return s.preventDefault(), !1;
|
|
@@ -1431,94 +1431,95 @@ const ce = /* @__PURE__ */ Me({
|
|
|
1431
1431
|
return s.preventDefault(), !1;
|
|
1432
1432
|
}
|
|
1433
1433
|
}, b = () => {
|
|
1434
|
-
|
|
1434
|
+
p.value && (w = be("wheel", W, {
|
|
1435
1435
|
passive: !1
|
|
1436
1436
|
}), $e = document.body.style.overflow, document.body.style.overflow = "hidden", C.value = !0);
|
|
1437
1437
|
}, k = () => {
|
|
1438
1438
|
w == null || w(), document.body.style.overflow = $e, C.value = !1;
|
|
1439
1439
|
};
|
|
1440
|
-
|
|
1441
|
-
e.lazy ? (h.value = !0,
|
|
1440
|
+
H(() => e.src, () => {
|
|
1441
|
+
e.lazy ? (h.value = !0, g.value = !1, z(), U()) : A();
|
|
1442
1442
|
}), tt(() => {
|
|
1443
1443
|
var s, S;
|
|
1444
|
-
|
|
1444
|
+
p.value && C.value ? (s = d.value) == null || s.setOpen(!0) : (S = d.value) == null || S.setOpen(!1);
|
|
1445
1445
|
});
|
|
1446
|
-
const
|
|
1447
|
-
return
|
|
1448
|
-
e.lazy ?
|
|
1446
|
+
const G = (s) => Ie(s) ? s + "px" : s;
|
|
1447
|
+
return wt(() => {
|
|
1448
|
+
e.lazy ? U() : A();
|
|
1449
1449
|
}), () => {
|
|
1450
|
+
var X;
|
|
1450
1451
|
const {
|
|
1451
1452
|
crossorigin: s,
|
|
1452
1453
|
decoding: S,
|
|
1453
1454
|
alt: x,
|
|
1454
|
-
sizes:
|
|
1455
|
-
srcset:
|
|
1456
|
-
usemap:
|
|
1455
|
+
sizes: se,
|
|
1456
|
+
srcset: ce,
|
|
1457
|
+
usemap: ue,
|
|
1457
1458
|
class: q,
|
|
1458
1459
|
style: J = {}
|
|
1459
1460
|
} = l, ee = {
|
|
1460
1461
|
crossorigin: s,
|
|
1461
1462
|
decoding: S,
|
|
1462
1463
|
alt: x,
|
|
1463
|
-
sizes:
|
|
1464
|
-
srcset:
|
|
1465
|
-
usemap:
|
|
1464
|
+
sizes: se,
|
|
1465
|
+
srcset: ce,
|
|
1466
|
+
usemap: ue,
|
|
1466
1467
|
style: {
|
|
1467
1468
|
...O.value,
|
|
1468
|
-
height: e.height ?
|
|
1469
|
+
height: e.height ? G(e.height) : void 0
|
|
1469
1470
|
}
|
|
1470
|
-
},
|
|
1471
|
+
}, _ = vt(jt, t, e, {
|
|
1472
|
+
render: !0
|
|
1473
|
+
});
|
|
1471
1474
|
return f(r("div", {
|
|
1472
1475
|
class: {
|
|
1473
1476
|
[`${c.value}`]: !0,
|
|
1474
1477
|
[`${o}`]: !0,
|
|
1475
1478
|
[`${q}`]: !!q
|
|
1476
1479
|
},
|
|
1477
|
-
ref: (
|
|
1480
|
+
ref: (de) => v.value = de,
|
|
1478
1481
|
style: {
|
|
1479
|
-
width: e.width ?
|
|
1480
|
-
height: e.height ?
|
|
1482
|
+
width: e.width ? G(e.width) : void 0,
|
|
1483
|
+
height: e.height ? G(e.height) : void 0,
|
|
1481
1484
|
display: e.lazy ? "block" : void 0,
|
|
1482
1485
|
...J
|
|
1483
1486
|
},
|
|
1484
1487
|
onClick: () => {
|
|
1485
1488
|
i("click");
|
|
1486
1489
|
}
|
|
1487
|
-
}, [h.value ?
|
|
1490
|
+
}, [h.value ? _.placeholder || r("div", {
|
|
1488
1491
|
class: `${o}-placeholder ${c.value}`
|
|
1489
|
-
}, null) :
|
|
1492
|
+
}, null) : g.value ? _.fallback || r("div", {
|
|
1490
1493
|
class: `${o}-error ${c.value}`
|
|
1491
|
-
}, [nt("加载失败")]) :
|
|
1494
|
+
}, [nt("加载失败")]) : E.value && r("img", pe(ee, {
|
|
1492
1495
|
class: {
|
|
1493
1496
|
[`${c.value}`]: !0,
|
|
1494
1497
|
[`${e.imageClassName}`]: !!e.imageClassName,
|
|
1495
1498
|
[`${o}-inner`]: !0,
|
|
1496
|
-
[`${o}-inner-preview`]:
|
|
1499
|
+
[`${o}-inner-preview`]: p.value
|
|
1497
1500
|
},
|
|
1498
1501
|
alt: e.alt,
|
|
1499
|
-
src:
|
|
1500
|
-
}), null),
|
|
1502
|
+
src: E.value
|
|
1503
|
+
}), null), p.value && r("div", {
|
|
1501
1504
|
class: `${o}-preview ${c.value}`,
|
|
1502
1505
|
onClick: () => b()
|
|
1503
|
-
}, null), r(
|
|
1504
|
-
ref: d
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
current:
|
|
1508
|
-
previewUrls: e.previewUrls,
|
|
1509
|
-
getContainer: e.getContainer,
|
|
1506
|
+
}, null), p.value && r(_t, pe({
|
|
1507
|
+
ref: d
|
|
1508
|
+
}, e.preview, Ct(_, Ke), {
|
|
1509
|
+
previewUrls: ((X = e.preview) == null ? void 0 : X.previewUrls) || [e.src],
|
|
1510
|
+
current: L.value,
|
|
1510
1511
|
onClose: () => k()
|
|
1511
|
-
}, null)]));
|
|
1512
|
+
}), null)]));
|
|
1512
1513
|
};
|
|
1513
1514
|
}
|
|
1514
1515
|
});
|
|
1515
|
-
|
|
1516
|
-
|
|
1516
|
+
le.isGImage = !0;
|
|
1517
|
+
le.install = (e) => (e.component(le.name, le), e);
|
|
1517
1518
|
export {
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1519
|
+
le as GImage,
|
|
1520
|
+
_t as ImagePreview,
|
|
1521
|
+
V as baseProps,
|
|
1522
|
+
le as default,
|
|
1523
|
+
Fe as imagePorps,
|
|
1524
|
+
j as imagePreviewProps
|
|
1524
1525
|
};
|