@gx-design-vue/image 0.0.1

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/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # ProTable
2
+
3
+ ```shell
4
+ pnpm add @gx-design-vue/pro-table
5
+ ```
6
+
7
+ ```ts
8
+ // 可全局引入,也可以单独引入
9
+ import { GProTable } from '@gx-design-vue/pro-table'
10
+
11
+ // 如果引入了ant-design-vue 相关组件的样式(table、menu、tooltip、button、input、treeSelect、select、dataPicker、dropdown等相关组件),则执行下面
12
+ import '@gx-design-vue/pro-table/dist/ProTable.less'
13
+
14
+ // 如果没有引入了ant-design-vue 相关组件,则执行下面
15
+ import '@gx-design-vue/pro-table/dist/style.less'
16
+ ```
@@ -0,0 +1,130 @@
1
+ import type { ExtractPropTypes } from 'vue';
2
+ import { gImagePorps } from './props';
3
+ import './style.less';
4
+ export declare type GImageProps = Partial<ExtractPropTypes<typeof gImagePorps>>;
5
+ declare const GImage: import("vue").DefineComponent<{
6
+ appendToBody: {
7
+ type: import("vue").PropType<boolean>;
8
+ default: boolean;
9
+ };
10
+ hideOnClickModal: {
11
+ type: import("vue").PropType<boolean>;
12
+ default: boolean;
13
+ };
14
+ src: {
15
+ type: import("vue").PropType<string>;
16
+ default: string;
17
+ };
18
+ fit: {
19
+ type: import("vue").PropType<string>;
20
+ default: string;
21
+ };
22
+ lazy: import("vue-types").VueTypeValidableDef<boolean> & {
23
+ default: boolean;
24
+ };
25
+ scrollContainer: {
26
+ type: import("vue").PropType<string | HTMLElement | undefined>;
27
+ };
28
+ placeholder: {
29
+ type: import("vue").PropType<import("@gx-design-vue/pro-utils").WithFalse<() => import("@gx-design-vue/pro-utils").CustomRender>>;
30
+ default: () => undefined;
31
+ };
32
+ fallback: {
33
+ type: import("vue").PropType<import("@gx-design-vue/pro-utils").WithFalse<() => import("@gx-design-vue/pro-utils").CustomRender>>;
34
+ default: () => undefined;
35
+ };
36
+ onError: {
37
+ type: import("vue").PropType<(e: Error) => void>;
38
+ };
39
+ onClick: {
40
+ type: import("vue").PropType<(info: any) => void>;
41
+ };
42
+ disablePreview: import("vue-types").VueTypeValidableDef<boolean> & {
43
+ default: boolean;
44
+ };
45
+ previewSrcList: {
46
+ type: import("vue").PropType<string[]>;
47
+ default: () => string[];
48
+ };
49
+ width: import("vue-types").VueTypeValidableDef<number> & {
50
+ default: number;
51
+ };
52
+ height: import("vue-types").VueTypeValidableDef<number> & {
53
+ default: number;
54
+ };
55
+ zIndex: {
56
+ type: import("vue").PropType<number>;
57
+ default: number;
58
+ };
59
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "error")[], "click" | "error", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
60
+ appendToBody: {
61
+ type: import("vue").PropType<boolean>;
62
+ default: boolean;
63
+ };
64
+ hideOnClickModal: {
65
+ type: import("vue").PropType<boolean>;
66
+ default: boolean;
67
+ };
68
+ src: {
69
+ type: import("vue").PropType<string>;
70
+ default: string;
71
+ };
72
+ fit: {
73
+ type: import("vue").PropType<string>;
74
+ default: string;
75
+ };
76
+ lazy: import("vue-types").VueTypeValidableDef<boolean> & {
77
+ default: boolean;
78
+ };
79
+ scrollContainer: {
80
+ type: import("vue").PropType<string | HTMLElement | undefined>;
81
+ };
82
+ placeholder: {
83
+ type: import("vue").PropType<import("@gx-design-vue/pro-utils").WithFalse<() => import("@gx-design-vue/pro-utils").CustomRender>>;
84
+ default: () => undefined;
85
+ };
86
+ fallback: {
87
+ type: import("vue").PropType<import("@gx-design-vue/pro-utils").WithFalse<() => import("@gx-design-vue/pro-utils").CustomRender>>;
88
+ default: () => undefined;
89
+ };
90
+ onError: {
91
+ type: import("vue").PropType<(e: Error) => void>;
92
+ };
93
+ onClick: {
94
+ type: import("vue").PropType<(info: any) => void>;
95
+ };
96
+ disablePreview: import("vue-types").VueTypeValidableDef<boolean> & {
97
+ default: boolean;
98
+ };
99
+ previewSrcList: {
100
+ type: import("vue").PropType<string[]>;
101
+ default: () => string[];
102
+ };
103
+ width: import("vue-types").VueTypeValidableDef<number> & {
104
+ default: number;
105
+ };
106
+ height: import("vue-types").VueTypeValidableDef<number> & {
107
+ default: number;
108
+ };
109
+ zIndex: {
110
+ type: import("vue").PropType<number>;
111
+ default: number;
112
+ };
113
+ }>> & {
114
+ onError?: ((...args: any[]) => any) | undefined;
115
+ onClick?: ((...args: any[]) => any) | undefined;
116
+ }, {
117
+ zIndex: number;
118
+ height: number;
119
+ width: number;
120
+ appendToBody: boolean;
121
+ hideOnClickModal: boolean;
122
+ src: string;
123
+ fit: string;
124
+ lazy: boolean;
125
+ placeholder: import("@gx-design-vue/pro-utils").WithFalse<() => import("@gx-design-vue/pro-utils").CustomRender>;
126
+ fallback: import("@gx-design-vue/pro-utils").WithFalse<() => import("@gx-design-vue/pro-utils").CustomRender>;
127
+ disablePreview: boolean;
128
+ previewSrcList: string[];
129
+ }>;
130
+ export default GImage;
@@ -0,0 +1,59 @@
1
+ export declare const on: (element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
2
+ export declare const off: (element: HTMLElement | Document | Window | null, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
3
+ export declare type AnyFunction<T> = (...args: any[]) => T;
4
+ export declare type ImageViewerAction = 'zoomIn' | 'zoomOut' | 'clocelise' | 'anticlocelise';
5
+ export declare const isFirefox: () => boolean;
6
+ export declare function rafThrottle<T extends AnyFunction<any>>(fn: T): AnyFunction<void>;
7
+ declare const GImageViewer: import("vue").DefineComponent<{
8
+ urlList: {
9
+ type: import("vue").PropType<string[]>;
10
+ default: () => never[];
11
+ };
12
+ zIndex: {
13
+ type: import("vue").PropType<number>;
14
+ default: number;
15
+ };
16
+ initialIndex: {
17
+ type: import("vue").PropType<number>;
18
+ default: number;
19
+ };
20
+ infinite: {
21
+ type: import("vue").PropType<boolean>;
22
+ default: boolean;
23
+ };
24
+ onHideOnClickModal: {
25
+ type: import("vue").PropType<boolean>;
26
+ default: boolean;
27
+ };
28
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "switch")[], "close" | "switch", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
29
+ urlList: {
30
+ type: import("vue").PropType<string[]>;
31
+ default: () => never[];
32
+ };
33
+ zIndex: {
34
+ type: import("vue").PropType<number>;
35
+ default: number;
36
+ };
37
+ initialIndex: {
38
+ type: import("vue").PropType<number>;
39
+ default: number;
40
+ };
41
+ infinite: {
42
+ type: import("vue").PropType<boolean>;
43
+ default: boolean;
44
+ };
45
+ onHideOnClickModal: {
46
+ type: import("vue").PropType<boolean>;
47
+ default: boolean;
48
+ };
49
+ }>> & {
50
+ onClose?: ((...args: any[]) => any) | undefined;
51
+ onSwitch?: ((...args: any[]) => any) | undefined;
52
+ }, {
53
+ urlList: string[];
54
+ zIndex: number;
55
+ initialIndex: number;
56
+ infinite: boolean;
57
+ onHideOnClickModal: boolean;
58
+ }>;
59
+ export default GImageViewer;
@@ -0,0 +1,14 @@
1
+ declare const gImageViewerGroup: import("vue").DefineComponent<{
2
+ hideOnClickModal: {
3
+ type: import("vue").PropType<boolean>;
4
+ default: boolean;
5
+ };
6
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
7
+ hideOnClickModal: {
8
+ type: import("vue").PropType<boolean>;
9
+ default: boolean;
10
+ };
11
+ }>>, {
12
+ hideOnClickModal: boolean;
13
+ }>;
14
+ export default gImageViewerGroup;
@@ -0,0 +1,2 @@
1
+ @gx-prefix: gx;
2
+ @gx-prefix-pro: ~'@{gx-prefix}-pro';
package/dist/image.mjs ADDED
@@ -0,0 +1,592 @@
1
+ import { createVNode as l, defineComponent as Z, ref as g, computed as b, watch as U, nextTick as oe, Fragment as re, resolveComponent as ue, cloneVNode as ve, Teleport as ce, isVNode as me, createTextVNode as ge, mergeProps as he } from "vue";
2
+ import { ExpandOutlined as ye, OneToOneOutlined as we, CloseOutlined as be, LeftOutlined as pe, RightOutlined as Oe, ZoomOutOutlined as Ce, ZoomInOutlined as Ie, RotateLeftOutlined as ke, RotateRightOutlined as xe, LoadingOutlined as Le } from "@ant-design/icons-vue";
3
+ import { getPrefixCls as K, isServer as T, getSlotVNode as ee, isInContainer as Se, isString as Ne, getScrollContainer as $e } from "@gx-design-vue/pro-utils";
4
+ import { onMountedOrActivated as se } from "@gx-design-vue/pro-hooks";
5
+ import { createTypes as Te } from "vue-types";
6
+ import { useThrottleFn as Ae, useEventListener as te } from "@vueuse/core";
7
+ var de = Te({
8
+ func: void 0,
9
+ bool: void 0,
10
+ string: void 0,
11
+ number: void 0,
12
+ array: void 0,
13
+ object: void 0,
14
+ integer: void 0
15
+ });
16
+ de.extend([{
17
+ name: "looseBool",
18
+ getter: !0,
19
+ type: Boolean,
20
+ default: void 0
21
+ }, {
22
+ name: "style",
23
+ getter: !0,
24
+ type: [String, Object],
25
+ default: void 0
26
+ }, {
27
+ name: "VueNode",
28
+ getter: !0,
29
+ type: null
30
+ }]);
31
+ const _ = de, P = {
32
+ appendToBody: {
33
+ type: Boolean,
34
+ default: !1
35
+ },
36
+ hideOnClickModal: {
37
+ type: Boolean,
38
+ default: !0
39
+ },
40
+ src: {
41
+ type: String,
42
+ default: ""
43
+ },
44
+ fit: {
45
+ type: String,
46
+ default: ""
47
+ },
48
+ lazy: _.bool,
49
+ scrollContainer: {
50
+ type: [String, Object]
51
+ },
52
+ placeholder: {
53
+ type: [Function, Object],
54
+ default: () => {
55
+ }
56
+ },
57
+ fallback: {
58
+ type: [Function, Object],
59
+ default: () => {
60
+ }
61
+ },
62
+ onError: {
63
+ type: Function
64
+ },
65
+ onClick: {
66
+ type: Function
67
+ },
68
+ disablePreview: _.bool,
69
+ previewSrcList: {
70
+ type: Array,
71
+ default: () => []
72
+ },
73
+ width: _.number,
74
+ height: _.number,
75
+ zIndex: {
76
+ type: Number,
77
+ default: 2e3
78
+ }
79
+ }, ze = {
80
+ urlList: {
81
+ type: Array,
82
+ default: () => []
83
+ },
84
+ zIndex: P.zIndex,
85
+ initialIndex: {
86
+ type: Number,
87
+ default: 0
88
+ },
89
+ infinite: {
90
+ type: Boolean,
91
+ default: !0
92
+ },
93
+ onHideOnClickModal: P.hideOnClickModal
94
+ }, $ = {
95
+ tab: "Tab",
96
+ enter: "Enter",
97
+ space: "Space",
98
+ left: "ArrowLeft",
99
+ up: "ArrowUp",
100
+ right: "ArrowRight",
101
+ down: "ArrowDown",
102
+ esc: "Escape",
103
+ delete: "Delete",
104
+ backspace: "Backspace"
105
+ }, Y = function(e, a, d, w = !1) {
106
+ e && a && d && e.addEventListener(a, d, w);
107
+ }, X = function(e, a, d, w = !1) {
108
+ e && a && d && e.removeEventListener(a, d, w);
109
+ }, V = {
110
+ CONTAIN: {
111
+ name: "contain",
112
+ icon: l(ye, null, null)
113
+ },
114
+ ORIGINAL: {
115
+ name: "original",
116
+ icon: l(we, null, null)
117
+ }
118
+ }, Ee = function() {
119
+ return !T && !!window.navigator.userAgent.match(/firefox/i);
120
+ }, ne = Ee() ? "DOMMouseScroll" : "mousewheel";
121
+ function q(e) {
122
+ let a = !1;
123
+ return function(...d) {
124
+ a || (a = !0, window.requestAnimationFrame(() => {
125
+ e.apply(this, d), a = !1;
126
+ }));
127
+ };
128
+ }
129
+ const fe = Z({
130
+ props: ze,
131
+ emits: ["close", "switch"],
132
+ setup: function(e, {
133
+ emit: a
134
+ }) {
135
+ let d = null, w = null, p = null;
136
+ const o = K({
137
+ suffixCls: "image-viewer"
138
+ }), f = g(!0), h = g(e.initialIndex), k = g(null), x = g(null), O = g(V.CONTAIN), r = g({
139
+ scale: 1,
140
+ deg: 0,
141
+ offsetX: 0,
142
+ offsetY: 0,
143
+ enableTransition: !1
144
+ }), u = b(() => {
145
+ const {
146
+ urlList: n
147
+ } = e;
148
+ return n.length <= 1;
149
+ }), s = b(() => h.value === 0), v = b(() => h.value === e.urlList.length - 1), I = b(() => e.urlList[h.value]), L = g("viewer-fade-enter-active"), A = b(() => {
150
+ const {
151
+ scale: n,
152
+ deg: y,
153
+ offsetX: t,
154
+ offsetY: i,
155
+ enableTransition: c
156
+ } = r.value, m = {
157
+ transform: `scale(${n}) rotate(${y}deg)`,
158
+ transition: c ? "transform .3s" : "",
159
+ marginLeft: `${t}px`,
160
+ marginTop: `${i}px`
161
+ };
162
+ return O.value.name === V.CONTAIN.name && (m.maxWidth = m.maxHeight = "100%"), m;
163
+ }), z = () => {
164
+ W(), setTimeout(() => {
165
+ a("close");
166
+ }, 200);
167
+ }, S = () => {
168
+ L.value = "viewer-fade-enter-active", d = q((n) => {
169
+ switch (n.code) {
170
+ case $.esc:
171
+ z();
172
+ break;
173
+ case $.space:
174
+ M();
175
+ break;
176
+ case $.left:
177
+ R();
178
+ break;
179
+ case $.up:
180
+ C("zoomIn");
181
+ break;
182
+ case $.right:
183
+ j();
184
+ break;
185
+ case $.down:
186
+ C("zoomOut");
187
+ break;
188
+ }
189
+ }), w = q((n) => {
190
+ (n.wheelDelta ? n.wheelDelta : -n.detail) > 0 ? C("zoomIn", {
191
+ zoomRate: 0.015,
192
+ enableTransition: !1
193
+ }) : C("zoomOut", {
194
+ zoomRate: 0.015,
195
+ enableTransition: !1
196
+ });
197
+ }), Y(document, "keydown", d), Y(document, ne, w);
198
+ }, W = () => {
199
+ L.value = "viewer-fade-leave-active", X(document, "keydown", d), X(document, ne, w), d = null, w = null;
200
+ }, E = () => {
201
+ f.value = !1;
202
+ }, D = (n) => {
203
+ f.value = !1, n.target.alt = "\u52A0\u8F7D\u5931\u8D25";
204
+ }, H = (n) => {
205
+ if (f.value || n.button !== 0)
206
+ return;
207
+ const {
208
+ offsetX: y,
209
+ offsetY: t
210
+ } = r.value, i = n.pageX, c = n.pageY;
211
+ p = q((m) => {
212
+ r.value = {
213
+ ...r.value,
214
+ offsetX: y + m.pageX - i,
215
+ offsetY: t + m.pageY - c
216
+ };
217
+ }), Y(document, "mousemove", p), Y(document, "mouseup", () => {
218
+ X(document, "mousemove", p);
219
+ }), n.preventDefault();
220
+ }, F = () => {
221
+ r.value = {
222
+ scale: 1,
223
+ deg: 0,
224
+ offsetX: 0,
225
+ offsetY: 0,
226
+ enableTransition: !1
227
+ };
228
+ }, M = () => {
229
+ if (f.value)
230
+ return;
231
+ const n = Object.keys(V), y = Object.values(V), t = O.value.name, c = (y.findIndex((m) => m.name === t) + 1) % n.length;
232
+ O.value = V[n[c]], F();
233
+ }, R = () => {
234
+ if (s.value && !e.infinite)
235
+ return;
236
+ const n = e.urlList.length;
237
+ h.value = (h.value - 1 + n) % n;
238
+ }, j = () => {
239
+ if (v.value && !e.infinite)
240
+ return;
241
+ const n = e.urlList.length;
242
+ h.value = (h.value + 1) % n;
243
+ }, C = (n, y = {}) => {
244
+ if (f.value)
245
+ return;
246
+ const {
247
+ zoomRate: t,
248
+ rotateDeg: i,
249
+ enableTransition: c
250
+ } = {
251
+ zoomRate: 0.2,
252
+ rotateDeg: 90,
253
+ enableTransition: !0,
254
+ ...y
255
+ };
256
+ switch (n) {
257
+ case "zoomOut":
258
+ r.value.scale > 0.2 && (r.value.scale = parseFloat((r.value.scale - t).toFixed(3)));
259
+ break;
260
+ case "zoomIn":
261
+ r.value.scale = parseFloat((r.value.scale + t).toFixed(3));
262
+ break;
263
+ case "clocelise":
264
+ r.value.deg += i;
265
+ break;
266
+ case "anticlocelise":
267
+ r.value.deg -= i;
268
+ break;
269
+ }
270
+ r.value.enableTransition = c;
271
+ };
272
+ return U(I, () => {
273
+ oe(() => {
274
+ x.value.complete || (f.value = !0);
275
+ });
276
+ }), U(h, (n) => {
277
+ F(), a("switch", n);
278
+ }), se(() => {
279
+ var n, y;
280
+ S(), (y = (n = k.value) == null ? void 0 : n.focus) == null || y.call(n);
281
+ }), () => l("div", {
282
+ ref: (n) => k.value = n,
283
+ tabindex: 1,
284
+ class: [`${o}-wrapper`, `${L.value}`],
285
+ style: {
286
+ zIndex: e.zIndex
287
+ }
288
+ }, [l("div", {
289
+ class: `${o}-mask`,
290
+ onClick: () => e.onHideOnClickModal && z()
291
+ }, null), l("span", {
292
+ class: [`${o}-btn`, `${o}-close`],
293
+ onClick: () => z()
294
+ }, [l(be, null, null)]), !u.value && l(re, null, [l("span", {
295
+ class: {
296
+ [`${o}-btn`]: !0,
297
+ [`${o}-prev`]: !0,
298
+ ["is-disabled"]: !e.infinite && s.value
299
+ },
300
+ onClick: () => R()
301
+ }, [l(pe, null, null)]), l("span", {
302
+ class: {
303
+ [`${o}-btn`]: !0,
304
+ [`${o}-next`]: !0,
305
+ ["is-disabled"]: !e.infinite && s.value
306
+ },
307
+ onClick: () => j()
308
+ }, [l(Oe, null, null)])]), l("div", {
309
+ class: [`${o}-btn`, `${o}-actions`]
310
+ }, [l("div", {
311
+ class: `${o}-actions-inner`
312
+ }, [l(Ce, {
313
+ onClick: () => C("zoomOut")
314
+ }, null), l(Ie, {
315
+ onClick: () => C("zoomIn")
316
+ }, null), l("i", {
317
+ class: `${o}-actions-divider`
318
+ }, null), l("i", {
319
+ onClick: () => M()
320
+ }, [O.value.icon]), l("i", {
321
+ class: `${o}-actions-divider`
322
+ }, null), l(ke, {
323
+ onClick: () => C("anticlocelise")
324
+ }, null), l(xe, {
325
+ onClick: () => C("clocelise")
326
+ }, null)])]), f.value && l("div", {
327
+ class: `${o}-canvas`
328
+ }, [l(ue("a-spin"), {
329
+ indicator: l(Le, {
330
+ style: {
331
+ color: "#fff",
332
+ fontSize: "40px"
333
+ }
334
+ }, null)
335
+ }, null)]), l("div", {
336
+ class: `${o}-canvas`
337
+ }, [e.urlList.map((n, y) => l("img", {
338
+ ref: (t) => x.value = t,
339
+ class: `${o}-img`,
340
+ key: n,
341
+ style: {
342
+ ...A.value,
343
+ display: y === h.value ? "block" : "none"
344
+ },
345
+ src: n,
346
+ onLoad: () => E(),
347
+ onError: (t) => D(t),
348
+ onMousedown: (t) => H(t)
349
+ }, null))])]);
350
+ }
351
+ });
352
+ function Fe(e) {
353
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !me(e);
354
+ }
355
+ let le = "";
356
+ const Ge = Z({
357
+ props: {
358
+ hideOnClickModal: P.hideOnClickModal
359
+ },
360
+ setup(e, {
361
+ slots: a
362
+ }) {
363
+ const d = K({
364
+ suffixCls: "image-viewer-group"
365
+ }), w = g(!1), p = g(""), o = b(() => {
366
+ var u, s, v, I, L;
367
+ return ((u = a.default) == null ? void 0 : u.call(a).length) === 1 && (String((s = a.default) == null ? void 0 : s.call(a)[0].type) === String(Symbol("Fragment")) || String((v = a.default) == null ? void 0 : v.call(a)[0].type) === String(Symbol())) ? ((I = a.default) == null ? void 0 : I.call(a)[0].children) || [] : ((L = a.default) == null ? void 0 : L.call(a)) || [];
368
+ }), f = b(() => o.value.filter((v) => k(v)).map((v) => v.props.src).filter((v) => v) || []), h = b(() => Array.isArray(f.value) && f.value.length > 0), k = (u) => u && u.type && (u.type.isGImage || u.type.name === "GImage"), x = () => {
369
+ let u = 0;
370
+ const s = f.value.findIndex((v) => v === p.value);
371
+ return s >= 0 && (u = s), u;
372
+ }, O = (u) => {
373
+ !h.value || !u || (p.value = u, le = document.body.style.overflow, document.body.style.overflow = "hidden", w.value = !0);
374
+ }, r = () => {
375
+ document.body.style.overflow = le, w.value = !1;
376
+ };
377
+ return () => {
378
+ let u;
379
+ return l("div", {
380
+ class: `${d}`
381
+ }, [l(ue("a-space"), {
382
+ size: 15
383
+ }, Fe(u = o.value.map((s, v) => k(s) ? l("div", {
384
+ key: v,
385
+ class: `${d}-item`,
386
+ onClick: () => {
387
+ var I;
388
+ return O(((I = s.props) == null ? void 0 : I.src) || "");
389
+ }
390
+ }, [ve(s, {
391
+ disablePreview: !0
392
+ })]) : null)) ? u : {
393
+ default: () => [u]
394
+ }), l(ce, {
395
+ to: "body"
396
+ }, {
397
+ default: () => [h.value && w.value && l(fe, {
398
+ initialIndex: x(),
399
+ urlList: f.value,
400
+ onHideOnClickModal: e.hideOnClickModal,
401
+ onClose: () => r()
402
+ }, null)]
403
+ })]);
404
+ };
405
+ }
406
+ }), Me = (e) => e && e.nodeType === Node.ELEMENT_NODE, ae = () => document.documentElement.style.objectFit !== void 0;
407
+ let ie = "";
408
+ const N = {
409
+ NONE: "none",
410
+ CONTAIN: "contain",
411
+ COVER: "cover",
412
+ FILL: "fill",
413
+ SCALE_DOWN: "scale-down"
414
+ }, G = Z({
415
+ props: P,
416
+ name: "GImage",
417
+ inheritAttrs: !1,
418
+ emits: ["error", "click"],
419
+ setup(e, {
420
+ slots: a,
421
+ emit: d,
422
+ attrs: w
423
+ }) {
424
+ const p = K({
425
+ suffixCls: "image"
426
+ }), o = g(!1), f = g(!0), h = g(0), k = g(0), x = g(!1), O = g(null), r = g();
427
+ let u, s;
428
+ const v = b(() => ({
429
+ width: e.width ? `${e.width}px` : void 0,
430
+ height: e.height ? `${e.height}px` : void 0
431
+ })), I = b(() => {
432
+ const {
433
+ fit: t
434
+ } = e;
435
+ return !T && t ? ae() ? {
436
+ "object-fit": t,
437
+ ...v.value
438
+ } : {
439
+ ...W(t),
440
+ ...v.value
441
+ } : v.value;
442
+ }), L = b(() => {
443
+ const {
444
+ fit: t
445
+ } = e;
446
+ return !T && !ae() && t !== N.FILL;
447
+ }), A = b(() => {
448
+ const {
449
+ previewSrcList: t
450
+ } = e;
451
+ return Array.isArray(t) && t.length > 0;
452
+ }), z = b(() => {
453
+ const {
454
+ src: t,
455
+ previewSrcList: i
456
+ } = e;
457
+ let c = 0;
458
+ const m = i.indexOf(t);
459
+ return m >= 0 && (c = m), c;
460
+ }), S = b(() => w), W = (t) => {
461
+ const i = e.width || h.value, c = e.height || k.value;
462
+ if (!O.value)
463
+ return {};
464
+ const {
465
+ clientWidth: m,
466
+ clientHeight: B
467
+ } = O.value;
468
+ if (!i || !c || !m || !B)
469
+ return {};
470
+ const J = i / c, Q = m / B;
471
+ switch (t === N.SCALE_DOWN && (t = i < m && c < B ? N.NONE : N.CONTAIN), t) {
472
+ case N.NONE:
473
+ return {
474
+ width: "auto",
475
+ height: "auto"
476
+ };
477
+ case N.CONTAIN:
478
+ return J < Q ? {
479
+ width: "auto"
480
+ } : {
481
+ height: "auto"
482
+ };
483
+ case N.COVER:
484
+ return J < Q ? {
485
+ height: "auto"
486
+ } : {
487
+ width: "auto"
488
+ };
489
+ default:
490
+ return {};
491
+ }
492
+ }, E = () => {
493
+ if (T)
494
+ return;
495
+ const t = S.value;
496
+ f.value = !0, o.value = !1;
497
+ const i = new Image();
498
+ i.onload = (c) => R(c, i), i.onerror = j, Object.keys(t).forEach((c) => {
499
+ if (c.toLowerCase() === "onload")
500
+ return;
501
+ const m = t[c];
502
+ i.setAttribute(c, m);
503
+ }), i.src = e.src;
504
+ };
505
+ function D() {
506
+ Se(O.value, r.value) && (E(), M());
507
+ }
508
+ const H = Ae(D, 200), F = async () => {
509
+ var i;
510
+ if (T)
511
+ return;
512
+ await oe();
513
+ const {
514
+ scrollContainer: t
515
+ } = e;
516
+ Me(t) ? r.value = t : Ne(t) && t !== "" ? r.value = (i = document.querySelector(t)) != null ? i : void 0 : O.value && (r.value = $e(O.value)), r.value && (u = te(r, "scroll", H), setTimeout(() => D(), 200));
517
+ }, M = () => {
518
+ T || !r.value || !H || (u(), r.value = void 0);
519
+ }, R = (t, i) => {
520
+ h.value = i.width, k.value = i.height, f.value = !1, o.value = !1;
521
+ }, j = (t) => {
522
+ f.value = !1, o.value = !0, d("error", t);
523
+ }, C = (t) => {
524
+ if (!!t.ctrlKey) {
525
+ if (t.deltaY < 0)
526
+ return t.preventDefault(), !1;
527
+ if (t.deltaY > 0)
528
+ return t.preventDefault(), !1;
529
+ }
530
+ }, n = () => {
531
+ !A.value || e.disablePreview || (s = te("wheel", C, {
532
+ passive: !1
533
+ }), ie = document.body.style.overflow, document.body.style.overflow = "hidden", x.value = !0);
534
+ }, y = () => {
535
+ s == null || s(), document.body.style.overflow = ie, x.value = !1;
536
+ };
537
+ return U(() => e.src, () => {
538
+ e.lazy ? (f.value = !0, o.value = !1, M(), F()) : E();
539
+ }), se(() => {
540
+ e.lazy ? F() : E();
541
+ }), () => {
542
+ const t = ee(a, e, "fallback"), i = ee(a, e, "placeholder");
543
+ return l(re, null, [l("div", {
544
+ class: {
545
+ [`${p}`]: !0,
546
+ [`${S.value.class}`]: S.value.class
547
+ },
548
+ ref: (c) => O.value = c,
549
+ style: {
550
+ ...S.value.style || {},
551
+ display: e.lazy ? "block" : void 0
552
+ },
553
+ onClick: () => {
554
+ d("click");
555
+ }
556
+ }, [f.value ? i || l("div", {
557
+ class: `${p}-placeholder`
558
+ }, null) : o.value ? t || l("div", {
559
+ class: `${p}-error`
560
+ }, [ge("\u52A0\u8F7D\u5931\u8D25")]) : l("img", he({
561
+ class: {
562
+ [`${p}-inner`]: !0,
563
+ [`${p}-inner-center`]: L.value,
564
+ [`${p}-preview`]: A.value
565
+ }
566
+ }, S.value, {
567
+ src: e.src,
568
+ style: I.value,
569
+ onClick: () => n()
570
+ }), null), l(ce, {
571
+ to: "body",
572
+ disabled: !e.appendToBody
573
+ }, {
574
+ default: () => [A.value && x.value && l(fe, {
575
+ zIndex: e.zIndex,
576
+ initialIndex: z.value,
577
+ urlList: e.previewSrcList,
578
+ onHideOnClickModal: e.hideOnClickModal,
579
+ onClose: () => y()
580
+ }, null)]
581
+ })])]);
582
+ };
583
+ }
584
+ });
585
+ G.isWImage = !0;
586
+ G.install = (e) => (e.component(G.name, G), e);
587
+ export {
588
+ G as GImage,
589
+ fe as ImageViewer,
590
+ Ge as ImageViewerGroup,
591
+ G as default
592
+ };
@@ -0,0 +1 @@
1
+ (function(v,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@ant-design/icons-vue"),require("@gx-design-vue/pro-utils"),require("@gx-design-vue/pro-hooks"),require("vue-types"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@ant-design/icons-vue","@gx-design-vue/pro-utils","@gx-design-vue/pro-hooks","vue-types","@vueuse/core"],e):(v=typeof globalThis<"u"?globalThis:v||self,e(v.GImage={},v.vue,v.iconsVue,v.proUtils,v.proHooks,v.vueTypes,v.core))})(this,function(v,e,O,w,J,oe,W){"use strict";const de="",ue="";var Q=oe.createTypes({func:void 0,bool:void 0,string:void 0,number:void 0,array:void 0,object:void 0,integer:void 0});Q.extend([{name:"looseBool",getter:!0,type:Boolean,default:void 0},{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VueNode",getter:!0,type:null}]);const H=Q,j={appendToBody:{type:Boolean,default:!1},hideOnClickModal:{type:Boolean,default:!0},src:{type:String,default:""},fit:{type:String,default:""},lazy:H.bool,scrollContainer:{type:[String,Object]},placeholder:{type:[Function,Object],default:()=>{}},fallback:{type:[Function,Object],default:()=>{}},onError:{type:Function},onClick:{type:Function},disablePreview:H.bool,previewSrcList:{type:Array,default:()=>[]},width:H.number,height:H.number,zIndex:{type:Number,default:2e3}},re={urlList:{type:Array,default:()=>[]},zIndex:j.zIndex,initialIndex:{type:Number,default:0},infinite:{type:Boolean,default:!0},onHideOnClickModal:j.hideOnClickModal},T={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace"},R=function(t,l,u,N=!1){t&&l&&u&&t.addEventListener(l,u,N)},q=function(t,l,u,N=!1){t&&l&&u&&t.removeEventListener(l,u,N)},A={CONTAIN:{name:"contain",icon:e.createVNode(O.ExpandOutlined,null,null)},ORIGINAL:{name:"original",icon:e.createVNode(O.OneToOneOutlined,null,null)}},U=function(){return!w.isServer&&!!window.navigator.userAgent.match(/firefox/i)}()?"DOMMouseScroll":"mousewheel";function B(t){let l=!1;return function(...u){l||(l=!0,window.requestAnimationFrame(()=>{t.apply(this,u),l=!1}))}}const X=e.defineComponent({props:re,emits:["close","switch"],setup:function(t,{emit:l}){let u=null,N=null,b=null;const r=w.getPrefixCls({suffixCls:"image-viewer"}),f=e.ref(!0),h=e.ref(t.initialIndex),I=e.ref(null),x=e.ref(null),p=e.ref(A.CONTAIN),i=e.ref({scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}),c=e.computed(()=>{const{urlList:a}=t;return a.length<=1}),d=e.computed(()=>h.value===0),m=e.computed(()=>h.value===t.urlList.length-1),k=e.computed(()=>t.urlList[h.value]),S=e.ref("viewer-fade-enter-active"),E=e.computed(()=>{const{scale:a,deg:y,offsetX:n,offsetY:o,enableTransition:s}=i.value,g={transform:`scale(${a}) rotate(${y}deg)`,transition:s?"transform .3s":"",marginLeft:`${n}px`,marginTop:`${o}px`};return p.value.name===A.CONTAIN.name&&(g.maxWidth=g.maxHeight="100%"),g}),z=()=>{Z(),setTimeout(()=>{l("close")},200)},L=()=>{S.value="viewer-fade-enter-active",u=B(a=>{switch(a.code){case T.esc:z();break;case T.space:D();break;case T.left:G();break;case T.up:C("zoomIn");break;case T.right:Y();break;case T.down:C("zoomOut");break}}),N=B(a=>{(a.wheelDelta?a.wheelDelta:-a.detail)>0?C("zoomIn",{zoomRate:.015,enableTransition:!1}):C("zoomOut",{zoomRate:.015,enableTransition:!1})}),R(document,"keydown",u),R(document,U,N)},Z=()=>{S.value="viewer-fade-leave-active",q(document,"keydown",u),q(document,U,N),u=null,N=null},F=()=>{f.value=!1},_=a=>{f.value=!1,a.target.alt="\u52A0\u8F7D\u5931\u8D25"},P=a=>{if(f.value||a.button!==0)return;const{offsetX:y,offsetY:n}=i.value,o=a.pageX,s=a.pageY;b=B(g=>{i.value={...i.value,offsetX:y+g.pageX-o,offsetY:n+g.pageY-s}}),R(document,"mousemove",b),R(document,"mouseup",()=>{q(document,"mousemove",b)}),a.preventDefault()},M=()=>{i.value={scale:1,deg:0,offsetX:0,offsetY:0,enableTransition:!1}},D=()=>{if(f.value)return;const a=Object.keys(A),y=Object.values(A),n=p.value.name,s=(y.findIndex(g=>g.name===n)+1)%a.length;p.value=A[a[s]],M()},G=()=>{if(d.value&&!t.infinite)return;const a=t.urlList.length;h.value=(h.value-1+a)%a},Y=()=>{if(m.value&&!t.infinite)return;const a=t.urlList.length;h.value=(h.value+1)%a},C=(a,y={})=>{if(f.value)return;const{zoomRate:n,rotateDeg:o,enableTransition:s}={zoomRate:.2,rotateDeg:90,enableTransition:!0,...y};switch(a){case"zoomOut":i.value.scale>.2&&(i.value.scale=parseFloat((i.value.scale-n).toFixed(3)));break;case"zoomIn":i.value.scale=parseFloat((i.value.scale+n).toFixed(3));break;case"clocelise":i.value.deg+=o;break;case"anticlocelise":i.value.deg-=o;break}i.value.enableTransition=s};return e.watch(k,()=>{e.nextTick(()=>{x.value.complete||(f.value=!0)})}),e.watch(h,a=>{M(),l("switch",a)}),J.onMountedOrActivated(()=>{var a,y;L(),(y=(a=I.value)==null?void 0:a.focus)==null||y.call(a)}),()=>e.createVNode("div",{ref:a=>I.value=a,tabindex:1,class:[`${r}-wrapper`,`${S.value}`],style:{zIndex:t.zIndex}},[e.createVNode("div",{class:`${r}-mask`,onClick:()=>t.onHideOnClickModal&&z()},null),e.createVNode("span",{class:[`${r}-btn`,`${r}-close`],onClick:()=>z()},[e.createVNode(O.CloseOutlined,null,null)]),!c.value&&e.createVNode(e.Fragment,null,[e.createVNode("span",{class:{[`${r}-btn`]:!0,[`${r}-prev`]:!0,["is-disabled"]:!t.infinite&&d.value},onClick:()=>G()},[e.createVNode(O.LeftOutlined,null,null)]),e.createVNode("span",{class:{[`${r}-btn`]:!0,[`${r}-next`]:!0,["is-disabled"]:!t.infinite&&d.value},onClick:()=>Y()},[e.createVNode(O.RightOutlined,null,null)])]),e.createVNode("div",{class:[`${r}-btn`,`${r}-actions`]},[e.createVNode("div",{class:`${r}-actions-inner`},[e.createVNode(O.ZoomOutOutlined,{onClick:()=>C("zoomOut")},null),e.createVNode(O.ZoomInOutlined,{onClick:()=>C("zoomIn")},null),e.createVNode("i",{class:`${r}-actions-divider`},null),e.createVNode("i",{onClick:()=>D()},[p.value.icon]),e.createVNode("i",{class:`${r}-actions-divider`},null),e.createVNode(O.RotateLeftOutlined,{onClick:()=>C("anticlocelise")},null),e.createVNode(O.RotateRightOutlined,{onClick:()=>C("clocelise")},null)])]),f.value&&e.createVNode("div",{class:`${r}-canvas`},[e.createVNode(e.resolveComponent("a-spin"),{indicator:e.createVNode(O.LoadingOutlined,{style:{color:"#fff",fontSize:"40px"}},null)},null)]),e.createVNode("div",{class:`${r}-canvas`},[t.urlList.map((a,y)=>e.createVNode("img",{ref:n=>x.value=n,class:`${r}-img`,key:a,style:{...E.value,display:y===h.value?"block":"none"},src:a,onLoad:()=>F(),onError:n=>_(n),onMousedown:n=>P(n)},null))])])}});function ie(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}let ee="";const ce=e.defineComponent({props:{hideOnClickModal:j.hideOnClickModal},setup(t,{slots:l}){const u=w.getPrefixCls({suffixCls:"image-viewer-group"}),N=e.ref(!1),b=e.ref(""),r=e.computed(()=>{var c,d,m,k,S;return((c=l.default)==null?void 0:c.call(l).length)===1&&(String((d=l.default)==null?void 0:d.call(l)[0].type)===String(Symbol("Fragment"))||String((m=l.default)==null?void 0:m.call(l)[0].type)===String(Symbol()))?((k=l.default)==null?void 0:k.call(l)[0].children)||[]:((S=l.default)==null?void 0:S.call(l))||[]}),f=e.computed(()=>r.value.filter(m=>I(m)).map(m=>m.props.src).filter(m=>m)||[]),h=e.computed(()=>Array.isArray(f.value)&&f.value.length>0),I=c=>c&&c.type&&(c.type.isGImage||c.type.name==="GImage"),x=()=>{let c=0;const d=f.value.findIndex(m=>m===b.value);return d>=0&&(c=d),c},p=c=>{!h.value||!c||(b.value=c,ee=document.body.style.overflow,document.body.style.overflow="hidden",N.value=!0)},i=()=>{document.body.style.overflow=ee,N.value=!1};return()=>{let c;return e.createVNode("div",{class:`${u}`},[e.createVNode(e.resolveComponent("a-space"),{size:15},ie(c=r.value.map((d,m)=>I(d)?e.createVNode("div",{key:m,class:`${u}-item`,onClick:()=>{var k;return p(((k=d.props)==null?void 0:k.src)||"")}},[e.cloneVNode(d,{disablePreview:!0})]):null))?c:{default:()=>[c]}),e.createVNode(e.Teleport,{to:"body"},{default:()=>[h.value&&N.value&&e.createVNode(X,{initialIndex:x(),urlList:f.value,onHideOnClickModal:t.hideOnClickModal,onClose:()=>i()},null)]})])}}}),se=t=>t&&t.nodeType===Node.ELEMENT_NODE,te=()=>document.documentElement.style.objectFit!==void 0;let ne="";const V={NONE:"none",CONTAIN:"contain",COVER:"cover",FILL:"fill",SCALE_DOWN:"scale-down"},$=e.defineComponent({props:j,name:"GImage",inheritAttrs:!1,emits:["error","click"],setup(t,{slots:l,emit:u,attrs:N}){const b=w.getPrefixCls({suffixCls:"image"}),r=e.ref(!1),f=e.ref(!0),h=e.ref(0),I=e.ref(0),x=e.ref(!1),p=e.ref(null),i=e.ref();let c,d;const m=e.computed(()=>({width:t.width?`${t.width}px`:void 0,height:t.height?`${t.height}px`:void 0})),k=e.computed(()=>{const{fit:n}=t;return!w.isServer&&n?te()?{"object-fit":n,...m.value}:{...Z(n),...m.value}:m.value}),S=e.computed(()=>{const{fit:n}=t;return!w.isServer&&!te()&&n!==V.FILL}),E=e.computed(()=>{const{previewSrcList:n}=t;return Array.isArray(n)&&n.length>0}),z=e.computed(()=>{const{src:n,previewSrcList:o}=t;let s=0;const g=o.indexOf(n);return g>=0&&(s=g),s}),L=e.computed(()=>N),Z=n=>{const o=t.width||h.value,s=t.height||I.value;if(!p.value)return{};const{clientWidth:g,clientHeight:K}=p.value;if(!o||!s||!g||!K)return{};const ae=o/s,le=g/K;switch(n===V.SCALE_DOWN&&(n=o<g&&s<K?V.NONE:V.CONTAIN),n){case V.NONE:return{width:"auto",height:"auto"};case V.CONTAIN:return ae<le?{width:"auto"}:{height:"auto"};case V.COVER:return ae<le?{height:"auto"}:{width:"auto"};default:return{}}},F=()=>{if(w.isServer)return;const n=L.value;f.value=!0,r.value=!1;const o=new Image;o.onload=s=>G(s,o),o.onerror=Y,Object.keys(n).forEach(s=>{if(s.toLowerCase()==="onload")return;const g=n[s];o.setAttribute(s,g)}),o.src=t.src};function _(){w.isInContainer(p.value,i.value)&&(F(),D())}const P=W.useThrottleFn(_,200),M=async()=>{var o;if(w.isServer)return;await e.nextTick();const{scrollContainer:n}=t;se(n)?i.value=n:w.isString(n)&&n!==""?i.value=(o=document.querySelector(n))!=null?o:void 0:p.value&&(i.value=w.getScrollContainer(p.value)),i.value&&(c=W.useEventListener(i,"scroll",P),setTimeout(()=>_(),200))},D=()=>{w.isServer||!i.value||!P||(c(),i.value=void 0)},G=(n,o)=>{h.value=o.width,I.value=o.height,f.value=!1,r.value=!1},Y=n=>{f.value=!1,r.value=!0,u("error",n)},C=n=>{if(!!n.ctrlKey){if(n.deltaY<0)return n.preventDefault(),!1;if(n.deltaY>0)return n.preventDefault(),!1}},a=()=>{!E.value||t.disablePreview||(d=W.useEventListener("wheel",C,{passive:!1}),ne=document.body.style.overflow,document.body.style.overflow="hidden",x.value=!0)},y=()=>{d==null||d(),document.body.style.overflow=ne,x.value=!1};return e.watch(()=>t.src,()=>{t.lazy?(f.value=!0,r.value=!1,D(),M()):F()}),J.onMountedOrActivated(()=>{t.lazy?M():F()}),()=>{const n=w.getSlotVNode(l,t,"fallback"),o=w.getSlotVNode(l,t,"placeholder");return e.createVNode(e.Fragment,null,[e.createVNode("div",{class:{[`${b}`]:!0,[`${L.value.class}`]:L.value.class},ref:s=>p.value=s,style:{...L.value.style||{},display:t.lazy?"block":void 0},onClick:()=>{u("click")}},[f.value?o||e.createVNode("div",{class:`${b}-placeholder`},null):r.value?n||e.createVNode("div",{class:`${b}-error`},[e.createTextVNode("\u52A0\u8F7D\u5931\u8D25")]):e.createVNode("img",e.mergeProps({class:{[`${b}-inner`]:!0,[`${b}-inner-center`]:S.value,[`${b}-preview`]:E.value}},L.value,{src:t.src,style:k.value,onClick:()=>a()}),null),e.createVNode(e.Teleport,{to:"body",disabled:!t.appendToBody},{default:()=>[E.value&&x.value&&e.createVNode(X,{zIndex:t.zIndex,initialIndex:z.value,urlList:t.previewSrcList,onHideOnClickModal:t.hideOnClickModal,onClose:()=>y()},null)]})])])}}});$.isWImage=!0,$.install=t=>(t.component($.name,$),t),v.GImage=$,v.ImageViewer=X,v.ImageViewerGroup=ce,v.default=$,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,7 @@
1
+ import './design/config.less';
2
+ import './style.less';
3
+ export { default as ImageViewer } from './components/ImageViewer';
4
+ export { default as ImageViewerGroup } from './components/ImageViewerGroup';
5
+ export type { GImageProps } from './Image';
6
+ export { default } from './Image';
7
+ export { default as GImage } from './Image';
@@ -0,0 +1,79 @@
1
+ import type { PropType } from 'vue';
2
+ import type { WithFalse, CustomRender } from '@gx-design-vue/pro-utils';
3
+ export declare const gImagePorps: {
4
+ appendToBody: {
5
+ type: PropType<boolean>;
6
+ default: boolean;
7
+ };
8
+ hideOnClickModal: {
9
+ type: PropType<boolean>;
10
+ default: boolean;
11
+ };
12
+ src: {
13
+ type: PropType<string>;
14
+ default: string;
15
+ };
16
+ fit: {
17
+ type: PropType<string>;
18
+ default: string;
19
+ };
20
+ lazy: import("vue-types").VueTypeValidableDef<boolean> & {
21
+ default: boolean;
22
+ };
23
+ scrollContainer: {
24
+ type: PropType<string | HTMLElement | undefined>;
25
+ };
26
+ placeholder: {
27
+ type: PropType<WithFalse<() => CustomRender>>;
28
+ default: () => undefined;
29
+ };
30
+ fallback: {
31
+ type: PropType<WithFalse<() => CustomRender>>;
32
+ default: () => undefined;
33
+ };
34
+ onError: {
35
+ type: PropType<(e: Error) => void>;
36
+ };
37
+ onClick: {
38
+ type: PropType<(info: any) => void>;
39
+ };
40
+ disablePreview: import("vue-types").VueTypeValidableDef<boolean> & {
41
+ default: boolean;
42
+ };
43
+ previewSrcList: {
44
+ type: PropType<string[]>;
45
+ default: () => string[];
46
+ };
47
+ width: import("vue-types").VueTypeValidableDef<number> & {
48
+ default: number;
49
+ };
50
+ height: import("vue-types").VueTypeValidableDef<number> & {
51
+ default: number;
52
+ };
53
+ zIndex: {
54
+ type: PropType<number>;
55
+ default: number;
56
+ };
57
+ };
58
+ export declare const gImageViewProps: {
59
+ urlList: {
60
+ type: PropType<string[]>;
61
+ default: () => never[];
62
+ };
63
+ zIndex: {
64
+ type: PropType<number>;
65
+ default: number;
66
+ };
67
+ initialIndex: {
68
+ type: PropType<number>;
69
+ default: number;
70
+ };
71
+ infinite: {
72
+ type: PropType<boolean>;
73
+ default: boolean;
74
+ };
75
+ onHideOnClickModal: {
76
+ type: PropType<boolean>;
77
+ default: boolean;
78
+ };
79
+ };
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .gx-image{position:relative;display:inline-flex;overflow:hidden}.gx-image-inner{width:100%;height:100%;vertical-align:top}.gx-image-inner.gx-image-inner-center{position:relative;top:50%;left:50%;display:block;transform:translate(-50%,-50%)}.gx-image-placeholder{width:100%;height:100%;background:#f5f7fa}.gx-image-error{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:14px;color:#c0c4cc;vertical-align:middle;background:#f5f7fa}.gx-image-preview,.gx-image-viewer-group-item{cursor:pointer}.gx-image-viewer-wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.gx-image-viewer-mask{position:absolute;top:0;left:0;width:100%;height:100%;background:#000;opacity:.5}.gx-image-viewer-btn{position:absolute;z-index:1;box-sizing:border-box;display:flex;align-items:center;justify-content:center;cursor:pointer;user-select:none;border-radius:50%;opacity:.8}.gx-image-viewer-close{top:40px;right:40px;width:40px;height:40px;font-size:40px;width:44px;height:44px;font-size:24px;color:#fff;background-color:#606266;border-color:#fff}.gx-image-viewer-canvas{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.gx-image-viewer-actions{bottom:30px;left:50%;width:282px;height:44px;padding:0 23px;background-color:#606266;border-color:#fff;border-radius:22px;transform:translate(-50%)}.gx-image-viewer-actions-inner{display:flex;align-items:center;justify-content:space-around;width:100%;height:100%;font-size:23px;color:#fff;text-align:justify;cursor:default}.gx-image-viewer-prev{top:50%;left:40px;transform:translateY(-50%);width:44px;height:44px;font-size:24px;color:#fff;background-color:#606266;border-color:#fff}.gx-image-viewer-next{top:50%;right:40px;text-indent:2px;transform:translateY(-50%);width:44px;height:44px;font-size:24px;color:#fff;background-color:#606266;border-color:#fff}.viewer-fade-enter-active{animation:viewer-fade-in .3s}.viewer-fade-leave-active{animation:viewer-fade-out .3s}@keyframes viewer-fade-in{0%{opacity:0;transform:translate3d(0,-20px,0)}to{opacity:1;transform:translateZ(0)}}@keyframes viewer-fade-out{0%{opacity:1;transform:translateZ(0)}to{opacity:0;transform:translate3d(0,-20px,0)}}
@@ -0,0 +1,177 @@
1
+ @import './design/config.less';
2
+
3
+ .size() {
4
+ width: 100%;
5
+ height: 100%;
6
+ }
7
+
8
+ .op-icon() {
9
+ width: 44px;
10
+ height: 44px;
11
+ font-size: 24px;
12
+ color: #fff;
13
+ background-color: #606266;
14
+ border-color: #fff;
15
+ }
16
+
17
+ .@{gx-prefix}-image {
18
+ position: relative;
19
+ display: inline-flex;
20
+ overflow: hidden;
21
+
22
+ &-inner {
23
+ .size();
24
+ vertical-align: top;
25
+
26
+ &.gx-image-inner-center {
27
+ position: relative;
28
+ top: 50%;
29
+ left: 50%;
30
+ display: block;
31
+ transform: translate(-50%, -50%);
32
+ }
33
+ }
34
+
35
+ &-placeholder {
36
+ .size();
37
+ background: #f5f7fa;
38
+ }
39
+
40
+ &-error {
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ .size();
45
+ font-size: 14px;
46
+ color: #c0c4cc;
47
+ vertical-align: middle;
48
+ background: #f5f7fa;
49
+ }
50
+
51
+ &-preview {
52
+ cursor: pointer;
53
+ }
54
+ }
55
+
56
+ .@{gx-prefix}-image-viewer {
57
+ &-group-item {
58
+ cursor: pointer;
59
+ }
60
+
61
+ &-wrapper {
62
+ position: fixed;
63
+ top: 0;
64
+ right: 0;
65
+ bottom: 0;
66
+ left: 0;
67
+ }
68
+
69
+ &-mask {
70
+ position: absolute;
71
+ top: 0;
72
+ left: 0;
73
+ width: 100%;
74
+ height: 100%;
75
+ background: #000;
76
+ opacity: 0.5;
77
+ }
78
+
79
+ &-btn {
80
+ position: absolute;
81
+ z-index: 1;
82
+ box-sizing: border-box;
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ cursor: pointer;
87
+ user-select: none;
88
+ border-radius: 50%;
89
+ opacity: 0.8;
90
+ }
91
+
92
+ &-close {
93
+ top: 40px;
94
+ right: 40px;
95
+ width: 40px;
96
+ height: 40px;
97
+ font-size: 40px;
98
+ .op-icon();
99
+ }
100
+
101
+ &-canvas {
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: center;
105
+ width: 100%;
106
+ height: 100%;
107
+ }
108
+
109
+ &-actions {
110
+ bottom: 30px;
111
+ left: 50%;
112
+ width: 282px;
113
+ height: 44px;
114
+ padding: 0 23px;
115
+ background-color: #606266;
116
+ border-color: #fff;
117
+ border-radius: 22px;
118
+ transform: translateX(-50%);
119
+
120
+ &-inner {
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: space-around;
124
+ width: 100%;
125
+ height: 100%;
126
+ font-size: 23px;
127
+ color: #fff;
128
+ text-align: justify;
129
+ cursor: default;
130
+ }
131
+ }
132
+
133
+ &-prev {
134
+ top: 50%;
135
+ left: 40px;
136
+ transform: translateY(-50%);
137
+ .op-icon();
138
+ }
139
+
140
+ &-next {
141
+ top: 50%;
142
+ right: 40px;
143
+ text-indent: 2px;
144
+ transform: translateY(-50%);
145
+ .op-icon();
146
+ }
147
+ }
148
+
149
+ .viewer-fade-enter-active {
150
+ animation: viewer-fade-in 0.3s;
151
+ }
152
+
153
+ .viewer-fade-leave-active {
154
+ animation: viewer-fade-out 0.3s;
155
+ }
156
+
157
+ @keyframes viewer-fade-in {
158
+ 0% {
159
+ opacity: 0;
160
+ transform: translate3d(0, -20px, 0);
161
+ }
162
+ 100% {
163
+ opacity: 1;
164
+ transform: translate3d(0, 0, 0);
165
+ }
166
+ }
167
+
168
+ @keyframes viewer-fade-out {
169
+ 0% {
170
+ opacity: 1;
171
+ transform: translate3d(0, 0, 0);
172
+ }
173
+ 100% {
174
+ opacity: 0;
175
+ transform: translate3d(0, -20px, 0);
176
+ }
177
+ }
@@ -0,0 +1,12 @@
1
+ export declare const EVENT_CODE: {
2
+ tab: string;
3
+ enter: string;
4
+ space: string;
5
+ left: string;
6
+ up: string;
7
+ right: string;
8
+ down: string;
9
+ esc: string;
10
+ delete: string;
11
+ backspace: string;
12
+ };
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@gx-design-vue/image",
3
+ "version": "0.0.1",
4
+ "scripts": {
5
+ "dev": "vite",
6
+ "build": "vite build",
7
+ "types": "vue-tsc --declaration --emitDeclarationOnly",
8
+ "preview": "vite preview --port 5050",
9
+ "test:unit": "vitest --environment jsdom",
10
+ "typecheck": "vue-tsc --noEmit && vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
11
+ "lint": "TIMING=1 eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "types": "./dist",
17
+ "main": "./dist/image.umd.js",
18
+ "module": "./dist/image.mjs",
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/image.mjs",
22
+ "require": "./dist/image.umd.js"
23
+ }
24
+ },
25
+ "dependencies": {
26
+ "@vueuse/core": "^6.8.0",
27
+ "@gx-design-vue/pro-utils": "0.0.6-rc.1",
28
+ "@gx-design-vue/pro-hooks": "^0.0.2-rc.1",
29
+ "ant-design-vue": "^3.2.15",
30
+ "vue": "^3.0.0",
31
+ "vue-types": "^4.1.1"
32
+ },
33
+ "devDependencies": {
34
+ "@shared/vite-plugin-less-copy": "workspace:^0.0.0",
35
+ "@rollup/plugin-typescript": "^8.3.0",
36
+ "@rushstack/eslint-patch": "^1.1.0",
37
+ "@types/lodash-es": "^4.17.6",
38
+ "@types/jsdom": "^16.2.14",
39
+ "@types/node": "^16.11.26",
40
+ "@vitejs/plugin-vue": "^3.1.0",
41
+ "@vitejs/plugin-vue-jsx": "^2.0.1",
42
+ "@vue/eslint-config-prettier": "^7.0.0",
43
+ "@vue/eslint-config-typescript": "^10.0.0",
44
+ "@vue/test-utils": "^2.0.0-rc.18",
45
+ "@vue/tsconfig": "^0.1.3",
46
+ "eslint": "^8.13.0",
47
+ "eslint-plugin-prettier": "^4.0.0",
48
+ "eslint-plugin-vue": "^8.6.0",
49
+ "jsdom": "^19.0.0",
50
+ "less": "^4.1.2",
51
+ "postcss": "^8.4.12",
52
+ "postcss-html": "^1.4.1",
53
+ "postcss-less": "^6.0.0",
54
+ "prettier": "^2.6.2",
55
+ "rollup": "^2.70.2",
56
+ "stylelint": "^14.7.1",
57
+ "stylelint-config-prettier": "^9.0.3",
58
+ "stylelint-config-recommended": "^7.0.0",
59
+ "stylelint-config-recommended-vue": "^1.4.0",
60
+ "stylelint-config-standard": "^25.0.0",
61
+ "stylelint-order": "^5.0.0",
62
+ "typescript": "^4.6.4",
63
+ "vite": "^3.1.3",
64
+ "vue-eslint-parser": "^9.0.3",
65
+ "vue-tsc": "0.39.4"
66
+ },
67
+ "description": "Gx Design"
68
+ }