@gx-design-vue/image 0.2.0-beta.3 → 0.2.0-beta.31

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.mjs DELETED
@@ -1,1495 +0,0 @@
1
- import { computed as M, isRef as et, createVNode as c, defineComponent as _e, shallowRef as ze, ref as x, watch as ue, nextTick as Ue, Teleport as tt, Transition as Oe, withDirectives as Le, vShow as Ne, mergeProps as Ze, cloneVNode as nt, watchEffect as at, Fragment as rt, createTextVNode as it } from "vue";
2
- import { ExpandOutlined as ot, OneToOneOutlined as st, CloseOutlined as lt, ZoomInOutlined as ut, ZoomOutOutlined as ct, RotateRightOutlined as ft, RotateLeftOutlined as dt, LeftOutlined as ht, RightOutlined as gt } from "@ant-design/icons-vue";
3
- import { getPrefixCls as J, isServer as q, getSlotVNode as De, isInContainer as vt, isString as pt, getScrollContainer as mt, isNumber as bt } from "@gx-design-vue/pro-utils";
4
- import { useState as Ee, onMountedOrActivated as Xe } from "@gx-design-vue/pro-hooks";
5
- import { useStyleRegister as Re, theme as yt } from "ant-design-vue";
6
- import { createTypes as wt } from "vue-types";
7
- import { useThrottleFn as St, useEventListener as He } from "@vueuse/core";
8
- const xt = (e, t) => {
9
- const { fontFamily: n, fontSize: a } = e, r = `[class^="${t}"], [class*=" ${t}"]`;
10
- return {
11
- [r]: {
12
- fontFamily: n,
13
- fontSize: a,
14
- boxSizing: "border-box",
15
- "&::before, &::after": {
16
- boxSizing: "border-box"
17
- },
18
- [r]: {
19
- boxSizing: "border-box",
20
- "&::before, &::after": {
21
- boxSizing: "border-box"
22
- }
23
- }
24
- }
25
- };
26
- }, It = (e) => ({
27
- a: {
28
- color: e.colorLink,
29
- textDecoration: e.linkDecoration,
30
- backgroundColor: "transparent",
31
- outline: "none",
32
- cursor: "pointer",
33
- transition: `color ${e.motionDurationSlow}`,
34
- "-webkit-text-decoration-skip": "objects",
35
- "&:hover": {
36
- color: e.colorLinkHover
37
- },
38
- "&:active": {
39
- color: e.colorLinkActive
40
- },
41
- [`&:active,
42
- &:hover`]: {
43
- textDecoration: e.linkHoverDecoration,
44
- outline: 0
45
- },
46
- // https://github.com/ant-design/ant-design/issues/22503
47
- "&:focus": {
48
- textDecoration: e.linkFocusDecoration,
49
- outline: 0
50
- },
51
- "&[disabled]": {
52
- color: e.colorTextDisabled,
53
- cursor: "not-allowed"
54
- }
55
- }
56
- }), qe = (
57
- // @ts-ignore
58
- process.env.NODE_ENV !== "production" || typeof CSSINJS_STATISTIC < "u"
59
- );
60
- let Ae = !0;
61
- function Te(...e) {
62
- if (!qe)
63
- return Object.assign({}, ...e);
64
- Ae = !1;
65
- const t = {};
66
- return e.forEach((n) => {
67
- Object.keys(n).forEach((a) => {
68
- Object.defineProperty(t, a, {
69
- configurable: !0,
70
- enumerable: !0,
71
- get: () => n[a]
72
- });
73
- });
74
- }), Ae = !0, t;
75
- }
76
- function Mt() {
77
- }
78
- function Ct(e) {
79
- let t, n = e, a = Mt;
80
- return qe && (t = /* @__PURE__ */ new Set(), n = new Proxy(e, {
81
- get(r, i) {
82
- return Ae && t.add(i), r[i];
83
- }
84
- }), a = (r, i) => {
85
- Array.from(t);
86
- }), { token: n, keys: t, flush: a };
87
- }
88
- class de {
89
- constructor(t, n) {
90
- this._keyframe = !0, this.name = t, this.style = n;
91
- }
92
- getName(t = "") {
93
- return t ? `${t}-${this.name}` : this.name;
94
- }
95
- }
96
- const Fe = (e, t = {}) => e ? {
97
- name: e,
98
- appear: !0,
99
- // type: 'animation',
100
- // appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
101
- // appearActiveClass: `antdv-base-transtion`,
102
- // appearToClass: `${transitionName}-appear ${transitionName}-appear-active`,
103
- enterFromClass: `${e}-enter ${e}-enter-prepare ${e}-enter-start`,
104
- enterActiveClass: `${e}-enter ${e}-enter-prepare`,
105
- enterToClass: `${e}-enter ${e}-enter-active`,
106
- leaveFromClass: ` ${e}-leave`,
107
- leaveActiveClass: `${e}-leave ${e}-leave-active`,
108
- leaveToClass: `${e}-leave ${e}-leave-active`,
109
- ...t
110
- } : { css: !1, ...t }, { useToken: At } = yt;
111
- function Je(e, t) {
112
- return (n) => {
113
- const a = J({}), r = M(() => et(n) ? n == null ? void 0 : n.value : n || a), { token: i, hashId: o, theme: l } = At(), u = M(() => J({})), p = M(() => ({
114
- theme: l.value,
115
- token: i.value,
116
- hashId: o.value,
117
- path: ["Shared", u.value]
118
- }));
119
- Re(p, () => [
120
- {
121
- "&": It(i.value)
122
- }
123
- ]);
124
- const v = M(() => ({
125
- theme: l.value,
126
- token: i.value,
127
- hashId: o.value,
128
- path: [e, r.value]
129
- }));
130
- return [
131
- Re(v, () => {
132
- const { token: z, flush: C } = Ct(i.value), m = `.${r.value}`, A = Te(z, {
133
- antCls: ".ant",
134
- componentCls: m,
135
- proComponentsCls: J({
136
- isPor: !0
137
- })
138
- }), d = t(A, {
139
- hashId: o.value,
140
- prefixCls: r.value
141
- });
142
- return C(e, {}), [xt(i.value, r.value), d];
143
- }),
144
- o
145
- ];
146
- };
147
- }
148
- function g(e, t) {
149
- kt(e) && (e = "100%");
150
- var n = Tt(e);
151
- return e = t === 360 ? e : Math.min(t, Math.max(0, parseFloat(e))), n && (e = parseInt(String(e * t), 10) / 100), Math.abs(e - t) < 1e-6 ? 1 : (t === 360 ? e = (e < 0 ? e % t + t : e % t) / parseFloat(String(t)) : e = e % t / parseFloat(String(t)), e);
152
- }
153
- function oe(e) {
154
- return Math.min(1, Math.max(0, e));
155
- }
156
- function kt(e) {
157
- return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1;
158
- }
159
- function Tt(e) {
160
- return typeof e == "string" && e.indexOf("%") !== -1;
161
- }
162
- function Qe(e) {
163
- return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e;
164
- }
165
- function se(e) {
166
- return e <= 1 ? "".concat(Number(e) * 100, "%") : e;
167
- }
168
- function H(e) {
169
- return e.length === 1 ? "0" + e : String(e);
170
- }
171
- function $t(e, t, n) {
172
- return {
173
- r: g(e, 255) * 255,
174
- g: g(t, 255) * 255,
175
- b: g(n, 255) * 255
176
- };
177
- }
178
- function Pe(e, t, n) {
179
- e = g(e, 255), t = g(t, 255), n = g(n, 255);
180
- var a = Math.max(e, t, n), r = Math.min(e, t, n), i = 0, o = 0, l = (a + r) / 2;
181
- if (a === r)
182
- o = 0, i = 0;
183
- else {
184
- var u = a - r;
185
- switch (o = l > 0.5 ? u / (2 - a - r) : u / (a + r), a) {
186
- case e:
187
- i = (t - n) / u + (t < n ? 6 : 0);
188
- break;
189
- case t:
190
- i = (n - e) / u + 2;
191
- break;
192
- case n:
193
- i = (e - t) / u + 4;
194
- break;
195
- }
196
- i /= 6;
197
- }
198
- return { h: i, s: o, l };
199
- }
200
- function ye(e, t, n) {
201
- return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + (t - e) * (6 * n) : n < 1 / 2 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e;
202
- }
203
- function zt(e, t, n) {
204
- var a, r, i;
205
- if (e = g(e, 360), t = g(t, 100), n = g(n, 100), t === 0)
206
- r = n, i = n, a = n;
207
- else {
208
- var o = n < 0.5 ? n * (1 + t) : n + t - n * t, l = 2 * n - o;
209
- a = ye(l, o, e + 1 / 3), r = ye(l, o, e), i = ye(l, o, e - 1 / 3);
210
- }
211
- return { r: a * 255, g: r * 255, b: i * 255 };
212
- }
213
- function je(e, t, n) {
214
- e = g(e, 255), t = g(t, 255), n = g(n, 255);
215
- var a = Math.max(e, t, n), r = Math.min(e, t, n), i = 0, o = a, l = a - r, u = a === 0 ? 0 : l / a;
216
- if (a === r)
217
- i = 0;
218
- else {
219
- switch (a) {
220
- case e:
221
- i = (t - n) / l + (t < n ? 6 : 0);
222
- break;
223
- case t:
224
- i = (n - e) / l + 2;
225
- break;
226
- case n:
227
- i = (e - t) / l + 4;
228
- break;
229
- }
230
- i /= 6;
231
- }
232
- return { h: i, s: u, v: o };
233
- }
234
- function Ot(e, t, n) {
235
- e = g(e, 360) * 6, t = g(t, 100), n = g(n, 100);
236
- var a = Math.floor(e), r = e - a, i = n * (1 - t), o = n * (1 - r * t), l = n * (1 - (1 - r) * t), u = a % 6, p = [n, o, i, i, l, n][u], v = [l, n, n, o, i, i][u], z = [i, i, l, n, n, o][u];
237
- return { r: p * 255, g: v * 255, b: z * 255 };
238
- }
239
- function Be(e, t, n, a) {
240
- var r = [
241
- H(Math.round(e).toString(16)),
242
- H(Math.round(t).toString(16)),
243
- H(Math.round(n).toString(16))
244
- ];
245
- return a && r[0].startsWith(r[0].charAt(1)) && r[1].startsWith(r[1].charAt(1)) && r[2].startsWith(r[2].charAt(1)) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join("");
246
- }
247
- function Lt(e, t, n, a, r) {
248
- var i = [
249
- H(Math.round(e).toString(16)),
250
- H(Math.round(t).toString(16)),
251
- H(Math.round(n).toString(16)),
252
- H(Nt(a))
253
- ];
254
- return r && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) && i[3].startsWith(i[3].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) + i[3].charAt(0) : i.join("");
255
- }
256
- function Nt(e) {
257
- return Math.round(parseFloat(e) * 255).toString(16);
258
- }
259
- function Ve(e) {
260
- return S(e) / 255;
261
- }
262
- function S(e) {
263
- return parseInt(e, 16);
264
- }
265
- function Dt(e) {
266
- return {
267
- r: e >> 16,
268
- g: (e & 65280) >> 8,
269
- b: e & 255
270
- };
271
- }
272
- var ke = {
273
- aliceblue: "#f0f8ff",
274
- antiquewhite: "#faebd7",
275
- aqua: "#00ffff",
276
- aquamarine: "#7fffd4",
277
- azure: "#f0ffff",
278
- beige: "#f5f5dc",
279
- bisque: "#ffe4c4",
280
- black: "#000000",
281
- blanchedalmond: "#ffebcd",
282
- blue: "#0000ff",
283
- blueviolet: "#8a2be2",
284
- brown: "#a52a2a",
285
- burlywood: "#deb887",
286
- cadetblue: "#5f9ea0",
287
- chartreuse: "#7fff00",
288
- chocolate: "#d2691e",
289
- coral: "#ff7f50",
290
- cornflowerblue: "#6495ed",
291
- cornsilk: "#fff8dc",
292
- crimson: "#dc143c",
293
- cyan: "#00ffff",
294
- darkblue: "#00008b",
295
- darkcyan: "#008b8b",
296
- darkgoldenrod: "#b8860b",
297
- darkgray: "#a9a9a9",
298
- darkgreen: "#006400",
299
- darkgrey: "#a9a9a9",
300
- darkkhaki: "#bdb76b",
301
- darkmagenta: "#8b008b",
302
- darkolivegreen: "#556b2f",
303
- darkorange: "#ff8c00",
304
- darkorchid: "#9932cc",
305
- darkred: "#8b0000",
306
- darksalmon: "#e9967a",
307
- darkseagreen: "#8fbc8f",
308
- darkslateblue: "#483d8b",
309
- darkslategray: "#2f4f4f",
310
- darkslategrey: "#2f4f4f",
311
- darkturquoise: "#00ced1",
312
- darkviolet: "#9400d3",
313
- deeppink: "#ff1493",
314
- deepskyblue: "#00bfff",
315
- dimgray: "#696969",
316
- dimgrey: "#696969",
317
- dodgerblue: "#1e90ff",
318
- firebrick: "#b22222",
319
- floralwhite: "#fffaf0",
320
- forestgreen: "#228b22",
321
- fuchsia: "#ff00ff",
322
- gainsboro: "#dcdcdc",
323
- ghostwhite: "#f8f8ff",
324
- goldenrod: "#daa520",
325
- gold: "#ffd700",
326
- gray: "#808080",
327
- green: "#008000",
328
- greenyellow: "#adff2f",
329
- grey: "#808080",
330
- honeydew: "#f0fff0",
331
- hotpink: "#ff69b4",
332
- indianred: "#cd5c5c",
333
- indigo: "#4b0082",
334
- ivory: "#fffff0",
335
- khaki: "#f0e68c",
336
- lavenderblush: "#fff0f5",
337
- lavender: "#e6e6fa",
338
- lawngreen: "#7cfc00",
339
- lemonchiffon: "#fffacd",
340
- lightblue: "#add8e6",
341
- lightcoral: "#f08080",
342
- lightcyan: "#e0ffff",
343
- lightgoldenrodyellow: "#fafad2",
344
- lightgray: "#d3d3d3",
345
- lightgreen: "#90ee90",
346
- lightgrey: "#d3d3d3",
347
- lightpink: "#ffb6c1",
348
- lightsalmon: "#ffa07a",
349
- lightseagreen: "#20b2aa",
350
- lightskyblue: "#87cefa",
351
- lightslategray: "#778899",
352
- lightslategrey: "#778899",
353
- lightsteelblue: "#b0c4de",
354
- lightyellow: "#ffffe0",
355
- lime: "#00ff00",
356
- limegreen: "#32cd32",
357
- linen: "#faf0e6",
358
- magenta: "#ff00ff",
359
- maroon: "#800000",
360
- mediumaquamarine: "#66cdaa",
361
- mediumblue: "#0000cd",
362
- mediumorchid: "#ba55d3",
363
- mediumpurple: "#9370db",
364
- mediumseagreen: "#3cb371",
365
- mediumslateblue: "#7b68ee",
366
- mediumspringgreen: "#00fa9a",
367
- mediumturquoise: "#48d1cc",
368
- mediumvioletred: "#c71585",
369
- midnightblue: "#191970",
370
- mintcream: "#f5fffa",
371
- mistyrose: "#ffe4e1",
372
- moccasin: "#ffe4b5",
373
- navajowhite: "#ffdead",
374
- navy: "#000080",
375
- oldlace: "#fdf5e6",
376
- olive: "#808000",
377
- olivedrab: "#6b8e23",
378
- orange: "#ffa500",
379
- orangered: "#ff4500",
380
- orchid: "#da70d6",
381
- palegoldenrod: "#eee8aa",
382
- palegreen: "#98fb98",
383
- paleturquoise: "#afeeee",
384
- palevioletred: "#db7093",
385
- papayawhip: "#ffefd5",
386
- peachpuff: "#ffdab9",
387
- peru: "#cd853f",
388
- pink: "#ffc0cb",
389
- plum: "#dda0dd",
390
- powderblue: "#b0e0e6",
391
- purple: "#800080",
392
- rebeccapurple: "#663399",
393
- red: "#ff0000",
394
- rosybrown: "#bc8f8f",
395
- royalblue: "#4169e1",
396
- saddlebrown: "#8b4513",
397
- salmon: "#fa8072",
398
- sandybrown: "#f4a460",
399
- seagreen: "#2e8b57",
400
- seashell: "#fff5ee",
401
- sienna: "#a0522d",
402
- silver: "#c0c0c0",
403
- skyblue: "#87ceeb",
404
- slateblue: "#6a5acd",
405
- slategray: "#708090",
406
- slategrey: "#708090",
407
- snow: "#fffafa",
408
- springgreen: "#00ff7f",
409
- steelblue: "#4682b4",
410
- tan: "#d2b48c",
411
- teal: "#008080",
412
- thistle: "#d8bfd8",
413
- tomato: "#ff6347",
414
- turquoise: "#40e0d0",
415
- violet: "#ee82ee",
416
- wheat: "#f5deb3",
417
- white: "#ffffff",
418
- whitesmoke: "#f5f5f5",
419
- yellow: "#ffff00",
420
- yellowgreen: "#9acd32"
421
- };
422
- function Et(e) {
423
- var t = { r: 0, g: 0, b: 0 }, n = 1, a = null, r = null, i = null, o = !1, l = !1;
424
- return typeof e == "string" && (e = Ft(e)), typeof e == "object" && (O(e.r) && O(e.g) && O(e.b) ? (t = $t(e.r, e.g, e.b), o = !0, l = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : O(e.h) && O(e.s) && O(e.v) ? (a = se(e.s), r = se(e.v), t = Ot(e.h, a, r), o = !0, l = "hsv") : O(e.h) && O(e.s) && O(e.l) && (a = se(e.s), i = se(e.l), t = zt(e.h, a, i), o = !0, l = "hsl"), Object.prototype.hasOwnProperty.call(e, "a") && (n = e.a)), n = Qe(n), {
425
- ok: o,
426
- format: e.format || l,
427
- r: Math.min(255, Math.max(t.r, 0)),
428
- g: Math.min(255, Math.max(t.g, 0)),
429
- b: Math.min(255, Math.max(t.b, 0)),
430
- a: n
431
- };
432
- }
433
- var Rt = "[-\\+]?\\d+%?", Ht = "[-\\+]?\\d*\\.\\d+%?", N = "(?:".concat(Ht, ")|(?:").concat(Rt, ")"), we = "[\\s|\\(]+(".concat(N, ")[,|\\s]+(").concat(N, ")[,|\\s]+(").concat(N, ")\\s*\\)?"), Se = "[\\s|\\(]+(".concat(N, ")[,|\\s]+(").concat(N, ")[,|\\s]+(").concat(N, ")[,|\\s]+(").concat(N, ")\\s*\\)?"), k = {
434
- CSS_UNIT: new RegExp(N),
435
- rgb: new RegExp("rgb" + we),
436
- rgba: new RegExp("rgba" + Se),
437
- hsl: new RegExp("hsl" + we),
438
- hsla: new RegExp("hsla" + Se),
439
- hsv: new RegExp("hsv" + we),
440
- hsva: new RegExp("hsva" + Se),
441
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
442
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
443
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
444
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
445
- };
446
- function Ft(e) {
447
- if (e = e.trim().toLowerCase(), e.length === 0)
448
- return !1;
449
- var t = !1;
450
- if (ke[e])
451
- e = ke[e], t = !0;
452
- else if (e === "transparent")
453
- return { r: 0, g: 0, b: 0, a: 0, format: "name" };
454
- var n = k.rgb.exec(e);
455
- return n ? { r: n[1], g: n[2], b: n[3] } : (n = k.rgba.exec(e), n ? { r: n[1], g: n[2], b: n[3], a: n[4] } : (n = k.hsl.exec(e), n ? { h: n[1], s: n[2], l: n[3] } : (n = k.hsla.exec(e), n ? { h: n[1], s: n[2], l: n[3], a: n[4] } : (n = k.hsv.exec(e), n ? { h: n[1], s: n[2], v: n[3] } : (n = k.hsva.exec(e), n ? { h: n[1], s: n[2], v: n[3], a: n[4] } : (n = k.hex8.exec(e), n ? {
456
- r: S(n[1]),
457
- g: S(n[2]),
458
- b: S(n[3]),
459
- a: Ve(n[4]),
460
- format: t ? "name" : "hex8"
461
- } : (n = k.hex6.exec(e), n ? {
462
- r: S(n[1]),
463
- g: S(n[2]),
464
- b: S(n[3]),
465
- format: t ? "name" : "hex"
466
- } : (n = k.hex4.exec(e), n ? {
467
- r: S(n[1] + n[1]),
468
- g: S(n[2] + n[2]),
469
- b: S(n[3] + n[3]),
470
- a: Ve(n[4] + n[4]),
471
- format: t ? "name" : "hex8"
472
- } : (n = k.hex3.exec(e), n ? {
473
- r: S(n[1] + n[1]),
474
- g: S(n[2] + n[2]),
475
- b: S(n[3] + n[3]),
476
- format: t ? "name" : "hex"
477
- } : !1)))))))));
478
- }
479
- function O(e) {
480
- return !!k.CSS_UNIT.exec(String(e));
481
- }
482
- var Q = (
483
- /** @class */
484
- function() {
485
- function e(t, n) {
486
- t === void 0 && (t = ""), n === void 0 && (n = {});
487
- var a;
488
- if (t instanceof e)
489
- return t;
490
- typeof t == "number" && (t = Dt(t)), this.originalInput = t;
491
- var r = Et(t);
492
- this.originalInput = t, this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (a = n.format) !== null && a !== void 0 ? a : r.format, this.gradientType = n.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = r.ok;
493
- }
494
- return e.prototype.isDark = function() {
495
- return this.getBrightness() < 128;
496
- }, e.prototype.isLight = function() {
497
- return !this.isDark();
498
- }, e.prototype.getBrightness = function() {
499
- var t = this.toRgb();
500
- return (t.r * 299 + t.g * 587 + t.b * 114) / 1e3;
501
- }, e.prototype.getLuminance = function() {
502
- var t = this.toRgb(), n, a, r, i = t.r / 255, o = t.g / 255, l = t.b / 255;
503
- return i <= 0.03928 ? n = i / 12.92 : n = Math.pow((i + 0.055) / 1.055, 2.4), o <= 0.03928 ? a = o / 12.92 : a = Math.pow((o + 0.055) / 1.055, 2.4), l <= 0.03928 ? r = l / 12.92 : r = Math.pow((l + 0.055) / 1.055, 2.4), 0.2126 * n + 0.7152 * a + 0.0722 * r;
504
- }, e.prototype.getAlpha = function() {
505
- return this.a;
506
- }, e.prototype.setAlpha = function(t) {
507
- return this.a = Qe(t), this.roundA = Math.round(100 * this.a) / 100, this;
508
- }, e.prototype.isMonochrome = function() {
509
- var t = this.toHsl().s;
510
- return t === 0;
511
- }, e.prototype.toHsv = function() {
512
- var t = je(this.r, this.g, this.b);
513
- return { h: t.h * 360, s: t.s, v: t.v, a: this.a };
514
- }, e.prototype.toHsvString = function() {
515
- var t = je(this.r, this.g, this.b), n = Math.round(t.h * 360), a = Math.round(t.s * 100), r = Math.round(t.v * 100);
516
- return this.a === 1 ? "hsv(".concat(n, ", ").concat(a, "%, ").concat(r, "%)") : "hsva(".concat(n, ", ").concat(a, "%, ").concat(r, "%, ").concat(this.roundA, ")");
517
- }, e.prototype.toHsl = function() {
518
- var t = Pe(this.r, this.g, this.b);
519
- return { h: t.h * 360, s: t.s, l: t.l, a: this.a };
520
- }, e.prototype.toHslString = function() {
521
- var t = Pe(this.r, this.g, this.b), n = Math.round(t.h * 360), a = Math.round(t.s * 100), r = Math.round(t.l * 100);
522
- return this.a === 1 ? "hsl(".concat(n, ", ").concat(a, "%, ").concat(r, "%)") : "hsla(".concat(n, ", ").concat(a, "%, ").concat(r, "%, ").concat(this.roundA, ")");
523
- }, e.prototype.toHex = function(t) {
524
- return t === void 0 && (t = !1), Be(this.r, this.g, this.b, t);
525
- }, e.prototype.toHexString = function(t) {
526
- return t === void 0 && (t = !1), "#" + this.toHex(t);
527
- }, e.prototype.toHex8 = function(t) {
528
- return t === void 0 && (t = !1), Lt(this.r, this.g, this.b, this.a, t);
529
- }, e.prototype.toHex8String = function(t) {
530
- return t === void 0 && (t = !1), "#" + this.toHex8(t);
531
- }, e.prototype.toRgb = function() {
532
- return {
533
- r: Math.round(this.r),
534
- g: Math.round(this.g),
535
- b: Math.round(this.b),
536
- a: this.a
537
- };
538
- }, e.prototype.toRgbString = function() {
539
- var t = Math.round(this.r), n = Math.round(this.g), a = Math.round(this.b);
540
- return this.a === 1 ? "rgb(".concat(t, ", ").concat(n, ", ").concat(a, ")") : "rgba(".concat(t, ", ").concat(n, ", ").concat(a, ", ").concat(this.roundA, ")");
541
- }, e.prototype.toPercentageRgb = function() {
542
- var t = function(n) {
543
- return "".concat(Math.round(g(n, 255) * 100), "%");
544
- };
545
- return {
546
- r: t(this.r),
547
- g: t(this.g),
548
- b: t(this.b),
549
- a: this.a
550
- };
551
- }, e.prototype.toPercentageRgbString = function() {
552
- var t = function(n) {
553
- return Math.round(g(n, 255) * 100);
554
- };
555
- return this.a === 1 ? "rgb(".concat(t(this.r), "%, ").concat(t(this.g), "%, ").concat(t(this.b), "%)") : "rgba(".concat(t(this.r), "%, ").concat(t(this.g), "%, ").concat(t(this.b), "%, ").concat(this.roundA, ")");
556
- }, e.prototype.toName = function() {
557
- if (this.a === 0)
558
- return "transparent";
559
- if (this.a < 1)
560
- return !1;
561
- for (var t = "#" + Be(this.r, this.g, this.b, !1), n = 0, a = Object.entries(ke); n < a.length; n++) {
562
- var r = a[n], i = r[0], o = r[1];
563
- if (t === o)
564
- return i;
565
- }
566
- return !1;
567
- }, e.prototype.toString = function(t) {
568
- var n = !!t;
569
- t = t ?? this.format;
570
- var a = !1, r = this.a < 1 && this.a >= 0, i = !n && r && (t.startsWith("hex") || t === "name");
571
- return i ? t === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (t === "rgb" && (a = this.toRgbString()), t === "prgb" && (a = this.toPercentageRgbString()), (t === "hex" || t === "hex6") && (a = this.toHexString()), t === "hex3" && (a = this.toHexString(!0)), t === "hex4" && (a = this.toHex8String(!0)), t === "hex8" && (a = this.toHex8String()), t === "name" && (a = this.toName()), t === "hsl" && (a = this.toHslString()), t === "hsv" && (a = this.toHsvString()), a || this.toHexString());
572
- }, e.prototype.toNumber = function() {
573
- return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
574
- }, e.prototype.clone = function() {
575
- return new e(this.toString());
576
- }, e.prototype.lighten = function(t) {
577
- t === void 0 && (t = 10);
578
- var n = this.toHsl();
579
- return n.l += t / 100, n.l = oe(n.l), new e(n);
580
- }, e.prototype.brighten = function(t) {
581
- t === void 0 && (t = 10);
582
- var n = this.toRgb();
583
- return n.r = Math.max(0, Math.min(255, n.r - Math.round(255 * -(t / 100)))), n.g = Math.max(0, Math.min(255, n.g - Math.round(255 * -(t / 100)))), n.b = Math.max(0, Math.min(255, n.b - Math.round(255 * -(t / 100)))), new e(n);
584
- }, e.prototype.darken = function(t) {
585
- t === void 0 && (t = 10);
586
- var n = this.toHsl();
587
- return n.l -= t / 100, n.l = oe(n.l), new e(n);
588
- }, e.prototype.tint = function(t) {
589
- return t === void 0 && (t = 10), this.mix("white", t);
590
- }, e.prototype.shade = function(t) {
591
- return t === void 0 && (t = 10), this.mix("black", t);
592
- }, e.prototype.desaturate = function(t) {
593
- t === void 0 && (t = 10);
594
- var n = this.toHsl();
595
- return n.s -= t / 100, n.s = oe(n.s), new e(n);
596
- }, e.prototype.saturate = function(t) {
597
- t === void 0 && (t = 10);
598
- var n = this.toHsl();
599
- return n.s += t / 100, n.s = oe(n.s), new e(n);
600
- }, e.prototype.greyscale = function() {
601
- return this.desaturate(100);
602
- }, e.prototype.spin = function(t) {
603
- var n = this.toHsl(), a = (n.h + t) % 360;
604
- return n.h = a < 0 ? 360 + a : a, new e(n);
605
- }, e.prototype.mix = function(t, n) {
606
- n === void 0 && (n = 50);
607
- var a = this.toRgb(), r = new e(t).toRgb(), i = n / 100, o = {
608
- r: (r.r - a.r) * i + a.r,
609
- g: (r.g - a.g) * i + a.g,
610
- b: (r.b - a.b) * i + a.b,
611
- a: (r.a - a.a) * i + a.a
612
- };
613
- return new e(o);
614
- }, e.prototype.analogous = function(t, n) {
615
- t === void 0 && (t = 6), n === void 0 && (n = 30);
616
- var a = this.toHsl(), r = 360 / n, i = [this];
617
- for (a.h = (a.h - (r * t >> 1) + 720) % 360; --t; )
618
- a.h = (a.h + r) % 360, i.push(new e(a));
619
- return i;
620
- }, e.prototype.complement = function() {
621
- var t = this.toHsl();
622
- return t.h = (t.h + 180) % 360, new e(t);
623
- }, e.prototype.monochromatic = function(t) {
624
- t === void 0 && (t = 6);
625
- for (var n = this.toHsv(), a = n.h, r = n.s, i = n.v, o = [], l = 1 / t; t--; )
626
- o.push(new e({ h: a, s: r, v: i })), i = (i + l) % 1;
627
- return o;
628
- }, e.prototype.splitcomplement = function() {
629
- var t = this.toHsl(), n = t.h;
630
- return [
631
- this,
632
- new e({ h: (n + 72) % 360, s: t.s, l: t.l }),
633
- new e({ h: (n + 216) % 360, s: t.s, l: t.l })
634
- ];
635
- }, e.prototype.onBackground = function(t) {
636
- var n = this.toRgb(), a = new e(t).toRgb();
637
- return new e({
638
- r: a.r + (n.r - a.r) * n.a,
639
- g: a.g + (n.g - a.g) * n.a,
640
- b: a.b + (n.b - a.b) * n.a
641
- });
642
- }, e.prototype.triad = function() {
643
- return this.polyad(3);
644
- }, e.prototype.tetrad = function() {
645
- return this.polyad(4);
646
- }, e.prototype.polyad = function(t) {
647
- for (var n = this.toHsl(), a = n.h, r = [this], i = 360 / t, o = 1; o < t; o++)
648
- r.push(new e({ h: (a + o * i) % 360, s: n.s, l: n.l }));
649
- return r;
650
- }, e.prototype.equals = function(t) {
651
- return this.toRgbString() === new e(t).toRgbString();
652
- }, e;
653
- }()
654
- );
655
- const Pt = new de("viewFadeIn", {
656
- "0%": {
657
- opacity: 0
658
- },
659
- "100%": {
660
- opacity: 1
661
- }
662
- }), jt = new de("viewFadeOut", {
663
- "0%": {
664
- opacity: 1
665
- },
666
- "100%": {
667
- opacity: 0
668
- }
669
- }), Bt = new de("viewZoomBadgeIn", {
670
- "0%": {
671
- transform: "scale(0.2)",
672
- opacity: 0
673
- },
674
- "100%": {
675
- transform: "scale(1)",
676
- opacity: 1
677
- }
678
- }), Vt = new de("viewZoomBadgeOut", {
679
- "0%": {
680
- transform: "scale(1)"
681
- },
682
- "100%": {
683
- transform: "scale(0.2)",
684
- opacity: 0
685
- }
686
- }), Ye = (e) => ({
687
- position: e || "absolute",
688
- inset: 0
689
- });
690
- function xe(e) {
691
- return {
692
- position: e,
693
- top: 0,
694
- insetInlineEnd: 0,
695
- bottom: 0,
696
- insetInlineStart: 0
697
- };
698
- }
699
- const Yt = (e) => ({
700
- boxSizing: "border-box",
701
- margin: 0,
702
- padding: 0,
703
- color: e.colorText,
704
- fontSize: e.fontSize,
705
- lineHeight: e.lineHeight,
706
- listStyle: "none",
707
- fontFamily: e.fontFamily
708
- }), Wt = (e) => {
709
- const { componentCls: t, modalMaskBg: n, paddingSM: a, previewOperationColorDisabled: r, motionDurationSlow: i } = e, o = new Q(n).setAlpha(0.1), l = o.clone().setAlpha(0.2);
710
- return {
711
- [`${t}-operations`]: {
712
- ...Yt(e),
713
- display: "flex",
714
- flexDirection: "row-reverse",
715
- alignItems: "center",
716
- color: e.previewOperationColor,
717
- listStyle: "none",
718
- background: o.toRgbString(),
719
- pointerEvents: "auto",
720
- "&-operation": {
721
- marginInlineStart: a,
722
- padding: a,
723
- cursor: "pointer",
724
- transition: `all ${i}`,
725
- userSelect: "none",
726
- "&:hover": {
727
- background: l.toRgbString()
728
- },
729
- "&-disabled": {
730
- color: r,
731
- pointerEvents: "none"
732
- },
733
- "&:last-of-type": {
734
- marginInlineStart: 0
735
- }
736
- },
737
- "&-progress": {
738
- position: "absolute",
739
- left: { _skip_check_: !0, value: "50%" },
740
- transform: "translateX(-50%)"
741
- },
742
- "&-icon": {
743
- fontSize: e.previewOperationSize
744
- }
745
- }
746
- };
747
- }, Gt = (e) => {
748
- const { modalMaskBg: t, previewOperationColorDisabled: n, zIndexPopup: a, motionDurationSlow: r } = e, i = new Q(t).setAlpha(0.1), o = i.clone().setAlpha(0.2);
749
- return {
750
- [`${e.componentCls}-switch-left, ${e.componentCls}-switch-right`]: {
751
- position: "fixed",
752
- insetBlockStart: "50%",
753
- zIndex: a + 1,
754
- display: "flex",
755
- alignItems: "center",
756
- justifyContent: "center",
757
- width: e.imagePreviewSwitchSize,
758
- height: e.imagePreviewSwitchSize,
759
- marginTop: -e.imagePreviewSwitchSize / 2,
760
- color: e.previewOperationColor,
761
- background: i.toRgbString(),
762
- borderRadius: "50%",
763
- transform: "translateY(-50%)",
764
- cursor: "pointer",
765
- transition: `all ${r}`,
766
- pointerEvents: "auto",
767
- userSelect: "none",
768
- "&:hover": {
769
- background: o.toRgbString()
770
- },
771
- ["&-disabled"]: {
772
- "&, &:hover": {
773
- color: n,
774
- background: "transparent",
775
- cursor: "not-allowed",
776
- [`> ${e.iconCls}`]: {
777
- cursor: "not-allowed"
778
- }
779
- }
780
- },
781
- [`> ${e.iconCls}`]: {
782
- fontSize: e.previewOperationSize
783
- }
784
- },
785
- [`${e.componentCls}-switch-left`]: {
786
- insetInlineStart: e.marginSM
787
- },
788
- [`${e.componentCls}-switch-right`]: {
789
- insetInlineEnd: e.marginSM
790
- }
791
- };
792
- }, _t = (e) => ({
793
- [e.componentCls]: {
794
- ["&-root"]: {
795
- ...xe("fixed"),
796
- zIndex: e.zIndexPopup,
797
- overflow: "auto",
798
- outline: 0,
799
- WebkitOverflowScrolling: "touch"
800
- },
801
- ["&-wrapper"]: {
802
- ...xe("fixed"),
803
- zIndex: e.zIndexPopup,
804
- overflow: "auto",
805
- outline: 0,
806
- WebkitOverflowScrolling: "touch"
807
- },
808
- ["&-mask"]: {
809
- ...xe("fixed"),
810
- zIndex: e.zIndexPopupBase,
811
- height: "100%",
812
- backgroundColor: e.colorBgMask
813
- },
814
- ["&-block"]: {
815
- height: "100%",
816
- textAlign: "center",
817
- pointerEvents: "none"
818
- },
819
- ["&-body"]: {
820
- ...Ye(),
821
- overflow: "hidden"
822
- },
823
- ["&-canvas"]: {
824
- ...Ye(),
825
- display: "flex",
826
- justifyContent: "center",
827
- alignItems: "center",
828
- "&::before": {
829
- display: "inline-block",
830
- width: 1,
831
- height: "50%",
832
- marginInlineEnd: -1,
833
- content: '""'
834
- }
835
- },
836
- ["&-img"]: {
837
- maxWidth: "100%",
838
- maxHeight: "100%",
839
- verticalAlign: "middle",
840
- transform: "scale3d(1, 1, 1)",
841
- cursor: "grab",
842
- transition: `transform ${e.motionDurationSlow} ${e.motionEaseOut} 0s`,
843
- userSelect: "none",
844
- pointerEvents: "auto"
845
- },
846
- ["&-fade-appear, &-fade-enter"]: {
847
- animationName: Pt,
848
- animationDuration: e.motionDurationSlow,
849
- animationTimingFunction: "linear"
850
- },
851
- ["&-fade-leave"]: {
852
- animationName: jt,
853
- animationDuration: e.motionDurationSlow,
854
- animationTimingFunction: "linear"
855
- },
856
- ["&-zoom-appear, &-zoom-enter"]: {
857
- animationName: Bt,
858
- opacity: 0,
859
- animationTimingFunction: e.motionEaseOutCirc,
860
- animationFillMode: "both",
861
- transform: "none",
862
- animationDuration: e.motionDurationSlow,
863
- userSelect: "none"
864
- },
865
- ["&-zoom-enter-active"]: {
866
- animationPlayState: "running"
867
- },
868
- ["&-zoom-leave"]: {
869
- animationName: Vt,
870
- animationDuration: e.motionDurationSlow,
871
- animationTimingFunction: e.motionEaseOutBack,
872
- animationFillMode: "both"
873
- }
874
- },
875
- [`${e.componentCls}-root`]: {
876
- [`${e.componentCls}-wrapper`]: {
877
- zIndex: e.zIndexPopup
878
- }
879
- },
880
- [`${e.componentCls}-operations-wrapper`]: {
881
- position: "fixed",
882
- insetBlockStart: 0,
883
- insetInlineEnd: 0,
884
- zIndex: e.zIndexPopup + 1,
885
- width: "100%"
886
- },
887
- "&": [Wt(e), Gt(e)]
888
- }), Ut = Je("ImageView", (e) => {
889
- const t = Te(e, {
890
- zIndexPopup: e.zIndexPopupBase + 80,
891
- previewOperationColorDisabled: new Q(e.colorTextLightSolid).setAlpha(0.25).toRgbString(),
892
- modalMaskBg: new Q("#000").setAlpha(0.45).toRgbString(),
893
- previewOperationColor: new Q(e.colorTextLightSolid).toRgbString(),
894
- previewOperationSize: e.fontSizeIcon * 1.5,
895
- imagePreviewSwitchSize: e.controlHeightLG,
896
- iconCls: "anticon"
897
- });
898
- return [_t(t)];
899
- }), Ke = wt({
900
- func: void 0,
901
- bool: void 0,
902
- string: void 0,
903
- number: void 0,
904
- array: void 0,
905
- object: void 0,
906
- integer: void 0
907
- });
908
- Ke.extend([{
909
- name: "looseBool",
910
- getter: !0,
911
- type: Boolean,
912
- default: void 0
913
- }, {
914
- name: "style",
915
- getter: !0,
916
- type: [String, Object],
917
- default: void 0
918
- }, {
919
- name: "VueNode",
920
- getter: !0,
921
- type: null
922
- }]);
923
- const B = Ke, F = {
924
- infinite: {
925
- type: Boolean,
926
- default: !0
927
- },
928
- zIndex: {
929
- type: Number,
930
- default: 2e3
931
- },
932
- initialIndex: {
933
- type: Number,
934
- default: 0
935
- },
936
- getContainer: {
937
- type: String
938
- }
939
- }, ce = {
940
- previewTeleported: {
941
- type: Boolean,
942
- default: !0
943
- },
944
- hideOnClickModal: {
945
- type: Boolean,
946
- default: !0
947
- },
948
- wrapperClassName: String,
949
- wrapperStyle: { type: Object, default: void 0 },
950
- src: {
951
- type: String,
952
- default: ""
953
- },
954
- alt: {
955
- type: String,
956
- default: ""
957
- },
958
- fit: {
959
- type: String,
960
- default: "contain"
961
- },
962
- lazy: B.bool,
963
- scrollContainer: {
964
- type: [String, Object]
965
- },
966
- placeholder: {
967
- type: [Function, Object],
968
- default: () => {
969
- }
970
- },
971
- fallback: {
972
- type: [Function, Object],
973
- default: () => {
974
- }
975
- },
976
- onLoad: {
977
- type: Function
978
- },
979
- onError: {
980
- type: Function
981
- },
982
- onClick: {
983
- type: Function
984
- },
985
- disablePreview: B.bool,
986
- previewSrcList: {
987
- type: Array,
988
- default: () => []
989
- },
990
- imageClassName: B.string,
991
- imageStyle: B.style,
992
- width: B.number,
993
- height: B.number,
994
- zIndex: F.zIndex,
995
- infinite: F.infinite,
996
- getContainer: F.getContainer,
997
- initialIndex: F.initialIndex
998
- }, Zt = {
999
- urlList: {
1000
- type: Array,
1001
- default: () => []
1002
- },
1003
- teleported: ce.previewTeleported,
1004
- zIndex: F.zIndex,
1005
- initialIndex: F.initialIndex,
1006
- infinite: F.infinite,
1007
- getContainer: ce.getContainer,
1008
- onHideOnClickModal: ce.hideOnClickModal,
1009
- icons: {
1010
- type: Object,
1011
- default: () => ({})
1012
- }
1013
- }, V = {
1014
- tab: "Tab",
1015
- enter: "Enter",
1016
- space: "Space",
1017
- left: "ArrowLeft",
1018
- up: "ArrowUp",
1019
- right: "ArrowRight",
1020
- down: "ArrowDown",
1021
- esc: "Escape",
1022
- delete: "Delete",
1023
- backspace: "Backspace"
1024
- }, le = function(e, t, n, a = !1) {
1025
- e && t && n && e.addEventListener(t, n, a);
1026
- }, Ie = function(e, t, n, a = !1) {
1027
- e && t && n && e.removeEventListener(t, n, a);
1028
- }, X = {
1029
- CONTAIN: {
1030
- name: "contain",
1031
- icon: c(ot, null, null)
1032
- },
1033
- ORIGINAL: {
1034
- name: "original",
1035
- icon: c(st, null, null)
1036
- }
1037
- }, Xt = function() {
1038
- return !q && !!window.navigator.userAgent.match(/firefox/i);
1039
- }, We = Xt() ? "DOMMouseScroll" : "mousewheel";
1040
- function Me(e) {
1041
- let t = !1;
1042
- return function(...n) {
1043
- t || (t = !0, window.requestAnimationFrame(() => {
1044
- e.apply(this, n), t = !1;
1045
- }));
1046
- };
1047
- }
1048
- const qt = /* @__PURE__ */ _e({
1049
- props: Zt,
1050
- emits: ["close", "switch"],
1051
- setup: function(e, {
1052
- emit: t,
1053
- expose: n
1054
- }) {
1055
- var re, ie, R, Z, $e;
1056
- let a = null, r = null, i = null;
1057
- const o = J({
1058
- suffixCls: "image-viewer"
1059
- }), [l, u] = Ut(o), p = ze(!1), [v, z] = Ee(!1), [C, m] = Ee(!1), A = x(!0), d = x(e.initialIndex), Y = x(null), P = x(null), W = x(X.CONTAIN), h = x({
1060
- scale: 1,
1061
- deg: 0,
1062
- offsetX: 0,
1063
- offsetY: 0,
1064
- enableTransition: !1
1065
- }), G = M(() => e.urlList.length > 1), K = M(() => d.value === 0), ee = M(() => d.value === e.urlList.length - 1), te = M(() => e.urlList[d.value]), he = M(() => {
1066
- const {
1067
- scale: s,
1068
- deg: y,
1069
- offsetX: w,
1070
- offsetY: $,
1071
- enableTransition: b
1072
- } = h.value, I = {
1073
- transform: `scale(${s}) rotate(${y}deg)`,
1074
- transition: b ? "transform .3s" : "",
1075
- marginLeft: `${w}px`,
1076
- marginTop: `${$}px`
1077
- };
1078
- return W.value.name === X.CONTAIN.name && (I.maxWidth = I.maxHeight = "100%"), I;
1079
- }), ne = () => {
1080
- pe(), t("close"), h.value = {
1081
- scale: 1,
1082
- deg: 0,
1083
- offsetX: 0,
1084
- offsetY: 0,
1085
- enableTransition: !1
1086
- };
1087
- }, ge = (s) => {
1088
- p.value ? p.value = !1 : Y.value === (s == null ? void 0 : s.target) && (m(!1), d.value = e.initialIndex);
1089
- }, ve = () => {
1090
- a = Me((s) => {
1091
- switch (s.code) {
1092
- case V.esc:
1093
- m(!1);
1094
- break;
1095
- case V.space:
1096
- j();
1097
- break;
1098
- case V.left:
1099
- ae();
1100
- break;
1101
- case V.up:
1102
- T("zoomIn");
1103
- break;
1104
- case V.right:
1105
- U();
1106
- break;
1107
- case V.down:
1108
- T("zoomOut");
1109
- break;
1110
- }
1111
- }), r = Me((s) => {
1112
- (s.wheelDelta ? s.wheelDelta : -s.detail) > 0 ? T("zoomIn", {
1113
- zoomRate: 0.015,
1114
- enableTransition: !1
1115
- }) : T("zoomOut", {
1116
- zoomRate: 0.015,
1117
- enableTransition: !1
1118
- });
1119
- }), le(document, "keydown", a), le(document, We, r);
1120
- }, pe = () => {
1121
- Ie(document, "keydown", a), Ie(document, We, r), a = null, r = null;
1122
- }, _ = () => {
1123
- A.value = !1;
1124
- }, f = (s) => {
1125
- A.value = !1, s.target.alt = "加载失败";
1126
- }, D = ze(), L = (s) => {
1127
- if (A.value || s.button !== 0)
1128
- return;
1129
- s.preventDefault(), s.stopPropagation(), clearTimeout(D.value), p.value = !0;
1130
- const {
1131
- offsetX: y,
1132
- offsetY: w
1133
- } = h.value, $ = s.pageX, b = s.pageY;
1134
- i = Me((I) => {
1135
- h.value = {
1136
- ...h.value,
1137
- offsetX: y + I.pageX - $,
1138
- offsetY: w + I.pageY - b
1139
- };
1140
- }), le(document, "mousemove", i), le(document, "mouseup", () => {
1141
- Ie(document, "mousemove", i), v.value && C.value && (D.value = setTimeout(() => {
1142
- p.value = !1;
1143
- }));
1144
- });
1145
- }, E = () => {
1146
- h.value = {
1147
- scale: 1,
1148
- deg: 0,
1149
- offsetX: 0,
1150
- offsetY: 0,
1151
- enableTransition: !1
1152
- };
1153
- }, j = () => {
1154
- if (A.value)
1155
- return;
1156
- const s = Object.keys(X), y = Object.values(X), w = W.value.name, b = (y.findIndex((I) => I.name === w) + 1) % s.length;
1157
- W.value = X[s[b]], E();
1158
- }, ae = () => {
1159
- if (K.value && !e.infinite)
1160
- return;
1161
- const s = e.urlList.length;
1162
- d.value = (d.value - 1 + s) % s;
1163
- }, U = () => {
1164
- if (ee.value && !e.infinite)
1165
- return;
1166
- const s = e.urlList.length;
1167
- d.value = (d.value + 1) % s;
1168
- }, T = (s, y = {}) => {
1169
- if (A.value)
1170
- return;
1171
- const {
1172
- zoomRate: w,
1173
- rotateDeg: $,
1174
- enableTransition: b
1175
- } = {
1176
- zoomRate: 0.2,
1177
- rotateDeg: 90,
1178
- enableTransition: !0,
1179
- ...y
1180
- };
1181
- switch (s) {
1182
- case "zoomOut":
1183
- h.value.scale > 0.2 && (h.value.scale = parseFloat((h.value.scale - w).toFixed(3)));
1184
- break;
1185
- case "zoomIn":
1186
- h.value.scale = parseFloat((h.value.scale + w).toFixed(3));
1187
- break;
1188
- case "clocelise":
1189
- h.value.deg += $;
1190
- break;
1191
- case "anticlocelise":
1192
- h.value.deg -= $;
1193
- break;
1194
- }
1195
- h.value.enableTransition = b;
1196
- }, me = [{
1197
- icon: ((re = e.icons) == null ? void 0 : re.close) || c(lt, null, null),
1198
- onClick: (s) => {
1199
- s.stopPropagation(), m(!1);
1200
- },
1201
- type: "close"
1202
- }, {
1203
- icon: ((ie = e.icons) == null ? void 0 : ie.zoomIn) || c(ut, null, null),
1204
- onClick: (s) => {
1205
- s.stopPropagation(), T("zoomIn");
1206
- },
1207
- type: "zoomIn"
1208
- }, {
1209
- icon: ((R = e.icons) == null ? void 0 : R.zoomOut) || c(ct, null, null),
1210
- onClick: (s) => {
1211
- s.stopPropagation(), T("zoomOut");
1212
- },
1213
- type: "zoomOut"
1214
- }, {
1215
- icon: ((Z = e.icons) == null ? void 0 : Z.rotateRight) || c(ft, null, null),
1216
- onClick: (s) => {
1217
- s.stopPropagation(), T("anticlocelise");
1218
- },
1219
- type: "rotateRight"
1220
- }, {
1221
- icon: (($e = e.icons) == null ? void 0 : $e.rotateLeft) || c(dt, null, null),
1222
- onClick: (s) => {
1223
- s.stopPropagation(), T("clocelise");
1224
- },
1225
- type: "rotateLeft"
1226
- }];
1227
- return ue(te, () => {
1228
- Ue(() => {
1229
- P.value.complete || (A.value = !0);
1230
- });
1231
- }), ue(d, (s) => {
1232
- E(), t("switch", s);
1233
- }), ue(v, (s) => {
1234
- s && (C.value = s);
1235
- }), Xe(() => {
1236
- var s, y;
1237
- ve(), (y = (s = Y.value) == null ? void 0 : s.focus) == null || y.call(s);
1238
- }), n({
1239
- setOpen: z
1240
- }), () => {
1241
- const s = Fe(`${o}-fade`), y = Fe(`${o}-zoom`);
1242
- return l(c(tt, {
1243
- to: e.getContainer || "body",
1244
- disabled: !e.teleported
1245
- }, {
1246
- default: () => [v.value && c("div", {
1247
- class: `${o}-root ${u.value}`
1248
- }, [c(Oe, s, {
1249
- default: () => [Le(c("div", {
1250
- class: `${o}-mask ${u.value}`
1251
- }, null), [[Ne, v.value && C.value]])]
1252
- }), c("div", {
1253
- ref: Y,
1254
- tabindex: -1,
1255
- class: [`${o}-wrapper`, `${u.value}`],
1256
- onClick: (w) => e.onHideOnClickModal && ge(w)
1257
- }, [c(Oe, Ze(y, {
1258
- onAfterLeave: () => ne()
1259
- }), {
1260
- default: () => {
1261
- var w, $;
1262
- return [Le(c("div", {
1263
- class: `${o}-block ${u.value}`
1264
- }, [c("div", {
1265
- class: `${o}-content ${u.value}`
1266
- }, [c("div", {
1267
- class: `${o}-body ${u.value}`
1268
- }, [c("div", {
1269
- class: `${o}-operations-wrapper ${u.value}`,
1270
- onClick: (b) => b.stopPropagation()
1271
- }, [c("ul", {
1272
- class: `${o}-operations ${u.value}`
1273
- }, [me.map(({
1274
- icon: b,
1275
- onClick: I,
1276
- type: be
1277
- }) => c("li", {
1278
- class: `${o}-operations-operation ${u.value}`,
1279
- onClick: I,
1280
- key: be
1281
- }, [nt(b, {
1282
- class: `${o}-operations-icon ${u.value}`
1283
- })]))])]), c("div", {
1284
- class: `${o}-canvas ${u.value}`
1285
- }, [e.urlList.map((b, I) => c("img", {
1286
- ref: P,
1287
- class: `${o}-img ${u.value}`,
1288
- style: {
1289
- ...he.value,
1290
- display: I === d.value ? "block" : "none"
1291
- },
1292
- key: b,
1293
- src: b,
1294
- onLoad: () => _(),
1295
- onError: (be) => f(be),
1296
- onMousedown: L
1297
- }, null))]), G.value && c("div", {
1298
- class: [`${o}-switch-left`, d.value === 0 && !e.infinite ? `${o}-switch-left-disabled` : "", `${u.value}`],
1299
- onClick: ae
1300
- }, [((w = e.icons) == null ? void 0 : w.left) || c(ht, null, null)]), G.value && c("div", {
1301
- class: [`${o}-switch-right`, d.value === e.urlList.length - 1 && !e.infinite ? `${o}-switch-right-disabled` : "", `${u.value}`],
1302
- onClick: U
1303
- }, [(($ = e.icons) == null ? void 0 : $.right) || c(gt, null, null)])])])]), [[Ne, v.value && C.value]])];
1304
- }
1305
- })])])]
1306
- }));
1307
- };
1308
- }
1309
- }), Ce = {
1310
- width: "100%",
1311
- height: "100%"
1312
- }, Jt = (e) => ({
1313
- [e.componentCls]: {
1314
- display: "inline-block",
1315
- position: "relative",
1316
- overflow: "hidden",
1317
- ["&-inner"]: {
1318
- ...Ce,
1319
- verticalAlign: "top",
1320
- opacity: 1
1321
- },
1322
- ["&-placeholder"]: {
1323
- ...Ce,
1324
- backgroundColor: e.colorBgContainerDisabled,
1325
- backgroundImage: "url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTQuNSAyLjVoLTEzQS41LjUgMCAwIDAgMSAzdjEwYS41LjUgMCAwIDAgLjUuNWgxM2EuNS41IDAgMCAwIC41LS41VjNhLjUuNSAwIDAgMC0uNS0uNXpNNS4yODEgNC43NWExIDEgMCAwIDEgMCAyIDEgMSAwIDAgMSAwLTJ6bTguMDMgNi44M2EuMTI3LjEyNyAwIDAgMS0uMDgxLjAzSDIuNzY5YS4xMjUuMTI1IDAgMCAxLS4wOTYtLjIwN2wyLjY2MS0zLjE1NmEuMTI2LjEyNiAwIDAgMSAuMTc3LS4wMTZsLjAxNi4wMTZMNy4wOCAxMC4wOWwyLjQ3LTIuOTNhLjEyNi4xMjYgMCAwIDEgLjE3Ny0uMDE2bC4wMTUuMDE2IDMuNTg4IDQuMjQ0YS4xMjcuMTI3IDAgMCAxLS4wMi4xNzV6IiBmaWxsPSIjOEM4QzhDIiBmaWxsLXJ1bGU9Im5vbnplcm8iLz48L3N2Zz4=')",
1326
- backgroundRepeat: "no-repeat",
1327
- backgroundPosition: "center center",
1328
- backgroundSize: "30%"
1329
- },
1330
- ["&-error"]: {
1331
- ...Ce,
1332
- display: "flex",
1333
- alignItems: "center",
1334
- justifyContent: "center",
1335
- color: e.colorText,
1336
- backgroundColor: e.colorBgContainerDisabled
1337
- },
1338
- ["&-preview"]: {
1339
- cursor: "pointer"
1340
- }
1341
- }
1342
- }), Qt = Je("Image", (e) => {
1343
- const t = Te(e);
1344
- return [Jt(t)];
1345
- }), Kt = (e) => e && e.nodeType === Node.ELEMENT_NODE;
1346
- let Ge = "";
1347
- const fe = /* @__PURE__ */ _e({
1348
- props: ce,
1349
- name: "GImage",
1350
- emits: ["error", "click", "load"],
1351
- setup(e, {
1352
- slots: t,
1353
- emit: n,
1354
- attrs: a
1355
- }) {
1356
- const r = J({
1357
- suffixCls: "image"
1358
- }), [i, o] = Qt(r), l = x(), u = x(""), p = x(!1), v = x(!0), z = x(!1), C = x(null), m = x();
1359
- let A, d;
1360
- const Y = M(() => !q && e.fit ? {
1361
- "object-fit": e.fit
1362
- } : {}), P = M(() => {
1363
- const {
1364
- previewSrcList: f
1365
- } = e;
1366
- return Array.isArray(f) && f.length > 0;
1367
- }), W = M(() => {
1368
- const {
1369
- src: f,
1370
- previewSrcList: D,
1371
- initialIndex: L
1372
- } = e;
1373
- if (L || L === 0)
1374
- return D.length >= L ? L : 0;
1375
- let E = 0;
1376
- const j = D.indexOf(f);
1377
- return j >= 0 && (E = j), E;
1378
- }), h = () => {
1379
- q || (v.value = !0, p.value = !1, e.src ? u.value = e.src : ne());
1380
- };
1381
- function G() {
1382
- vt(C.value, m.value) && (h(), te());
1383
- }
1384
- const K = St(G, 200), ee = async () => {
1385
- if (q)
1386
- return;
1387
- await Ue();
1388
- const {
1389
- scrollContainer: f
1390
- } = e;
1391
- Kt(f) ? m.value = f : pt(f) && f !== "" ? m.value = document.querySelector(f) ?? void 0 : C.value && (m.value = mt(C.value)), m.value && (A = He(m, "scroll", K), setTimeout(() => G(), 200));
1392
- }, te = () => {
1393
- q || !m.value || !K || (A(), m.value = void 0);
1394
- }, he = (f) => {
1395
- v.value = !1, p.value = !1, n("load", f);
1396
- }, ne = (f) => {
1397
- v.value = !1, p.value = !0, n("error", f);
1398
- }, ge = (f) => {
1399
- if (f.ctrlKey) {
1400
- if (f.deltaY < 0)
1401
- return f.preventDefault(), !1;
1402
- if (f.deltaY > 0)
1403
- return f.preventDefault(), !1;
1404
- }
1405
- }, ve = () => {
1406
- !P.value || e.disablePreview || (d = He("wheel", ge, {
1407
- passive: !1
1408
- }), Ge = document.body.style.overflow, document.body.style.overflow = "hidden", z.value = !0);
1409
- }, pe = () => {
1410
- d == null || d(), document.body.style.overflow = Ge, z.value = !1;
1411
- };
1412
- ue(() => e.src, () => {
1413
- e.lazy ? (v.value = !0, p.value = !1, te(), ee()) : h();
1414
- });
1415
- const _ = (f) => bt(f) ? f + "px" : f;
1416
- return Xe(() => {
1417
- e.lazy ? ee() : h();
1418
- }), () => {
1419
- const {
1420
- crossorigin: f,
1421
- decoding: D,
1422
- alt: L,
1423
- sizes: E,
1424
- srcset: j,
1425
- usemap: ae,
1426
- class: U,
1427
- style: T
1428
- } = a, me = {
1429
- crossorigin: f,
1430
- decoding: D,
1431
- alt: L,
1432
- sizes: E,
1433
- srcset: j,
1434
- usemap: ae,
1435
- style: {
1436
- ...Y.value,
1437
- height: e.height ? _(e.height) : void 0,
1438
- ...T
1439
- }
1440
- }, re = De(t, e, "fallback"), ie = De(t, e, "placeholder");
1441
- return at(() => {
1442
- var R, Z;
1443
- P.value && z.value ? (R = l.value) == null || R.setOpen(!0) : (Z = l.value) == null || Z.setOpen(!1);
1444
- }), i(c(rt, null, [c("div", {
1445
- class: {
1446
- [`${o.value}`]: !0,
1447
- [`${r}`]: !0,
1448
- [`${e.wrapperClassName}`]: e.wrapperClassName
1449
- },
1450
- ref: (R) => C.value = R,
1451
- style: {
1452
- ...e.wrapperStyle,
1453
- width: e.width ? _(e.width) : void 0,
1454
- height: e.height ? _(e.height) : void 0,
1455
- display: e.lazy ? "block" : void 0
1456
- },
1457
- onClick: () => {
1458
- n("click");
1459
- }
1460
- }, [v.value && (ie || c("div", {
1461
- class: `${r}-placeholder ${o.value}`
1462
- }, null)), p.value ? re || c("div", {
1463
- class: `${r}-error ${o.value}`
1464
- }, [it("加载失败")]) : u.value && c("img", Ze(me, {
1465
- class: {
1466
- [`${o.value}`]: !0,
1467
- [`${r}-inner`]: !0,
1468
- [`${r}-preview`]: P.value,
1469
- [`${U}`]: !!U
1470
- },
1471
- alt: e.alt,
1472
- src: u.value,
1473
- onLoad: he,
1474
- onError: ne,
1475
- onClick: () => ve()
1476
- }), null), c(qt, {
1477
- ref: l,
1478
- zIndex: e.zIndex,
1479
- infinite: e.infinite,
1480
- initialIndex: W.value,
1481
- urlList: e.previewSrcList,
1482
- getContainer: e.getContainer,
1483
- onHideOnClickModal: e.hideOnClickModal,
1484
- onClose: () => pe()
1485
- }, null)])]));
1486
- };
1487
- }
1488
- });
1489
- fe.isWImage = !0;
1490
- fe.install = (e) => (e.component(fe.name, fe), e);
1491
- export {
1492
- fe as GImage,
1493
- qt as ImageViewer,
1494
- fe as default
1495
- };