@element-plus/nightly 0.0.20231216 → 0.0.20231217
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/index.full.js +3 -4
- package/dist/index.full.min.js +3 -3
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +3 -3
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +3 -4
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/ckb.js +1 -1
- package/dist/locale/ckb.min.js +1 -1
- package/dist/locale/ckb.min.mjs +1 -1
- package/dist/locale/ckb.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/sw.js +1 -1
- package/dist/locale/sw.min.js +1 -1
- package/dist/locale/sw.min.mjs +1 -1
- package/dist/locale/sw.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/cascader-panel/src/index.mjs +1 -1
- package/es/components/cascader-panel/src/menu.mjs +1 -1
- package/es/components/cascader-panel/src/node.mjs +209 -116
- package/es/components/cascader-panel/src/node.mjs.map +1 -1
- package/es/components/cascader-panel/src/node2.mjs +116 -209
- package/es/components/cascader-panel/src/node2.mjs.map +1 -1
- package/es/components/cascader-panel/src/store.mjs +1 -1
- package/es/components/descriptions/index.d.ts +1 -1
- package/es/components/descriptions/src/description.vue.d.ts +1 -1
- package/es/components/icon/index.mjs +2 -2
- package/es/components/icon/src/icon.mjs +36 -8
- package/es/components/icon/src/icon.mjs.map +1 -1
- package/es/components/icon/src/icon2.mjs +8 -36
- package/es/components/icon/src/icon2.mjs.map +1 -1
- package/es/components/image/index.mjs +2 -2
- package/es/components/image/src/image.mjs +225 -61
- package/es/components/image/src/image.mjs.map +1 -1
- package/es/components/image/src/image2.mjs +61 -225
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/image-viewer/index.mjs +2 -2
- package/es/components/image-viewer/src/image-viewer.mjs +401 -41
- package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer2.mjs +41 -401
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.mjs +5 -5
- package/es/components/input/src/input2.mjs +1 -2
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/menu/index.mjs +2 -2
- package/es/components/menu/src/menu-item.mjs +97 -14
- package/es/components/menu/src/menu-item.mjs.map +1 -1
- package/es/components/menu/src/menu-item2.mjs +14 -97
- package/es/components/menu/src/menu-item2.mjs.map +1 -1
- package/es/components/space/index.d.ts +1 -1
- package/es/components/space/src/space.d.ts +1 -1
- package/es/components/steps/index.d.ts +1 -1
- package/es/components/steps/src/steps.vue.d.ts +1 -1
- package/es/components/table/index.d.ts +1 -1
- package/es/components/table/src/table.vue.d.ts +1 -1
- package/es/components/tooltip-v2/index.mjs +1 -1
- package/es/components/tooltip-v2/src/root.mjs +80 -17
- package/es/components/tooltip-v2/src/root.mjs.map +1 -1
- package/es/components/tooltip-v2/src/root2.mjs +17 -80
- package/es/components/tooltip-v2/src/root2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +1 -1
- package/es/components/tooltip-v2/src/tooltip2.mjs +2 -2
- package/es/components/watermark/index.mjs +2 -2
- package/es/components/watermark/src/watermark.mjs +209 -28
- package/es/components/watermark/src/watermark.mjs.map +1 -1
- package/es/components/watermark/src/watermark2.mjs +28 -209
- package/es/components/watermark/src/watermark2.mjs.map +1 -1
- package/es/index.mjs +5 -5
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/cascader-panel/src/index.js +1 -1
- package/lib/components/cascader-panel/src/menu.js +1 -1
- package/lib/components/cascader-panel/src/node.js +209 -116
- package/lib/components/cascader-panel/src/node.js.map +1 -1
- package/lib/components/cascader-panel/src/node2.js +116 -209
- package/lib/components/cascader-panel/src/node2.js.map +1 -1
- package/lib/components/cascader-panel/src/store.js +1 -1
- package/lib/components/descriptions/index.d.ts +1 -1
- package/lib/components/descriptions/src/description.vue.d.ts +1 -1
- package/lib/components/icon/index.js +2 -2
- package/lib/components/icon/src/icon.js +36 -8
- package/lib/components/icon/src/icon.js.map +1 -1
- package/lib/components/icon/src/icon2.js +8 -36
- package/lib/components/icon/src/icon2.js.map +1 -1
- package/lib/components/image/index.js +2 -2
- package/lib/components/image/src/image.js +224 -61
- package/lib/components/image/src/image.js.map +1 -1
- package/lib/components/image/src/image2.js +61 -224
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/image-viewer/index.js +2 -2
- package/lib/components/image-viewer/src/image-viewer.js +401 -42
- package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer2.js +42 -401
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.js +5 -5
- package/lib/components/input/src/input2.js +1 -2
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/menu/index.js +2 -2
- package/lib/components/menu/src/menu-item.js +97 -15
- package/lib/components/menu/src/menu-item.js.map +1 -1
- package/lib/components/menu/src/menu-item2.js +15 -97
- package/lib/components/menu/src/menu-item2.js.map +1 -1
- package/lib/components/space/index.d.ts +1 -1
- package/lib/components/space/src/space.d.ts +1 -1
- package/lib/components/steps/index.d.ts +1 -1
- package/lib/components/steps/src/steps.vue.d.ts +1 -1
- package/lib/components/table/index.d.ts +1 -1
- package/lib/components/table/src/table.vue.d.ts +1 -1
- package/lib/components/tooltip-v2/index.js +1 -1
- package/lib/components/tooltip-v2/src/root.js +80 -17
- package/lib/components/tooltip-v2/src/root.js.map +1 -1
- package/lib/components/tooltip-v2/src/root2.js +17 -80
- package/lib/components/tooltip-v2/src/root2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +1 -1
- package/lib/components/tooltip-v2/src/tooltip2.js +2 -2
- package/lib/components/watermark/index.js +2 -2
- package/lib/components/watermark/src/watermark.js +209 -28
- package/lib/components/watermark/src/watermark.js.map +1 -1
- package/lib/components/watermark/src/watermark2.js +28 -209
- package/lib/components/watermark/src/watermark2.js.map +1 -1
- package/lib/index.js +5 -5
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
|
@@ -1,408 +1,48 @@
|
|
|
1
|
-
import { defineComponent, markRaw, ref, effectScope, shallowRef, computed, watch, nextTick, onMounted, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, createElementVNode, normalizeClass, unref, normalizeStyle, withModifiers, createCommentVNode, createElementBlock, Fragment, resolveDynamicComponent, renderList, withDirectives, vShow, renderSlot } from 'vue';
|
|
2
|
-
import { useEventListener } from '@vueuse/core';
|
|
3
|
-
import { throttle } from 'lodash-unified';
|
|
4
|
-
import '../../../hooks/index.mjs';
|
|
5
|
-
import '../../../constants/index.mjs';
|
|
6
1
|
import '../../../utils/index.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { imageViewerProps, imageViewerEmits } from './image-viewer.mjs';
|
|
10
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
11
|
-
import { useLocale } from '../../../hooks/use-locale/index.mjs';
|
|
12
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
13
|
-
import { useZIndex } from '../../../hooks/use-z-index/index.mjs';
|
|
2
|
+
import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
|
|
3
|
+
import { mutable } from '../../../utils/typescript.mjs';
|
|
14
4
|
import { isNumber } from '../../../utils/types.mjs';
|
|
15
|
-
import { EVENT_CODE } from '../../../constants/aria.mjs';
|
|
16
|
-
import { keysOf } from '../../../utils/objects.mjs';
|
|
17
5
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
offsetY: 0,
|
|
52
|
-
enableTransition: false
|
|
53
|
-
});
|
|
54
|
-
const isSingle = computed(() => {
|
|
55
|
-
const { urlList } = props;
|
|
56
|
-
return urlList.length <= 1;
|
|
57
|
-
});
|
|
58
|
-
const isFirst = computed(() => {
|
|
59
|
-
return activeIndex.value === 0;
|
|
60
|
-
});
|
|
61
|
-
const isLast = computed(() => {
|
|
62
|
-
return activeIndex.value === props.urlList.length - 1;
|
|
63
|
-
});
|
|
64
|
-
const currentImg = computed(() => {
|
|
65
|
-
return props.urlList[activeIndex.value];
|
|
66
|
-
});
|
|
67
|
-
const arrowPrevKls = computed(() => [
|
|
68
|
-
ns.e("btn"),
|
|
69
|
-
ns.e("prev"),
|
|
70
|
-
ns.is("disabled", !props.infinite && isFirst.value)
|
|
71
|
-
]);
|
|
72
|
-
const arrowNextKls = computed(() => [
|
|
73
|
-
ns.e("btn"),
|
|
74
|
-
ns.e("next"),
|
|
75
|
-
ns.is("disabled", !props.infinite && isLast.value)
|
|
76
|
-
]);
|
|
77
|
-
const imgStyle = computed(() => {
|
|
78
|
-
const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
|
|
79
|
-
let translateX = offsetX / scale;
|
|
80
|
-
let translateY = offsetY / scale;
|
|
81
|
-
switch (deg % 360) {
|
|
82
|
-
case 90:
|
|
83
|
-
case -270:
|
|
84
|
-
;
|
|
85
|
-
[translateX, translateY] = [translateY, -translateX];
|
|
86
|
-
break;
|
|
87
|
-
case 180:
|
|
88
|
-
case -180:
|
|
89
|
-
;
|
|
90
|
-
[translateX, translateY] = [-translateX, -translateY];
|
|
91
|
-
break;
|
|
92
|
-
case 270:
|
|
93
|
-
case -90:
|
|
94
|
-
;
|
|
95
|
-
[translateX, translateY] = [-translateY, translateX];
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
const style = {
|
|
99
|
-
transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
|
|
100
|
-
transition: enableTransition ? "transform .3s" : ""
|
|
101
|
-
};
|
|
102
|
-
if (mode.value.name === modes.CONTAIN.name) {
|
|
103
|
-
style.maxWidth = style.maxHeight = "100%";
|
|
104
|
-
}
|
|
105
|
-
return style;
|
|
106
|
-
});
|
|
107
|
-
const computedZIndex = computed(() => {
|
|
108
|
-
return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
|
|
109
|
-
});
|
|
110
|
-
function hide() {
|
|
111
|
-
unregisterEventListener();
|
|
112
|
-
emit("close");
|
|
113
|
-
}
|
|
114
|
-
function registerEventListener() {
|
|
115
|
-
const keydownHandler = throttle((e) => {
|
|
116
|
-
switch (e.code) {
|
|
117
|
-
case EVENT_CODE.esc:
|
|
118
|
-
props.closeOnPressEscape && hide();
|
|
119
|
-
break;
|
|
120
|
-
case EVENT_CODE.space:
|
|
121
|
-
toggleMode();
|
|
122
|
-
break;
|
|
123
|
-
case EVENT_CODE.left:
|
|
124
|
-
prev();
|
|
125
|
-
break;
|
|
126
|
-
case EVENT_CODE.up:
|
|
127
|
-
handleActions("zoomIn");
|
|
128
|
-
break;
|
|
129
|
-
case EVENT_CODE.right:
|
|
130
|
-
next();
|
|
131
|
-
break;
|
|
132
|
-
case EVENT_CODE.down:
|
|
133
|
-
handleActions("zoomOut");
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
const mousewheelHandler = throttle((e) => {
|
|
138
|
-
const delta = e.deltaY || e.deltaX;
|
|
139
|
-
handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
|
|
140
|
-
zoomRate: props.zoomRate,
|
|
141
|
-
enableTransition: false
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
scopeEventListener.run(() => {
|
|
145
|
-
useEventListener(document, "keydown", keydownHandler);
|
|
146
|
-
useEventListener(document, "wheel", mousewheelHandler);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function unregisterEventListener() {
|
|
150
|
-
scopeEventListener.stop();
|
|
151
|
-
}
|
|
152
|
-
function handleImgLoad() {
|
|
153
|
-
loading.value = false;
|
|
154
|
-
}
|
|
155
|
-
function handleImgError(e) {
|
|
156
|
-
loading.value = false;
|
|
157
|
-
e.target.alt = t("el.image.error");
|
|
158
|
-
}
|
|
159
|
-
function handleMouseDown(e) {
|
|
160
|
-
if (loading.value || e.button !== 0 || !wrapper.value)
|
|
161
|
-
return;
|
|
162
|
-
transform.value.enableTransition = false;
|
|
163
|
-
const { offsetX, offsetY } = transform.value;
|
|
164
|
-
const startX = e.pageX;
|
|
165
|
-
const startY = e.pageY;
|
|
166
|
-
const dragHandler = throttle((ev) => {
|
|
167
|
-
transform.value = {
|
|
168
|
-
...transform.value,
|
|
169
|
-
offsetX: offsetX + ev.pageX - startX,
|
|
170
|
-
offsetY: offsetY + ev.pageY - startY
|
|
171
|
-
};
|
|
172
|
-
});
|
|
173
|
-
const removeMousemove = useEventListener(document, "mousemove", dragHandler);
|
|
174
|
-
useEventListener(document, "mouseup", () => {
|
|
175
|
-
removeMousemove();
|
|
176
|
-
});
|
|
177
|
-
e.preventDefault();
|
|
178
|
-
}
|
|
179
|
-
function reset() {
|
|
180
|
-
transform.value = {
|
|
181
|
-
scale: 1,
|
|
182
|
-
deg: 0,
|
|
183
|
-
offsetX: 0,
|
|
184
|
-
offsetY: 0,
|
|
185
|
-
enableTransition: false
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function toggleMode() {
|
|
189
|
-
if (loading.value)
|
|
190
|
-
return;
|
|
191
|
-
const modeNames = keysOf(modes);
|
|
192
|
-
const modeValues = Object.values(modes);
|
|
193
|
-
const currentMode = mode.value.name;
|
|
194
|
-
const index = modeValues.findIndex((i) => i.name === currentMode);
|
|
195
|
-
const nextIndex = (index + 1) % modeNames.length;
|
|
196
|
-
mode.value = modes[modeNames[nextIndex]];
|
|
197
|
-
reset();
|
|
198
|
-
}
|
|
199
|
-
function setActiveItem(index) {
|
|
200
|
-
const len = props.urlList.length;
|
|
201
|
-
activeIndex.value = (index + len) % len;
|
|
202
|
-
}
|
|
203
|
-
function prev() {
|
|
204
|
-
if (isFirst.value && !props.infinite)
|
|
205
|
-
return;
|
|
206
|
-
setActiveItem(activeIndex.value - 1);
|
|
207
|
-
}
|
|
208
|
-
function next() {
|
|
209
|
-
if (isLast.value && !props.infinite)
|
|
210
|
-
return;
|
|
211
|
-
setActiveItem(activeIndex.value + 1);
|
|
212
|
-
}
|
|
213
|
-
function handleActions(action, options = {}) {
|
|
214
|
-
if (loading.value)
|
|
215
|
-
return;
|
|
216
|
-
const { minScale, maxScale } = props;
|
|
217
|
-
const { zoomRate, rotateDeg, enableTransition } = {
|
|
218
|
-
zoomRate: props.zoomRate,
|
|
219
|
-
rotateDeg: 90,
|
|
220
|
-
enableTransition: true,
|
|
221
|
-
...options
|
|
222
|
-
};
|
|
223
|
-
switch (action) {
|
|
224
|
-
case "zoomOut":
|
|
225
|
-
if (transform.value.scale > minScale) {
|
|
226
|
-
transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
|
|
227
|
-
}
|
|
228
|
-
break;
|
|
229
|
-
case "zoomIn":
|
|
230
|
-
if (transform.value.scale < maxScale) {
|
|
231
|
-
transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
|
|
232
|
-
}
|
|
233
|
-
break;
|
|
234
|
-
case "clockwise":
|
|
235
|
-
transform.value.deg += rotateDeg;
|
|
236
|
-
emit("rotate", transform.value.deg);
|
|
237
|
-
break;
|
|
238
|
-
case "anticlockwise":
|
|
239
|
-
transform.value.deg -= rotateDeg;
|
|
240
|
-
emit("rotate", transform.value.deg);
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
transform.value.enableTransition = enableTransition;
|
|
244
|
-
}
|
|
245
|
-
watch(currentImg, () => {
|
|
246
|
-
nextTick(() => {
|
|
247
|
-
const $img = imgRefs.value[0];
|
|
248
|
-
if (!($img == null ? void 0 : $img.complete)) {
|
|
249
|
-
loading.value = true;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
watch(activeIndex, (val) => {
|
|
254
|
-
reset();
|
|
255
|
-
emit("switch", val);
|
|
256
|
-
});
|
|
257
|
-
onMounted(() => {
|
|
258
|
-
var _a, _b;
|
|
259
|
-
registerEventListener();
|
|
260
|
-
(_b = (_a = wrapper.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
|
|
261
|
-
});
|
|
262
|
-
expose({
|
|
263
|
-
setActiveItem
|
|
264
|
-
});
|
|
265
|
-
return (_ctx, _cache) => {
|
|
266
|
-
return openBlock(), createBlock(Teleport, {
|
|
267
|
-
to: "body",
|
|
268
|
-
disabled: !_ctx.teleported
|
|
269
|
-
}, [
|
|
270
|
-
createVNode(Transition, {
|
|
271
|
-
name: "viewer-fade",
|
|
272
|
-
appear: ""
|
|
273
|
-
}, {
|
|
274
|
-
default: withCtx(() => [
|
|
275
|
-
createElementVNode("div", {
|
|
276
|
-
ref_key: "wrapper",
|
|
277
|
-
ref: wrapper,
|
|
278
|
-
tabindex: -1,
|
|
279
|
-
class: normalizeClass(unref(ns).e("wrapper")),
|
|
280
|
-
style: normalizeStyle({ zIndex: unref(computedZIndex) })
|
|
281
|
-
}, [
|
|
282
|
-
createElementVNode("div", {
|
|
283
|
-
class: normalizeClass(unref(ns).e("mask")),
|
|
284
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"]))
|
|
285
|
-
}, null, 2),
|
|
286
|
-
createCommentVNode(" CLOSE "),
|
|
287
|
-
createElementVNode("span", {
|
|
288
|
-
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
|
|
289
|
-
onClick: hide
|
|
290
|
-
}, [
|
|
291
|
-
createVNode(unref(ElIcon), null, {
|
|
292
|
-
default: withCtx(() => [
|
|
293
|
-
createVNode(unref(Close))
|
|
294
|
-
]),
|
|
295
|
-
_: 1
|
|
296
|
-
})
|
|
297
|
-
], 2),
|
|
298
|
-
createCommentVNode(" ARROW "),
|
|
299
|
-
!unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
300
|
-
createElementVNode("span", {
|
|
301
|
-
class: normalizeClass(unref(arrowPrevKls)),
|
|
302
|
-
onClick: prev
|
|
303
|
-
}, [
|
|
304
|
-
createVNode(unref(ElIcon), null, {
|
|
305
|
-
default: withCtx(() => [
|
|
306
|
-
createVNode(unref(ArrowLeft))
|
|
307
|
-
]),
|
|
308
|
-
_: 1
|
|
309
|
-
})
|
|
310
|
-
], 2),
|
|
311
|
-
createElementVNode("span", {
|
|
312
|
-
class: normalizeClass(unref(arrowNextKls)),
|
|
313
|
-
onClick: next
|
|
314
|
-
}, [
|
|
315
|
-
createVNode(unref(ElIcon), null, {
|
|
316
|
-
default: withCtx(() => [
|
|
317
|
-
createVNode(unref(ArrowRight))
|
|
318
|
-
]),
|
|
319
|
-
_: 1
|
|
320
|
-
})
|
|
321
|
-
], 2)
|
|
322
|
-
], 64)) : createCommentVNode("v-if", true),
|
|
323
|
-
createCommentVNode(" ACTIONS "),
|
|
324
|
-
createElementVNode("div", {
|
|
325
|
-
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
|
|
326
|
-
}, [
|
|
327
|
-
createElementVNode("div", {
|
|
328
|
-
class: normalizeClass(unref(ns).e("actions__inner"))
|
|
329
|
-
}, [
|
|
330
|
-
createVNode(unref(ElIcon), {
|
|
331
|
-
onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
|
|
332
|
-
}, {
|
|
333
|
-
default: withCtx(() => [
|
|
334
|
-
createVNode(unref(ZoomOut))
|
|
335
|
-
]),
|
|
336
|
-
_: 1
|
|
337
|
-
}),
|
|
338
|
-
createVNode(unref(ElIcon), {
|
|
339
|
-
onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
|
|
340
|
-
}, {
|
|
341
|
-
default: withCtx(() => [
|
|
342
|
-
createVNode(unref(ZoomIn))
|
|
343
|
-
]),
|
|
344
|
-
_: 1
|
|
345
|
-
}),
|
|
346
|
-
createElementVNode("i", {
|
|
347
|
-
class: normalizeClass(unref(ns).e("actions__divider"))
|
|
348
|
-
}, null, 2),
|
|
349
|
-
createVNode(unref(ElIcon), { onClick: toggleMode }, {
|
|
350
|
-
default: withCtx(() => [
|
|
351
|
-
(openBlock(), createBlock(resolveDynamicComponent(unref(mode).icon)))
|
|
352
|
-
]),
|
|
353
|
-
_: 1
|
|
354
|
-
}),
|
|
355
|
-
createElementVNode("i", {
|
|
356
|
-
class: normalizeClass(unref(ns).e("actions__divider"))
|
|
357
|
-
}, null, 2),
|
|
358
|
-
createVNode(unref(ElIcon), {
|
|
359
|
-
onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
|
|
360
|
-
}, {
|
|
361
|
-
default: withCtx(() => [
|
|
362
|
-
createVNode(unref(RefreshLeft))
|
|
363
|
-
]),
|
|
364
|
-
_: 1
|
|
365
|
-
}),
|
|
366
|
-
createVNode(unref(ElIcon), {
|
|
367
|
-
onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
|
|
368
|
-
}, {
|
|
369
|
-
default: withCtx(() => [
|
|
370
|
-
createVNode(unref(RefreshRight))
|
|
371
|
-
]),
|
|
372
|
-
_: 1
|
|
373
|
-
})
|
|
374
|
-
], 2)
|
|
375
|
-
], 2),
|
|
376
|
-
createCommentVNode(" CANVAS "),
|
|
377
|
-
createElementVNode("div", {
|
|
378
|
-
class: normalizeClass(unref(ns).e("canvas"))
|
|
379
|
-
}, [
|
|
380
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url, i) => {
|
|
381
|
-
return withDirectives((openBlock(), createElementBlock("img", {
|
|
382
|
-
ref_for: true,
|
|
383
|
-
ref: (el) => imgRefs.value[i] = el,
|
|
384
|
-
key: url,
|
|
385
|
-
src: url,
|
|
386
|
-
style: normalizeStyle(unref(imgStyle)),
|
|
387
|
-
class: normalizeClass(unref(ns).e("img")),
|
|
388
|
-
onLoad: handleImgLoad,
|
|
389
|
-
onError: handleImgError,
|
|
390
|
-
onMousedown: handleMouseDown
|
|
391
|
-
}, null, 46, _hoisted_1)), [
|
|
392
|
-
[vShow, i === activeIndex.value]
|
|
393
|
-
]);
|
|
394
|
-
}), 128))
|
|
395
|
-
], 2),
|
|
396
|
-
renderSlot(_ctx.$slots, "default")
|
|
397
|
-
], 6)
|
|
398
|
-
]),
|
|
399
|
-
_: 3
|
|
400
|
-
})
|
|
401
|
-
], 8, ["disabled"]);
|
|
402
|
-
};
|
|
6
|
+
const imageViewerProps = buildProps({
|
|
7
|
+
urlList: {
|
|
8
|
+
type: definePropType(Array),
|
|
9
|
+
default: () => mutable([])
|
|
10
|
+
},
|
|
11
|
+
zIndex: {
|
|
12
|
+
type: Number
|
|
13
|
+
},
|
|
14
|
+
initialIndex: {
|
|
15
|
+
type: Number,
|
|
16
|
+
default: 0
|
|
17
|
+
},
|
|
18
|
+
infinite: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
hideOnClickModal: Boolean,
|
|
23
|
+
teleported: Boolean,
|
|
24
|
+
closeOnPressEscape: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true
|
|
27
|
+
},
|
|
28
|
+
zoomRate: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 1.2
|
|
31
|
+
},
|
|
32
|
+
minScale: {
|
|
33
|
+
type: Number,
|
|
34
|
+
default: 0.2
|
|
35
|
+
},
|
|
36
|
+
maxScale: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 7
|
|
403
39
|
}
|
|
404
40
|
});
|
|
405
|
-
|
|
41
|
+
const imageViewerEmits = {
|
|
42
|
+
close: () => true,
|
|
43
|
+
switch: (index) => isNumber(index),
|
|
44
|
+
rotate: (deg) => isNumber(deg)
|
|
45
|
+
};
|
|
406
46
|
|
|
407
|
-
export {
|
|
47
|
+
export { imageViewerEmits, imageViewerProps };
|
|
408
48
|
//# sourceMappingURL=image-viewer2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-viewer2.mjs","sources":["../../../../../../packages/components/image-viewer/src/image-viewer.vue"],"sourcesContent":["<template>\n <teleport to=\"body\" :disabled=\"!teleported\">\n <transition name=\"viewer-fade\" appear>\n <div\n ref=\"wrapper\"\n :tabindex=\"-1\"\n :class=\"ns.e('wrapper')\"\n :style=\"{ zIndex: computedZIndex }\"\n >\n <div :class=\"ns.e('mask')\" @click.self=\"hideOnClickModal && hide()\" />\n\n <!-- CLOSE -->\n <span :class=\"[ns.e('btn'), ns.e('close')]\" @click=\"hide\">\n <el-icon><Close /></el-icon>\n </span>\n\n <!-- ARROW -->\n <template v-if=\"!isSingle\">\n <span :class=\"arrowPrevKls\" @click=\"prev\">\n <el-icon><ArrowLeft /></el-icon>\n </span>\n <span :class=\"arrowNextKls\" @click=\"next\">\n <el-icon><ArrowRight /></el-icon>\n </span>\n </template>\n <!-- ACTIONS -->\n <div :class=\"[ns.e('btn'), ns.e('actions')]\">\n <div :class=\"ns.e('actions__inner')\">\n <el-icon @click=\"handleActions('zoomOut')\">\n <ZoomOut />\n </el-icon>\n <el-icon @click=\"handleActions('zoomIn')\">\n <ZoomIn />\n </el-icon>\n <i :class=\"ns.e('actions__divider')\" />\n <el-icon @click=\"toggleMode\">\n <component :is=\"mode.icon\" />\n </el-icon>\n <i :class=\"ns.e('actions__divider')\" />\n <el-icon @click=\"handleActions('anticlockwise')\">\n <RefreshLeft />\n </el-icon>\n <el-icon @click=\"handleActions('clockwise')\">\n <RefreshRight />\n </el-icon>\n </div>\n </div>\n <!-- CANVAS -->\n <div :class=\"ns.e('canvas')\">\n <img\n v-for=\"(url, i) in urlList\"\n v-show=\"i === activeIndex\"\n :ref=\"(el) => (imgRefs[i] = el as HTMLImageElement)\"\n :key=\"url\"\n :src=\"url\"\n :style=\"imgStyle\"\n :class=\"ns.e('img')\"\n @load=\"handleImgLoad\"\n @error=\"handleImgError\"\n @mousedown=\"handleMouseDown\"\n />\n </div>\n <slot />\n </div>\n </transition>\n </teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n effectScope,\n markRaw,\n nextTick,\n onMounted,\n ref,\n shallowRef,\n watch,\n} from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { throttle } from 'lodash-unified'\nimport { useLocale, useNamespace, useZIndex } from '@element-plus/hooks'\nimport { EVENT_CODE } from '@element-plus/constants'\nimport { isNumber, keysOf } from '@element-plus/utils'\nimport ElIcon from '@element-plus/components/icon'\nimport {\n ArrowLeft,\n ArrowRight,\n Close,\n FullScreen,\n RefreshLeft,\n RefreshRight,\n ScaleToOriginal,\n ZoomIn,\n ZoomOut,\n} from '@element-plus/icons-vue'\nimport { imageViewerEmits, imageViewerProps } from './image-viewer'\n\nimport type { CSSProperties } from 'vue'\nimport type { ImageViewerAction, ImageViewerMode } from './image-viewer'\n\nconst modes: Record<'CONTAIN' | 'ORIGINAL', ImageViewerMode> = {\n CONTAIN: {\n name: 'contain',\n icon: markRaw(FullScreen),\n },\n ORIGINAL: {\n name: 'original',\n icon: markRaw(ScaleToOriginal),\n },\n}\n\ndefineOptions({\n name: 'ElImageViewer',\n})\n\nconst props = defineProps(imageViewerProps)\nconst emit = defineEmits(imageViewerEmits)\n\nconst { t } = useLocale()\nconst ns = useNamespace('image-viewer')\nconst { nextZIndex } = useZIndex()\nconst wrapper = ref<HTMLDivElement>()\nconst imgRefs = ref<HTMLImageElement[]>([])\n\nconst scopeEventListener = effectScope()\n\nconst loading = ref(true)\nconst activeIndex = ref(props.initialIndex)\nconst mode = shallowRef<ImageViewerMode>(modes.CONTAIN)\nconst transform = ref({\n scale: 1,\n deg: 0,\n offsetX: 0,\n offsetY: 0,\n enableTransition: false,\n})\n\nconst isSingle = computed(() => {\n const { urlList } = props\n return urlList.length <= 1\n})\n\nconst isFirst = computed(() => {\n return activeIndex.value === 0\n})\n\nconst isLast = computed(() => {\n return activeIndex.value === props.urlList.length - 1\n})\n\nconst currentImg = computed(() => {\n return props.urlList[activeIndex.value]\n})\n\nconst arrowPrevKls = computed(() => [\n ns.e('btn'),\n ns.e('prev'),\n ns.is('disabled', !props.infinite && isFirst.value),\n])\n\nconst arrowNextKls = computed(() => [\n ns.e('btn'),\n ns.e('next'),\n ns.is('disabled', !props.infinite && isLast.value),\n])\n\nconst imgStyle = computed(() => {\n const { scale, deg, offsetX, offsetY, enableTransition } = transform.value\n let translateX = offsetX / scale\n let translateY = offsetY / scale\n\n switch (deg % 360) {\n case 90:\n case -270:\n ;[translateX, translateY] = [translateY, -translateX]\n break\n case 180:\n case -180:\n ;[translateX, translateY] = [-translateX, -translateY]\n break\n case 270:\n case -90:\n ;[translateX, translateY] = [-translateY, translateX]\n break\n }\n\n const style: CSSProperties = {\n transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,\n transition: enableTransition ? 'transform .3s' : '',\n }\n if (mode.value.name === modes.CONTAIN.name) {\n style.maxWidth = style.maxHeight = '100%'\n }\n return style\n})\n\nconst computedZIndex = computed(() => {\n return isNumber(props.zIndex) ? props.zIndex : nextZIndex()\n})\n\nfunction hide() {\n unregisterEventListener()\n emit('close')\n}\n\nfunction registerEventListener() {\n const keydownHandler = throttle((e: KeyboardEvent) => {\n switch (e.code) {\n // ESC\n case EVENT_CODE.esc:\n props.closeOnPressEscape && hide()\n break\n // SPACE\n case EVENT_CODE.space:\n toggleMode()\n break\n // LEFT_ARROW\n case EVENT_CODE.left:\n prev()\n break\n // UP_ARROW\n case EVENT_CODE.up:\n handleActions('zoomIn')\n break\n // RIGHT_ARROW\n case EVENT_CODE.right:\n next()\n break\n // DOWN_ARROW\n case EVENT_CODE.down:\n handleActions('zoomOut')\n break\n }\n })\n const mousewheelHandler = throttle((e: WheelEvent) => {\n const delta = e.deltaY || e.deltaX\n handleActions(delta < 0 ? 'zoomIn' : 'zoomOut', {\n zoomRate: props.zoomRate,\n enableTransition: false,\n })\n })\n\n scopeEventListener.run(() => {\n useEventListener(document, 'keydown', keydownHandler)\n useEventListener(document, 'wheel', mousewheelHandler)\n })\n}\n\nfunction unregisterEventListener() {\n scopeEventListener.stop()\n}\n\nfunction handleImgLoad() {\n loading.value = false\n}\n\nfunction handleImgError(e: Event) {\n loading.value = false\n ;(e.target as HTMLImageElement).alt = t('el.image.error')\n}\n\nfunction handleMouseDown(e: MouseEvent) {\n if (loading.value || e.button !== 0 || !wrapper.value) return\n transform.value.enableTransition = false\n\n const { offsetX, offsetY } = transform.value\n const startX = e.pageX\n const startY = e.pageY\n\n const dragHandler = throttle((ev: MouseEvent) => {\n transform.value = {\n ...transform.value,\n offsetX: offsetX + ev.pageX - startX,\n offsetY: offsetY + ev.pageY - startY,\n }\n })\n const removeMousemove = useEventListener(document, 'mousemove', dragHandler)\n useEventListener(document, 'mouseup', () => {\n removeMousemove()\n })\n\n e.preventDefault()\n}\n\nfunction reset() {\n transform.value = {\n scale: 1,\n deg: 0,\n offsetX: 0,\n offsetY: 0,\n enableTransition: false,\n }\n}\n\nfunction toggleMode() {\n if (loading.value) return\n\n const modeNames = keysOf(modes)\n const modeValues = Object.values(modes)\n const currentMode = mode.value.name\n const index = modeValues.findIndex((i) => i.name === currentMode)\n const nextIndex = (index + 1) % modeNames.length\n mode.value = modes[modeNames[nextIndex]]\n reset()\n}\n\nfunction setActiveItem(index: number) {\n const len = props.urlList.length\n activeIndex.value = (index + len) % len\n}\n\nfunction prev() {\n if (isFirst.value && !props.infinite) return\n setActiveItem(activeIndex.value - 1)\n}\n\nfunction next() {\n if (isLast.value && !props.infinite) return\n setActiveItem(activeIndex.value + 1)\n}\n\nfunction handleActions(action: ImageViewerAction, options = {}) {\n if (loading.value) return\n const { minScale, maxScale } = props\n const { zoomRate, rotateDeg, enableTransition } = {\n zoomRate: props.zoomRate,\n rotateDeg: 90,\n enableTransition: true,\n ...options,\n }\n switch (action) {\n case 'zoomOut':\n if (transform.value.scale > minScale) {\n transform.value.scale = Number.parseFloat(\n (transform.value.scale / zoomRate).toFixed(3)\n )\n }\n break\n case 'zoomIn':\n if (transform.value.scale < maxScale) {\n transform.value.scale = Number.parseFloat(\n (transform.value.scale * zoomRate).toFixed(3)\n )\n }\n break\n case 'clockwise':\n transform.value.deg += rotateDeg\n emit('rotate', transform.value.deg)\n break\n case 'anticlockwise':\n transform.value.deg -= rotateDeg\n emit('rotate', transform.value.deg)\n break\n }\n transform.value.enableTransition = enableTransition\n}\n\nwatch(currentImg, () => {\n nextTick(() => {\n const $img = imgRefs.value[0]\n if (!$img?.complete) {\n loading.value = true\n }\n })\n})\n\nwatch(activeIndex, (val) => {\n reset()\n emit('switch', val)\n})\n\nonMounted(() => {\n registerEventListener()\n // add tabindex then wrapper can be focusable via Javascript\n // focus wrapper so arrow key can't cause inner scroll behavior underneath\n wrapper.value?.focus?.()\n})\n\ndefineExpose({\n /**\n * @description manually switch image\n */\n setActiveItem,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;mCAgHc,CAAA;AAAA,EACZ,IAAM,EAAA,eAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAbA,IAAA,MAAM,KAAyD,GAAA;AAAA,MAC7D,OAAS,EAAA;AAAA,QACP,IAAM,EAAA,SAAA;AAAA,QACN,IAAA,EAAM,QAAQ,UAAU,CAAA;AAAA,OAC1B;AAAA,MACA,QAAU,EAAA;AAAA,QACR,IAAM,EAAA,UAAA;AAAA,QACN,IAAA,EAAM,QAAQ,eAAe,CAAA;AAAA,OAC/B;AAAA,KACF,CAAA;AASA,IAAM,MAAA,EAAE,MAAM,SAAU,EAAA,CAAA;AACxB,IAAM,MAAA,EAAA,GAAK,aAAa,cAAc,CAAA,CAAA;AACtC,IAAM,MAAA,EAAE,eAAe,SAAU,EAAA,CAAA;AACjC,IAAA,MAAM,UAAU,GAAoB,EAAA,CAAA;AACpC,IAAM,MAAA,OAAA,GAAU,GAAwB,CAAA,EAAE,CAAA,CAAA;AAE1C,IAAA,MAAM,qBAAqB,WAAY,EAAA,CAAA;AAEvC,IAAM,MAAA,OAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AACxB,IAAM,MAAA,WAAA,GAAc,GAAI,CAAA,KAAA,CAAM,YAAY,CAAA,CAAA;AAC1C,IAAM,MAAA,IAAA,GAAO,UAA4B,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AACtD,IAAA,MAAM,YAAY,GAAI,CAAA;AAAA,MACpB,KAAO,EAAA,CAAA;AAAA,MACP,GAAK,EAAA,CAAA;AAAA,MACL,OAAS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AAA;AAGtB,MAAA,qBAAuB,EAAA,CAAA;AAAA,MACxB,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,OAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAED,KAAa,CAAA,CAAA;AAAA,IAIX,MAAA,CAAA;AAAA,MACD,aAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"image-viewer2.mjs","sources":["../../../../../../packages/components/image-viewer/src/image-viewer.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n isNumber,\n mutable,\n} from '@element-plus/utils'\n\nimport type { Component, ExtractPropTypes } from 'vue'\nimport type ImageViewer from './image-viewer.vue'\n\nexport type ImageViewerAction =\n | 'zoomIn'\n | 'zoomOut'\n | 'clockwise'\n | 'anticlockwise'\n\nexport const imageViewerProps = buildProps({\n /**\n * @description preview link list.\n */\n urlList: {\n type: definePropType<string[]>(Array),\n default: () => mutable([] as const),\n },\n /**\n * @description preview backdrop z-index.\n */\n zIndex: {\n type: Number,\n },\n /**\n * @description the initial preview image index, less than or equal to the length of `url-list`.\n */\n initialIndex: {\n type: Number,\n default: 0,\n },\n /**\n * @description whether preview is infinite.\n */\n infinite: {\n type: Boolean,\n default: true,\n },\n /**\n * @description whether user can emit close event when clicking backdrop.\n */\n hideOnClickModal: Boolean,\n /**\n * @description whether to append image itself to body. A nested parent element attribute transform should have this attribute set to `true`.\n */\n teleported: Boolean,\n /**\n * @description whether the image-viewer can be closed by pressing ESC.\n */\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n /**\n * @description the zoom rate of the image viewer zoom event.\n */\n zoomRate: {\n type: Number,\n default: 1.2,\n },\n /**\n * @description the min scale of the image viewer zoom event.\n */\n minScale: {\n type: Number,\n default: 0.2,\n },\n /**\n * @description the max scale of the image viewer zoom event.\n */\n maxScale: {\n type: Number,\n default: 7,\n },\n} as const)\nexport type ImageViewerProps = ExtractPropTypes<typeof imageViewerProps>\n\nexport const imageViewerEmits = {\n close: () => true,\n switch: (index: number) => isNumber(index),\n rotate: (deg: number) => isNumber(deg),\n}\nexport type ImageViewerEmits = typeof imageViewerEmits\n\nexport interface ImageViewerMode {\n name: string\n icon: Component\n}\n\nexport type ImageViewerInstance = InstanceType<typeof ImageViewer>\n"],"names":[],"mappings":";;;;;AAMY,MAAC,gBAAgB,GAAG,UAAU,CAAC;AAC3C,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,gBAAgB,EAAE,OAAO;AAC3B,EAAE,UAAU,EAAE,OAAO;AACrB,EAAE,kBAAkB,EAAE;AACtB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACpC,EAAE,MAAM,EAAE,CAAC,GAAG,KAAK,QAAQ,CAAC,GAAG,CAAC;AAChC;;;;"}
|
package/es/components/index.mjs
CHANGED
|
@@ -125,14 +125,14 @@ export { formItemProps, formItemValidateStates } from './form/src/form-item.mjs'
|
|
|
125
125
|
export { formContextKey, formItemContextKey } from './form/src/constants.mjs';
|
|
126
126
|
export { useDisabled, useFormDisabled, useFormSize, useSize } from './form/src/hooks/use-form-common-props.mjs';
|
|
127
127
|
export { useFormItem, useFormItemInputId } from './form/src/hooks/use-form-item.mjs';
|
|
128
|
-
export { iconProps } from './icon/src/
|
|
129
|
-
export { imageEmits, imageProps } from './image/src/
|
|
130
|
-
export { imageViewerEmits, imageViewerProps } from './image-viewer/src/image-
|
|
128
|
+
export { iconProps } from './icon/src/icon2.mjs';
|
|
129
|
+
export { imageEmits, imageProps } from './image/src/image2.mjs';
|
|
130
|
+
export { imageViewerEmits, imageViewerProps } from './image-viewer/src/image-viewer2.mjs';
|
|
131
131
|
export { inputEmits, inputProps } from './input/src/input.mjs';
|
|
132
132
|
export { inputNumberEmits, inputNumberProps } from './input-number/src/input-number.mjs';
|
|
133
133
|
export { linkEmits, linkProps } from './link/src/link.mjs';
|
|
134
134
|
export { menuEmits, menuProps } from './menu/src/menu.mjs';
|
|
135
|
-
export { menuItemEmits, menuItemProps } from './menu/src/menu-
|
|
135
|
+
export { menuItemEmits, menuItemProps } from './menu/src/menu-item2.mjs';
|
|
136
136
|
export { menuItemGroupProps } from './menu/src/menu-item-group.mjs';
|
|
137
137
|
export { subMenuProps } from './menu/src/sub-menu.mjs';
|
|
138
138
|
export { overlayEmits, overlayProps } from './overlay/src/overlay.mjs';
|
|
@@ -207,7 +207,7 @@ export { default as DynamicSizeList } from './virtual-list/src/components/dynami
|
|
|
207
207
|
export { default as FixedSizeGrid } from './virtual-list/src/components/fixed-size-grid.mjs';
|
|
208
208
|
export { default as DynamicSizeGrid } from './virtual-list/src/components/dynamic-size-grid.mjs';
|
|
209
209
|
export { virtualizedGridProps, virtualizedListProps, virtualizedProps, virtualizedScrollbarProps } from './virtual-list/src/props.mjs';
|
|
210
|
-
export { watermarkProps } from './watermark/src/
|
|
210
|
+
export { watermarkProps } from './watermark/src/watermark2.mjs';
|
|
211
211
|
export { vLoading as ElLoadingDirective, vLoading } from './loading/src/directive.mjs';
|
|
212
212
|
export { Loading as ElLoadingService } from './loading/src/service.mjs';
|
|
213
213
|
export { messageDefaults, messageEmits, messageProps, messageTypes } from './message/src/message.mjs';
|
|
@@ -102,8 +102,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
102
102
|
const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
|
|
103
103
|
const passwordIcon = computed(() => passwordVisible.value ? View : Hide);
|
|
104
104
|
const containerStyle = computed(() => [
|
|
105
|
-
rawAttrs.style
|
|
106
|
-
props.inputStyle
|
|
105
|
+
rawAttrs.style
|
|
107
106
|
]);
|
|
108
107
|
const textareaStyle = computed(() => [
|
|
109
108
|
props.inputStyle,
|