ep-craft 0.1.35 → 0.1.37
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/components/avatar/EpAvatar.vue.d.ts +20 -0
- package/dist/components/avatar/EpAvatar.vue.js +72 -0
- package/dist/components/avatar/EpAvatar2.vue.js +4 -0
- package/dist/components/avatar/avatar.d.ts +68 -0
- package/dist/components/avatar/avatar.js +59 -0
- package/dist/components/avatar/constants.d.ts +7 -0
- package/dist/components/avatar/constants.js +6 -0
- package/dist/components/avatar/index.d.ts +13 -2
- package/dist/components/avatar/index.js +8 -3
- package/dist/components/avatar/instance.d.ts +2 -0
- package/dist/components/badge/EpBadge.vue.d.ts +28 -0
- package/dist/components/badge/EpBadge.vue.js +75 -0
- package/dist/components/badge/EpBadge2.vue.js +4 -0
- package/dist/components/badge/badge.d.ts +67 -0
- package/dist/components/badge/badge.js +69 -0
- package/dist/components/badge/index.d.ts +11 -2
- package/dist/components/badge/index.js +8 -4
- package/dist/components/badge/instance.d.ts +2 -0
- package/dist/components/breadcrumb/EpBreadcrumb.vue.d.ts +15 -0
- package/dist/components/breadcrumb/EpBreadcrumb.vue.js +41 -0
- package/dist/components/breadcrumb/EpBreadcrumb2.vue.js +4 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +28 -0
- package/dist/components/breadcrumb/breadcrumb.js +21 -0
- package/dist/components/breadcrumb/constants.d.ts +3 -0
- package/dist/components/breadcrumb/constants.js +4 -0
- package/dist/components/breadcrumb/index.d.ts +20 -2
- package/dist/components/breadcrumb/index.js +10 -4
- package/dist/components/breadcrumb/instance.d.ts +2 -0
- package/dist/components/breadcrumb-item/EpBreadcrumbItem.vue.d.ts +15 -0
- package/dist/components/breadcrumb-item/EpBreadcrumbItem.vue.js +58 -0
- package/dist/components/breadcrumb-item/EpBreadcrumbItem2.vue.js +4 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +23 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.js +19 -0
- package/dist/components/breadcrumb-item/index.d.ts +11 -2
- package/dist/components/breadcrumb-item/index.js +8 -4
- package/dist/components/breadcrumb-item/instance.d.ts +2 -0
- package/dist/components/card/EpCard.vue.d.ts +22 -0
- package/dist/components/card/EpCard.vue.js +64 -0
- package/dist/components/card/EpCard2.vue.js +4 -0
- package/dist/components/card/card.d.ts +51 -0
- package/dist/components/card/card.js +49 -0
- package/dist/components/card/index.d.ts +11 -2
- package/dist/components/card/index.js +5 -4
- package/dist/components/card/instance.d.ts +2 -0
- package/dist/components/col/EpCol.vue.d.ts +24 -0
- package/dist/components/col/EpCol.vue.js +61 -0
- package/dist/components/col/EpCol2.vue.js +4 -0
- package/dist/components/col/col.d.ts +71 -0
- package/dist/components/col/col.js +79 -0
- package/dist/components/col/index.d.ts +10 -2
- package/dist/components/col/index.js +5 -4
- package/dist/components/collapse/EpCollapse.vue.d.ts +27 -0
- package/dist/components/collapse/EpCollapse.vue.js +30 -0
- package/dist/components/collapse/EpCollapse2.vue.js +4 -0
- package/dist/components/collapse/collapse.d.ts +47 -0
- package/dist/components/collapse/collapse.js +46 -0
- package/dist/components/collapse/constants.d.ts +7 -0
- package/dist/components/collapse/constants.js +4 -0
- package/dist/components/collapse/index.d.ts +21 -2
- package/dist/components/collapse/index.js +11 -3
- package/dist/components/collapse/instance.d.ts +2 -0
- package/dist/components/collapse/use-collapse-item.d.ts +21 -0
- package/dist/components/collapse/use-collapse-item.js +66 -0
- package/dist/components/collapse/use-collapse.d.ts +9 -0
- package/dist/components/collapse/use-collapse.js +72 -0
- package/dist/components/collapse-item/EpCollapseItem.vue.d.ts +27 -0
- package/dist/components/collapse-item/EpCollapseItem.vue.js +102 -0
- package/dist/components/collapse-item/EpCollapseItem2.vue.js +4 -0
- package/dist/components/collapse-item/collapse-item.d.ts +34 -0
- package/dist/components/collapse-item/collapse-item.js +34 -0
- package/dist/components/collapse-item/index.d.ts +11 -2
- package/dist/components/collapse-item/index.js +8 -4
- package/dist/components/collapse-item/instance.d.ts +2 -0
- package/dist/components/countdown/EpCountdown.vue.d.ts +28 -0
- package/dist/components/countdown/EpCountdown.vue.js +71 -0
- package/dist/components/countdown/EpCountdown2.vue.js +4 -0
- package/dist/components/countdown/countdown.d.ts +48 -0
- package/dist/components/countdown/countdown.js +50 -0
- package/dist/components/countdown/index.d.ts +11 -2
- package/dist/components/countdown/index.js +9 -4
- package/dist/components/countdown/instance.d.ts +2 -0
- package/dist/components/countdown/utils.d.ts +3 -0
- package/dist/components/countdown/utils.js +40 -0
- package/dist/components/dropdown/src/dropdown-item-impl2.vue.js +1 -1
- package/dist/components/dropdown/src/dropdown-item2.vue.js +1 -1
- package/dist/components/dropdown/src/dropdown-menu2.vue.js +1 -1
- package/dist/components/dropdown/src/dropdown2.vue.js +1 -1
- package/dist/components/empty/EpEmpty.vue.d.ts +20 -0
- package/dist/components/empty/EpEmpty.vue.js +62 -0
- package/dist/components/empty/EpEmpty2.vue.js +4 -0
- package/dist/components/empty/empty.d.ts +27 -0
- package/dist/components/empty/empty.js +26 -0
- package/dist/components/empty/img-empty.vue.d.ts +2 -0
- package/dist/components/empty/img-empty.vue.js +141 -0
- package/dist/components/empty/img-empty2.vue.js +4 -0
- package/dist/components/empty/index.d.ts +11 -2
- package/dist/components/empty/index.js +8 -4
- package/dist/components/empty/instance.d.ts +2 -0
- package/dist/components/image/EpImage.vue.d.ts +63 -0
- package/dist/components/image/EpImage.vue.js +207 -0
- package/dist/components/image/EpImage2.vue.js +4 -0
- package/dist/components/image/image.d.ts +132 -0
- package/dist/components/image/image.js +132 -0
- package/dist/components/image/index.d.ts +11 -2
- package/dist/components/image/index.js +9 -4
- package/dist/components/image/instance.d.ts +2 -0
- package/dist/components/image-viewer/EpImageViewer.vue.d.ts +61 -0
- package/dist/components/image-viewer/EpImageViewer.vue.js +421 -0
- package/dist/components/image-viewer/EpImageViewer2.vue.js +4 -0
- package/dist/components/image-viewer/image-viewer.d.ts +100 -0
- package/dist/components/image-viewer/image-viewer.js +99 -0
- package/dist/components/image-viewer/index.d.ts +11 -2
- package/dist/components/image-viewer/index.js +9 -4
- package/dist/components/image-viewer/instance.d.ts +2 -0
- package/dist/components/link/EpLink.vue.d.ts +24 -0
- package/dist/components/link/EpLink.vue.js +86 -0
- package/dist/components/link/EpLink2.vue.js +4 -0
- package/dist/components/link/index.d.ts +11 -2
- package/dist/components/link/index.js +5 -3
- package/dist/components/link/instance.d.ts +2 -0
- package/dist/components/link/link.d.ts +56 -0
- package/dist/components/link/link.js +51 -0
- package/dist/components/result/EpResult.vue.d.ts +23 -0
- package/dist/components/result/EpResult.vue.js +71 -0
- package/dist/components/result/EpResult2.vue.js +4 -0
- package/dist/components/result/index.d.ts +11 -2
- package/dist/components/result/index.js +10 -4
- package/dist/components/result/instance.d.ts +2 -0
- package/dist/components/result/result.d.ts +35 -0
- package/dist/components/result/result.js +47 -0
- package/dist/components/roving-focus-group/index.js +1 -1
- package/dist/components/roving-focus-group/src/roving-focus-item.vue.js +18 -76
- package/dist/components/roving-focus-group/src/roving-focus-item2.vue.js +76 -18
- package/dist/components/row/EpRow.vue.d.ts +17 -0
- package/dist/components/row/EpRow.vue.js +50 -0
- package/dist/components/row/EpRow2.vue.js +4 -0
- package/dist/components/row/constants.d.ts +5 -0
- package/dist/components/row/constants.js +4 -0
- package/dist/components/row/index.d.ts +12 -2
- package/dist/components/row/index.js +7 -4
- package/dist/components/row/row.d.ts +41 -0
- package/dist/components/row/row.js +49 -0
- package/dist/components/skeleton/EpSkeleton.vue.d.ts +24 -0
- package/dist/components/skeleton/EpSkeleton.vue.js +56 -0
- package/dist/components/skeleton/EpSkeleton2.vue.js +4 -0
- package/dist/components/skeleton/index.d.ts +16 -2
- package/dist/components/skeleton/index.js +9 -3
- package/dist/components/skeleton/skeleton.d.ts +53 -0
- package/dist/components/skeleton/skeleton.js +39 -0
- package/dist/components/skeleton-item/EpSkeletonItem.vue.d.ts +5 -0
- package/dist/components/skeleton-item/EpSkeletonItem.vue.js +31 -0
- package/dist/components/skeleton-item/EpSkeletonItem2.vue.js +4 -0
- package/dist/components/skeleton-item/index.d.ts +8 -2
- package/dist/components/skeleton-item/index.js +7 -3
- package/dist/components/skeleton-item/skeleton-item.d.ts +19 -0
- package/dist/components/skeleton-item/skeleton-item.js +26 -0
- package/dist/components/space/index.d.ts +15 -2
- package/dist/components/space/index.js +23 -4
- package/dist/components/space/instance.d.ts +2 -0
- package/dist/components/space/item.d.ts +29 -0
- package/dist/components/space/item.js +30 -0
- package/dist/components/space/space.d.ts +92 -0
- package/dist/components/space/space.js +182 -0
- package/dist/components/space/use-space.d.ts +7 -0
- package/dist/components/space/use-space.js +47 -0
- package/dist/components/statistic/EpStatistic.vue.d.ts +28 -0
- package/dist/components/statistic/EpStatistic.vue.js +82 -0
- package/dist/components/statistic/EpStatistic2.vue.js +4 -0
- package/dist/components/statistic/index.d.ts +11 -2
- package/dist/components/statistic/index.js +8 -4
- package/dist/components/statistic/instance.d.ts +2 -0
- package/dist/components/statistic/statistic.d.ts +58 -0
- package/dist/components/statistic/statistic.js +59 -0
- package/dist/components/timeline/index.d.ts +21 -2
- package/dist/components/timeline/index.js +10 -3
- package/dist/components/timeline/instance.d.ts +2 -0
- package/dist/components/timeline/timeline.d.ts +20 -0
- package/dist/components/timeline/timeline.js +53 -0
- package/dist/components/timeline/tokens.d.ts +7 -0
- package/dist/components/timeline/tokens.js +4 -0
- package/dist/components/timeline-item/EpTimelineItem.vue.d.ts +21 -0
- package/dist/components/timeline-item/EpTimelineItem.vue.js +94 -0
- package/dist/components/timeline-item/EpTimelineItem2.vue.js +4 -0
- package/dist/components/timeline-item/index.d.ts +12 -2
- package/dist/components/timeline-item/index.js +7 -3
- package/dist/components/timeline-item/instance.d.ts +2 -0
- package/dist/components/timeline-item/timeline-item.d.ts +63 -0
- package/dist/components/timeline-item/timeline-item.js +64 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-throttle-render/index.d.ts +7 -0
- package/dist/hooks/use-throttle-render/index.js +31 -0
- package/dist/utils/vue/vnode.js +32 -22
- package/dist/vendored-components.d.ts +1 -1
- package/dist/vendored-components.js +33 -3
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { isNumber as o } from "../../utils/types.js";
|
|
2
|
+
import "lodash-unified";
|
|
3
|
+
import "@vueuse/core";
|
|
4
|
+
import "@vue/shared";
|
|
5
|
+
import { mutable as r } from "../../utils/typescript.js";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
import { buildProps as i, definePropType as t } from "../../utils/vue/props/runtime.js";
|
|
8
|
+
import "vue";
|
|
9
|
+
i({
|
|
10
|
+
/**
|
|
11
|
+
* @description when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode.
|
|
12
|
+
*/
|
|
13
|
+
hideOnClickModal: Boolean,
|
|
14
|
+
/**
|
|
15
|
+
* @description image source, same as native.
|
|
16
|
+
*/
|
|
17
|
+
src: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
/**
|
|
22
|
+
* @description indicate how the image should be resized to fit its container, same as [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).
|
|
23
|
+
*/
|
|
24
|
+
fit: {
|
|
25
|
+
type: String,
|
|
26
|
+
values: ["", "contain", "cover", "fill", "none", "scale-down"],
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* @description Indicates how the browser should load the image, same as [native](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/img#loading)
|
|
31
|
+
*/
|
|
32
|
+
loading: {
|
|
33
|
+
type: String,
|
|
34
|
+
values: ["eager", "lazy"]
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* @description whether to use lazy load.
|
|
38
|
+
*/
|
|
39
|
+
lazy: Boolean,
|
|
40
|
+
/**
|
|
41
|
+
* @description the container to add scroll listener when using lazy load.
|
|
42
|
+
*/
|
|
43
|
+
scrollContainer: {
|
|
44
|
+
type: t([String, Object])
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* @description allow big image preview.
|
|
48
|
+
*/
|
|
49
|
+
previewSrcList: {
|
|
50
|
+
type: t(Array),
|
|
51
|
+
default: () => r([])
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* @description whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`.
|
|
55
|
+
*/
|
|
56
|
+
previewTeleported: Boolean,
|
|
57
|
+
/**
|
|
58
|
+
* @description set image preview z-index.
|
|
59
|
+
*/
|
|
60
|
+
zIndex: {
|
|
61
|
+
type: Number
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* @description initial preview image index, less than the length of `url-list`.
|
|
65
|
+
*/
|
|
66
|
+
initialIndex: {
|
|
67
|
+
type: Number,
|
|
68
|
+
default: 0
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* @description whether the viewer preview is infinite.
|
|
72
|
+
*/
|
|
73
|
+
infinite: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: !0
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* @description whether the image-viewer can be closed by pressing ESC.
|
|
79
|
+
*/
|
|
80
|
+
closeOnPressEscape: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !0
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* @description the zoom rate of the image viewer zoom event
|
|
86
|
+
*/
|
|
87
|
+
zoomRate: {
|
|
88
|
+
type: Number,
|
|
89
|
+
default: 1.2
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* @description preview image scale.
|
|
93
|
+
*/
|
|
94
|
+
scale: {
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 1
|
|
97
|
+
},
|
|
98
|
+
/**
|
|
99
|
+
* @description the min scale of the image viewer zoom event.
|
|
100
|
+
*/
|
|
101
|
+
minScale: {
|
|
102
|
+
type: Number,
|
|
103
|
+
default: 0.2
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* @description the max scale of the image viewer zoom event.
|
|
107
|
+
*/
|
|
108
|
+
maxScale: {
|
|
109
|
+
type: Number,
|
|
110
|
+
default: 7
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* @description show preview image progress content.
|
|
114
|
+
*/
|
|
115
|
+
showProgress: Boolean,
|
|
116
|
+
/**
|
|
117
|
+
* @description set HTML attribute: crossorigin.
|
|
118
|
+
*/
|
|
119
|
+
crossorigin: {
|
|
120
|
+
type: t(String)
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
const c = {
|
|
124
|
+
load: (e) => e instanceof Event,
|
|
125
|
+
error: (e) => e instanceof Event,
|
|
126
|
+
switch: (e) => o(e),
|
|
127
|
+
close: () => !0,
|
|
128
|
+
show: () => !0
|
|
129
|
+
};
|
|
130
|
+
export {
|
|
131
|
+
c as imageEmits
|
|
132
|
+
};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { Plugin } from 'vue';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import _EpImage from './EpImage.vue';
|
|
3
|
+
/**
|
|
4
|
+
* image 自持 barrel(vendor-batch-4 产出)。
|
|
5
|
+
*
|
|
6
|
+
* 预览消费本地 `EpImageViewer`,不再引入上游对应组件。
|
|
7
|
+
* 保留 `showPreview` 暴露契约,不导出 `ElImage` 别名。
|
|
8
|
+
*/
|
|
9
|
+
export declare const EpImage: typeof _EpImage & Plugin;
|
|
4
10
|
export default EpImage;
|
|
11
|
+
export { imageEmits, imageProps } from './image';
|
|
12
|
+
export type { ImageCrossorigin, ImageEmits, ImageFitType, ImageProps, ImagePropsPublic, } from './image';
|
|
13
|
+
export type { ImageInstance } from './instance';
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { withInstall as m } from "../../utils/with-install.js";
|
|
2
|
+
import o from "./EpImage.vue.js";
|
|
3
|
+
import { imageEmits as a } from "./image.js";
|
|
4
|
+
const r = m(
|
|
5
|
+
o,
|
|
6
|
+
"ep-image"
|
|
7
|
+
);
|
|
4
8
|
export {
|
|
5
|
-
|
|
9
|
+
r as EpImage,
|
|
10
|
+
a as imageEmits
|
|
6
11
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ImageViewerAction, ImageViewerProps } from './image-viewer';
|
|
2
|
+
declare function toggleMode(): void;
|
|
3
|
+
declare function setActiveItem(index: number): void;
|
|
4
|
+
declare function prev(): void;
|
|
5
|
+
declare function next(): void;
|
|
6
|
+
declare function handleActions(action: ImageViewerAction, options?: {}): void;
|
|
7
|
+
declare var __VLS_42: {
|
|
8
|
+
activeIndex: number;
|
|
9
|
+
total: number;
|
|
10
|
+
}, __VLS_44: {
|
|
11
|
+
actions: typeof handleActions;
|
|
12
|
+
prev: typeof prev;
|
|
13
|
+
next: typeof next;
|
|
14
|
+
reset: typeof toggleMode;
|
|
15
|
+
activeIndex: number;
|
|
16
|
+
setActiveItem: typeof setActiveItem;
|
|
17
|
+
}, __VLS_106: {
|
|
18
|
+
activeIndex: number;
|
|
19
|
+
src: string;
|
|
20
|
+
}, __VLS_108: {};
|
|
21
|
+
type __VLS_Slots = {} & {
|
|
22
|
+
progress?: (props: typeof __VLS_42) => any;
|
|
23
|
+
} & {
|
|
24
|
+
toolbar?: (props: typeof __VLS_44) => any;
|
|
25
|
+
} & {
|
|
26
|
+
'viewer-error'?: (props: typeof __VLS_106) => any;
|
|
27
|
+
} & {
|
|
28
|
+
default?: (props: typeof __VLS_108) => any;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_component: import("vue").DefineComponent<ImageViewerProps, {
|
|
31
|
+
/**
|
|
32
|
+
* @description manually switch image
|
|
33
|
+
*/
|
|
34
|
+
setActiveItem: typeof setActiveItem;
|
|
35
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
36
|
+
rotate: (deg: number) => void;
|
|
37
|
+
switch: (index: number) => void;
|
|
38
|
+
close: () => void;
|
|
39
|
+
error: (evt: Event) => void;
|
|
40
|
+
}, string, import("vue").PublicProps, Readonly<ImageViewerProps> & Readonly<{
|
|
41
|
+
onRotate?: ((deg: number) => any) | undefined;
|
|
42
|
+
onSwitch?: ((index: number) => any) | undefined;
|
|
43
|
+
onClose?: (() => any) | undefined;
|
|
44
|
+
onError?: ((evt: Event) => any) | undefined;
|
|
45
|
+
}>, {
|
|
46
|
+
infinite: boolean;
|
|
47
|
+
scale: number;
|
|
48
|
+
initialIndex: number;
|
|
49
|
+
closeOnPressEscape: boolean;
|
|
50
|
+
urlList: string[];
|
|
51
|
+
zoomRate: number;
|
|
52
|
+
minScale: number;
|
|
53
|
+
maxScale: number;
|
|
54
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
55
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
56
|
+
export default _default;
|
|
57
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
58
|
+
new (): {
|
|
59
|
+
$slots: S;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { defineComponent as Ie, markRaw as U, ref as k, effectScope as xe, computed as g, shallowRef as Ce, watch as K, nextTick as Te, onMounted as ye, openBlock as N, createBlock as W, Teleport as Ee, createVNode as r, Transition as Re, withCtx as v, createElementVNode as p, normalizeStyle as ee, normalizeClass as u, unref as o, withModifiers as ze, createElementBlock as q, Fragment as Le, createCommentVNode as te, renderSlot as D, createTextVNode as Oe, toDisplayString as Ne, resolveDynamicComponent as Ye } from "vue";
|
|
2
|
+
import { clamp as $e, useEventListener as x } from "@vueuse/core";
|
|
3
|
+
import { throttle as F } from "lodash-unified";
|
|
4
|
+
import { useNamespace as Se } from "../../hooks/use-namespace/index.js";
|
|
5
|
+
import "@vue/shared";
|
|
6
|
+
import { keysOf as Xe } from "../../utils/objects.js";
|
|
7
|
+
import { getEventCode as Me } from "../../utils/dom/event.js";
|
|
8
|
+
import { ScaleToOriginal as De, FullScreen as Fe, Close as Ve, ArrowLeft as Ae, ArrowRight as Be, ZoomOut as Pe, ZoomIn as He, RefreshLeft as Ze, RefreshRight as Ke } from "@element-plus/icons-vue";
|
|
9
|
+
import { EVENT_CODE as y } from "../../constants/aria.js";
|
|
10
|
+
import { useLocale as qe } from "../../hooks/use-locale/index.js";
|
|
11
|
+
import "../../hooks/use-size/index.js";
|
|
12
|
+
import "@popperjs/core";
|
|
13
|
+
import { useZIndex as je } from "../../hooks/use-z-index/index.js";
|
|
14
|
+
import "../../hooks/use-delayed-toggle/index.js";
|
|
15
|
+
import "../../hooks/use-aria/index.js";
|
|
16
|
+
import "../../hooks/use-model-toggle/index.js";
|
|
17
|
+
import "../../hooks/use-empty-values/index.js";
|
|
18
|
+
import { useLockscreen as Ge } from "../../hooks/use-lockscreen/index.js";
|
|
19
|
+
import "../focus-trap/index.js";
|
|
20
|
+
import { ElIcon as w } from "../icon/index.js";
|
|
21
|
+
import { imageViewerEmits as _e } from "./image-viewer.js";
|
|
22
|
+
import Je from "../focus-trap/src/focus-trap.vue.js";
|
|
23
|
+
const Qe = ["src", "crossorigin"], bt = /* @__PURE__ */ Ie({
|
|
24
|
+
name: "EpImageViewer",
|
|
25
|
+
__name: "EpImageViewer",
|
|
26
|
+
props: {
|
|
27
|
+
urlList: { default: () => [] },
|
|
28
|
+
zIndex: {},
|
|
29
|
+
initialIndex: { default: 0 },
|
|
30
|
+
infinite: { type: Boolean, default: !0 },
|
|
31
|
+
hideOnClickModal: { type: Boolean },
|
|
32
|
+
teleported: { type: Boolean },
|
|
33
|
+
closeOnPressEscape: { type: Boolean, default: !0 },
|
|
34
|
+
zoomRate: { default: 1.2 },
|
|
35
|
+
scale: { default: 1 },
|
|
36
|
+
minScale: { default: 0.2 },
|
|
37
|
+
maxScale: { default: 7 },
|
|
38
|
+
showProgress: { type: Boolean },
|
|
39
|
+
crossorigin: {}
|
|
40
|
+
},
|
|
41
|
+
emits: _e,
|
|
42
|
+
setup(C, { expose: oe, emit: ae }) {
|
|
43
|
+
const E = {
|
|
44
|
+
CONTAIN: {
|
|
45
|
+
name: "contain",
|
|
46
|
+
icon: U(Fe)
|
|
47
|
+
},
|
|
48
|
+
ORIGINAL: {
|
|
49
|
+
name: "original",
|
|
50
|
+
icon: U(De)
|
|
51
|
+
}
|
|
52
|
+
}, l = C, R = ae;
|
|
53
|
+
let Y;
|
|
54
|
+
const { t: ne } = qe(), s = Se("image-viewer"), { nextZIndex: se } = je(), z = k(), j = k(), G = xe(), V = g(() => {
|
|
55
|
+
const { scale: e, minScale: t, maxScale: n } = l;
|
|
56
|
+
return $e(e, t, n);
|
|
57
|
+
}), b = k(!0), L = k(!1), A = k(!1), c = k(l.initialIndex), $ = Ce(E.CONTAIN), a = k({
|
|
58
|
+
scale: V.value,
|
|
59
|
+
deg: 0,
|
|
60
|
+
offsetX: 0,
|
|
61
|
+
offsetY: 0,
|
|
62
|
+
enableTransition: !1
|
|
63
|
+
}), le = k(l.zIndex ?? se());
|
|
64
|
+
Ge(A, { ns: s });
|
|
65
|
+
const re = g(() => {
|
|
66
|
+
const { urlList: e } = l;
|
|
67
|
+
return e.length <= 1;
|
|
68
|
+
}), _ = g(() => c.value === 0), J = g(() => c.value === l.urlList.length - 1), S = g(() => l.urlList[c.value]), ie = g(() => [
|
|
69
|
+
s.e("btn"),
|
|
70
|
+
s.e("prev"),
|
|
71
|
+
s.is("disabled", !l.infinite && _.value)
|
|
72
|
+
]), ue = g(() => [
|
|
73
|
+
s.e("btn"),
|
|
74
|
+
s.e("next"),
|
|
75
|
+
s.is("disabled", !l.infinite && J.value)
|
|
76
|
+
]), ce = g(() => {
|
|
77
|
+
const { scale: e, deg: t, offsetX: n, offsetY: f, enableTransition: d } = a.value;
|
|
78
|
+
let i = n / e, m = f / e;
|
|
79
|
+
const T = t * Math.PI / 180, I = Math.cos(T), O = Math.sin(T);
|
|
80
|
+
i = i * I + m * O, m = m * I - n / e * O;
|
|
81
|
+
const Z = {
|
|
82
|
+
transform: `scale(${e}) rotate(${t}deg) translate(${i}px, ${m}px)`,
|
|
83
|
+
transition: d ? "transform .3s" : ""
|
|
84
|
+
};
|
|
85
|
+
return $.value.name === E.CONTAIN.name && (Z.maxWidth = Z.maxHeight = "100%"), Z;
|
|
86
|
+
}), fe = g(
|
|
87
|
+
() => `${c.value + 1} / ${l.urlList.length}`
|
|
88
|
+
);
|
|
89
|
+
function X() {
|
|
90
|
+
me(), Y == null || Y(), A.value = !1, R("close");
|
|
91
|
+
}
|
|
92
|
+
function de() {
|
|
93
|
+
const e = F((n) => {
|
|
94
|
+
switch (Me(n)) {
|
|
95
|
+
case y.esc:
|
|
96
|
+
l.closeOnPressEscape && X();
|
|
97
|
+
break;
|
|
98
|
+
case y.space:
|
|
99
|
+
B();
|
|
100
|
+
break;
|
|
101
|
+
case y.left:
|
|
102
|
+
P();
|
|
103
|
+
break;
|
|
104
|
+
case y.up:
|
|
105
|
+
h("zoomIn");
|
|
106
|
+
break;
|
|
107
|
+
case y.right:
|
|
108
|
+
H();
|
|
109
|
+
break;
|
|
110
|
+
case y.down:
|
|
111
|
+
h("zoomOut");
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}), t = F((n) => {
|
|
115
|
+
const f = n.deltaY || n.deltaX;
|
|
116
|
+
h(f < 0 ? "zoomIn" : "zoomOut", {
|
|
117
|
+
zoomRate: l.zoomRate,
|
|
118
|
+
enableTransition: !1
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
G.run(() => {
|
|
122
|
+
x(document, "keydown", e), x(z, "wheel", t);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function me() {
|
|
126
|
+
G.stop();
|
|
127
|
+
}
|
|
128
|
+
function ve() {
|
|
129
|
+
b.value = !1;
|
|
130
|
+
}
|
|
131
|
+
function pe(e) {
|
|
132
|
+
L.value = !0, b.value = !1, R("error", e), e.target.alt = ne("el.image.error");
|
|
133
|
+
}
|
|
134
|
+
function ge(e) {
|
|
135
|
+
if (b.value || e.button !== 0 || !z.value) return;
|
|
136
|
+
a.value.enableTransition = !1;
|
|
137
|
+
const { offsetX: t, offsetY: n } = a.value, f = e.pageX, d = e.pageY, i = F((I) => {
|
|
138
|
+
a.value = {
|
|
139
|
+
...a.value,
|
|
140
|
+
offsetX: t + I.pageX - f,
|
|
141
|
+
offsetY: n + I.pageY - d
|
|
142
|
+
};
|
|
143
|
+
}), m = x(document, "mousemove", i), T = x(document, "mouseup", () => {
|
|
144
|
+
m(), T();
|
|
145
|
+
});
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
}
|
|
148
|
+
function he(e) {
|
|
149
|
+
if (b.value || !z.value || e.touches.length !== 1) return;
|
|
150
|
+
a.value.enableTransition = !1;
|
|
151
|
+
const { offsetX: t, offsetY: n } = a.value, { pageX: f, pageY: d } = e.touches[0], i = F((I) => {
|
|
152
|
+
const O = I.touches[0];
|
|
153
|
+
a.value = {
|
|
154
|
+
...a.value,
|
|
155
|
+
offsetX: t + O.pageX - f,
|
|
156
|
+
offsetY: n + O.pageY - d
|
|
157
|
+
};
|
|
158
|
+
}), m = x(document, "touchmove", i), T = x(document, "touchend", () => {
|
|
159
|
+
m(), T();
|
|
160
|
+
});
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
}
|
|
163
|
+
function Q() {
|
|
164
|
+
a.value = {
|
|
165
|
+
scale: V.value,
|
|
166
|
+
deg: 0,
|
|
167
|
+
offsetX: 0,
|
|
168
|
+
offsetY: 0,
|
|
169
|
+
enableTransition: !1
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function B() {
|
|
173
|
+
if (b.value || L.value) return;
|
|
174
|
+
const e = Xe(E), t = Object.values(E), n = $.value.name, d = (t.findIndex((i) => i.name === n) + 1) % e.length;
|
|
175
|
+
$.value = E[e[d]], Q();
|
|
176
|
+
}
|
|
177
|
+
function M(e) {
|
|
178
|
+
L.value = !1;
|
|
179
|
+
const t = l.urlList.length;
|
|
180
|
+
c.value = (e + t) % t;
|
|
181
|
+
}
|
|
182
|
+
function P() {
|
|
183
|
+
_.value && !l.infinite || M(c.value - 1);
|
|
184
|
+
}
|
|
185
|
+
function H() {
|
|
186
|
+
J.value && !l.infinite || M(c.value + 1);
|
|
187
|
+
}
|
|
188
|
+
function h(e, t = {}) {
|
|
189
|
+
if (b.value || L.value) return;
|
|
190
|
+
const { minScale: n, maxScale: f } = l, { zoomRate: d, rotateDeg: i, enableTransition: m } = {
|
|
191
|
+
zoomRate: l.zoomRate,
|
|
192
|
+
rotateDeg: 90,
|
|
193
|
+
enableTransition: !0,
|
|
194
|
+
...t
|
|
195
|
+
};
|
|
196
|
+
switch (e) {
|
|
197
|
+
case "zoomOut":
|
|
198
|
+
a.value.scale > n && (a.value.scale = Number.parseFloat(
|
|
199
|
+
(a.value.scale / d).toFixed(3)
|
|
200
|
+
));
|
|
201
|
+
break;
|
|
202
|
+
case "zoomIn":
|
|
203
|
+
a.value.scale < f && (a.value.scale = Number.parseFloat(
|
|
204
|
+
(a.value.scale * d).toFixed(3)
|
|
205
|
+
));
|
|
206
|
+
break;
|
|
207
|
+
case "clockwise":
|
|
208
|
+
a.value.deg += i, R("rotate", a.value.deg);
|
|
209
|
+
break;
|
|
210
|
+
case "anticlockwise":
|
|
211
|
+
a.value.deg -= i, R("rotate", a.value.deg);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
a.value.enableTransition = m;
|
|
215
|
+
}
|
|
216
|
+
function ke(e) {
|
|
217
|
+
var t;
|
|
218
|
+
((t = e.detail) == null ? void 0 : t.focusReason) === "pointer" && e.preventDefault();
|
|
219
|
+
}
|
|
220
|
+
function we() {
|
|
221
|
+
l.closeOnPressEscape && X();
|
|
222
|
+
}
|
|
223
|
+
function be(e) {
|
|
224
|
+
if (e.ctrlKey) {
|
|
225
|
+
if (e.deltaY < 0)
|
|
226
|
+
return e.preventDefault(), !1;
|
|
227
|
+
if (e.deltaY > 0)
|
|
228
|
+
return e.preventDefault(), !1;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return K(
|
|
232
|
+
() => V.value,
|
|
233
|
+
(e) => {
|
|
234
|
+
a.value.scale = e;
|
|
235
|
+
}
|
|
236
|
+
), K(S, () => {
|
|
237
|
+
Te(() => {
|
|
238
|
+
const e = j.value;
|
|
239
|
+
e != null && e.complete || (b.value = !0);
|
|
240
|
+
});
|
|
241
|
+
}), K(c, (e) => {
|
|
242
|
+
Q(), R("switch", e);
|
|
243
|
+
}), ye(() => {
|
|
244
|
+
A.value = !0, de(), Y = x("wheel", be, {
|
|
245
|
+
passive: !1
|
|
246
|
+
});
|
|
247
|
+
}), oe({
|
|
248
|
+
/**
|
|
249
|
+
* @description manually switch image
|
|
250
|
+
*/
|
|
251
|
+
setActiveItem: M
|
|
252
|
+
}), (e, t) => (N(), W(Ee, {
|
|
253
|
+
to: "body",
|
|
254
|
+
disabled: !C.teleported
|
|
255
|
+
}, [
|
|
256
|
+
r(Re, {
|
|
257
|
+
name: "viewer-fade",
|
|
258
|
+
appear: ""
|
|
259
|
+
}, {
|
|
260
|
+
default: v(() => [
|
|
261
|
+
p("div", {
|
|
262
|
+
ref_key: "wrapper",
|
|
263
|
+
ref: z,
|
|
264
|
+
tabindex: -1,
|
|
265
|
+
class: u(o(s).e("wrapper")),
|
|
266
|
+
style: ee({ zIndex: le.value })
|
|
267
|
+
}, [
|
|
268
|
+
r(o(Je), {
|
|
269
|
+
loop: "",
|
|
270
|
+
trapped: "",
|
|
271
|
+
"focus-trap-el": z.value,
|
|
272
|
+
"focus-start-el": "container",
|
|
273
|
+
onFocusoutPrevented: ke,
|
|
274
|
+
onReleaseRequested: we
|
|
275
|
+
}, {
|
|
276
|
+
default: v(() => [
|
|
277
|
+
p("div", {
|
|
278
|
+
class: u(o(s).e("mask")),
|
|
279
|
+
onClick: t[0] || (t[0] = ze((n) => C.hideOnClickModal && X(), ["self"]))
|
|
280
|
+
}, null, 2),
|
|
281
|
+
p("span", {
|
|
282
|
+
class: u([o(s).e("btn"), o(s).e("close")]),
|
|
283
|
+
onClick: X
|
|
284
|
+
}, [
|
|
285
|
+
r(o(w), null, {
|
|
286
|
+
default: v(() => [
|
|
287
|
+
r(o(Ve))
|
|
288
|
+
]),
|
|
289
|
+
_: 1
|
|
290
|
+
})
|
|
291
|
+
], 2),
|
|
292
|
+
re.value ? te("", !0) : (N(), q(Le, { key: 0 }, [
|
|
293
|
+
p("span", {
|
|
294
|
+
class: u(ie.value),
|
|
295
|
+
onClick: P
|
|
296
|
+
}, [
|
|
297
|
+
r(o(w), null, {
|
|
298
|
+
default: v(() => [
|
|
299
|
+
r(o(Ae))
|
|
300
|
+
]),
|
|
301
|
+
_: 1
|
|
302
|
+
})
|
|
303
|
+
], 2),
|
|
304
|
+
p("span", {
|
|
305
|
+
class: u(ue.value),
|
|
306
|
+
onClick: H
|
|
307
|
+
}, [
|
|
308
|
+
r(o(w), null, {
|
|
309
|
+
default: v(() => [
|
|
310
|
+
r(o(Be))
|
|
311
|
+
]),
|
|
312
|
+
_: 1
|
|
313
|
+
})
|
|
314
|
+
], 2)
|
|
315
|
+
], 64)),
|
|
316
|
+
e.$slots.progress || C.showProgress ? (N(), q("div", {
|
|
317
|
+
key: 1,
|
|
318
|
+
class: u([o(s).e("btn"), o(s).e("progress")])
|
|
319
|
+
}, [
|
|
320
|
+
D(e.$slots, "progress", {
|
|
321
|
+
activeIndex: c.value,
|
|
322
|
+
total: C.urlList.length
|
|
323
|
+
}, () => [
|
|
324
|
+
Oe(Ne(fe.value), 1)
|
|
325
|
+
])
|
|
326
|
+
], 2)) : te("", !0),
|
|
327
|
+
p("div", {
|
|
328
|
+
class: u([o(s).e("btn"), o(s).e("actions")])
|
|
329
|
+
}, [
|
|
330
|
+
p("div", {
|
|
331
|
+
class: u(o(s).e("actions__inner"))
|
|
332
|
+
}, [
|
|
333
|
+
D(e.$slots, "toolbar", {
|
|
334
|
+
actions: h,
|
|
335
|
+
prev: P,
|
|
336
|
+
next: H,
|
|
337
|
+
reset: B,
|
|
338
|
+
activeIndex: c.value,
|
|
339
|
+
setActiveItem: M
|
|
340
|
+
}, () => [
|
|
341
|
+
r(o(w), {
|
|
342
|
+
onClick: t[1] || (t[1] = (n) => h("zoomOut"))
|
|
343
|
+
}, {
|
|
344
|
+
default: v(() => [
|
|
345
|
+
r(o(Pe))
|
|
346
|
+
]),
|
|
347
|
+
_: 1
|
|
348
|
+
}),
|
|
349
|
+
r(o(w), {
|
|
350
|
+
onClick: t[2] || (t[2] = (n) => h("zoomIn"))
|
|
351
|
+
}, {
|
|
352
|
+
default: v(() => [
|
|
353
|
+
r(o(He))
|
|
354
|
+
]),
|
|
355
|
+
_: 1
|
|
356
|
+
}),
|
|
357
|
+
p("i", {
|
|
358
|
+
class: u(o(s).e("actions__divider"))
|
|
359
|
+
}, null, 2),
|
|
360
|
+
r(o(w), { onClick: B }, {
|
|
361
|
+
default: v(() => [
|
|
362
|
+
(N(), W(Ye($.value.icon)))
|
|
363
|
+
]),
|
|
364
|
+
_: 1
|
|
365
|
+
}),
|
|
366
|
+
p("i", {
|
|
367
|
+
class: u(o(s).e("actions__divider"))
|
|
368
|
+
}, null, 2),
|
|
369
|
+
r(o(w), {
|
|
370
|
+
onClick: t[3] || (t[3] = (n) => h("anticlockwise"))
|
|
371
|
+
}, {
|
|
372
|
+
default: v(() => [
|
|
373
|
+
r(o(Ze))
|
|
374
|
+
]),
|
|
375
|
+
_: 1
|
|
376
|
+
}),
|
|
377
|
+
r(o(w), {
|
|
378
|
+
onClick: t[4] || (t[4] = (n) => h("clockwise"))
|
|
379
|
+
}, {
|
|
380
|
+
default: v(() => [
|
|
381
|
+
r(o(Ke))
|
|
382
|
+
]),
|
|
383
|
+
_: 1
|
|
384
|
+
})
|
|
385
|
+
])
|
|
386
|
+
], 2)
|
|
387
|
+
], 2),
|
|
388
|
+
p("div", {
|
|
389
|
+
class: u(o(s).e("canvas"))
|
|
390
|
+
}, [
|
|
391
|
+
L.value && e.$slots["viewer-error"] ? D(e.$slots, "viewer-error", {
|
|
392
|
+
activeIndex: c.value,
|
|
393
|
+
src: S.value
|
|
394
|
+
}, void 0, void 0, 0) : (N(), q("img", {
|
|
395
|
+
ref_key: "imgRef",
|
|
396
|
+
ref: j,
|
|
397
|
+
key: S.value,
|
|
398
|
+
src: S.value,
|
|
399
|
+
style: ee(ce.value),
|
|
400
|
+
class: u(o(s).e("img")),
|
|
401
|
+
crossorigin: C.crossorigin,
|
|
402
|
+
onLoad: ve,
|
|
403
|
+
onError: pe,
|
|
404
|
+
onMousedown: ge,
|
|
405
|
+
onTouchstart: he
|
|
406
|
+
}, null, 46, Qe))
|
|
407
|
+
], 2),
|
|
408
|
+
D(e.$slots, "default")
|
|
409
|
+
]),
|
|
410
|
+
_: 3
|
|
411
|
+
}, 8, ["focus-trap-el"])
|
|
412
|
+
], 6)
|
|
413
|
+
]),
|
|
414
|
+
_: 3
|
|
415
|
+
})
|
|
416
|
+
], 8, ["disabled"]));
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
export {
|
|
420
|
+
bt as default
|
|
421
|
+
};
|